L
L
Leonid2020-07-16 14:07:42
PHP
Leonid, 2020-07-16 14:07:42

How to hide them after pressing the buttons in a message from Telegram-Bot?

There is a Telegram-Bot, I use the library: https://github.com/irazasyed/telegram-bot-sdk

The bot sends a message to the user with two buttons.
The user presses one of the buttons - the request is sent and the buttons are hidden from this message - is this possible?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
Leonid, 2020-07-17
@easycode

I figured it out and here is a small example (clipping):

$telegram = new Telegram\Bot\Api('XXXXXXXXXXXXXXXXXXXX');
$update = $this->telegram->getWebhookUpdates();
$update = json_decode($this->update, true);

$keyboard = Keyboard::make()->inline()->row(Keyboard::inlineButton(['text' => 'One more?','callback_data' => '/random']));

$telegram->editMessageText([
    'chat_id' => $update['callback_query']['message']['chat']['id'],
    'message_id' => $update['callback_query']['message']['message_id'],
    'text' => 'Ответочка',
    'reply_markup' => $keyboard,
    'parse_mode' => 'markdown',
]);

A
Alexander, 2020-07-16
@Mrsnek007

Read about ReplyKeyboardRemove

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question