mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
build: 1.3.5-beta38
This commit is contained in:
@@ -9,13 +9,14 @@ class BaseAction<PayloadType, ReturnDataType> {
|
||||
private validate: any = undefined;
|
||||
PayloadSchema: any = undefined;
|
||||
protected async check(payload: PayloadType): Promise<BaseCheckResult> {
|
||||
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
|
||||
|
Reference in New Issue
Block a user