From 43f445ef85818ed1c872ca385bffcbbfc328eb5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A7=81Ash=C3=BB=EA=A7=82?= <30575805+Ashu11-A@users.noreply.github.com> Date: Sat, 15 Jun 2024 05:00:18 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=A8=F0=9F=8F=BB=E2=80=8D=F0=9F=92=BB?= =?UTF-8?q?=20Implementation=20observation=20and=20reason?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/tickets/src/class/TicketBuilder.ts | 4 ++-- .../tickets/src/discord/components/Ticket/ActionsClose.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/tickets/src/class/TicketBuilder.ts b/plugins/tickets/src/class/TicketBuilder.ts index 0c543fdb..edc4e502 100644 --- a/plugins/tickets/src/class/TicketBuilder.ts +++ b/plugins/tickets/src/class/TicketBuilder.ts @@ -223,7 +223,7 @@ export class TicketBuilder { return this } - async delete () { + async delete (options?: { reason?: string, observation?: string }) { if (this.interaction instanceof Message) return const claimBuilder = new ClaimBuilder({ interaction: this.interaction }) const ticketData = await ticket.findOne({ where: { channelId: this.channelId }, relations: { claim: true } }) @@ -242,7 +242,7 @@ export class TicketBuilder { if (message.deletable) await message.delete() } - await new TicketFunctions({ interaction: this.interaction }).transcript({ messageId: ticketData.claim.messageId }) + await new TicketFunctions({ interaction: this.interaction }).transcript({ messageId: ticketData.claim.messageId, observation: options?.observation, reason: options?.reason }) await ticket.delete({ id: ticketData.id }) await claimBuilder.delete(ticketData.claim.id) } diff --git a/plugins/tickets/src/discord/components/Ticket/ActionsClose.ts b/plugins/tickets/src/discord/components/Ticket/ActionsClose.ts index 7b97b567..bc50348a 100644 --- a/plugins/tickets/src/discord/components/Ticket/ActionsClose.ts +++ b/plugins/tickets/src/discord/components/Ticket/ActionsClose.ts @@ -90,13 +90,13 @@ new Component({ customId: 'Close-With-Question', type: "Modal", async run(interaction) { - const { channelId } = interaction + const { channelId, fields } = interaction if (!interaction.inCachedGuild() || channelId === null) return - // const observation = fields.getTextInputValue('observation') - // const reason = fields.getTextInputValue('reason') + const observation = fields.getTextInputValue('observation') + const reason = fields.getTextInputValue('reason') const builder = new TicketBuilder({ interaction }) await interaction.deferReply({ ephemeral: true }) - await (await builder.setTicket(channelId).loader()).delete() + await (await builder.setTicket(channelId).loader()).delete({ observation, reason }) } }) \ No newline at end of file