mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-16 04:45:46 +00:00
remove: core不要干多余的事情
This commit is contained in:
parent
7e49bfa984
commit
946f12cf6a
@ -4,9 +4,9 @@ import fs from "node:fs";
|
|||||||
import { InstanceContext } from "./wrapper";
|
import { InstanceContext } from "./wrapper";
|
||||||
import { NTEventChannel } from "@/common/framework/event";
|
import { NTEventChannel } from "@/common/framework/event";
|
||||||
import { proxiedListenerOf } from "@/common/utils/proxy-handler";
|
import { proxiedListenerOf } from "@/common/utils/proxy-handler";
|
||||||
import { MsgListener } from "./listeners";
|
import { MsgListener, ProfileListener } from "./listeners";
|
||||||
import { sleep } from "@/common/utils/helper";
|
import { sleep } from "@/common/utils/helper";
|
||||||
import { SelfInfo, LineDevice } from "./entities";
|
import { SelfInfo, LineDevice, SelfStatusInfo } from "./entities";
|
||||||
|
|
||||||
export enum NapCatCoreWorkingEnv {
|
export enum NapCatCoreWorkingEnv {
|
||||||
Unknown = 0,
|
Unknown = 0,
|
||||||
@ -30,12 +30,6 @@ export class NapCatCore {
|
|||||||
|
|
||||||
// runtime info, not readonly
|
// runtime info, not readonly
|
||||||
selfInfo: SelfInfo;
|
selfInfo: SelfInfo;
|
||||||
deviceList: {
|
|
||||||
app_id: string,
|
|
||||||
device_name: string,
|
|
||||||
device_kind: string
|
|
||||||
}[] = [];
|
|
||||||
|
|
||||||
// 通过构造器递过去的 runtime info 应该尽量少
|
// 通过构造器递过去的 runtime info 应该尽量少
|
||||||
constructor(context: InstanceContext, selfInfo: SelfInfo) {
|
constructor(context: InstanceContext, selfInfo: SelfInfo) {
|
||||||
this.selfInfo = selfInfo;
|
this.selfInfo = selfInfo;
|
||||||
@ -50,16 +44,24 @@ export class NapCatCore {
|
|||||||
msgListener.onRecvMsg = (msg) => {
|
msgListener.onRecvMsg = (msg) => {
|
||||||
console.log("RecvMsg", msg);
|
console.log("RecvMsg", msg);
|
||||||
}
|
}
|
||||||
msgListener.onLineDev = (devices: LineDevice[]) => {
|
|
||||||
this.deviceList = devices.map((device: LineDevice) => ({
|
|
||||||
app_id: device.devUid,
|
|
||||||
device_name: device.clientType.toString(),
|
|
||||||
device_kind: device.clientType.toString(),
|
|
||||||
}));
|
|
||||||
};
|
|
||||||
//await sleep(2500);
|
//await sleep(2500);
|
||||||
this.context.session.getMsgService().addKernelMsgListener(
|
this.context.session.getMsgService().addKernelMsgListener(
|
||||||
new this.context.wrapper.NodeIKernelMsgListener(proxiedListenerOf(msgListener, this.context.logger))
|
new this.context.wrapper.NodeIKernelMsgListener(proxiedListenerOf(msgListener, this.context.logger))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const profileListener = new ProfileListener();
|
||||||
|
profileListener.onProfileDetailInfoChanged = (profile) => {
|
||||||
|
if (profile.uid === this.selfInfo.uid) {
|
||||||
|
Object.assign(this.selfInfo, profile);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
profileListener.onSelfStatusChanged = (Info: SelfStatusInfo) => {
|
||||||
|
// if (Info.status == 20) {
|
||||||
|
// log("账号状态变更为离线")
|
||||||
|
// }
|
||||||
|
};
|
||||||
|
this.context.session.getProfileService().addKernelProfileListener(
|
||||||
|
new this.context.wrapper.NodeIKernelProfileListener(proxiedListenerOf(profileListener, this.context.logger))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -177,6 +177,16 @@ export interface FriendV2 extends SimpleInfo {
|
|||||||
categoryId?: number;
|
categoryId?: number;
|
||||||
categroyName?: string;
|
categroyName?: string;
|
||||||
}
|
}
|
||||||
|
export interface SelfStatusInfo {
|
||||||
|
uid: string
|
||||||
|
status: number
|
||||||
|
extStatus: number
|
||||||
|
termType: number
|
||||||
|
netType: number
|
||||||
|
iconType: number
|
||||||
|
customStatus: any
|
||||||
|
setTime: string
|
||||||
|
}
|
||||||
export interface UserDetailInfoListenerArg {
|
export interface UserDetailInfoListenerArg {
|
||||||
uid: string;
|
uid: string;
|
||||||
uin: string;
|
uin: string;
|
||||||
|
@ -6,6 +6,7 @@ export * from './NodeIKernelGroupListener';
|
|||||||
export * from './NodeIKernelBuddyListener';
|
export * from './NodeIKernelBuddyListener';
|
||||||
export * from './NodeIKernelProfileListener';
|
export * from './NodeIKernelProfileListener';
|
||||||
export * from './NodeIKernelRobotListener';
|
export * from './NodeIKernelRobotListener';
|
||||||
|
export * from './NodeIKernelProfileListener';
|
||||||
export * from './NodeIKernelTicketListener';
|
export * from './NodeIKernelTicketListener';
|
||||||
export * from './NodeIKernelStorageCleanListener';
|
export * from './NodeIKernelStorageCleanListener';
|
||||||
export * from './NodeIKernelFileAssistantListener';
|
export * from './NodeIKernelFileAssistantListener';
|
||||||
|
Loading…
Reference in New Issue
Block a user