fix: update reject button correctly

This commit is contained in:
Isaac 2023-02-09 22:22:47 +00:00
parent a0ffbae36d
commit 42ad5216f6
No known key found for this signature in database
GPG Key ID: 0DE40AE37BBA5C33

View File

@ -58,27 +58,45 @@ module.exports = class CloseButton extends Button {
} }
} else { } else {
// TODO: reply // TODO: reply
if (client.tickets.$stale.has(ticket.id)) { try {
try { await interaction.update({
await interaction.channel.messages.edit( components: [],
client.tickets.$stale.get(ticket.id).message.id, embeds: [
{ new ExtendedEmbedBuilder({
components: [], iconURL: interaction.guild.iconURL(),
embeds: [ text: ticket.guild.footer,
new ExtendedEmbedBuilder({ })
iconURL: interaction.guild.iconURL(), .setColor(ticket.guild.errorColour)
text: ticket.guild.footer, .setDescription(getMessage('ticket.close.rejected', { user: interaction.user.toString() }))
}) .setFooter({ text: null }),
.setColor(ticket.guild.errorColour) ],
.setDescription(getMessage('ticket.close.rejected', { user: interaction.user.toString() })) });
.setFooter({ text: null }),
], } finally { // this should run regardless of whatever happens above
}, client.tickets.$stale.delete(ticket.id);
);
} finally { // this should run regardless of whatever happens above
client.tickets.$stale.delete(ticket.id);
}
} }
// if (client.tickets.$stale.has(ticket.id)) {
// try {
// await interaction.channel.messages.edit(
// client.tickets.$stale.get(ticket.id).message.id,
// {
// components: [],
// embeds: [
// new ExtendedEmbedBuilder({
// iconURL: interaction.guild.iconURL(),
// text: ticket.guild.footer,
// })
// .setColor(ticket.guild.errorColour)
// .setDescription(getMessage('ticket.close.rejected', { user: interaction.user.toString() }))
// .setFooter({ text: null }),
// ],
// },
// );
// } finally { // this should run regardless of whatever happens above
// client.tickets.$stale.delete(ticket.id);
// }
// }
} }
} }
} }