blah
This commit is contained in:
parent
75a700e332
commit
510838db4d
@ -11,6 +11,7 @@
|
||||
"dependencies": {
|
||||
"node-fetch": "^2.2.0",
|
||||
"nodejs-mysql2": "git+https://gitfap.de/Flummi/nodejs-mysql2.git",
|
||||
"cuffeo": "git+https://gitfap.de/keinBot/cuffeo.git",
|
||||
"request": "^2.88.0",
|
||||
"request-promise-native": "^1.0.5",
|
||||
"winston": "^2.4.0"
|
||||
|
@ -6,6 +6,7 @@ let cfg = {
|
||||
websrv: {},
|
||||
trigger: {}
|
||||
};
|
||||
let admins = [];
|
||||
|
||||
const read = () => new Promise((resolve, reject) => {
|
||||
sql.exec("select * from cfg").then(rows => {
|
||||
@ -27,11 +28,33 @@ const read = () => new Promise((resolve, reject) => {
|
||||
type: rows[row].type
|
||||
}
|
||||
}
|
||||
resolve();
|
||||
loadAdmins().then(() => {
|
||||
resolve();
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
reject("no cfg");
|
||||
})
|
||||
});
|
||||
|
||||
export { cfg, read };
|
||||
export const loadAdmins = () => new Promise((resolve, reject) => {
|
||||
admins = [];
|
||||
sql.exec(`select * from admins`)
|
||||
.then(rows => {
|
||||
rows.forEach(row => {
|
||||
admins.push({
|
||||
id: row.id,
|
||||
prefix: row.prefix,
|
||||
account: row.account,
|
||||
network: row.network,
|
||||
level: row.level
|
||||
});
|
||||
});
|
||||
resolve();
|
||||
})
|
||||
.catch(err => {
|
||||
reject("keine Admins vorhanden");
|
||||
});
|
||||
});
|
||||
|
||||
export { cfg, read, admins };
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { logger } from "./inc/log";
|
||||
import { read, cfg } from "./inc/cfg";
|
||||
import { wrapper } from "./inc/wrapper";
|
||||
import { read, cfg, admins } from "./inc/cfg";
|
||||
//import { wrapper } from "./inc/wrapper";
|
||||
import { cuffeo } from "cuffeo";
|
||||
|
||||
import triggers from "./inc/trigger";
|
||||
import events from "./inc/events";
|
||||
@ -17,11 +18,10 @@ read().then(() => {
|
||||
this.clients = args.clients || ["irc", "tg", "discord"];
|
||||
this.f = args.f;
|
||||
},
|
||||
bot: new wrapper()
|
||||
bot: new cuffeo(cfg.client, admins)
|
||||
};
|
||||
|
||||
triggers.forEach(mod => {
|
||||
console.log(mod);
|
||||
mod(self);
|
||||
});
|
||||
events.forEach(event => event(self));
|
||||
|
Loading…
Reference in New Issue
Block a user