Skip to content

Commit

Permalink
feat: allow /transcript to accept numbers as well as IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
eartharoid committed Feb 14, 2025
1 parent 20a0b93 commit 5a66c31
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/commands/slash/transcript.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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`);
Expand Down

0 comments on commit 5a66c31

Please sign in to comment.