A Discord bot that plays music
clear: clear the queueleave: leave the voice channelpause: pause the current songplay <song>: play a song, this can be a youtube url or a search queryqueue: show the current queueresume: resume the current songshuffle: shuffle the queueskip: skip the current songstop: stop the current song and clear the queue
First of all make sure you have Rust installed. You can find the official installation guide here.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shNote
You might need to add the following if you are using linux
sudo apt update
sudo apt install build-essential libc6-dev cmake pkg-config libopus-devThis bot uses yt-dlp to search and stream audio. For installation instructions, you can refer to the official yt-dlp installation guide.
Note
When installing yt-dlp through pip, you might need to add the following to your .bashrc / .zshrc
export PATH="$HOME/.local/bin:$PATH"
- Navigate to the Discord Developer Portal.
- Select your application.
- Under the "OAuth2" > "URL Generator" section, select the
botandapplications.commandsscopes. - A URL will be generated at the bottom of the page. Copy this URL and paste it into your browser.
- Select the server you want to add the bot to and click "Authorize".
- Back in the Discord Developer Portal, go to the "Bot" page.
- Under "Privileged Gateway Intents", ensure "Message Content Intent" is enabled if your bot needs to read message content.
- Under "Bot Permissions", grant the bot "Administrator" rights. Alternatively, you can enable all necessary voice and text-related permissions individually for more granular control.
Copy the .env.example file to .env and fill in the values.

