Development (#11)

We need this NOW.

---------

Co-authored-by: PineaFan <ash@pinea.dev>
Co-authored-by: pineafan <pineapplefanyt@gmail.com>
Co-authored-by: PineappleFan <PineaFan@users.noreply.github.com>
Co-authored-by: Skyler <skyler3665@gmail.com>
diff --git a/src/commands/mod/about.ts b/src/commands/mod/about.ts
index 130cdbc..0a9d962 100644
--- a/src/commands/mod/about.ts
+++ b/src/commands/mod/about.ts
@@ -3,17 +3,16 @@
 import Discord, {
     CommandInteraction,
     GuildMember,
-    Interaction,
     Message,
     ActionRowBuilder,
     ButtonBuilder,
     MessageComponentInteraction,
     ModalSubmitInteraction,
     ButtonStyle,
-    StringSelectMenuInteraction,
     TextInputStyle,
+    APIMessageComponentEmoji,
+    SlashCommandSubcommandBuilder
 } from "discord.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
 import getEmojiByName from "../../utils/getEmojiByName.js";
 import client from "../../utils/client.js";
@@ -167,8 +166,7 @@
                         .setLabel(value.text)
                         .setValue(key)
                         .setDefault(filteredTypes.includes(key))
-                        // @ts-expect-error
-                        .setEmoji(getEmojiByName(value.emoji, "id"))  // FIXME: This gives a type error but is valid
+                        .setEmoji(getEmojiByName(value.emoji, "id") as APIMessageComponentEmoji)
             )))
         ]);
         components = components.concat([new ActionRowBuilder<Discord.ButtonBuilder>().addComponents([
@@ -253,7 +251,7 @@
         try {
             i = await m.awaitMessageComponent({
                 time: 300000,
-                filter: (i) => { return i.user.id === interaction.user.id && i.channel!.id === interaction.channel!.id }
+                filter: (i) => { return i.user.id === interaction.user.id && i.channel!.id === interaction.channel!.id && i.message.id === m.id }
             });
         } catch (e) {
             interaction.editReply({
@@ -269,9 +267,9 @@
             timedOut = true;
             continue;
         }
-        i.deferUpdate();
-        if (i.customId === "filter") {
-            filteredTypes = (i as StringSelectMenuInteraction).values;
+        await i.deferUpdate();
+        if (i.customId === "filter" && i.isStringSelectMenu()) {
+            filteredTypes = i.values;
             pageIndex = null;
             refresh = true;
         }
@@ -359,7 +357,7 @@
         try {
             i = await m.awaitMessageComponent({
                 time: 300000,
-                filter: (i) => { return i.user.id === interaction.user.id && i.channel!.id === interaction.channel!.id }
+                filter: (i) => { return i.user.id === interaction.user.id && i.channel!.id === interaction.channel!.id && i.message.id === m.id }
             });
         } catch (e) {
             timedOut = true;
@@ -402,17 +400,12 @@
             });
             let out;
             try {
-                out = await modalInteractionCollector(
-                    m,
-                    (m: Interaction) =>
-                        (m as MessageComponentInteraction | ModalSubmitInteraction).channelId === interaction.channelId,
-                    (m) => m.customId === "modify"
-                );
+                out = await modalInteractionCollector(m, interaction.user);
             } catch (e) {
                 timedOut = true;
                 continue;
             }
-            if (out === null) {
+            if (out === null || out.isButton()) {
                 continue;
             } else if (out instanceof ModalSubmitInteraction) {
                 let toAdd = out.fields.getTextInputValue("note") || null;
@@ -423,7 +416,7 @@
                 continue;
             }
         } else if (i.customId === "history") {
-            i.deferUpdate();
+            await i.deferUpdate();
             if (!(await showHistory(member, interaction))) return;
         }
     }
@@ -436,6 +429,8 @@
     return true;
 };
 
-export { command };
-export { callback };
-export { check };
+export { command, callback, check };
+export const metadata = {
+    longDescription: "Shows the moderation history (all previous bans, kicks, warns etc.), and moderator notes for a user.",
+    premiumOnly: true,
+}