当我在Botman的Keyboard中单击按钮时,如何获取callbackData?

问题描述

$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中不存在,但我将其弄清楚了

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)