PHP code example of jacknoordhuis / discord-php
1. Go to this page and download the library: Download jacknoordhuis/discord-php library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jacknoordhuis / discord-php example snippets
iscord\Discord;
$discord = new Discord([
'token' => 'bot-token',
]);
$discord->on('ready', function ($discord) {
echo "Bot is ready!", PHP_EOL;
// Listen for messages.
$discord->on('message', function ($message, $discord) {
echo "{$message->author->username}: {$message->content}",PHP_EOL;
});
});
$discord->run();