Closed expelliamus closed 4 years ago
you can use "native" telegraf for handling"unsupported" commands. Add a middleware after the middlewares which handle the supported commands. For example like this:
bot.command('start', ctx => ctx.reply('was started'))
bot.command(/.+/, ctx => ctx.reply('unsupported))
You can define any middleware in the last statement.
I personally prefer to reply with an explanation what happened and that the user did something unexpected. But containing something like 'You can open the main menu with /start' so the user only has to tap / click on that one to find his way.
Alternatively you can use const middleware = menu.replyMenuMiddleware()
and use this middleware to always respond with the menu.
Hi,
is there a way to handle all unsupported commands? Suppose I have:
if the user write in the chat "hello world" or some other messages, I would like to display a default reply, how can I do this?
Thanks.