Discord.js V12 Rude Words Filter Not Working
so I am adding like a rude words filter, whenever someone says that word (lowercase or uppercase) it deletes their message and replies back with something and then the reply gets d
Solution 1:
rudeWords
is an array, not a string so you can't compare message.content
to rudeWords
by checking if they're equal, instead, you need to use includes()
client.on('message', message => {
if (message.author.bot) return;
let rudeWords = ["kys", "kill yourself"];
if (rudeWords.includes(message.content.toLowerCase())) {
message.delete()
message.reply('do not use that word here, thank you.').then(msg => {
msg.delete({ timeout: 3000 })
})
}})
Post a Comment for "Discord.js V12 Rude Words Filter Not Working"