S
S
Sasha42242020-11-19 10:15:22
PHP
Sasha4224, 2020-11-19 10:15:22

How to make buttons in a telegram bot replace commands?

Hello, I have a bot that works on commands (Example: /help). How can I add buttons to the bot so that when I click on the button, the command that I specify is automatically entered.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vasily Bannikov, 2020-11-19
@vabka

easy to google "php telegram bot keyboard"
https://telegram-bot-sdk.readme.io/docs/keyboards

A
Alex, 2020-11-19
@Kozack

If I understand you correctly, then most likely not. There is a keyboard API, but you can't assign a custom action. A button in such a keyboard enters only the next text that is written in it.
TG clients themselves create an interface for quickly entering commands, so there is no need to create your own keyboard for this.

B
Belarus007, 2020-11-19
@Belarus007

Attach a callback of the c=help type to the buttons, set up a callback query handler on the bot itself, which will look at this same c= and execute the command

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question