chore(module.ts) Move Command Modules to different file, change context objs to class counterparts

This commit is contained in:
Jacob Nguyen
2022-03-07 23:49:38 -06:00
parent 707840bc76
commit 36831def0f
6 changed files with 52 additions and 54 deletions

View File

@@ -1,30 +1,22 @@
import type { Option } from 'ts-results';
import type {
CommandInteraction,
CommandInteractionOptionResolver,
Message,
MessagePayload,
MessageOptions,
} from 'discord.js';
import type * as Sern from '../handler/sern';
import type Module from '../handler/module';
export type Visibility = 'private' | 'public';
// Anything that can be sent in a `<TextChannel>#send` or `<CommandInteraction>#reply`
export type possibleOutput<T = string> = T | (MessagePayload & MessageOptions);
export type execute = Sern.Module<unknown>['execute'];
export type execute = Module<unknown>['execute'];
// Thanks @cursorsdottsx
export type ParseType<T> = {
[K in keyof T]: T[K] extends unknown ? [k: K, args: T[K]] : never;
}[keyof T];
// A Sern.Module['delegate'] will carry a Context Parameter
export type Context = {
message: Option<Message>;
interaction: Option<CommandInteraction>;
};
export type Arg = ParseType<{ text: string[]; slash: SlashOptions }>;