Fully modular, multifunctional, self-hosted Discord bot built with the Discord.js library.
Command | Description |
---|---|
!help |
Returns command descriptions. |
!ping |
Returns response time. |
!roll <sides> |
Rolls dice. |
!scramble <number of teams> <team size> <players> |
Returns randomized teams. |
Command | Description | Permissions |
---|---|---|
!ban <user> <reason> |
Bans the given user with an optional reason. | Ban Members |
!kick <user> <reason> |
Kicks the given user with an optional reason. | Kick Members |
!unban <user> <reason> |
Unbans the given user with an optional reason. | Ban Members |
!prune <number of messsages> <user> |
Deletes the given number of messages in general or from a given user. | Manage Messages |
Command | Description |
---|---|
!play <title/link> |
Plays the given link or searches YouTube for the song and displays results. |
!song |
Returns information about the song currently playing. |
!queue |
Returns the music queue. |
!pause |
Pauses the currently playing song. |
!resume |
Resumes the paused song. |
!skip |
Plays the next song in the queue. |
!stop |
Disconnects the bot from the voice channel and clears the queue. |
!remove <index> |
Removes the song at the given index from the queue. |
!shuffle |
Randomizes the order of songs in the queue. |
Download and install Git and Node.
# Navigate to directory to install bot in
cd C:/Discord
# Download the bot
git clone https://github.com/RhyDev/RhyBot.git
# Enter the bot folder
cd RhyBot
# Install dependencies
npm install
- Go to https://discordapp.com/developers/applications/me
- Click
New App
- Name your bot and give it a profile picture
- Click
Create App
- Click
Create a Bot User
- Copy the
Client ID
and replaceCLIENT_ID
here https://discordapp.com/oauth2/authorize?client_id=CLIENT_ID&scope=bot - Authorize the bot on your server(s)
Note that this requires
Manage Server
permissions.
Navigate to your bot folder and create a new file config.json
, the file should be in the same folder as bot.js
, and paste the following:
{
"token": "BOT_TOKEN",
"prefix": "!",
"ytapi": "YT_API_KEY"
}
Replace BOT_TOKEN
with your Discord Bot Token and YT_API_KEY
with your YouTube API Key, refer to the Tokens section below.
You can set prefix
to whatever phrase you want to trigger bot commands, e.g. !ban or rhy.ban.
# Navigate to bot directory
cd C:/Discord/RhyBot
# Run the bot
node bot.js
If the bot is running successfully,
Logged in as X!
should be logged in the console.
# Navigate to bot directory
cd C:/Discord/RhyBot
# Update the bot
git pull
# Update dependencies
npm update
To create a new command, simply create a new JavaScript file in /commands
with format like mycommand.js
then paste the following skeleton:
function run(client, msg, args) {
}
const help = {
name: '',
type: '',
args: '',
desc: ''
};
module.exports = {
run,
help
};
Refer to Discord.js docs or other commands for syntax.
Keep your tokens secret!
- Go to https://discordapp.com/developers/applications/me
- Select your bot
- In the Bot window reveal its token
- Go to https://console.developers.google.com/apis/credentials
- Click
Create crendentials
- Select
API key
from the drop-down menu
Note that YouTube API calls are limited
- Added FFMPEG files required for bot voice connection
- Changed * dependencies to correct versions to ensure package compatibility
- Changed permission levels for mod commands to reflect each command instead of
ADMINISTRATOR
- Now checks if bot has permissions for mod commands
- Updated README with command list, fixed formatting errors