Uwev2/src/bot.mjs

26 lines
781 B
JavaScript
Raw Normal View History

2017-12-04 11:22:53 +00:00
import { logger } from "./inc/log";
import { read, cfg } from "./inc/cfg";
import { wrapper } from "./inc/wrapper";
2018-03-01 05:45:26 +00:00
import triggers from "./inc/trigger";
import events from "./inc/events";
2017-11-07 17:22:41 +00:00
read().then(() => {
2017-11-20 16:30:20 +00:00
const self = {
2017-11-26 23:00:54 +00:00
_trigger: new Map(),
2018-03-01 06:02:33 +00:00
trigger: function trigger(args) {
this.call = args.call;
this.help = args.help || false;
this.level = args.level || 0;
this.active = args.hasOwnProperty("active") ? args.active : true;
this.set = args.set || "all"; // uwe, nxy, f0ck, all
this.clients = args.clients || ["irc", "tg", "discord"];
this.f = args.f;
},
bot: new wrapper()
2017-11-20 16:30:20 +00:00
};
2017-12-04 13:59:42 +00:00
triggers.forEach(mod => mod(self));
2018-03-01 05:45:26 +00:00
events.forEach(event => event(self));
2018-03-01 06:02:33 +00:00
}).catch(err => logger.error(`(main) ${err.message}`));