Trying to reply with a message

Posted in General by Jason Mon Oct 12 2020 04:11:35 GMT+0000 (Coordinated Universal Time)·1·Viewed 25 times

I am not sure what I am missing. I am able to start the server. Send a Private message to the bot. But the but does not respond. I am confused as to where I would put the code to respond. Here is what I have so far: include __DIR__.'/vendor/autoload.php'; use Discord\DiscordCommandClient; $discord = new \Discord\Discord([ 'token' => 'MY-TOKEN HERE', ]); $discord->on('ready', function ($discord) { echo "Bot is ready.", PHP_EOL; // Listen for events here $discord->on('message', function ($message) { echo "Recieved a message from {$message->author->username}: {$message->content}", PHP_EOL; }); }); $discord->registerCommand('ping', function ($message) { return 'pong!'; }, [ 'description' => 'pong!', ]); $discord->run();
Oct 17, 2020
// Listen for events here
$discord->on('message', function ($message) {
    return "Recieved a message from {$message->author->username}: {$message->content}", PHP_EOL;
Markdown is allowed