I have a problem with Conversation. I wrote the following code in Conversation:
if (ctx.session.in_conversation == true) return;
conversation.session.in_conversation = true;
await ctx.replyWithChatAction("typing");
await ctx.reply("Mahsulot nomini kiriting:", {
reply_markup: cancelKeyboard,
});
const nameMsg = await conversation.waitFor(["message"], {
otherwise: () => ctx.reply("Iltimos matn ko'rinishida kiriting!"),
});
const name = nameMsg.message?.text;
if (name == "❌ Bekor qilish") {
conversation.session.in_conversation = false;
await ctx.reply("♂️ Amal bekor qilindi", { reply_markup: mainKeyboard });
return;
}
await ctx.reply("Mahsulot haqida ma'lumot:");
const descryptionMsg = await conversation.waitFor(["message"]);
let descryption = descryptionMsg.message.text;
await ctx.reply(`${descryption}`);
conversation.session.in_conversation = false;
return;
Conversation is stopping by itself without returning any error.
await ctx.reply("Mahsulot haqida ma'lumot:");
The text has been sent and the conversation is stuck. Where did I go wrong?
All are working until 2nd reply. But nothing is working after that. replies, conversation logs ... nothing. I solved the previous ones by completely deleting the conversation or rebuilding the project from 0.