Spoticord is a music bot designed to work using your Spotify player, instead of all those annoying commands like play
, skip
and pause
to control a music bot.
Just join a voice channel with the bot, go to your Spotify player on either your PC or your phone, and just switch to Spoticord. The bot will now play every song that you play on Spotify, while also responding to pause, resume, and seeking through a song.
Users who join the Spotify party after you have started one will have their Spotify mimic what yours is doing, so that these users can see what kind of tunes you are playing.
No, Spoticord already has an official bot and can be invited via the Spoticord website. This version of Spoticord also contains extra features and will receive additional exclusive features in the future. You will only have to follow the setup if you want to run Spoticord as your own bot, just remember that running Spoticord on your own can come with some complications.
Fundamentally, there is no difference. Both the open source and live version use your Spotify player as the control panel for playing music. However the live version may have limited functionality on some quality of life features, like renaming the Spoticord device in Spotify. This is one of the features that is free when you are using the selfhosted version. Setting up your own version of Spoticord is also a lot more difficult than just inviting the live version to your server(s).
I believe that in this world we all should have at least the privilege of seeing how a program is made. As a security enthousiast I find that this can significantly help in finding and fixing (yet to be known) vulnerabilitites and also gives people a chance to contribute and make projects even better than they were before.
But enough rambling, time to get set up
Get started by cloning this project and installing the required dependencies.
$ git clone --recurse-submodules https://github.com/SpoticordMusic/Spoticord.git
$ cd Spoticord
$ npm install
Also make sure that you have typescript tools installed, you can check this by running tsc -v
. If this does not work you will have to install typescript using npm i -g typescript
.
Now before you can properly use the bot you will have to setup a few things.
You can find an example config.example.json
file at the root of the repo. This json file contains an empty line somewhere in the middle. Every entry above this line is required. All the lines below this empty line are optional and should be omitted if you won't need to tamper with these settings.
Key | Required | Default | Description |
---|---|---|---|
token | Yes | N/A | The Discord bot token |
spotify_client_id | Yes | N/A | The Spotify client ID |
spotify_client_secret | Yes | N/A | The Spotify client secret |
realtime | No | Null (Disabled) | An object containing host (string) and port (number) for listening on the Realtime server. |
database | No | JsonDB at ./db.json | Setting up a database |
linker_hostname | No | '127.0.0.1' | The hostname the linker website will listen on |
linker_port | No | 4481 | The port number the linker website will listen on |
spotify_redirect_url | No | 'http://localhost:4481/' | The redirect url for the Spotify OAuth procedure |
Spoticord currently supports two strategies of storing data: json
and mongo
. Using json is easier but can become hard to manage. Instead you might want to set up a MongoDB server. To choose which strategy you want to use, you will have to add a new database
field to the config.json
file. If no database
field is supplied then Spoticord will automatically use the json
strategy in the file $PROJECT_ROOT/db.json
.
{
...,
"database": {
"strategy": "json",
"filename": "/etc/spoticord/db.json"
},
...
}
{
...,
"database": {
"strategy": "mongo",
"username": "admin",
"password": "admin",
"host": "mongo.myepicdomainname.com",
"port": 27017,
"db": "spoticord"
}
...
}
You can download Lavalink from the official releases page. Make sure to download the most up-to-date version to get better speed and stability.
After downloading the jar file you will need to create a new file called application.yml
with your preferred Lavalink configuration. A template version can be found here. If you need more information about Lavalink you can visit the Lavalink repo.
For changing the application.yml
the only two fields that are the most important are the port
and password
field. These values need to be changed accordingly inside the nodes
field in the config.json
file.
Next up you will have to create a lavalink.config.json
file (an example has been provided). This file will contain all the nodes that the bot may use to communicate with Lavalink.
Create a new Discord application and bot in your Discord Developer Dashboard. If you need help setting up your application then Google is your best friend.
Once you have your bot ready copy your discord bot token to the config.json
file in the token
field.
Create a new Spotify application in your Spotify Developer Dashboard. If you need help setting up your application then (what a surprise) Google is your best friend.
Once you have your application ready you can copy your client ID and client secret (click SHOW CLIENT SECRET
) and place them both respectively in the config.json
file under spotify_client_id
and spotify_client_secret
If only you are planning to use your bot then you can simply add http://localhost:4481/
to your Spotify application as a redirect URL. Don't forget to remove the spotify_redirect_url
from the config.json
if you do this. If you are however planning on other people using this bot too, then you need to make sure the bot can be reached using either port forwarding or hosting the bot on a VPS. Set the linker_hostname
to '0.0.0.0' in the config.json
and set the linker_port
to a port of your choosing. Then add your preferred redirect url to your Spotify application and to the spotify_redirect_url
field in the config.json
file.
When this is all finally done you can build the source by running npm run build
and then start the bot with npm run start
. These commands can also be combined by using npm run compile
.
If you get stuck or simply don't know how to continue with one of the steps then feel free to join the Spoticord Support Server and ask away inside the #questions channel.
soon?