Fix all missing await issues (eslint)
diff --git a/src/actions/createModActionTicket.ts b/src/actions/createModActionTicket.ts
index ea85255..6b34739 100644
--- a/src/actions/createModActionTicket.ts
+++ b/src/actions/createModActionTicket.ts
@@ -115,8 +115,8 @@
type: Discord.ChannelType.PrivateThread,
reason: "Creating ticket"
})) as Discord.PrivateThreadChannel;
- c.members.add(user.id);
- c.members.add(createdBy.id);
+ await c.members.add(user.id);
+ await c.members.add(createdBy.id);
try {
await c.send({
content:
@@ -174,7 +174,7 @@
guild: guild.id
}
};
- log(data);
+ await log(data);
return c.id;
}
diff --git a/src/actions/roleMenu.ts b/src/actions/roleMenu.ts
index 9796b28..6997393 100644
--- a/src/actions/roleMenu.ts
+++ b/src/actions/roleMenu.ts
@@ -175,7 +175,7 @@
console.log(e);
return;
}
- component.deferUpdate();
+ await component.deferUpdate();
}
}
@@ -246,7 +246,7 @@
console.log(e);
return;
}
- component.deferUpdate();
+ await component.deferUpdate();
if (component.customId === "back") {
page = Math.max(0, page - 1);
} else if (component.customId === "next") {
diff --git a/src/actions/tickets/create.ts b/src/actions/tickets/create.ts
index 26236d8..8dafe52 100644
--- a/src/actions/tickets/create.ts
+++ b/src/actions/tickets/create.ts
@@ -155,7 +155,7 @@
new ActionRowBuilder<ButtonBuilder>().addComponents(formattedTicketTypes.slice(i, i + 5))
);
}
- component.update({
+ await component.update({
embeds: [
new EmojiEmbed()
.setTitle("Create Ticket")
@@ -280,7 +280,7 @@
type: Discord.ChannelType.PrivateThread,
reason: "Creating ticket"
})) as Discord.PrivateThreadChannel;
- c.members.add(interaction.member!.user.id);
+ await c.members.add(interaction.member!.user.id);
try {
await c.send({
content:
@@ -357,7 +357,7 @@
guild: interaction.guild.id
}
};
- log(data);
+ await log(data);
await interaction.editReply({
embeds: [
new EmojiEmbed()
diff --git a/src/actions/tickets/delete.ts b/src/actions/tickets/delete.ts
index 1c1e464..7e52458 100644
--- a/src/actions/tickets/delete.ts
+++ b/src/actions/tickets/delete.ts
@@ -78,7 +78,7 @@
guild: interaction.guild.id
}
};
- log(data);
+ await log(data);
await channel.delete();
} else if (status === "Active") {
@@ -86,12 +86,12 @@
// Archive the ticket
await interaction.channel.fetch();
if (channel.isThread()) {
- channel.setName(`${channel.name.replace("Active", "Archived")}`);
- channel.members.remove(channel.name.split(" - ")[1]!);
+ await channel.setName(`${channel.name.replace("Active", "Archived")}`);
+ await channel.members.remove(channel.name.split(" - ")[1]!);
} else {
- channel.setTopic(`${(channel.topic ?? "").replace("Active", "Archived")}`);
+ await channel.setTopic(`${(channel.topic ?? "").replace("Active", "Archived")}`);
if (!channel.topic!.includes("Archived")) {
- channel.setTopic("0 Archived");
+ await channel.setTopic("0 Archived");
}
await channel.permissionOverwrites.delete(channel.topic!.split(" ")[0]!);
}
@@ -153,7 +153,7 @@
guild: interaction.guild.id
}
};
- log(data);
+ await log(data);
}
return;
}
@@ -170,28 +170,28 @@
if (tickets.type === Discord.ChannelType.GuildCategory) {
// For channels, the topic is the user ID, then the word Active
const category = tickets as Discord.CategoryChannel;
- category.children.cache.forEach((element) => {
+ for (const [_id, element] of category.children.cache) {
if (!(element.type === Discord.ChannelType.GuildText)) return;
if (!((element as Discord.TextChannel).topic ?? "").includes(member)) return;
try {
- element.delete();
+ await element.delete();
deleted++;
} catch (e) {
console.error(e);
}
- });
+ };
} else {
// For threads, the name is the users name, id, then the word Active
const channel = tickets as Discord.TextChannel;
- channel.threads.cache.forEach((element: Discord.ThreadChannel) => {
+ for (const [_id, element] of channel.threads.cache) {
if (!element.name.includes(member)) return;
try {
- element.delete();
+ await element.delete();
deleted++;
} catch (e) {
console.error(e);
}
- });
+ };
}
if (!deleted) return;
const { log, NucleusColors, entry, renderUser, renderDelta } = client.logger;
@@ -214,7 +214,7 @@
guild: guild
}
};
- log(data);
+ await log(data);
}
export { purgeByUser };