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
