fix(forums): fixed missing channel attribute
Some checks reported warnings
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled

This commit is contained in:
Seaswimmer 2023-09-07 19:30:12 -04:00
parent c87261b17e
commit 0529842b62
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -46,8 +46,9 @@ class Forums(commands.Cog):
@ui.button(label="Yes", style=discord.ButtonStyle.success, emoji="") @ui.button(label="Yes", style=discord.ButtonStyle.success, emoji="")
async def resolved_button_yes(self, button: ui.Button, interaction: discord.Interaction): async def resolved_button_yes(self, button: ui.Button, interaction: discord.Interaction):
match = any(role_id in interaction.user.roles for role_id in await self.config.guild(interaction.channel.guild).request_roles()) match = any(role_id in interaction.user.roles for role_id in await self.config.guild(self.ctx.guild).request_roles())
if match or interaction.user.id == interaction.channel.owner.id: if match or interaction.user.id == interaction.channel.owner.id:
channel = self.ctx.channel
await interaction.response.defer() await interaction.response.defer()
if self.reason: if self.reason:
response_reason = f"Thread closed by {interaction.user.mention} with reason: {self.reason}" response_reason = f"Thread closed by {interaction.user.mention} with reason: {self.reason}"
@ -55,7 +56,7 @@ class Forums(commands.Cog):
else: else:
response_reason = f"Thread closed by {interaction.user.mention}" response_reason = f"Thread closed by {interaction.user.mention}"
reason = f"Thread closed by {interaction.user.name} ({interaction.user.id})" reason = f"Thread closed by {interaction.user.name} ({interaction.user.id})"
await interaction.channel.edit(locked=True, archived=True, applied_tags=interaction.channel.applied_tags + await self.config.guild(interaction.channel.guild).forum_tag(), reason=reason) await channel.edit(locked=True, archived=True, applied_tags=channel.applied_tags + await self.config.guild(channel.guild).forum_tag(), reason=reason)
await self.msg.edit(content=response_reason, view=None) await self.msg.edit(content=response_reason, view=None)
await self.ctx.message.add_reaction("") await self.ctx.message.add_reaction("")
else: else:
@ -63,7 +64,7 @@ class Forums(commands.Cog):
@ui.button(label="No", style=discord.ButtonStyle.danger, emoji="✖️") @ui.button(label="No", style=discord.ButtonStyle.danger, emoji="✖️")
async def resolved_button_no(self, button: ui.Button, interaction: discord.Interaction): async def resolved_button_no(self, button: ui.Button, interaction: discord.Interaction):
match = any(role_id in interaction.user.roles for role_id in await self.config.guild(interaction.channel.guild).request_roles()) match = any(role_id in interaction.user.roles for role_id in await self.config.guild(self.ctx.guild).request_roles())
if match or interaction.user.id == interaction.channel.owner.id: if match or interaction.user.id == interaction.channel.owner.id:
await interaction.response.defer() await interaction.response.defer()
await self.msg.delete() await self.msg.delete()
@ -71,7 +72,7 @@ class Forums(commands.Cog):
else: else:
await interaction.response.send_message(content="You cannot close this thread!", ephemeral=True) await interaction.response.send_message(content="You cannot close this thread!", ephemeral=True)
@commands.group(name='forumconfig', invoke_without_command=True, aliases=['forumsset']) @commands.group(name='forumsconfig', invoke_without_command=True, aliases=['forumconfig'])
@commands.guild_only() @commands.guild_only()
@commands.admin() @commands.admin()
async def forumsconfig(self, ctx: commands.Context): async def forumsconfig(self, ctx: commands.Context):