MMRIZE / MMM-TelegramBot

TelegramBot module for remote-controlling MagicMirror
MIT License
26 stars 8 forks source link

Make use of /setcommands to enable command suggestions in telegram #34

Closed Barokai closed 4 years ago

Barokai commented 4 years ago

Description Sending/setcommands to telegram botfather allows to you use the / button in the chat input box which then shows all available commands and descriptions just like sending /commands to MMM-TelegramBot does. But using it like this enables suggestions when starting a command with / and writing the first few characters.

From docu https://core.telegram.org/bots /setcommands: Users will see the list of commands whenever they type ‘/’ in a conversation with your bot.

Problem But i encounterd following problems when setting it up: i sent /setcommands to BotFather, chose my MMM-TelegramBot and wasn't able to submit my commands i've copied from the output of /setcommands Botfather output

Sorry, the list of commands is invalid. Please use this format:

command1 - Description
command2 - Another description

Solution The solution was to have all commands in lowercase and the descriptions max. 32 charaters long.

Request Could you please add some kind of howto for others? Could be really helpful in my opinion, thx a lot!

eouia commented 4 years ago

You are talking about shorter description suggestion?

Barokai commented 4 years ago

Basically yes (and writing commands in lowercase only), and adding the how-to steps to the wiki then :)

eouia commented 4 years ago

Ok. Thanks. English is not my mother tongue, so sometimes hard to catch the meanings. I’ll do it soon.

eouia commented 4 years ago

I added some guides on wiki. Thanks. (I open the wiki publicly now. You can edit if you think more explanation is needed.)

Barokai commented 4 years ago

No problem, it isn't my mother tongue too :)

If you need some help, let me know

eouia commented 4 years ago

For additional info; Description of each command in /commands would be cut on its first sentence period(.) or line-break(`\n') automatically. Anyway, it's better explicitly address it would be 32 chars max. (I considered auto cutting 32chars, but there is only one issue, markdown broken. Telegram API doesn't handle markdown gracefully, so when markdown is broken, it will spit error. To check markdown broken is too over-spec in my thought. :D)