diff --git a/src/types/handler.ts b/src/types/handler.ts index 112ae5b..ae4c7f9 100644 --- a/src/types/handler.ts +++ b/src/types/handler.ts @@ -8,6 +8,9 @@ import type { ErrorHandling, Logging, ModuleManager } from '../core/contracts'; import type { ModuleStore } from '../core/structures/moduleStore'; import type SernEmitter from '../core/sernEmitter'; import type { Container } from 'iti'; + +export type Awaitable = PromiseLike | T; + // Thanks to @kelsny export type ParseType = { [K in keyof T]: T[K] extends unknown ? [k: K, args: T[K]] : never; diff --git a/src/types/module.ts b/src/types/module.ts index ecd2bdf..e133d86 100644 --- a/src/types/module.ts +++ b/src/types/module.ts @@ -9,7 +9,6 @@ import type { ApplicationCommandSubCommandData, ApplicationCommandSubGroupData, AutocompleteInteraction, - Awaitable, BaseApplicationCommandOptionsData, ButtonInteraction, MessageContextMenuCommandInteraction, @@ -22,7 +21,7 @@ import type { UserSelectMenuInteraction, } from 'discord.js'; import { CommandType } from '../core/structures/enums'; -import type { Args, SlashOptions } from './handler'; +import type { Args, Awaitable, SlashOptions } from './handler'; import type Context from '../handler/structures/context'; import type { InitPlugin, ControlPlugin } from './plugin'; import { EventType } from '../core/structures/enums'; diff --git a/src/types/plugin.ts b/src/types/plugin.ts index aba244e..49822fb 100644 --- a/src/types/plugin.ts +++ b/src/types/plugin.ts @@ -11,12 +11,11 @@ * Plugins are reminiscent of middleware in express. */ -import type { Awaitable } from 'discord.js'; import type { Err, Ok, Result } from 'ts-results-es'; import type { PluginType } from '../core/structures/enums'; import type { CommandModule, EventModule } from './module'; import type { InitArgs } from '../core/plugins'; -import type { Processed } from './handler'; +import type { Awaitable, Processed } from './handler'; export type PluginResult = Awaitable; export type VoidResult = Result;