A
A
Alexey2021-10-28 01:43:25
PHP
Alexey, 2021-10-28 01:43:25

How to attach buttons to sendGame method in telegram bot API?

I call https://api.telegram.org/bot_token/sendGame with parameters in POST:

$option = ['chat_id' => '12345689', 'game_short_name' => 'name_game'];

so everything works fine, he attaches the inline button "PLAY name_game" and sends a message with the game, but if I add the buttons myself, it doesn't work:

$keyboard = json_encode(["inline_keyboard" => [
            ,
            
        ]]);
$option = ['chat_id' => '12345689', 'game_short_name' => 'name_game', 'reply_markup' => $keyboard];

the answer comes: Bad Request: REPLY_MARKUP_GAME_EMPTY

* the inline_keyboard itself is compiled correctly and works fine with the SendMessage method, but it does not work with sendGame because there is a rule that the first button of sendGame should be the game button, and how to do it is not clear
* I will be glad to solve this questions in any language

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question