From b04fdc65eecdc6ba238546ce539f7ec6d082c720 Mon Sep 17 00:00:00 2001 From: Ave Ozkal Date: Thu, 27 Dec 2018 14:07:15 +0300 Subject: [PATCH] userlog: allow only accessing a type of events + add .events --- cogs/mod_userlog.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/cogs/mod_userlog.py b/cogs/mod_userlog.py index 4994f3e..d1be472 100644 --- a/cogs/mod_userlog.py +++ b/cogs/mod_userlog.py @@ -79,13 +79,26 @@ class ModUserlog: set_userlog(json.dumps(userlog)) return embed + @commands.guild_only() + @commands.check(check_if_staff) + @commands.command(aliases=["events"]) + async def eventtypes(self, ctx): + """Lists the available event types, staff only.""" + event_list = [f"{et} ({userlog_event_types[et]})" for et in + userlog_event_types] + event_text = ("Available events:\n``` - " + + "\n - ".join(event_list) + + "```") + await ctx.send(event_text) + @commands.guild_only() @commands.check(check_if_staff) @commands.command(name="userlog", aliases=["listwarns", "getuserlog", "listuserlog"]) - async def userlog_cmd(self, ctx, target: discord.Member): + async def userlog_cmd(self, ctx, target: discord.Member, event=""): """Lists the userlog events for a user, staff only.""" - embed = self.get_userlog_embed_for_id(str(target.id), str(target)) + embed = self.get_userlog_embed_for_id(str(target.id), str(target), + event=event) await ctx.send(embed=embed) @commands.guild_only()