This commit is contained in:
Flummi 2017-11-27 00:09:41 +01:00
parent cef5d1463c
commit fea750f11f

View File

@ -11,13 +11,12 @@ read().then(() => {
trigger: trigger
};
/*fs.readdirSync(`${__dirname}/inc/trigger/`).forEach(file => {
fs.readdirSync(`${__dirname}/inc/trigger/`).forEach(file => {
if(file.substr(-3, 3) === ".js") {
logger.info(`(main) loading trigger: ${file}`);
require(`${__dirname}/inc/trigger/${file}`)(self);
}
});*/
require(`${__dirname}/inc/trigger/kernel.js`)(self);
});
bot.on("message", e => { // Todo: eventhandler
for (var [name, trigger] of self._trigger.entries()) {
@ -41,7 +40,6 @@ read().then(() => {
break;
}
console.log(trigger);
trigger.f(e);
}
logger.info(`${e.network} -> ${e.channel} -> ${e.user.nick}: ${e.message}`);
@ -52,10 +50,10 @@ read().then(() => {
});
});
function trigger(args, trigger) {
function trigger(args) {
this.call = args.call;
this.level = args.level || 0;
this.active = args.active || true;
this.active = args.hasOwnProperty("active") ? args.active : true;
this.clients = args.clients || ["irc", "tg"];
this.f = args.f;
}