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

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

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

問題描述

我希望我的機器人通過使用<afk [radio]"在 2 個 afk 頻道中的 1 個中移動用戶.命令.但我首先想檢查用戶是否已經(jīng)在 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');
    }

但是當(dāng)我嘗試使用<afk"時命令機器人發(fā)送消息:

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

您已經(jīng)在 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.

這篇關(guān)于Discord js/檢查用戶是否在特定的語音頻道中的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

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(如何讓我的機器人提及發(fā)出該機器人命令的人)
How to fix Must use import to load ES Module discord.js(如何修復(fù)必須使用導(dǎo)入來加載 ES 模塊 discord.js)
How to list all members from a specific server?(如何列出來自特定服務(wù)器的所有成員?)
Discord bot: Fix ‘FFMPEG not found’(Discord bot:修復(fù)“找不到 FFMPEG)
Welcome message when joining discord Server using discord.js(使用 discord.js 加入 discord 服務(wù)器時的歡迎消息)
主站蜘蛛池模板: 国产精品欧美一区二区三区 | 亚洲成人精品久久久 | 国产精品毛片无码 | 久久久久国产精品一区三寸 | 亚洲高清电影 | 日韩中文字幕久久 | 久久曰视频 | 久久99精品久久久久久国产越南 | 日韩亚洲视频 | 九九热在线免费观看 | 夜色www国产精品资源站 | av免费网站在线观看 | 久久av网站 | 欧区一欧区二欧区三免费 | 一区二区三区高清 | 成人小视频在线免费观看 | 国产亚洲网站 | 日韩免费电影 | 国产精品一区二区三 | 久久久网 | 一级欧美 | 91国产精品| 欧美亚洲另类丝袜综合网动图 | 新av在线| av网站免费在线观看 | 逼逼网| 久久高清 | 亚洲一区二区视频 | 国产精品资源在线 | 欧美久久视频 | 毛片一级黄色 | 羞羞视频在线观看免费观看 | 日本涩涩网 | 欧美成人一区二免费视频软件 | 毛片视频网站 | 欧美激情一区二区 | 午夜av电影 | 国产91在线播放 | 国产精品视频一二三区 | 乱码av午夜噜噜噜噜动漫 | 国产精品成人在线观看 |