diff --git a/src/commands/mod/ban.ts b/src/commands/mod/ban.ts
index 628b607..88f7b39 100644
--- a/src/commands/mod/ban.ts
+++ b/src/commands/mod/ban.ts
@@ -3,9 +3,9 @@
     GuildMember,
     ActionRowBuilder,
     ButtonBuilder,
-    User,
     ButtonStyle,
-    SlashCommandSubcommandBuilder
+    SlashCommandSubcommandBuilder,
+    ButtonInteraction
 } from "discord.js";
 import confirmationMessage from "../../utils/confirmationMessage.js";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
@@ -29,8 +29,16 @@
                 .setRequired(false)
         );
 
-const callback = async (interaction: CommandInteraction): Promise<void> => {
+const callback = async (interaction: CommandInteraction | ButtonInteraction, member?: GuildMember): Promise<void> => {
     if (!interaction.guild) return;
+    let deleteDays;
+    if (!interaction.isButton()) {
+        member = interaction.options.getMember("user") as GuildMember;
+        deleteDays = (interaction.options.get("delete")?.value as number | null) ?? 0
+    } else {
+        deleteDays = 0;
+    }
+    if (!member) return;
     const { renderUser } = client.logger;
     // TODO:[Modals] Replace the command arguments with a modal
     let reason = null;
@@ -44,15 +52,12 @@
             .setTitle("Ban")
             .setDescription(
                 keyValueList({
-                    user: renderUser(interaction.options.getUser("user")!),
+                    user: renderUser(member.user),
                     reason: reason ? "\n> " + reason.replaceAll("\n", "\n> ") : "*No reason provided*"
                 }) +
                     `The user **will${notify ? "" : " not"}** be notified\n` +
-                    `${addPlurals(
-                        (interaction.options.get("delete")?.value as number | null) ?? 0,
-                        "day"
-                    )} of messages will be deleted\n\n` +
-                    `Are you sure you want to ban <@!${(interaction.options.getMember("user") as GuildMember).id}>?`
+                    `${addPlurals(deleteDays, "day")} of messages will be deleted\n\n` +
+                    `Are you sure you want to ban <@!${member.id}>?`
             )
             .addCustomBoolean(
                 "notify",
@@ -113,23 +118,21 @@
                             .setURL(
                                 config.moderation.ban.link.replaceAll(
                                     "{id}",
-                                    (interaction.options.getMember("user") as GuildMember).id
+                                    member.id
                                 )
                             )
                     )
                 );
             }
-            dmMessage = await (interaction.options.getMember("user") as GuildMember).send(messageData);
+            dmMessage = await member.send(messageData);
             dmSent = true;
         }
     } catch {
         dmSent = false;
     }
     try {
-        const member = interaction.options.getMember("user") as GuildMember;
-        const days: number = (interaction.options.get("delete")?.value as number | null) ?? 0;
         member.ban({
-            deleteMessageSeconds: days * 24 * 60 * 60,
+            deleteMessageSeconds: deleteDays * 24 * 60 * 60,
             reason: reason ?? "*No reason provided*"
         });
         await client.database.history.create("ban", interaction.guild.id, member.user, interaction.user, reason);
@@ -189,23 +192,22 @@
     });
 };
 
