async def guilds(self, ctx: AnsuraContext): g: discord.Guild m: discord.Message = await ctx.send("Building list...") s = """```""" async with ctx.typing(): for g in self.bot.guilds: s += f"{g.id} - {g.name}\n" await m.edit(content=s + "```")
async def ginfo(self, ctx: AnsuraContext, guild_id: int): async with ctx.typing(): if guild_id not in [g.id for g in self.bot.guilds]: await ctx.send("I'm not in a guild with that ID") return m: discord.User g: discord.Guild = self.bot.get_guild(guild_id) users, bots = 0, 0 for m in g.members: if m.bot: bots += 1 else: users += 1 e = discord.Embed() e.title = g.name e.set_thumbnail(url=g.icon_url) e.description = g.description e.add_field(name="Total Members", value=g.member_count) e.add_field(name="Users/Bots", value=f"{users}/{bots}") e.add_field(name="Region", value=str(g.region)) e.add_field(name="ID", value=str(g.id), inline=False) u: discord.User = g.owner e.add_field(name="Owner", value=f"{u.name}#{u.discriminator} ({g.owner_id})", inline=False) await ctx.send(embed=e)