E
E
Evgeny2022-01-12 09:19:43
PHP
Evgeny, 2022-01-12 09:19:43

Telegram bot doesn't handle inline keyboard?

I wrote a bot that, on command, should display a message with a dynamic inline keyboard, but it only displays an error - Bad Request: can't parse inline keyboard button: InlineKeyboardButton must be an Object

for ($i = 0; $i < $array_count; $i++) {
        $token_get = secret_token_get($user_id)[$i];
        $token_symbols = substr($token_get['token'], -5);

        global $buttons;
        $buttons = secret_token_get($user_id);
        $buttons = array_map(function ($token_symbols) {
            return [];
            }, $buttons);
        }
    $post = [
        'chat_id' => $user_id,
        'text' => '<b>All your private tokens are listed here: </b>',
        'parse_mode' => 'html',
        'reply_markup' => inline_keyboard($buttons)
    ];
    sendRequest('sendMessage', $post);


Answer from Telegram:

{
"chat_id": 915597301,
"text": "<b>All your private tokens are listed here: </b>",
"parse_mode": "html",
"reply_markup": "{\"inline_keyboard\":[,,]}"
}

Bad Request: can't parse inline keyboard button: InlineKeyboardButton must be an Object

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