【问题标题】:Text and voice channels counting文本和语音通道计数
【发布时间】:2020-08-10 08:13:00
【问题描述】:
`:speech_balloon: Channels ${message.guild.channels.filter(m => m.type === 'all'.size)}`,`[** ${message.guild.channels.filter(m => m.type === 'text').size}** ] | [** ${message.guild.channels.filter(m => m.type === 'voice').size} **]`,true)

我正在使用它来计算文本/语音通道的数量,message.guild.channels.filter(m => m.type === 'all'.size) 不起作用,我尝试了 message.guild.channels.size,但它也在计算类别。

【问题讨论】:

    标签: javascript discord


    【解决方案1】:

    计数所有频道,不包括类别:

    message.guild.channels.filter((c) => c.type !== "category").size;
    

    统计文本频道:

    message.guild.channels.filter((c) => c.type === "text").size;
    

    统计文本语音频道:

    message.guild.channels.filter((c) => c.type === "text" || c.type === "voice").size;
    

    下次,将discord.js 标签添加到您的问题中;)

    【讨论】:

      猜你喜欢
      • 2020-08-21
      • 1970-01-01
      • 2020-05-30
      • 1970-01-01
      • 1970-01-01
      • 2015-06-16
      • 1970-01-01
      • 2020-07-13
      • 2023-03-03
      相关资源
      最近更新 更多