chore: OneBotApi

This commit is contained in:
手瓜一十雪
2024-08-09 15:44:45 +08:00
parent 7587e1b8f5
commit 086a6ad2cd
111 changed files with 4493 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
import { EventType, OB11BaseEvent } from '../OB11BaseEvent';
export abstract class OB11BaseMetaEvent extends OB11BaseEvent {
post_type = EventType.META;
meta_event_type: string;
}

View 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
};
}
}

View 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;
}
}