让机器人删除用户输入的消息 (discord.js)

时间:2021-05-04 22:41:07

标签: javascript discord.js

我写下了这段代码,机器人会检测到坏词,然后说“语言!”但不会删除用户发送的消息。

 if (badWords.some(word => msg.content.includes(word))) {
    msg.delete(1000)
    msg.reply("LANGUAGE, YOU MUFFIN!!")
  }
})

1 个答案:

答案 0 :(得分:0)

//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
        }
    }