Compare commits

..

No commits in common. "b6b144bb21feb20a6bb3950fbcae629b0a442129" and "4709af1146d2efff385a446a99c4727c392c06fa" have entirely different histories.

View file

@ -27,7 +27,7 @@ class Forums(commands.Cog):
} }
if match and reason: if match and reason:
passed_info.update({"reason": reason}) passed_info.update({"reason": reason})
if match or ctx.author.id == ctx.channel.owner.id: if match or ctx.author.id == ctx.channel.owner_id:
msg = await ctx.send("Are you sure you'd like to mark this thread as resolved?") msg = await ctx.send("Are you sure you'd like to mark this thread as resolved?")
passed_info.update({"msg": msg}) passed_info.update({"msg": msg})
await msg.edit(view=self.ResolvedButtons(timeout=180, passed_info=passed_info)) await msg.edit(view=self.ResolvedButtons(timeout=180, passed_info=passed_info))
@ -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(interaction.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,16 +56,16 @@ 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:
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)
@ui.button(label="No", style=discord.ButtonStyle.danger, emoji="") @ui.button(label="No", style=discord.ButtonStyle.success, 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(interaction.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()
await self.ctx.message.delete() await self.ctx.message.delete()