isValid()) { $bot->reply('I received an invalid request'); exit; } // Give the bot something to listen for. foreach ($bot->listCommands() as $command) { $bot->hears(call_user_func([$command, 'getPattern']), $command); } $bot->hears('(hello|hi|bonjour|salut)', function (Bot $bot) { $bot->replyPolitely('Bonjour'); }); if (!$request->isMessage()) { exit(); } $bot->listen($request->getMessage());