diff --git a/src/commands/mod/ban.ts b/src/commands/mod/ban.ts
index e32a720..7346bcc 100644
--- a/src/commands/mod/ban.ts
+++ b/src/commands/mod/ban.ts
@@ -53,6 +53,7 @@
                 false,
                 undefined,
                 "The user will be sent a DM",
+                null,
                 "ICONS.NOTIFY." + (notify ? "ON" : "OFF"),
                 notify
             )
diff --git a/src/commands/mod/info.ts b/src/commands/mod/info.ts
index 12c414f..6e9abed 100644
--- a/src/commands/mod/info.ts
+++ b/src/commands/mod/info.ts
@@ -1,3 +1,4 @@
+import { LoadingEmbed } from './../../utils/defaultEmbeds.js';
 import type { HistorySchema } from "../../utils/database.js";
 import Discord, {
     CommandInteraction,
@@ -8,11 +9,12 @@
     ButtonBuilder,
     MessageComponentInteraction,
     ModalSubmitInteraction,
-    TextInputComponent,
     ButtonStyle,
-    StringSelectMenuInteraction
+    StringSelectMenuInteraction,
+    TextInputStyle,
+    APIMessageComponentEmoji
 } from "discord.js";
-import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import { SlashCommandSubcommandBuilder, StringSelectMenuOptionBuilder } from "@discordjs/builders";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
 import getEmojiByName from "../../utils/getEmojiByName.js";
 import client from "../../utils/client.js";
@@ -153,60 +155,59 @@
             }
         }
         if (pageIndex === null) pageIndex = 0;
-        const components = (
-            openFilterPane
-                ? [
-                      new ActionRowBuilder<Discord.StringSelectMenuBuilder>().addComponents(
-                          new Discord.SelectMenuBuilder()
-                              .setOptions(
-                                  Object.entries(types).map(([key, value]) => ({
-                                      label: value.text,
-                                      value: key,
-                                      default: filteredTypes.includes(key),
-                                      emoji: client.emojis.resolve(getEmojiByName(value.emoji, "id"))
-                                  }))
-                              )
-                              .setMinValues(1)
-                              .setMaxValues(Object.keys(types).length)
-                              .setCustomId("filter")
-                              .setPlaceholder("Select at least one event")
-                      )
-                  ]
-                : []
-        ).concat([
-            new ActionRowBuilder<Discord.ButtonBuilder>().addComponents([
-                new ButtonBuilder()
-                    .setCustomId("prevYear")
-                    .setLabel((currentYear - 1).toString())
-                    .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
-                    .setStyle(ButtonStyle.Secondary),
-                new ButtonBuilder().setCustomId("prevPage").setLabel("Previous page").setStyle(ButtonStyle.Primary),
-                new ButtonBuilder().setCustomId("today").setLabel("Today").setStyle(ButtonStyle.Primary),
-                new ButtonBuilder()
-                    .setCustomId("nextPage")
-                    .setLabel("Next page")
-                    .setStyle(ButtonStyle.Primary)
-                    .setDisabled(pageIndex >= groups.length - 1 && currentYear === new Date().getFullYear()),
-                new ButtonBuilder()
-                    .setCustomId("nextYear")
-                    .setLabel((currentYear + 1).toString())
-                    .setEmoji(getEmojiByName("CONTROL.RIGHT", "id"))
-                    .setStyle(ButtonStyle.Secondary)
-                    .setDisabled(currentYear === new Date().getFullYear())
-            ]),
-            new ActionRowBuilder<Discord.ButtonBuilder>().addComponents([
-                new ButtonBuilder()
-                    .setLabel("Mod notes")
-                    .setCustomId("modNotes")
-                    .setStyle(ButtonStyle.Primary)
-                    .setEmoji(getEmojiByName("ICONS.EDIT", "id")),
-                new ButtonBuilder()
-                    .setLabel("Filter")
-                    .setCustomId("openFilter")
-                    .setStyle(openFilterPane ? ButtonStyle.Success : ButtonStyle.Primary)
-                    .setEmoji(getEmojiByName("ICONS.FILTER", "id"))
-            ])
-        ]);
+        let components: (ActionRowBuilder<Discord.StringSelectMenuBuilder> | ActionRowBuilder<ButtonBuilder>)[] = []
+        if (openFilterPane) components = components.concat([
+            new ActionRowBuilder<Discord.StringSelectMenuBuilder>().addComponents(
+                new Discord.StringSelectMenuBuilder().setOptions(
+                    ...Object.entries(types).map(([key, value]) => new StringSelectMenuOptionBuilder()
+                        .setLabel(value.text)
+                        .setValue(key)
+                        .setDefault(filteredTypes.includes(key))
+                        .setEmoji(client.emojis.resolve(getEmojiByName(value.emoji, "id"))! as APIMessageComponentEmoji)
+                    )
+                )
+                .setMinValues(1)
+                .setMaxValues(Object.keys(types).length)
+                .setCustomId("filter")
+                .setPlaceholder("Select events to show")
+            )
+        ])
+        components = components.concat([new ActionRowBuilder<Discord.ButtonBuilder>().addComponents([
+            new ButtonBuilder()
+                .setCustomId("prevYear")
+                .setLabel((currentYear - 1).toString())
+                .setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
+                .setStyle(ButtonStyle.Secondary),
+            new ButtonBuilder()
+                .setCustomId("prevPage")
+                .setLabel("Previous page")
+                .setStyle(ButtonStyle.Primary),
+            new ButtonBuilder().setCustomId("today").setLabel("Today").setStyle(ButtonStyle.Primary),
+            new ButtonBuilder()
+                .setCustomId("nextPage")
+                .setLabel("Next page")
+                .setStyle(ButtonStyle.Primary)
+                .setDisabled(pageIndex >= groups.length - 1 && currentYear === new Date().getFullYear()),
+            new ButtonBuilder()
+                .setCustomId("nextYear")
+                .setLabel((currentYear + 1).toString())
+                .setEmoji(getEmojiByName("CONTROL.RIGHT", "id"))
+                .setStyle(ButtonStyle.Secondary)
+                .setDisabled(currentYear === new Date().getFullYear())
+        ])])
+        components = components.concat([new ActionRowBuilder<Discord.ButtonBuilder>().addComponents([
+            new ButtonBuilder()
+                .setLabel("Mod notes")
+                .setCustomId("modNotes")
+                .setStyle(ButtonStyle.Primary)
+                .setEmoji(getEmojiByName("ICONS.EDIT", "id")),
+            new ButtonBuilder()
+                .setLabel("Filter")
+                .setCustomId("openFilter")
+                .setStyle(openFilterPane ? ButtonStyle.Success : ButtonStyle.Primary)
+                .setEmoji(getEmojiByName("ICONS.FILTER", "id"))
+        ])])
+
         const end =
             "\n\nJanuary " +
             currentYear.toString() +
