import discord from discord.ext import commands class discordinfo: def __init__(self, bot): self.bot = bot @commands.command(pass_context=True) async def user(self, ctx): em = discord.Embed(title=f"**{ctx.message.author}**", color=discord.Color(4359924)) em.set_thumbnail(url=ctx.message.author.avatar_url) em.add_field(value=[i.name for i in ctx.message.author.roles if i.name != '@everyone'], name='Roles') await self.bot.say(embed=em) @commands.group(pass_context=True) async def server(self, ctx): if ctx.invoked_subcommand is None: out = f'{ctx.message.server.name}\n' humans = {"online": 0, "offline": 0, "idle": 0, "dnd": 0} bots = {"online": 0, "offline": 0, "idle": 0, "dnd": 0} for m in ctx.message.server.members: if m.bot: bots[str(m.status)] = bots[str(m.status)] + 1 else: humans[str(m.status)] = humans[str(m.status)] + 1 out += f'**Bots**: {bots["online"]}**online**, ' \ f'{bots["offline"]}**offline**, {bots["idle"]}**idle**, ' \ f'{bots["dnd"]}**dnd**\n' \ f'**Humans**: {humans["online"]}**online**, ' \ f'{humans["offline"]}**offline**, ' \ f'{humans["idle"]}**idle**, {humans["dnd"]}**dnd**\n' await self.bot.say(out) @server.command(pass_context=True) async def roles(self, ctx): out = f'**{ctx.message.server.name}, roles**\n' for r in ctx.message.server.roles: if r.name != '@everyone': out = out + f'**{r.name}**: {r.id}\n' await self.bot.say(out) def setup(bot): bot.add_cog(discordinfo(bot))