Compare commits
3 commits
4709af1146
...
b6b144bb21
Author | SHA1 | Date | |
---|---|---|---|
b6b144bb21 | |||
529fdfa341 | |||
cf013e81b4 |
1 changed files with 7 additions and 8 deletions
|
@ -27,7 +27,7 @@ class Forums(commands.Cog):
|
|||
}
|
||||
if match and 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?")
|
||||
passed_info.update({"msg": msg})
|
||||
await msg.edit(view=self.ResolvedButtons(timeout=180, passed_info=passed_info))
|
||||
|
@ -46,9 +46,8 @@ class Forums(commands.Cog):
|
|||
|
||||
@ui.button(label="Yes", style=discord.ButtonStyle.success, emoji="✅")
|
||||
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.guild).request_roles())
|
||||
if match or interaction.user.id == interaction.channel.owner_id:
|
||||
channel = self.ctx.channel
|
||||
match = any(role_id in interaction.user.roles for role_id in await self.config.guild(interaction.channel.guild).request_roles())
|
||||
if match or interaction.user.id == interaction.channel.owner.id:
|
||||
await interaction.response.defer()
|
||||
if self.reason:
|
||||
response_reason = f"Thread closed by {interaction.user.mention} with reason: {self.reason}"
|
||||
|
@ -56,16 +55,16 @@ class Forums(commands.Cog):
|
|||
else:
|
||||
response_reason = f"Thread closed by {interaction.user.mention}"
|
||||
reason = f"Thread closed by {interaction.user.name} ({interaction.user.id})"
|
||||
await channel.edit(locked=True, archived=True, applied_tags=channel.applied_tags + await self.config.guild(channel.guild).forum_tag(), reason=reason)
|
||||
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 self.msg.edit(content=response_reason, view=None)
|
||||
await self.ctx.message.add_reaction("✅")
|
||||
else:
|
||||
await interaction.response.send_message(content="You cannot close this thread!", ephemeral=True)
|
||||
|
||||
@ui.button(label="No", style=discord.ButtonStyle.success, emoji="❌")
|
||||
@ui.button(label="No", style=discord.ButtonStyle.danger, emoji="❌")
|
||||
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.guild).request_roles())
|
||||
if match or interaction.user.id == interaction.channel.owner_id:
|
||||
match = any(role_id in interaction.user.roles for role_id in await self.config.guild(interaction.channel.guild).request_roles())
|
||||
if match or interaction.user.id == interaction.channel.owner.id:
|
||||
await interaction.response.defer()
|
||||
await self.msg.delete()
|
||||
await self.ctx.message.delete()
|
||||
|
|
Loading…
Reference in a new issue