This PR finally implements the entire spotify oauth process using the Authorization Code method. It requires that you set three environment variables
export SPOTIFY_AUTH={{your spotify authorization code}}
export SPOTIFY_CLIENT_ID={{your spotify client id}}
export SPOTIFY_CLIENT_SECRET={{your spotify client secret}}
The processes uses these variables in a request sent to spotify which returns an access_token and a refresh_token. The access_token is used on subsequent requests to get information from the spotify API, while the refresh_token is used after 60 minutes to generate a new access_token.
Once we have access to spotify, we can search for songs and manipulate playlists. This lets us add songs directly to the weekly playlist, and keep track of who chooses what song. Replies are parsed and used to search spotify's database for the track. If found, the bot will reply and add that song to the weekly playlist, automating much of the process.
Check out the #nowplaying community and bot in action here