Have you ever streamed to an audience while listening to Spotify and wanted to take in song requests from your audience? This bot can deliver that capability! It shows the information on the current song, song queue list, and adds song to the queue list!
- !song - Shows the artist and title of current song
- !queue - Shows the next five (5) songs in queue (limited to only show 5 to reduce chat clutter)
- !add {Spotify song URL} - Adds song to queue (note: will not add the song if it's already in queue)
- PyCharm
- Python Libraries: discord, os, spotipy, dotenv
- Spotify desktop
- Clone this repo and within the root directory of the project folder, create a file called
.env
, within this file copy and paste the following four (4) lines of text:DISCORD_BOT_TOKEN=
SPOTIFY_CLIENT_ID=
SPOTIFY_CLIENT_SECRET=
SPOTIFY_REDIRECT_URI=
- We need a Discord bot now. Follow these instructions to create one and invite it to your server. Make sure you take note of the token!
- We also need a Spotify token. Follow these instructions to create one. Make sure you take note of the client ID, client secret, and redirect URI!
- With the Discord bot token, Spotify client ID, Spotify client secret, and Spotify redirect URI we just created,
paste them over to its respective parts within the
.env
file. Remember to save the file too! - Open up Spotify and execute
mybot.py
, your bot should now be showing as online within your server - Start playing any music on Spotify and then go back to Discord and try out the
!song
command, the bot will reply with the artist and title of the current song - Try out the
!queue
command, the bot will reply with the next 5 songs in queue - To add songs to the queue, we need the song URL. This can be obtained by selecting the three-dot icon
on a Spotify track, selecting Share, and then Copy Song Link.
For example, I want to add the song "Like a G6" from the Far East Movement. This is how the command is used after I copy the song URL from Spotify:
!add https://open.spotify.com/track/4DvhkX2ic4zWkQeWMwQ2qf?si=dcd87cfbf50748a9