我找到了这段代码,但我不知道如何在index.js. 有任何想法吗?voiceChannel.join() .then(connection => { connection.voice.setSelfDeaf(true); });
1 回答
炎炎设计
TA贡献1808条经验 获得超4个赞
作为对您评论的回复,以下代码将在您的机器人每次加入语音频道时拒绝它。
client.on("voiceStateUpdate", (oldVoiceState, newVoiceState) => {
if (!newVoiceState.channel) {return false}; // The bot disconnected.
if (newVoiceState.id == client.user.id) { // Checking if it is the bot.
newVoiceState.setSelfDeaf(true); // Setting self defean to true.
};
});
让您的机器人加入语音频道:
// Getting the channel.
const channel = client.channels.cache.get("722944525986955386");
// Joining the channel.
channel.join();
添加回答
举报
0/150
提交
取消