From 5a66c31494ba49edf8ff3ac7221b814e519684e0 Mon Sep 17 00:00:00 2001 From: Isaac Date: Fri, 14 Feb 2025 16:53:03 +0000 Subject: [PATCH] feat: allow `/transcript` to accept numbers as well as IDs --- src/commands/slash/transcript.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/commands/slash/transcript.js b/src/commands/slash/transcript.js index 4ee3bff..1ad5fce 100644 --- a/src/commands/slash/transcript.js +++ b/src/commands/slash/transcript.js @@ -47,7 +47,7 @@ module.exports = class TranscriptSlashCommand extends SlashCommand { ); } - shouldAllowAccess(interaction, ticket) { + shouldAllowAccess(interaction, ticket) { // the creator can always get their ticket, even from outside the guild if (ticket.createdById === interaction.user.id) return true; // user not member (DMs) // everyone else must be in the guild @@ -132,7 +132,14 @@ module.exports = class TranscriptSlashCommand extends SlashCommand { guild: true, questionAnswers: true, }, - where: { id: ticketId }, + where: interaction.guildId && ticketId.length < 16 + ? { + guildId_number: { + guildId: interaction.guildId, + number: parseInt(ticketId), + }, + } + : { id: ticketId }, }); if (!ticket) throw new Error(`Ticket ${ticketId} does not exist`);