derp
This commit is contained in:
parent
cef5d1463c
commit
fea750f11f
10
src/bot.js
10
src/bot.js
|
@ -11,13 +11,12 @@ read().then(() => {
|
||||||
trigger: trigger
|
trigger: trigger
|
||||||
};
|
};
|
||||||
|
|
||||||
/*fs.readdirSync(`${__dirname}/inc/trigger/`).forEach(file => {
|
fs.readdirSync(`${__dirname}/inc/trigger/`).forEach(file => {
|
||||||
if(file.substr(-3, 3) === ".js") {
|
if(file.substr(-3, 3) === ".js") {
|
||||||
logger.info(`(main) loading trigger: ${file}`);
|
logger.info(`(main) loading trigger: ${file}`);
|
||||||
require(`${__dirname}/inc/trigger/${file}`)(self);
|
require(`${__dirname}/inc/trigger/${file}`)(self);
|
||||||
}
|
}
|
||||||
});*/
|
});
|
||||||
require(`${__dirname}/inc/trigger/kernel.js`)(self);
|
|
||||||
|
|
||||||
bot.on("message", e => { // Todo: eventhandler
|
bot.on("message", e => { // Todo: eventhandler
|
||||||
for (var [name, trigger] of self._trigger.entries()) {
|
for (var [name, trigger] of self._trigger.entries()) {
|
||||||
|
@ -41,7 +40,6 @@ read().then(() => {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(trigger);
|
|
||||||
trigger.f(e);
|
trigger.f(e);
|
||||||
}
|
}
|
||||||
logger.info(`${e.network} -> ${e.channel} -> ${e.user.nick}: ${e.message}`);
|
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.call = args.call;
|
||||||
this.level = args.level || 0;
|
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.clients = args.clients || ["irc", "tg"];
|
||||||
this.f = args.f;
|
this.f = args.f;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user