diff --git a/src/events/interactionCreate.ts b/src/events/interactionCreate.ts
index 1fd1e1f..900c774 100644
--- a/src/events/interactionCreate.ts
+++ b/src/events/interactionCreate.ts
@@ -3,18 +3,43 @@
 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"
 
 export const event = 'interactionCreate';
 
+
+function getAutocomplete(typed: string, options: string[]): object[] {
+    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}))
+}
+
+const validReplacements = ["serverName", "memberCount", "memberCount:bots", "memberCount:humans"]
+function generateStatsChannelAutocomplete(typed) {
+    let autocompletions = []
+    const beforeLastOpenBracket = typed.match(/(.*){[^{}]{0,15}$/)
+    if (beforeLastOpenBracket !== null) { for (let replacement of validReplacements) { autocompletions.push(`${beforeLastOpenBracket[1]} {${replacement}}`) } }
+    else { for (let replacement of validReplacements) { autocompletions.push(`${typed} {${replacement}}`) } }
+    return getAutocomplete(typed, autocompletions)
+}
+
 async function interactionCreate(interaction) {
     if (interaction.componentType === "BUTTON") {
-        if (interaction.customId === "rolemenu") return await roleMenu(interaction)
-        if (interaction.customId === "verifybutton") return verify(interaction)
-        if (interaction.customId === "createticket") return create(interaction)
-        if (interaction.customId === "closeticket") return close(interaction)
-        if (interaction.customId === "createtranscript") return createTranscript(interaction)
+        switch (interaction.customId) {
+            case "rolemenu": { return await roleMenu(interaction) }
+            case "verifybutton": { return verify(interaction) }
+            case "createticket": { return create(interaction) }
+            case "closeticket": { return close(interaction) }
+            case "createtranscript": { return createTranscript(interaction) }
+        }
     } else if (interaction.componentType === "MESSAGE_COMPONENT") {
-        console.table(interaction)
+    } else if (interaction.type === "APPLICATION_COMMAND_AUTOCOMPLETE") {
+        switch (`${interaction.commandName} ${interaction.options.getSubcommandGroup(false)} ${interaction.options.getSubcommand(false)}`) {
+            case `tag null null`: { return interaction.respond(getAutocomplete(interaction.options.getString("tag"), (await tagAutocomplete(interaction)))) }
+            case `settings stats set`: { return interaction.respond(generateStatsChannelAutocomplete(interaction.options.getString("name"))) }
+        }
     }
 }
 
