forked from Galactic/galactic-bot
reload whitelist function
This commit is contained in:
parent
7dac86bb2a
commit
0b150680ff
@ -3,7 +3,7 @@ const { inspect } = require('util');
|
||||
const { username } = require('os').userInfo();
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { Util } = require("../../../../utilities");
|
||||
const { Util, FilterUtil } = require("../../../../utilities");
|
||||
|
||||
|
||||
class EvalCommand extends Command {
|
||||
|
@ -3,6 +3,8 @@ const similarity = require('similarity');
|
||||
const { FilterPresets } = require('../constants/index.js');
|
||||
const BinaryTree = require('./BinaryTree.js');
|
||||
const Logger = require('./Logger.js');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = class FilterUtility {
|
||||
|
||||
@ -16,6 +18,11 @@ module.exports = class FilterUtility {
|
||||
|
||||
}
|
||||
|
||||
static reloadFilterWhitelist() {
|
||||
const { whitelist } = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'src/constants/FilterPresets.json'), { encoding: 'utf-8' }));
|
||||
FilterUtility.whitelist = new BinaryTree(null, whitelist);
|
||||
}
|
||||
|
||||
/*static filter = {
|
||||
words: CONFIG.words.map((word) => new RegExp(`(${word})`, 'gi')),
|
||||
_words: CONFIG._words,
|
||||
|
Loading…
Reference in New Issue
Block a user