forked from Galactic/galactic-bot
misc
This commit is contained in:
parent
9e8beb687f
commit
287193dd17
2
index.js
2
index.js
@ -1,4 +1,4 @@
|
||||
const env = require('dotenv').config({ override: true, debug: true });
|
||||
require('dotenv').config({ override: true });
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Starting in ${process.env.NODE_ENV} mode`);
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "node index.js",
|
||||
"dev": "nodemon --trace-warnings --unhandled-rejections=strict index.js",
|
||||
"dev": "node --trace-warnings --unhandled-rejections=strict index.js",
|
||||
"debug": "node --trace-warnings --inspect index.js",
|
||||
"update": "git pull && cd api && yarn update",
|
||||
"test": "jest --detectOpenHandles",
|
||||
|
@ -70,7 +70,7 @@ class DiscordClient extends Client {
|
||||
// });
|
||||
|
||||
process.on('unhandledRejection', (err, reason) => {
|
||||
this.logger.error(`Unhandled rejection:\n${err.stack || err}\n${inspect(reason)}`);
|
||||
this.logger.error(`Unhandled rejection:\n${err?.stack || err}\n${inspect(reason)}`);
|
||||
});
|
||||
|
||||
process.on('message', this._handleMessage.bind(this));
|
||||
@ -135,7 +135,7 @@ class DiscordClient extends Client {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
this._evals.set(script, { resolve, reject });
|
||||
process.send({ _mEval: true, script });
|
||||
process.send({ _mEval: true, script, debug: options.debug || process.env.NODE_ENV === 'development' });
|
||||
|
||||
});
|
||||
|
||||
|
@ -222,28 +222,42 @@ class Setting extends Component {
|
||||
|
||||
// Manipulator functions
|
||||
add(list = [], params = [], caseSensitive = false) {
|
||||
const modified = [],
|
||||
skipped = [];
|
||||
|
||||
for (const param of params) {
|
||||
if (!list.includes(param)) list.push(!caseSensitive ? param : param.toLowerCase());
|
||||
if (!list.includes(param)) {
|
||||
list.push(!caseSensitive ? param : param.toLowerCase());
|
||||
modified.push(param);
|
||||
} else skipped.push(param);
|
||||
}
|
||||
return list;
|
||||
|
||||
return { list, modified, skipped };
|
||||
}
|
||||
|
||||
remove(list = [], params = [], caseSensitive = false) {
|
||||
const modified = [],
|
||||
skipped = [];
|
||||
|
||||
for (const param of params) {
|
||||
if (list.includes(param)) list.splice(list.indexOf(!caseSensitive ? param : param.toLowerCase()), 1);
|
||||
if (list.includes(param)) {
|
||||
list.splice(list.indexOf(!caseSensitive ? param : param.toLowerCase()), 1);
|
||||
} else skipped.push(param);
|
||||
}
|
||||
return list;
|
||||
|
||||
return { list, modified, skipped };
|
||||
}
|
||||
|
||||
set(list, params = []) {
|
||||
const modified = [...new Set(params)];
|
||||
list.splice(0, list.length);
|
||||
list.push(...params);
|
||||
return list;
|
||||
list.push(...modified);
|
||||
return { list, modified };
|
||||
}
|
||||
|
||||
reset(list) {
|
||||
list.splice(0, list.length);
|
||||
return list;
|
||||
const modified = list.splice(0, list.length);
|
||||
return { list, modified };
|
||||
}
|
||||
|
||||
// Functions for message component based settings
|
||||
|
Loading…
Reference in New Issue
Block a user