feat: make TextCommand and SlashCommand return more specific arg type

This commit is contained in:
Jacob Nguyen
2022-06-05 11:27:42 -05:00
parent 18d07d6e2d
commit 048072bdd7
2 changed files with 4 additions and 2 deletions

View File

@@ -22,7 +22,7 @@ export const onMessageCreate = (wrapper: Wrapper) => {
const [prefix, ...rest] = fmt(message, defaultPrefix);
return {
ctx: Context.wrap(message),
args: <Args>['text', rest],
args: <['text', string[]]>['text', rest],
mod:
Files.TextCommands.text.get(prefix) ??
Files.BothCommands.get(prefix) ??

View File

@@ -15,7 +15,7 @@ import type {
SelectMenuInteraction,
UserContextMenuCommandInteraction,
} from 'discord.js';
import type { Args, Override } from '../../types/handler';
import type { Args, Override, SlashOptions } from '../../types/handler';
import type { CommandPlugin, EventPlugin } from '../plugins/plugin';
import type Context from './context';
import { CommandType, PluginType } from './enums';
@@ -37,6 +37,7 @@ export type TextCommand = Override<
onEvent: EventPlugin<CommandType.Text>[];
plugins: CommandPlugin[];
alias?: string[];
execute: (ctx: Context, args: ['text', string[]]) => Awaitable<void | unknown>;
}
>;
@@ -47,6 +48,7 @@ export type SlashCommand = Override<
onEvent: EventPlugin<CommandType.Slash>[];
plugins: CommandPlugin[];
options?: SernOptionsData[];
execute: (ctx: Context, args: ['slash', SlashOptions]) => Awaitable<void | unknown>;
}
>;