Commit d3771841 authored by nanahira's avatar nanahira

add type to CommandLocale

parent c5e8b4e0
......@@ -2,6 +2,7 @@ import {
BeforeEventName,
CommandConfigExtended,
CommandDefinitionFun,
CommandLocaleDef,
CommandOptionConfigWithDescription,
EventName,
KoishiCommandDefinition,
......@@ -113,7 +114,7 @@ export const CommandUse = <T extends Command, R extends any[]>(
...args: R
) => CommandDef((cmd) => callback(cmd, ...args));
export const CommandLocale = (locale: string, def: any) =>
export const CommandLocale = (locale: string, def: CommandLocaleDef) =>
CommandDef((cmd, ctx) => {
ctx.i18n.define(locale, `commands.${cmd.name}`, def);
return cmd;
......
......@@ -6,6 +6,7 @@ import {
EventMap,
Plugin,
Selection,
Store,
} from 'koishi';
import type { DefaultContext, DefaultState, ParameterizedContext } from 'koa';
import type { RouterParamContext } from '@koa/router';
......@@ -150,3 +151,9 @@ export type TopLevelActionDef = (ctx: Context, obj: any) => void;
export interface CommandOptionConfigWithDescription extends Argv.OptionConfig {
description?: string | Dict<string>;
}
export interface CommandLocaleDef extends Store {
description?: string;
options?: Dict<string>;
messages?: Store;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment