mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2025-04-05 04:41:41 +03:00
feat: transcript button in DM
This commit is contained in:
parent
54455c316e
commit
e947c9589b
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user