diff --git a/src/commands/mod/slowmode.ts b/src/commands/mod/slowmode.ts
index 7e8b8a2..1a06db1 100644
--- a/src/commands/mod/slowmode.ts
+++ b/src/commands/mod/slowmode.ts
@@ -5,29 +5,51 @@
 import confirmationMessage from "../../utils/confirmationMessage.js";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
 
-
 const command = (builder: SlashCommandSubcommandBuilder) =>
     builder
         .setName("slowmode")
         .setDescription("Manages slowmode in a channel")
-        .addStringOption(option => option.setName("time").setDescription("The delay between messages").setRequired(false).addChoices([
-            ["Off", "0"],
-            ["5 seconds", "5"], ["10 seconds", "10"], ["15 seconds", "15"], ["30 seconds", "30"],
-            ["1 minute", "60"], ["2 minutes", "120"], ["5 minutes", "300"], ["10 minutes", "600"],
-            ["15 minutes", "900"], ["30 minutes", "1800"],
-            ["1 hour", "3600"], ["2 hours", "7200"], ["6 hours", "21600"]
-        ]));
+        .addStringOption((option) =>
+            option
+                .setName("time")
+                .setDescription("The delay between messages")
+                .setRequired(false)
+                .addChoices([
+                    ["Off", "0"],
+                    ["5 seconds", "5"],
+                    ["10 seconds", "10"],
+                    ["15 seconds", "15"],
+                    ["30 seconds", "30"],
+                    ["1 minute", "60"],
+                    ["2 minutes", "120"],
+                    ["5 minutes", "300"],
+                    ["10 minutes", "600"],
+                    ["15 minutes", "900"],
+                    ["30 minutes", "1800"],
+                    ["1 hour", "3600"],
+                    ["2 hours", "7200"],
+                    ["6 hours", "21600"]
+                ])
+        );
 
 const callback = async (interaction: CommandInteraction): Promise<void> => {
     let time = parseInt(interaction.options.getString("time") ?? "0");
-    if (time === 0 && (interaction.channel as TextChannel).rateLimitPerUser === 0) { time = 10; }
+    if (
+        time === 0 &&
+        (interaction.channel as TextChannel).rateLimitPerUser === 0
+    ) {
+        time = 10;
+    }
     const confirmation = await new confirmationMessage(interaction)
         .setEmoji("CHANNEL.SLOWMODE.OFF")
         .setTitle("Slowmode")
-        .setDescription(keyValueList({
-            "time": time ? humanizeDuration(time * 1000, { round: true }) : "No delay"
-        })
-        + "Are you sure you want to set the slowmode in this channel?")
+        .setDescription(
+            keyValueList({
+                time: time
+                    ? humanizeDuration(time * 1000, { round: true })
+                    : "No delay"
+            }) + "Are you sure you want to set the slowmode in this channel?"
+        )
         .setColor("Danger")
         .send();
     if (confirmation.cancelled) return;
@@ -35,37 +57,53 @@
         try {
             (interaction.channel as TextChannel).setRateLimitPerUser(time);
         } catch (e) {
-            await interaction.editReply({embeds: [new EmojiEmbed()
-                .setEmoji("CHANNEL.SLOWMODE.OFF")
-                .setTitle("Slowmode")
-                .setDescription("Something went wrong while setting the slowmode")
-                .setStatus("Danger")
-            ], components: []});
+            await interaction.editReply({
+                embeds: [
+                    new EmojiEmbed()
+                        .setEmoji("CHANNEL.SLOWMODE.OFF")
+                        .setTitle("Slowmode")
+                        .setDescription(
+                            "Something went wrong while setting the slowmode"
+                        )
+                        .setStatus("Danger")
+                ],
+                components: []
+            });
         }
-        await interaction.editReply({embeds: [new EmojiEmbed()
-            .setEmoji("CHANNEL.SLOWMODE.ON")
-            .setTitle("Slowmode")
-            .setDescription("The channel slowmode was set successfully")
-            .setStatus("Success")
-        ], components: []});
+        await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setEmoji("CHANNEL.SLOWMODE.ON")
+                    .setTitle("Slowmode")
+                    .setDescription("The channel slowmode was set successfully")
+                    .setStatus("Success")
+            ],
+            components: []
+        });
     } else {
-        await interaction.editReply({embeds: [new EmojiEmbed()
-            .setEmoji("CHANNEL.SLOWMODE.ON")
-            .setTitle("Slowmode")
-            .setDescription("No changes were made")
-            .setStatus("Success")
-        ], components: []});
+        await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setEmoji("CHANNEL.SLOWMODE.ON")
+                    .setTitle("Slowmode")
+                    .setDescription("No changes were made")
+                    .setStatus("Success")
+            ],
+            components: []
+        });
     }
 };
 
 const check = (interaction: CommandInteraction) => {
-    const member = (interaction.member as GuildMember);
+    const member = interaction.member as GuildMember;
     // Check if Nucleus can set the slowmode
-    if (! interaction.guild.me.permissions.has("MANAGE_CHANNELS")) throw "I do not have the *Manage Channels* permission";
+    if (!interaction.guild.me.permissions.has("MANAGE_CHANNELS"))
+        throw "I do not have the *Manage Channels* permission";
     // Check if the user has manage_channel permission
-    if (! member.permissions.has("MANAGE_CHANNELS")) throw "You do not have the *Manage Channels* permission";
+    if (!member.permissions.has("MANAGE_CHANNELS"))
+        throw "You do not have the *Manage Channels* permission";
     // Allow slowmode
     return true;
 };
 
-export { command, callback, check };
\ No newline at end of file
+export { command, callback, check };
