bugfix
This commit is contained in:
parent
4af52d6609
commit
ddd1530c8e
11
src/bot.js
11
src/bot.js
|
@ -10,13 +10,12 @@ read().then(() => {
|
||||||
_trigger: new Map()
|
_trigger: new Map()
|
||||||
};
|
};
|
||||||
|
|
||||||
const files = fs.readdirSync(`${__dirname}/inc/trigger/`);
|
fs.readdirSync(`${__dirname}/inc/trigger/`).forEach(file => {
|
||||||
for (let file in files) {
|
if(file.substr(-3, 3) === ".js") {
|
||||||
if (files[file].substr(-3, 3) === ".js") {
|
logger.info(`(main) loading trigger: ${file}`);
|
||||||
logger.info(`(main) loading trigger: ${files[file]}`);
|
require(`${__dirname}/inc/trigger/${file}`)(self);
|
||||||
require(`${__dirname}/inc/trigger/${files[file]}`)(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()) {
|
||||||
|
|
|
@ -37,7 +37,11 @@ module.exports = bot => {
|
||||||
return e.reply(`holy fuck, Ausgabe wäre viel zu lang! (${output.length} Zeichen :DDDDDD)`);
|
return e.reply(`holy fuck, Ausgabe wäre viel zu lang! (${output.length} Zeichen :DDDDDD)`);
|
||||||
else {
|
else {
|
||||||
_contexts.set(`${e.network}.${e.channel}.${e.user.nick}`, context);
|
_contexts.set(`${e.network}.${e.channel}.${e.user.nick}`, context);
|
||||||
sql.exec("update `useless` set `data` = ? where `trigger` = 'sandbox_js';", JSON.stringify(stringify([..._contexts]).replace(/\n/g, "").replace(/\t/g, "")))
|
let tmp = JSON.stringify(stringify([..._contexts])
|
||||||
|
.replace(/\n/g, "")
|
||||||
|
.replace(/\t/g, "")
|
||||||
|
.split("[native code]").join(""));
|
||||||
|
sql.exec("update `useless` set `data` = ? where `trigger` = 'sandbox_js';", tmp)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
e.reply(output);
|
e.reply(output);
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue
Block a user