Fix all missing await issues (eslint)
diff --git a/src/utils/commandRegistration/register.ts b/src/utils/commandRegistration/register.ts
index fbd052f..22c2fbd 100644
--- a/src/utils/commandRegistration/register.ts
+++ b/src/utils/commandRegistration/register.ts
@@ -181,11 +181,11 @@
client.on("interactionCreate", async (interaction: Interaction) => {
if (interaction.isUserContextMenuCommand()) {
const commandName = "contextCommands/user/" + interaction.commandName;
- execute(client.commands[commandName]![0]?.check, client.commands[commandName]![0]?.callback, interaction);
+ await execute(client.commands[commandName]![0]?.check, client.commands[commandName]![0]?.callback, interaction);
return;
} else if (interaction.isMessageContextMenuCommand()) {
const commandName = "contextCommands/message/" + interaction.commandName;
- execute(client.commands[commandName]![0]?.check, client.commands[commandName]![0]?.callback, interaction);
+ await execute(client.commands[commandName]![0]?.check, client.commands[commandName]![0]?.callback, interaction);
return;
} else if (interaction.isAutocomplete()) {
const commandName = interaction.commandName;
@@ -203,7 +203,7 @@
const formatted = (choices ?? []).map((choice) => {
return { name: choice, value: choice };
});
- interaction.respond(formatted);
+ await interaction.respond(formatted);
} else if (interaction.isChatInputCommand()) {
const commandName = interaction.commandName;
const subcommandGroupName = interaction.options.getSubcommandGroup(false);
@@ -219,7 +219,7 @@
const command = client.commands[fullCommandName]![0];
const callback = command?.callback;
const check = command?.check;
- execute(check, callback, interaction);
+ await execute(check, callback, interaction);
}
});
}
diff --git a/src/utils/confirmationMessage.ts b/src/utils/confirmationMessage.ts
index 7b3bd31..a417f6f 100644
--- a/src/utils/confirmationMessage.ts
+++ b/src/utils/confirmationMessage.ts
@@ -228,7 +228,7 @@
break;
}
if (component.customId === "yes") {
- component.deferUpdate();
+ await component.deferUpdate();
for (const v of Object.values(this.customButtons)) {
if (!v.active) continue;
try {
@@ -241,7 +241,7 @@
returnComponents = true;
continue;
} else if (component.customId === "no") {
- component.deferUpdate();
+ await component.deferUpdate();
success = false;
returnComponents = true;
continue;
@@ -348,7 +348,7 @@
returnComponents = true;
continue;
} else {
- component.deferUpdate();
+ await component.deferUpdate();
this.customButtons[component.customId]!.active = !this.customButtons[component.customId]!.active;
returnComponents = true;
continue;
diff --git a/src/utils/database.ts b/src/utils/database.ts
index 3fc2333..51b2bca 100644
--- a/src/utils/database.ts
+++ b/src/utils/database.ts
@@ -268,7 +268,7 @@
const doc = await this.transcripts.insertOne(Object.assign(transcript, { code: code }), collectionOptions);
if (doc.acknowledged) {
- client.database.eventScheduler.schedule(
+ await client.database.eventScheduler.schedule(
"deleteTranscript",
(Date.now() + 1000 * 60 * 60 * 24 * 7).toString(),
{ guild: transcript.guild, code: code, iv: iv, key: key }
diff --git a/src/utils/dualCollector.ts b/src/utils/dualCollector.ts
index bf9b0c0..e96ff5d 100644
--- a/src/utils/dualCollector.ts
+++ b/src/utils/dualCollector.ts
@@ -32,11 +32,7 @@
time: 300000
})
.on("collect", (m) => {
- try {
- m.delete();
- } catch (e) {
- client.emit("error", e as Error);
- }
+ void m.delete().catch();
resolve(m);
});
mes.on("end", () => {
diff --git a/src/utils/eventScheduler.ts b/src/utils/eventScheduler.ts
index 34bb28e..48eee63 100644
--- a/src/utils/eventScheduler.ts
+++ b/src/utils/eventScheduler.ts
@@ -79,13 +79,13 @@
guild: guild.id
}
};
- log(data);
+ await log(data);
});
}
async start() {
await new Promise((resolve) => this.agenda.once("ready", resolve));
- this.agenda.start();
+ await this.agenda.start();
return this;
}
@@ -95,8 +95,8 @@
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
- cancel(name: string, data: any) {
- this.agenda.cancel({ name, data });
+ async cancel(name: string, data: any) {
+ await this.agenda.cancel({ name, data });
}
}
diff --git a/src/utils/log.ts b/src/utils/log.ts
index b29f365..8c8c0c9 100644
--- a/src/utils/log.ts
+++ b/src/utils/log.ts
@@ -127,7 +127,7 @@
)
.setTimestamp(log.meta.timestamp)
.setColor(log.meta.color);
- channel.send({ embeds: [embed] });
+ await channel.send({ embeds: [embed] });
}
}
},
diff --git a/src/utils/performanceTesting/record.ts b/src/utils/performanceTesting/record.ts
index 89f3ead..34ed206 100644
--- a/src/utils/performanceTesting/record.ts
+++ b/src/utils/performanceTesting/record.ts
@@ -14,7 +14,7 @@
const user = guild.ownerId;
const currentYear = new Date().getFullYear();
const start = Date.now();
- client.database.history.read(guild.id, user, currentYear - 1);
+ await client.database.history.read(guild.id, user, currentYear - 1);
const end = Date.now();
return end - start;
};
@@ -35,7 +35,7 @@
resources: await resources()
};
if (results.discord > 1000 || results.databaseRead > 500 || results.resources.cpu > 100) {
- singleNotify(
+ await singleNotify(
"performanceTest",
config.developmentGuildID,
`Discord ping time: \`${results.discord}ms\`\nDatabase read time: \`${
@@ -47,12 +47,12 @@
config.owners
);
} else {
- singleNotify("performanceTest", config.developmentGuildID, true);
+ await singleNotify("performanceTest", config.developmentGuildID, true);
}
- client.database.performanceTest.record(results);
- setTimeout(async () => {
- await record();
+ await client.database.performanceTest.record(results);
+ setTimeout(() => {
+ void record();
}, 60 * 1000);
};
diff --git a/src/utils/temp/generateFileName.ts b/src/utils/temp/generateFileName.ts
index 109478d..b95b347 100644
--- a/src/utils/temp/generateFileName.ts
+++ b/src/utils/temp/generateFileName.ts
@@ -6,13 +6,13 @@
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
-export default function generateFileName(ending: string): string {
+export default async function generateFileName(ending: string): Promise<string> {
let fileName = crypto.randomBytes(35).toString("hex");
fileName = fileName.replace(/([a-zA-Z0-9]{8})/g, "$1-");
if (fs.existsSync(`./${fileName}`)) {
fileName = generateFileName(ending);
}
- client.database.eventScheduler.schedule("deleteFile", (Date.now() + 60 * 1000).toString(), {
+ await client.database.eventScheduler.schedule("deleteFile", (Date.now() + 60 * 1000).toString(), {
fileName: `${fileName}.${ending}`
});
return path.join(__dirname, fileName + "." + ending);