From 3e72e9e0f06a6b4687c43d99d16fdcf941fd5d38 Mon Sep 17 00:00:00 2001 From: Zevaryx Date: Sun, 4 Jul 2021 10:02:54 -0600 Subject: [PATCH] /autoreact list to list current autoreacts on a channel (thanks, @glitterbutts) --- jarvis/cogs/autoreact.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/jarvis/cogs/autoreact.py b/jarvis/cogs/autoreact.py index 3e18890..bdb116d 100644 --- a/jarvis/cogs/autoreact.py +++ b/jarvis/cogs/autoreact.py @@ -181,6 +181,41 @@ class AutoReactCog(commands.Cog): ) await ctx.send(f"Removed {emote} from {channel.mention} autoreact.") + @cog_ext.cog_subcommand( + base="autoreact", + name="list", + description="List all autoreacts on a channel", + guild_ids=[418094694325813248, 578757004059738142], + options=[ + create_option( + name="channel", + description="Autoreact channel to list", + option_type=7, + required=True, + ), + ], + ) + @commands.has_permissions(administrator=True) + async def _autoreact_list(self, ctx, channel: TextChannel): + exists = self.db.jarvis.autoreact.find_one( + {"guild": ctx.guild.id, "channel": channel.id} + ) + if not exists: + await ctx.send( + "Please create autoreact first with " + + f"/autoreact create {channel.mention}" + ) + return + message = "" + if len(exists["reacions"]) > 0: + message = ( + f"Current active autoreacts on {channel.mention}:\n" + + "\n".join(exists["reactions"]) + ) + else: + message = f"No reactions set on {channel.mention}" + await ctx.send(message) + def setup(bot): bot.add_cog(AutoReactCog(bot))