Fix all missing await issues (eslint)
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 };