diff --git a/src/commands/settings/logs/attachment.ts b/src/commands/settings/logs/attachment.ts
index 326246a..2709bee 100644
--- a/src/commands/settings/logs/attachment.ts
+++ b/src/commands/settings/logs/attachment.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, ButtonInteraction } from "discord.js";
 import EmojiEmbed from "../../../utils/generateEmojiEmbed.js";
 import confirmationMessage from "../../../utils/confirmationMessage.js";
 import getEmojiByName from "../../../utils/getEmojiByName.js";
@@ -25,10 +25,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: [
@@ -41,7 +41,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()
@@ -53,19 +53,20 @@
             });
         }
         const confirmation = await new confirmationMessage(interaction)
-            .setEmoji("CHANNEL.TEXT.EDIT", "CHANNEL.TEXT.DELETE")
+            .setEmoji("CHANNEL.TEXT.EDIT")
             .setTitle("Attachment Log Channel")
             .setDescription(
                 "This will be the channel all attachments will be sent to.\n\n" +
                     `Are you sure you want to set the attachment log channel to <#${channel.id}>?`
             )
             .setColor("Warning")
+            .setFailedMessage("Attachment log channel not set", "Warning", "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.attachments.channel": channel.id
                 });
                 const { log, NucleusColors, entry, renderUser, renderChannel } = client.logger;
@@ -84,7 +85,7 @@
                         channel: entry(channel.id, renderChannel(channel))
                     },
                     hidden: {
-                        guild: interaction.guild.id
+                        guild: interaction.guild!.id
                     }
                 };
                 log(data);
@@ -114,7 +115,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.staff.channel;
 
     let timedOut = false;
@@ -127,7 +128,7 @@
                         channel
                             ? `Your attachment log channel is currently set to <#${channel}>`
                             : "This server does not have an attachment log channel" +
-                                  (client.database.premium.hasPremium(interaction.guild.id)
+                                  (await client.database.premium.hasPremium(interaction.guild!.id)
                                       ? ""
                                       : "\n\nThis server does not have premium, so this feature is disabled")
                     )
@@ -135,7 +136,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")
@@ -156,12 +157,12 @@
             continue;
         }
         i.deferUpdate();
-        if (i.component.customId === "clear") {
+        if ((i.component as unknown as ButtonInteraction).customId === "clear") {
             clicks += 1;
             if (clicks === 2) {
                 clicks = 0;
-                await client.database.guilds.write(interaction.guild.id, null, ["logging.announcements.channel"]);
-                channel = undefined;
+                await client.database.guilds.write(interaction.guild!.id, null, ["logging.announcements.channel"]);
+                channel = null;
             }
         }
     }
@@ -179,7 +180,7 @@
                 .setFooter({ text: "Message closed" })
         ],
         components: [
-            new ActionRowBuilder().addComponents([
+            new ActionRowBuilder<ButtonBuilder>().addComponents([
                 new ButtonBuilder()
                     .setCustomId("clear")
                     .setLabel("Clear")
