From 10e1c3e72c77c176e00256884a503897aeb41c54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Sat, 18 May 2024 18:08:18 +0800 Subject: [PATCH] build: 1.3.5-beta38 --- src/onebot11/action/BaseAction.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/onebot11/action/BaseAction.ts b/src/onebot11/action/BaseAction.ts index cc19217a..b4d1154a 100644 --- a/src/onebot11/action/BaseAction.ts +++ b/src/onebot11/action/BaseAction.ts @@ -9,13 +9,14 @@ class BaseAction { private validate: any = undefined; PayloadSchema: any = undefined; protected async check(payload: PayloadType): Promise { + if (this.PayloadSchema) { + this.validate = new Ajv().compile(this.PayloadSchema); + } if (this.validate && !this.validate(payload)) { return { valid: false, message: this.validate.errors?.map((e: { message: any; }) => e.message).join(',') as string } - } else if (this.PayloadSchema) { - this.validate = new Ajv().compile(this.PayloadSchema); } return { valid: true