hubot-pushbot
Version:
PushBot implementation for hubot which is: "PushBot is an IRC bot that manages the topic in an IRC channel that has a push train."
25 lines (24 loc) • 830 B
JavaScript
var fs = require('fs');
var path = require('path');
module.exports = function (robot, scripts) {
'use strict';
var scriptsPath = path.resolve(__dirname, 'src');
return fs.exists(scriptsPath, function (exists) {
if (exists) {
var ref = fs.readdirSync(scriptsPath);
var results = [];
for (var i = 0, len = ref.length; i < len; i++) {
var script = ref[i];
if (scripts && scripts.indexOf('*') < 0) {
if (scripts.indexOf(script) > -1) {
results.push(robot.loadFile(scriptsPath, script));
}
}
else {
results.push(robot.loadFile(scriptsPath, script));
}
}
return results;
}
});
};