From a2993f7a3409f3cbc3cf604026218eedfa24dea6 Mon Sep 17 00:00:00 2001 From: Shigma <1700011071@pku.edu.cn> Date: Thu, 1 Apr 2021 15:33:03 +0800 Subject: [PATCH] fix(core): do not send twice when return session.execute() --- .nycrc.json | 3 ++- packages/koishi-core/src/session.ts | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.nycrc.json b/.nycrc.json index 30f824ae7c..42b3da153d 100644 --- a/.nycrc.json +++ b/.nycrc.json @@ -10,6 +10,7 @@ "packages/plugin-*/**/database/**", "packages/plugin-*/**/database.js", "packages/plugin-mongo/**", - "packages/plugin-mysql/**" + "packages/plugin-mysql/**", + "packages/plugin-webui/**" ] } \ No newline at end of file diff --git a/packages/koishi-core/src/session.ts b/packages/koishi-core/src/session.ts index 942a871643..670dc492c2 100644 --- a/packages/koishi-core/src/session.ts +++ b/packages/koishi-core/src/session.ts @@ -358,8 +358,9 @@ export class Session< } const result = await argv.command.execute(argv, next) - if (shouldEmit) await this.send(result) - return result + if (!shouldEmit) return result + await this.send(result) + return '' } middleware(middleware: Middleware) {