swear word javascript + cooldown + delete mesagge discord.js
bot.on("message", async(message) => {
if(message.member.hasPermission(['ADMINISTRATOR'])) return;
let swearwords = ["arse","ass","asshole","bastard","bitch","bollocks","brotherfucker","bugger","bullshit","child-fucker","Christ on a bike","Christ on a cracker","crap","cunt","damn","effing","fatherfucker","frigger","fuck","godsdamn","hell","holy shit","horseshit","Jesus Christ","Jesus fuck","Jesus H. Christ","Jesus Harold Christ","Jesus wept","Jesus, Mary and Joseph","Judas Priest","motherfucker","nigga","prick","shit","shit ass","shitass","sisterfucker","slut","son of a bitch","son of a whore","sweet Jesus","twat"]
let foundInText = false;
for (var i in swearwords){
if (message.content.includes(swearwords[i])) foundInText = true;
}
if (foundInText) {
message.delete();
if (talkedRecently.has(message.author.id)) {
return;
} else {
talkedRecently.add(message.author.id);
setTimeout(() => {
talkedRecently.delete(message.author.id);
}, 120000);
}
message.channel.send("**Do not post yourself or any other post** -" + "<@" + message.author + ">" )
.then(sentMessage => sentMessage.delete({ timeout: 30000 }))
.catch(console.error)
}
})