Custom made discord music bot made for me and my friends. This bot is meant to be hosted on a Heroku server.
- Play music from YouTube (
/play <url | name>
) - Use slash commands to control the bot
- Has a nice button interface to control the bot (
/actions
) - You can run multiple instances of the bot on the same server
- Assign a "special" song to a bot via
SPECIALITIES
environment variable to play it via/perform
command
- Go to the (Discord Developer Portal)[https://discord.com/developers/applications]
- Create a new application
- Go to the "Bot" tab and click "Add Bot"
- Copy the token and save it for later
- Go to the "OAuth2" tab and select "bot" and "applications.commands" in the scopes section
- Select the permissions the bot will need ("Send Messages", "Connect", "Speak" and "Read Messages/View Channels")
- Copy the link, it will be used to invite the bot to a server
- Create a new app on (Heroku)[https://dashboard.heroku.com/new-app]
- Make sure to use
heroku-20
stack, as later versions have issues with ffmpeg at the time of writing - Add the following buildpacks (Settings -> Buildpacks -> Add buildpack):
heroku/nodejs
heroku/python
https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git
https://github.com/xrisk/heroku-opus.git
- Setup the environment variables (Settings -> Config Vars). See Configuration for more information
- Connect the app to the repository (Deploy -> Deployment method -> GitHub)
- Start the worker (Resources -> worker -> edit -> toggle the switch)
-
Clone the repository
-
Install (ffmpeg)[https://www.ffmpeg.org/download.html]
-
Install (Python 3.10+)[https://www.python.org/downloads/]
-
Run the following commands: Windows:
python -m venv .venv .venv\Scripts\activate pip install -r requirements.txt
Linux:
python -m venv .venv source .venv/bin/activate pip install -r requirements.txt
-
Setup the environment variables. See Configuration for more information
-
Run the bot with the following command: Windows:
cmd .venv\Scripts\python bot.py
Linux:
bash .venv/bin/python bot.py
- Clone the repository
- Build the image with the following command:
docker build -t instruity .
- Run the container with the following command:
docker run -e TOKENS="token1 token2 ..." -e SPECIALITIES="url1 url2 ..." -e HIDDEN=1 instruity
Create a .env
file with the following content:
TOKENS=token1 token2 ...
SPECIALITIES=url1 url2 ... [optional]
HIDDEN=1 [optional]
TOKENS
- whitespace-separated list of bot tokens (any whitespace is allowed: space, tab, newline, etc.)SPECIALITIES
- whitespace-separated list of URLs to special songsHIDDEN
- if set to1
, the bots will be shown as offline in the server