mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-05 15:11:15 +00:00
Introduced explicit payloadSchema and returnSchema definitions for all OneBotAction classes using @sinclair/typebox. This improves type safety, API documentation, and validation for action payloads and return values. Also refactored method signatures and types for consistency across the codebase.
26 lines
931 B
TypeScript
26 lines
931 B
TypeScript
import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
||
import { ActionName, BaseCheckResult } from '@/napcat-onebot/action/router';
|
||
|
||
export abstract class GetPacketStatusDepends<PT, RT> extends OneBotAction<PT, RT> {
|
||
protected override async check (payload: PT): Promise<BaseCheckResult> {
|
||
if (!this.core.apis.PacketApi.packetStatus) {
|
||
return {
|
||
valid: false,
|
||
message: 'packetBackend不可用,请参照文档 https://napneko.github.io/config/advanced 和启动日志检查packetBackend状态或进行配置!' +
|
||
'错误堆栈信息:' + this.core.apis.PacketApi.clientLogStack,
|
||
};
|
||
}
|
||
return await super.check(payload);
|
||
}
|
||
}
|
||
|
||
export class GetPacketStatus extends GetPacketStatusDepends<void, void> {
|
||
override actionName = ActionName.GetPacketStatus;
|
||
override payloadSchema = Type.Object({});
|
||
override returnSchema = Type.Null();
|
||
|
||
async _handle () {
|
||
|
||
}
|
||
}
|