diff --git a/src/commands/settings/logs/channel.ts b/src/commands/settings/logs/channel.ts
index 9129841..992491a 100644
--- a/src/commands/settings/logs/channel.ts
+++ b/src/commands/settings/logs/channel.ts
@@ -1,10 +1,10 @@
 import { LoadingEmbed } from "../../../utils/defaults.js";
 import { ChannelType } from "discord-api-types/v9";
-import Discord, { CommandInteraction, ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js";
+import Discord, { CommandInteraction, ActionRowBuilder, ButtonBuilder, ButtonStyle, ButtonInteraction, ButtonComponent } from "discord.js";
 import EmojiEmbed from "../../../utils/generateEmojiEmbed.js";
 import confirmationMessage from "../../../utils/confirmationMessage.js";
 import getEmojiByName from "../../../utils/getEmojiByName.js";
-import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
 import client from "../../../utils/client.js";
 
 const command = (builder: SlashCommandSubcommandBuilder) =>
@@ -24,10 +24,10 @@
         ephemeral: true,
         fetchReply: true
     })) as Discord.Message;
-    if (interaction.options.getChannel("channel")) {
+    if (interaction.options.get("channel")?.channel) {
         let channel;
         try {
-            channel = interaction.options.getChannel("channel");
+            channel = interaction.options.get("channel")?.channel;
         } catch {
             return await interaction.editReply({
                 embeds: [
@@ -40,7 +40,7 @@
             });
         }
         channel = channel as Discord.TextChannel;
-        if (channel.guild.id !== interaction.guild.id) {
+        if (channel.guild.id !== interaction.guild!.id) {
             return interaction.editReply({
                 embeds: [
                     new EmojiEmbed()
@@ -52,16 +52,17 @@
             });
         }
         const confirmation = await new confirmationMessage(interaction)
-            .setEmoji("CHANNEL.TEXT.EDIT", "CHANNEL.TEXT.DELETE")
+            .setEmoji("CHANNEL.TEXT.EDIT")
             .setTitle("Log Channel")
             .setDescription(`Are you sure you want to set the log channel to <#${channel.id}>?`)
             .setColor("Warning")
+            .setFailedMessage("The log channel was not changed", "Danger", "CHANNEL.TEXT.DELETE")
             .setInverted(true)
             .send(true);
         if (confirmation.cancelled) return;
         if (confirmation.success) {
             try {
-                await client.database.guilds.write(interaction.guild.id, {
+                await client.database.guilds.write(interaction.guild!.id, {
                     "logging.logs.channel": channel.id
                 });
                 const { log, NucleusColors, entry, renderUser, renderChannel } = client.logger;
@@ -111,7 +112,7 @@
         }
     }
     let clicks = 0;
-    const data = await client.database.guilds.read(interaction.guild.id);
+    const data = await client.database.guilds.read(interaction.guild!.id);
     let channel = data.logging.logs.channel;
     let timedOut = false;
     while (!timedOut) {
@@ -128,7 +129,7 @@
                     .setEmoji("CHANNEL.TEXT.CREATE")
             ],
             components: [
-                new ActionRowBuilder().addComponents([
+                new ActionRowBuilder<ButtonBuilder>().addComponents([
                     new ButtonBuilder()
                         .setCustomId("clear")
                         .setLabel(clicks ? "Click again to confirm" : "Reset channel")
@@ -138,22 +139,23 @@
                 ])
             ]
         });
-        let i;
+        let i: ButtonInteraction;
         try {
             i = await m.awaitMessageComponent({
                 time: 300000,
                 filter: (i) => { return i.user.id === interaction.user.id && i.channel!.id === interaction.channel!.id }
-            });
+            }) as ButtonInteraction;
         } catch (e) {
             timedOut = true;
         }
+        i = i!
         i.deferUpdate();
-        if (i.component.customId === "clear") {
+        if ((i.component as ButtonComponent).customId === "clear") {
             clicks += 1;
             if (clicks === 2) {
                 clicks = 0;
-                await client.database.guilds.write(interaction.guild.id, null, ["logging.logs.channel"]);
-                channel = undefined;
+                await client.database.guilds.write(interaction.guild!.id, null, ["logging.logs.channel"]);
+                channel = null;
             }
         }
     }
@@ -171,7 +173,7 @@
                 .setFooter({ text: "Message closed" })
         ],
         components: [
-            new ActionRowBuilder().addComponents([
+            new ActionRowBuilder<ButtonBuilder>().addComponents([
                 new ButtonBuilder()
                     .setCustomId("clear")
                     .setLabel("Clear")
diff --git a/src/commands/settings/logs/events.ts b/src/commands/settings/logs/events.ts
index ae04e89..a158b19 100644
--- a/src/commands/settings/logs/events.ts
+++ b/src/commands/settings/logs/events.ts
@@ -1,6 +1,6 @@
 import { LoadingEmbed } from "../../../utils/defaults.js";
-import Discord, { CommandInteraction, Message, ActionRowBuilder, ButtonBuilder, SelectMenuBuilder, ButtonStyle } from "discord.js";
-import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import Discord, { CommandInteraction, Message, ActionRowBuilder, ButtonBuilder, SelectMenuBuilder, ButtonStyle, StringSelectMenuBuilder, EmbedBuilder, StringSelectMenuComponent, StringSelectMenuInteraction } from "discord.js";
+import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
 import EmojiEmbed from "../../../utils/generateEmojiEmbed.js";
 import client from "../../../utils/client.js";
 import { toHexArray, toHexInteger } from "../../../utils/calculate.js";
@@ -40,7 +40,7 @@
     let m: Message;
     let timedOut = false;
     do {
-        const config = await client.database.guilds.read(interaction.guild.id);
+        const config = await client.database.guilds.read(interaction.guild!.id);
         const converted = toHexArray(config.logging.logs.toLog);
         m = (await interaction.editReply({
             embeds: [
@@ -53,21 +53,21 @@
                     .setEmoji("CHANNEL.TEXT.CREATE")
             ],
             components: [
-                new ActionRowBuilder().addComponents([
-                    new SelectMenuBuilder()
+                new ActionRowBuilder<StringSelectMenuBuilder>().addComponents([
+                    new StringSelectMenuBuilder()
                         .setPlaceholder("Set events to log")
                         .setMaxValues(Object.keys(logs).length)
                         .setCustomId("logs")
                         .setMinValues(0)
                         .setOptions(
                             Object.keys(logs).map((e, i) => ({
-                                label: logs[e],
+                                label: (logs as any)[e],
                                 value: i.toString(),
                                 default: converted.includes(e)
                             }))
                         )
                 ]),
-                new ActionRowBuilder().addComponents([
+                new ActionRowBuilder<ButtonBuilder>().addComponents([
                     new ButtonBuilder().setLabel("Select all").setStyle(ButtonStyle.Primary).setCustomId("all"),
                     new ButtonBuilder().setLabel("Select none").setStyle(ButtonStyle.Danger).setCustomId("none")
                 ])
@@ -85,24 +85,24 @@
         }
         i.deferUpdate();
         if (i.customId === "logs") {
-            const selected = i.values;
-            const newLogs = toHexInteger(selected.map((e) => Object.keys(logs)[parseInt(e)]));
-            await client.database.guilds.write(interaction.guild.id, {
+            const selected = (i as StringSelectMenuInteraction).values;
+            const newLogs = toHexInteger(selected.map((e: string) => Object.keys(logs)[parseInt(e)]!));
+            await client.database.guilds.write(interaction.guild!.id, {
                 "logging.logs.toLog": newLogs
             });
         } else if (i.customId === "all") {
             const newLogs = toHexInteger(Object.keys(logs).map((e) => e));
-            await client.database.guilds.write(interaction.guild.id, {
+            await client.database.guilds.write(interaction.guild!.id, {
                 "logging.logs.toLog": newLogs
             });
         } else if (i.customId === "none") {
-            await client.database.guilds.write(interaction.guild.id, {
+            await client.database.guilds.write(interaction.guild!.id, {
                 "logging.logs.toLog": 0
             });
         }
     } while (!timedOut);
 
-    await interaction.editReply({ embeds: [m.embeds[0]!.setFooter({ text: "Message timed out" })] });
+    await interaction.editReply({ embeds: [new EmbedBuilder(m.embeds[0]!.data).setFooter({ text: "Message timed out" })] });
     return;
 };
 
diff --git a/src/commands/settings/logs/staff.ts b/src/commands/settings/logs/staff.ts
index 5a23839..13125ef 100644
--- a/src/commands/settings/logs/staff.ts
+++ b/src/commands/settings/logs/staff.ts
@@ -1,6 +1,6 @@
 import { LoadingEmbed } from "../../../utils/defaults.js";
 import { ChannelType } from "discord-api-types/v9";
-import Discord, { CommandInteraction, ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js";
+import Discord, { CommandInteraction, ActionRowBuilder, ButtonBuilder, ButtonStyle, ButtonComponent } from "discord.js";
 import EmojiEmbed from "../../../utils/generateEmojiEmbed.js";
 import confirmationMessage from "../../../utils/confirmationMessage.js";
 import getEmojiByName from "../../../utils/getEmojiByName.js";
@@ -26,10 +26,10 @@
         ephemeral: true,
         fetchReply: true
     })) as Discord.Message;
-    if (interaction.options.getChannel("channel")) {
+    if (interaction.options.get("channel")?.channel) {
         let channel;
         try {
-            channel = interaction.options.getChannel("channel");
+            channel = interaction.options.get("channel")?.channel;
         } catch {
             return await interaction.editReply({
                 embeds: [
@@ -54,13 +54,14 @@
             });
         }
         const confirmation = await new confirmationMessage(interaction)
-            .setEmoji("CHANNEL.TEXT.EDIT", "CHANNEL.TEXT.DELETE")
+            .setEmoji("CHANNEL.TEXT.EDIT")
             .setTitle("Staff Notifications Channel")
             .setDescription(
                 "This will be the channel all notifications, updates, user reports etc. will be sent to.\n\n" +
                     `Are you sure you want to set the staff notifications channel to <#${channel.id}>?`
             )
             .setColor("Warning")
+            .setFailedMessage("Staff notifications channel not set", "Warning", "CHANNEL.TEXT.DELETE")
             .setInverted(true)
             .send(true);
         if (confirmation.cancelled) return;
@@ -132,7 +133,7 @@
                     .setEmoji("CHANNEL.TEXT.CREATE")
             ],
             components: [
-                new ActionRowBuilder().addComponents([
+                new ActionRowBuilder<ButtonBuilder>().addComponents([
                     new ButtonBuilder()
                         .setCustomId("clear")
                         .setLabel(clicks ? "Click again to confirm" : "Reset channel")
@@ -153,12 +154,12 @@
             continue;
         }
         i.deferUpdate();
-        if ((i.component as ButtonBuilder).customId === "clear") {
+        if ((i.component as ButtonComponent).customId === "clear") {
             clicks += 1;
             if (clicks === 2) {
                 clicks = 0;
                 await client.database.guilds.write(interaction.guild.id, null, ["logging.staff.channel"]);
-                channel = undefined;
+                channel = null;
             }
         }
     }
@@ -176,7 +177,7 @@
                 .setFooter({ text: "Message closed" })
         ],
         components: [
-            new ActionRowBuilder().addComponents([
+            new ActionRowBuilder<ButtonBuilder>().addComponents([
                 new ButtonBuilder()
                     .setCustomId("clear")
                     .setLabel("Clear")
