mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-12 16:00:27 +00:00
refactor: simplify the PacketClient availability check process & add action nc_get_packet_status
This commit is contained in:
25
src/onebot/action/packet/GetPacketStatus.ts
Normal file
25
src/onebot/action/packet/GetPacketStatus.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import {ActionName, BaseCheckResult} from '../types';
|
||||
|
||||
|
||||
export abstract class GetPacketStatusDepends<PT, RT> extends BaseAction<PT, RT> {
|
||||
actionName = ActionName.GetPacketStatus;
|
||||
|
||||
protected async check(): Promise<BaseCheckResult>{
|
||||
if (!this.core.apis.PacketApi.available) {
|
||||
return {
|
||||
valid: false,
|
||||
message: "PacketClient is not available!",
|
||||
}
|
||||
}
|
||||
return {
|
||||
valid: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class GetPacketStatus extends GetPacketStatusDepends<any, null> {
|
||||
async _handle(payload: any) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user