all repos — stealth-developers @ 960f8f74d3c05db34f143b02ffb9180777ed6380

feat(tickets/gdpr): exports
vi v@vt3e.cat
Thu, 26 Feb 2026 02:07:44 +0000
commit

960f8f74d3c05db34f143b02ffb9180777ed6380

parent

6c744f271cd810fefa95d8e39c0fb238f9414fa5

1 files changed, 33 insertions(+), 0 deletions(-)

jump to
M src/interactions/buttons/tickets/ticket.tssrc/interactions/buttons/tickets/ticket.ts

@@ -311,6 +311,10 @@ if (action === "list") {

await handleList(client, interaction); return; } + if (action === "export") { + await handleExport(client, interaction); + return; + } const { data: guild } = await getGuild(interaction.guildId); const { data: ticket } = await getTicket(

@@ -997,6 +1001,35 @@ await interaction.editReply({

components: [container], files: files, flags: ["IsComponentsV2"], + }); +} + +async function handleExport( + _client: Client, + interaction: ChatInputCommandInteraction, +) { + const _tickets = await db + .select() + .from(tickets) + .where(eq(tickets.authorId, interaction.user.id)); + + const transcripts = await Promise.all( + _tickets.map(async (ticket) => { + const [transcriptText] = await generateTranscript(ticket); + return transcriptText; + }), + ); + + const combined = transcripts.join("\n\n\n\n"); + await interaction.reply({ + content: "Here is your exported ticket data:", + files: [ + { + attachment: Buffer.from(combined, "utf-8"), + name: `tickets-export-${interaction.user.id}.txt`, + }, + ], + flags: ["Ephemeral"], }); }