mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-13 00:10:27 +00:00
chore: OneBotApi
This commit is contained in:
6
src/onebot/event/meta/OB11BaseMetaEvent.ts
Normal file
6
src/onebot/event/meta/OB11BaseMetaEvent.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { EventType, OB11BaseEvent } from '../OB11BaseEvent';
|
||||
|
||||
export abstract class OB11BaseMetaEvent extends OB11BaseEvent {
|
||||
post_type = EventType.META;
|
||||
meta_event_type: string;
|
||||
}
|
||||
21
src/onebot/event/meta/OB11HeartbeatEvent.ts
Normal file
21
src/onebot/event/meta/OB11HeartbeatEvent.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { OB11BaseMetaEvent } from './OB11BaseMetaEvent';
|
||||
|
||||
interface HeartbeatStatus {
|
||||
online: boolean | null,
|
||||
good: boolean
|
||||
}
|
||||
|
||||
export class OB11HeartbeatEvent extends OB11BaseMetaEvent {
|
||||
meta_event_type = 'heartbeat';
|
||||
status: HeartbeatStatus;
|
||||
interval: number;
|
||||
|
||||
public constructor(isOnline: boolean, isGood: boolean, interval: number) {
|
||||
super();
|
||||
this.interval = interval;
|
||||
this.status = {
|
||||
online: isOnline,
|
||||
good: isGood
|
||||
};
|
||||
}
|
||||
}
|
||||
17
src/onebot/event/meta/OB11LifeCycleEvent.ts
Normal file
17
src/onebot/event/meta/OB11LifeCycleEvent.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { OB11BaseMetaEvent } from './OB11BaseMetaEvent';
|
||||
|
||||
export enum LifeCycleSubType {
|
||||
ENABLE = 'enable',
|
||||
DISABLE = 'disable',
|
||||
CONNECT = 'connect'
|
||||
}
|
||||
|
||||
export class OB11LifeCycleEvent extends OB11BaseMetaEvent {
|
||||
meta_event_type = 'lifecycle';
|
||||
sub_type: LifeCycleSubType;
|
||||
|
||||
public constructor(subType: LifeCycleSubType) {
|
||||
super();
|
||||
this.sub_type = subType;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user