Merge branch 'dev' of git.lat:f0ck/f0ckv2 into dev
This commit is contained in:
commit
40da7f4f34
@ -20,31 +20,31 @@ import flummpress from "flummpress";
|
||||
bot: await new cuffeo(cfg.clients)
|
||||
};
|
||||
|
||||
//console.time("loading");
|
||||
console.time("loading");
|
||||
const modules = {
|
||||
events: (await fs.readdir("./src/inc/events")).filter(f => f.endsWith(".mjs")),
|
||||
trigger: (await fs.readdir("./src/inc/trigger")).filter(f => f.endsWith(".mjs"))
|
||||
};
|
||||
|
||||
//console.timeLog("loading", "directories");
|
||||
console.timeLog("loading", "directories");
|
||||
const blah = (await Promise.all(Object.entries(modules).map(async ([dir, mods]) => ({
|
||||
[dir]: (await Promise.all(mods.map(async mod => {
|
||||
const res = await Promise.race([
|
||||
(await import(`./inc/${dir}/${mod}`)).default(self),
|
||||
new Promise((_, rej) => setTimeout(() => rej(false), timeout))
|
||||
]);
|
||||
//console.timeLog("loading", `${dir}/${mod}`);
|
||||
console.timeLog("loading", `${dir}/${mod}`);
|
||||
return res;
|
||||
}))).flat(2)
|
||||
})))).reduce((a, b) => ({...a, ...b}));
|
||||
|
||||
blah.events.forEach(event => {
|
||||
//console.timeLog("loading", `registering event > ${event.name}`);
|
||||
console.timeLog("loading", `registering event > ${event.name}`);
|
||||
self.bot.on(event.listener, event.f);
|
||||
});
|
||||
|
||||
blah.trigger.forEach(trigger => {
|
||||
//console.timeLog("loading", `registering trigger > ${trigger.name}`);
|
||||
console.timeLog("loading", `registering trigger > ${trigger.name}`);
|
||||
self._trigger.set(trigger.name, new self.trigger(trigger));
|
||||
});
|
||||
|
||||
@ -125,4 +125,8 @@ import flummpress from "flummpress";
|
||||
await router.importRoutesFromPath("src/inc/routes", tpl);
|
||||
|
||||
app.listen(cfg.websrv.port);
|
||||
|
||||
db.subscribe('*:items', (row, { command, old }) => {
|
||||
console.log(command, row, old);
|
||||
});
|
||||
})();
|
||||
|
Loading…
Reference in New Issue
Block a user