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))