-const check = async (interaction: CommandInteraction, partial: boolean = false) => {
+const check = (interaction: CommandInteraction | ButtonInteraction, partial: boolean = false, target?: GuildMember) => {
     if (!interaction.guild) return;
     const member = interaction.member as GuildMember;
     // Check if the user has ban_members permission
     if (!member.permissions.has("BanMembers")) return "You do not have the *Ban Members* permission";
     if (partial) return true;
     const me = interaction.guild.members.me!;
-    let apply = interaction.options.getUser("user") as User | GuildMember;
+    let apply: GuildMember;
+    if (interaction.isButton()) {
+        apply = target!;
+    } else {
+        apply = interaction.options.getMember("user") as GuildMember;
+    };
     const memberPos = member.roles.cache.size > 1 ? member.roles.highest.position : 0;
     const mePos = me.roles.cache.size > 1 ? me.roles.highest.position : 0;
-    let applyPos = 0;
-    try {
-        apply = (await interaction.guild.members.fetch(apply.id)) as GuildMember;
-        applyPos = apply.roles.cache.size > 1 ? apply.roles.highest.position : 0;
-    } catch {
-        apply = apply as User;
-    }
+    const applyPos = apply.roles.cache.size > 1 ? apply.roles.highest.position : 0;
     // Do not allow banning the owner
     if (member.id === interaction.guild.ownerId) return "You cannot ban the owner of the server";
     // Check if Nucleus can ban the member
diff --git a/src/commands/mod/kick.ts b/src/commands/mod/kick.ts
index c4f1867..4d325a2 100644
--- a/src/commands/mod/kick.ts
+++ b/src/commands/mod/kick.ts
@@ -5,7 +5,8 @@
     ActionRowBuilder,
     ButtonBuilder,
     ButtonStyle,
-    SlashCommandSubcommandBuilder
+    SlashCommandSubcommandBuilder,
+    ButtonInteraction
 } from "discord.js";
 // @ts-expect-error
 import humanizeDuration from "humanize-duration";
@@ -22,8 +23,12 @@
         .setDescription("Kicks a user from the server")
         .addUserOption((option) => option.setName("user").setDescription("The user to kick").setRequired(true));
 
-const callback = async (interaction: CommandInteraction): Promise<unknown> => {
+const callback = async (interaction: CommandInteraction | ButtonInteraction, member?: GuildMember): Promise<void> => {
     if (!interaction.guild) return;
+    if (!interaction.isButton()) {
+        member = interaction.options.getMember("user") as GuildMember;
+    }
+    if (!member) return;
     const { renderUser } = client.logger;
     // TODO:[Modals] Replace this with a modal
     let reason: string | null = null;
@@ -37,9 +42,9 @@
             .setTitle("Kick")
             .setDescription(
                 keyValueList({
-                    user: renderUser(interaction.options.getUser("user")!),
+                    user: renderUser(member.user),
                     reason: reason ? "\n> " + reason.replaceAll("\n", "\n> ") : "*No reason provided*"
-                }) + `Are you sure you want to kick <@!${(interaction.options.getMember("user") as GuildMember).id}>?`
+                }) + `Are you sure you want to kick <@!${member.id}>?`
             )
             .setColor("Danger")
             .addCustomBoolean(
@@ -101,21 +106,20 @@
                             .setURL(
                                 config.moderation.kick.link.replaceAll(
                                     "{id}",
-                                    (interaction.options.getMember("user") as GuildMember).id
+                                    member.id
                                 )
                             )
                     )
                 );
             }
-            dmMessage = await (interaction.options.getMember("user") as GuildMember).send(messageData);
+            dmMessage = await member.send(messageData);
             dmSent = true;
         }
     } catch {
         dmSent = false;
     }
     try {
-        (interaction.options.getMember("user") as GuildMember).kick(reason || "No reason provided");
-        const member = interaction.options.getMember("user") as GuildMember;
+        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
@@ -186,7 +190,7 @@
     });
 };
 
