I have an image
command for my bot. This is used for memes and other funny pictures. My bot just scrapes Google for the best result. But on the other side, you can also look up, well, NSWF images. Since I don't want people sending those, I am trying to build a profanity filter. It now works like this:
$image cheese
If the word cheese
is chosen, nothing should happen, but if there is something NSWF, the bot should detect that and delete the $image NSFW-word
command. I already have a list of profanity list, now just the implementation. My command now, that doesn't work is:
const blacklist = require("./../Other/profanity.js");
blacklist.forEach((word) => {
if (message.content.toLowerCase().includes(word));
message.delete();
message.channel.send("Let's try to keep it family friendly!");
console.log(`${message.author} used the word ${word} in an image search.`)
});
My profanity list (profanity.js) looks like this:
module.exports = [
"NSFW1",
"NSFW2",
"NSWF3",
"Etc"
]
Also, I should note, that piece of code is broken. Even if someone sends cheese
, it spams (infinite times, untill I shut-down the bot) the 'lets-keep-it-family-friendly' phrase. I searched the whole internet, but couldn't find the right fit.
So can anyone help me?