Discord Spotify Integration


Starts, Connects, Detects nothing Playing

Detects a song starting, updates it Can see the whole song by clicking the person Detects the song pausing and wipes it from the status message


Recently I decided I wanted Discord to display what I was currently playing in Spotify. This is the result.

For the whole saga, see this post: Discord Spotify Now Playing Self-Bot

 

To use it:

  1. Download and install Node.js (if you don’t already have it)
  2. Git clone the repository linked above (or manually download it)
  3. Put the folder with the bot.js file inside it somewhere it won’t get deleted
  4. Open a command prompt window with the context of that folder
    • Either Shift+Right Click in the folder and ‘Open Command Window here’
    • or run command prompt normally and cd into the folder
  5. In the command prompt window, run ‘npm init’ and run through the initialiser. Use the defaults for everything, it’s not really important except that it lets you do the next bit without errors
  6. In the command prompt window, run npm install spotify-web-helper@1.7.1 discord.js@11.0.0 --save to install both dependencies for the bot and link them to the bot so it can find them.Get your Discord token:
    1. Open up discord and open the inspector window (CTRL + SHIFT + I)
    2. Go to the Application tab
    3. Under Storage, select Local Storage, and then discordapp.com
    4. Find the token row and copy the value that is in quotes.
  7. Paste that (quotes included) into the config.json file where it says “token”:
    So it’d look something like:

    {
        "email":"",
        "password":"",
        "username":"",
        "token":"YOURTOKEN"
    }
  8. In the command prompt window, run ‘Node bot.js’ and you should see it connect as you, and then output whatever song you’re playing in Spotify. I’d have Spotify running beforehand just in case it doesn’t detect Spotify after it starts.

If you want it to run invisibly in the background like how I talked about in my blog post (Windows only):

  1. Open the ‘Task Scheduler’ app
  2. Click ‘Create Task’ in the right hand column
  3. Name it and Describe it how you like
  4. In the Triggers tab, create a new one and choose ‘At log on’ from the topmost dropdown
  5. I personally delayed the task for 1 minute to allow Spotify to start first, though that may not be necessary, or a longer delay may be necessary
  6. In the Actions tab, create a new one and browse to the location of the included .vbs script
  7. After selecting it, copy everything except the “\botStart.vbs” at the end, and paste that into the “Start in (optional)” box (IE: Set the Start in box to be whatever folder the .vbs script is in)
  8. Configure the rest however you like, it should now automatically run, invisibly, when you log in.