diff --git a/src/structure/components/commands/developer/Eval.js b/src/structure/components/commands/developer/Eval.js index 876005b..1bdfce4 100644 --- a/src/structure/components/commands/developer/Eval.js +++ b/src/structure/components/commands/developer/Eval.js @@ -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 { diff --git a/src/utilities/FilterUtil.js b/src/utilities/FilterUtil.js index 032d68f..a02ca73 100644 --- a/src/utilities/FilterUtil.js +++ b/src/utilities/FilterUtil.js @@ -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,