/autoreact list <channel> to list current autoreacts on a channel (thanks, @glitterbutts)
This commit is contained in:
parent
0bc1b8c66c
commit
3e72e9e0f0
1 changed files with 35 additions and 0 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Reference in a new issue