This is a simple Discord Music bot that plays music 24/7 looping thorugh the available ones in directory. To run this bot we need to several packages such as PyNaCl, discord.py
Use the package manager pip
To install discord.py
python3 -m pip install -U discord.py
To install PyNaCl
pip install pynacl
To install youtube_dl
pip install youtube_dl
You also need to install FFmpeg API key for song lyrics should be acquired from Genius
This is a discord bot made using the lastest discord.py api as of march 2021. This bot plays mp3 file from the storage i.e. all the mp3 files available to play from the file of your bot. I did this program in python language and have used discord.py , youtube_dl , PyNaCl , FFmpeg and several other packages and api's. Initially this bot was build on repl.it IDE and can run for infinite time i.e. it will be online continuously using Uptimerobot
-
Create a
python
virtual environment.I did in repl.it -
Clone the repo
git clone https://github.com/DivyaKumarBaid/Discord_Music_bot.git
or download the repository. -
Go to the cloned/downloaded directory
cd Discord_Music_bot
-
Upload it in
repl.it
-
Create a bot in discord developers portal
-
Copy the
Token
of the bot and paste it in the.env
file asTOKEN
-
Run the bot on
repl.it
-
Copy the
url
that appears on the right side of window -
Go to Uptimerobot and create a monitor and paste the copied
url
and start the monitor.This will keep the bot alive even after you close it.For more precise steps have a look at FreeCodeCamp
add This adds a music to the playlist. The url must be of youtube
clear This command clears given number of messages and by default it clears last 5 messages
clear_playlist This command removes every available mp3 file
join This adds bot to the given channel and by default in General
play This command plays song from the available ones.Providing channel would let the bot run there else by default it will run in General
remove This command removes the specified .mp3 file
songs This command lists all the songs available to play
stop This stops the music playing and the bot leaves the voice channel
lyrics This displays the lyrics for the current playing song
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.