- 听到和后备都很好:
use App\Http\Controllers\BotManController;
use BotMan\BotMan\Messages\Conversations\Conversation;
$botman = resolve('botman');
$botman->hears('Начать', function($bot) {
$bot->startConversation(new OnboardingConversation);
}); //this works
$botman->fallback(function($bot) {
$bot->startConversation(new OnboardingConversation);
}); //this works
- 有 VK 驱动程序的组内听到NOT WORKS,但后备WORKS:
use App\Http\Controllers\BotManController;
use BotMan\BotMan\Messages\Conversations\Conversation;
$botman = resolve('botman');
$botman->group(['driver' => [VkCommunityCallbackDriver::class]], function($botman) {
$botman->hears('Начать', function($bot) {
$bot->startConversation(new OnboardingConversation);
}); //this NOT works
$botman->fallback(function($bot) {
$bot->startConversation(new OnboardingConversation);
}); //this works
});
我想做的一切——例如用于 VK 和 Telegram 的通用机器人,但我需要检查用户是否在目标平台的黑名单中,所以如果“驱动程序”类似于来自 botman 的“MatchingMiddleware”——我不明白为什么听到在“组”内不起作用,这是来自网站的官方示例: 官方 botman 视频教程截图
这个例子也不起作用:https ://botman.io/2.0/receiving#command-groups-drivers
在 VK Driver 网站上没有关于“组”的信息:https ://github.com/yageorgiy/botman-vk-community-callback-driver