brrrrrrrrrrrrrrrrrrr
This commit is contained in:
parent
98692a8d62
commit
3b55561b89
@ -41,7 +41,7 @@ class Manager extends EventEmitter {
|
||||
await this.shardManager.spawn();
|
||||
// G:\Documents\My programs\GBot\New GBot\api\index.cjs
|
||||
this.info('Shards done, booting up API...');
|
||||
const API = await import('./api/index.js').catch((err) => this.error(`Import of API Manager failed.\n${err.stack}`));
|
||||
const API = await import('./api/index.js').catch(() => this.warn(`Import of API Manager failed. Skipping API.`));
|
||||
if (API) {
|
||||
const { default: APIManager } = API;
|
||||
this.apiManager = new APIManager(this);
|
||||
|
@ -78,7 +78,7 @@ module.exports = class WordFilter extends FilterSetting {
|
||||
} else if (['explicit', 'fuzzy', 'regex', 'whitelist'].includes(method)) {
|
||||
|
||||
const [first, ...rest] = args; // First arg should skip sanitisation
|
||||
if (method === 'regex') args = rest.map((arg) => Util.sanitiseRegex(arg));
|
||||
if (method === 'regex') args = rest.map((arg) => Util.sanitiseRegex(arg, ['?', '\\', '(', ')', '|', '\\[', '\\]', '.', '-']));
|
||||
const resolved = await resolver.resolveMethod([first, ...args], {
|
||||
existing: setting[method],
|
||||
allowedMethods: ['add', 'remove', 'set', 'reset']
|
||||
|
@ -124,11 +124,11 @@ class Util {
|
||||
*
|
||||
* @static
|
||||
* @param {string} input
|
||||
* @param {string} [allowed=['?', '\\', '(', ')', '|']]
|
||||
* @param {string[]} [allowed=['?', '\\', '(', ')', '|']]
|
||||
* @return {string} The sanitised expression
|
||||
* @memberof Util
|
||||
*/
|
||||
static sanitiseRegex(input, allowed = ['?', '\\', '(', ')', '|', '\\[', '\\]', '.']) {
|
||||
static sanitiseRegex(input, allowed = ['?', '\\', '(', ')', '|']) {
|
||||
if (!input) throw new Error('Missing input');
|
||||
const reg = new RegExp(`[${this.regChars.filter((char) => !allowed.includes(char)).join('')}]`, 'gu');
|
||||
return input.replace(reg, '\\$&');
|
||||
|
Loading…
Reference in New Issue
Block a user