This repository contains code to build a music bot for any Discord servers, allowing users to stream their favorite YouTube music directly in voice channels.
The Discord bot supports the following commands:
| Commands | Description |
|---|---|
| !add <url or query> | Adds a YouTube audio source to the playlist. |
| !blacklist | Shows the blacklists for each command. |
| !chat <message> | Chats with the bot. |
| !help | Displays a list of available commands. |
| !id | Shows the IDs in the current discord server. |
| !join | Makes the bot join the author's current voice channel. |
| !leave | Disconnects the bot from the voice channel. |
| !pause | Pauses the currently playing audio source. |
| !play | Starts playing the audio source from the playlist. |
| !reset | Stops the currently played audio source and clears the playlist. |
| !role <cmd or all> <id1> ... <idN> | Blacklists specified roles for a command. |
| !show <n> | Lists the first n audio sources in the playlist. |
| !skip | Skips the currently playing audio source. |
| !text_channel <cmd or all> <id1> ... <idN> | Blacklists specified text channels for a command. |
| !timeout <ts> | Adjusts the bot's timeout duration. |
| !user <cmd or all> <id1> ... <idN> | Blacklists specified users for a command. |
| !voice_channel <cmd or all> <id1> ... <idN> | Blacklists specified voice channels for a command. |
| !volume <vol> | Modifies the playback volume of the audio source. |
- Clone the Repository
Clone the repository to your local machine:
git clone https://github.com/nobodyPerfecZ/discord-bot.git- Adjust the config.yaml file
The config.yaml file defines the bot's default settings, including which roles are allowed to use specific commands and in which text channels commands can be executed.
- Add your Discord Token to compose.yaml file
In the compose.yaml file, locate the TOKEN key and add your Discord API token there. This token is required for the bot to connect to your Discord server.
- Build application with Docker
Ensure Docker and Docker Compose are installed on your system. If not, refer to the Docker installation guide. Once installed, you can build and run the Discord bot using Docker Compose with the following command:
sudo docker compose up -d --buildAfter running this command, the Discord bot should start and appear online in your Discord server.
Contributions are welcome! Please fork the repository and submit a pull request. Make sure to follow the coding standards and write tests for any new features or bug fixes.