-const check = (interaction: CommandInteraction, partial: boolean = false) => {
+const check = (interaction: CommandInteraction | ButtonInteraction, partial: boolean = false, target?: GuildMember) => {
     if (!interaction.guild) return;
 
     const member = interaction.member as GuildMember;
@@ -195,7 +199,12 @@
     if (partial) return true;
 
     const me = interaction.guild.members.me!;
-    const apply = interaction.options.getMember("user") as GuildMember;
+    let apply: GuildMember;
+    if (interaction.isButton()) {
+        apply = target!;
+    } else {
+        apply = interaction.options.getMember("user") as GuildMember;
+    }
     const memberPos = member.roles.cache.size > 1 ? member.roles.highest.position : 0;
     const mePos = me.roles.cache.size > 1 ? me.roles.highest.position : 0;
     const applyPos = apply.roles.cache.size > 1 ? apply.roles.highest.position : 0;
diff --git a/src/commands/mod/mute.ts b/src/commands/mod/mute.ts
index 39c9e5e..51ffc4d 100644
--- a/src/commands/mod/mute.ts
+++ b/src/commands/mod/mute.ts
@@ -1,5 +1,5 @@
 import { LinkWarningFooter, LoadingEmbed } from "../../utils/defaults.js";
-import Discord, { CommandInteraction, GuildMember, ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js";
+import Discord, { CommandInteraction, GuildMember, ActionRowBuilder, ButtonBuilder, ButtonStyle, ButtonInteraction } from "discord.js";
 import type { SlashCommandSubcommandBuilder } from "discord.js";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
 import getEmojiByName from "../../utils/getEmojiByName.js";
@@ -49,16 +49,22 @@
                 .setRequired(false)
         );
 
-const callback = async (interaction: CommandInteraction): Promise<unknown> => {
+const callback = async (interaction: CommandInteraction | ButtonInteraction, member?: GuildMember): Promise<unknown> => {
     if (!interaction.guild) return;
     const { log, NucleusColors, renderUser, entry, renderDelta } = client.logger;
-    const member = interaction.options.getMember("user") as GuildMember;
-    const time: { days: number; hours: number; minutes: number; seconds: number } = {
-        days: (interaction.options.get("days")?.value as number | null) ?? 0,
-        hours: (interaction.options.get("hours")?.value as number | null) ?? 0,
-        minutes: (interaction.options.get("minutes")?.value as number | null) ?? 0,
-        seconds: (interaction.options.get("seconds")?.value as number | null) ?? 0
-    };
+    let time: { days: number; hours: number; minutes: number; seconds: number } | null = null;
+    if (!interaction.isButton()) {
+        member = interaction.options.getMember("user") as GuildMember;
+        time = {
+            days: (interaction.options.get("days")?.value as number | null) ?? 0,
+            hours: (interaction.options.get("hours")?.value as number | null) ?? 0,
+            minutes: (interaction.options.get("minutes")?.value as number | null) ?? 0,
+            seconds: (interaction.options.get("seconds")?.value as number | null) ?? 0
+        };
+    } else {
+        time = {days: 0, hours: 0, minutes: 0, seconds: 0};
+    }
+    if (!member) return;
     const config = await client.database.guilds.read(interaction.guild.id);
     let serverSettingsDescription = config.moderation.mute.timeout ? "given a timeout" : "";
     if (config.moderation.mute.role)
@@ -198,7 +204,7 @@
                 "Create appeal ticket",
                 !(await areTicketsEnabled(interaction.guild.id)),
                 async () =>
-                    await create(interaction.guild!, interaction.options.getUser("user")!, interaction.user, reason),
+                    await create(interaction.guild!, member!.user, interaction.user, reason),
                 "An appeal ticket will be created when Confirm is clicked",
                 null,
                 "CONTROL.TICKET",
@@ -275,12 +281,7 @@
                         new ButtonBuilder()
                             .setStyle(ButtonStyle.Link)
                             .setLabel(config.moderation.mute.text)
-                            .setURL(
-                                config.moderation.mute.link.replaceAll(
-                                    "{id}",
-                                    (interaction.options.getMember("user") as GuildMember).id
-                                )
-                            )
+                            .setURL(config.moderation.mute.link.replaceAll("{id}", member.id))
                     )
                 );
             }
@@ -399,14 +400,19 @@
     });
 };
 
