P
P
part_os2020-05-28 12:09:42
PHP
part_os, 2020-05-28 12:09:42

How to understand that there was a response to a button in Telegram?

Hello everyone, using irazasyed/telegram-bot-sdk
Wrote a web hook handler, and a small chain of keyboards.
The question is how to understand after pressing the button and sending a text response that this text message is the answer to the previously pressed button.
https://i.imgur.com/B4BJwZ7.png

Answer the question

In order to leave comments, you need to log in

3 answer(s)
P
part_os, 2020-10-29
@part_os

finally wrote a small workflow

V
Vitaly, 2020-06-02
@qavitalii

Hello. Use State in callback

H
hesy, 2020-06-03
@hesy

https://github.com/aethletic/botify#-states

$bot->setState('how_much_is');

$bot->state('how_much_is')
    ->hear('{default}', function () use ($bot) {
        $count = (int) $bot->message;
        $bot->say("Ты выполнил {$count} раз?");
    }
)

// or

if ($bot->state_name == 'how_much_is' && $bot->message !== 'СТОП СЛОВО ДЛЯ ВЫХОДА ИЗ СТЕЙТА') {
    // code...
} else {
    $bot->clearState();
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question