diff --git a/src/commands/admin/ticket/ticket.js b/src/commands/admin/ticket/ticket.js index 6eb13fd8f..b88ea5b51 100644 --- a/src/commands/admin/ticket/ticket.js +++ b/src/commands/admin/ticket/ticket.js @@ -204,7 +204,7 @@ module.exports = class Ticket extends Command { // Close all tickets else if (input === "closeall") { let sent = await message.safeReply("Closing tickets ..."); - response = await closeAll(message); + response = await closeAll(message, message.author); return sent.editable ? sent.edit(response) : message.channel.send(response); } @@ -286,7 +286,7 @@ module.exports = class Ticket extends Command { // Close all else if (sub === "closeall") { - response = await closeAll(interaction); + response = await closeAll(interaction, interaction.user); } // Add to ticket @@ -422,8 +422,8 @@ async function close({ channel }, author) { return null; } -async function closeAll({ guild }) { - const stats = await closeAllTickets(guild); +async function closeAll({ guild }, user) { + const stats = await closeAllTickets(guild, user); return `Completed! Success: \`${stats[0]}\` Failed: \`${stats[1]}\``; } diff --git a/src/utils/ticketUtils.js b/src/utils/ticketUtils.js index 729e3a563..2cc41a4c4 100644 --- a/src/utils/ticketUtils.js +++ b/src/utils/ticketUtils.js @@ -122,11 +122,11 @@ async function closeAllTickets(guild, author) { let success = 0; let failed = 0; - channels.forEach(async (ch) => { - const status = await closeTicket(ch, author, "Force close all open tickets"); - if (status.success) success += 1; + for (const ch of channels) { + const status = await closeTicket(ch[1], author, "Force close all open tickets"); + if (status === "SUCCESS") success += 1; else failed += 1; - }); + } return [success, failed]; }