totallymike / ircnode

Extensible IRC bot written with node.js
https://github.com/totallymike/ircnode/wiki
MIT License
4 stars 2 forks source link

Reloading plugins on file change #52

Closed sigv closed 11 years ago

sigv commented 11 years ago

Adds plugin reloading on plugin file change and persistent storage for storing data when reloading. Closes #9.

// Simple example plugin to demonstrate new functions.

var irc = global.irc;

var cmd_handler = function (act) {
  exports.store.countVar++;
  irc.privmsg(act.source, 'Hi, #' + exports.store.countVar + '!');
};

// The name of plugin. Associated with plugin's data.
exports.name = 'hello';
// All commands and their respective handlers.
exports.commands = { 'hello': cmd_handler };
// Plugin's data which needs to be retained.
exports.store = { 'countVar': 0 };