0

I have a command to get some suggestion/criticism in some specific categories that are shown as some InlineKeyboardButton. first user touch one of them and then should be send a simple text as suggestion/criticism.

this is my command:

class SuggestionCommand extends SystemCommand
{
    protected $name        = 'suggestion';                     // Your command's name
    protected $description = 'Suggestion Command';             // Your command description
    protected $usage       = '/suggestion';                    // Usage of your command
    protected $version     = '1.0.0';                          // Version of your command

    public function execute()
    {
        $inlineKeyboard = new InlineKeyboard([]);

        $inlineKeyboard->addRow(new InlineKeyboardButton([
            'text'          => 'Sellers',
            'callback_data' => 'suggestion_sellers'
        ]), new InlineKeyboardButton([
            'text'          => 'Products',
            'callback_data' => 'suggestion_products'
        ]));


        $chat_id = $this->getMessage()->getChat()->getId();

        $data = [
            'chat_id'      => $chat_id,
            'text'         => 'In which of the following areas is your suggestion / criticism: ',
            'reply_markup' => $inlineKeyboard
        ];

        return Request::sendMessage($data);
    }
}

What I want to do is do that is when user enter his text I want to recognize which button is touched in The previous step because I want to do other actions based on that button.

is there any way to do that?

Ahmad Badpey
  • 6,348
  • 16
  • 93
  • 159

1 Answers1

0

You need to get the callback_data value and store it in a database or JSON file. Then store the upcoming message as a reply to this value.

Brian B
  • 80
  • 1
  • 9