question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to handle unsupported commands?

See original GitHub issue

I am using webhooks with Koa as mentioned in examples. But on unsupported commands, Telegraph is returning back with 404 Not Found which makes telegram keep retrying. I want to rather reply with a message saying that this command is not supported. Is there an existing way to do that?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
sidoshicommented, May 10, 2018

Also Is there a way to send a default response to any kind of interaction other than explicitly allowed. I know I can listen for all events, but is there a better way?

It works well with text messages. What I meant was other kinds of interactions like sending media or locations. I assumed that text would only set the default for text messages. Other messages like media would still receive 400 since no defaults are found and hence Telegram would keep retrying.

I should have just checked first instead of assuming that and asking, sorry for that 😦 Anyways, I have tried it and verified that

bot.on('message', ctx => ctx.reply('Default reply'));

sets default for all kinds of messages.

I will go ahead and close this. Thank you 🙂

1reaction
Otto-AAcommented, May 10, 2018

I am not sure how/if this works with Koa but in Node.js you can listen all unhandled messages like this:

/* ... all your commands above ... */

// Default response
bot.on('text', ctx => ctx.reply('Default reply'));

If you only want this for commands you can look if the first letter of the message is a /

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to handle unsupported commands? · Issue #53 - GitHub
Hi,. is there a way to handle all unsupported commands? Suppose I have: const menu = new TelegrafInlineMenu(ctx => ctx.i18n.t('welcomeMsg', { ...
Read more >
How to handle unsupported system commands in Python?
I would like to ask if there is any solution to handle unsupported system command in Python. E.g.:
Read more >
Unsupported Commands in Cisco IOS Release 12.2(50)SE
The unsupported commands are listed by software feature and command mode. Access Control Lists. Unsupported Privileged EXEC Commands.
Read more >
Unsupported Commands in Atlas - MongoDB
If you use an unsupported command or invalid syntax, Atlas returns the following error message: <$command> is not allowed or the syntax is...
Read more >
You are using an unsupported command-line flag - Abode QA
“You are using an unsupported command-line flag –ignore-certificate-errors. Stability and security will suffer.” Handling in WebDriver using ChromeOptions() · “ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found