Skip to content

danielkimGH/MyDiscordBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

My Discord Bot

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!

Commands

  • !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)

Required Software

  • PyCharm
  • Python Libraries: discord, os, spotipy, dotenv
  • Spotify desktop

Setup

  1. 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=

  2. 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!
  3. 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!
  4. 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!
  5. Open up Spotify and execute mybot.py, your bot should now be showing as online within your server
  6. 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
  7. Try out the !queue command, the bot will reply with the next 5 songs in queue
  8. 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

References

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages