mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
Compare commits
21 Commits
8c164910f6
...
v3.6.13
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ed9cd2fe38 | ||
![]() |
e287906a9d | ||
![]() |
8bae789020 | ||
![]() |
ce57b7b725 | ||
![]() |
1d9872195d | ||
![]() |
98d1f8e29f | ||
![]() |
221b3fb730 | ||
![]() |
90a834495a | ||
![]() |
8bfd102232 | ||
![]() |
65e784f169 | ||
![]() |
0fc81c672f | ||
![]() |
62ae0f4321 | ||
![]() |
a01a0a1a18 | ||
![]() |
4c30cc69ad | ||
![]() |
1d43b75df4 | ||
![]() |
d02afdfc3e | ||
![]() |
5d6dee9fd0 | ||
![]() |
60c67ef41c | ||
![]() |
917d7c1f19 | ||
![]() |
ad19f2c99e | ||
![]() |
8a61f5a03f |
8
.github/workflows/release.yml
vendored
8
.github/workflows/release.yml
vendored
@@ -127,10 +127,6 @@ jobs:
|
|||||||
zip -q -r NapCat.Framework.Windows.Once.zip *
|
zip -q -r NapCat.Framework.Windows.Once.zip *
|
||||||
cd ..
|
cd ..
|
||||||
mv ./NapCat.Framework.Windows.Once/NapCat.Framework.Windows.Once.zip ./
|
mv ./NapCat.Framework.Windows.Once/NapCat.Framework.Windows.Once.zip ./
|
||||||
mv ./external/packet/napcat.packet.arm64 ./
|
|
||||||
mv ./external/packet/napcat.packet.exe ./
|
|
||||||
mv ./external/packet/napcat.packet.linux ./
|
|
||||||
mv ./external/packet/napcat.packet.production.py ./
|
|
||||||
- name: Extract version from tag
|
- name: Extract version from tag
|
||||||
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
|
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
|
||||||
|
|
||||||
@@ -147,8 +143,4 @@ jobs:
|
|||||||
NapCat.Framework.zip
|
NapCat.Framework.zip
|
||||||
NapCat.Shell.zip
|
NapCat.Shell.zip
|
||||||
NapCat.Framework.Windows.Once.zip
|
NapCat.Framework.Windows.Once.zip
|
||||||
napcat.packet.arm64
|
|
||||||
napcat.packet.exe
|
|
||||||
napcat.packet.linux
|
|
||||||
napcat.packet.production.py
|
|
||||||
draft: true
|
draft: true
|
||||||
|
@@ -30,6 +30,10 @@ NapCatQQ (aka 猫猫框架) 是现代化的基于 NTQQ 的 Bot 协议端实现
|
|||||||
|
|
||||||
[Cloudflare.Pages](https://napneko.pages.dev/)
|
[Cloudflare.Pages](https://napneko.pages.dev/)
|
||||||
|
|
||||||
|
[Server.China](https://napneko.com/)
|
||||||
|
|
||||||
|
[Server.Other](https://napcat.cyou/)
|
||||||
|
|
||||||
[Github.IO](https://napneko.github.io/)
|
[Github.IO](https://napneko.github.io/)
|
||||||
## 回家旅途
|
## 回家旅途
|
||||||
[QQ Group](https://qm.qq.com/q/VfjAq5HIMS)
|
[QQ Group](https://qm.qq.com/q/VfjAq5HIMS)
|
||||||
|
BIN
external/LiteLoaderWrapper.zip
vendored
BIN
external/LiteLoaderWrapper.zip
vendored
Binary file not shown.
BIN
external/packet/napcat.packet.arm64
vendored
BIN
external/packet/napcat.packet.arm64
vendored
Binary file not shown.
BIN
external/packet/napcat.packet.exe
vendored
BIN
external/packet/napcat.packet.exe
vendored
Binary file not shown.
BIN
external/packet/napcat.packet.linux
vendored
BIN
external/packet/napcat.packet.linux
vendored
Binary file not shown.
102
external/packet/napcat.packet.production.py
vendored
102
external/packet/napcat.packet.production.py
vendored
File diff suppressed because one or more lines are too long
32
launcher/launcher-user.bat
Normal file
32
launcher/launcher-user.bat
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
@echo off
|
||||||
|
chcp 65001
|
||||||
|
set NAPCAT_PATCH_PACKAGE=%cd%\qqnt.json
|
||||||
|
set NAPCAT_LOAD_PATH=%cd%\loadNapCat.js
|
||||||
|
set NAPCAT_INJECT_PATH=%cd%\NapCatWinBootHook.dll
|
||||||
|
set NAPCAT_LAUNCHER_PATH=%cd%\NapCatWinBootMain.exe
|
||||||
|
set NAPCAT_MAIN_PATH=%cd%\napcat.mjs
|
||||||
|
:loop_read
|
||||||
|
for /f "tokens=2*" %%a in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\QQ" /v "UninstallString"') do (
|
||||||
|
set RetString=%%b
|
||||||
|
goto :napcat_boot
|
||||||
|
)
|
||||||
|
|
||||||
|
:napcat_boot
|
||||||
|
for %%a in ("%RetString%") do (
|
||||||
|
set "pathWithoutUninstall=%%~dpa"
|
||||||
|
)
|
||||||
|
|
||||||
|
SET QQPath=%pathWithoutUninstall%QQ.exe
|
||||||
|
|
||||||
|
if not exist "%QQpath%" (
|
||||||
|
echo provided QQ path is invalid: %QQpath%
|
||||||
|
pause
|
||||||
|
exit /b
|
||||||
|
)
|
||||||
|
|
||||||
|
set NAPCAT_MAIN_PATH=%NAPCAT_MAIN_PATH:\=/%
|
||||||
|
echo (async () =^> {await import("file:///%NAPCAT_MAIN_PATH%")})() > "%NAPCAT_LOAD_PATH%"
|
||||||
|
|
||||||
|
"%NAPCAT_LAUNCHER_PATH%" "%QQPath%" "%NAPCAT_INJECT_PATH%" %1
|
||||||
|
|
||||||
|
pause
|
33
launcher/launcher-win10-user.bat
Normal file
33
launcher/launcher-win10-user.bat
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
@echo off
|
||||||
|
chcp 65001
|
||||||
|
set NAPCAT_PATCH_PACKAGE=%cd%\qqnt.json
|
||||||
|
set NAPCAT_LOAD_PATH=%cd%\loadNapCat.js
|
||||||
|
set NAPCAT_INJECT_PATH=%cd%\NapCatWinBootHook.dll
|
||||||
|
set NAPCAT_LAUNCHER_PATH=%cd%\NapCatWinBootMain.exe
|
||||||
|
set NAPCAT_MAIN_PATH=%cd%\napcat.mjs
|
||||||
|
:loop_read
|
||||||
|
for /f "tokens=2*" %%a in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\QQ" /v "UninstallString"') do (
|
||||||
|
set RetString=%%b
|
||||||
|
goto :napcat_boot
|
||||||
|
)
|
||||||
|
|
||||||
|
:napcat_boot
|
||||||
|
for %%a in ("%RetString%") do (
|
||||||
|
set "pathWithoutUninstall=%%~dpa"
|
||||||
|
)
|
||||||
|
|
||||||
|
SET QQPath=%pathWithoutUninstall%QQ.exe
|
||||||
|
|
||||||
|
if not exist "%QQpath%" (
|
||||||
|
echo provided QQ path is invalid: %QQpath%
|
||||||
|
pause
|
||||||
|
exit /b
|
||||||
|
)
|
||||||
|
set NAPCAT_MAIN_PATH=%NAPCAT_MAIN_PATH:\=/%
|
||||||
|
echo (async () =^> {await import("file:///%NAPCAT_MAIN_PATH%")})() > "%NAPCAT_LOAD_PATH%"
|
||||||
|
|
||||||
|
"%NAPCAT_LAUNCHER_PATH%" "%QQPath%" "%NAPCAT_INJECT_PATH%" %1
|
||||||
|
|
||||||
|
REM "%NAPCAT_LAUNCHER_PATH%" "%QQPath%" "%NAPCAT_INJECT_PATH%" 123456
|
||||||
|
|
||||||
|
pause
|
@@ -4,7 +4,7 @@
|
|||||||
"name": "NapCatQQ",
|
"name": "NapCatQQ",
|
||||||
"slug": "NapCat.Framework",
|
"slug": "NapCat.Framework",
|
||||||
"description": "高性能的 OneBot 11 协议实现",
|
"description": "高性能的 OneBot 11 协议实现",
|
||||||
"version": "3.6.5",
|
"version": "3.6.12",
|
||||||
"icon": "./logo.png",
|
"icon": "./logo.png",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
"name": "napcat",
|
"name": "napcat",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "3.6.5",
|
"version": "3.6.12",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build:framework": "vite build --mode framework",
|
"build:framework": "vite build --mode framework",
|
||||||
"build:shell": "vite build --mode shell",
|
"build:shell": "vite build --mode shell",
|
||||||
|
@@ -1 +1 @@
|
|||||||
export const napCatVersion = '3.6.5';
|
export const napCatVersion = '3.6.12';
|
||||||
|
@@ -175,14 +175,18 @@ export class NTQQFileApi {
|
|||||||
const thumbPath = pathLib.join(thumb, thumbFileName);
|
const thumbPath = pathLib.join(thumb, thumbFileName);
|
||||||
ffmpeg(filePath)
|
ffmpeg(filePath)
|
||||||
.on('error', (err) => {
|
.on('error', (err) => {
|
||||||
logger.logDebug('获取视频封面失败,使用默认封面', err);
|
try {
|
||||||
if (diyThumbPath) {
|
logger.logDebug('获取视频封面失败,使用默认封面', err);
|
||||||
fsPromises.copyFile(diyThumbPath, thumbPath).then(() => {
|
if (diyThumbPath) {
|
||||||
|
fsPromises.copyFile(diyThumbPath, thumbPath).then(() => {
|
||||||
|
resolve(thumbPath);
|
||||||
|
}).catch(reject);
|
||||||
|
} else {
|
||||||
|
fs.writeFileSync(thumbPath, Buffer.from(defaultVideoThumbB64, 'base64'));
|
||||||
resolve(thumbPath);
|
resolve(thumbPath);
|
||||||
}).catch(reject);
|
}
|
||||||
} else {
|
} catch (error) {
|
||||||
fs.writeFileSync(thumbPath, Buffer.from(defaultVideoThumbB64, 'base64'));
|
logger.logError.bind(logger)('获取视频封面失败,使用默认封面失败', error);
|
||||||
resolve(thumbPath);
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.screenshots({
|
.screenshots({
|
||||||
|
@@ -375,8 +375,10 @@ export class NTQQGroupApi {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async getGroupMembersV2(groupQQ: string, num = 3000): Promise<Map<string, GroupMember>> {
|
async getGroupMembersV2(groupQQ: string, num = 3000, no_cache: boolean = false): Promise<Map<string, GroupMember>> {
|
||||||
//console.log('getGroupMembers -->', groupQQ);
|
if (no_cache) {
|
||||||
|
return (await this.getGroupMemberAll(groupQQ, true)).result.infos;
|
||||||
|
}
|
||||||
let res = await this.GetGroupMembersV3(groupQQ, num);
|
let res = await this.GetGroupMembersV3(groupQQ, num);
|
||||||
let ret = res.infos;
|
let ret = res.infos;
|
||||||
if (res.infos.size === 0 && !res.listenerMode) {
|
if (res.infos.size === 0 && !res.listenerMode) {
|
||||||
@@ -386,14 +388,13 @@ export class NTQQGroupApi {
|
|||||||
if (res.infos.size === 0) {
|
if (res.infos.size === 0) {
|
||||||
ret = (await this.getGroupMemberAll(groupQQ)).result.infos;
|
ret = (await this.getGroupMemberAll(groupQQ)).result.infos;
|
||||||
}
|
}
|
||||||
//console.log("<---------------")
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getGroupMembers(groupQQ: string, num = 3000): Promise<Map<string, GroupMember>> {
|
async getGroupMembers(groupQQ: string, num = 3000): Promise<Map<string, GroupMember>> {
|
||||||
const groupService = this.context.session.getGroupService();
|
const groupService = this.context.session.getGroupService();
|
||||||
const sceneId = groupService.createMemberListScene(groupQQ, 'groupMemberList_MainWindow');
|
const sceneId = groupService.createMemberListScene(groupQQ, 'groupMemberList_MainWindow');
|
||||||
const result = await groupService.getNextMemberList(sceneId!, undefined, num);
|
const result = await groupService.getNextMemberList(sceneId, undefined, num);
|
||||||
if (result.errCode !== 0) {
|
if (result.errCode !== 0) {
|
||||||
throw new Error('获取群成员列表出错,' + result.errMsg);
|
throw new Error('获取群成员列表出错,' + result.errMsg);
|
||||||
}
|
}
|
||||||
@@ -401,8 +402,8 @@ export class NTQQGroupApi {
|
|||||||
return result.result.infos;
|
return result.result.infos;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getGroupFileCount(Gids: Array<string>) {
|
async getGroupFileCount(group_ids: Array<string>) {
|
||||||
return this.context.session.getRichMediaService().batchGetGroupFileCount(Gids);
|
return this.context.session.getRichMediaService().batchGetGroupFileCount(group_ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getArkJsonGroupShare(GroupCode: string) {
|
async getArkJsonGroupShare(GroupCode: string) {
|
||||||
|
26
src/core/external/offset.json
vendored
26
src/core/external/offset.json
vendored
@@ -1,8 +1,4 @@
|
|||||||
{
|
{
|
||||||
"6.9.56-28418-arm64": {
|
|
||||||
"send": "4471360",
|
|
||||||
"recv": "4473BCC"
|
|
||||||
},
|
|
||||||
"3.2.12-28418-x64": {
|
"3.2.12-28418-x64": {
|
||||||
"recv": "A0723E0",
|
"recv": "A0723E0",
|
||||||
"send": "A06EAE0"
|
"send": "A06EAE0"
|
||||||
@@ -11,6 +7,14 @@
|
|||||||
"recv": "37A9004",
|
"recv": "37A9004",
|
||||||
"send": "37A4BD0"
|
"send": "37A4BD0"
|
||||||
},
|
},
|
||||||
|
"6.9.56-28418-x64": {
|
||||||
|
"send": "4471360",
|
||||||
|
"recv": "4473BCC"
|
||||||
|
},
|
||||||
|
"6.9.56-28418-arm64": {
|
||||||
|
"send": "3FBDBF8",
|
||||||
|
"recv": "3FC0410"
|
||||||
|
},
|
||||||
"9.9.15-28498-x64": {
|
"9.9.15-28498-x64": {
|
||||||
"recv": "37A9004",
|
"recv": "37A9004",
|
||||||
"send": "37A4BD0"
|
"send": "37A4BD0"
|
||||||
@@ -39,10 +43,14 @@
|
|||||||
"send": "6E91318",
|
"send": "6E91318",
|
||||||
"recv": "6E94B50"
|
"recv": "6E94B50"
|
||||||
},
|
},
|
||||||
"6.9.58-28971-arm64": {
|
"6.9.58-28971-x64": {
|
||||||
"send": "449ACA0",
|
"send": "449ACA0",
|
||||||
"recv": "449D50C"
|
"recv": "449D50C"
|
||||||
},
|
},
|
||||||
|
"6.9.58-28971-arm64": {
|
||||||
|
"send": "3FE0DB0",
|
||||||
|
"recv": "3FE35C8"
|
||||||
|
},
|
||||||
"9.9.16-29271-x64": {
|
"9.9.16-29271-x64": {
|
||||||
"send": "3833510",
|
"send": "3833510",
|
||||||
"recv": "3837944"
|
"recv": "3837944"
|
||||||
@@ -66,5 +74,13 @@
|
|||||||
"3.2.13-29456-arm64": {
|
"3.2.13-29456-arm64": {
|
||||||
"send": "6ECA130",
|
"send": "6ECA130",
|
||||||
"recv": "6ECD968"
|
"recv": "6ECD968"
|
||||||
|
},
|
||||||
|
"6.9.59-29456-x64": {
|
||||||
|
"send": "44C57A0",
|
||||||
|
"recv": "44C800C"
|
||||||
|
},
|
||||||
|
"6.9.59-29456-arm64": {
|
||||||
|
"send": "4005FE8",
|
||||||
|
"recv": "4008800"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { ChatType, RawMessage } from '@/core/entities';
|
import { ChatType, KickedOffLineInfo, RawMessage } from '@/core/entities';
|
||||||
import { CommonFileInfo } from '@/core';
|
import { CommonFileInfo } from '@/core';
|
||||||
|
|
||||||
export interface OnRichMediaDownloadCompleteParams {
|
export interface OnRichMediaDownloadCompleteParams {
|
||||||
@@ -212,7 +212,7 @@ export class NodeIKernelMsgListener {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onKickedOffLine(kickedInfo: unknown) {
|
onKickedOffLine(kickedInfo: KickedOffLineInfo) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BIN
src/native/packet/MoeHoo.darwin.arm64.node
Normal file
BIN
src/native/packet/MoeHoo.darwin.arm64.node
Normal file
Binary file not shown.
@@ -42,7 +42,7 @@ export default class GoCQHTTPUploadGroupFile extends BaseAction<Payload, null> {
|
|||||||
deleteAfterSentFiles: []
|
deleteAfterSentFiles: []
|
||||||
};
|
};
|
||||||
const sendFileEle = await this.core.apis.FileApi.createValidSendFileElement(msgContext, downloadResult.path, payload.name, payload.folder ?? payload.folder_id);
|
const sendFileEle = await this.core.apis.FileApi.createValidSendFileElement(msgContext, downloadResult.path, payload.name, payload.folder ?? payload.folder_id);
|
||||||
await this.obContext.apis.MsgApi.sendMsgWithOb11UniqueId(peer, [sendFileEle], [], true);
|
await this.obContext.apis.MsgApi.sendMsgWithOb11UniqueId(peer, [sendFileEle], msgContext.deleteAfterSentFiles, true);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -53,7 +53,7 @@ export default class GoCQHTTPUploadPrivateFile extends BaseAction<Payload, null>
|
|||||||
deleteAfterSentFiles: []
|
deleteAfterSentFiles: []
|
||||||
};
|
};
|
||||||
const sendFileEle: SendFileElement = await this.core.apis.FileApi.createValidSendFileElement(msgContext, downloadResult.path, payload.name);
|
const sendFileEle: SendFileElement = await this.core.apis.FileApi.createValidSendFileElement(msgContext, downloadResult.path, payload.name);
|
||||||
await this.obContext.apis.MsgApi.sendMsgWithOb11UniqueId(await this.getPeer(payload), [sendFileEle], [], true);
|
await this.obContext.apis.MsgApi.sendMsgWithOb11UniqueId(await this.getPeer(payload), [sendFileEle], msgContext.deleteAfterSentFiles, true);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -24,12 +24,11 @@ export class GetGroupMemberList extends BaseAction<Payload, OB11GroupMember[]> {
|
|||||||
const noCache = payload.no_cache ? this.stringToBoolean(payload.no_cache) : false;
|
const noCache = payload.no_cache ? this.stringToBoolean(payload.no_cache) : false;
|
||||||
const memberCache = this.core.apis.GroupApi.groupMemberCache;
|
const memberCache = this.core.apis.GroupApi.groupMemberCache;
|
||||||
let groupMembers;
|
let groupMembers;
|
||||||
if (noCache) {
|
try {
|
||||||
groupMembers = await this.core.apis.GroupApi.getGroupMembersV2(groupIdStr);
|
groupMembers = await this.core.apis.GroupApi.getGroupMembersV2(groupIdStr, 3000, noCache);
|
||||||
} else {
|
} catch (error) {
|
||||||
groupMembers = memberCache.get(groupIdStr) ?? await this.core.apis.GroupApi.getGroupMembersV2(groupIdStr);
|
groupMembers = memberCache.get(groupIdStr) ?? await this.core.apis.GroupApi.getGroupMembersV2(groupIdStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
const memberPromises = Array.from(groupMembers.values()).map(item =>
|
const memberPromises = Array.from(groupMembers.values()).map(item =>
|
||||||
OB11Entities.groupMember(groupIdStr, item)
|
OB11Entities.groupMember(groupIdStr, item)
|
||||||
);
|
);
|
||||||
|
@@ -2,12 +2,14 @@ import { ChatType, Peer } from '@/core/entities';
|
|||||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
import BaseAction from '../BaseAction';
|
import BaseAction from '../BaseAction';
|
||||||
import { ActionName } from '../types';
|
import { ActionName } from '../types';
|
||||||
|
import { MessageUnique } from '@/common/message-unique';
|
||||||
|
|
||||||
const SchemaData = {
|
const SchemaData = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
properties: {
|
properties: {
|
||||||
user_id: { type: ['number', 'string'] },
|
user_id: { type: ['number', 'string'] },
|
||||||
group_id: { type: ['number', 'string'] },
|
group_id: { type: ['number', 'string'] },
|
||||||
|
message_id: { type: ['number', 'string'] },
|
||||||
},
|
},
|
||||||
} as const satisfies JSONSchema;
|
} as const satisfies JSONSchema;
|
||||||
|
|
||||||
@@ -15,6 +17,16 @@ type PlayloadType = FromSchema<typeof SchemaData>;
|
|||||||
|
|
||||||
class MarkMsgAsRead extends BaseAction<PlayloadType, null> {
|
class MarkMsgAsRead extends BaseAction<PlayloadType, null> {
|
||||||
async getPeer(payload: PlayloadType): Promise<Peer> {
|
async getPeer(payload: PlayloadType): Promise<Peer> {
|
||||||
|
if (payload.message_id) {
|
||||||
|
let s_peer = MessageUnique.getMsgIdAndPeerByShortId(+payload.message_id)?.Peer;
|
||||||
|
if (s_peer) {
|
||||||
|
return s_peer;
|
||||||
|
}
|
||||||
|
let l_peer = MessageUnique.getPeerByMsgId(payload.message_id.toString())?.Peer;
|
||||||
|
if (l_peer) {
|
||||||
|
return l_peer;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (payload.user_id) {
|
if (payload.user_id) {
|
||||||
const peerUid = await this.core.apis.UserApi.getUidByUinV2(payload.user_id.toString());
|
const peerUid = await this.core.apis.UserApi.getUidByUinV2(payload.user_id.toString());
|
||||||
if (!peerUid) {
|
if (!peerUid) {
|
||||||
|
16
src/onebot/event/notice/BotOfflineEvent.ts
Normal file
16
src/onebot/event/notice/BotOfflineEvent.ts
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import { OB11BaseNoticeEvent } from './OB11BaseNoticeEvent';
|
||||||
|
import { NapCatCore } from '@/core';
|
||||||
|
|
||||||
|
export class BotOfflineEvent extends OB11BaseNoticeEvent {
|
||||||
|
notice_type = 'bot_offline';
|
||||||
|
user_id: number;
|
||||||
|
tag: string = 'BotOfflineEvent';
|
||||||
|
message: string = 'BotOfflineEvent';
|
||||||
|
|
||||||
|
public constructor(core: NapCatCore, tag: string, message: string) {
|
||||||
|
super(core);
|
||||||
|
this.user_id = +core.selfInfo.uin;
|
||||||
|
this.tag = tag;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
}
|
@@ -47,6 +47,7 @@ import { LRUCache } from '@/common/lru-cache';
|
|||||||
import { NodeIKernelRecentContactListener } from '@/core/listeners/NodeIKernelRecentContactListener';
|
import { NodeIKernelRecentContactListener } from '@/core/listeners/NodeIKernelRecentContactListener';
|
||||||
import { Native } from '@/native';
|
import { Native } from '@/native';
|
||||||
import { decodeMessage, decodeRecallGroup } from '@/core/packet/proto/old/Message';
|
import { decodeMessage, decodeRecallGroup } from '@/core/packet/proto/old/Message';
|
||||||
|
import { BotOfflineEvent } from './event/notice/BotOfflineEvent';
|
||||||
|
|
||||||
//OneBot实现类
|
//OneBot实现类
|
||||||
export class NapCatOneBot11Adapter {
|
export class NapCatOneBot11Adapter {
|
||||||
@@ -343,7 +344,11 @@ export class NapCatOneBot11Adapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
msgListener.onKickedOffLine = async (kick) => {
|
||||||
|
let event = new BotOfflineEvent(this.core, kick.tipsTitle, kick.tipsDesc);
|
||||||
|
this.networkManager.emitEvent(event)
|
||||||
|
.catch(e => this.context.logger.logError.bind(this.context.logger)('处理Bot掉线失败', e));
|
||||||
|
}
|
||||||
this.context.session.getMsgService().addKernelMsgListener(
|
this.context.session.getMsgService().addKernelMsgListener(
|
||||||
proxiedListenerOf(msgListener, this.context.logger),
|
proxiedListenerOf(msgListener, this.context.logger),
|
||||||
);
|
);
|
||||||
|
@@ -164,7 +164,7 @@ async function onSettingWindowCreated(view) {
|
|||||||
SettingItem(
|
SettingItem(
|
||||||
'<span id="napcat-update-title">Napcat</span>',
|
'<span id="napcat-update-title">Napcat</span>',
|
||||||
void 0,
|
void 0,
|
||||||
SettingButton("V3.6.5", "napcat-update-button", "secondary")
|
SettingButton("V3.6.12", "napcat-update-button", "secondary")
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
SettingList([
|
SettingList([
|
||||||
|
Reference in New Issue
Block a user