-const check = async (interaction: CommandInteraction, partial: boolean = false) => {
+const check = (interaction: CommandInteraction | ButtonInteraction, partial: boolean = false, target?: GuildMember) => {
     if (!interaction.guild) return;
     const member = interaction.member as GuildMember;
     // Check if the user has moderate_members permission
     if (!member.permissions.has("ModerateMembers")) return "You do not have the *Moderate Members* permission";
     if (partial) return true;
     const me = interaction.guild.members.me!;
-    const apply = interaction.options.getMember("user") as GuildMember;
+    let apply;
+    if (interaction.isButton()) {
+        apply = target!;
+    } else {
+        apply = interaction.options.getMember("user") as GuildMember;
+    }
     const memberPos = member.roles.cache.size > 1 ? member.roles.highest.position : 0;
     const mePos = me.roles.cache.size > 1 ? me.roles.highest.position : 0;
     const applyPos = apply.roles.cache.size > 1 ? apply.roles.highest.position : 0;
diff --git a/src/commands/mod/nick.ts b/src/commands/mod/nick.ts
index 8b33551..743579b 100644
--- a/src/commands/mod/nick.ts
+++ b/src/commands/mod/nick.ts
@@ -1,5 +1,5 @@
 import { LinkWarningFooter } from "./../../utils/defaults.js";
-import { ActionRowBuilder, ButtonBuilder, CommandInteraction, GuildMember, ButtonStyle, Message } from "discord.js";
+import { ActionRowBuilder, ButtonBuilder, CommandInteraction, GuildMember, ButtonStyle, Message, ButtonInteraction, ModalBuilder, TextInputBuilder, TextInputStyle } from "discord.js";
 import type { SlashCommandSubcommandBuilder } from "discord.js";
 import confirmationMessage from "../../utils/confirmationMessage.js";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
@@ -17,31 +17,37 @@
             option.setName("name").setDescription("The name to set | Leave blank to clear").setRequired(false)
         );
 
-const callback = async (interaction: CommandInteraction): Promise<unknown> => {
+const callback = async (interaction: CommandInteraction | ButtonInteraction, member?: GuildMember): Promise<unknown> => {
     const { log, NucleusColors, entry, renderDelta, renderUser } = client.logger;
+    let newNickname;
+    if (!interaction.isButton()) {
+        member = interaction.options.getMember("user") as GuildMember;
+        newNickname = interaction.options.get("name")?.value as string | undefined;
+    }
+    if (!member) return;
     // TODO:[Modals] Replace this with a modal
-    let notify = true;
+    let notify = false;
     let confirmation;
     let timedOut = false;
     let success = false;
     let createAppealTicket = false;
-    let firstRun = true;
+    let firstRun = !interaction.isButton();
     do {
         confirmation = await new confirmationMessage(interaction)
             .setEmoji("PUNISH.NICKNAME.RED")
             .setTitle("Nickname")
             .setDescription(
                 keyValueList({
-                    user: renderUser(interaction.options.getUser("user")!),
+                    user: renderUser(member.user),
                     "new nickname": `${
-                        (interaction.options.get("name")?.value as string)
-                            ? (interaction.options.get("name")?.value as string)
+                        newNickname
+                            ? newNickname
                             : "*No nickname*"
                     }`
                 }) +
                     `Are you sure you want to ${
-                        (interaction.options.get("name")?.value as string) ? "change" : "clear"
-                    } <@!${(interaction.options.getMember("user") as GuildMember).id}>'s nickname?`
+                        newNickname ? "change" : "clear"
+                    } <@!${member.id}>'s nickname?`
             )
             .setColor("Danger")
             .addCustomBoolean(
@@ -51,7 +57,7 @@
                 async () =>
                     await create(
                         interaction.guild!,
-                        interaction.options.getUser("user")!,
+                        member!.user,
                         interaction.user,
                         "Nickname changed"
                     ),
@@ -70,6 +76,25 @@
                 "ICONS.NOTIFY." + (notify ? "ON" : "OFF"),
                 notify
             )
+            .addModal(
+                "Change nickname",
+                "ICONS.EDIT",
+                "modal",
+                newNickname ?? "",
+                new ModalBuilder()
+                    .setTitle("Editing nickname")
+                    .addComponents(
+                        new ActionRowBuilder<TextInputBuilder>().addComponents(
+                            new TextInputBuilder()
+                                .setCustomId("default")
+                                .setLabel("Nickname")
+                                .setMaxLength(32)
+                                .setRequired(false)
+                                .setStyle(TextInputStyle.Short)
+                                .setValue(newNickname ? newNickname : " ")
+                        )
+                )
+            )
             .setFailedMessage("No changes were made", "Success", "PUNISH.NICKNAME.GREEN")
             .send(!firstRun);
         firstRun = false;
@@ -79,6 +104,7 @@
             notify = confirmation.components["notify"]!.active;
             createAppealTicket = confirmation.components["appeal"]!.active;
         }
+        if (confirmation.modals) newNickname = confirmation.modals![0]!.value
     } while (!timedOut && !success);
     if (timedOut || !success) return;
     let dmSent = false;
@@ -96,10 +122,10 @@
                         .setTitle("Nickname changed")
                         .setDescription(
                             `Your nickname was ${
-                                (interaction.options.get("name")?.value as string) ? "changed" : "cleared"
+                                newNickname ? "changed" : "cleared"
                             } in ${interaction.guild!.name}.` +
-                                ((interaction.options.get("name")?.value as string)
-                                    ? `\nIt is now: ${interaction.options.get("name")?.value as string}`
+                                (newNickname
+                                    ? `\nIt is now: ${newNickname}`
                                     : "") +
                                 "\n\n" +
                                 (createAppealTicket
@@ -122,26 +148,22 @@
                             .setURL(
                                 config.moderation.nick.link.replaceAll(
                                     "{id}",
-                                    (interaction.options.getMember("user") as GuildMember).id
+                                    member.id
                                 )
                             )
                     )
                 );
             }
-            dmMessage = await (interaction.options.getMember("user") as GuildMember).send(messageData);
+            dmMessage = await member.send(messageData);
             dmSent = true;
         }
     } catch {
         dmSent = false;
     }
