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

Discord js/檢查用戶是否在特定的語音頻道中

Discord js / Check if user is in an specific voice Channel(Discord js/檢查用戶是否在特定的語音頻道中)
本文介紹了Discord js/檢查用戶是否在特定的語音頻道中的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我希望我的機器人通過使用<afk [radio]"在 2 個 afk 頻道中的 1 個中移動用戶.命令.但我首先想檢查用戶是否已經在 AFK 頻道中.我試過了:

I want my bot to move a user in 1 of 2 afk channels by using a "<afk [radio]" command. But i first want to check if the user is allready in an AFK Channel. I tried:

const voiceChannel = message.member.voice.channel;
const voiceChannelID = message.member.voice.channelID;
if (!voiceChannel) {
        return message.channel.send('You are not in an voice Channel so why move to AFK?');
    } else if (voiceChannelID === '789186504483536937', '791444742042943548') {
        return message.channel.send('You are already in an AFK channel!');
    } else if (!args.length) {
        return member.voice.setChannel('789186504483536937');
    }

但是當我嘗試使用<afk"時命令機器人發送消息:

But when i try t use the "<afk" command the bot send the message:

您已經在 AFK 頻道中!

You are already in an AFK channel!

任何想法為什么這樣做?

Any ideas why it does this?

推薦答案

問題是

if (voiceChannelID === '789186504483536937', '791444742042943548')

這不是多個條件的工作方式.用 or 操作符分隔.

This is not how multiple conditionals work. Seperate it with the or operator.

if (voiceChannelID === '789186504483536937' || voiceChannelID === '791444742042943548')

您可以將您嘗試做的事情想象為傳入兩個不同的條件 f(x, y).Javascript 中的 if 語句將只檢查最后一個 (y) 和791444742042943548".是真實的,因為它是非空的.

You can think of what you were trying to do as passing in two different conditions, f(x, y). If statements in Javascript will only check for the last one (y), and "791444742042943548" is truthy since it is non-null.

這篇關于Discord js/檢查用戶是否在特定的語音頻道中的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 服務器時的歡迎消息)
主站蜘蛛池模板: 久久久久久久久久一区 | 亚洲精品在线免费观看视频 | 国产精品毛片久久久久久久 | 久久人体视频 | www.国产精 | 国产精品国产三级国产aⅴ浪潮 | 91爱啪啪| 免费在线观看一区二区三区 | 国产成人精品一区二区三区 | www.久久 | 国产精品成人一区二区三区 | 在线看av网址 | 国产精品免费大片 | 久久亚洲国产精品 | 国产一区h | 欧美成人精品一区二区男人看 | 一区二区中文字幕 | 日本久久网 | 亚洲精品久久久久久久久久吃药 | 日韩精品一区二区三区在线观看 | 亚洲va在线va天堂va狼色在线 | 天天操夜夜操 | 天天综合91| 久久久久久免费精品一区二区三区 | 日本成人午夜影院 | 亚洲精品中文字幕在线 | 在线91| 久久精彩 | 午夜国产一级 | 黄色片视频网站 | 久久久久久国产精品久久 | 日韩www| 中文字幕在线网 | 久久成人人人人精品欧 | 中文字幕在线观看成人 | 婷婷福利| 精品久久久久久久 | 日韩精品在线一区 | 久久精品国产亚洲夜色av网站 | 欧美日韩亚洲国产综合 | 国产91丝袜在线18 |