Is there any way that I can stop my Discord bot from deleting all messages? I only want to delete messages that include banned words.
client.on('messageCreate', async message => {
if (message.author.bot || !message.guildId)
return;
if (message.content.includes(badWords))
await message.reply("Not cool buddy you getting a timeout")
message.delete()
return;
})
Can anyone solve this because I couldn’t find anything? I asked some people too but I couldn’t understand what they mean.
3
Answers
It looks like a typo. You don’t have curly braces around the whole block you want to execute when that if statement is true:
I don’t know anything about Discord but this part of your logic doesn’t look right…
Because "badWords" must be an array of strings and you’re meant to loop through them.
Probably something like this…
Yes bro its a typo, You don’t have curly braces around the whole block you want to execute when that if statement is true.