Defean Bot 加入语音频道

我找到了这段代码,但我不知道如何在index.js. 有任何想法吗?


voiceChannel.join()

  .then(connection => {

      connection.voice.setSelfDeaf(true);

  });


开心每一天1111
浏览 92回答 1
1回答

炎炎设计

作为对您评论的回复,以下代码将在您的机器人每次加入语音频道时拒绝它。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();
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript