Eleirbag89 / TelegramBotPHP

A very simple PHP Telegram Bot API for sending messages.
http://eleirbag89.github.io/TelegramBotPHP
MIT License
809 stars 341 forks source link

How to send a command by clicking a button | showing Different Text and sending different one #139

Closed emobin closed 6 years ago

emobin commented 6 years ago

How can I create a ReplyKeyboardButton with a specified text, which sends a specified command when it is being clicked.

For example the text is "Yes" and when I click yes, it sends /1 as a command.

Following picture is from Telegram documentation which demonstrate the idea:

https://core.telegram.org/file/811140184/1/5YJxx-rostA/ad3f74094485fb97bd

Eleirbag89 commented 6 years ago

From the Telegram Doc: KeyboardButton:
text -> Text of the button. [...] it will be sent as a message when the button is pressed

So i guess the bot recognize the Text of the button as a command