Commit 3fcf14d2 authored by nanahira's avatar nanahira

adapt latest koishi

parent 79d85ae0
This diff is collapsed.
...@@ -69,6 +69,6 @@ ...@@ -69,6 +69,6 @@
"testEnvironment": "node" "testEnvironment": "node"
}, },
"peerDependencies": { "peerDependencies": {
"koishi": "^4.10.3" "koishi": "^4.10.4"
} }
} }
...@@ -23,7 +23,6 @@ export const { ...@@ -23,7 +23,6 @@ export const {
UseBeforeEvent, UseBeforeEvent,
UseMiddleware, UseMiddleware,
UsePreset, UsePreset,
UseFormatter,
UseInterval, UseInterval,
} = methodDecorators; } = methodDecorators;
...@@ -64,10 +63,14 @@ export const CommandDescription = koishiRegistrar.decorateCommandTransformer( ...@@ -64,10 +63,14 @@ export const CommandDescription = koishiRegistrar.decorateCommandTransformer(
export const CommandAlias = koishiRegistrar.decorateCommandTransformer( export const CommandAlias = koishiRegistrar.decorateCommandTransformer(
(ctx, cmd, ...names: string[]) => cmd.alias(...names), (ctx, cmd, ...names: string[]) => cmd.alias(...names),
); );
export const CommandShortcut = koishiRegistrar.decorateCommandTransformer( export const CommandShortcut = koishiRegistrar.decorateCommandTransformer(
(ctx, cmd, name: string | RegExp, config: Command.Shortcut = {}) => (ctx, cmd, pattern: string | RegExp, config: Command.Shortcut) =>
cmd.shortcut(name, config), // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
cmd.shortcut(pattern, config),
); );
export const CommandUsage = koishiRegistrar.decorateCommandTransformer( export const CommandUsage = koishiRegistrar.decorateCommandTransformer(
(ctx, cmd, text: Command.Usage) => cmd.usage(text), (ctx, cmd, text: Command.Usage) => cmd.usage(text),
); );
......
...@@ -147,21 +147,12 @@ export class KoishiRegistrar extends SatoriRegistrar<Context> { ...@@ -147,21 +147,12 @@ export class KoishiRegistrar extends SatoriRegistrar<Context> {
return command; return command;
}, },
), ),
UseFormatter: this.decorateMethod(
'formatter',
({ ctx }, fun: I18n.Formatter, name: string) => {
ctx.i18n.formatter(name, fun);
ctx.on('dispose', () => {
delete ctx.i18n._formatters[name];
});
},
),
UsePreset: this.decorateMethod( UsePreset: this.decorateMethod(
'preset', 'preset',
({ ctx }, fun: I18n.Renderer, name: string) => { ({ ctx }, fun: I18n.Renderer, name: string) => {
ctx.i18n.preset(name, fun); ctx.i18n.preset(name, fun);
ctx.on('dispose', () => { ctx.on('dispose', () => {
delete ctx.i18n._presets[fun.name]; delete ctx.i18n._presets[name];
}); });
}, },
), ),
......
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