From e9cee361717d50cd0abae221e7b1742cfe0d812b Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Thu, 7 Sep 2023 23:25:50 -0400 Subject: [PATCH] fix(forums): changed error message for if the targetted channel is not a forums channel (resolvedset channel) --- forums/forums.py | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/forums/forums.py b/forums/forums.py index f0c3716..d312dc8 100644 --- a/forums/forums.py +++ b/forums/forums.py @@ -90,8 +90,6 @@ class Forums(commands.Cog): """Manages the configuration for the [p]resolved command.""" @resolvedset.group(name='role', invoke_without_command=True, aliases=['roles']) - @commands.guild_only() - @commands.admin() async def resolvedset_role(self, ctx: commands.Context): """Manages the allowed roles list.""" current_list = await self.config.guild(ctx.guild).request_roles() @@ -108,8 +106,6 @@ class Forums(commands.Cog): await ctx.send(f"No roles are currently in the allowed roles list.\nUse `{command} add` to add some!") @resolvedset_role.command(name='add') - @commands.guild_only() - @commands.admin() async def resolvedset_role_add(self, ctx: commands.Context, role: discord.Role = None): """Adds roles to the allowed roles list.""" current_list = await self.config.guild(ctx.guild).request_roles() @@ -125,8 +121,6 @@ class Forums(commands.Cog): await ctx.send("Please provide a valid role.") @resolvedset_role.command(name='remove') - @commands.guild_only() - @commands.admin() async def resolvedset_role_remove(self, ctx: commands.Context, role: discord.Role = None): """Removes roles from the allowed roles list.""" current_list = await self.config.guild(ctx.guild).request_roles() @@ -144,6 +138,15 @@ class Forums(commands.Cog): options.append(discord.SelectOption(label=tag.name, emoji=emoji, description="", value=tag.id)) return options + @resolvedset.command(name="channel") + async def resolvedset_channel(self, ctx: commands.Context, channel: discord.abc.GuildChannel): + """Sets the forums channel used by the [p]resolved command.""" + if isinstance(channel, discord.ForumChannel): + await self.config.guild(ctx.guild).forum_channel.set(channel.id) + await ctx.send(f"Forum channel has been set to {channel.mention}.") + else: + await ctx.send(f"{channel.mention} is not a forums channel!") + @resolvedset.command(name="tag") async def resolvedset_tag(self, ctx: commands.Context, channel: discord.ForumChannel): """Sets the tag used by the [p]resolved command.""" @@ -152,12 +155,6 @@ class Forums(commands.Cog): msg = await ctx.send(f"Forum tag is currently set to `{str(tag)}`.") await msg.edit(view=SelectView(msg, options)) - @resolvedset.command(name="channel") - async def resolvedset_channel(self, ctx: commands.Context, channel: discord.ForumChannel): - """Sets the tag used by the [p]resolved command.""" - await self.config.guild(ctx.guild).forum_channel.set(channel.id) - await ctx.send(f"Forum channel has been set to `{channel.name}`.") - class Select(ui.Select): def __init__(self, message, options): self.message = message