A
A
Alisa Unylova2020-04-05 02:12:10
PHP
Alisa Unylova, 2020-04-05 02:12:10

After the callback is called, the script is run again. Telegram bot api, inline keyboard?

There is a script that sends a message with an inline keyboard, when pressed, another message should come. But it turns out that after pressing the keyboard, the script works from the very beginning, sending everything again.

$inline_button1 = array("text"=>"Принять заявку","callback_data"=>"/take");
    $inline_keyboard = ;
    $keyboard=array("inline_keyboard"=>$inline_keyboard);
    $replyMarkup = json_encode($keyboard); 
    $msg = "новая заявка например";
    sendMessage($chat_id,$msg, $replyMarkup);
switch($data){
    case '/take':
    $take_msg = "Заявка принята ".$callback_user;    
    sendReply($chat_id, $take_msg, $message_id);
    break;
}

Script fired after submitting the form5e89144927cb5613371673.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arthur, 2020-04-05
@ar2rsoft

You can make a check, and not send this button in cases where it is not needed. Well, as an option.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question