mirror of
https://github.com/sern-handler/handler
synced 2026-06-06 01:16:55 +00:00
feat: make TextCommand and SlashCommand return more specific arg type
This commit is contained in:
@@ -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) ??
|
||||
|
||||
@@ -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>;
|
||||
}
|
||||
>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user