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

是否可以使用 discord.js 將成員靜音?

Is it possible to selft mute a member with discord.js?(是否可以使用 discord.js 將成員靜音?)
本文介紹了是否可以使用 discord.js 將成員靜音?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

最近由于冠狀病毒,學校停課了,所以我為我的班級制作了一個不和諧的服務器.人們對不和諧不是很熟悉,所以我想要一個可以讓人們自我靜音的命令,這樣課程就可以開始了.如果他們想向老師提問,我希望每個人都能夠取消靜音,因此是自我靜音而不是服務器靜音.我已經嘗試過這段代碼,但它不起作用,因為 .selfmute(true) 是為機器人制作的.

Recently with coronavirus, school is cancelled so I made a discord server for my class. People are not very familiar with Discord so I want a command that can selfmute people so that the course can start. I want everyone to be able to unmute if they want to ask a question to the teacher, hence the self-mute and not the server-mute. I have tried this code but it's not working because the .selfmute(true) is made for the bot.

const Discord = require('discord.js');
const client = new Discord.Client();
const config = require("./config.json");

const prefix = "!";
client.on("message", (message) => {
if (!message.content.startsWith(prefix)) return;

if (message.content.startsWith(prefix + "mute")) {
    let channel = message.member.voice.channel;
    for (let member of channel.members) {
        member[1].voice.setSelfMute(true);
    }
}
});

client.login(config.token);

有人知道怎么做嗎?感謝您的幫助.

Does anyone know how to do this ? Thanks for the help.

PS:對不起,我的英語不是我的母語.

PS: sorry for my english, it's not my native language.

推薦答案

很遺憾,您不能對客戶端用戶以外的用戶進行自靜音或自聾.

Unfortunately, you cannot self-mute or self-deafen a user other than the client's user.

setSelfMute 的文檔 說:

為此語音狀態自動靜音/取消靜音.

Self-mutes/unmutes the bot for this voice state.

此外,如果您嘗試將不是客戶端用戶的用戶自我靜音,您將收到此錯誤:

Also, if you attempt to self-mute a user that will isn't the client user you will get this error:

Error [VOICE_STATE_NOT_OWN]: You cannot self-deafen/mute on VoiceStates that do not belong to the ClientUser.

<小時>

或者,您可以正常靜音,然后使用命令取消靜音.


Alternatively, you could mute them normally and then have a command to unmute them.

這篇關于是否可以使用 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 服務器時的歡迎消息)
主站蜘蛛池模板: 九九国产 | 欧美a级成人淫片免费看 | 天天天操操操 | 在线免费观看成年人视频 | 久草院线 | 婷婷激情综合 | 黄一区二区三区 | 伊人激情综合网 | 久久久久国产精品午夜一区 | 在线婷婷| 在线成人 | 国产精品不卡一区二区三区 | 日韩一区二区三区四区五区 | 99精品久久久国产一区二区三 | 国产成人精品免费视频 | 91亚洲国产成人久久精品网站 | 久久久精品 | 亚洲一区中文字幕在线观看 | 草久久免费视频 | 欧美一区二区三区在线看 | www国产亚洲精品久久网站 | 欧美一区免费在线观看 | 免费同性女女aaa免费网站 | 国产一区二区自拍 | 日韩免费一二三区 | 国产91丝袜在线播放 | a国产一区二区免费入口 | 国产日产精品一区二区三区四区 | 成人在线电影在线观看 | 亚洲欧美一区二区三区情侣bbw | 天天碰夜夜操 | 99国内精品久久久久久久 | 在线免费观看黄视频 | 岛国毛片 | 精品视频在线观看 | 日韩欧美一区在线 | 久久久久久久久久毛片 | 中文字幕一区在线观看视频 | 国产91久久久久久久免费 | 精品一区国产 | 欧洲精品在线观看 |