misc stuff

This commit is contained in:
Erik 2021-05-03 17:56:09 +03:00
parent 022b436536
commit 94b884e9d8
4 changed files with 8 additions and 5 deletions

View File

@ -46,6 +46,7 @@ class DiscordClient extends Client {
this._evals = new Map();
process.on('message', this._handleMessage.bind(this));
this.on('debug', this.logger.debug.bind(this.logger));
}
@ -88,11 +89,13 @@ class DiscordClient extends Client {
}
for (const [param, val] of Object.entries(parameters)) {
// eslint-disable-next-line require-unicode-regexp
template = template.replace(new RegExp(`{${escapeRegex(param.toLowerCase())}}`, 'gi'), val);
}
if(code) {
try {
// eslint-disable-next-line no-eval
template = eval(template);
} catch(error) {
this.client.logger.error(`Error in locale ${language}:${index} while executing code.\n${error.stack || error}`);

View File

@ -97,7 +97,7 @@ class Resolver {
.filter((c) => type === 'any' || c.type === type)
.filter(exact ? (c) => c.tags.includes(key) : filterInexactTags(key))
.array();
return components || [];
}

View File

@ -49,7 +49,7 @@ class MessageLogsSetting extends Setting {
const { guild } = message;
const setting = guild._settings[this.index];
if (['roles', 'role', 'ignoredrole', 'ignoredroles', 'ignorerole', 'ignoreroles'].includes(method)) {
if (['bypass', 'roles', 'role', 'ignoredrole', 'ignoredroles', 'ignorerole', 'ignoreroles'].includes(method)) {
if (!args.length) return {
msg: message.format('MISSING_ARGS'),
@ -96,7 +96,7 @@ class MessageLogsSetting extends Setting {
};
}
} else if (['channels', 'channel', 'ignoredchannels', 'ignoredchannel', 'ignorechannel', 'ignorechannels'].includes(method)) {
} else if (['ignore', 'channels', 'channel', 'ignoredchannels', 'ignoredchannel', 'ignorechannel', 'ignorechannels'].includes(method)) {
if (!args.length) return {
msg: message.format('MISSING_ARGS'),

View File

@ -347,12 +347,12 @@ module.exports = class WordFilter extends FilterSetting {
},
{
name: '》 Fuzzy filter',
value: setting.fuzzy.length ? '||' + setting.fuzzy.join(', ') + '||' : '`N/A`',
value: setting.fuzzy?.length ? '||' + setting.fuzzy.join(', ') + '||' : '`N/A`',
inline: true
},
{
name: '》 Regex filter',
value: setting.regex.length ? '`' + setting.regex.join('`\n`') + '`' : '`N/A`',
value: setting.regex?.length ? '`' + setting.regex.join('`\n`') + '`' : '`N/A`',
inline: true
},
{