Commit 98405ccc authored by nanahira's avatar nanahira

run command action at last

parent cf12428d
Pipeline #6153 passed with stages
in 1 minute and 13 seconds
{
"name": "koishi-nestjs",
"version": "1.0.29",
"version": "1.0.30",
"description": "Koishi.js as Nest.js Module",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
......
......@@ -83,9 +83,8 @@ export class KoishiMetascanService {
);
break;
case 'onevent':
const {
data: eventData,
} = regData as DoRegisterConfig<EventNameAndPrepend>;
const { data: eventData } =
regData as DoRegisterConfig<EventNameAndPrepend>;
baseContext.on(eventData.name, (...args: any[]) =>
methodFun.call(instance, ...args),
);
......@@ -106,11 +105,7 @@ export class KoishiMetascanService {
const { data: commandData } = regData as DoRegisterConfig<
ContextFunction<Command>
>;
let command = commandData(
baseContext,
).action((argv: Argv, ...args: any[]) =>
methodFun.call(instance, argv, ...args),
);
let command = commandData(baseContext);
const commandDefs: CommandDefinitionFun[] = this.reflector.get(
KoishiCommandDefinition,
methodFun,
......@@ -120,6 +115,9 @@ export class KoishiMetascanService {
command = commandDef(command) || command;
}
}
command.action((argv: Argv, ...args: any[]) =>
methodFun.call(instance, argv, ...args),
);
break;
default:
throw new Error(`Unknown operaton type ${regData.type}`);
......
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