htilly / zenmusic

Slack / Sonos / Spotify / Node.js - Control Sonos through #Slack
125 stars 36 forks source link

Spotify functions do not work and crash the server #49

Closed macOS-Wolf closed 5 years ago

macOS-Wolf commented 5 years ago

Hello

I've been looking for a new slack integrated Sonos controller with Spotify support however I had some trouble setting this one up.

I am setting up locally and the Spotify api keys are functioning as normal, however I get the following error when I try to search or add or do anything that needs to control Spotify:

info: term: search info: _search search /Users/tech/Sites/Sonos/zenmusic/index.js:922 var [data, message] = spotify.searchSpotify(input, channel, userName, searchLimit) ^

TypeError: spotify.searchSpotify is not a function or its return value is not iterable at _search (/Users/tech/Sites/Sonos/zenmusic/index.js:922:33) at processInput (/Users/tech/Sites/Sonos/zenmusic/index.js:205:13) at RTMClient.slack.on (/Users/tech/Sites/Sonos/zenmusic/index.js:162:5) at RTMClient.emit (/Users/tech/Sites/Sonos/zenmusic/node_modules/eventemitter3/index.js:116:35) at RTMClient._handleWsMessageViaEventHandler (/Users/tech/Sites/Sonos/zenmusic/node_modules/@slack/client/lib/clients/rtm/client.js:482:10) at RTMClient.handleWsMessage (/Users/tech/Sites/Sonos/zenmusic/node_modules/@slack/client/lib/clients/rtm/client.js:436:10) at WebSocket.wrapper (/Users/tech/Sites/Sonos/zenmusic/node_modules/lodash/lodash.js:4929:19) at WebSocket.emit (events.js:198:13) at Receiver.ontext (/Users/tech/Sites/Sonos/zenmusic/node_modules/ws/lib/WebSocket.js:841:10) at /Users/tech/Sites/Sonos/zenmusic/node_modules/ws/lib/Receiver.js:536:18 at Receiver.applyExtensions (/Users/tech/Sites/Sonos/zenmusic/node_modules/ws/lib/Receiver.js:371:5) at /Users/tech/Sites/Sonos/zenmusic/node_modules/ws/lib/Receiver.js:508:14 at Receiver.flush (/Users/tech/Sites/Sonos/zenmusic/node_modules/ws/lib/Receiver.js:347:3) at Receiver.finish (/Users/tech/Sites/Sonos/zenmusic/node_modules/ws/lib/Receiver.js:541:12) at Receiver.expectHandler (/Users/tech/Sites/Sonos/zenmusic/node_modules/ws/lib/Receiver.js:499:31) at Receiver.add (/Users/tech/Sites/Sonos/zenmusic/node_modules/ws/lib/Receiver.js:103:24)

macOS-Wolf commented 5 years ago

Anyone have any ideas? I've just about tried everything I can think of!

@htilly are you still around?

BachDSingh commented 5 years ago

Found it, durp. You need to do this first: https://developer.spotify.com/documentation/general/guides/app-settings/ create a hobby app, take the ClientID and Client Secret and place it in the config! :) It also explains on the main page, you just need to scroll down a bit.

macOS-Wolf commented 5 years ago

@BachDSingh I had done that during install and both the client ID and client Secret was inserted

In the end it turned out I had accidentally removed something while frankesteining the code when I had Sonos errors. I simply reinstalled the index.json and it stopped crashing

But now I get this following error:

Sorry @macOS-Wolf , I could not find that track :(

For every track I try to search or add!

Solve one problem and another pops up haha

macOS-Wolf commented 5 years ago

If anyone has any idea please let me know :D slowly driving me insane!

Everything else works perfectly fine, can control Sonos without issues, its just Spotify commands that don't work.

Could this be something to do with Slack Bot API?

But then again, everything else works!

macOS-Wolf commented 5 years ago

Fixed

It was so super simple I am ashamed.

I was entering the wrong market, and this wasn't flagging up as an error.

if in the UK, do not use UK as market, use GB.