feat(handler) create command-options interface, remove module

This commit is contained in:
Jacob Nguyen
2022-03-13 01:37:24 -06:00
parent 840619d7c5
commit 5b968ce442
6 changed files with 34 additions and 58 deletions

View File

@@ -1,26 +0,0 @@
import type { possibleOutput, Arg } from '../../types/handler';
import type { CommandType } from '../sern';
import type Context from './context' ;
import type { Awaitable } from 'discord.js';
import type { Ok } from 'ts-results';
import type * as Utils from '../utilities/preprocessors/args';
/**
* An object that gets imported and acts as a command.
* @typedef {object} Module<T=string>
* @property {string} desc
* @property {Visibility} visibility
* @property {CommandType} type
* @property {(eventParams : Context, args : Ok<T=string) => Awaitable<possibleOutput | void>)} execute
* @prop {(ctx: Context, args: Arg) => Utils.ArgType<T>} parse
*/
interface Module<T = string> {
alias: string[];
desc: string;
type: CommandType;
execute: (eventParams: Context, args: Ok<T>) => Awaitable<possibleOutput | void>;
parse?: (ctx: Context, args: Arg) => Utils.ArgType<T>;
}
export default Module;