mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-12-23 00:03:09 +02:00
feat: DM on close (fixes #338)
A very basic message to notify the user of the ticket closure
This commit is contained in:
parent
d1c3620fcd
commit
5579362f26
@ -230,6 +230,9 @@ commands:
|
||||
create:
|
||||
name: Create a ticket for user
|
||||
dm:
|
||||
closed:
|
||||
archived: Type `/transcript` in **{guild}** to view the archived messages.
|
||||
title: Your ticket has been closed
|
||||
confirm_open:
|
||||
title: Do you want to open a ticket with the following topic?
|
||||
log:
|
||||
|
@ -1081,10 +1081,38 @@ module.exports = class TicketManager {
|
||||
where: { id: ticket.id },
|
||||
});
|
||||
|
||||
|
||||
if (channel?.deletable) {
|
||||
const member = closedBy ? channel.guild.members.cache.get(closedBy) : null;
|
||||
await channel.delete('Ticket closed' + (member ? ` by ${member.displayName}` : '') + reason ? `: ${reason}` : '');
|
||||
}
|
||||
|
||||
if (closedBy) {
|
||||
logTicketEvent(this.client, {
|
||||
action: 'close',
|
||||
target: {
|
||||
id: ticket.id,
|
||||
name: channel.toString(),
|
||||
},
|
||||
userId: closedBy,
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const creator = await channel?.guild.members.fetch(ticket.createdById);
|
||||
if (creator) {
|
||||
const getMessage = this.client.i18n.getLocale(ticket.guild.locale);
|
||||
const embed = new ExtendedEmbedBuilder({
|
||||
iconURL: channel.guild.iconURL(),
|
||||
text: ticket.guild.footer,
|
||||
})
|
||||
.setColor(ticket.guild.primaryColour)
|
||||
.setTitle(getMessage('dm.closed.title'));
|
||||
if (ticket.guild.archive) embed.setDescription(getMessage('dm.closed.archived', { guild: channel.guild.name }));
|
||||
await creator.send({ embeds: [embed] });
|
||||
}
|
||||
} catch (error) {
|
||||
this.client.log.error(error);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user