diff --git a/src/utils/confirmationMessage.ts b/src/utils/confirmationMessage.ts
index 18e6ea0..87724f3 100644
--- a/src/utils/confirmationMessage.ts
+++ b/src/utils/confirmationMessage.ts
@@ -1,3 +1,4 @@
+import { TextInputBuilder } from "@discordjs/builders";
 import Discord, {
     CommandInteraction,
     Interaction,
@@ -6,8 +7,8 @@
     ButtonBuilder,
     MessageComponentInteraction,
     ModalSubmitInteraction,
-    TextInputComponent,
-    ButtonStyle
+    ButtonStyle,
+    TextInputStyle
 } from "discord.js";
 import { modalInteractionCollector } from "./dualCollector.js";
 import EmojiEmbed from "./generateEmojiEmbed.js";
@@ -65,7 +66,7 @@
         customId: string,
         title: string,
         disabled: boolean,
-        callback: () => Promise<unknown> = async () => null,
+        callback: (() => Promise<unknown>) | null = async () => null,
         callbackClicked: string | null,
         emoji?: string,
         initial?: boolean
@@ -76,7 +77,7 @@
             value: callbackClicked,
             emoji: emoji,
             active: initial ?? false,
-            onClick: callback,
+            onClick: callback ?? (async () => null),
             response: null
         };
         return this;
@@ -129,7 +130,10 @@
                 );
             const components = [];
             for (let i = 0; i < fullComponents.length; i += 5) {
-                components.push(new ActionRowBuilder().addComponents(fullComponents.slice(i, i + 5)));
+                components.push(new ActionRowBuilder<
+                    Discord.ButtonBuilder | Discord.StringSelectMenuBuilder |
+                    Discord.RoleSelectMenuBuilder | Discord.UserSelectMenuBuilder
+                >().addComponents(fullComponents.slice(i, i + 5)));
             }
             const object = {
                 embeds: [
@@ -155,7 +159,7 @@
             let m: Message;
             try {
                 if (editOnly) {
-                    m = (await this.interaction.editReply(object)) as Message;
+                    m = (await this.interaction.editReply(object)) as unknown as Message;
                 } else {
                     m = (await this.interaction.reply(object)) as unknown as Message;
                 }
@@ -194,17 +198,17 @@
                 continue;
             } else if (component.customId === "reason") {
                 await component.showModal(
-                    new Discord.Modal()
+                    new Discord.ModalBuilder()
                         .setCustomId("modal")
                         .setTitle("Editing reason")
                         .addComponents(
-                            new ActionRowBuilder<TextInputComponent>().addComponents(
-                                new TextInputComponent()
+                            new ActionRowBuilder<TextInputBuilder>().addComponents(
+                                new TextInputBuilder()
                                     .setCustomId("reason")
                                     .setLabel("Reason")
                                     .setMaxLength(2000)
                                     .setRequired(false)
-                                    .setStyle("PARAGRAPH")
+                                    .setStyle(TextInputStyle.Paragraph)
                                     .setPlaceholder("Spammed in #general")
                                     .setValue(this.reason ? this.reason : "")
                             )
@@ -219,13 +223,13 @@
                             .setEmoji(this.emoji)
                     ],
                     components: [
-                        new ActionRowBuilder().addComponents([
+                        new ActionRowBuilder<Discord.ButtonBuilder>().addComponents(
                             new ButtonBuilder()
                                 .setLabel("Back")
                                 .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
                                 .setStyle(ButtonStyle.Primary)
                                 .setCustomId("back")
-                        ])
+                        )
                     ]
                 });
                 let out;
@@ -269,7 +273,12 @@
         }
         if (newReason) returnValue.newReason = newReason;
 
-        return returnValue;
+        const typedReturnValue = returnValue as {cancelled: true} |
+        { success: boolean, components: Record<string, CustomBoolean<unknown>>, newReason?: string} |
+        { newReason: string, components: Record<string, CustomBoolean<unknown>> } |
+        { components: Record<string, CustomBoolean<unknown>> };
+
+        return typedReturnValue;
     }
 
     async timeoutError(): Promise<void> {
