isRequestValid()) { $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'); }); // Only on message, not on event or whatever if (!$request->isMessage()) { return ; } $message = $request->getMessage(); $bot->listen($message);