Credit to Pawel Bes Code Edited By Riyadh Alzahrani
Since a lot of discord music bots are being blocked by youtube nowadays I've decided to write up a quick project that will allow anyone to host their own discord bot. This bot includes the following commands:
/help
- displays all the available commands/p "keywords"
- finds the song on youtube and plays it in your current channel. Will resume playing the current song if it was paused/q
- displays the current music queue/skip
- skips the current song being played/clear
- Stops the music and clears the queue/leave
- Disconnected the bot from the voice channel/pause
- pauses the current song being played or resumes if already paused/resume
- resumes playing the current song
To run the discord bot all you need is python 3.4
or above.
install dependencies of the python that are needed for the bot.
youtube_dl:
pip install youtube_dl
ffmpeg:
pip install ffmpeg
PyNaCl:
pip install PyNaCl
Please note that you will need to have ffmpeg installed and make sure that the path to the bin folder is in your environment variables.
Add your Bot Token by going to the DEVELOPER PORTAL then...
- Login by using your discord account.
- Create New Application .
- Go to Bot then Add Bot .
- Reset Token then Copy the new Token the Paste it in the File Token in the Bot folder .
- Go to Privileged Gateway Intents and Enable
PRESENCE INTENT
,SERVER MEMBERS INTENT
,MESSAGE CONTENT INTENT
. - You are done installion .
- To invite the Bot to ur server go to
OAuth2
->URL Generator
. - Set the
SCOPES" to "Bot
. - Set the
BOT PERMISSIONS
what ever the Bot Needs or just set it toAdministrator
. - Copy the
GENERATED URL
the Paset it in the Browser then Invite your Bot like any other Bot.
To create a bot follow Pawel Bes tutorial.
This will guide on how to create a bot.
Lastly you'll need to deploy your bot.
Navgate to the Bot Folder in the CMD
then...
python main.py
or just open the folder in Visual Studio Code Then Run
the main.py file or Run and Debug
the main.py
file
You can follow Pawel Bes other tutorial on deploying with docker the gist is to have a server setup with all the dependencies and then run
python main.py
.