0
$this->bot->hears('[\s\S]+',function(BotMan $bot){
            $input = $bot->getMessage()->getText();
            $k = Keyboard::create()->type( Keyboard::TYPE_KEYBOARD )
                ->oneTimeKeyboard(true)
                ->addRow(
                    KeyboardButton::create("Cat")->callbackData('c'),
                    KeyboardButton::create("Dog")->callbackData('d')
                )
                ->toArray();

            if ($bot->getcallbackData() == 'c')//Here I need to check callbackData from clicked button
            {
                $bot->reply('you clicked on Cat');
            }
            else
            {
                $bot->reply('you clicked on Dog');
            }
        });

getcallbackData() function is not exists in botman but i put it to Clarify the idea

Ibrahim
  • 5
  • 3
  • so you create two buttons c and d, then why are you not using addButtons() – bhucho Oct 15 '20 at 16:39
  • You are right , but guess I want to use keyboard then how to get callbackdata so I know which button the user has clicked on? – Ibrahim Oct 15 '20 at 20:31

0 Answers0