Skip to content

Commit

Permalink
Replace forEach by for...of to be asynchronous and prevent users bein…
Browse files Browse the repository at this point in the history
…g added and removed on the ticket
  • Loading branch information
Sayrix authored Sep 15, 2023
1 parent 90fff32 commit eca79bb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/events/interactionCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ export default class InteractionCreateEvent extends BaseEvent {
}
});

interaction.values.forEach((value) => {
(interaction.channel as GuildChannel | null)?.permissionOverwrites.delete(value).catch((e) => console.log(e));
for (const value of interaction.values) {
await (interaction.channel as GuildChannel | null)?.permissionOverwrites.delete(value).catch((e) => console.log(e));

log(
{
Expand All @@ -209,7 +209,7 @@ export default class InteractionCreateEvent extends BaseEvent {
},
this.client
);
});
};

interaction
.update({
Expand Down
4 changes: 2 additions & 2 deletions src/utils/createTicket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export const createTicket = async (interaction: StringSelectMenuInteraction | Mo
.catch((e) => console.log(e));

if (client.config.rolesWhoHaveAccessToTheTickets.length > 0) {
client.config.rolesWhoHaveAccessToTheTickets.forEach(async (role) => {
for (const role of client.config.rolesWhoHaveAccessToTheTickets) {
await channel.permissionOverwrites
.edit(role, {
SendMessages: true,
Expand All @@ -96,7 +96,7 @@ export const createTicket = async (interaction: StringSelectMenuInteraction | Mo
ViewChannel: true,
})
.catch((e) => console.log(e));
});
};
}
const footer = locale.getSubValue("embeds", "ticketOpened", "footer", "text").replace("ticket.pm", "");
if(ticketType.color?.toString().trim() === "") ticketType.color = undefined;
Expand Down

0 comments on commit eca79bb

Please sign in to comment.