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