diff --git a/src/events/interactionCreate.ts b/src/events/interactionCreate.ts
index 5b0aff1..9ee7bee 100644
--- a/src/events/interactionCreate.ts
+++ b/src/events/interactionCreate.ts
@@ -5,10 +5,13 @@
 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";
+// @ts-expect-error
+import type { HaikuClient } from "jshaiku";
 
 export const event = "interactionCreate";
 
-function getAutocomplete(typed: string, options: string[]): object[] {
+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
@@ -23,7 +26,7 @@
     return fuse.slice(0, 25).map((option) => ({ name: option.item, value: option.item }));
 }
 
-function generateStatsChannelAutocomplete(typed) {
+function generateStatsChannelAutocomplete(typed: string) {
     const validReplacements = ["serverName", "memberCount", "memberCount:bots", "memberCount:humans"];
     const autocompletions = [];
     const beforeLastOpenBracket = typed.match(/(.*){[^{}]{0,15}$/);
@@ -38,7 +41,7 @@
     }
     return getAutocomplete(typed, autocompletions);
 }
-function generateWelcomeMessageAutocomplete(typed) {
+function generateWelcomeMessageAutocomplete(typed: string) {
     const validReplacements = [
         "serverName",
         "memberCount",
@@ -61,14 +64,15 @@
     return getAutocomplete(typed, autocompletions);
 }
 
-async function interactionCreate(interaction) {
-    if (interaction.componentType === "BUTTON") {
-        switch (interaction.customId) {
+async function interactionCreate(interaction: Interaction) {
+    if (interaction.type === "MESSAGE_COMPONENT" && (interaction as MessageComponentInteraction).componentType === "BUTTON") {
+        const int = (interaction as MessageComponentInteraction)
+        switch (int.customId) {
             case "rolemenu": {
                 return await roleMenu(interaction);
             }
             case "verifybutton": {
-                return verify(interaction);
+                return verify(int);
             }
             case "createticket": {
                 return create(interaction);
@@ -77,32 +81,33 @@
                 return close(interaction);
             }
             case "createtranscript": {
-                return createTranscript(interaction);
+                return createTranscript(int);
             }
         }
     } else if (interaction.type === "APPLICATION_COMMAND_AUTOCOMPLETE") {
+        const int = (interaction as AutocompleteInteraction)
         switch (
-            `${interaction.commandName} ${interaction.options.getSubcommandGroup(
+            `${int.commandName} ${int.options.getSubcommandGroup(
                 false
-            )} ${interaction.options.getSubcommand(false)}`
+            )} ${int.options.getSubcommand(false)}`
         ) {
             case "tag null null": {
-                return interaction.respond(
-                    getAutocomplete(interaction.options.getString("tag"), await tagAutocomplete(interaction))
+                return int.respond(
+                    getAutocomplete(int.options.getString("tag") ?? "", await tagAutocomplete(int))
                 );
             }
             case "settings null stats": {
-                return interaction.respond(generateStatsChannelAutocomplete(interaction.options.getString("name")));
+                return int.respond(generateStatsChannelAutocomplete(int.options.getString("name") ?? ""));
             }
             case "settings null welcome": {
-                return interaction.respond(
-                    generateWelcomeMessageAutocomplete(interaction.options.getString("message"))
+                return int.respond(
+                    generateWelcomeMessageAutocomplete(int.options.getString("message") ?? "")
                 );
             }
         }
     }
 }
 
-export async function callback(client, interaction) {
+export async function callback(_client: HaikuClient, interaction: Interaction) {
     await interactionCreate(interaction);
 }
