📅  最后修改于: 2022-03-11 14:54:53.393000             🧑  作者: Mango
use BotMan\BotMan\BotMan;
use BotMan\BotMan\Messages\Incoming\Answer;
public function handle()
{
$botman=app("botman");
$botman->hears("{message}",function($botman,$message)
{
if($message=="hi")
{
$this->askName($botman);
}
else
{
$botman->reply("kindly write hi to start the talk");
}
});
$botman->listen();
}
public function askName($botman)
{
$botman->ask("Hello what is your name",function(Answer $answer)
{
$name=$answer->getText();
$this->say("Nice to meet you"." ".$name);
});
}