Fix the last of the eslint errors (for real this time)
diff --git a/src/commands/user/about.ts b/src/commands/user/about.ts
index 6ae3231..4701630 100644
--- a/src/commands/user/about.ts
+++ b/src/commands/user/about.ts
@@ -7,9 +7,10 @@
MessageActionRowComponent,
MessageButton,
MessageComponentInteraction,
+ MessageSelectOptionData,
SelectMenuInteraction
} from "discord.js";
-import { SelectMenuOption, SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import getEmojiByName from "../../utils/getEmojiByName.js";
import generateKeyValueList from "../../utils/generateKeyValueList.js";
@@ -224,22 +225,20 @@
ephemeral: true
})) as Message;
let page = 0;
- let breakReason = "";
- while (true) {
+ let timedOut = false;
+ while (!timedOut) {
const em = new Discord.MessageEmbed(embeds[page].embed);
em.setDescription(em.description + "\n" + createPageIndicator(embeds.length, page));
let selectPane = [];
if (selectPaneOpen) {
- const options = [];
+ const options: MessageSelectOptionData[] = [];
embeds.forEach((embed) => {
- options.push(
- new SelectMenuOption({
- label: embed.title,
- value: embed.pageId.toString(),
- description: embed.description || ""
- })
- );
+ options.push({
+ label: embed.title,
+ value: embed.pageId.toString(),
+ description: embed.description || ""
+ });
});
selectPane = [
new MessageActionRow().addComponents([
@@ -269,11 +268,7 @@
.setEmoji(getEmojiByName("CONTROL.RIGHT", "id"))
.setCustomId("right")
.setStyle("SECONDARY")
- .setDisabled(page === embeds.length - 1),
- new MessageButton()
- .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
- .setCustomId("close")
- .setStyle("DANGER")
+ .setDisabled(page === embeds.length - 1)
])
])
});
@@ -281,8 +276,8 @@
try {
i = await m.awaitMessageComponent({ time: 300000 });
} catch {
- breakReason = "Message timed out";
- break;
+ timedOut = true;
+ continue;
}
i.deferUpdate();
if ((i.component as MessageActionRowComponent).customId === "left") {
@@ -293,45 +288,16 @@
selectPaneOpen = false;
} else if ((i.component as MessageActionRowComponent).customId === "select") {
selectPaneOpen = !selectPaneOpen;
- } else if ((i.component as MessageActionRowComponent).customId === "close") {
- breakReason = "Message closed";
- break;
} else if ((i.component as MessageActionRowComponent).customId === "page") {
page = parseInt((i as SelectMenuInteraction).values[0]);
selectPaneOpen = false;
- } else {
- breakReason = "Message closed";
- break;
}
}
const em = new Discord.MessageEmbed(embeds[page].embed);
- em.setDescription(em.description + "\n" + createPageIndicator(embeds.length, page) + " | " + breakReason);
+ em.setDescription(em.description + "\n" + createPageIndicator(embeds.length, page) + " | Message closed");
await interaction.editReply({
embeds: [em],
- components: [
- new MessageActionRow().addComponents([
- new MessageButton()
- .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
- .setStyle("SECONDARY")
- .setCustomId("left")
- .setDisabled(true),
- new MessageButton()
- .setEmoji(getEmojiByName("CONTROL.MENU", "id"))
- .setStyle("SECONDARY")
- .setCustomId("select")
- .setDisabled(true),
- new MessageButton()
- .setEmoji(getEmojiByName("CONTROL.RIGHT", "id"))
- .setCustomId("right")
- .setStyle("SECONDARY")
- .setDisabled(true),
- new MessageButton()
- .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
- .setCustomId("close")
- .setStyle("DANGER")
- .setDisabled(true)
- ])
- ]
+ components: []
});
};
diff --git a/src/commands/user/track.ts b/src/commands/user/track.ts
index da62880..8c991e3 100644
--- a/src/commands/user/track.ts
+++ b/src/commands/user/track.ts
@@ -35,7 +35,8 @@
const roles = await guild.roles.fetch();
const memberRoles = member.roles;
let managed: boolean;
- while (true) {
+ let timedOut = false;
+ while (!timedOut) {
const data = config.tracks[track];
if (data.manageableBy !== undefined)
managed = data.manageableBy.some((element: string) => {
@@ -169,7 +170,8 @@
try {
component = await m.awaitMessageComponent({ time: 300000 });
} catch (e) {
- return;
+ timedOut = true;
+ continue;
}
component.deferUpdate();
if (component.customId === "conflict") {