diff --git a/src/handler/sern.ts b/src/handler/sern.ts index 94efce2..a1cb934 100644 --- a/src/handler/sern.ts +++ b/src/handler/sern.ts @@ -1,7 +1,7 @@ -import type { Arg, Context, ParseType, Visibility } from "../types/handler/handler"; +import type { Arg, Context, ParseType, Visibility } from "../types/handler"; import * as Files from "./utils/readFile" import type { ApplicationCommandOptionData, Awaitable, Client, CommandInteraction, Message } from "discord.js"; -import type { possibleOutput } from "../types/handler/handler" +import type { possibleOutput } from "../types/handler" import { Ok, Result, None, Some } from "ts-results"; import type * as Utils from "./utils/preprocessors/args"; import { CtxHandler } from "./utils/ctxHandler"; @@ -56,8 +56,8 @@ export class Handler { interaction: CommandInteraction): Promise { if (module === undefined) return "Unknown slash command!"; - const name = Array.from(Files.Commands.keys()).find(it => it === interaction.commandName)!; - + const name = Array.from(Files.Commands.keys()).find(it => it === interaction.commandName); + if(name === undefined) return `Could not find ${interaction.commandName} command!`; (await this.client.guilds.fetch(this.privateServerId)) .commands .create({ diff --git a/src/handler/utils/preprocessors/args.ts b/src/handler/utils/preprocessors/args.ts index 83da5e2..837781a 100644 --- a/src/handler/utils/preprocessors/args.ts +++ b/src/handler/utils/preprocessors/args.ts @@ -1,5 +1,5 @@ import { Err, Ok, Result } from "ts-results"; -import type { possibleOutput } from "../../../types/handler/handler"; +import type { possibleOutput } from "../../../types/handler"; diff --git a/src/index.ts b/src/index.ts index 5209a81..a6f302e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,5 @@ import * as Sern from "./handler/sern"; import * as Utils from "./handler/utils/preprocessors/args" -import * as Types from "./types/handler/handler" +import * as Types from "./types/handler" module.exports = { Sern, Utils, Types }; export { Sern, Utils, Types }; diff --git a/src/types/handler/handler.d.ts b/src/types/handler.d.ts similarity index 95% rename from src/types/handler/handler.d.ts rename to src/types/handler.d.ts index 51e6612..5a10a58 100644 --- a/src/types/handler/handler.d.ts +++ b/src/types/handler.d.ts @@ -1,6 +1,6 @@ import type { Option } from 'ts-results' import type { CommandInteraction, CommandInteractionOptionResolver, Message, MessagePayload, MessageOptions } from 'discord.js'; -import type { Sern } from '../../handler/sern'; +import type { Sern } from '../handler/sern'; export type Visibility = "private" | "public" //Anything that can be sent in a `#send` or `#reply`