chore: make BaseAction abstract
This commit is contained in:
1 parent
63237bc112
commit
9feab4bc79
1 file changed
+2
-4
@@ -5,7 +5,7 @@ import Ajv, { ErrorObject, ValidateFunction } from 'ajv';
|
|||||||
import { NapCatCore } from '@/core';
|
import { NapCatCore } from '@/core';
|
||||||
import { NapCatOneBot11Adapter } from '../main';
|
import { NapCatOneBot11Adapter } from '../main';
|
||||||
|
|
||||||
class BaseAction<PayloadType, ReturnDataType> {
|
abstract class BaseAction<PayloadType, ReturnDataType> {
|
||||||
actionName: ActionName = ActionName.Unknown;
|
actionName: ActionName = ActionName.Unknown;
|
||||||
CoreContext: NapCatCore;
|
CoreContext: NapCatCore;
|
||||||
private validate: undefined | ValidateFunction<any> = undefined;
|
private validate: undefined | ValidateFunction<any> = undefined;
|
||||||
@@ -64,9 +64,7 @@ class BaseAction<PayloadType, ReturnDataType> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async _handle(payload: PayloadType): Promise<ReturnDataType> {
|
abstract _handle(payload: PayloadType): PromiseLike<ReturnDataType>;
|
||||||
throw `pleas override ${this.actionName} _handle`;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default BaseAction;
|
export default BaseAction;
|
||||||
Reference in new issue
Block a user