Skip to content

Instantly share code, notes, and snippets.

@SomeKittens

SomeKittens/gist:9579594

Last active Aug 29, 2015
Embed
What would you like to do?
Converting commands

We need to edit/test all the plugins, found here: https://github.com/SomeKittens/bot-plugins

Plugins are in this form:

(function() {
  // ...plugin
})();

Switch that to this:

module.exports = function(bot, IO) {
  // ...plugin
};

We'll need to manually call this in bot.js (it's near the bottom, it'll be replaced after all the plugins are fixed).

require('../bot-plugins/$PLUGIN_NAME')(bot, IO);

and that's it!

...unless it's not. I think I've changed all the JSONP and xhr, but those should be changed to IO.request.

In addition, define and unonebox need to be rewritten with jsdom, stat returns Unicode for some reason, converter and roomPermissions need testing, substitution needs some way of tracking chat history and many other things that will eventually crop up.

@AmaanC

This comment has been minimized.

Copy link

@AmaanC AmaanC commented Mar 16, 2014

I've fixed define up along with stop, meme and most of undo (the command works, the permission mechanism doesn't yet).

@AmaanC

This comment has been minimized.

Copy link

@AmaanC AmaanC commented Mar 16, 2014

Also changed it so commands that register to the input event using IO actually fire on input now

@AmaanC

This comment has been minimized.

Copy link

@AmaanC AmaanC commented Mar 16, 2014

Fixed the stat command. The issue was that the API responded with Gzipped contents

@ralt

This comment has been minimized.

Copy link

@ralt ralt commented Mar 18, 2014

The eval module should have some special consideration. What do we use instead of WebWorker? Can we have something that will not crash the node process, similarly to how the current implementation does?

I guess using the vm module is the way to go, but will the "Too much recursion" errors and the likes crash the process?

@SomeKittens

This comment has been minimized.

Copy link
Owner Author

@SomeKittens SomeKittens commented Mar 19, 2014

@ralt: Node actually provides a worker class (insert Marxist undertones here) that might actually be run with a little more freedom thanks to our ability to actually kill the process if it starts eating processing.

@Jhawins

This comment has been minimized.

Copy link

@Jhawins Jhawins commented Mar 21, 2014

@SomeKittens can all the plugins just go into a /plugins folder and then we can loop through it with require()? Would be much cleaner/dynamic.

EDIT: I'm told this is how it'll work in the future?

@SomeKittens

This comment has been minimized.

Copy link
Owner Author

@SomeKittens SomeKittens commented Mar 24, 2014

Think of the current state of plugin loading as dev mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment