diff --git a/manifest.json b/manifest.json
index 8e0af195..383da8d9 100644
--- a/manifest.json
+++ b/manifest.json
@@ -4,7 +4,7 @@
"name": "NapCatQQ",
"slug": "NapCat.Framework",
"description": "高性能的 OneBot 11 协议实现",
- "version": "2.2.41",
+ "version": "2.2.42",
"icon": "./logo.png",
"authors": [
{
diff --git a/package.json b/package.json
index 98ffba79..8fb1dbcb 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "napcat",
"private": true,
"type": "module",
- "version": "2.2.41",
+ "version": "2.2.42",
"scripts": {
"build:framework": "vite build --mode framework",
"build:shell": "vite build --mode shell",
diff --git a/src/common/version.ts b/src/common/version.ts
index f8fb8ba6..07449f95 100644
--- a/src/common/version.ts
+++ b/src/common/version.ts
@@ -1 +1 @@
-export const napCatVersion = '2.2.41';
+export const napCatVersion = '2.2.42';
diff --git a/src/core/index.ts b/src/core/index.ts
index 198e4992..adc5e917 100644
--- a/src/core/index.ts
+++ b/src/core/index.ts
@@ -24,7 +24,7 @@ import path from 'node:path';
import fs from 'node:fs';
import { getMachineId, hostname, systemName, systemVersion } from '@/common/system';
import { NTEventWrapper } from '@/common/event';
-import { DataSource, GroupMember, SelfInfo } from '@/core/entities';
+import { DataSource, GroupMember, KickedOffLineInfo, SelfInfo, SelfStatusInfo } from '@/core/entities';
import { NapCatConfigLoader } from '@/core/helper/config';
import os from 'node:os';
import { NodeIKernelGroupListener, NodeIKernelMsgListener, NodeIKernelProfileListener } from '@/core/listeners';
@@ -113,6 +113,11 @@ export class NapCatCore {
// Renamed from 'InitDataListener'
async initNapCatCoreListeners() {
const msgListener = new NodeIKernelMsgListener();
+ msgListener.onKickedOffLine = (Info: KickedOffLineInfo) => {
+ // 下线通知
+ this.context.logger.logError('[KickedOffLine] [' + Info.tipsTitle + '] ' + Info.tipsDesc);
+ this.selfInfo.online = false;
+ };
msgListener.onRecvMsg = (msgs) => {
msgs.forEach(msg => this.context.logger.logMessage(msg, this.selfInfo));
};
@@ -130,10 +135,12 @@ export class NapCatCore {
Object.assign(this.selfInfo, profile);
}
};
- profileListener.onSelfStatusChanged = (/* Info: SelfStatusInfo */) => {
- // if (Info.status == 20) {
- // log("账号状态变更为离线")
- // }
+ profileListener.onSelfStatusChanged = (Info: SelfStatusInfo) => {
+ if (Info.status == 20) {
+ this.selfInfo.online = false;
+ this.context.logger.log("账号状态变更为离线");
+ }
+ this.selfInfo.online = true;
};
this.context.session.getProfileService().addKernelProfileListener(
proxiedListenerOf(profileListener, this.context.logger),
diff --git a/src/webui/ui/NapCat.ts b/src/webui/ui/NapCat.ts
index 9fea01b1..d18e8113 100644
--- a/src/webui/ui/NapCat.ts
+++ b/src/webui/ui/NapCat.ts
@@ -30,7 +30,7 @@ async function onSettingWindowCreated(view: Element) {
SettingItem(
'Napcat',
undefined,
- SettingButton('V2.2.41', 'napcat-update-button', 'secondary'),
+ SettingButton('V2.2.42', 'napcat-update-button', 'secondary'),
),
]),
SettingList([
diff --git a/static/assets/renderer.js b/static/assets/renderer.js
index 663b4c4c..d5f2e8a4 100644
--- a/static/assets/renderer.js
+++ b/static/assets/renderer.js
@@ -164,7 +164,7 @@ async function onSettingWindowCreated(view) {
SettingItem(
'Napcat',
void 0,
- SettingButton("V2.2.41", "napcat-update-button", "secondary")
+ SettingButton("V2.2.42", "napcat-update-button", "secondary")
)
]),
SettingList([