Advertisements
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.
>Solution :
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:
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;
}
})