繁体   English   中英

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

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

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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