久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Discord.js V12 粗魯的話過濾器不起作用

Discord.js V12 Rude words filter not working(Discord.js V12 粗魯的話過濾器不起作用)
本文介紹了Discord.js V12 粗魯的話過濾器不起作用的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

所以我像粗魯的詞過濾器一樣添加,每當有人說那個詞(小寫或大寫)時,它會刪除他們的消息并回復一些內容,然后回復會在幾秒鐘內被刪除.

so I am adding like a rude words filter, whenever someone says that word (lowercase or uppercase) it deletes their message and replies back with something and then the reply gets deleted in a few seconds.

這是我當前的代碼,但它不會讀取 rudeWords 并且當我在聊天中寫下任何粗魯的話時也不會做任何事情.

Here's my current code, but it doesn't read the rudeWords and doesn't do anything when I write any of the rude words in the chat.

client.on('message', message => {
    if (message.author.bot) return;
    let rudeWords = ["kys", "kill yourself"];
    if (message.content.toLowerCase() === rudeWords) {
        message.delete()
        message.reply('do not use that word here, thank you.').then(msg => {
        msg.delete({ timeout: 3000 })
    })
}})

推薦答案

rudeWords 是一個數組,而不是字符串,所以你不能將 message.contentrudeWords 通過檢查它們是否相等,相反,您需要使用 includes()

rudeWords is an array, not a string so you can't compare message.content to rudeWords by checking if they're equal, instead, you need to use includes()

client.on('message', message => {
    if (message.author.bot) return;
    let rudeWords = ["kys", "kill yourself"];
    if (rudeWords.includes(message.content.toLowerCase())) {
        message.delete()
        message.reply('do not use that word here, thank you.').then(msg => {
        msg.delete({ timeout: 3000 })
    })
}})

這篇關于Discord.js V12 粗魯的話過濾器不起作用的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

discord.js v12: How do I await for messages in a DM channel?(discord.js v12:我如何等待 DM 頻道中的消息?)
how to make my bot mention the person who gave that bot command(如何讓我的機器人提及發出該機器人命令的人)
How to fix Must use import to load ES Module discord.js(如何修復必須使用導入來加載 ES 模塊 discord.js)
How to list all members from a specific server?(如何列出來自特定服務器的所有成員?)
Discord bot: Fix ‘FFMPEG not found’(Discord bot:修復“找不到 FFMPEG)
Welcome message when joining discord Server using discord.js(使用 discord.js 加入 discord 服務器時的歡迎消息)
主站蜘蛛池模板: 日韩久久久一区二区 | 亚洲天堂中文字幕 | 欧美日韩在线一区二区 | 亚洲国产精品一区二区第一页 | 超碰在线免费 | 国产91久久久久 | 在线免费视频一区 | 北条麻妃99精品青青久久 | 欧美精品欧美精品系列 | 一级片网址 | 亚洲精品一级 | 久久综合久色欧美综合狠狠 | 日韩中文字幕免费在线观看 | 一区在线视频 | 天天草天天干 | 成人夜晚看av | 久久精品99久久 | 精品av | 国产精品无码永久免费888 | 欧美在线视频a | 拍真实国产伦偷精品 | 最新中文字幕在线 | 成年人精品视频 | 成人高清在线视频 | 精品久久久久久国产 | 天天影视网天天综合色在线播放 | 亚洲一区播放 | 99久久久久久 | 精品久久一区 | 免费人成激情视频在线观看冫 | 香蕉视频一区二区 | 91激情视频| 国产91久久精品一区二区 | 久久av一区二区三区 | 成人国产一区二区三区精品麻豆 | 国产精品成人在线观看 | 欧美日韩高清在线一区 | 色屁屁在线观看 | 欧美一级久久 | 狠狠天天| 天天色天天色 |