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 };
diff --git a/src/api/index.ts b/src/api/index.ts
index 4b849f1..41f281d 100644
--- a/src/api/index.ts
+++ b/src/api/index.ts
@@ -35,7 +35,7 @@
await member.roles.add(client.verify[code]!.rID);
const interaction = client.verify[code]!.interaction;
- interaction.editReply({
+ await interaction.editReply({
embeds: [
new EmojiEmbed()
.setTitle("Verify")
@@ -70,7 +70,7 @@
guild: guild.id
}
};
- log(data);
+ await log(data);
} catch {
res.sendStatus(500);
}
@@ -80,12 +80,12 @@
}
});
- app.get("/verify/:code", jsonParser, function (req: express.Request, res: express.Response) {
+ app.get("/verify/:code", jsonParser, async function (req: express.Request, res: express.Response) {
const code = req.params.code;
if (client.verify[code]) {
try {
const interaction = client.verify[code]!.interaction;
- interaction.editReply({
+ await interaction.editReply({
embeds: [
new EmojiEmbed()
.setTitle("Verify")
@@ -124,12 +124,12 @@
}
});
- app.get("/rolemenu/:code", jsonParser, function (req: express.Request, res: express.Response) {
+ app.get("/rolemenu/:code", jsonParser, async function (req: express.Request, res: express.Response) {
const code = req.params.code;
if (client.roleMenu[code] !== undefined) {
try {
const interaction = client.roleMenu[code]!.interaction;
- interaction.editReply({
+ await interaction.editReply({
embeds: [
new EmojiEmbed()
.setTitle("Roles")
diff --git a/src/commands/mod/about.ts b/src/commands/mod/about.ts
index 8736054..6f8b74c 100644
--- a/src/commands/mod/about.ts
+++ b/src/commands/mod/about.ts
@@ -266,7 +266,7 @@
}
});
} catch (e) {
- interaction.editReply({
+ await interaction.editReply({
embeds: [
new EmojiEmbed()
.setEmoji("MEMBER.JOIN")
diff --git a/src/commands/mod/ban.ts b/src/commands/mod/ban.ts
index 91e074d..41d1252 100644
--- a/src/commands/mod/ban.ts
+++ b/src/commands/mod/ban.ts
@@ -126,7 +126,7 @@
dmSent = false;
}
try {
- member.ban({
+ await member.ban({
deleteMessageSeconds: deleteDays * 24 * 60 * 60,
reason: reason ?? "*No reason provided*"
});
@@ -159,7 +159,7 @@
guild: interaction.guild.id
}
};
- log(data);
+ await log(data);
} catch {
await interaction.editReply({
embeds: [
diff --git a/src/commands/mod/kick.ts b/src/commands/mod/kick.ts
index 4ef78c8..f9242fe 100644
--- a/src/commands/mod/kick.ts
+++ b/src/commands/mod/kick.ts
@@ -114,7 +114,7 @@
dmSent = false;
}
try {
- member.kick(reason || "No reason provided");
+ await member.kick(reason || "No reason provided");
await client.database.history.create("kick", interaction.guild.id, member.user, interaction.user, reason);
const { log, NucleusColors, entry, renderUser, renderDelta } = client.logger;
const timeInServer = member.joinedTimestamp
@@ -157,7 +157,7 @@
data.list.joined = entry(member.joinedTimestamp.toString(), renderDelta(member.joinedTimestamp));
}
await client.database.history.create("kick", interaction.guild.id, member.user, interaction.user, reason);
- log(data);
+ await log(data);
} catch {
await interaction.editReply({
embeds: [
diff --git a/src/commands/mod/mute.ts b/src/commands/mod/mute.ts
index 2266a1a..0cfe660 100644
--- a/src/commands/mod/mute.ts
+++ b/src/commands/mod/mute.ts
@@ -132,7 +132,7 @@
} catch {
return;
}
- component.deferUpdate();
+ await component.deferUpdate();
if (component.customId === "cancel")
return interaction.editReply({
embeds: [
@@ -389,7 +389,7 @@
guild: interaction.guild.id
}
};
- log(data);
+ await log(data);
const failed = !status.dm && notify;
await interaction.editReply({
embeds: [
diff --git a/src/commands/mod/nick.ts b/src/commands/mod/nick.ts
index cfdcf47..a8d4ab8 100644
--- a/src/commands/mod/nick.ts
+++ b/src/commands/mod/nick.ts
@@ -153,7 +153,7 @@
let before: string | null;
try {
before = member.nickname;
- member.setNickname(newNickname ?? null, "Nucleus Nickname command");
+ await member.setNickname(newNickname ?? null, "Nucleus Nickname command");
await client.database.history.create(
"nickname",
interaction.guild!.id,
@@ -202,7 +202,7 @@
guild: interaction.guild!.id
}
};
- log(data);
+ await log(data);
const failed = !dmSent && notify;
await interaction.editReply({
embeds: [
diff --git a/src/commands/mod/purge.ts b/src/commands/mod/purge.ts
index dadab04..1170c33 100644
--- a/src/commands/mod/purge.ts
+++ b/src/commands/mod/purge.ts
@@ -100,7 +100,7 @@
})) as Discord.Message;
let component;
try {
- component = m.awaitMessageComponent({
+ component = await m.awaitMessageComponent({
filter: (i) => i.user.id === interaction.user.id && i.channel!.id === interaction.channel!.id,
time: 300000
});
@@ -108,12 +108,12 @@
timedOut = true;
continue;
}
- (await component).deferUpdate();
- if ((await component).customId === "done") {
+ await component.deferUpdate();
+ if (component.customId === "done") {
amountSelected = true;
continue;
}
- const amount = parseInt((await component).customId);
+ const amount = parseInt(component.customId);
let messages: Discord.Message[] = [];
await (interaction.channel as TextChannel).messages.fetch({ limit: amount }).then(async (ms) => {
@@ -167,7 +167,7 @@
guild: interaction.guild.id
}
};
- log(data);
+ await log(data);
const newOut = await client.database.transcripts.createTranscript(
"purge",
deleted,
@@ -209,7 +209,7 @@
return;
}
if (component.customId === "download") {
- interaction.editReply({
+ await interaction.editReply({
embeds: [
new EmojiEmbed()
.setEmoji("CHANNEL.PURGE.GREEN")
@@ -221,7 +221,7 @@
files: [attachmentObject]
});
} else {
- interaction.editReply({
+ await interaction.editReply({
embeds: [
new EmojiEmbed()
.setEmoji("CHANNEL.PURGE.GREEN")
@@ -261,12 +261,12 @@
messages = await (channel as TextChannel).bulkDelete(toDelete, true);
} else {
const toDelete = (
- await (
- await (interaction.channel as TextChannel).messages.fetch({
- limit: 100
- })
- ).filter((m) => m.author.id === user.id)
- ).first(interaction.options.get("amount")?.value as number);
+ await (interaction.channel as TextChannel).messages.fetch({
+ limit: 100
+ })
+ )
+ .filter((m) => m.author.id === user.id)
+ .first(interaction.options.get("amount")?.value as number);
messages = await (channel as TextChannel).bulkDelete(toDelete, true);
}
} catch (e) {
@@ -326,7 +326,7 @@
guild: interaction.guild.id
}
};
- log(data);
+ await log(data);
const messageArray: Message[] = messages
.filter(
(message) =>
diff --git a/src/commands/mod/slowmode.ts b/src/commands/mod/slowmode.ts
index ba88c00..8fe9f16 100644
--- a/src/commands/mod/slowmode.ts
+++ b/src/commands/mod/slowmode.ts
@@ -51,7 +51,7 @@
.send();
if (confirmation.cancelled || !confirmation.success) return;
try {
- (interaction.channel as TextChannel).setRateLimitPerUser(time);
+ await (interaction.channel as TextChannel).setRateLimitPerUser(time);
} catch (e) {
await interaction.editReply({
embeds: [
diff --git a/src/commands/mod/softban.ts b/src/commands/mod/softban.ts
index cd03d1a..984bb6b 100644
--- a/src/commands/mod/softban.ts
+++ b/src/commands/mod/softban.ts
@@ -128,7 +128,7 @@
try {
const member = interaction.options.getMember("user") as GuildMember;
const days: number = (interaction.options.get("delete")?.value as number | null) ?? 0;
- member.ban({
+ await member.ban({
deleteMessageSeconds: days * 24 * 60 * 60,
reason: reason ?? "*No reason provided*"
});
@@ -162,7 +162,7 @@
guild: interaction.guild.id
}
};
- log(data);
+ await log(data);
} catch {
await interaction.editReply({
embeds: [
diff --git a/src/commands/mod/unban.ts b/src/commands/mod/unban.ts
index 7397414..1c1a877 100644
--- a/src/commands/mod/unban.ts
+++ b/src/commands/mod/unban.ts
@@ -76,7 +76,7 @@
guild: interaction.guild.id
}
};
- log(data);
+ await log(data);
} catch {
await interaction.editReply({
embeds: [
diff --git a/src/commands/mod/unmute.ts b/src/commands/mod/unmute.ts
index f248a3b..516bd39 100644
--- a/src/commands/mod/unmute.ts
+++ b/src/commands/mod/unmute.ts
@@ -76,7 +76,7 @@
}
const member = interaction.options.getMember("user") as GuildMember;
try {
- member.timeout(0, reason ?? "*No reason provided*");
+ await member.timeout(0, reason ?? "*No reason provided*");
} catch {
await interaction.editReply({
embeds: [
@@ -122,7 +122,7 @@
guild: interaction.guild.id
}
};
- log(data);
+ await log(data);
const failed = !dmSent && notify;
await interaction.editReply({
embeds: [
diff --git a/src/commands/mod/warn.ts b/src/commands/mod/warn.ts
index 232219b..0424d48 100644
--- a/src/commands/mod/warn.ts
+++ b/src/commands/mod/warn.ts
@@ -153,7 +153,7 @@
}
};
await client.database.history.create("warn", interaction.guild.id, member.user, interaction.user, reason);
- log(data);
+ await log(data);
const failed = !dmSent && notify;
if (!failed) {
await interaction.editReply({
diff --git a/src/commands/nucleus/guide.ts b/src/commands/nucleus/guide.ts
index d05e265..c95e78c 100644
--- a/src/commands/nucleus/guide.ts
+++ b/src/commands/nucleus/guide.ts
@@ -6,7 +6,7 @@
builder.setName("guide").setDescription("Shows the welcome guide for the bot");
const callback = async (interaction: CommandInteraction) => {
- guide(interaction.guild!, interaction);
+ await guide(interaction.guild!, interaction);
};
export { command };
diff --git a/src/commands/nucleus/invite.ts b/src/commands/nucleus/invite.ts
index 9f78cc5..0307c68 100644
--- a/src/commands/nucleus/invite.ts
+++ b/src/commands/nucleus/invite.ts
@@ -7,7 +7,7 @@
builder.setName("invite").setDescription("Invites Nucleus to your server");
const callback = async (interaction: CommandInteraction): Promise<void> => {
- interaction.reply({
+ await interaction.reply({
embeds: [
new EmojiEmbed()
.setTitle("Invite")
diff --git a/src/commands/nucleus/ping.ts b/src/commands/nucleus/ping.ts
index 62988bb..8a9ca87 100644
--- a/src/commands/nucleus/ping.ts
+++ b/src/commands/nucleus/ping.ts
@@ -13,7 +13,7 @@
const initial = Date.now();
await interaction.reply({ embeds: LoadingEmbed, ephemeral: true });
const ping = Date.now() - initial;
- interaction.editReply({
+ await interaction.editReply({
embeds: [
new EmojiEmbed()
.setTitle("Ping")
diff --git a/src/commands/nucleus/premium.ts b/src/commands/nucleus/premium.ts
index 4effb23..f544045 100644
--- a/src/commands/nucleus/premium.ts
+++ b/src/commands/nucleus/premium.ts
@@ -106,7 +106,7 @@
const member = await (await interaction.client.guilds.fetch("684492926528651336")).members
.fetch(interaction.user.id)
.catch(() => {
- interaction.editReply({
+ void interaction.editReply({
embeds: [
new EmojiEmbed()
.setTitle("Premium")
@@ -197,7 +197,7 @@
if ((dbMember?.appliesTo.length ?? 0) > 0)
userPremiumServers = "\nIf you want to remove premium from a server, run this command in your DMs with me.";
- interaction.editReply({
+ await interaction.editReply({
embeds: [
new EmojiEmbed()
.setTitle("Premium")
@@ -216,10 +216,10 @@
} catch (e) {
return;
}
- i.deferUpdate();
+ await i.deferUpdate();
const guild = i.guild!;
if (count - appliesTo.length <= 0) {
- interaction.editReply({
+ await interaction.editReply({
embeds: [
new EmojiEmbed()
.setTitle("Premium")
@@ -235,7 +235,7 @@
});
} else {
await client.database.premium.addPremium(interaction.user.id, guild.id);
- interaction.editReply({
+ await interaction.editReply({
embeds: [
new EmojiEmbed()
.setTitle("Premium")
diff --git a/src/commands/nucleus/stats.ts b/src/commands/nucleus/stats.ts
index 294ee27..a7f9b3b 100644
--- a/src/commands/nucleus/stats.ts
+++ b/src/commands/nucleus/stats.ts
@@ -35,7 +35,7 @@
fetchReply: true
});
if (config.owners.includes(interaction.user.id)) {
- interaction.editReply({
+ await interaction.editReply({
embeds: [
new EmojiEmbed()
.setTitle("Admin")
@@ -96,7 +96,7 @@
} catch {
return;
}
- out.deferUpdate();
+ await out.deferUpdate();
const GuildID = out.fields.getTextInputValue("guildID");
if (!client.guilds.cache.has(GuildID)) {
await interaction.editReply({
@@ -126,7 +126,7 @@
} catch {
return;
}
- i.deferUpdate();
+ await i.deferUpdate();
const guild = (await client.guilds.fetch(GuildID)) as Guild | null;
if (!guild) {
await interaction.editReply({
diff --git a/src/commands/privacy.ts b/src/commands/privacy.ts
index 590e866..3a671ed 100644
--- a/src/commands/privacy.ts
+++ b/src/commands/privacy.ts
@@ -214,7 +214,7 @@
const em = new Discord.EmbedBuilder(pages[page]!.embed);
em.setDescription(em.data.description + "\n\n" + createPageIndicator(pages.length, page));
em.setFooter({ text: "Message closed" });
- interaction.editReply({ embeds: [em], components: [] });
+ await interaction.editReply({ embeds: [em], components: [] });
return;
}
}
diff --git a/src/commands/server/about.ts b/src/commands/server/about.ts
index 815b9e6..1857653 100644
--- a/src/commands/server/about.ts
+++ b/src/commands/server/about.ts
@@ -32,7 +32,7 @@
const callback = async (interaction: CommandInteraction): Promise<void> => {
const guild = interaction.guild!;
const { renderUser, renderDelta } = client.logger;
- interaction.reply({
+ await interaction.reply({
embeds: [
new EmojiEmbed()
.setTitle("Server Info")
diff --git a/src/commands/settings/automod.ts b/src/commands/settings/automod.ts
index d8464f0..6860a26 100644
--- a/src/commands/settings/automod.ts
+++ b/src/commands/settings/automod.ts
@@ -1076,12 +1076,12 @@
} else {
switch (i.values[0]) {
case "invites": {
- i.deferUpdate();
+ await i.deferUpdate();
config.invite = await inviteMenu(i, m, config.invite);
break;
}
case "mentions": {
- i.deferUpdate();
+ await i.deferUpdate();
config.pings = await mentionMenu(i, m, config.pings);
break;
}
diff --git a/src/commands/settings/rolemenu.ts b/src/commands/settings/rolemenu.ts
index e683e4f..7da9dfe 100644
--- a/src/commands/settings/rolemenu.ts
+++ b/src/commands/settings/rolemenu.ts
@@ -89,7 +89,7 @@
out = null;
}
if (!out) return;
- out.deferUpdate();
+ await out.deferUpdate();
if (out.isButton()) return;
const values = out.values;
@@ -218,7 +218,7 @@
`**Max:** ${data.max}\n`
);
- interaction.editReply({ embeds: [embed], components: [previewSelect, buttons] });
+ await interaction.editReply({ embeds: [embed], components: [previewSelect, buttons] });
let i: StringSelectMenuInteraction | ButtonInteraction;
try {
i = (await m.awaitMessageComponent({
@@ -304,7 +304,7 @@
}\n`
);
- interaction.editReply({
+ await interaction.editReply({
embeds: [embed],
components: [new ActionRowBuilder<RoleSelectMenuBuilder>().addComponents(roleSelect), buttons]
});
diff --git a/src/commands/settings/stats.ts b/src/commands/settings/stats.ts
index d4e4439..ed2fc6f 100644
--- a/src/commands/settings/stats.ts
+++ b/src/commands/settings/stats.ts
@@ -198,7 +198,7 @@
)
]
});
- showModal(i, { name: newChannelName, enabled: newChannelEnabled });
+ await showModal(i, { name: newChannelName, enabled: newChannelEnabled });
const out: Discord.ModalSubmitInteraction | ButtonInteraction | null =
await modalInteractionCollector(m, interaction.user);
@@ -336,7 +336,7 @@
}
}
- interaction.editReply({
+ await interaction.editReply({
embeds: [embed],
components: [
new ActionRowBuilder<StringSelectMenuBuilder>().addComponents(pageSelect),
@@ -367,7 +367,7 @@
modified = true;
switch (i.values[0]!) {
case "edit": {
- showModal(i, current!);
+ await showModal(i, current!);
await interaction.editReply({
embeds: [
new EmojiEmbed()
@@ -439,7 +439,7 @@
}
case "save": {
await client.database.guilds.write(interaction.guild.id, { stats: currentObject });
- singleNotify("statsChannelDeleted", interaction.guild.id, true);
+ await singleNotify("statsChannelDeleted", interaction.guild.id, true);
modified = false;
await client.memory.forceUpdate(interaction.guild.id);
break;
diff --git a/src/commands/settings/tracks.ts b/src/commands/settings/tracks.ts
index 625bcfb..60a7eae 100644
--- a/src/commands/settings/tracks.ts
+++ b/src/commands/settings/tracks.ts
@@ -142,7 +142,7 @@
out = null;
}
if (!out) return;
- out.deferUpdate();
+ await out.deferUpdate();
if (out.isButton()) return;
const values = out.values;
@@ -268,7 +268,7 @@
];
if (current.track.length >= 1) comps.splice(1, 0, selectMenu);
- interaction.editReply({ embeds: [embed], components: comps });
+ await interaction.editReply({ embeds: [embed], components: comps });
let out: ButtonInteraction | RoleSelectMenuInteraction | StringSelectMenuInteraction | null;
@@ -286,7 +286,7 @@
if (out.isButton()) {
switch (out.customId) {
case "back": {
- out.deferUpdate();
+ await out.deferUpdate();
closed = true;
break;
}
@@ -295,23 +295,23 @@
break;
}
case "reorder": {
- out.deferUpdate();
+ await out.deferUpdate();
current.track = (await reorderTracks(interaction, out, message, roles, current.track))!;
break;
}
case "retainPrevious": {
- out.deferUpdate();
+ await out.deferUpdate();
current.retainPrevious = !current.retainPrevious;
break;
}
case "nullable": {
- out.deferUpdate();
+ await out.deferUpdate();
current.nullable = !current.nullable;
break;
}
}
} else if (out.isStringSelectMenu()) {
- out.deferUpdate();
+ await out.deferUpdate();
switch (out.customId) {
case "removeRole": {
const index = current.track.findIndex(
@@ -322,7 +322,7 @@
}
}
} else {
- out.deferUpdate();
+ await out.deferUpdate();
switch (out.customId) {
case "addRole": {
const role = out.values![0]!;
@@ -476,7 +476,7 @@
break;
}
case "save": {
- client.database.guilds.write(interaction.guild!.id, { tracks: tracks });
+ await client.database.guilds.write(interaction.guild!.id, { tracks: tracks });
modified = false;
await client.memory.forceUpdate(interaction.guild!.id);
break;
diff --git a/src/commands/settings/verify.ts b/src/commands/settings/verify.ts
index e2318fc..05c4764 100644
--- a/src/commands/settings/verify.ts
+++ b/src/commands/settings/verify.ts
@@ -82,7 +82,7 @@
if (i.isButton()) {
switch (i.customId) {
case "save": {
- client.database.guilds.write(interaction.guild.id, { verify: data });
+ await client.database.guilds.write(interaction.guild.id, { verify: data });
config = await client.database.guilds.read(interaction.guild.id);
data = Object.assign({}, config.verify);
await client.memory.forceUpdate(interaction.guild.id);
diff --git a/src/commands/user/role.ts b/src/commands/user/role.ts
index 74b6c41..9a0a462 100644
--- a/src/commands/user/role.ts
+++ b/src/commands/user/role.ts
@@ -129,7 +129,7 @@
continue;
}
- i.deferUpdate();
+ await i.deferUpdate();
if (i.isButton()) {
switch (i.customId) {
case "roleSave": {
diff --git a/src/commands/user/track.ts b/src/commands/user/track.ts
index 19b9da2..ee69868 100644
--- a/src/commands/user/track.ts
+++ b/src/commands/user/track.ts
@@ -178,7 +178,7 @@
timedOut = true;
continue;
}
- component.deferUpdate();
+ await component.deferUpdate();
if (component.customId === "conflict") {
const rolesToRemove = selected.filter(
(role) => role !== (component as StringSelectMenuInteraction).values[0]
diff --git a/src/commands/verify.ts b/src/commands/verify.ts
index 0dd8b24..4bbe50f 100644
--- a/src/commands/verify.ts
+++ b/src/commands/verify.ts
@@ -5,7 +5,7 @@
const command = new SlashCommandBuilder().setName("verify").setDescription("Get verified in the server");
const callback = async (interaction: CommandInteraction): Promise<void> => {
- verify(interaction);
+ await verify(interaction);
};
export { command };
diff --git a/src/context/messages/purgeto.ts b/src/context/messages/purgeto.ts
index 4f0ea1e..a75a281 100644
--- a/src/context/messages/purgeto.ts
+++ b/src/context/messages/purgeto.ts
@@ -19,14 +19,14 @@
async function waitForButton(m: Discord.Message, member: Discord.GuildMember): Promise<boolean> {
let component;
try {
- component = m.awaitMessageComponent({
+ component = await m.awaitMessageComponent({
time: 200000,
filter: (i) => i.user.id === member.id && i.channel!.id === m.channel.id && i.message.id === m.id
});
} catch (e) {
return false;
}
- (await component).deferUpdate();
+ await component.deferUpdate();
return true;
}
@@ -210,7 +210,7 @@
guild: interaction.guild!.id
}
};
- log(data);
+ await log(data);
const messages: Message[] = deleted
.map((m) => m)
.filter((m) => m instanceof Message)
diff --git a/src/events/channelCreate.ts b/src/events/channelCreate.ts
index 90a7f6d..8fd6b35 100644
--- a/src/events/channelCreate.ts
+++ b/src/events/channelCreate.ts
@@ -81,5 +81,5 @@
guild: channel.guild.id
}
};
- log(data);
+ await log(data);
}
diff --git a/src/events/channelDelete.ts b/src/events/channelDelete.ts
index 8dffd38..b79c2da 100644
--- a/src/events/channelDelete.ts
+++ b/src/events/channelDelete.ts
@@ -123,5 +123,5 @@
guild: channel.guild.id
}
};
- log(data);
+ await log(data);
}
diff --git a/src/events/channelUpdate.ts b/src/events/channelUpdate.ts
index 6491cc9..adfe87f 100644
--- a/src/events/channelUpdate.ts
+++ b/src/events/channelUpdate.ts
@@ -301,5 +301,5 @@
guild: newChannel.guild.id
}
};
- log(data);
+ await log(data);
}
diff --git a/src/events/emojiCreate.ts b/src/events/emojiCreate.ts
index 96f7909..873defa 100644
--- a/src/events/emojiCreate.ts
+++ b/src/events/emojiCreate.ts
@@ -30,5 +30,5 @@
guild: emoji.guild.id
}
};
- log(data);
+ await log(data);
}
diff --git a/src/events/emojiDelete.ts b/src/events/emojiDelete.ts
index 52822cb..21ade1d 100644
--- a/src/events/emojiDelete.ts
+++ b/src/events/emojiDelete.ts
@@ -31,5 +31,5 @@
guild: emoji.guild.id
}
};
- log(data);
+ await log(data);
}
diff --git a/src/events/emojiUpdate.ts b/src/events/emojiUpdate.ts
index 173f5c5..236a799 100644
--- a/src/events/emojiUpdate.ts
+++ b/src/events/emojiUpdate.ts
@@ -37,5 +37,5 @@
guild: newEmoji.guild.id
}
};
- log(data);
+ await log(data);
}
diff --git a/src/events/guildBanAdd.ts b/src/events/guildBanAdd.ts
index 6036ddf..c8f3446 100644
--- a/src/events/guildBanAdd.ts
+++ b/src/events/guildBanAdd.ts
@@ -9,7 +9,7 @@
export async function callback(client: NucleusClient, ban: GuildBan) {
const { log, isLogging, NucleusColors, entry, renderUser, renderDelta, getAuditLog } = client.logger;
await statsChannelRemove(ban.user, ban.guild);
- purgeByUser(ban.user.id, ban.guild.id);
+ await purgeByUser(ban.user.id, ban.guild.id);
if (!(await isLogging(ban.guild.id, "guildMemberPunish"))) return;
const auditLog: GuildAuditLogsEntry | undefined = (await getAuditLog(ban.guild, AuditLogEvent.MemberBanAdd)).filter(
(entry: GuildAuditLogsEntry) => (entry.target! as User).id === ban.user.id
@@ -39,5 +39,5 @@
guild: ban.guild.id
}
};
- log(data);
+ await log(data);
}
diff --git a/src/events/guildBanRemove.ts b/src/events/guildBanRemove.ts
index fc916ba..64d9de3 100644
--- a/src/events/guildBanRemove.ts
+++ b/src/events/guildBanRemove.ts
@@ -33,5 +33,5 @@
guild: ban.guild.id
}
};
- log(data);
+ await log(data);
}
diff --git a/src/events/guildCreate.ts b/src/events/guildCreate.ts
index ff6c6b2..f5e43a9 100644
--- a/src/events/guildCreate.ts
+++ b/src/events/guildCreate.ts
@@ -5,5 +5,5 @@
export const event = "guildCreate";
export async function callback(_client: NucleusClient, guild: Guild) {
- guide(guild);
+ await guide(guild);
}
diff --git a/src/events/guildMemberUpdate.ts b/src/events/guildMemberUpdate.ts
index 34a52b8..05b70b7 100644
--- a/src/events/guildMemberUpdate.ts
+++ b/src/events/guildMemberUpdate.ts
@@ -84,7 +84,7 @@
});
}
data = Object.assign(data, { list: list });
- log(data);
+ await log(data);
}
}
const auditLog = (await getAuditLog(after.guild, AuditLogEvent.MemberUpdate)).filter(
@@ -93,7 +93,7 @@
if (!auditLog) return;
if (auditLog.executor!.id === client.user!.id) return;
if (before.nickname !== after.nickname) {
- doMemberChecks(after, after.guild);
+ await doMemberChecks(after, after.guild);
await client.database.history.create(
"nickname",
after.guild.id,
@@ -123,7 +123,7 @@
guild: after.guild.id
}
};
- log(data);
+ await log(data);
}
if (
(before.communicationDisabledUntilTimestamp ?? 0) < Date.now() &&
@@ -163,8 +163,8 @@
guild: after.guild.id
}
};
- log(data);
- client.database.eventScheduler.schedule("naturalUnmute", after.communicationDisabledUntil?.toISOString()!, {
+ await log(data);
+ await client.database.eventScheduler.schedule("naturalUnmute", after.communicationDisabledUntil?.toISOString()!, {
guild: after.guild.id,
user: after.id,
expires: after.communicationDisabledUntilTimestamp
@@ -204,8 +204,8 @@
guild: after.guild.id
}
};
- log(data);
- client.database.eventScheduler.cancel("naturalUnmute", {
+ await log(data);
+ await client.database.eventScheduler.cancel("naturalUnmute", {
guild: after.guild.id,
user: after.id,
expires: before.communicationDisabledUntilTimestamp
diff --git a/src/events/guildUpdate.ts b/src/events/guildUpdate.ts
index c48c82f..27c609d 100644
--- a/src/events/guildUpdate.ts
+++ b/src/events/guildUpdate.ts
@@ -93,5 +93,5 @@
guild: after.id
}
};
- log(data);
+ await log(data);
}
diff --git a/src/events/inviteCreate.ts b/src/events/inviteCreate.ts
index 240965c..6e28d95 100644
--- a/src/events/inviteCreate.ts
+++ b/src/events/inviteCreate.ts
@@ -33,5 +33,5 @@
guild: invite.guild!.id
}
};
- log(data);
+ await log(data);
}
diff --git a/src/events/inviteDelete.ts b/src/events/inviteDelete.ts
index 81285c7..89bd226 100644
--- a/src/events/inviteDelete.ts
+++ b/src/events/inviteDelete.ts
@@ -33,5 +33,5 @@
guild: invite.guild!.id
}
};
- log(data);
+ await log(data);
}
diff --git a/src/events/memberJoin.ts b/src/events/memberJoin.ts
index 66abe28..b01eb60 100644
--- a/src/events/memberJoin.ts
+++ b/src/events/memberJoin.ts
@@ -7,9 +7,9 @@
export const event = "guildMemberAdd";
export async function callback(client: NucleusClient, member: GuildMember) {
- welcome(member);
- statsChannelAdd(member.user, member.guild);
- doMemberChecks(member, member.guild);
+ await welcome(member);
+ await statsChannelAdd(member.user, member.guild);
+ await doMemberChecks(member, member.guild);
const { log, isLogging, NucleusColors, entry, renderUser, renderDelta } = client.logger;
if (!(await isLogging(member.guild.id, "guildMemberUpdate"))) return;
await client.database.history.create("join", member.guild.id, member.user, null, null);
@@ -33,5 +33,5 @@
guild: member.guild.id
}
};
- log(data);
+ await log(data);
}
diff --git a/src/events/memberLeave.ts b/src/events/memberLeave.ts
index e80ea0b..1ca50c6 100644
--- a/src/events/memberLeave.ts
+++ b/src/events/memberLeave.ts
@@ -8,7 +8,7 @@
export async function callback(client: NucleusClient, member: GuildMember) {
const startTime = Date.now() - 10 * 1000;
- purgeByUser(member.id, member.guild.id);
+ await purgeByUser(member.id, member.guild.id);
await statsChannelRemove(member.user, member.guild);
const { getAuditLog, isLogging, log, NucleusColors, entry, renderUser, renderDelta } = client.logger;
if (!(await isLogging(member.guild.id, "guildMemberUpdate"))) return;
@@ -95,5 +95,5 @@
}
};
}
- log(data);
+ await log(data);
}
diff --git a/src/events/messageCreate.ts b/src/events/messageCreate.ts
index 0281fa1..5369bf4 100644
--- a/src/events/messageCreate.ts
+++ b/src/events/messageCreate.ts
@@ -23,7 +23,11 @@
if (message.channel.permissionsFor(message.guild.members.me!)!.has("ManageMessages")) {
await message.crosspost();
} else {
- singleNotify(`Nucleus does not have Manage Messages in <#${message.channel.id}>`, message.guild.id, true);
+ await singleNotify(
+ `Nucleus does not have Manage Messages in <#${message.channel.id}>`,
+ message.guild.id,
+ true
+ );
}
}
@@ -71,7 +75,7 @@
if (!config.filters.invite.allowed.channels.includes(message.channel.id)) {
if (/(?:https?:\/\/)?discord(?:app)?\.(?:com\/invite|gg)\/[a-zA-Z0-9]+\/?/.test(content)) {
messageException(message.guild.id, message.channel.id, message.id);
- message.delete();
+ await message.delete();
const data = {
meta: {
type: "messageDelete",
diff --git a/src/events/messageDelete.ts b/src/events/messageDelete.ts
index c29bfd0..b847400 100644
--- a/src/events/messageDelete.ts
+++ b/src/events/messageDelete.ts
@@ -68,5 +68,5 @@
guild: message.guild!.id
}
};
- log(data);
+ await log(data);
}
diff --git a/src/events/messageEdit.ts b/src/events/messageEdit.ts
index 67796c7..9799dde 100644
--- a/src/events/messageEdit.ts
+++ b/src/events/messageEdit.ts
@@ -103,5 +103,5 @@
guild: newMessage.guild.id
}
};
- log(data);
+ await log(data);
}
diff --git a/src/events/roleCreate.ts b/src/events/roleCreate.ts
index 9b900f8..ea85b4d 100644
--- a/src/events/roleCreate.ts
+++ b/src/events/roleCreate.ts
@@ -30,5 +30,5 @@
guild: role.guild.id
}
};
- log(data);
+ await log(data);
}
diff --git a/src/events/roleDelete.ts b/src/events/roleDelete.ts
index e83d557..1802518 100644
--- a/src/events/roleDelete.ts
+++ b/src/events/roleDelete.ts
@@ -42,5 +42,5 @@
guild: role.guild.id
}
};
- log(data);
+ await log(data);
}
diff --git a/src/events/roleUpdate.ts b/src/events/roleUpdate.ts
index 236bc0f..c15cf01 100644
--- a/src/events/roleUpdate.ts
+++ b/src/events/roleUpdate.ts
@@ -74,5 +74,5 @@
guild: newRole.guild.id
}
}; // TODO: make our own page for this
- log(data);
+ await log(data);
}
diff --git a/src/events/stickerCreate.ts b/src/events/stickerCreate.ts
index 01944fc..bc8adb8 100644
--- a/src/events/stickerCreate.ts
+++ b/src/events/stickerCreate.ts
@@ -32,5 +32,5 @@
guild: sticker.guild!.id
}
};
- log(data);
+ await log(data);
}
diff --git a/src/events/stickerDelete.ts b/src/events/stickerDelete.ts
index a348b73..7704c49 100644
--- a/src/events/stickerDelete.ts
+++ b/src/events/stickerDelete.ts
@@ -30,5 +30,5 @@
guild: sticker.guild!.id
}
};
- log(data);
+ await log(data);
}
diff --git a/src/events/stickerUpdate.ts b/src/events/stickerUpdate.ts
index c42f775..4be1a3d 100644
--- a/src/events/stickerUpdate.ts
+++ b/src/events/stickerUpdate.ts
@@ -35,5 +35,5 @@
guild: newSticker.guild!.id
}
};
- log(data);
+ await log(data);
}
diff --git a/src/events/threadCreate.ts b/src/events/threadCreate.ts
index cefaf3b..42cda47 100644
--- a/src/events/threadCreate.ts
+++ b/src/events/threadCreate.ts
@@ -44,5 +44,5 @@
guild: thread.guild.id
}
};
- log(data);
+ await log(data);
}
diff --git a/src/events/threadDelete.ts b/src/events/threadDelete.ts
index ecbf4cf..fba6592 100644
--- a/src/events/threadDelete.ts
+++ b/src/events/threadDelete.ts
@@ -46,5 +46,5 @@
guild: thread.guild.id
}
};
- log(data);
+ await log(data);
}
diff --git a/src/events/threadUpdate.ts b/src/events/threadUpdate.ts
index 510ec30..e28abf1 100644
--- a/src/events/threadUpdate.ts
+++ b/src/events/threadUpdate.ts
@@ -55,5 +55,5 @@
guild: newThread.guild.id
}
};
- log(data);
+ await log(data);
}
diff --git a/src/events/webhookUpdate.ts b/src/events/webhookUpdate.ts
index 438c66e..c4a4efb 100644
--- a/src/events/webhookUpdate.ts
+++ b/src/events/webhookUpdate.ts
@@ -130,7 +130,7 @@
guild: channel.guild.id
}
};
- log(data);
+ await log(data);
} catch (e) {
console.log(e);
}
diff --git a/src/index.ts b/src/index.ts
index 50a1526..b3883a1 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -8,7 +8,7 @@
client.on("ready", async () => {
console.log(`Logged in as ${client.user!.tag}!`);
- register();
+ await register();
runServer(client);
if (config.enableDevelopment) {
client.fetchedCommands = await client.guilds.cache.get(config.developmentGuildID)?.commands.fetch()!;
diff --git a/src/premium/attachmentLogs.ts b/src/premium/attachmentLogs.ts
index e719f22..9bb216d 100644
--- a/src/premium/attachmentLogs.ts
+++ b/src/premium/attachmentLogs.ts
@@ -36,7 +36,7 @@
if (await client.database.premium.hasPremium(message.guild.id)) {
const channel = (await client.database.guilds.read(message.guild.id)).logging.attachments.channel;
if (!channel) {
- singleNotify(
+ await singleNotify(
"noAttachmentLogChannel",
message.guild.id,
`No channel set for attachment logging. You can set one with ${getCommandMentionByName(
@@ -48,7 +48,7 @@
}
const channelObj = await message.guild.channels.fetch(channel);
if (!channelObj) {
- singleNotify(
+ await singleNotify(
"attachmentLogChannelDeleted",
message.guild.id,
`Your attachment history channel was deleted or is not longer accessible. You can set a new one with ${getCommandMentionByName(
@@ -75,7 +75,7 @@
],
files: attachments.map((file) => file.local)
});
- client.database.guilds.write(message.guild.id, {
+ await client.database.guilds.write(message.guild.id, {
[`logging.attachments.saved.${message.channel.id}${message.id}`]: m.url
});
return { files: attachments, jump: m.url };
diff --git a/src/premium/createTranscript.ts b/src/premium/createTranscript.ts
index 7a1f57f..fa1f7a4 100644
--- a/src/premium/createTranscript.ts
+++ b/src/premium/createTranscript.ts
@@ -134,7 +134,7 @@
guild: interaction.guild!.id
}
};
- log(data);
+ await log(data);
await interaction.channel.delete();
return;
}
diff --git a/src/reflex/guide.ts b/src/reflex/guide.ts
index 1901d34..59c12c7 100644
--- a/src/reflex/guide.ts
+++ b/src/reflex/guide.ts
@@ -353,12 +353,12 @@
const em = new Discord.EmbedBuilder(pages[page]!.embed);
em.setDescription(em.data.description + "\n\n" + createPageIndicator(pages.length, page));
em.setFooter({ text: "Message closed" });
- interaction.editReply({
+ await interaction.editReply({
embeds: [em],
components: []
});
} else {
- m.delete();
+ await m.delete();
}
}
};
diff --git a/src/reflex/scanners.ts b/src/reflex/scanners.ts
index 59bfa2a..23337ac 100644
--- a/src/reflex/scanners.ts
+++ b/src/reflex/scanners.ts
@@ -55,7 +55,7 @@
} catch (e) {
return { safe: true };
}
- client.database.scanCache.write(hash, "malware", malware);
+ await client.database.scanCache.write(hash, "malware", malware);
return { safe: !malware };
}
@@ -75,7 +75,7 @@
console.error(err);
return { safe: true, tags: [] };
});
- client.database.scanCache.write(link, "bad_link", scanned.safe ?? true, scanned.tags ?? []);
+ await client.database.scanCache.write(link, "bad_link", scanned.safe ?? true, scanned.tags ?? []);
return {
safe: scanned.safe ?? true,
tags: scanned.tags ?? []
@@ -90,7 +90,7 @@
export async function saveAttachment(link: string): Promise<[string, string]> {
const image = await (await fetch(link)).arrayBuffer();
- const fileName = generateFileName(link.split("/").pop()!.split(".").pop()!);
+ const fileName = await generateFileName(link.split("/").pop()!.split(".").pop()!);
const enc = new TextDecoder("utf-8");
writeFileSync(fileName, new DataView(image), "base64");
return [fileName, createHash("sha512").update(enc.decode(image), "base64").digest("base64")];
diff --git a/src/reflex/statsChannelUpdate.ts b/src/reflex/statsChannelUpdate.ts
index e3c7a2a..f2650a8 100644
--- a/src/reflex/statsChannelUpdate.ts
+++ b/src/reflex/statsChannelUpdate.ts
@@ -12,7 +12,7 @@
export async function callback(user: User, guild: Guild) {
guild = await client.guilds.fetch(guild.id);
const config = await client.database.guilds.read(guild.id);
- Object.entries(config.stats).forEach(async ([channel, props]) => {
+ Object.entries(config.stats).forEach(([channel, props]) => void (async () => {
if ((props as PropSchema).enabled) {
let string = (props as PropSchema).name;
if (!string) return;
@@ -41,5 +41,5 @@
console.error(e);
}
}
- });
+ })());
}
diff --git a/src/reflex/verify.ts b/src/reflex/verify.ts
index a5991de..540fb4d 100644
--- a/src/reflex/verify.ts
+++ b/src/reflex/verify.ts
@@ -208,7 +208,7 @@
.setEmoji("CONTROL.BLOCKCROSS")
]
});
- singleNotify(
+ await singleNotify(
"verifyRoleDeleted",
interaction.guild!.id,
`The role given when a member is verified has been deleted. Use ${getCommandMentionByName(
diff --git a/src/reflex/welcome.ts b/src/reflex/welcome.ts
index 8e471c6..33f1651 100644
--- a/src/reflex/welcome.ts
+++ b/src/reflex/welcome.ts
@@ -45,7 +45,7 @@
content: (config.welcome.ping ? `<@&${config.welcome.ping}>` : "") + `<@${member.id}>`
});
} catch (err) {
- singleNotify(
+ await singleNotify(
"welcomeChannelDeleted",
member.guild.id,
`The welcome channel has been deleted or is no longer accessible. Use ${getCommandMentionByName(
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);