refactor: ticket logs

This commit is contained in:
Isaac 2023-05-24 20:50:10 +01:00
parent cdfdf72026
commit 22b15d7fd7
No known key found for this signature in database
GPG Key ID: 0DE40AE37BBA5C33

View File

@ -138,6 +138,8 @@ async function logTicketEvent(client, {
const member = await guild.members.fetch(userId); const member = await guild.members.fetch(userId);
client.log.info.tickets(`${member.user.tag} ${client.i18n.getMessage('en-GB', `log.ticket.verb.${action}`)} ticket ${target.id}`); client.log.info.tickets(`${member.user.tag} ${client.i18n.getMessage('en-GB', `log.ticket.verb.${action}`)} ticket ${target.id}`);
if (!ticket.guild.logChannel) return; if (!ticket.guild.logChannel) return;
const channel = client.channels.cache.get(ticket.guild.logChannel);
if (!channel) return;
const colour = action === 'create' const colour = action === 'create'
? 'Aqua' : action === 'close' ? 'Aqua' : action === 'close'
? 'DarkAqua' : action === 'update' ? 'DarkAqua' : action === 'update'
@ -149,8 +151,6 @@ async function logTicketEvent(client, {
user: `<@${member.user.id}>`, user: `<@${member.user.id}>`,
verb: getMessage(`log.ticket.verb.${action}`), verb: getMessage(`log.ticket.verb.${action}`),
}; };
const channel = client.channels.cache.get(ticket.guild.logChannel);
if (!channel) return;
const embeds = [ const embeds = [
new EmbedBuilder() new EmbedBuilder()
.setColor(colour) .setColor(colour)