You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* When a User says "ping", the Bot will reply "pong"
*
* Getting a User message content requries the Message Content Privileged Intent
* @link http://dis.gd/mcfaq
*
* Run this example bot from main directory using command:
* php examples/ping.php
*/
include__DIR__.'/../vendor/autoload.php';
// Import classes, install a LSP such as Intelephense to auto complete imports
useDiscord\Discord;
useDiscord\Parts\Channel\Message;
useDiscord\WebSockets\Intents;
// Create a $discord BOT
$discord = newDiscord([
'token' => '', // Put your Bot token here from https://discord.com/developers/applications/
'intents' => Intents::getDefaultIntents() | Intents::MESSAGE_CONTENT// Required to get message content, enable it on https://discord.com/developers/applications/
]);
// When the Bot is ready
$discord->on('init', function (Discord$discord) {
// Listen for messages
$discord->on('message', function (Message$message, Discord$discord) {