Answers for "blacklisted word command discordjs"

2

blacklisted word discord.js

let blacklisted = ['word', 'word'];
    let foundInText = false;
    for (var i in blacklisted) {
      if (message.content.toLowerCase().includes(blacklisted[i].toLowerCase())) foundInText = true;
    }
    if (foundInText) {
      message.delete();
      Message.channel.send();
Posted by: Guest on April-15-2020
0

How to blacklist words with discord.js

const blacklist = ['bad word 1', 'bad word 2', 'bad word 3']
    blacklist.forEach(word => {
        // 'word' represents an element inside of the array. 
        // Everytime the client is finished walking through an element, the value of 'word' changes to the next one!
        if (message.content.toLowerCase().includes(word)) message.delete() && message.author.send("Keep the use of Profanity out of our server!")
    })
Posted by: Guest on November-18-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language