mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2025-02-23 18:51:29 +02:00
feat: allow /transcript
to accept numbers as well as IDs
This commit is contained in:
parent
20a0b9378b
commit
5a66c31494
@ -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
|
// the creator can always get their ticket, even from outside the guild
|
||||||
if (ticket.createdById === interaction.user.id) return true; // user not member (DMs)
|
if (ticket.createdById === interaction.user.id) return true; // user not member (DMs)
|
||||||
// everyone else must be in the guild
|
// everyone else must be in the guild
|
||||||
@ -132,7 +132,14 @@ module.exports = class TranscriptSlashCommand extends SlashCommand {
|
|||||||
guild: true,
|
guild: true,
|
||||||
questionAnswers: 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`);
|
if (!ticket) throw new Error(`Ticket ${ticketId} does not exist`);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user