A discord bot that can follow what a Spotify user is listening to and play it in a voice channel so everyone can listen in simultaneously. Although this feature already exists in Discord with the Spotify integration (Listen Along), only premium Spotify users get to use it. This bot can be a viable alternative.
Apart from that, it also supports manually playing songs with the /play
command.
And no, I don't have plans to host and make this a public bot for everyone. This is just a hobby project for private use in my Discord servers. Please set it up yourselves.
Command | Description |
---|---|
/followme |
Makes the bot track what you're currently playing on Spotify! |
/unfollowme |
Makes the bot stop tracking the current user's Spotify. |
/followwho |
Tells you who the bot is following. |
/play |
Play a song using a search phrase or URLs from Spotify or YouTube. |
/pause |
Pauses the currently playing song. |
/resume |
Resumes the currently playing song if it's paused. |
/stop |
Stops the currently playing song. |
/currently-playing |
Shows the song that's currently playing |
- Node.js v19 or above.
- Docker Compose.
- Clone the repo and run
npm i
in this directory. - Make Spotify app in your Spotify developer dashboard.
- Make a Discord app in your Discord developer portal.
- Make a free MongoDB database using Atlas.
- Make a file called
application.yml
and copy the contents fromsample.lavalink.application.yml
into it. Fill up the fields marked#INPUT
with your own values. - Make a file called
config.json
in ./src folder and fill it with your info just like insample.config.json
. - Run
docker compose up
in the project directory. (In the future, dodocker compose down
to delete the containers if you wanna start clean, ordocker compose stop
to just stop the containers) - To deploy the commands to your Discord servers, run
npm run deploycommands
. - Run
npm run start
.
- Make Spotify app in your Spotify developer dashboard.
- Make a Discord app in your Discord developer portal.
- Make a free MongoDB database using Atlas.
- Download the
docker-compose.prod.yml
file. - In the same directory, make a file called
application.yml
and copy the contents fromsample.lavalink.application.yml
into it. Fill up the fields marked#INPUT
with your own values. - In the same directory, make a file called
config.json
in ./src folder and fill it with your info just like insample.config.json
- Run
docker compose -f docker-compose.prod.yml up
in the directory. (In the future, dodocker compose -f docker-compose.prod.yml down
to delete the containers if you wanna rebuild them, ordocker compose -f docker-compose.prod.yml stop
to just stop the containers) - To make the slash commands work, enter the shell of the container by running
docker exec -ti <container name of tamashi-bot> /bin/bash
. Then, runnpm run deploycommands
. Exit the shell usingexit
command. You'll only have to run this once. However, if you make any changes to the command names or add/delete new ones, deploy the commands again.
- In the Discord developer portal, when generating the invite link for the bot, set the scopes to
bot
,voice
andapplication.commands
. Then give it admin access from the bot permissions. - To test the bot locally, you can setup ngrok to test the callback URL from Spotify for a public URL. You will also have to set this in the Spotify application settings from the dashboard (in the dashboard make sure it ends with
/tamashi/callback
). The public URL ngrok gives you will also have to be put inconfig.json
file. - Without a quota extension from Spotify, you can have a maximum of 25 users (excluding yourself) use the
/followme
command. You'll have to add their emails in theUsers And Access
section of the dashboard.
- NodeJS
- Discord.js
- Express
- MongoDB with Mongoose
- Redis
- Lavalink
- Docker
To release new versions, change tag in docker-compose.prod.yml
and package.json
. Build the new images using docker compose -f docker-compose.prod.yml build --no-cache
. Push it using docker compose -f docker-compose.prod.yml push
.