diff --git a/src/structures/Command.ts b/src/structures/Command.ts index 5aff06b..52b87e2 100644 --- a/src/structures/Command.ts +++ b/src/structures/Command.ts @@ -1,4 +1,4 @@ -import type { CommandContext, CommandOptions, PartialCommandContext } from '@/types' +import type { CommandContext, CommandOptions, PartialCommandContext, CommandOutput } from '@/types' import type { Blop } from '@/structures' import type { APIApplicationCommandOption, APIEmbed } from 'discord.js' @@ -67,7 +67,7 @@ export class Command { * @param {CommandContext} context - The command context. * @throws {Error} If the command doesn't have an execute method. */ - execute(context: CommandContext): string | { content?: string; embeds?: APIEmbed[]; files?: any[]; components?: any[] } | null | undefined | void | Promise { + execute(context: CommandContext): CommandOutput { throw new Error(`${this.name} doesn't have an execute() method.`) } } diff --git a/types.d.ts b/types.d.ts index 8d35756..9144e52 100644 --- a/types.d.ts +++ b/types.d.ts @@ -1,6 +1,7 @@ import type { Blop } from '@/structures' import type { APIApplicationCommandOption, + APIEmbed, ChatInputCommandInteraction, Snowflake } from 'discord.js' @@ -29,3 +30,5 @@ export interface PartialCommandContext { client: Blop interaction?: ChatInputCommandInteraction<'cached'> } + +export type CommandOutput = string | { content?: string; embeds?: APIEmbed[]; files?: any[]; components?: any[] } | null | undefined | void | Promise