Skip to content

Commit

Permalink
ticket close bug
Browse files Browse the repository at this point in the history
  • Loading branch information
saiteja-madha committed Aug 31, 2022
1 parent 9cdf2a8 commit 872bc3a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/commands/admin/ticket/ticket.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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]}\``;
}

Expand Down
8 changes: 4 additions & 4 deletions src/utils/ticketUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand Down

0 comments on commit 872bc3a

Please sign in to comment.