如何找到我的机器人所在的公会数量? [英] How do I find how many guilds my bot is in?

查看:17
本文介绍了如何找到我的机器人所在的公会数量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个不和谐的机器人,我只是想知道:我如何知道这个机器人在多少个公会中?所以如果我说 -guilds 它会告诉我它在多少个公会中.

I have a discord bot, and I was just wondering: how do I find out how many guilds the bot is in? So that if I say -guilds it'll tell me how many guilds it's in.

推荐答案

我将把命令留给你,但要获得机器人可用的公会,你必须使用 <Client>.guilds.

I'll leave the command up to you, but to get the bot's available guilds, you must use <Client>.guilds.

这是一个公会集合,因此要获得集合的大小,您只需 <Client>.guilds.size

This is a collection of guilds so to get the size of a collection all you have to do is <Client>.guilds.size

此信息也在 discord.js文档.

我希望这会有所帮助!

- Trifex

在评论中,@NicoHd105 指出,从 discord.js v12 开始,检索bot 所属的所有公会都是 <Client>.guilds.cache,意思是获取公会的大小必须使用 <Client>.guilds.cache.size

In the comments, @NicoHd105 noted that as of discord.js v12, the proper way to retrieve a collection of all guilds a bot is part of is <Client>.guilds.cache, meaning to get the size of the guilds you must use <Client>.guilds.cache.size!

这篇关于如何找到我的机器人所在的公会数量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