@@ -216,7 +217,7 @@
             currentYear.toString();
         if (groups.length > 0) {
             const toRender = groups[Math.min(pageIndex, groups.length - 1)]!;
-            m = (await interaction.editReply({
+            m = await interaction.editReply({
                 embeds: [
                     new EmojiEmbed()
                         .setEmoji("MEMBER.JOIN")
@@ -226,25 +227,25 @@
                         )
                         .setStatus("Success")
                         .setFooter({
-                            text: openFilterPane && filteredTypes.length ? "Filters are currently enabled" : ""
+                            text: openFilterPane && filteredTypes.length ? "Filters are currently enabled" : "No filters selected"
                         })
                 ],
                 components: components
-            })) as Message;
+            });
         } else {
-            m = (await interaction.editReply({
+            m = await interaction.editReply({
                 embeds: [
                     new EmojiEmbed()
                         .setEmoji("MEMBER.JOIN")
                         .setTitle("Moderation history for " + member.user.username)
-                        .setDescription(`**${currentYear}**\n\n*No events*` + "\n\n" + end)
+                        .setDescription(`**${currentYear}**\n\n*No events*`)
                         .setStatus("Success")
                         .setFooter({
-                            text: openFilterPane && filteredTypes.length ? "Filters are currently enabled" : ""
+                            text: openFilterPane && filteredTypes.length ? "Filters are currently enabled" : "No filters selected"
                         })
                 ],
                 components: components
-            })) as Message;
+            })
         }
         let i: MessageComponentInteraction;
         try {
@@ -315,7 +316,7 @@
     let m: Message;
     const member = interaction.options.getMember("user") as Discord.GuildMember;
     await interaction.reply({
-        embeds: [new EmojiEmbed().setEmoji("NUCLEUS.LOADING").setTitle("Downloading Data").setStatus("Danger")],
+        embeds: LoadingEmbed,
         ephemeral: true,
         fetchReply: true
     });
@@ -324,9 +325,7 @@
     let timedOut = false;
     while (!timedOut) {
         note = await client.database.notes.read(member.guild.id, member.id);
-        if (firstLoad && !note) {
-            await showHistory(member, interaction);
-        }
+        if (firstLoad && !note) { await showHistory(member, interaction); }
         firstLoad = false;
         m = (await interaction.editReply({
             embeds: [
@@ -344,7 +343,7 @@
                         .setCustomId("modify")
                         .setEmoji(getEmojiByName("ICONS.EDIT", "id")),
                     new ButtonBuilder()
-                        .setLabel("View moderation history")
+                        .setLabel("Moderation history")
                         .setStyle(ButtonStyle.Primary)
                         .setCustomId("history")
                         .setEmoji(getEmojiByName("ICONS.HISTORY", "id"))
@@ -364,14 +363,14 @@
                     .setCustomId("modal")
                     .setTitle("Editing moderator note")
                     .addComponents(
-                        new ActionRowBuilder<Discord.TextInputComponent>().addComponents(
-                            new TextInputComponent()
+                        new ActionRowBuilder<Discord.TextInputBuilder>().addComponents(
+                            new Discord.TextInputBuilder()
                                 .setCustomId("note")
                                 .setLabel("Note")
                                 .setMaxLength(4000)
                                 .setRequired(false)
-                                .setStyle("PARAGRAPH")
-                                .setValue(note ? note : "")
+                                .setStyle(TextInputStyle.Paragraph)
+                                .setValue(note ? note : " ")
                         )
                     )
             );
@@ -408,7 +407,9 @@
             if (out === null) {
                 continue;
             } else if (out instanceof ModalSubmitInteraction) {
-                const toAdd = out.fields.getTextInputValue("note") || null;
+                let toAdd = out.fields.getTextInputValue("note") || null;
+                if (toAdd === " ") toAdd = null;
+                if (toAdd) toAdd = toAdd.trim();
                 await client.database.notes.create(member.guild.id, member.id, toAdd);
             } else {
                 continue;
diff --git a/src/commands/mod/kick.ts b/src/commands/mod/kick.ts
index 2feb5d7..dd71892 100644
--- a/src/commands/mod/kick.ts
+++ b/src/commands/mod/kick.ts
@@ -1,4 +1,4 @@
-import { LinkWarningFooter } from './../../utils/defaultEmbeds';
+import { LinkWarningFooter } from './../../utils/defaultEmbeds.js';
 import { CommandInteraction, GuildMember, ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js";
 // @ts-expect-error
 import humanizeDuration from "humanize-duration";
@@ -42,6 +42,7 @@
                 false,
                 null,
                 "The user will be sent a DM",
+                null,
                 "ICONS.NOTIFY." + (notify ? "ON" : "OFF"),
                 notify
             )
diff --git a/src/commands/mod/mute.ts b/src/commands/mod/mute.ts
index 0e76cba..95c8c5a 100644
--- a/src/commands/mod/mute.ts
+++ b/src/commands/mod/mute.ts
@@ -192,6 +192,7 @@
                 async () =>
                     await create(interaction.guild, interaction.options.getUser("user")!, interaction.user, reason),
                 "An appeal ticket will be created when Confirm is clicked",
+                null,
                 "CONTROL.TICKET",
                 createAppealTicket
             )
@@ -201,6 +202,7 @@
                 false,
                 undefined,
                 null,
+                null,
                 "ICONS.NOTIFY." + (notify ? "ON" : "OFF"),
                 notify
             )
diff --git a/src/commands/mod/nick.ts b/src/commands/mod/nick.ts
index b5e5554..0975375 100644
--- a/src/commands/mod/nick.ts
+++ b/src/commands/mod/nick.ts
@@ -45,6 +45,7 @@
                 false,
                 null,
                 null,
+                null,
                 "ICONS.NOTIFY." + (notify ? "ON" : "OFF"),
                 notify
             )
diff --git a/src/commands/mod/purge.ts b/src/commands/mod/purge.ts
index e9aa41a..6087890 100644
--- a/src/commands/mod/purge.ts
+++ b/src/commands/mod/purge.ts
@@ -1,4 +1,4 @@
-import Discord, { CommandInteraction, GuildChannel, GuildMember, TextChannel, ButtonStyle } from "discord.js";
+import Discord, { CommandInteraction, GuildChannel, GuildMember, TextChannel, ButtonStyle, ButtonBuilder } from "discord.js";
 import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
 import confirmationMessage from "../../utils/confirmationMessage.js";
 import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
@@ -26,7 +26,8 @@
         );
 
 const callback = async (interaction: CommandInteraction): Promise<unknown> => {
-    const user = (interaction.options.getMember("user") as GuildMember);
+    if (!interaction.guild) return;
+    const user = (interaction.options.getMember("user") as GuildMember | null);
     const channel = interaction.channel as GuildChannel;
     if (
         !["GUILD_TEXT", "GUILD_NEWS", "GUILD_NEWS_THREAD", "GUILD_PUBLIC_THREAD", "GUILD_PRIVATE_THREAD"].includes(
@@ -46,7 +47,7 @@
         });
     }
     // TODO:[Modals] Replace this with a modal
-    if (!interaction.options.getInteger("amount")) {
+    if (!interaction.options.get("amount")) {
         await interaction.reply({
             embeds: [
                 new EmojiEmbed()
@@ -74,17 +75,17 @@
                         .setStatus("Danger")
                 ],
                 components: [
-                    new Discord.ActionRowBuilder().addComponents([
+                    new Discord.ActionRowBuilder<ButtonBuilder>().addComponents([
                         new Discord.ButtonBuilder().setCustomId("1").setLabel("1").setStyle(ButtonStyle.Secondary),
                         new Discord.ButtonBuilder().setCustomId("3").setLabel("3").setStyle(ButtonStyle.Secondary),
                         new Discord.ButtonBuilder().setCustomId("5").setLabel("5").setStyle(ButtonStyle.Secondary)
                     ]),
-                    new Discord.ActionRowBuilder().addComponents([
+                    new Discord.ActionRowBuilder<ButtonBuilder>().addComponents([
                         new Discord.ButtonBuilder().setCustomId("10").setLabel("10").setStyle(ButtonStyle.Secondary),
                         new Discord.ButtonBuilder().setCustomId("25").setLabel("25").setStyle(ButtonStyle.Secondary),
                         new Discord.ButtonBuilder().setCustomId("50").setLabel("50").setStyle(ButtonStyle.Secondary)
                     ]),
-                    new Discord.ActionRowBuilder().addComponents([
+                    new Discord.ActionRowBuilder<ButtonBuilder>().addComponents([
                         new Discord.ButtonBuilder()
                             .setCustomId("done")
                             .setLabel("Done")
@@ -110,16 +111,14 @@
             }
             const amount = parseInt((await component).customId);
 
-            let messages;
+            let messages: Discord.Message[] = [];
             await (interaction.channel as TextChannel).messages.fetch({ limit: amount }).then(async (ms) => {
                 if (user) {
                     ms = ms.filter((m) => m.author.id === user.id);
                 }
-                messages = await (channel as TextChannel).bulkDelete(ms, true);
+                messages = (await (channel as TextChannel).bulkDelete(ms, true)).map(m => m as Discord.Message);
             });
-            if (messages) {
-                deleted = deleted.concat(messages.map((m) => m));
-            }
+            deleted = deleted.concat(messages);
         }
         if (deleted.length === 0)
             return await interaction.editReply({
@@ -136,11 +135,12 @@
             await client.database.history.create(
                 "purge",
                 interaction.guild.id,
-                user,
-                interaction.options.getString("reason"),
+                user.user,
+                interaction.user,
+                (interaction.options.get("reason")?.value as (string | null)) ?? "*No reason provided*",
                 null,
                 null,
-                deleted.length
+                deleted.length.toString()
             );
         }
         const { log, NucleusColors, entry, renderUser, renderChannel } = client.logger;
@@ -156,8 +156,8 @@
             list: {
                 memberId: entry(interaction.user.id, `\`${interaction.user.id}\``),
                 purgedBy: entry(interaction.user.id, renderUser(interaction.user)),
-                channel: entry(interaction.channel.id, renderChannel(interaction.channel)),
-                messagesCleared: entry(deleted.length, deleted.length)
+                channel: entry(interaction.channel!.id, renderChannel(interaction.channel! as GuildChannel)),
+                messagesCleared: entry(deleted.length.toString(), deleted.length.toString())
             },
             hidden: {
                 guild: interaction.guild.id
@@ -189,7 +189,7 @@
                     .setStatus("Success")
             ],
             components: [
-                new Discord.ActionRowBuilder().addComponents([
+                new Discord.ActionRowBuilder<ButtonBuilder>().addComponents([
                     new Discord.ButtonBuilder()
                         .setCustomId("download")
                         .setLabel("Download transcript")
@@ -207,7 +207,7 @@
         } catch {
             return;
         }
-        if (component && component.customId === "download") {
+        if (component.customId === "download") {
             interaction.editReply({
                 embeds: [
                     new EmojiEmbed()
@@ -239,12 +239,8 @@
             .setDescription(
                 keyValueList({
                     channel: `<#${channel.id}>`,
-                    amount: interaction.options.getInteger("amount").toString(),
-                    reason: `\n> ${
-                        interaction.options.getString("reason")
-                            ? interaction.options.getString("reason")
-                            : "*No reason provided*"
-                    }`
+                    amount: (interaction.options.get("amount")?.value as number).toString(),
+                    reason: `\n> ${interaction.options.get("reason")?.value ? interaction.options.get("reason")?.value : "*No reason provided*"}`
                 })
             )
             .setColor("Danger")
@@ -255,7 +251,7 @@
             try {
                 if (!user) {
                     const toDelete = await (interaction.channel as TextChannel).messages.fetch({
-                        limit: interaction.options.getInteger("amount")
+                        limit: interaction.options.get("amount")?.value as number
                     });
                     messages = await (channel as TextChannel).bulkDelete(toDelete, true);
                 } else {
@@ -265,7 +261,7 @@
                                 limit: 100
                             })
                         ).filter((m) => m.author.id === user.id)
-                    ).first(interaction.options.getInteger("amount"));
+                    ).first(interaction.options.get("amount")?.value as number);
                     messages = await (channel as TextChannel).bulkDelete(toDelete, true);
                 }
             } catch (e) {
@@ -280,15 +276,29 @@
                     components: []
                 });
             }
+            if (!messages) {
+                await interaction.editReply({
+                    embeds: [
+                        new EmojiEmbed()
+                            .setEmoji("CHANNEL.PURGE.RED")
+                            .setTitle("Purge")
+                            .setDescription("No messages could be deleted")
+                            .setStatus("Danger")
+                    ],
+                    components: []
+                });
+                return;
+            }
             if (user) {
                 await client.database.history.create(
                     "purge",
                     interaction.guild.id,
-                    user,
-                    interaction.options.getString("reason"),
+                    user.user,
+                    interaction.user,
+                    (interaction.options.get("reason")?.value as (string | null)) ?? "*No reason provided*",
                     null,
                     null,
-                    messages.size
+                    messages.size.toString()
                 );
             }
             const { log, NucleusColors, entry, renderUser, renderChannel } = client.logger;
@@ -304,8 +314,8 @@
                 list: {
                     memberId: entry(interaction.user.id, `\`${interaction.user.id}\``),
                     purgedBy: entry(interaction.user.id, renderUser(interaction.user)),
-                    channel: entry(interaction.channel.id, renderChannel(interaction.channel)),
-                    messagesCleared: entry(messages.size, messages.size)
+                    channel: entry(interaction.channel!.id, renderChannel(interaction.channel! as GuildChannel)),
+                    messagesCleared: entry(messages.size.toString(), messages.size.toString())
                 },
                 hidden: {
                     guild: interaction.guild.id
@@ -314,14 +324,26 @@
             log(data);
             let out = "";
             messages.reverse().forEach((message) => {
-                out += `${message.author.username}#${message.author.discriminator} (${message.author.id}) [${new Date(
-                    message.createdTimestamp
-                ).toISOString()}]\n`;
-                const lines = message.content.split("\n");
-                lines.forEach((line) => {
-                    out += `> ${line}\n`;
-                });
-                out += "\n\n";
+                if (!message) {
+                    out += "Unknown message\n\n"
+                } else {
+                    const author = message.author ?? { username: "Unknown", discriminator: "0000", id: "Unknown" };
+                    out += `${author.username}#${author.discriminator} (${author.id}) [${new Date(
+                        message.createdTimestamp
+                    ).toISOString()}]\n`;
+                    if (message.content) {
+                        const lines = message.content.split("\n");
+                        lines.forEach((line) => {
+                            out += `> ${line}\n`;
+                        });
+                    }
+                    if (message.attachments.size > 0) {
+                        message.attachments.forEach((attachment) => {
+                            out += `Attachment > ${attachment.url}\n`;
+                        });
+                    }
+                    out += "\n\n";
+                }
             });
             const attachmentObject = {
                 attachment: Buffer.from(out),
@@ -337,7 +359,7 @@
                         .setStatus("Success")
                 ],
                 components: [
-                    new Discord.ActionRowBuilder().addComponents([
+                    new Discord.ActionRowBuilder<ButtonBuilder>().addComponents([
                         new Discord.ButtonBuilder()
                             .setCustomId("download")
                             .setLabel("Download transcript")
@@ -355,7 +377,7 @@
             } catch {
                 return;
             }
-            if (component && component.customId === "download") {
+            if (component.customId === "download") {
                 interaction.editReply({
                     embeds: [
                         new EmojiEmbed()
@@ -395,14 +417,15 @@
 };
 
 const check = (interaction: CommandInteraction) => {
+    if (!interaction.guild) return false;
     const member = interaction.member as GuildMember;
-    const me = interaction.guild.me!;
+    const me = interaction.guild.members.me!;
     // Check if nucleus has the manage_messages permission
-    if (!me.permissions.has("MANAGE_MESSAGES")) throw new Error("I do not have the *Manage Messages* permission");
+    if (!me.permissions.has("ManageMessages")) throw new Error("I do not have the *Manage Messages* permission");
     // Allow the owner to purge
     if (member.id === interaction.guild.ownerId) return true;
     // Check if the user has manage_messages permission
-    if (!member.permissions.has("MANAGE_MESSAGES")) throw new Error("You do not have the *Manage Messages* permission");
+    if (!member.permissions.has("ManageMessages")) throw new Error("You do not have the *Manage Messages* permission");
     // Allow purge
     return true;
 };
diff --git a/src/commands/mod/softban.ts b/src/commands/mod/softban.ts
index c9a71f6..12bfc3e 100644
--- a/src/commands/mod/softban.ts
+++ b/src/commands/mod/softban.ts
@@ -51,6 +51,7 @@
                 false,
                 null,
                 null,
+                null,
                 "ICONS.NOTIFY." + (notify ? "ON" : "OFF"),
                 notify
             )
diff --git a/src/commands/mod/unmute.ts b/src/commands/mod/unmute.ts
index 40510a8..c93f8cc 100644
--- a/src/commands/mod/unmute.ts
+++ b/src/commands/mod/unmute.ts
@@ -38,6 +38,7 @@
                 false,
                 null,
                 "The user will be sent a DM",
+                null,
                 "ICONS.NOTIFY." + (notify ? "ON" : "OFF"),
                 notify
             )
diff --git a/src/commands/mod/warn.ts b/src/commands/mod/warn.ts
index 1c5223f..390baa5 100644
--- a/src/commands/mod/warn.ts
+++ b/src/commands/mod/warn.ts
@@ -41,6 +41,7 @@
                 !(await areTicketsEnabled(interaction.guild.id)),
                 async () => await create(interaction.guild!, interaction.options.getUser("user")!, interaction.user, reason),
                 "An appeal ticket will be created",
+                null,
                 "CONTROL.TICKET",
                 createAppealTicket
             )
@@ -50,6 +51,7 @@
                 false,
                 null,
                 "The user will be sent a DM",
+                null,
                 "ICONS.NOTIFY." + (notify ? "ON" : "OFF"),
                 notify
             )
diff --git a/src/commands/tag.ts b/src/commands/tag.ts
index c54d7ab..859b7fc 100644
--- a/src/commands/tag.ts
+++ b/src/commands/tag.ts
@@ -2,6 +2,8 @@
 import { SlashCommandBuilder } from "@discordjs/builders";
 import client from "../utils/client.js";
 import EmojiEmbed from "../utils/generateEmojiEmbed.js";
+import { capitalize } from "../utils/generateKeyValueList.js";
+import { getResults } from "../utils/search.js";
 
 const command = new SlashCommandBuilder()
     .setName("tag")
@@ -9,41 +11,44 @@
     .addStringOption((o) => o.setName("tag").setDescription("The tag to get").setAutocomplete(true).setRequired(true));
 
 const callback = async (interaction: CommandInteraction): Promise<void> => {
-    const config = await client.database.guilds.read(interaction.guild.id);
-    const tags = config.getKey("tags");
-    const tag = tags[interaction.options.getString("tag")];
+    const config = await client.database.guilds.read(interaction.guild!.id);
+    const tags = config.tags;
+    const search = interaction.options.get("tag")?.value as string;
+    const tag = tags[search];
     if (!tag) {
-        return await interaction.reply({
+        await interaction.reply({
             embeds: [
                 new EmojiEmbed()
                     .setTitle("Tag")
-                    .setDescription(`Tag \`${interaction.options.get("tag")}\` does not exist`)
+                    .setDescription(`Tag \`${search}\` does not exist`)
                     .setEmoji("PUNISH.NICKNAME.RED")
                     .setStatus("Danger")
             ],
             ephemeral: true
         });
+        return;
     }
     let url = "";
-    let components: ActionRowBuilder[] = [];
+    let components: ActionRowBuilder<ButtonBuilder>[] = [];
     if (tag.match(/^(http|https):\/\/[^ "]+$/)) {
         url = tag;
         components = [
-            new ActionRowBuilder().addComponents([new ButtonBuilder().setLabel("Open").setURL(url).setStyle(ButtonStyle.Link)])
+            new ActionRowBuilder<ButtonBuilder>().addComponents([new ButtonBuilder().setLabel("Open").setURL(url).setStyle(ButtonStyle.Link)])
         ];
     }
-    return await interaction.reply({
-        embeds: [
-            new EmojiEmbed()
-                .setTitle(interaction.options.get("tag").value)
-                .setDescription(tag)
-                .setEmoji("PUNISH.NICKNAME.GREEN")
-                .setStatus("Success")
-                .setImage(url)
-        ],
+    const em = new EmojiEmbed()
+        .setTitle(capitalize(search))
+        .setEmoji("PUNISH.NICKNAME.GREEN")
+        .setStatus("Success")
+    if (url) em.setImage(url)
+    else em.setDescription(tag);
+
+    await interaction.reply({
+        embeds: [em],
         components: components,
         ephemeral: true
     });
+    return;
 };
 
 const check = () => {
@@ -52,9 +57,12 @@
 
 const autocomplete = async (interaction: AutocompleteInteraction): Promise<string[]> => {
     if (!interaction.guild) return [];
-    const config = await client.database.guilds.read(interaction.guild.id);
-    const tags = Object.keys(config.getKey("tags"));
-    return tags;
+    const prompt = interaction.options.getString("tag");
+    console.log(prompt)
+    const possible = Object.keys((await client.memory.readGuildInfo(interaction.guild.id)).tags);
+    const results = getResults(prompt ?? "", possible);
+    console.log(results)
+    return results;
 };
 
 export { command };
diff --git a/src/commands/tags/create.ts b/src/commands/tags/create.ts
index b922da3..5379bf8 100644
--- a/src/commands/tags/create.ts
+++ b/src/commands/tags/create.ts
@@ -16,8 +16,8 @@
         );
 
 const callback = async (interaction: CommandInteraction): Promise<unknown> => {
-    const name = interaction.options.getString("name");
-    const value = interaction.options.getString("value");
+    const name = interaction.options.get("name")?.value as string;
+    const value = interaction.options.get("value")?.value as string;
     if (name!.length > 100)
         return await interaction.reply({
             embeds: [
@@ -41,7 +41,7 @@
             ephemeral: true
         });
     const data = await client.database.guilds.read(interaction.guild!.id);
-    if (data.tags.length >= 100)
+    if (Object.keys(data.tags).length >= 100)
         return await interaction.reply({
             embeds: [
                 new EmojiEmbed()
@@ -90,6 +90,7 @@
         await client.database.guilds.write(interaction.guild!.id, {
             [`tags.${name}`]: value
         });
+        await client.memory.forceUpdate(interaction.guild!.id);
     } catch (e) {
         return await interaction.editReply({
             embeds: [
@@ -116,7 +117,7 @@
 
 const check = (interaction: CommandInteraction) => {
     const member = interaction.member as Discord.GuildMember;
-    if (!member.permissions.has("MANAGE_MESSAGES"))
+    if (!member.permissions.has("ManageMessages"))
         throw new Error("You must have the *Manage Messages* permission to use this command");
     return true;
 };
diff --git a/src/commands/tags/delete.ts b/src/commands/tags/delete.ts
index 2fff637..6d76eb1 100644
--- a/src/commands/tags/delete.ts
+++ b/src/commands/tags/delete.ts
@@ -13,7 +13,7 @@
         .addStringOption((o) => o.setName("name").setRequired(true).setDescription("The name of the tag"));
 
 const callback = async (interaction: CommandInteraction): Promise<unknown> => {
-    const name = interaction.options.getString("name");
+    const name = interaction.options.get("name")?.value as string;
     const data = await client.database.guilds.read(interaction.guild!.id);
     if (!data.tags[name])
         return await interaction.reply({
@@ -51,6 +51,7 @@
         });
     try {
         await client.database.guilds.write(interaction.guild!.id, null, ["tags." + name]);
+        await client.memory.forceUpdate(interaction.guild!.id);
     } catch (e) {
         console.log(e);
         return await interaction.editReply({
@@ -78,7 +79,7 @@
 
 const check = (interaction: CommandInteraction) => {
     const member = interaction.member as Discord.GuildMember;
-    if (!member.permissions.has("MANAGE_MESSAGES"))
+    if (!member.permissions.has("ManageMessages"))
         throw new Error("You must have the *Manage Messages* permission to use this command");
     return true;
 };
diff --git a/src/commands/tags/edit.ts b/src/commands/tags/edit.ts
index 376abbd..018a0bb 100644
--- a/src/commands/tags/edit.ts
+++ b/src/commands/tags/edit.ts
@@ -110,6 +110,7 @@
             toSet[`tags.${newname}`] = data.tags[name];
         }
         await client.database.guilds.write(interaction.guild.id, toSet === {} ? null : toSet, toUnset);
+        await client.memory.forceUpdate(interaction.guild!.id);
     } catch (e) {
         return await interaction.editReply({
             embeds: [
@@ -136,7 +137,7 @@
 
 const check = (interaction: CommandInteraction) => {
     const member = interaction.member as GuildMember;
-    if (!member.permissions.has("MANAGE_MESSAGES"))
+    if (!member.permissions.has("ManageMessages"))
         throw new Error("You must have the *Manage Messages* permission to use this command");
     return true;
 };
diff --git a/src/commands/user/about.ts b/src/commands/user/about.ts
index f94fb24..72ad1eb 100644
--- a/src/commands/user/about.ts
+++ b/src/commands/user/about.ts
@@ -1,4 +1,4 @@
-import { LoadingEmbed } from "./../../utils/defaultEmbeds.js";
+import { LoadingEmbed, Embed } from "./../../utils/defaultEmbeds.js";
 import Discord, {
     CommandInteraction,
     GuildMember,
@@ -25,30 +25,6 @@
             option.setName("user").setDescription("The user to get info about | Default: Yourself")
         );
 
-class Embed {
-    embed: EmojiEmbed = new EmojiEmbed();
-    title: string = "";
-    description = "";
-    pageId = 0;
-
-    setEmbed(embed: EmojiEmbed) {
-        this.embed = embed;
-        return this;
-    }
-    setTitle(title: string) {
-        this.title = title;
-        return this;
-    }
-    setDescription(description: string) {
-        this.description = description;
-        return this;
-    }
-    setPageId(pageId: number) {
-        this.pageId = pageId;
-        return this;
-    }
-}
-
 const callback = async (interaction: CommandInteraction): Promise<void> => {
     const guild = interaction.guild!;
     const member = (interaction.options.getMember("user") ?? interaction.member) as Discord.GuildMember;
@@ -101,11 +77,11 @@
         BugHunterLevel2: "Bug Hunter Level 2",
         Partner: "Partnered Server Owner",
         Staff: "Discord Staff",
-        VerifiedDeveloper: "Verified Bot Developer"
-        // ActiveDeveloper
+        VerifiedDeveloper: "Verified Bot Developer",
+        ActiveDeveloper: "Active Developer",
+        Quarantined: "Quarantined [What does this mean?](https://support.discord.com/hc/en-us/articles/6461420677527)",
+        Spammer: "Likely Spammer"
         // CertifiedModerator
-        // Quarantined https://discord-api-types.dev/api/discord-api-types-v10/enum/UserFlags#Quarantined
-        // Spammer https://discord-api-types.dev/api/discord-api-types-v10/enum/UserFlags#Spammer
         // VerifiedBot
     };
     const members = await guild.members.fetch();
@@ -121,8 +97,8 @@
     let s = "";
     let count = 0;
     let ended = false;
-    for (const roleId in roles) {
-        const string = `<@&${roleId}>, `;
+    for (const roleId of roles) {
+        const string = `<@&${roleId[1].id}>, `;
         if (s.length + string.length > 1000) {
             ended = true;
             s += `and ${roles.size - count} more`;
diff --git a/src/config/emojis.json b/src/config/emojis.json
index f29f383..168d84b 100644
--- a/src/config/emojis.json
+++ b/src/config/emojis.json
@@ -190,7 +190,10 @@
         "BugHunterLevel2": "775783766130950234",
         "Partner": "775783766178005033",
         "Staff": "775783766383788082",
-        "VerifiedDeveloper": "775783766425600060"
+        "VerifiedDeveloper": "775783766425600060",
+        "Quarantined": "1059794708638994474",
+        "Spammer": "1059794708638994474",
+        "ActiveDeveloper": "1059795592966053918"
     },
     "VOICE": {
         "CONNECT": "784785219391193138",
diff --git a/src/context/messages/purgeto.ts b/src/context/messages/purgeto.ts
new file mode 100644
index 0000000..e2ec6e4
--- /dev/null
+++ b/src/context/messages/purgeto.ts
@@ -0,0 +1,279 @@
+import confirmationMessage from '../../utils/confirmationMessage.js';
+import EmojiEmbed from '../../utils/generateEmojiEmbed.js';
+import { LoadingEmbed } from './../../utils/defaultEmbeds.js';
+import Discord, { ActionRowBuilder, ButtonBuilder, ButtonStyle, ContextMenuCommandBuilder, GuildTextBasedChannel, MessageContextMenuCommandInteraction } from "discord.js";
+import client from "../../utils/client.js";
+import getEmojiByName from '../../utils/getEmojiByName.js';
+
+const command = new ContextMenuCommandBuilder()
+    .setName("Purge up to here")
+
+
+async function waitForButton(m: Discord.Message, member: Discord.GuildMember): Promise<boolean> {
+    let component;
+    try {
+        component = m.awaitMessageComponent({ time: 200000, filter: (i) => i.user.id === member.id });
+    } catch (e) {
+        return false;
+    }
+    (await component).deferUpdate();
+    return true;
+}
+
+
+const callback = async (interaction: MessageContextMenuCommandInteraction) => {
+    await interaction.targetMessage.fetch();
+    const targetMessage = interaction.targetMessage;
+    const targetMember: Discord.User = targetMessage.author;
+    let allowedMessage: Discord.Message | undefined = undefined;
+    const channel = interaction.channel;
+    if (!channel) return;
+    await interaction.reply({ embeds: LoadingEmbed, ephemeral: true, fetchReply: true });
+    // Option for "include this message"?
+    // Option for "Only selected user"?
+
+    const history: Discord.Collection<string, Discord.Message> = await channel.messages.fetch({ limit: 100 });
+    if (Date.now() - targetMessage.createdTimestamp > 2 * 7 * 24 * 60 * 60 * 1000) {
+        const m = await interaction.editReply({ embeds: [new EmojiEmbed()
+            .setTitle("Purge")
+            .setDescription("The message you selected is older than 2 weeks. Discord only allows bots to delete messages that are 2 weeks old or younger.")
+            .setEmoji("CHANNEL.PURGE.RED")
+            .setStatus("Danger")
+        ], components: [
+            new ActionRowBuilder<ButtonBuilder>().addComponents(
+                new ButtonBuilder()
+                    .setCustomId("oldest")
+                    .setLabel("Select first allowed message")
+                    .setStyle(ButtonStyle.Primary),
+            )
+        ]});
+        if (!await waitForButton(m, interaction.member as Discord.GuildMember)) return;
+    } else if (!history.has(targetMessage.id)) {
+        const m = await interaction.editReply({ embeds: [new EmojiEmbed()
+            .setTitle("Purge")
+            .setDescription("The message you selected is not in the last 100 messages in this channel. Discord only allows bots to delete 100 messages at a time.")
+            .setEmoji("CHANNEL.PURGE.YELLOW")
+            .setStatus("Warning")
+        ], components: [
+            new ActionRowBuilder<ButtonBuilder>().addComponents(
+                new ButtonBuilder()
+                    .setCustomId("oldest")
+                    .setLabel("Select first allowed message")
+                    .setStyle(ButtonStyle.Primary),
+            )
+        ]});
+        if (!await waitForButton(m, interaction.member as Discord.GuildMember)) return;
+    } else {
+        allowedMessage = targetMessage;
+    }
+
+    if (!allowedMessage) {
+        // Find the oldest message thats younger than 2 weeks
+        const messages = history.filter(m => Date.now() - m.createdTimestamp < 2 * 7 * 24 * 60 * 60 * 1000);
+        allowedMessage = messages.sort((a, b) => a.createdTimestamp - b.createdTimestamp).first();
+    }
+
+    if (!allowedMessage) {
+        await interaction.editReply({ embeds: [new EmojiEmbed()
+            .setTitle("Purge")
+            .setDescription("There are no valid messages in the last 100 messages. (No messages younger than 2 weeks)")
+            .setEmoji("CHANNEL.PURGE.RED")
+            .setStatus("Danger")
+        ], components: [] });
+        return;
+    }
+
+    let reason: string | null = null
+    let confirmation;
+    let chosen = false;
+    let timedOut = false;
+    let deleteSelected = true;
+    let deleteUser = false;
+    do {
+        confirmation = await new confirmationMessage(interaction)
+            .setEmoji("CHANNEL.PURGE.RED")
+            .setTitle("Purge")
+            .setDescription(
+                `[[Selected Message]](${allowedMessage.url})\n\n` +
+                (reason ? "\n> " + reason.replaceAll("\n", "\n> ") : "*No reason provided*") + "\n\n" +
+                `Are you sure you want to delete all messages from below the selected message?`
+            )
+            .addCustomBoolean(
+                "includeSelected",
+                "Include selected message",
+                false,
+                undefined,
+                "The selected message will be deleted as well.",
+                "The selected message will not be deleted.",
+                "CONTROL." + (deleteSelected ? "TICK" : "CROSS"),
+                deleteSelected
+            )
+            .addCustomBoolean(
+                "onlySelectedUser",
+                "Only selected user",
+                false,
+                undefined,
+                `Only messages from <@${targetMember.id}> will be deleted.`,
+                `All messages will be deleted.`,
+                "CONTROL." + (deleteUser ? "TICK" : "CROSS"),
+                deleteUser
+            )
+            .setColor("Danger")
+            .addReasonButton(reason ?? "")
+            .send(true)
+        reason = reason ?? ""
+        if (confirmation.cancelled) timedOut = true;
+        else if (confirmation.success !== undefined) chosen = true;
+        else if (confirmation.newReason) reason = confirmation.newReason;
+        else if (confirmation.components) {
+            deleteSelected = confirmation.components["includeSelected"]!.active;
+            deleteUser = confirmation.components["onlySelectedUser"]!.active;
+        }
+    } while (!chosen && !timedOut);
+    if (timedOut) return;
+    if (!confirmation.success) {
+        await interaction.editReply({ embeds: [new EmojiEmbed()
+            .setTitle("Purge")
+            .setDescription("No changes were made")
+            .setEmoji("CHANNEL.PURGE.GREEN")
+            .setStatus("Success")
+        ], components: [] });
+        return;
+    }
+    const filteredMessages = history
+        .filter(m => m.createdTimestamp >= allowedMessage!.createdTimestamp)  // older than selected
+        .filter(m => deleteUser ? m.author.id === targetMember.id : true)  // only selected user
+        .filter(m => deleteSelected ? true : m.id !== allowedMessage!.id)  // include selected
+
+    const deleted = await (channel as GuildTextBasedChannel).bulkDelete(filteredMessages, true);
+    if (deleted.size === 0) {
+        return await interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setEmoji("CHANNEL.PURGE.RED")
+                    .setTitle("Purge")
+                    .setDescription("No messages were deleted")
+                    .setStatus("Danger")
+            ],
+            components: []
+        });
+    }
+    if (deleteUser) {
+        await client.database.history.create(
+            "purge",
+            interaction.guild!.id,
+            targetMember,
+            interaction.user,
+            reason === "" ? "*No reason provided*" : reason,
+            null,
+            null,
+            deleted.size.toString()
+        );
+    }
+    const { log, NucleusColors, entry, renderUser, renderChannel } = client.logger;
+    const data = {
+        meta: {
+            type: "channelPurge",
+            displayName: "Channel Purged",
+            calculateType: "messageDelete",
+            color: NucleusColors.red,
+            emoji: "PUNISH.BAN.RED",
+            timestamp: new Date().getTime()
+        },
+        list: {
+            memberId: entry(interaction.user.id, `\`${interaction.user.id}\``),
+            purgedBy: entry(interaction.user.id, renderUser(interaction.user)),
+            channel: entry(interaction.channel!.id, renderChannel(interaction.channel! as Discord.GuildChannel)),
+            messagesCleared: entry(deleted.size.toString(), deleted.size.toString())
+        },
+        hidden: {
+            guild: interaction.guild!.id
+        }
+    };
+    log(data);
+    let out = "";
+    deleted.reverse().forEach((message) => {
+        if (!message) {
+            out += "Unknown message\n\n"
+        } else {
+            const author = message.author ?? { username: "Unknown", discriminator: "0000", id: "Unknown" };
+            out += `${author.username}#${author.discriminator} (${author.id}) [${new Date(
+                message.createdTimestamp
+            ).toISOString()}]\n`;
+            if (message.content) {
+                const lines = message.content.split("\n");
+                lines.forEach((line) => {
+                    out += `> ${line}\n`;
+                });
+            }
+            if (message.attachments.size > 0) {
+                message.attachments.forEach((attachment) => {
+                    out += `Attachment > ${attachment.url}\n`;
+                });
+            }
+            out += "\n\n";
+        }
+    });
+    const attachmentObject = {
+        attachment: Buffer.from(out),
+        name: `purge-${channel.id}-${Date.now()}.txt`,
+        description: "Purge log"
+    };
+    const m = (await interaction.editReply({
+        embeds: [
+            new EmojiEmbed()
+                .setEmoji("CHANNEL.PURGE.GREEN")
+                .setTitle("Purge")
+                .setDescription("Messages cleared")
+                .setStatus("Success")
+        ],
+        components: [
+            new Discord.ActionRowBuilder<ButtonBuilder>().addComponents([
+                new Discord.ButtonBuilder()
+                    .setCustomId("download")
+                    .setLabel("Download transcript")
+                    .setStyle(ButtonStyle.Success)
+                    .setEmoji(getEmojiByName("CONTROL.DOWNLOAD", "id"))
+            ])
+        ]
+    })) as Discord.Message;
+    let component;
+    try {
+        component = await m.awaitMessageComponent({
+            filter: (m) => m.user.id === interaction.user.id,
+            time: 300000
+        });
+    } catch {
+        return;
+    }
+    if (component.customId === "download") {
+        interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setEmoji("CHANNEL.PURGE.GREEN")
+                    .setTitle("Purge")
+                    .setDescription("Transcript uploaded above")
+                    .setStatus("Success")
+            ],
+            components: [],
+            files: [attachmentObject]
+        });
+    } else {
+        interaction.editReply({
+            embeds: [
+                new EmojiEmbed()
+                    .setEmoji("CHANNEL.PURGE.GREEN")
+                    .setTitle("Purge")
+                    .setDescription("Messages cleared")
+                    .setStatus("Success")
+            ],
+            components: []
+        });
+    }
+}
+
+const check = async (_interaction: MessageContextMenuCommandInteraction) => {
+    return true;
+}
+
+export { command, callback, check }
diff --git a/src/context/users/userinfo.ts b/src/context/users/userinfo.ts
new file mode 100644
index 0000000..3b1a6bd
--- /dev/null
+++ b/src/context/users/userinfo.ts
@@ -0,0 +1,18 @@
+import { ContextMenuCommandBuilder, GuildMember, UserContextMenuCommandInteraction } from "discord.js";
+import { userAbout } from "../../commands/user/about.js";
+
+const command = new ContextMenuCommandBuilder()
+    .setName("User info")
+
+const callback = async (interaction: UserContextMenuCommandInteraction) => {
+    const guild = interaction.guild!
+    let member = interaction.targetMember
+    if (!member) member = await guild.members.fetch(interaction.targetId)
+    await userAbout(guild, member as GuildMember, interaction)
+}
+
+const check = async (_interaction: UserContextMenuCommandInteraction) => {
+    return true;
+}
+
+export { command, callback, check }
diff --git a/src/events/interactionCreate.ts b/src/events/interactionCreate.ts
index ddc143b..1796146 100644
--- a/src/events/interactionCreate.ts
+++ b/src/events/interactionCreate.ts
@@ -3,71 +3,15 @@
 import create from "../actions/tickets/create.js";
 import close from "../actions/tickets/delete.js";
 import createTranscript from "../premium/createTranscript.js";
-import Fuse from "fuse.js";
-import { autocomplete as tagAutocomplete } from "../commands/tag.js";
-import type { AutocompleteInteraction, Interaction, MessageComponentInteraction } from "discord.js";
+
+import type { Interaction, MessageComponentInteraction } from "discord.js";
 import type { NucleusClient } from "../utils/client.js";
 
 export const event = "interactionCreate";
 
-function getAutocomplete(typed: string, options: string[]): { name: string; value: string }[] {
-    options = options.filter((option) => option.length <= 100); // thanks discord. 6000 character limit on slash command inputs but only 100 for autocomplete.
-    if (!typed)
-        return options
-            .slice(0, 25)
-            .sort()
-            .map((option) => ({ name: option, value: option }));
-    const fuse = new Fuse(options, {
-        useExtendedSearch: true,
-        findAllMatches: true,
-        minMatchCharLength: 0
-    }).search(typed);
-    return fuse.slice(0, 25).map((option) => ({ name: option.item, value: option.item }));
-}
-
-function generateStatsChannelAutocomplete(typed: string) {
-    const validReplacements = ["serverName", "memberCount", "memberCount:bots", "memberCount:humans"];
-    const autocompletions = [];
-    const beforeLastOpenBracket = typed.match(/(.*){[^{}]{0,15}$/);
-    if (beforeLastOpenBracket !== null) {
-        for (const replacement of validReplacements) {
-            autocompletions.push(`${beforeLastOpenBracket[1]} {${replacement}}`);
-        }
-    } else {
-        for (const replacement of validReplacements) {
-            autocompletions.push(`${typed} {${replacement}}`);
-        }
-    }
-    return getAutocomplete(typed, autocompletions);
-}
-function generateWelcomeMessageAutocomplete(typed: string) {
-    const validReplacements = [
-        "serverName",
-        "memberCount",
-        "memberCount:bots",
-        "memberCount:humans",
-        "member:mention",
-        "member:name"
-    ];
-    const autocompletions = [];
-    const beforeLastOpenBracket = typed.match(/(.*){[^{}]{0,15}$/);
-    if (beforeLastOpenBracket !== null) {
-        for (const replacement of validReplacements) {
-            autocompletions.push(`${beforeLastOpenBracket[1]} {${replacement}}`);
-        }
-    } else {
-        for (const replacement of validReplacements) {
-            autocompletions.push(`${typed} {${replacement}}`);
-        }
-    }
-    return getAutocomplete(typed, autocompletions);
-}
 
 async function interactionCreate(interaction: Interaction) {
-    if (
-        interaction.type === "MESSAGE_COMPONENT" &&
-        (interaction as MessageComponentInteraction).componentType === "BUTTON"
-    ) {
+    if (interaction.isButton()) {
         const int = interaction as MessageComponentInteraction;
         switch (int.customId) {
             case "rolemenu": {
@@ -86,19 +30,19 @@
                 return createTranscript(int);
             }
         }
-    } else if (interaction.type === "APPLICATION_COMMAND_AUTOCOMPLETE") {
-        const int = interaction as AutocompleteInteraction;
-        switch (`${int.commandName} ${int.options.getSubcommandGroup(false)} ${int.options.getSubcommand(false)}`) {
-            case "tag null null": {
-                return int.respond(getAutocomplete(int.options.getString("tag") ?? "", await tagAutocomplete(int)));
-            }
-            case "settings null stats": {
-                return int.respond(generateStatsChannelAutocomplete(int.options.getString("name") ?? ""));
-            }
-            case "settings null welcome": {
-                return int.respond(generateWelcomeMessageAutocomplete(int.options.getString("message") ?? ""));
-            }
-        }
+    // } else if (interaction.type === "APPLICATION_COMMAND_AUTOCOMPLETE") {
+    //     const int = interaction as AutocompleteInteraction;
+    //     switch (`${int.commandName} ${int.options.getSubcommandGroup(false)} ${int.options.getSubcommand(false)}`) {
+    //         case "tag null null": {
+    //             return int.respond(getAutocomplete(int.options.getString("tag") ?? "", await tagAutocomplete(int)));
+    //         }
+    //         case "settings null stats": {
+    //             return int.respond(generateStatsChannelAutocomplete(int.options.getString("name") ?? ""));
+    //         }
+    //         case "settings null welcome": {
+    //             return int.respond(generateWelcomeMessageAutocomplete(int.options.getString("message") ?? ""));
+    //         }
+    //     }
     }
 }
 
diff --git a/src/reflex/statsChannelUpdate.ts b/src/reflex/statsChannelUpdate.ts
index d807267..2e12429 100644
--- a/src/reflex/statsChannelUpdate.ts
+++ b/src/reflex/statsChannelUpdate.ts
@@ -12,10 +12,9 @@
 export async function callback(client: NucleusClient, member?: GuildMember, guild?: Guild, user?: User) {
     if (!member && !guild) return;
     guild = await client.guilds.fetch(member ? member.guild.id : guild!.id);
-    if (!guild) return;
     user = user ?? member!.user;
     const config = await client.database.guilds.read(guild.id);
-    Object.entries(config.getKey("stats")).forEach(async ([channel, props]) => {
+    Object.entries(config.stats).forEach(async ([channel, props]) => {
         if ((props as PropSchema).enabled) {
             let string = (props as PropSchema).name;
             if (!string) return;
@@ -27,13 +26,13 @@
                 fetchedChannel = null;
             }
             if (!fetchedChannel) {
-                const deleted = config.getKey("stats")[channel];
+                const deleted = config.stats[channel];
                 await client.database.guilds.write(guild!.id, null, `stats.${channel}`);
                 return singleNotify(
                     "statsChannelDeleted",
                     guild!.id,
                     "One or more of your stats channels have been deleted. Please use `/settings stats` if you wish to add the channel again.\n" +
-                        `The channels name was: ${deleted.name}`,
+                        `The channels name was: ${deleted!.name}`,
                     "Critical"
                 );
             }
diff --git a/src/utils/client.ts b/src/utils/client.ts
index 53267f2..a57c639 100644
--- a/src/utils/client.ts
+++ b/src/utils/client.ts
@@ -1,11 +1,10 @@
-import Discord, { Client, Interaction } from 'discord.js';
+import Discord, { Client, Interaction, AutocompleteInteraction } from 'discord.js';
 import { Logger } from "../utils/log.js";
 import Memory from "../utils/memory.js";
 import type { VerifySchema } from "../reflex/verify.js";
 import { Guilds, History, ModNotes, Premium } from "../utils/database.js";
 import EventScheduler from "../utils/eventScheduler.js";
 import type { RoleMenuSchema } from "../actions/roleMenu.js";
-// @ts-expect-error
 import config from "../config/main.json" assert { type: "json" };
 
 
@@ -28,9 +27,9 @@
                 ((builder: Discord.SlashCommandBuilder) => Discord.SlashCommandBuilder) |
                 Discord.SlashCommandSubcommandBuilder | ((builder: Discord.SlashCommandSubcommandBuilder) => Discord.SlashCommandSubcommandBuilder) | Discord.SlashCommandSubcommandGroupBuilder | ((builder: Discord.SlashCommandSubcommandGroupBuilder) => Discord.SlashCommandSubcommandGroupBuilder),
         callback: (interaction: Interaction) => Promise<void>,
-        check: (interaction: Interaction) => Promise<boolean> | boolean
+        check: (interaction: Interaction) => Promise<boolean> | boolean,
+        autocomplete: (interaction: AutocompleteInteraction) => Promise<string[]>
     }> = {};
-    // commands: Discord.Collection<string, [Function, Function]> = new Discord.Collection();
 
     constructor(database: typeof NucleusClient.prototype.database) {
         super({ intents: 32767 });
diff --git a/src/utils/commandRegistration/register.ts b/src/utils/commandRegistration/register.ts
index 0193f6c..a4c57c4 100644
--- a/src/utils/commandRegistration/register.ts
+++ b/src/utils/commandRegistration/register.ts
@@ -1,5 +1,4 @@
 import Discord, { Interaction, SlashCommandBuilder, ApplicationCommandType } from 'discord.js';
-// @ts-expect-error
 import config from "../../config/main.json" assert { type: "json" };
 import client from "../client.js";
 import fs from "fs";
@@ -140,19 +139,31 @@
             const commandName = "contextCommands/message/" + interaction.commandName;
             execute(client.commands[commandName]?.check, client.commands[commandName]?.callback, interaction)
             return;
+        } else if (interaction.isAutocomplete()) {
+            const commandName = interaction.commandName;
+            const subcommandGroupName = interaction.options.getSubcommandGroup(false);
+            const subcommandName = interaction.options.getSubcommand(false);
+
+            const fullCommandName = "commands/" + commandName + (subcommandGroupName ? `/${subcommandGroupName}` : "") + (subcommandName ? `/${subcommandName}` : "");
+
+            const choices = await client.commands[fullCommandName]?.autocomplete(interaction);
+
+            const formatted = (choices ?? []).map(choice => {
+                return { name: choice, value: choice }
+            })
+            interaction.respond(formatted)
+        } else if (interaction.isChatInputCommand()) {
+            const commandName = interaction.commandName;
+            const subcommandGroupName = interaction.options.getSubcommandGroup(false);
+            const subcommandName = interaction.options.getSubcommand(false);
+
+            const fullCommandName = "commands/" + commandName + (subcommandGroupName ? `/${subcommandGroupName}` : "") + (subcommandName ? `/${subcommandName}` : "");
+
+            const command = client.commands[fullCommandName];
+            const callback = command?.callback;
+            const check = command?.check;
+            execute(check, callback, interaction);
         }
-        if (!interaction.isChatInputCommand()) return;
-
-        const commandName = interaction.commandName;
-        const subcommandGroupName = interaction.options.getSubcommandGroup(false);
-        const subcommandName = interaction.options.getSubcommand(false);
-
-        const fullCommandName = "commands/" + commandName + (subcommandGroupName ? `/${subcommandGroupName}` : "") + (subcommandName ? `/${subcommandName}` : "");
-
-        const command = client.commands[fullCommandName];
-        const callback = command?.callback;
-        const check = command?.check;
-        execute(check, callback, interaction);
     });
 }
 
diff --git a/src/utils/commandRegistration/slashCommandBuilder.ts b/src/utils/commandRegistration/slashCommandBuilder.ts
index 45cb8f1..76ecabe 100644
--- a/src/utils/commandRegistration/slashCommandBuilder.ts
+++ b/src/utils/commandRegistration/slashCommandBuilder.ts
@@ -1,6 +1,5 @@
 import type { SlashCommandSubcommandGroupBuilder } from "@discordjs/builders";
 import type { SlashCommandBuilder } from "discord.js";
-// @ts-expect-error
 import config from "../../config/main.json" assert { type: "json" };
 import getSubcommandsInFolder from "./getFilesInFolder.js";
 import client from "../client.js";
diff --git a/src/utils/confirmationMessage.ts b/src/utils/confirmationMessage.ts
index 87724f3..6682be0 100644
--- a/src/utils/confirmationMessage.ts
+++ b/src/utils/confirmationMessage.ts
@@ -18,6 +18,7 @@
     title: string;
     disabled: boolean;
     value: string | null;
+    notValue: string | null;
     emoji: string | undefined;
     active: boolean;
     onClick: () => Promise<T>;
@@ -68,6 +69,7 @@
         disabled: boolean,
         callback: (() => Promise<unknown>) | null = async () => null,
         callbackClicked: string | null,
+        callbackNotClicked: string | null,
         emoji?: string,
         initial?: boolean
     ) {
@@ -75,6 +77,7 @@
             title: title,
             disabled: disabled,
             value: callbackClicked,
+            notValue: callbackNotClicked,
             emoji: emoji,
             active: initial ?? false,
             onClick: callback ?? (async () => null),
@@ -145,10 +148,12 @@
                                 "\n\n" +
                                 Object.values(this.customButtons)
                                     .map((v) => {
-                                        if (v.value === null) return "";
-                                        return v.active ? `*${v.value}*\n` : "";
-                                    })
-                                    .join("")
+                                        if (v.active) {
+                                            return v.value ? `*${v.value}*\n` : "";
+                                        } else {
+                                            return v.notValue ? `*${v.notValue}*\n` : "";
+                                        }
+                                    }).join("")
                         )
                         .setStatus(this.color)
                 ],
@@ -163,7 +168,8 @@
                 } else {
                     m = (await this.interaction.reply(object)) as unknown as Message;
                 }
-            } catch {
+            } catch (e) {
+                console.log(e);
                 cancelled = true;
                 continue;
             }
diff --git a/src/utils/database.ts b/src/utils/database.ts
index 2624fc9..b14c5c4 100644
--- a/src/utils/database.ts
+++ b/src/utils/database.ts
@@ -1,6 +1,5 @@
 import type Discord from "discord.js";
 import { Collection, MongoClient } from "mongodb";
-// @ts-expect-error
 import config from "../config/main.json" assert { type: "json" };
 
 const mongoClient = new MongoClient(config.mongoUrl);
@@ -17,7 +16,6 @@
     }
 
     async setup(): Promise<Guilds> {
-        // @ts-expect-error
         this.defaultData = (await import("../config/default.json", { assert: { type: "json" } }))
             .default as unknown as GuildConfig;
         return this;
diff --git a/src/utils/defaultEmbeds.ts b/src/utils/defaultEmbeds.ts
index 39a6080..a027c76 100644
--- a/src/utils/defaultEmbeds.ts
+++ b/src/utils/defaultEmbeds.ts
@@ -8,4 +8,30 @@
 export const LinkWarningFooter = {
     text: "The button below will take you to a website set by the server moderators. Do not enter any passwords unless it is from a trusted website.",
     iconURL: "https://cdn.discordapp.com/emojis/952295894370369587.webp?size=128&quality=lossless"
-}
\ No newline at end of file
+}
+
+class Embed {
+    embed: EmojiEmbed = new EmojiEmbed();
+    title: string = "";
+    description = "";
+    pageId = 0;
+
+    setEmbed(embed: EmojiEmbed) {
+        this.embed = embed;
+        return this;
+    }
+    setTitle(title: string) {
+        this.title = title;
+        return this;
+    }
+    setDescription(description: string) {
+        this.description = description;
+        return this;
+    }
+    setPageId(pageId: number) {
+        this.pageId = pageId;
+        return this;
+    }
+}
+
+export { Embed };
diff --git a/src/utils/eventScheduler.ts b/src/utils/eventScheduler.ts
index 0a32a1e..3c9d6ca 100644
--- a/src/utils/eventScheduler.ts
+++ b/src/utils/eventScheduler.ts
@@ -2,7 +2,6 @@
 import client from "./client.js";
 import * as fs from "fs";
 import * as path from "path";
-// @ts-expect-error
 import config from "../config/main.json" assert { type: "json" };
 
 class EventScheduler {
diff --git a/src/utils/getEmojiByName.ts b/src/utils/getEmojiByName.ts
index 7824982..3fa2b53 100644
--- a/src/utils/getEmojiByName.ts
+++ b/src/utils/getEmojiByName.ts
@@ -1,4 +1,3 @@
-// @ts-expect-error
 import emojis from "../config/emojis.json" assert { type: "json" };
 
 interface EmojisIndex {
diff --git a/src/utils/memory.ts b/src/utils/memory.ts
index a397d09..870ffaf 100644
--- a/src/utils/memory.ts
+++ b/src/utils/memory.ts
@@ -6,6 +6,7 @@
     filters: GuildConfig["filters"];
     logging: GuildConfig["logging"];
     tickets: GuildConfig["tickets"];
+    tags: GuildConfig["tags"];
 }
 
 class Memory {
@@ -20,7 +21,7 @@
                 }
             }
         }, 1000 * 60 * 30);
-    }
+    };
 
     async readGuildInfo(guild: string): Promise<GuildData> {
         if (!this.memory.has(guild)) {
@@ -29,10 +30,15 @@
                 lastUpdated: Date.now(),
                 filters: guildData.filters,
                 logging: guildData.logging,
-                tickets: guildData.tickets
+                tickets: guildData.tickets,
+                tags: guildData.tags
             });
         }
         return this.memory.get(guild)!;
+    };
+
+    async forceUpdate(guild: string) {
+        if (this.memory.has(guild)) this.memory.delete(guild);
     }
 }
 
diff --git a/src/utils/search.ts b/src/utils/search.ts
new file mode 100644
index 0000000..310dbf8
--- /dev/null
+++ b/src/utils/search.ts
@@ -0,0 +1,18 @@
+import Fuse from "fuse.js";
+
+function getResults(typed: string, options: string[]): string[] {
+    options = options.filter((option) => option.length <= 100); // thanks discord. 6000 character limit on slash command inputs but only 100 for autocomplete.
+    if (!typed)
+        return options
+            .slice(0, 25)
+            .sort()
+    // @ts-expect-error
+    const fuse = new Fuse(options, {
+        useExtendedSearch: true,
+        findAllMatches: true,
+        minMatchCharLength: typed.length > 3 ? 3 : typed.length,
+    }).search(typed);
+    return fuse.slice(0, 25).map((option: {item: string }) => option.item );
+}
+
+export { getResults }
\ No newline at end of file
