chrisinajar / plugapi

A generic API for creating Plug.dj bots
13 stars 27 forks source link

Full room data functionality to mirror Plug.DJ API used in most existing bots #4

Closed backus closed 11 years ago

backus commented 11 years ago

Almost every function described on this page http://blog.plug.dj/api-documentation/ is included in this commit hold for a few non-essentials. This addition should really accelerate the migration to server side nodeJS bots

chrisinajar commented 11 years ago

Nice!! Thanks a bunch, I'll look through this in a bit!

TATDK commented 11 years ago

Using this I got the following error

\node_modules\plugapi\src\room.coffee:144
      for (_i = 0, _len = djs.length; _i < _len; _i++) {
                             ^
TypeError: Cannot read property 'length' of undefined
    at Room.setDjs (\node_modules\plugapi\src\room.coffee:144:30)
    at Room.__bind (\node_modules\plugapi\src\room.coffee:3:61)
    at PlugAPI.messageHandler (\node_modules\plugapi\src\client.coffee:183:21)
    at PlugAPI.dataHandler (\node_modules\plugapi\src\client.coffee:125:16)
    at EventEmitter.__bind (\node_modules\plugapi\src\client.coffee:3:61)
    at EventEmitter.emit (events.js:126:20)
    at Object.XHRStreaming.emitData (\node_modules\plugapi\src\sockjs-client.js:323:30)
    at Object.XHRStreaming.running (\node_modules\plugapi\src\sockjs-client.js:294:26)
    at Object.StateMachine.invoke (\node_modules\plugapi\src\sockjs-client.js:359:29)
    at Object.StateMachine.stepper (\node_modules\plugapi\src\sockjs-client.js:388:29)
chrisinajar commented 11 years ago

Looks like "djs" isn't an array. Probably just needs a conditional before an $.each or a for()...

On Wed, Jan 16, 2013 at 1:54 PM, TATDK notifications@github.com wrote:

Using this I got the following error

\node_modules\plugapi\src\room.coffee:144 for (_i = 0, _len = djs.length; _i < _len; _i++) { ^ TypeError: Cannot read property 'length' of undefined at Room.setDjs (\node_modules\plugapi\src\room.coffee:144:30) at Room.__bind (\node_modules\plugapi\src\room.coffee:3:61) at PlugAPI.messageHandler (\node_modules\plugapi\src\client.coffee:183:21) at PlugAPI.dataHandler (\node_modules\plugapi\src\client.coffee:125:16) at EventEmitter.__bind (\node_modules\plugapi\src\client.coffee:3:61) at EventEmitter.emit (events.js:126:20) at Object.XHRStreaming.emitData (\node_modules\plugapi\src\sockjs-client.js:323:30) at Object.XHRStreaming.running (\node_modules\plugapi\src\sockjs-client.js:294:26) at Object.StateMachine.invoke (\node_modules\plugapi\src\sockjs-client.js:359:29) at Object.StateMachine.stepper (\node_modules\plugapi\src\sockjs-client.js:388:29)

— Reply to this email directly or view it on GitHubhttps://github.com/chrisinajar/plugapi/pull/4#issuecomment-12333861.

unusualbob commented 11 years ago

That error just means that djs is undefined. I don't have the time to dive in, but maybe check typeof(djs) != 'undefined' before trying?

backus commented 11 years ago

I'll look into this should be easy to fix

backus commented 11 years ago

Ok I fixed the issue and I also added a super simple repl for people trying out the api to play around with. Its as easy as

rescomp-12-248016:plugapi johnbackus$ node repl.js
[+] Joined dubstep-den
bot>bot.sendChat('hi')
TATDK commented 11 years ago

I can report that the same error still happens

backus commented 11 years ago

@TATDK I'm online now what room are you in I want to see whats causing it

TATDK commented 11 years ago

@backus I'm in friendshipismagic

backus commented 11 years ago

^ That commit is unrelated lol just some changes I was about to add when your message came in

backus commented 11 years ago

Alright there are definitely still some crashes involved with the additions but they aren't the same as the djs bug quoted earlier I'll dive into it soon to figure out whats going on

chrisinajar commented 11 years ago

This weekend I'll have the time to thoroughly test this and merge it in, and I'll pop it into NPM as well.

Backus, drop your name and email how you want it to appear on the contributors list at some point.

TATDK, thanks a ton for testing this for us!

On Thu, Jan 17, 2013 at 7:35 AM, backus notifications@github.com wrote:

Alright there are definitely still some crashes involved with the additions but they aren't the same as the djs bug quoted earlier I'll dive into it soon to figure out whats going on

— Reply to this email directly or view it on GitHubhttps://github.com/chrisinajar/plugapi/pull/4#issuecomment-12366197.

TATDK commented 11 years ago

@chrisinajar I heard you were looking for me - I'm in the room now

Edit: you can contact me on TAT@plugpony.net if I'm not online the same time as you

backus commented 11 years ago

@chrisinajar my name is John Backus and email is johncbackus@gmail.com. I also made an npm profile if that is helpful.

chrisinajar commented 11 years ago

Merging and I'll add some fixed and dry it out a bit