This commit is contained in:
Danya H 2024-06-11 19:23:06 +01:00
parent 3c07a2f271
commit 40d8a79002

View File

@ -223,22 +223,26 @@ export class CreateTicketSystem {
@ButtonComponent({ id: 'close-btn' })
async closeBtn(interaction: ButtonInteraction): Promise<void> {
await interaction.deferReply()
logger.action(
'Ticket close attempt',
`User: ${interaction.user.username}(${interaction.user.id})\nChannel: ${interaction.channel?.id}`,
)
if (!interaction.channel || !interaction.guild) {
await interaction.editReply('❌ Ticket channel does not exist')
return
}
if (!interaction.channel.isThread() || interaction.channel.archived) {
return
}
try {
await interaction.deferReply()
await interaction.editReply('Closing ticket..')
} catch (e) {
logger.error('Deferring interaction reply', e)
return
}
try {
// lock + archive thread