queue
This commit is contained in:
@@ -138,7 +138,13 @@ async function handleButton(interaction) {
|
||||
if (pendingCloses.has(interaction.channel.id)) {
|
||||
return interaction.reply({ content: 'A close is already pending for this ticket.', ephemeral: true });
|
||||
}
|
||||
await interaction.update({ content: `Closing ticket in ${timerSeconds} seconds. Use \`/cancel-close\` to abort.`, components: [] });
|
||||
const cancelRow = new ActionRowBuilder().addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId('cancel_close')
|
||||
.setLabel('Cancel Close')
|
||||
.setStyle(ButtonStyle.Secondary)
|
||||
);
|
||||
await interaction.update({ content: `Closing ticket in ${timerSeconds} seconds.`, components: [cancelRow] });
|
||||
const timerId = setTimeout(async () => {
|
||||
pendingCloses.delete(interaction.channel.id);
|
||||
const freshTicket = await Ticket.findOne({ discordThreadId: interaction.channel.id }).lean();
|
||||
@@ -156,6 +162,11 @@ async function handleButton(interaction) {
|
||||
}
|
||||
|
||||
if (interaction.customId === 'cancel_close') {
|
||||
const pending = pendingCloses.get(interaction.channel.id);
|
||||
if (pending) {
|
||||
clearTimeout(pending.timeout);
|
||||
pendingCloses.delete(interaction.channel.id);
|
||||
}
|
||||
return interaction.update({ content: 'Close cancelled.', components: [] });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user