@dunnbot/support
Version:
Helpful items for developing plugins.
69 lines (52 loc) • 1.41 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
var _bluebird = require('bluebird');
var _bluebird2 = _interopRequireDefault(_bluebird);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
class Plugin {
static get pluginName() {
return this.name.toLowerCase();
}
static setup() {
return _bluebird2.default.resolve();
}
constructor(client) {
this.client = client;
return this.handler(client.bot);
}
get db() {
return this.client.db;
}
on(...args) {
this.client.on(...args);
return this;
}
get(...args) {
return this.client.webServer.get(...args);
}
post(...args) {
return this.client.webServer.post(...args);
}
log(message) {
return process.stdout.write(`${ message }\n`);
}
error(message) {
return process.stderr.write(`ERROR: ${ message }\n`);
}
command(command, callback) {
return this.on(`command:${ command }`, callback);
}
send(recipient, message) {
return this.client.write(`PRIVMSG ${ recipient } :${ message }`);
}
action(recipient, action) {
return this.client.write(`PRIVMSG ${ recipient } :\u0001ACTION ${ action }\u0001`);
}
}
exports.default = Plugin;
Plugin.description = 'No description provided.';
Plugin.author = 'No author provided.';
Plugin.help = null;
module.exports = exports['default'];