diff --git a/src/commands/slash/transcript.js b/src/commands/slash/transcript.js index 7a5d40a..4ee3bff 100644 --- a/src/commands/slash/transcript.js +++ b/src/commands/slash/transcript.js @@ -48,8 +48,11 @@ module.exports = class TranscriptSlashCommand extends SlashCommand { } shouldAllowAccess(interaction, ticket) { - if (interaction.guild.id !== ticket.guildId) return false; - if (ticket.createdById === interaction.member.id) return true; + // 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 + if (interaction.guild?.id !== ticket.guildId) return false; + // and have authority if (interaction.client.supers.includes(interaction.member.id)) return true; if (interaction.member.permissions.has(PermissionsBitField.Flags.ManageGuild)) return true; if (interaction.member.roles.cache.filter(role => ticket.category.staffRoles.includes(role.id)).size > 0) return true; diff --git a/src/lib/tickets/manager.js b/src/lib/tickets/manager.js index 8368a23..c17a7e8 100644 --- a/src/lib/tickets/manager.js +++ b/src/lib/tickets/manager.js @@ -1342,9 +1342,31 @@ module.exports = class TicketManager { }); } - if (ticket.guild.archive) embed.setDescription(getMessage('dm.closed.archived', { guild: channel.guild.name })); + const components = []; - await creator.send({ embeds: [embed] }); + if (ticket.guild.archive) { + embed.setDescription(getMessage('dm.closed.archived', { guild: channel.guild.name })); + components.push( + new ActionRowBuilder() + .addComponents( + new ButtonBuilder() + .setCustomId(JSON.stringify({ + action: 'transcript', + ticket: ticket.id, + })) + .setStyle(ButtonStyle.Primary) + .setEmoji(getMessage('buttons.transcript.emoji')) + .setLabel(getMessage('buttons.transcript.text')), + + ), + ); + } + + + await creator.send({ + components, + embeds: [embed], + }); } } catch (error) { this.client.log.error(error);