From 42ad5216f6da80fb8b751bc2746eee15d91b87ba Mon Sep 17 00:00:00 2001 From: Isaac Date: Thu, 9 Feb 2023 22:22:47 +0000 Subject: [PATCH] fix: update reject button correctly --- src/buttons/close.js | 58 +++++++++++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 20 deletions(-) diff --git a/src/buttons/close.js b/src/buttons/close.js index ff1a61e..3289047 100644 --- a/src/buttons/close.js +++ b/src/buttons/close.js @@ -58,27 +58,45 @@ module.exports = class CloseButton extends Button { } } else { // TODO: reply - 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); - } + try { + await interaction.update({ + 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); } + + // 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); + // } + // } } } }