我正在尝试欢迎组中的用户,我在我的handle()方法中有以下代码-
public function handle(Request $request)
{
$botman = app('botman');
$botman->on('new_chat_members', function($payload, $bot) {
$bot->reply($payload);
});
$botman->hears('/help', function ($bot) {
$result = '/hi - hello';
$bot->reply($result, [
'parse_mode' => 'Markdown'
]);
});
$botman->fallback(function ($bot) {
$bot->reply("Sorry, I did not understand these commands. Try: /help");
});
$botman->listen();
}但如果我将任何人添加到组中,我看不到任何东西。我是不是漏掉了什么?
发布于 2017-12-15 22:42:47
我找到问题了。这一行$bot->reply($payload);就是问题所在。我是PHP、Laravel和Botman的新手。我认为,它不能发送对象作为回复。一旦将其替换为
$bot->reply($payload[0]['first_name']);
啊,真灵。我至少可以看到加入组的用户的名字。
https://stackoverflow.com/questions/47833753
复制相似问题