简体   繁体   中英

Getting A Bot To Delete A User-Typed Message (discord.js)

I have this code written down, and the bot will detect the bad word, and say "LANGUAGE." but won't delete the message the user sent.

 if (badWords.some(word => msg.content.includes(word))) {
    msg.delete(1000)
    msg.reply("LANGUAGE, YOU MUFFIN!!")
  }
})
//Replace these words with the bad words 

const word = ['shrex','fiona', 'rick astley']
        
       
    for(i = 0; i < word.length; i++) {
        if(message.content.toLowerCase().includes(word[i])) {
            message.delete()
            message.reply("You muffin.")//Change this to whatever you want it to say
        }
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM