D
D
Dmitry2020-02-20 10:44:53
PHP
Dmitry, 2020-02-20 10:44:53

Why does telegram bot give multiple response when clicking on inlinekeyboard?

When you click on the inline keyboard button, the bot displays many messages instead of one
How to overcome this?

Here is my code

$bot->on(function($update) use ($bot, $callback_loc, $find_command){
    $callback = $update->getCallbackQuery();
    $message = $callback->getMessage();
    $chatId = $message->getChat()->getId();
    $data = $callback->getData();


    $bot->sendMessage($chatId, "Вы выбрали $data\n");
}, function($update){
    $callback = $update->getCallbackQuery();
    if (is_null($callback) || !strlen($callback->getData()))
        return false;
    return true;
});

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