A Discord bot that runs music quizzes based on Spotify playlists.
The link to a Spotify playlist (e.g. https://open.spotify.com/playlist/6XOLmQWwf0Id5xYnKcHz3O) or the playlist ID (e.g. 6XOLmQWwf0Id5xYnKcHz3O
).
Defaults to: 6XOLmQWwf0Id5xYnKcHz3O
The number of songs you want to include in the quiz. The bot will randomly select this number of songs from playlist
.
Defaults to: 15
In order to run the bot yourself, you need to create an application in Discord's developer portal.
From the OAuth2 screen, copy the client ID and client secret.
You'll need set these 2 tokens as environment variables when running the app through node
directly or through Docker.
The bot also needs credentials for Spotify's Web API in order to fetch the tracks from public playlists. Once you've logged into the developer portal, create a new app and copy the client ID and client secret. Like the discord tokens, you'll need to set these 2 as environment variables when running the app.
You can run the latest build locally through Docker.
If this is the first time you're running the bot after creating your Discord application, you'll need to run the deploy-commands.js
script to add the global commands:
docker run \
-e DISCORD_CLIENT_ID=<your docker app client id> \
-e DISCORD_TOKEN=<your docker app token> \
ostrander/music-bot-js:latest \
node deploy-commands.js
The container should log the following and exit
Started refreshing application (/) commands.
Successfully reloaded application (/) commands.
To run the actual bot:
docker run \
-e DISCORD_CLIENT_ID=<your docker app client id> \
-e DISCORD_TOKEN=<your docker app token> \
-e SPOTIFY_CLIENT_ID=<your spotify app client id> \
-e SPOTIFY_CLIENT_SECRET=<your spotify app client secret> \
ostrander/music-bot-js:latest
To run the app using node.js
, you need to install the required dependencies using your prefered node.js
package manager (e.g. npm install
, yarn install
, etc.).
Once the dependencies are installed, set the Discord and Spotify environment variables:
export DISCORD_CLIENT_ID=<your docker app client id>
export DISCORD_TOKEN=<your docker app token>
export SPOTIFY_CLIENT_ID=<your spotify app client id>
export SPOTIFY_CLIENT_SECRET=<your spotify app client secret>
If this is the first time you're running the bot after creating your Discord application, you'll need to run the deploy-commands.js
script to add the global commands:
node deploy-commands.js
This script should log the following and exit
Started refreshing application (/) commands.
Successfully reloaded application (/) commands.
To run the actual bot:
node index.js