Reputation: 13
I've set up a simple telegram bot application but I'm struggling with message interception for a specific menu button.
bot.start((ctx) => ctx.reply('start handler', {
reply_markup: JSON.stringify({
reply_to_message_id: ctx.message.message_id,
resize_keyboard: true,
keyboard: [
[{text: 'ZIP'}, {text: 'birthday'}],
]
})
}));
bot.hears('ZIP', (ctx) => ctx.reply('input your ZIP code', {
reply_markup: JSON.stringify({
resize_keyboard: true,
keyboard: [
['Отмена']
]
})
}));
bot.hears('birthday', (ctx) => ctx.reply('input day only', {
reply_markup: JSON.stringify({
resize_keyboard: true,
keyboard: [
['Отмена']
]
})
})
);
What kind of approach should I use to listen to answer in a 'ZIP' menu for example. I don't want that general listeners will listen for this answer. How could I understand that the answer comes from the 'ZIP' button??
Upvotes: 0
Views: 1110
Reputation: 7548
You may choose to use inline keyboards instead (if you want to 100% accurately listen to updates only from the menu)
That being said there are some workarounds you might consider if you want to keep using reply keyboards and avoid the confusion..
Upvotes: 1