Commit ce1147be authored by nanahira's avatar nanahira

dont add exception handler for empty commands

parent bc232825
...@@ -17,7 +17,7 @@ import { KoishiContextService } from './koishi-context.service'; ...@@ -17,7 +17,7 @@ import { KoishiContextService } from './koishi-context.service';
import { Module } from '@nestjs/core/injector/module'; import { Module } from '@nestjs/core/injector/module';
import { KoishiMetadataFetcherService } from '../koishi-metadata-fetcher/koishi-metadata-fetcher.service'; import { KoishiMetadataFetcherService } from '../koishi-metadata-fetcher/koishi-metadata-fetcher.service';
import { KoishiInterceptorManagerService } from '../koishi-interceptor-manager/koishi-interceptor-manager.service'; import { KoishiInterceptorManagerService } from '../koishi-interceptor-manager/koishi-interceptor-manager.service';
import { Registrar } from 'koishi-decorators'; import { CommandRegisterConfig, Registrar } from 'koishi-decorators';
import { handleActionException } from '../utility/wrap-action'; import { handleActionException } from '../utility/wrap-action';
import { KoishiExceptionHandlerService } from '../koishi-exception-handler/koishi-exception-handler.service'; import { KoishiExceptionHandlerService } from '../koishi-exception-handler/koishi-exception-handler.service';
...@@ -60,13 +60,15 @@ export class KoishiMetascanService { ...@@ -60,13 +60,15 @@ export class KoishiMetascanService {
), ),
); );
this.addInterceptors(command, interceptorDefs); this.addInterceptors(command, interceptorDefs);
command.action(async (argv) => { if (!(result.data as CommandRegisterConfig).config?.empty) {
try { command.action(async (argv) => {
return await argv.next(); try {
} catch (e) { return await argv.next();
return this.exceptionHandler.handleActionException(e); } catch (e) {
} return this.exceptionHandler.handleActionException(e);
}, true); }
}, true);
}
} }
} }
......
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