【问题标题】:How do I get the user count of a voice by channel id? Discordjs v.13如何通过频道 ID 获取语音的用户数? Discordjs v.13
【发布时间】:2022-07-06 06:53:35
【问题描述】:

如何通过频道 ID 获取语音的用户数? Discordjs v.13

 async function usercount(channelId){
      try {
    
       let voiceChannel = Client.guilds.cache.get("guildId").channels.cache.get(channelId);
        let membersInChannel = voiceChannel.members.size;
        console.log(membersInChannel);
    
      } catch (error) {
        logger.error("Error while performing usercount")
        console.log(error)
      }
    
    }

【问题讨论】:

  • 有什么问题? Client 是什么?
  • Client 是 Discordjs 客户端。我想用语音通道的 ID 解决连接到特定语音通道的成员数量,但我没有从中获得任何价值

标签: javascript node.js discord.js


【解决方案1】:

无法通过频道 ID 获取语音频道中的当前用户数。 ID 就像频道的名称一样。让您的机器人识别频道并发送至 f.E.更改频道名称。但是,您将无法获取该频道当前已连接的用户。

还是我误会了什么?希望这会有所帮助

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-08-22
    • 2020-09-16
    • 2020-05-30
    • 2020-12-24
    • 2021-11-10
    • 2020-11-26
    • 2019-11-24
    • 2020-08-30
    相关资源
    最近更新 更多