Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I have my Bot respond with arguments?

Tags:

So I've built a Telegram bot, which can receive the following commands:

  • /list
  • /info 123

This works great, as I can catch /info and pass the additional arguments as ints. But, sadly, the Telegram clients don't see /info 123 as a complete command, but just the /info part. Is there a way to make it recognize the entirety of the command as the command?

I've tried Markdown-ing it: [/info 123](/info 123), but no joy. Is this possible?

like image 448
Mave Avatar asked Mar 17 '16 11:03

Mave


People also ask

Why is bot not working?

Bot does not work in Web Chat There could be a number of reasons why a bot doesn't work. Most likely, the bot application is down and cannot receive messages, or the bot receives the messages but fails to respond. Here are some of the possible causes: The bot is down and cannot be reached.


1 Answers

I've reached out to @BotSupport with the same question, and he/they/it responded swiftly with the following answer:

Hi, at the moment it is not possible to highlight parameters of a command. I any case, you may can find a workaround if you use correct custom keyboards ;) — @BotSupport

Custom keyboards may be an option for someone, but not for me. The solution I've gone for is to give the command as /info123. As the bot receives all / commands, I check if the received command starts with info, and if so, I remove the info part. I convert the remaining string/int to arguments, and pass that along to the relevant command.

like image 126
Mave Avatar answered Sep 29 '22 01:09

Mave