fix: handle missing ticket on/move and /transfer

This commit is contained in:
Isaac 2025-02-14 14:09:51 +00:00
parent 73ff67c65f
commit 1f24561ac0
No known key found for this signature in database
GPG Key ID: 0DE40AE37BBA5C33
2 changed files with 22 additions and 4 deletions

View File

@ -47,15 +47,15 @@ module.exports = class MoveSlashCommand extends SlashCommand {
}); });
if (!ticket) { if (!ticket) {
const { locale } = await client.prisma.guild.findUnique({ where: { id: interaction.guild.id } }); const settings = await client.prisma.guild.findUnique({ where: { id: interaction.guild.id } });
const getMessage = client.i18n.getLocale(locale); const getMessage = client.i18n.getLocale(settings.locale);
return await interaction.editReply({ return await interaction.editReply({
embeds: [ embeds: [
new ExtendedEmbedBuilder({ new ExtendedEmbedBuilder({
iconURL: interaction.guild.iconURL(), iconURL: interaction.guild.iconURL(),
text: ticket.guild.footer, text: settings.footer,
}) })
.setColor(ticket.guild.errorColour) .setColor(settings.errorColour)
.setTitle(getMessage('misc.not_ticket.title')) .setTitle(getMessage('misc.not_ticket.title'))
.setDescription(getMessage('misc.not_ticket.description')), .setDescription(getMessage('misc.not_ticket.description')),
], ],

View File

@ -3,6 +3,7 @@ const {
ApplicationCommandOptionType, ApplicationCommandOptionType,
EmbedBuilder, EmbedBuilder,
} = require('discord.js'); } = require('discord.js');
const ExtendedEmbedBuilder = require('../../lib/embed');
const { quick } = require('../../lib/threads'); const { quick } = require('../../lib/threads');
@ -50,6 +51,23 @@ module.exports = class TransferSlashCommand extends SlashCommand {
where: { id: interaction.channel.id }, where: { id: interaction.channel.id },
}); });
if (!ticket) {
const settings = await client.prisma.guild.findUnique({ where: { id: interaction.guild.id } });
const getMessage = client.i18n.getLocale(settings.locale);
return await interaction.editReply({
embeds: [
new ExtendedEmbedBuilder({
iconURL: interaction.guild.iconURL(),
text: settings.footer,
})
.setColor(settings.errorColour)
.setTitle(getMessage('misc.not_ticket.title'))
.setDescription(getMessage('misc.not_ticket.description')),
],
ephemeral: true,
});
}
const from = ticket.createdById; const from = ticket.createdById;
const channelName = ticket.category.channelName const channelName = ticket.category.channelName