diff --git a/forums/forums.py b/forums/forums.py index 9940b87..4b5b7b4 100644 --- a/forums/forums.py +++ b/forums/forums.py @@ -20,10 +20,11 @@ class Forums(commands.Cog): async def resolved(self, ctx: commands.Context, reason: str = None): """Marks a thread as resolved.""" if isinstance(ctx.channel, discord.Thread) and ctx.channel.parent_id == await self.config.guild(ctx.guild).forum_channel(): - match = any(role_id in ctx.author.roles for role_id in await self.config.guild(ctx.guild).request_roles()) + request_role_ids = await self.config.guild(ctx.guild).request_roles() + request_roles = [ctx.guild.get_role(role_id) for role_id in request_role_ids] + match = any(role in ctx.author.roles for role in request_roles) passed_info = { - "ctx": ctx, - "match": match + "ctx": ctx } if match and reason: passed_info.update({"reason": reason}) @@ -39,7 +40,6 @@ class Forums(commands.Cog): super().__init__() self.timeout = timeout self.ctx: commands.Context = passed_info['ctx'] - self.match: bool = passed_info['match'] self.msg: discord.Message = passed_info['msg'] if 'reason' in passed_info: self.reason: str = passed_info['reason'] @@ -49,7 +49,9 @@ class Forums(commands.Cog): @ui.button(label="Yes", style=discord.ButtonStyle.success, emoji="✅") async def resolved_button_yes(self, interaction: discord.Interaction, button: ui.Button): - match = any(role_id in interaction.user.roles for role_id in await self.config.guild(interaction.guild).request_roles()) + request_role_ids = await self.config.guild(interaction.guild).request_roles() + request_roles = [interaction.guild.get_role(role_id) for role_id in request_role_ids] + match = any(role in interaction.user.roles for role in request_roles) if match or interaction.user.id == interaction.channel.owner.id: await interaction.response.defer() if self.reason: @@ -70,7 +72,9 @@ class Forums(commands.Cog): @ui.button(label="No", style=discord.ButtonStyle.danger, emoji="✖️") async def resolved_button_no(self, interaction: discord.Interaction, button: ui.Button): - match = any(role_id in interaction.user.roles for role_id in await self.config.guild(interaction.guild).request_roles()) + request_role_ids = await self.config.guild(interaction.guild).request_roles() + request_roles = [interaction.guild.get_role(role_id) for role_id in request_role_ids] + match = any(role in interaction.user.roles for role in request_roles) if match or interaction.user.id == interaction.channel.owner.id: await interaction.response.defer() await self.msg.delete()