conversation doesn't continue after using conversation.session
Closed this issue · 1 comments
eedea commented
Hi,
I Used conversation.session to store data in session in middle of conversation and it looses track of conversation after sending one response!
conversation.session.facilities = await conversation.external(() =>
facilitiesList(user.id)
);
await ctx.reply("please choose a facility", {
reply_markup: facilitiesMenu,
});
const { session } = await conversation.waitFor("callback_query:data");
const facilityID = session.selectedFacility;
await ctx.reply("Please send contact number.");
const { message } = await conversation.waitFor("message:contact");
it goes down to "await ctx.reply("Please send contact number.");" but there is no response to sending contact after it
KnorpelSenf commented
You have to use conversation.session
always. ctx.session
, which is what you're calling when you do const { session } = await conversation.wait…
, is frozen in time and will not persist its changes. This is documented: https://grammy.dev/plugins/conversations#rule-iii-use-convenience-functions