A very simple music playing bot, with an autoplay feature backed by Spotify track recommendation system.
- Ubuntu 22.04
- Node v20.18.0
- ffmpeg. For Ubuntu you can install it with
apt install ffmpeg
.
npm install
The final credentials must be stored as environment variables.
TOKEN
CLIENT_ID
GUILD_ID
SPOTIFY_CLIENT_ID
SPOTIFY_CLIENT_SECRET
- Setup 2-factor authentication for your Discord account
- Enable developer mode on your Discord client
- Creating your bot in Discord developer portal
- Adding your bot to your server
After you finish those instructions, you will be able to obtain:
TOKEN
- The Discord bot token.CLIENT_ID
- from the Discord developer portal.GUILD_ID
(aka your channel's ID) - Make sure developer mode is enabled. Right click on the channel's title ->Copy Server ID
.
Spotify API is used for obtaining song recommendations. It requires a token to query from it.
Follow these instructions to obtain SPOTIFY_CLIENT_ID
and SPOTIFY_CLIENT_SECRET
:
- Create a Spotify app
- Obtain the client Id and sercret from the Spotify Dashboard (note: you don't need to obtain the access token by yourselves, the client Id and secret is enough) - These 2 correspond to
SPOTIFY_CLIENT_ID
andSPOTIFY_CLIENT_SECRET
respectively.
Reference: https://discord.com/developers/docs/interactions/application-commands#registering-a-command
npm run deploy-commands
You can use tsx to run the bot directly without compiling:
npx tsx src/index.
npm run build
npm run start
npm run test
npm run style
podman build -t lemon-soda:testing -f Dockerfile ./
podman run --init -it --rm -e TOKEN=$TOKEN -e SPOTIFY_CLIENT_ID=$SPOTIFY_CLIENT_ID -e SPOTIFY_CLIENT_SECRET=$SPOTIFY_CLIENT_SECRET lemon-soda:testing