-    let member: GuildMember;
     let before: string | null;
-    let nickname: string | undefined;
     try {
-        member = interaction.options.getMember("user") as GuildMember;
         before = member.nickname;
-        nickname = interaction.options.get("name")?.value as string | undefined;
-        member.setNickname(nickname ?? null, "Nucleus Nickname command");
+        member.setNickname(newNickname ?? null, "Nucleus Nickname command");
         await client.database.history.create(
             "nickname",
             interaction.guild!.id,
@@ -149,7 +171,7 @@
             interaction.user,
             null,
             before,
-            nickname
+            newNickname
         );
     } catch {
         await interaction.editReply({
@@ -175,9 +197,9 @@
             timestamp: Date.now()
         },
         list: {
-            memberId: entry(member.id, `\`${member.id}\``),
+            member: entry(member.id, renderUser(member.user)),
             before: entry(before, before ?? "*No nickname set*"),
-            after: entry(nickname ?? null, nickname ?? "*No nickname set*"),
+            after: entry(newNickname ?? null, newNickname ?? "*No nickname set*"),
             updated: entry(Date.now(), renderDelta(Date.now())),
             updatedBy: entry(interaction.user.id, renderUser(interaction.user))
         },
@@ -210,13 +232,18 @@
     });
 };
 
-const check = async (interaction: CommandInteraction, partial: boolean = false) => {
+const check = async (interaction: CommandInteraction | ButtonInteraction, partial: boolean, target?: GuildMember) => {
     const member = interaction.member as GuildMember;
     // Check if the user has manage_nicknames permission
     if (!member.permissions.has("ManageNicknames")) return "You do not have the *Manage Nicknames* permission";
     if (partial) return true;
     const me = interaction.guild!.members.me!;
-    const apply = interaction.options.getMember("user") as GuildMember;
+    let apply: GuildMember;
+    if (interaction.isButton()) {
+        apply = target!;
+    } else {
+        apply = interaction.options.getMember("user") as GuildMember;
+    }
     const memberPos = member.roles.cache.size ? member.roles.highest.position : 0;
     const mePos = me.roles.cache.size ? me.roles.highest.position : 0;
     const applyPos = apply.roles.cache.size ? apply.roles.highest.position : 0;
diff --git a/src/commands/mod/warn.ts b/src/commands/mod/warn.ts
index 5d1bd94..8408303 100644
--- a/src/commands/mod/warn.ts
+++ b/src/commands/mod/warn.ts
@@ -1,4 +1,4 @@
-import Discord, { CommandInteraction, GuildMember, ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js";
+import Discord, { CommandInteraction, GuildMember, ActionRowBuilder, ButtonBuilder, ButtonStyle, ButtonInteraction } from "discord.js";
 import type { SlashCommandSubcommandBuilder } from "discord.js";
 import confirmationMessage from "../../utils/confirmationMessage.js";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
@@ -14,9 +14,11 @@
         .setDescription("Warns a user")
         .addUserOption((option) => option.setName("user").setDescription("The user to warn").setRequired(true));
 
-const callback = async (interaction: CommandInteraction): Promise<unknown> => {
-    if (interaction.guild === null) return;
+const callback = async (interaction: CommandInteraction | ButtonInteraction, member?: GuildMember): Promise<unknown> => {
+    if (!interaction.guild) return;
     const { log, NucleusColors, renderUser, entry } = client.logger;
+    if (!interaction.isButton()) member = interaction.options.getMember("user") as GuildMember;
+    if (!member) return;
     // TODO:[Modals] Replace this with a modal
     let reason: string | null = null;
     let notify = true;
@@ -30,9 +32,9 @@
             .setTitle("Warn")
             .setDescription(
                 keyValueList({
-                    user: renderUser(interaction.options.getUser("user")!),
+                    user: renderUser(member.user),
                     reason: reason ? "\n> " + reason.replaceAll("\n", "\n> ") : "*No reason provided*"
-                }) + `Are you sure you want to warn <@!${(interaction.options.getMember("user") as GuildMember).id}>?`
+                }) + `Are you sure you want to warn <@!${member.id}>?`
             )
             .setColor("Danger")
             .addCustomBoolean(
@@ -40,7 +42,7 @@
                 "Create appeal ticket",
                 !(await areTicketsEnabled(interaction.guild.id)),
                 async () =>
-                    await create(interaction.guild!, interaction.options.getUser("user")!, interaction.user, reason),
+                    await create(interaction.guild!, member!.user, interaction.user, reason),
                 "An appeal ticket will be created",
                 null,
                 "CONTROL.TICKET",
@@ -111,13 +113,13 @@
                             .setURL(
                                 config.moderation.warn.link.replaceAll(
                                     "{id}",
-                                    (interaction.options.getMember("user") as GuildMember).id
+                                    member.id
                                 )
                             )
                     )
                 );
             }
-            await (interaction.options.getMember("user") as GuildMember).send(messageData);
+            await member.send(messageData);
             dmSent = true;
         }
     } catch (e) {
@@ -134,8 +136,8 @@
         },
         list: {
             user: entry(
-                (interaction.options.getMember("user") as GuildMember).user.id,
-                renderUser((interaction.options.getMember("user") as GuildMember).user)
+                member.user.id,
+                renderUser(member.user)
             ),
             warnedBy: entry(interaction.member!.user.id, renderUser(interaction.member!.user as Discord.User)),
             reason: reason ? reason : "*No reason provided*"
@@ -152,7 +154,7 @@
     await client.database.history.create(
         "warn",
         interaction.guild.id,
-        (interaction.options.getMember("user") as GuildMember).user,
+        member.user,
         interaction.user,
         reason
     );
@@ -177,7 +179,7 @@
             components: []
         });
     } else {
-        const canSeeChannel = (interaction.options.getMember("user") as GuildMember)
+        const canSeeChannel = member
             .permissionsIn(interaction.channel as Discord.TextChannel)
             .has("ViewChannel");
         const m = (await interaction.editReply({
@@ -235,9 +237,9 @@
                         .setDescription("You have been warned" + (reason ? ` for:\n> ${reason}` : "."))
                         .setStatus("Danger")
                 ],
-                content: `<@!${(interaction.options.getMember("user") as GuildMember).id}>`,
+                content: `<@!${member.id}>`,
                 allowedMentions: {
-                    users: [(interaction.options.getMember("user") as GuildMember).id]
+                    users: [member.id]
                 }
             });
             return await interaction.editReply({
@@ -271,7 +273,7 @@
         } else if (component.customId === "ticket") {
             const ticketChannel = await create(
                 interaction.guild,
-                interaction.options.getUser("user")!,
+                member.user,
                 interaction.user,
                 reason,
                 "Warn Notification"
@@ -302,13 +304,17 @@
     }
 };
 
-const check = (interaction: CommandInteraction, partial: boolean = false) => {
+const check = (interaction: CommandInteraction | ButtonInteraction, partial: boolean = false, target?: GuildMember) => {
     if (!interaction.guild) return;
     const member = interaction.member as GuildMember;
     if (!member.permissions.has("ModerateMembers")) return "You do not have the *Moderate Members* permission";
     if (partial) return true;
-    const apply = interaction.options.getMember("user") as GuildMember | null;
-    if (apply === null) return "That member is not in the server";
+    let apply: GuildMember;
+    if (interaction.isButton()) {
+        apply = target!;
+    } else {
+        apply = interaction.options.getMember("user") as GuildMember;
+    }
     const memberPos = member.roles.cache.size ? member.roles.highest.position : 0;
     const applyPos = apply.roles.cache.size ? apply.roles.highest.position : 0;
     // Do not allow warning bots
diff --git a/src/commands/nucleus/stats.ts b/src/commands/nucleus/stats.ts
index 058695c..1eceae2 100644
--- a/src/commands/nucleus/stats.ts
+++ b/src/commands/nucleus/stats.ts
@@ -28,7 +28,10 @@
                     .setDescription(description)
                     .setStatus("Success")
                     .setEmoji("SETTINGS.STATS.GREEN")
-            ], components: [new ActionRowBuilder<ButtonBuilder>().addComponents(new ButtonBuilder().setCustomId("admin").setLabel("Admin Panel").setStyle(ButtonStyle.Primary))]
+            ], components: [new ActionRowBuilder<ButtonBuilder>().addComponents(
+                new ButtonBuilder().setCustomId("admin").setLabel("Admin Panel").setStyle(ButtonStyle.Primary),
+                new ButtonBuilder().setCustomId("mod:nickname:599498449733550102").setLabel("Testing").setStyle(ButtonStyle.Primary)
+            )]
         });
 
         const modal = new ModalBuilder()
