From a7d40ea53898c3033e7e20ea9b2d92b2ecb947b5 Mon Sep 17 00:00:00 2001 From: romangraef Date: Tue, 1 May 2018 20:46:11 +0200 Subject: added `~channel` command --- main.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index f736109..942c774 100644 --- a/main.py +++ b/main.py @@ -64,6 +64,28 @@ def get_with_attr(arr, **attributes): return list(_get_with_attr()) +@bot.command(name="channel", pass_context=True) +@check_guild +async def channel_cmd(ctx: commands.Context, channel: discord.TextChannel = None): + if channel is None: + channel = ctx.channel + category: discord.CategoryChannel = channel.category + + embed = discord.Embed( + title='Channel: %s' % channel.name, + description=channel.topic, + color=discord.Color.blurple()) + + embed.add_field(name="Created at", value=channel.created_at) + embed.add_field(name="Id", value=channel.id) + embed.add_field(name="Category", value="%s (%s)" % (category.name, category.id)) + embed.add_field(name="Position", value=channel.position) + embed.add_field(name="Changed roles", value=', '.join(role.mention for role in channel.changed_roles)) + + await ctx.send(embed=embed) + await ctx.react('✅') + + @bot.command(name="user", pass_context=True) @check_guild async def user_cmd(ctx: commands.Context, identifier): @@ -127,7 +149,7 @@ async def role_cmd(ctx: commands.Context): @bot.command(pass_context=True) @check_guild -async def raw(ctx: commands.Context, id, quiet: bool=True): +async def raw(ctx: commands.Context, id, quiet: bool = True): channel: discord.TextChannel = ctx.channel async for mes in channel.history(limit=2, around=Object(id=id)): if str(mes.id) == id: -- cgit