diff --git a/src/utils/confirmationMessage.ts b/src/utils/confirmationMessage.ts
index a8c7ab4..58ab9d4 100644
--- a/src/utils/confirmationMessage.ts
+++ b/src/utils/confirmationMessage.ts
@@ -86,7 +86,12 @@
         components?: Record<string, CustomBoolean<unknown>>;
         newReason?: string;
     }> {
-        while (true) {
+        let cancelled = false;
+        let success: boolean | undefined = undefined;
+        let returnComponents = false;
+        let newReason = undefined;
+
+        while (!cancelled && success === undefined && !returnComponents && !newReason) {
             const fullComponents = [
                 new Discord.MessageButton()
                     .setCustomId("yes")
@@ -150,7 +155,8 @@
                     m = (await this.interaction.reply(object)) as unknown as Message;
                 }
             } catch {
-                return { cancelled: true };
+                cancelled = true;
+                continue;
             }
             let component;
             try {
@@ -159,7 +165,9 @@
                     time: 300000
                 });
             } catch (e) {
-                return { success: false, components: this.customButtons };
+                success = false;
+                returnComponents = true;
+                continue;
             }
             if (component.customId === "yes") {
                 component.deferUpdate();
@@ -171,10 +179,14 @@
                         console.log(e);
                     }
                 }
-                return { success: true, components: this.customButtons };
+                success = true;
+                returnComponents = true;
+                continue;
             } else if (component.customId === "no") {
                 component.deferUpdate();
-                return { success: false, components: this.customButtons };
+                success = false;
+                returnComponents = true;
+                continue;
             } else if (component.customId === "reason") {
                 await component.showModal(
                     new Discord.Modal()
@@ -221,24 +233,35 @@
                         (m) => m.customId === "reason"
                     );
                 } catch (e) {
-                    return { cancelled: true };
+                    cancelled = true;
+                    continue;
                 }
                 if (out === null) {
-                    return { cancelled: true };
+                    cancelled = true;
+                    continue;
                 }
                 if (out instanceof ModalSubmitInteraction) {
-                    return {
-                        newReason: out.fields.getTextInputValue("reason")
-                    };
+                    newReason = out.fields.getTextInputValue("reason");
+                    continue;
                 } else {
-                    return { components: this.customButtons };
+                    returnComponents = true;
+                    continue;
                 }
             } else {
                 component.deferUpdate();
                 this.customButtons[component.customId]!.active = !this.customButtons[component.customId]!.active;
-                return { components: this.customButtons };
+                returnComponents = true;
+                continue;
             }
         }
+        const returnValue: Awaited<ReturnType<typeof this.send>> = {};
+
+        if (returnComponents) returnValue.components = this.customButtons;
+        if (success !== undefined) returnValue.success = success;
+        if (cancelled) returnValue.cancelled = true;
+        if (newReason) returnValue.newReason = newReason;
+
+        return returnValue;
     }
 }
 
