avatarkava / beavisbot

A node.js powered bot for plug.dj and dubtrack.fm
https://github.com/avatarkava/beavisbot/wiki
MIT License
22 stars 20 forks source link

Bot crashing because of [TypeError: Cannot read property 'media' of undefined] #18

Closed timwuzhere9 closed 10 years ago

timwuzhere9 commented 10 years ago

Hello,

I noticed BeavisBot in The "I love the 80's and 90's" community and recently started looking into reproducing him into a room I run for a gaming server I develop for.

When I try to start the bot however, This happens:

tim@Bot:~/BeavisBot$ node sparkle.js Using update code: h90 11 Apr 12:45:22 [Socket Server] Connected 11 Apr 12:45:22 [Chat Server] Connected Joined room undefined [GATEWAY ERROR] [TypeError: Cannot read property 'media' of undefined]

/home/tim/BeavisBot/sparkle.js:279 if (room.mediaStartTime) { ^ TypeError: Cannot read property 'mediaStartTime' of undefined at monitorDJList (/home/tim/BeavisBot/sparkle.js:279:17) at null. (/home/tim/BeavisBot/sparkle.js:252:13) at wrapper as _onTimeout at Timer.listOnTimeout as ontimeout

Am I overlooking something in the config or did I mess something up?

Thanks :)

timwuzhere9 commented 10 years ago

Also, what are you using as an updatecode/ how do you find it?

avatarkava commented 10 years ago

Probably getting that error because you're failing to connect to the room you've set up in the config.json - make sure you use the 'slugified' version from the URL (eg our 80s-90s room is 'i-the-80-s-and-90-s-1')

The updatecode is dependent on PlugAPI: https://github.com/atomjack/plugapi. Assuming you have your copy in node_modules updated, it'll likely grab the right one and you can leave the updateCode section in the config blank. It's only there on the occasions when plug changes how they generate that code and plugAPI stops picking up a valid one.