【发布时间】:2021-10-05 08:52:18
【问题描述】:
对于我的机器人,我正在制作一个服务器信息命令,目前我似乎无法获得公会中类别的数量,因此当用户运行 !serverinfo 时,有一个嵌入并在 类别 将显示一个数字。目前显示的数字是 0。我该如何解决这个问题?
代码
const channels = message.guild.channels.cache;
const embed = new MessageEmbed()
.setAuthor(message.guild.name, message.guild.iconURL({dynamic: true}))
.setThumbnail(message.guild.iconURL({dynaic: true}))
.addField(`Owner`, `${owner.user.tag}`,true)
.addField(`Categorys`, `${channels.filter(channel => channel.type === "category").size}`,true)
【问题讨论】:
标签: discord.js