This is my version of a Discord Bot built to play Music.
To use this code for your own bot follow the steps below if you have Python installed:
- Download this repository.
- Extract the contents.
- Install dependencies from requirements.txt
Windows
pip install -r requirements.txt
Linux
pip3 install -r requirements.txt
- Paste the token for your bot in the variable "my_secrets" at the top of main.py file.
(You can find your token in the dev pages on discord.com)
- Run the file main.
Windows command:
python main.py
Linux command:
python3 main.py
I have my code with my bot's Token on repl.it
Feel free to run my bot using this link from repl.it and click play
OR
Add my bot to your server
This allows you to run the bot on their server without having to download anything on your device. It runs in the browser and can be used and viewed by anyone.
In-Progress Features and Known Bugs:
- Queue out of index when cleared or next enough times
- No seek for now playing music yet
- Bot sends too many reply messages, need to change that to editable embeds for better visuals
NOTE: You may encounter an error while installing multidict package. To fix this try updating setuptools on your distro
Linux
sudo apt install libpython3.7-dev && sudo apt install python3-dev
Windows
https://visualstudio.microsoft.com/visual-cpp-build-tools/
Follow this tutorial to install FFmpeg on your Windows PC
Linux
sudo apt install ffmpeg
- Re-add a session playlist
The commands below can be used by typing the following syntax:
-<function_name | Alias> <required input> <Optional inputs:...>
- clear
- clear current queue
- help
- Shows this message
- index
- Aliases:
-i
- Displays Index of the song currently playing. (Useful for troubleshooting some errors)
- Aliases:
- join
- Aliases:
-j
- Joins the Voice Channel the user is connected to. Does not work if you are not in a Voice Channel already
- Aliases:
- leave
- Aliases:
-dc, -die
- Disconnect from Voice Channel
- Aliases:
-
play
- Required:
<song name or link>
- Aliases:
-p
- Play followed by the name of your Search Query / Song
- Required:
-
playall
- Required:
<song name or link>
- Optional:
<startpoint> <endpoint>
- Aliases:
-pa
- Play followed by the url of your Playlist
- Required:
-
playnext
- Required:
<song name or link>
- Optional:
<startpoint> <endpoint>
- Aliases:
-pn
- Add the given song to Queue right after the currently playing song
- Required:
-
playallnext
- Required:
<song name or link>
- Optional:
<startpoint> <endpoint>
- Aliases:
-pan
- Add the given playlist to Queue right after the currently playing song
- Required:
-
next
- Aliases:
-n
- Next song
- Aliases:
-
prev
- Previous Song
-
jump
- Aliases:
-jm <enter number here>
- Jump to the specified index number given
- Aliases:
-
loop
- Aliases:
-l
- Loop queue
- Aliases:
-
remove
- Aliases:
-rm <song index number>
- Remove the song with the specified index number (only numbers allowed)
- Aliases:
- link
- Share Youtube link of the currently playing song
- dj
- Displays the number of songs added by each user
- nowplaying
- Aliases:
-np
- View the song title currently playing
- Aliases:
- ping
- Latency of the bot to the Voice Channel Server
- queue
- Aliases:
-q
- View the current queue
- Aliases:
- save
- Export and save the current queue to the server database
- test
-test <your_message_here>
- Responds back with your input message
- vcmute
- Aliases:
-vm
- Server mute all the people in the current Voice Channel
- Aliases:
- vcunmute
- Aliases:
-um
- Server unmute all the people in the current Voice Channel
- Aliases:
- ask play songname
- find song
- save video_id to q
- change q from txt to just a list in code
- get q[0] for first song
- play song from q
- End of session, export q metadata to a databse: requestorName, songName, etc