diff --git a/src/commands/mod/nick.ts b/src/commands/mod/nick.ts
index 743579b..cfdcf47 100644
--- a/src/commands/mod/nick.ts
+++ b/src/commands/mod/nick.ts
@@ -1,5 +1,16 @@
 import { LinkWarningFooter } from "./../../utils/defaults.js";
-import { ActionRowBuilder, ButtonBuilder, CommandInteraction, GuildMember, ButtonStyle, Message, ButtonInteraction, ModalBuilder, TextInputBuilder, TextInputStyle } 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,7 +28,10 @@
             option.setName("name").setDescription("The name to set | Leave blank to clear").setRequired(false)
         );
 
-const callback = async (interaction: CommandInteraction | ButtonInteraction, member?: GuildMember): 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()) {
@@ -39,28 +53,15 @@
             .setDescription(
                 keyValueList({
                     user: renderUser(member.user),
-                    "new nickname": `${
-                        newNickname
-                            ? newNickname
-                            : "*No nickname*"
-                    }`
-                }) +
-                    `Are you sure you want to ${
-                        newNickname ? "change" : "clear"
-                    } <@!${member.id}>'s nickname?`
+                    "new nickname": `${newNickname ? newNickname : "*No nickname*"}`
+                }) + `Are you sure you want to ${newNickname ? "change" : "clear"} <@!${member.id}>'s nickname?`
             )
             .setColor("Danger")
             .addCustomBoolean(
                 "appeal",
                 "Create appeal ticket",
                 !(await areTicketsEnabled(interaction.guild!.id)),
-                async () =>
-                    await create(
-                        interaction.guild!,
-                        member!.user,
-                        interaction.user,
-                        "Nickname changed"
-                    ),
+                async () => await create(interaction.guild!, member!.user, interaction.user, "Nickname changed"),
                 "An appeal ticket will be created",
                 null,
                 "CONTROL.TICKET",
@@ -81,18 +82,16 @@
                 "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 : " ")
-                        )
+                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")
@@ -104,7 +103,7 @@
             notify = confirmation.components["notify"]!.active;
             createAppealTicket = confirmation.components["appeal"]!.active;
         }
-        if (confirmation.modals) newNickname = confirmation.modals![0]!.value
+        if (confirmation.modals) newNickname = confirmation.modals![0]!.value;
     } while (!timedOut && !success);
     if (timedOut || !success) return;
     let dmSent = false;
@@ -121,12 +120,8 @@
                         .setEmoji("PUNISH.NICKNAME.RED")
                         .setTitle("Nickname changed")
                         .setDescription(
-                            `Your nickname was ${
-                                newNickname ? "changed" : "cleared"
-                            } in ${interaction.guild!.name}.` +
-                                (newNickname
-                                    ? `\nIt is now: ${newNickname}`
-                                    : "") +
+                            `Your nickname was ${newNickname ? "changed" : "cleared"} in ${interaction.guild!.name}.` +
+                                (newNickname ? `\nIt is now: ${newNickname}` : "") +
                                 "\n\n" +
                                 (createAppealTicket
                                     ? `You can appeal this in the ticket created in <#${
@@ -145,12 +140,7 @@
                         new ButtonBuilder()
                             .setStyle(ButtonStyle.Link)
                             .setLabel(config.moderation.nick.text)
-                            .setURL(
-                                config.moderation.nick.link.replaceAll(
-                                    "{id}",
-                                    member.id
-                                )
-                            )
+                            .setURL(config.moderation.nick.link.replaceAll("{id}", member.id))
                     )
                 );
             }
