Skip to content

Commit

Permalink
fix: update reject button correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
eartharoid committed Feb 9, 2023
1 parent a0ffbae commit 42ad521
Showing 1 changed file with 38 additions and 20 deletions.
58 changes: 38 additions & 20 deletions src/buttons/close.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
// }
// }
}
}
}
Expand Down

0 comments on commit 42ad521

Please sign in to comment.