feat(tickets): limit thanking
vi v@vt3e.cat
Tue, 07 Apr 2026 21:59:14 +0100
2 files changed,
16 insertions(+),
0 deletions(-)
M
src/database/schema/tickets.ts
→
src/database/schema/tickets.ts
@@ -29,6 +29,9 @@
closeReason: text("close_reason"), privateReason: text("private_reason"), + thankedAt: integer("thanked_at", { + mode: "timestamp", + }).$type<Date | null>(), warnedAt: integer("warned_at", { mode: "timestamp" }).$type<Date | null>(), }, (t) => [
M
src/interactions/commands/tickets/actions.ts
→
src/interactions/commands/tickets/actions.ts
@@ -394,6 +394,12 @@ "⚠️ Ticket or guild data not found, cannot send thank you message.",
); } + if (ticket.thankedAt) { + return interaction.editReply( + "⚠️ You have already thanked the moderator for this ticket.", + ); + } + const { data: guild, exists: guildExists } = await getGuild(ticket.guildId); if (!guildExists || !guild || !guild.ticket_channel_id) { logger.error(`Ticket ${ticket.id} missing guild/channel data`);@@ -416,6 +422,13 @@
await channel.send( `The reporter says thank you for handling ticket #${ticket.ticketNumber}! 💖`, ); + + const thankedAt = new Date(); + await db + .update(tickets) + .set({ thankedAt }) + .where(eq(tickets.id, ticket.id)); + return interaction.editReply("A thank you message sent to the moderators!"); } catch (error) { logger.error(