Discotify is a Discord/Spotify bot solution to enhance user experiences when listening to Spotify music in Discord parties. Our Discord bot solution allows multiple people to control Spotify listening parties instead of a single person. Your listening experience can now become fun and collaborative! Users who would benefit most from this program would be users who have Spotify premium and actively use Discord with friends or other people. Once users are in Discord and in each others Spotify listening parties, users can send commands to the bot. These commands include but are not limited to actions such as start track, pause track, skip track, and add to queue
!hello
: Greets the user.!auth
: Initiates authentication with Spotify.!helps
: Displays a list of avaiable commands.
!play <query>
: plays a track on Spotify. The<query>
can be a Spotify link, song name, or song name with the artist.!pause
: Pauses the current playback on Spotify.!resume
: Resumes playback on Spotify.!next
: Skips to the next track on Spotify.!previous
: Goes to the previous track on Spotify!devices
: Lists avaiable Spotify devices.
!toptracks
: Shows the user's top 10 tracks on Spotify.!playlist <name>
: Plays a playlist from the user's library on Spotify by playlist name.!profile
: Show user Spotify profile
-
Go to the Discord Developer Portal: Open your web browser and navigate to the Discord Developer Portal.
-
Create a New Application: Click on the
New Application
button. Give your application a name and confirm the creation. -
Create a Bot User: Within your application, find the
Bot
tab and click onAdd Bot
. Confirm the creation of the bot. -
Enable Intents: In the bot tab, you will see options for
Privileged Gateway Intents
-
Access the Bot Tab: In your application, navigate to the
Bot
tab. -
Copy the Token: Under the
Build-A-Bot
section, you’ll see a token. Click onReset Token
to reset your bot's token and copy bot's token. Keep this token secure, as it allows anyone to control your bot.
-
Generate the Invite Link: Go to the
OAuth2
tab in your application. UnderScopes
, selectbot
. Then, underBot Permissions
, choose the permissions you want your bot to have. -
Copy and Use the Invite Link: Copy the generated link and paste it into your web browser. Select the server to which you want to add the bot and authorize it.
- Open Spotify and play something
- Click on the "+" button next to your chatbox at the bottom left and click on "Invite [users] to Listen to Spotify"
If the option 'Invite [users] to listen to Spotify' does not appear, make sure your Discord status is set to online.
- You should be able to see when you're in a listening party through Discord
- People can now click the Join button to be in your listening party!
Note:
- Only the listening party host needs to run the executable file
- The listening party host must then authenticate (!auth) with the bot (only the listening party host needs to do this)
- After this is done, everyone in the listening party can use the commands for the bot
- If you pause (!pause) then the listening party will end, this is on Spotify/Discords end on how they made the functionality
- Open Spotify and play something
MacOS:
-
Ensure you have python3 installed on your system.
- To check that python is installed properly run this command in your terminal:
python --version
- If the previous commands does not work try:
python3 --version
- If the command is successful you will see your current python version installed
- You need Python 3.11 and greater to run this program
- To check that python is installed properly run this command in your terminal:
-
Open a terminal or command prompt.
-
Use the following command to install the required modules using pip, the package installer for Python:
pip install discord requests
-
Wait for the installation to complete. Once finished, the required modules will be installed in the Python environment.
-
Download executable from release in Repo bot
-
Set up environment variables
- In the same directory the executable is located, create a .env file
nano .env
- Set your Client ID and Client Secret in the following format (How to find Client ID and Client Secret):
SPOTIFY_CLIENT_ID= your_client_id SPOTIFY_CLIENT_SECRET= your_client_secret DISCORD_TOKEN= your_discord_token
- Save that file.
-
Run executable.
- In the directory you downloaded the executeable, Run:
./bot
Windows OS:
-
Ensure you have python3 installed on your system.
- To check that python is installed properly run this command in your terminal:
python --version
- If the previous commands does not work try:
python3 --version
- If the command is successful you will see your current python version installed
- To check that python is installed properly run this command in your terminal:
-
Open a terminal or command prompt.
-
Use the following command to install the required modules using pip or pip3, the package installer for Python:
pip install discord requests
-
Wait for the installation to complete. Once finished, the required modules will be installed in the Python environment.
-
Download executable from release in Repo bot.exe
-
Set up environment variables
-
In the same directory the executable is located, create a .env file in Notepad
-
Set your Client ID and Client Secret in the following format (How to find Client ID and Client Secret):
SPOTIFY_CLIENT_ID= your_client_id SPOTIFY_CLIENT_SECRET= your_client_secret DISCORD_TOKEN= your_discord_token
- Save that file.
- Make sure you save it as type All Files
-
-
Run executable.
- In the directory you downloaded the executeable, Run:
.\bot.exe
- Can also run executable by right-clicking bot.exe in File Explorer and then clicking on Open
Docker:
-
Ensure Docker is installed on your current OS (Docker Desktop Download)
-
Once Docker is installed be sure to run the Docker application ensuring that the daemon is running.
-
Open a terminal of your choice and check to see if Docker is installed properly with the following command:
docker --version
-
Once you have verified Docker is installed and running pull our latest image.
docker pull andrewto/discotify:v3.0
-
Once pulled be sure to setup your environment variables.
-
In the same directory the executable is located, create a .env file in Notepad
-
Set your Client ID and Client Secret in the following format (How to find Client ID and Client Secret):
SPOTIFY_CLIENT_ID= your_client_id SPOTIFY_CLIENT_SECRET= your_client_secret DISCORD_TOKEN= your_discord_token
- Save that file.
- Make sure you save it as type All Files
-
-
Run the image with the following command:
docker run --env-file env_file andrewto/discotify:v3.0
- env_file will be the path to your .env file that you created in the previous step
- to run multiple containers you can a command similar to:
docker run --env-file env_file_1 -d --name container1 andrewto/discotify:v3.0 docker run --env-file env_file_2 -d --name container2 andrewto/discotify:v3.0
- env_file_1 and env_file_2 are paths to your two .env files while container1 and container2 can be any names you want to want to name your container
Follow this project board to know the latest status of the project: http://...
https://github.com/orgs/cis3296f23/projects/112
- Use this github repository: ...
- Specify what branch to use for a more stable release or for cutting edge development.
- Use Visual Studio
- Specify additional library to download if needed
- What file and target to compile and run.
- What is expected to happen when the app start.
Continuously adding new problems that come up through development or building, will post common problems and solutions for current/future developers to refer to.
If pip install discord jsonlib base64 requests
doesn't work and you are on macOS, try removing the base64 and see if that works.
Make sure you are also using the correct interpreter for your IDE if you using that to run the program.
you can check what interpreter your terminal is using with which python
or which python3
.
If you received this error, make sure to add your Spotify Client ID and Secret to 4 environment variables as if you don't you will receive an INVALID_CLIENT: Invalid client
error when you click on the authentication link sent by the discord bot.
Make sure you have also added your own Discord Bot token to the environment variable DISCORD_TOKEN
.
If you used !previous and got an error 403, it's most likely because you tried to do the command while not in a playlist. If you did !play and then !previous, you will get the error since you are playing just one single song and there hasn't been any previous history.
3. Scroll down to Security 4. Click `Open Anyway`
5. After enter your password, Click `Open`
6. Bot are ready to go.