I'm adding an auto-mod for swearing, I want the bot to look for any word from the list in config.json
named "badwords" and delete it, which works, but if the member adds " "(space) or "_" or anything like that, it bypasses the check, so I added .replace(//s/g,'')
which works for space, but for dash and other stuff, I wanted to use a list in config.json
, but I can't seem to get the bot to run thru the list, there are no errors, so how can I fix this problem?
here is my code:
const config = require('../../config');
module.exports = async (client, message) => {
if (!message.guild) return;
if(!message.author.bot) {
var badwords = config.badwords;
var thingstoremove = config.thingstoremove;
for (var i = 0; i < badwords.length; i++) {
if (message.content.toLowerCase().replace(thingstoremove[8],'').includes(badwords[i])) {
message.delete()
message.reply("Watch your language!").then(m => m.delete({timeout: 10000}))
break;
}
}
}
}
config.json:
{
"badwords": ["test1", "test2", "test3", "test4", "test5"],
"thingstoremove": ["-", "_", ".", ",", "`", "~", "@", "#"]
}
Thanks.