简体   繁体   English

botman 中的默认消息

[英]Default message in botman

I'm testing botman in Laravel and it works very well.我正在 Laravel 中测试 botman,它运行良好。 But I can not find how to put a message by default.但是我找不到默认情况下如何放置消息。 Can someone give me an orientation ?有人可以给我一个方向吗?

$botman->hears('Hi', function ($bot) {
    $bot->reply('Hello!');
});

BotMan allows you to create a fallback method, that gets called if none of your "hears" patterns matches. BotMan 允许您创建回退方法,如果您的“听到”模式均不匹配,则会调用该方法。 You may use this feature to give your bot users guidance on how to use your bot.您可以使用此功能为您的机器人用户提供有关如何使用您的机器人的指导。

$botman->fallback(function($bot) {
$bot->reply('Sorry, I did not understand these commands. Here is a list of commands I understand: ...');

}); });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM