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() 函数在 botman 中不存在,但我把它用来澄清这个想法

4

0 回答 0