diff --git a/src/commands/settings/automod.ts b/src/commands/settings/automod.ts
index 9d59520..db4a1c4 100644
--- a/src/commands/settings/automod.ts
+++ b/src/commands/settings/automod.ts
@@ -1069,17 +1069,19 @@
             closed = true;
             continue;
         }
-        await i.deferUpdate();
         if (i.isButton()) {
+            await i.deferUpdate();
             await client.database.guilds.write(interaction.guild.id, { filters: config });
             await client.memory.forceUpdate(interaction.guild.id);
         } else {
             switch (i.values[0]) {
                 case "invites": {
+                    i.deferUpdate();
                     config.invite = await inviteMenu(i, m, config.invite);
                     break;
                 }
                 case "mentions": {
+                    i.deferUpdate();
                     config.pings = await mentionMenu(i, m, config.pings);
                     break;
                 }
@@ -1088,15 +1090,18 @@
                     break;
                 }
                 case "malware": {
+                    i.deferUpdate();
                     config.malware = !config.malware;
                     break;
                 }
                 case "images": {
+                    i.deferUpdate();
                     const next = await imageMenu(i, m, config.images);
                     config.images = next;
                     break;
                 }
                 case "clean": {
+                    i.deferUpdate();
                     const next = await cleanMenu(i, m, config.clean);
                     config.clean = next;
                     break;
