Skip to content

Commit

Permalink
πŸ‘¨πŸ»β€πŸ’» Implementation observation and reason
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashu11-A committed Jun 15, 2024
1 parent beb4894 commit 43f445e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions plugins/tickets/src/class/TicketBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 } })
Expand All @@ -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)
}
Expand Down
8 changes: 4 additions & 4 deletions plugins/tickets/src/discord/components/Ticket/ActionsClose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
}
})

0 comments on commit 43f445e

Please sign in to comment.