Giter VIP home page Giter VIP logo

plugbotapi's People

Contributors

atomjack avatar nthitz avatar nugget avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

plugbotapi's Issues

how to install Phantomjs 2.0

is it possible for someone to do a tutorial on how to install phantomjs on windows. I have no idea what the hell I am doing

Getting more consistent stream.js errors

Howdy,

Usually I would get a stream.js error when plug was under heavy load but now it seems that it's just regularly happening.

stream.js:94
throw er; // Unhandled stream error in pipe.

At a lost of how to prevent this from consistently killing my bot

Is moderateBanUser working?

I know there was an update to the moderateBanUser code shortly before "the update", and I haven't been able to get that code to work since. If this code working? My experience with it has been that the callback fires but the bot doesn't actually ban anyone.

Occasionally can't connect

Ok, I think I only have one remaining issue that's preventing me from switching full time to this API. Sometimes it doesn't seem to want to connect. After a long timeout, a message like this will appear:

phantom stdout: onStatusError ==>  15


phantom stdout:   http://plug.dj/_/static/js/room.aa4ab92.js:26 in onStatusError
Room Join Error :: 15

  http://plug.dj/_/static/js/room.aa4ab92.js:26 in onServiceError

If that happens, I have to manually stop and restart the script because it doesn't actually close, nor does it connect to the room. If it would error out, I could catch it with Forever and restart it automatically.

