Reputation: 103
How would i use python to find the server count for other servers? One's I'm not a part of? I can figure it out for my own, but not for others.
Upvotes: 1
Views: 672
Reputation: 318
You will need to have the server's guild ID for this. You can then fetch the guild from the discord API using fetch_guild()
and then access the guild's member_count
attribute.
async def get_guild_members(guild_id: int):
guild = bot.fetch_guild(guild_id)
return guild.member_count
Upvotes: 2