refactor: add core into all event constructors

This commit is contained in:
Wesley F. Young committed 2024-08-10 22:11:57 +08:00
1 parent 2c14281168
commit 6d954b2d5d
20 files changed
+97 -57

No files matched your search

+2 -2
View File
@@ -2,5 +2,5 @@ import { EventType, OB11BaseEvent } from '../OB11BaseEvent';
export abstract class OB11BaseMetaEvent extends OB11BaseEvent {
post_type = EventType.META;
meta_event_type: string;
}
abstract meta_event_type: string;
}
+3 -2
View File
@@ -1,4 +1,5 @@
import { OB11BaseMetaEvent } from './OB11BaseMetaEvent';
import { NapCatCore } from '@/core';
interface HeartbeatStatus {
online: boolean | null,
@@ -10,8 +11,8 @@ export class OB11HeartbeatEvent extends OB11BaseMetaEvent {
status: HeartbeatStatus;
interval: number;
public constructor(isOnline: boolean, isGood: boolean, interval: number) {
super();
public constructor(core: NapCatCore, interval: number, isOnline: boolean | null, isGood: boolean) {
super(core);
this.interval = interval;
this.status = {
online: isOnline,
+4 -3
View File
@@ -1,4 +1,5 @@
import { OB11BaseMetaEvent } from './OB11BaseMetaEvent';
import { NapCatCore } from '@/core';
export enum LifeCycleSubType {
ENABLE = 'enable',
@@ -10,8 +11,8 @@ export class OB11LifeCycleEvent extends OB11BaseMetaEvent {
meta_event_type = 'lifecycle';
sub_type: LifeCycleSubType;
public constructor(subType: LifeCycleSubType) {
super();
public constructor(core: NapCatCore, subType: LifeCycleSubType) {
super(core);
this.sub_type = subType;
}
}
}