📜  如何使用 discord.js 将单词列入黑名单 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:09.040000             🧑  作者: Mango

代码示例1
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!")
    })