This is different than the c[3000 Go Away message... I still get that occasionally too on startup, but the API seems to handle that gracefully and reconnects on it's own.

Unknown endtype with moderateMoveDJ

bot.moderateMoveDJ(targetID, iPos, function(){});

Any time I try to use moderateMoveDJ, I get the following unknown endpoint error. I've verified that I'm passing valid values for targetID and iPos.

ERROR:  onStatusError ==>  15
ERROR TRACE:  [ { file: 'http://plug.dj/_/static/js/room.aa4ab92.js',
    line: 26,
    function: 'onStatusError' } ]
Server Error ==>  Unknown endpoint
0 = U
1 = n
2 = k
3 = n
4 = o
5 = w
6 = n
7 =
8 = e
9 = n
10 = d
11 = p
12 = o
13 = i
14 = n
15 = t

Woot / Meh functions stop working

After a time, it seems the Woot / Meh functions no longer work. They don't produce an error, the just no longer affect the bot's behavior.

(And, as a side note, they're missing from the readme file as well.)

moderateBanUser duration format?

bot.moderateBanUser(targetID, bot.API.BAN.HOUR, function() {});

This is producing a permanent ban rather than a one hour ban. What format should the duration be? For the old API I had it as the time in minutes (so 60 in this case) but that also produced a perm ban in this API.

HTML Entities, etc

Seems a bit like this is API is abandoned since it hasn't needed any changes as of late, but I'll ask anyway. It seems like the bot "sees" HTML entities and emojis in a translated form - for example & is seen by the bot as & and :smile:is seen as pure HTML code. This didn't use to happen - the bot used to see them exactly as typed. Is there a way to fix this to work the way it used to?

Bot stops responding

This is rather strange. After running fine for awhile, the bot went mute - it was completely unable to send chat messages to the room. The log files for the bot indicate that it was still functioning properly, just none of the announcements it normally makes were shown in the room.

Log segment:

[14:03:57] djAdvance: Stallion Duck is now playing "Another You" by Of Mice & Men
sio disconnect
sio disconnect
[14:05:13] Left: Stallion Duck
[14:05:13] djAdvance: Smokeout is now playing "Mr. Highway's Thinking About The End" by A Day To Remember
[14:09:14] displayStats
[14:09:18] djAdvance: DJ_AirTime is now playing "Lost That Loving Feeling Lyrics" by Righteous Brothers
[14:12:42] displayStats
[14:12:46] djAdvance: MegaRsmm is now playing "November Rain" by Guns N' Roses

After the "sio disconnect" messages happened, the bot went silent. As you can see above the events were still firing, but at each of those event logs the bot should send a message to the room but nothing came through.

A mod in the room at the time attempted to use a bot command to restart the bot, but the attempt to do so was not logged and the bot did not restart as it should, so it's possible the bot could no longer see chat either.

Manually stopping / restarting the script brought the bot back to normal operation.

Unknown endpoint

While reviewing the logs I found this. I wasn't in the room at the time, so unfortunately I can't comment as to whether or how it affected the bot.

ERROR: onStatusError ==>  15
Server Error ==>  Unknown endpoint
0 = U
1 = n
2 = k
3 = n
4 = o
5 = w
6 = n
7 =
8 = e
9 = n
10 = d
11 = p
12 = o
13 = i
14 = n
15 = t

The only thing possibly worthy of mention was that within 3 minutes of this, the bot encountered another of the "sio disconnect" errors I reported in #12.

New Plug Version Breaks API

I know it hasn't been updated yet but I figured I'd get a convo going. :)

My error is "TypeError: Cannot read property 'attribs' of undefined" in the plug-dj-login/index.js file on line 79

Is it possible for the bot to recognize/log an invalid auth code?

Plug had a lot of issues over the weekend. I had some stability issues with the bot as well, but I assumed it was Plug related. After things seemed to settle down with Plug though, I still wasn't able to get the bot back online. I logged in as the bot to disagnose and was able to login fine. I then checked and found that there was a new auth code. Once I loaded the new code into the bot, it loaded without issue.

Is there any way that an invalid auth code can be detected & logged? This would have been 10x easier to diagnose if there was. (My bot uses Facebook to authenticate.)

Can't add or remove bot from waitlist with API?

bot.moderateAddDJ(config.botId, function(){});
bot.moderateRemoveDJ(config.botId, function(){});

Neither seems to work. Yes, I've confirmed that config.botId is the actual bot UID... I've even replaced it with the actual UID number instead of a variable - it didn't help. If I put another user's UID in there instead, such as my own, the commands work fine.

Any thoughts on this?

Phantom is crashing.

phantom stderr: PhantomJS has crashed. Please read the crash reporting guide at https://github.com/ariya/phantomjs/wiki/Crash-Reporting and file a bug report at https://github.com/ariya/phantomjs/issues/new with the crash dump file attached: /tmp/33f123c6-ff15-2aaf-67ac10e7-0bd6d0a1.dmp

AssertionError: signal killed phantomjs: SIGSEGV
    at Console.assert (console.js:102:23)
    at ChildProcess.<anonymous> (/root/yay/node_modules/plugbotapi/node_modules/phantom/phantom.js:128:21)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at Process.ChildProcess._handle.onexit (child_process.js:789:12)

and I have literally no idea where to go from here.

// connect to plug
    lib.api.getAuth(_auth,function(err,auth){
        if (err) return $err("Error Getting Auth.",err);
        note("Got Auth, Connecting to plug...","gray");
        global.$bot = new lib.api(auth);
        $bot.setMaxListeners(20);
        // $bot.debug.SHOWAPI = false;
        // $bot.debug.SHOWOTHER = false;
        $bot.connect($cfg.room);
        $bot.on('roomJoin',function(){
            $bot.getUsers(function(users){
                $bot.getMedia(function(media){
                    $bot.getStaff(function(staff){
                        $bot.getWaitList(function(waitlist){
                            $bot.getDJ(function(dj){
                                $bot.getRoomScore(function(score){
                                    return console.log(score);
                                });
                            });
                        });
                    });
                });
            });
        });
    });

18 June Plug.dj update seems to have broken the API

Plug.dj went down this afternoon for a software update and since it has come back online neither of my bots are working. They appear to connect but see no other users in the room.

It's like the data isn't making it through when an event fires. For example, this code:

bot.on('roomJoin', function(data) {
    util.log(util.inspect(data));

Yields:
18 Jun 17:28:28 - undefined

so the roomJoin event is being processed, but data is empty/undefined .

Cannot find module 'weak'

screen shot 2014-04-26 at 19 16 31

NPM version is 1.2.18
On installing weak I get:

npm ERR! Error: No compatible version found: nan@'>= 0.8.0 && < 1'

plugbotapi is latest

Error on connect, via phantom

I am running pretty default code:

  var _auth = {},
    room = 'room',
    api = require('plugbotapi');

  api.getAuth(_auth,function(err,auth){
    if (!err) {
      console.log("Got auth! Connecting To Room...");
      global.$bot = new api(auth);
      $bot.connect(room);
      $bot.on('roomJoin',function(){
        console.log("Joined Room! Powering On.....");
        $bot.getUsers(function(users){
          $bot.getMedia(function(media){
            return console.log(users,media);
          });
        });
      });
    }
  });

But I don't get any of my logs after Got Auth!, and then (after around 30 seconds of just sitting), I get this message in console:

phantom stdout: TypeError: 'null' is not an object (evaluating 'e.transport.onClose')

followed by this one:

phantom stdout: http://plug.dj/_/static/js/core.53afc28.js:144

PhantomJS on Cloud9

Hopefully this is a stupid question. I tried to set up PhantomJS on Cloud9 IDE and was unsuccessful - it kept running it out of drive space. I have about 900 mb free space there, but every time I tried the "git submodule update" step it exhausted all available drive space. I don't actually run my bot from Cloud9, but it's sure a whole lot simpler to develop it there, so it would be nice if there was a work-around for this. Is there?

voteUpdate not firing?

For some reason, my voteUpdate event doesn't seem to be firing when people vote. I hesitated to ask about this because I figured it must be my code's fault since the rest of the events work but I can't find the issue. I've stripped it down to the following though and I'm still not getting anything:

bot.on('voteUpdate', function(data) {
    console.log(data);
});

Double responses from bot

A normal startup looks like this:

debug: sjs connect
debug: sio connecting websocket
debug: sio connect
debug: sjs join rock-madness
debug: room joined
debug: sio join rock-madness

Today one of the restarts looked like this instead:

debug: sjs connect
debug: sjs disconnect SimpleEvent(type=close, code=3000, reason=Go away!, wasClean=true)
debug: sjs attempting to re-connect to the server 1
debug: sio connecting websocket
debug: sjs connect
debug: sio connect
debug: sjs join rock-madness
debug: room joined
debug: sio join rock-madness

When this happened, every time the bot was issued a command it would double respond. Regular events seemed unaffected (djAdvance, userJoin, etc).

Chat not always properly escaped, and therefore does not display

If a line of text sent with the chat action has multiple escaped characters, it fails.

This code:

bot.chat(data.from + ', you\'re in position ' + (iPos+1) + ', it\'ll be your turn to DJ in roughly ' + ((iPos+1) * iAvgLength).toFixed(0) + ' minutes.');

is producing this:

debug: result = API.sendChat('username, you\'re in position 10, it'll be your turn to DJ in roughly 40 minutes.');

Note that "it'll" is not properly escaped in the debug output, though it is in the original API call. It seems it fails on the second escaped character, as "you're" was escaped properly. Because of this, the text doesn't actually get output to the room.

In this example, I've changed "it'll" to "it will" to bypass the problem and the text properly sends.

Zero users?

A lot of times on connect (especially within the last few days), the bot connects and sees zero users in the room... Since that's obviously not possible (he should at least see himself), I just added a line of code to restart if that happens... but is there something more going on here? He frequently tries to reconnect 10 times or more even when Plug appears to be working fine.

I also periodically find the bot just missing, though the logs say he's in the room and nothing's happening (to him the room looks idle even when it's not). That may be the same thing going on... not sure?

Object [object Object] has no method 'connect'

@atomjack I got this error when running my bot with the latest version of plugbotapi and phantomjs 2.0.

Error Log:
TypeError: Object [object Object] has no method 'connect'
at /var/lib/stickshift/52bdc9f44382ecfb8d000026/app-root/data/704711/Plug.DJ
at /var/lib/stickshift/52bdc9f44382ecfb8d000026/app-root/data/704711/node_modules/plugbotapi/index.js:188:11
at Request._callback (/var/lib/stickshift/52bdc9f44382ecfb8d000026/app-root/data/704711/node_modules/plugbotapi/node_modules/plug-dj-login/index.js:32:11)
at Request.self.callback (/var/lib/stickshift/52bdc9f44382ecfb8d000026/app-root/data/704711/node_modules/plugbotapi/node_modules/plug-dj-login/node_modules/request/request.js:129:22)
at Request.EventEmitter.emit (events.js:98:17)
at Request. (/var/lib/stickshift/52bdc9f44382ecfb8d000026/app-root/data/704711/node_modules/plugbotapi/node_modules/plug-dj-login/node_modules/request/request.js:873:14)
at Request.EventEmitter.emit (events.js:117:20)
at IncomingMessage. (/var/lib/stickshift/52bdc9f44382ecfb8d000026/app-root/data/704711/node_modules/plugbotapi/node_modules/plug-dj-login/node_modules/request/request.js:824:12)
at IncomingMessage.EventEmitter.emit (events.js:117:20)
at _stream_readable.js:920:16

Bot stopped wooting, had to change the code

Change the woot and meh icons to .icon-woot and .icon-meh respectively

Line 501:

      if(which == 'woot')
        $('.icon-woot').click();
      else if(which == 'meh') {
        $('.icon-meh').click();
      }

Coming from plugapi

If I had a bot written for the original API, how much effort would it be to migrate it over? Is the data being passed in the same structure?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.