Compare commits

...
48 Commits
Author SHA1 Message Date
手瓜一十雪 ed9cd2fe38 fix: #513
Build Release / check-version (push) Canceled after 0s
Build Release / Build-LiteLoader (push) Canceled after 0s
Build Release / Build-Shell (push) Canceled after 0s
Build Release / release-napcat (push) Canceled after 0s
2024-11-12 18:37:44 +08:00
Mlikiowa e287906a9d release: v3.6.12 2024-11-11 13:03:29 +00:00
手瓜一十雪 8bae789020 Merge branch 'main' of https://github.com/NapNeko/NapCatQQ
Build Release / check-version (push) Canceled after 0s
Build Release / Build-LiteLoader (push) Canceled after 0s
Build Release / Build-Shell (push) Canceled after 0s
Build Release / release-napcat (push) Canceled after 0s
2024-11-11 21:00:27 +08:00
手瓜一十雪 ce57b7b725 fix: #509 2024-11-11 21:00:12 +08:00
pk5ls20 1d9872195d fix: offset name 2024-11-11 20:57:30 +08:00
pk5ls20 98d1f8e29f feat: add some macOS offset 2024-11-11 20:54:57 +08:00
手瓜一十雪 221b3fb730 fix 2024-11-11 20:35:13 +08:00
Mlikiowa 90a834495a release: v3.6.11 2024-11-11 12:17:25 +00:00
手瓜一十雪 8bfd102232 fix: macos arm64 28971
Build Release / check-version (push) Canceled after 0s
Build Release / Build-LiteLoader (push) Canceled after 0s
Build Release / Build-Shell (push) Canceled after 0s
Build Release / release-napcat (push) Canceled after 0s
2024-11-11 20:16:44 +08:00
Mlikiowa 65e784f169 release: v3.6.10 2024-11-11 02:45:39 +00:00
手瓜一十雪 0fc81c672f fix: once升级
Build Release / check-version (push) Canceled after 0s
Build Release / Build-LiteLoader (push) Canceled after 0s
Build Release / Build-Shell (push) Canceled after 0s
Build Release / release-napcat (push) Canceled after 0s
2024-11-11 10:45:15 +08:00
手瓜一十雪 62ae0f4321 feat: 文档镜像 2024-11-10 12:40:18 +08:00
Mlikiowa a01a0a1a18 release: v3.6.9 2024-11-10 04:11:16 +00:00
手瓜一十雪 4c30cc69ad fix: #73
Build Release / check-version (push) Canceled after 0s
Build Release / Build-LiteLoader (push) Canceled after 0s
Build Release / Build-Shell (push) Canceled after 0s
Build Release / release-napcat (push) Canceled after 0s
2024-11-10 12:10:43 +08:00
Mlikiowa 1d43b75df4 release: v3.6.8 2024-11-09 10:22:17 +00:00
手瓜一十雪 d02afdfc3e fix: 缓存
Build Release / check-version (push) Canceled after 0s
Build Release / Build-LiteLoader (push) Canceled after 0s
Build Release / Build-Shell (push) Canceled after 0s
Build Release / release-napcat (push) Canceled after 0s
2024-11-09 18:21:50 +08:00
Mlikiowa 5d6dee9fd0 release: v3.6.7 2024-11-09 04:36:58 +00:00
手瓜一十雪 60c67ef41c Merge branch 'main' of https://github.com/NapNeko/NapCatQQ
Build Release / check-version (push) Canceled after 0s
Build Release / Build-LiteLoader (push) Canceled after 0s
Build Release / Build-Shell (push) Canceled after 0s
Build Release / release-napcat (push) Canceled after 0s
2024-11-09 12:36:21 +08:00
手瓜一十雪 917d7c1f19 feat: user boot script 2024-11-09 12:35:50 +08:00
Mlikiowa ad19f2c99e release: v3.6.6 2024-11-09 04:22:55 +00:00
手瓜一十雪 8a61f5a03f fix: #503
Build Release / check-version (push) Canceled after 0s
Build Release / Build-LiteLoader (push) Canceled after 0s
Build Release / Build-Shell (push) Canceled after 0s
Build Release / release-napcat (push) Canceled after 0s
2024-11-09 12:22:28 +08:00
手瓜一十雪 8c164910f6 docs: 因为优点太多所以只好去掉几条了 2024-11-08 16:23:20 +08:00
pk5ls20 a560d3d266 chore: eslint migrate 2024-11-08 15:43:27 +08:00
手瓜一十雪 532f739272 Merge pull request #501 from NapNeko/eslint9
feat: eslint9
2024-11-08 12:38:12 +08:00
手瓜一十雪 a120727f2d feat: eslint9 2024-11-08 12:36:25 +08:00
手瓜一十雪 a9bcb830a8 feat: 迁移29456为标准版本 2024-11-08 12:14:15 +08:00
Mlikiowa 56e5f0033f release: v3.6.5 2024-11-08 01:20:08 +00:00
手瓜一十雪 101106996a feat: 29456
Build Release / check-version (push) Canceled after 0s
Build Release / Build-LiteLoader (push) Canceled after 0s
Build Release / Build-Shell (push) Canceled after 0s
Build Release / release-napcat (push) Canceled after 0s
2024-11-08 09:18:40 +08:00
pk5ls20 41a81534dc feat: support 29456 2024-11-08 00:26:09 +08:00
Mlikiowa 1425e8f229 release: v3.6.4 2024-11-07 08:14:56 +00:00
手瓜一十雪 75bb1d2193 Merge pull request #499 from kanocence/main
Build Release / check-version (push) Canceled after 0s
Build Release / Build-LiteLoader (push) Canceled after 0s
Build Release / Build-Shell (push) Canceled after 0s
Build Release / release-napcat (push) Canceled after 0s
修复 config 页面样式
2024-11-07 16:14:01 +08:00
手瓜一十雪 2a23820f9b Merge pull request #500 from Stapxs/patch-1
fix: 在处理 file uri 时可能会意外忽略 fragment 段
2024-11-07 16:13:06 +08:00
林小槐 2ee0fed047 fix: 在处理 file uri 时可能会意外忽略 fragment 段
在处理类似 C:\\test\\test#1.txt 时 #1.txt 由于为 url fragment 而被意外截断
2024-11-07 16:10:59 +08:00
kanocence 40be6b9c43 Merge branch 'NapNeko:main' into main 2024-11-07 15:34:19 +08:00
kanocence a06b3f0246 feat: 💄 修改页面样式 2024-11-07 15:33:57 +08:00
Mlikiowa 4787fa53b4 release: v3.6.3 2024-11-07 04:16:13 +00:00
手瓜一十雪 a06158bf01 fix: 标准化接口
Build Release / check-version (push) Canceled after 0s
Build Release / Build-LiteLoader (push) Canceled after 0s
Build Release / Build-Shell (push) Canceled after 0s
Build Release / release-napcat (push) Canceled after 0s
2024-11-07 12:15:49 +08:00
pk5ls20 314e7485b8 chore: format 2024-11-07 10:33:01 +08:00
pk5ls20 aed5d2d9f0 chore: log 2024-11-07 10:31:50 +08:00
pk5ls20 f44e48a28b fix: remove useless import 2024-11-06 16:58:12 +08:00
手瓜一十雪 38be90450c feat: 兼容gocq标准 2024-11-06 16:48:18 +08:00
手瓜一十雪 2dd57d7676 Merge branch 'main' of https://github.com/NapNeko/NapCatQQ 2024-11-06 16:45:04 +08:00
手瓜一十雪 6b3b163fa8 fix: 错误代码 2024-11-06 16:45:01 +08:00
Mlikiowa 9792ebafdc release: v3.6.2 2024-11-06 08:00:05 +00:00
手瓜一十雪 d10e7c37cb fix: link
Build Release / check-version (push) Canceled after 0s
Build Release / Build-LiteLoader (push) Canceled after 0s
Build Release / Build-Shell (push) Canceled after 0s
Build Release / release-napcat (push) Canceled after 0s
2024-11-06 15:59:39 +08:00
Mlikiowa d38f1853a4 release: v3.6.1 2024-11-06 06:42:33 +00:00
手瓜一十雪 bdec16266e fix: #498
Build Release / check-version (push) Canceled after 0s
Build Release / Build-LiteLoader (push) Canceled after 0s
Build Release / Build-Shell (push) Canceled after 0s
Build Release / release-napcat (push) Canceled after 0s
2024-11-06 14:42:05 +08:00
Mlikiowa 49ca698ab9 release: v3.6.0 2024-11-06 03:30:17 +00:00
39 changed files with 298 additions and 227 deletions

No files matched your search

-64
View File
@@ -1,64 +0,0 @@
module.exports = {
'env': {
'browser': true,
'es2021': true,
'node': true
},
'ignorePatterns': ['src/core/proto/'],
'extends': [
'eslint:recommended',
'plugin:@typescript-eslint/recommended'
],
'overrides': [
{
'env': {
'node': true
},
'files': [
'.eslintrc.{js,cjs}'
],
'parserOptions': {
'sourceType': 'script'
}
}
],
'parser': '@typescript-eslint/parser',
'parserOptions': {
'ecmaVersion': 'latest',
'sourceType': 'module'
},
'plugins': [
'@typescript-eslint',
'import'
],
'settings': {
'import/parsers': {
'@typescript-eslint/parser': ['.ts']
},
'import/resolver': {
'typescript': {
'alwaysTryTypes': true
}
}
},
'rules': {
'indent': [
'error',
4
],
'linebreak-style': [
'error',
'unix'
],
'semi': [
'error',
'always'
],
'no-unused-vars': 'off',
'no-async-promise-executor': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-var-requires': 'off',
'object-curly-spacing': ['error', 'always'],
}
};
-8
View File
@@ -127,10 +127,6 @@ jobs:
zip -q -r NapCat.Framework.Windows.Once.zip *
cd ..
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
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
@@ -147,8 +143,4 @@ jobs:
NapCat.Framework.zip
NapCat.Shell.zip
NapCat.Framework.Windows.Once.zip
napcat.packet.arm64
napcat.packet.exe
napcat.packet.linux
napcat.packet.production.py
draft: true
+4 -2
View File
@@ -9,14 +9,12 @@
NapCatQQ (aka 猫猫框架) 是现代化的基于 NTQQ 的 Bot 协议端实现
## 猫猫技能
- [x] **超高性能**:轻松数千群聊 独创消息队列
- [x] **启动方式**:支持以无头、LiteLoader 插件、仅 QQ GUI 三种方式启动
- [x] **覆盖平台**: 覆盖 Windows / Linux (可选 Docker) / Android Termux / MacOS
- [x] **安装简单**: 支持一键脚本/程序自动部署/镜像部署等多种覆盖范围
- [x] **超低占用**:无头模式占用资源极低,适合在服务器上运行
- [x] **超多接口**:实现大部分 OneBot 和 go-cqhttp 接口,超多扩展 API
- [x] **远程管理**:自带 WebUI 支持,远程管理更加便捷
- [x] **扩展支持**:基于 MoeHoo 的Native 可实现发包与收包
## 使用猫猫
@@ -32,6 +30,10 @@ NapCatQQ (aka 猫猫框架) 是现代化的基于 NTQQ 的 Bot 协议端实现
[Cloudflare.Pages](https://napneko.pages.dev/)
[Server.China](https://napneko.com/)
[Server.Other](https://napcat.cyou/)
[Github.IO](https://napneko.github.io/)
## 回家旅途
[QQ Group](https://qm.qq.com/q/VfjAq5HIMS)
+70
View File
@@ -0,0 +1,70 @@
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import _import from "eslint-plugin-import";
import { fixupPluginRules } from "@eslint/compat";
import globals from "globals";
import tsParser from "@typescript-eslint/parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";
const filename = fileURLToPath(import.meta.url);
const dirname = path.dirname(filename);
const compat = new FlatCompat({
baseDirectory: dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});
export default [{
ignores: ["src/core/proto/"],
}, ...compat.extends("eslint:recommended", "plugin:@typescript-eslint/recommended"), {
plugins: {
"@typescript-eslint": typescriptEslint,
import: fixupPluginRules(_import),
},
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
parser: tsParser,
ecmaVersion: "latest",
sourceType: "module",
},
settings: {
"import/parsers": {
"@typescript-eslint/parser": [".ts"],
},
"import/resolver": {
typescript: {
alwaysTryTypes: true,
},
},
},
rules: {
indent: ["error", 4],
semi: ["error", "always"],
"no-unused-vars": "off",
"no-async-promise-executor": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-var-requires": "off",
"object-curly-spacing": ["error", "always"],
},
}, {
files: ["**/.eslintrc.{js,cjs}"],
languageOptions: {
globals: {
...globals.node,
},
ecmaVersion: 5,
sourceType: "commonjs",
},
}];
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-102
View File
@@ -1,102 +0,0 @@
import asyncio #line:1
import datetime #line:2
import json #line:3
import hashlib #line:4
import sys #line:5
import websockets #line:6
import frida #line:7
clients ={}#line:9
event_loop =None #line:10
def generate_md5_hash (O000OO00OOO00O0OO :str )->str :#line:12
return hashlib .md5 (O000OO00OOO00O0OO .encode ()).hexdigest ()#line:13
async def on_message (O000O0000OO0O0000 ,O0O00OO0OOOO000O0 ):#line:15
try :#line:16
if O000O0000OO0O0000 ['type']=='send':#line:17
O000O0O00OO0O0OOO =O000O0000OO0O0000 ['payload']#line:18
if not O0O00OO0OOOO000O0 :#line:19
return #line:20
if O000O0O00OO0O0OOO ['type']=='recv':#line:21
await O0O00OO0OOOO000O0 .send (json .dumps ({"type":"recv","trace_id_md5":O000O0O00OO0O0OOO ['trace_id_md5'],"data":{"seq":O000O0O00OO0O0OOO ['seq'],"cmd":O000O0O00OO0O0OOO ['cmd'],"hex_data":O000O0O00OO0O0OOO ['hex_data']}}))#line:30
elif O000O0O00OO0O0OOO ['type']=='send':#line:31
print ("send data: ",O000O0O00OO0O0OOO )#line:32
await O0O00OO0OOOO000O0 .send (json .dumps ({"type":"send","trace_id_md5":O000O0O00OO0O0OOO ['trace_id_md5'],"data":{}}))#line:37
except Exception as O0O00O0O00O00OO0O :#line:38
print (f"Error in on_message: {O0O00O0O00O00OO0O}")#line:39
print (O000O0000OO0O0000 ['payload'])#line:40
def on_frida_message (OO0O00OOO00000OOO ,OOOOOO0OOO0OOO00O ,O0OO000OOOO00O000 ,O00O000OOO000O0O0 ):#line:42
asyncio .run_coroutine_threadsafe (on_message (OO0O00OOO00000OOO ,O0OO000OOOO00O000 ),O00O000OOO000O0O0 )#line:43
async def initialize_frida (OO000OOO000O0OO00 ,O00OOOO0O0OOOO000 ):#line:45
global clients ,event_loop #line:46
O0O0OOOO00O000O00 =int (OO000OOO000O0OO00 ['pid'])#line:47
O00OOO0O000O0OOO0 =hex (int (OO000OOO000O0OO00 ['recv'],16 )>>1 )#line:48
O0O000OO0O0OOOO00 =hex (int (OO000OOO000O0OO00 ['send'],16 )>>1 )#line:49
print ("init frida with pid: %d"%O0O0OOOO00O000O00 )#line:50
OO0OOO0OOOO000O00 =frida .attach (O0O0OOOO00O000O00 )#line:51
O0OOOOOOO0OO00O00 ="""
const _0x171b=['attach','toString','add','now','recv','event\x20add!','charCodeAt','readPointer','log','set','send','length','startsWith','push','wrapper.node','event\x20send!\x20','findBaseAddress','join','delete','stringify','current_time','sended','seq','readUtf8String','event\x20clear!\x20','trace_id','hook_send\x20napcat!\x20','input','readByteArray'];const _0x5b84=function(_0x171b04,_0x5b84f0){_0x171b04=_0x171b04-0x0;let _0x379e29=_0x171b[_0x171b04];return _0x379e29;};let offset_recv=FRIDA_RECV_OFFSET;let offset_send=FRIDA_SEND_OFFSET;let eventlist=new Map();let isListened=!![];recv(_0x5b84('0x1b'),_0x443b1a=>{isListened=![];if(_0x443b1a&&_0x443b1a[_0x5b84('0x19')]){_0x443b1a['sended']=![];console[_0x5b84('0x8')](_0x5b84('0x5'),JSON['stringify'](_0x443b1a,null,0x2));eventlist[_0x5b84('0x9')](_0x443b1a[_0x5b84('0x19')],_0x443b1a);send({'type':_0x5b84('0xa'),'trace_id_md5':_0x443b1a['trace_id_md5']});}let _0x53dd5f=Date[_0x5b84('0x3')]()/0x3e8;for(let [_0x5981c6,_0x5a5f37]of eventlist){if(_0x5a5f37[_0x5b84('0x14')]+0x3c<_0x53dd5f){console['log'](_0x5b84('0x18'),JSON['stringify'](_0x5a5f37,null,0x2));eventlist[_0x5b84('0x12')](_0x5981c6);}}});function bytesToHex(_0x317040){var _0x475d58=new Uint8Array(_0x317040);for(var _0x247ab6=[],_0x4f61a3=0x0;_0x4f61a3<_0x475d58[_0x5b84('0xb')];_0x4f61a3++){_0x247ab6[_0x5b84('0xd')]((_0x475d58[_0x4f61a3]>>>0x4)['toString'](0x10));_0x247ab6['push']((_0x475d58[_0x4f61a3]&0xf)[_0x5b84('0x1')](0x10));}return _0x247ab6[_0x5b84('0x11')]('');}function HexToBytes(_0x4a226e){var _0x335e51=[];for(var _0x46bc7a=0x0;_0x46bc7a<_0x4a226e['length'];_0x46bc7a+=0x2)_0x335e51[_0x5b84('0xd')](parseInt(_0x4a226e['substr'](_0x46bc7a,0x2),0x10));return _0x335e51;}function String2HexText(_0xba6082){var _0x20ceff=[];for(var _0x28780a=0x0;_0x28780a<_0xba6082['length'];_0x28780a++){_0x20ceff[_0x28780a]=_0xba6082[_0x5b84('0x6')](_0x28780a)['toString'](0x10);}return _0x20ceff[_0x5b84('0x11')]('');}async function main(){let _0x112236=Module[_0x5b84('0x10')]('wrapper.node');while(_0x112236==null){_0x112236=Module[_0x5b84('0x10')](_0x5b84('0xe'));}let _0xce97d=_0x112236['add'](offset_recv);console['log']('hook_recv\x20napcat!\x20');Interceptor[_0x5b84('0x0')](_0xce97d,{'onEnter'(_0x58d330){let _0x366bab=Memory['readPointer'](_0x58d330[0x1])['add'](0x20);let _0x4fc7ff=new Uint8Array(_0x366bab['readByteArray'](0x1))[0x0]&0x1;let _0x28a912=Memory['readPointer'](_0x58d330[0x1])['add'](0x18);let _0x13dd09=Memory[_0x5b84('0x7')](_0x58d330[0x1]);let _0x50360e=new Uint8Array(_0x13dd09[_0x5b84('0x1c')](0x1))[0x0]&0x1;let _0x196dbb=Memory['readPointer'](Memory['readPointer'](_0x58d330[0x1])[_0x5b84('0x2')](0x38));let _0x42cfc8=Memory['readPointer'](_0x196dbb);let _0xca3db8=Memory[_0x5b84('0x7')](_0x196dbb[_0x5b84('0x2')](0x8));let _0x21181a=_0xca3db8-_0x42cfc8;let _0x169a6e=_0x4fc7ff==0x0?Memory[_0x5b84('0x17')](_0x366bab['add'](0x1)):Memory['readUtf8String'](Memory[_0x5b84('0x7')](_0x366bab['add'](0x10)));let _0x3e9755=_0x50360e==0x0?Memory[_0x5b84('0x17')](_0x13dd09['add'](0x1)):Memory[_0x5b84('0x17')](Memory[_0x5b84('0x7')](_0x13dd09[_0x5b84('0x2')](0x10)));let _0x12eb97=Memory['readU32'](_0x28a912);let _0x177b45=bytesToHex(_0x42cfc8['readByteArray'](_0x21181a));let _0xb9a9db='';for(let [_0x7418bd,_0x53b726]of eventlist){if(_0x53b726[_0x5b84('0x16')]==_0x12eb97){_0xb9a9db=_0x53b726['trace_id_md5'];eventlist['delete'](_0x7418bd);break;}}send({'type':_0x5b84('0x4'),'trace_id_md5':_0xb9a9db,'seq':_0x12eb97,'hex_data':_0x177b45,'cmd':_0x169a6e});},'onLeave'(_0x18676d){}});let _0x50e030=_0x112236[_0x5b84('0x2')](offset_send);console['log'](_0x5b84('0x1a'));Interceptor[_0x5b84('0x0')](_0x50e030,{'onEnter'(_0x2c50e5){let _0x43ef68=Memory[_0x5b84('0x7')](_0x2c50e5[0x1])[_0x5b84('0x2')](0x40);let _0x11494e=Memory['readPointer'](_0x2c50e5[0x1])['add'](0x20);let _0x160870=new Uint8Array(_0x11494e['readByteArray'](0x1))[0x0]&0x1;let _0x48c8c0=Memory[_0x5b84('0x7')](Memory['readPointer'](_0x2c50e5[0x1]));let _0x551e15=new Uint8Array(_0x48c8c0['readByteArray'](0x1))[0x0]&0x1;let _0x3d1fb7=Memory[_0x5b84('0x7')](Memory['readPointer'](Memory[_0x5b84('0x7')](_0x2c50e5[0x1]))['add'](0x20));let _0x532d5f=Memory['readPointer'](_0x3d1fb7);let _0xc16bfa=Memory[_0x5b84('0x7')](_0x3d1fb7['add'](0x8));let _0x388601=_0xc16bfa-_0x532d5f;let _0x2f6658=_0x551e15==0x0?Memory['readUtf8String'](_0x48c8c0['add'](0x1)):Memory['readUtf8String'](Memory['readPointer'](_0x48c8c0['add'](0x10)));let _0xa730b0=_0x160870==0x0?Memory[_0x5b84('0x17')](_0x11494e['add'](0x1)):Memory['readUtf8String'](Memory['readPointer'](_0x11494e[_0x5b84('0x2')](0x10)));let _0xd6be27=Memory['readU32'](_0x43ef68);let _0x46ad70=bytesToHex(_0x532d5f[_0x5b84('0x1c')](_0x388601));for(let [_0xecd6b,_0x5390a3]of eventlist){if(_0x46ad70[_0x5b84('0xc')](String2HexText(_0x5390a3[_0x5b84('0x19')]))&&!_0x5390a3['sended']){_0x532d5f['writeByteArray'](HexToBytes(_0x5390a3['hex_data']));_0x5390a3[_0x5b84('0x15')]=!![];_0x5390a3[_0x5b84('0x16')]=_0xd6be27;console[_0x5b84('0xLine truncated
"""#line:55
O0OOOOOOO0OO00O00 =O0OOOOOOO0OO00O00 .replace ("FRIDA_RECV_OFFSET",O00OOO0O000O0OOO0 )#line:56
O0OOOOOOO0OO00O00 =O0OOOOOOO0OO00O00 .replace ("FRIDA_SEND_OFFSET",O0O000OO0O0OOOO00 )#line:57
OOO0000O00O0O0000 =OO0OOO0OOOO000O00 .create_script (O0OOOOOOO0OO00O00 )#line:58
OOO0000O00O0O0000 .on ('message',lambda O00OO0000O0OO000O ,O0O0000OO00OO0OO0 :on_frida_message (O00OO0000O0OO000O ,O0O0000OO00OO0OO0 ,O00OOOO0O0OOOO000 ,event_loop ))#line:59
OOO0000O00O0O0000 .load ()#line:60
clients [O00OOOO0O0OOOO000 ]={'pid':O0O0OOOO00O000O00 ,'frida_script':OOO0000O00O0O0000 ,'session':OO0OOO0OOOO000O00 }#line:66
await O00OOOO0O0OOOO000 .send (json .dumps ({"type":"init",'trace_id':'init',"data":{}}))#line:68
async def handle_send (OO0O00000O0000O00 ,O0O0000OOOOO00000 ):#line:70
global clients #line:71
OO0O00OO0OO0OOO0O =OO0O00000O0000O00 ['data']#line:72
OOOO00000O00OOO00 =OO0O00000O0000O00 ['trace_id']#line:73
O000O0000000O00O0 =OO0O00000O0000O00 ['cmd']#line:74
O00OOOO0OOOOO0O0O =int (datetime .datetime .now ().timestamp ())#line:75
O00OOO00000O000OO =clients [O0O0000OOOOO00000 ]['frida_script']#line:76
O00OOO00000O000OO .post ({'type':'input','cmd':O000O0000000O00O0 ,'hex_data':OO0O00OO0OO0OOO0O ,'trace_id':OOOO00000O00OOO00 ,'current_time':O00OOOO0OOOOO0O0O ,'trace_id_md5':generate_md5_hash (OOOO00000O00OOO00 )})#line:84
async def websocket_handler (O000OO0OO0OO0OO0O ,OO0O0OO0O00OOOO0O ):#line:86
global clients #line:87
try :#line:88
async for O0OOOOO0O00O0OO00 in O000OO0OO0OO0OO0O :#line:89
O00O0O0O000OO0O0O =json .loads (O0OOOOO0O00O0OO00 )#line:90
O000O0000O00OO00O =O00O0O0O000OO0O0O .get ('action')#line:91
if O000O0000O00OO00O =='init':#line:92
O0OO0000OOOOO000O =False #line:93
for OO00OO000O00O0OOO in frida .get_local_device ().enumerate_processes ():#line:94
if OO00OO000O00O0OOO .pid ==clients .get (O000OO0OO0OO0OO0O ,{}).get ('pid'):#line:95
O0OO0000OOOOO000O =True #line:96
if not O0OO0000OOOOO000O :#line:97
await initialize_frida (O00O0O0O000OO0O0O ,O000OO0OO0OO0OO0O )#line:98
elif O000O0000O00OO00O =='send'and O000OO0OO0OO0OO0O in clients :#line:99
await handle_send (O00O0O0O000OO0O0O ,O000OO0OO0OO0OO0O )#line:100
except Exception as O0OOOO0O00O000O0O :#line:101
print (f"WebSocket connection closed: {O0OOOO0O00O000O0O}")#line:102
finally :#line:103
if O000OO0OO0OO0OO0O in clients :#line:104
clients [O000OO0OO0OO0OO0O ]['session'].detach ()#line:105
del clients [O000OO0OO0OO0OO0O ]#line:106
async def main ():#line:108
global event_loop #line:109
event_loop =asyncio .get_running_loop ()#line:110
OOOOOO0OOO0000O0O =None #line:111
OOO000OO0O0OOOO00 =None #line:112
if '-ip'in sys .argv and '-port'in sys .argv :#line:114
O00000OOO00OO000O =sys .argv .index ('-ip')+1 #line:115
OOO0O00O0OO0000OO =sys .argv .index ('-port')+1 #line:116
if O00000OOO00OO000O <len (sys .argv )and OOO0O00O0OO0000OO <len (sys .argv ):#line:117
OOOOOO0OOO0000O0O =sys .argv [O00000OOO00OO000O ]#line:118
OOO000OO0O0OOOO00 =int (sys .argv [OOO0O00O0OO0000OO ])#line:119
if OOOOOO0OOO0000O0O is None or OOO000OO0O0OOOO00 is None :#line:121
O0OOOOOO0OO0O0OO0 =read_config ()#line:122
OOOOOO0OOO0000O0O =O0OOOOOO0OO0O0OO0 ['ip']#line:123
OOO000OO0O0OOOO00 =O0OOOOOO0OO0O0OO0 ['port']#line:124
print ("listen...",OOOOOO0OOO0000O0O ,OOO000OO0O0OOOO00 )#line:126
async with websockets .serve (websocket_handler ,OOOOOO0OOO0000O0O ,OOO000OO0O0OOOO00 ):#line:127
await asyncio .get_running_loop ().create_future ()#line:128
def read_config ():#line:130
try :#line:131
with open ("config.json","r")as OO0O0O00OOOOO0OO0 :#line:132
O0O00O0OO00O00000 =json .load (OO0O0O00OOOOO0OO0 )#line:133
except FileNotFoundError :#line:134
O0O00O0OO00O00000 ={"ip":"127.0.0.1","port":8086 }#line:135
with open ("config.json","w")as OO0O0O00OOOOO0OO0 :#line:136
OO0O0O00OOOOO0OO0 .write (json .dumps (O0O00O0OO00O00000 ))#line:137
return O0O00O0OO00O00000 #line:138
if __name__ =='__main__':#line:140
asyncio .run (main ())
+32
View 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
View 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
+5 -5
View File
@@ -1,9 +1,9 @@
{
"name": "qq-chat",
"version": "9.9.16-28788",
"verHash": "73b0c8f6",
"linuxVersion": "3.2.13-28788",
"linuxVerHash": "55fb6434",
"version": "9.9.16-29456",
"verHash": "dd395162",
"linuxVersion": "3.2.13-29456",
"linuxVerHash": "e379390a",
"type": "module",
"private": true,
"description": "QQ",
@@ -18,7 +18,7 @@
"qd": "externals/devtools/cli/index.js"
},
"main": "./loadNapCat.js",
"buildVersion": "28788",
"buildVersion": "29456",
"isPureShell": true,
"isByteCodeShell": true,
"platform": "win32",
+1 -1
View File
@@ -4,7 +4,7 @@
"name": "NapCatQQ",
"slug": "NapCat.Framework",
"description": "高性能的 OneBot 11 协议实现",
"version": "3.5.2",
"version": "3.6.12",
"icon": "./logo.png",
"authors": [
{
+7 -2
View File
@@ -2,7 +2,7 @@
"name": "napcat",
"private": true,
"type": "module",
"version": "3.5.2",
"version": "3.6.12",
"scripts": {
"build:framework": "vite build --mode framework",
"build:shell": "vite build --mode shell",
@@ -12,6 +12,9 @@
},
"devDependencies": {
"@babel/preset-typescript": "^7.24.7",
"@eslint/compat": "^1.2.2",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.14.0",
"@log4js-node/log4js-api": "^1.0.2",
"@napneko/nap-proto-core": "^0.0.2",
"@protobuf-ts/runtime": "^2.9.4",
@@ -30,14 +33,16 @@
"chalk": "^5.3.0",
"commander": "^12.1.0",
"cors": "^2.8.5",
"eslint": "^8.57.0",
"eslint": "^9.14.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.1",
"fast-xml-parser": "^4.3.6",
"file-type": "^19.0.0",
"globals": "^15.12.0",
"image-size": "^1.1.1",
"json-schema-to-ts": "^3.1.1",
"typescript": "^5.3.3",
"typescript-eslint": "^8.13.0",
"vite": "^5.2.6",
"vite-plugin-cp": "^4.0.8",
"vite-tsconfig-paths": "^5.1.0"
+1 -1
View File
@@ -215,7 +215,7 @@ export async function checkUriType(Uri: string) {
}
if (uri.startsWith('file://')) {
let filePath: string;
const pathname = decodeURIComponent(new URL(uri).pathname);
const pathname = decodeURIComponent(new URL(uri).pathname + new URL(uri).hash);
if (process.platform === 'win32') {
filePath = pathname.slice(1);
} else {
+1 -1
View File
@@ -1 +1 @@
export const napCatVersion = '3.5.2';
export const napCatVersion = '3.6.12';
+11 -7
View File
@@ -175,14 +175,18 @@ export class NTQQFileApi {
const thumbPath = pathLib.join(thumb, thumbFileName);
ffmpeg(filePath)
.on('error', (err) => {
logger.logDebug('获取视频封面失败,使用默认封面', err);
if (diyThumbPath) {
fsPromises.copyFile(diyThumbPath, thumbPath).then(() => {
try {
logger.logDebug('获取视频封面失败,使用默认封面', err);
if (diyThumbPath) {
fsPromises.copyFile(diyThumbPath, thumbPath).then(() => {
resolve(thumbPath);
}).catch(reject);
} else {
fs.writeFileSync(thumbPath, Buffer.from(defaultVideoThumbB64, 'base64'));
resolve(thumbPath);
}).catch(reject);
} else {
fs.writeFileSync(thumbPath, Buffer.from(defaultVideoThumbB64, 'base64'));
resolve(thumbPath);
}
} catch (error) {
logger.logError.bind(logger)('获取视频封面失败,使用默认封面失败', error);
}
})
.screenshots({
+7 -6
View File
@@ -375,8 +375,10 @@ export class NTQQGroupApi {
};
}
async getGroupMembersV2(groupQQ: string, num = 3000): Promise<Map<string, GroupMember>> {
//console.log('getGroupMembers -->', groupQQ);
async getGroupMembersV2(groupQQ: string, num = 3000, no_cache: boolean = false): Promise<Map<string, GroupMember>> {
if (no_cache) {
return (await this.getGroupMemberAll(groupQQ, true)).result.infos;
}
let res = await this.GetGroupMembersV3(groupQQ, num);
let ret = res.infos;
if (res.infos.size === 0 && !res.listenerMode) {
@@ -386,14 +388,13 @@ export class NTQQGroupApi {
if (res.infos.size === 0) {
ret = (await this.getGroupMemberAll(groupQQ)).result.infos;
}
//console.log("<---------------")
return ret;
}
async getGroupMembers(groupQQ: string, num = 3000): Promise<Map<string, GroupMember>> {
const groupService = this.context.session.getGroupService();
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) {
throw new Error('获取群成员列表出错,' + result.errMsg);
}
@@ -401,8 +402,8 @@ export class NTQQGroupApi {
return result.result.infos;
}
async getGroupFileCount(Gids: Array<string>) {
return this.context.session.getRichMediaService().batchGetGroupFileCount(Gids);
async getGroupFileCount(group_ids: Array<string>) {
return this.context.session.getRichMediaService().batchGetGroupFileCount(group_ids);
}
async getArkJsonGroupShare(GroupCode: string) {
+4 -2
View File
@@ -25,6 +25,7 @@ import { OidbSvcTrpcTcp0X929B_0Resp, OidbSvcTrpcTcp0X929D_0Resp } from "@/core/p
import { IndexNode, MsgInfo } from "@/core/packet/proto/oidb/common/Ntv2.RichMediaReq";
import { NTV2RichMediaResp } from "@/core/packet/proto/oidb/common/Ntv2.RichMediaResp";
import { RecvPacketData } from "@/core/packet/client/client";
import { napCatVersion } from "@/common/version";
interface OffsetType {
@@ -61,11 +62,12 @@ export class NTQQPacketApi {
this.qqVersion = qqversion;
const table = typedOffset[qqversion + '-' + os.arch()];
if (!table) {
this.logger.logError('[Core] [Packet] PacketServer Offset table not found for QQVersion: ', qqversion + '-' + os.arch());
this.logger.logError(`[Core] [Packet] PacketBackend 不支持当前QQ版本架构:${qqversion}-${os.arch()},
请参照 https://github.com/NapNeko/NapCatQQ/releases/tag/v${napCatVersion} 配置正确的QQ版本!`);
return false;
}
if (this.core.configLoader.configData.packetBackend === 'disable') {
this.logger.logWarn('[Core] [Packet] 已禁用Packet后端,NapCat.Packet将不会加载!');
this.logger.logWarn('[Core] [Packet] 已禁用PacketBackend,NapCat.Packet将不会加载!');
return false;
}
this.packetSession = new PacketSession(this.core);
+1 -1
View File
@@ -283,7 +283,7 @@ export class NTQQWebApi {
this.context.logger.logError.bind(this.context.logger)('获取群聊之火失败');
}
}
if (getType === WebHonorType.PERFORMER || getType === WebHonorType.ALL) {
if (getType === WebHonorType.LEGEND || getType === WebHonorType.ALL) {
const RetInternal = await getDataInternal(groupCode, 3);
if (RetInternal) {
HonorInfo.legend_list = [];
+13 -1
View File
@@ -74,5 +74,17 @@
"6.9.59-29271": {
"appid": 537249863,
"qua": "V1_MAC_NQ_6.9.59_29271_GW_B"
},
"9.9.16-29456": {
"appid": 537249875,
"qua": "V1_WIN_NQ_9.9.16_29456_GW_B"
},
"3.2.13-29456": {
"appid": 537249996,
"qua": "V1_LNX_NQ_3.2.13_29456_GW_B"
},
"6.9.59-29456": {
"appid": 537249961,
"qua": "V1_MAC_NQ_6.9.59_29456_GW_B"
}
}
}
+34 -6
View File
@@ -1,8 +1,4 @@
{
"6.9.56-28418-arm64": {
"send": "4471360",
"recv": "4473BCC"
},
"3.2.12-28418-x64": {
"recv": "A0723E0",
"send": "A06EAE0"
@@ -11,6 +7,14 @@
"recv": "37A9004",
"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": {
"recv": "37A9004",
"send": "37A4BD0"
@@ -39,10 +43,14 @@
"send": "6E91318",
"recv": "6E94B50"
},
"6.9.58-28971-arm64": {
"6.9.58-28971-x64": {
"send": "449ACA0",
"recv": "449D50C"
},
"6.9.58-28971-arm64": {
"send": "3FE0DB0",
"recv": "3FE35C8"
},
"9.9.16-29271-x64": {
"send": "3833510",
"recv": "3837944"
@@ -54,5 +62,25 @@
"3.2.13-29271-arm64": {
"send": "6ECA098",
"recv": "6ECD8D0"
},
"9.9.16-29456-x64": {
"send": "3835CD0",
"recv": "383A104"
},
"3.2.13-29456-x64": {
"send": "A11E820",
"recv": "A122120"
},
"3.2.13-29456-arm64": {
"send": "6ECA130",
"recv": "6ECD968"
},
"6.9.59-29456-x64": {
"send": "44C57A0",
"recv": "44C800C"
},
"6.9.59-29456-arm64": {
"send": "4005FE8",
"recv": "4008800"
}
}
}
+2 -2
View File
@@ -1,4 +1,4 @@
import { ChatType, RawMessage } from '@/core/entities';
import { ChatType, KickedOffLineInfo, RawMessage } from '@/core/entities';
import { CommonFileInfo } from '@/core';
export interface OnRichMediaDownloadCompleteParams {
@@ -212,7 +212,7 @@ export class NodeIKernelMsgListener {
}
onKickedOffLine(kickedInfo: unknown) {
onKickedOffLine(kickedInfo: KickedOffLineInfo) {
}
+1 -1
View File
@@ -45,7 +45,7 @@ export class PacketSession {
client = this.judgeClient(core);
break;
default:
this.logger.logError(`[Core] [Packet] 未知的Packet后端类型 ${prefer},请检查配置文件!`);
this.logger.logError(`[Core] [Packet] 未知的PacketBackend ${prefer},请检查配置文件!`);
client = null;
}
if (!(client && client.check(core))) {
Binary file not shown.
Binary file not shown.
+5 -2
View File
@@ -5,7 +5,7 @@ import { FromSchema, JSONSchema } from 'json-schema-to-ts';
const SchemaData = {
type: 'object',
properties: {
group_id: { type: 'string' },
group_id: { type: ['string', 'number'] },
},
required: ['group_id'],
} as const satisfies JSONSchema;
@@ -17,6 +17,9 @@ export class SetGroupSign extends BaseAction<Payload, any> {
payloadSchema = SchemaData;
async _handle(payload: Payload) {
return await this.core.apis.PacketApi.sendGroupSignPacket(payload.group_id);
return await this.core.apis.PacketApi.sendGroupSignPacket(payload.group_id.toString());
}
}
export class SendGroupSign extends SetGroupSign {
actionName = ActionName.SendGroupSign;
}
@@ -6,10 +6,15 @@ const SchemaData = {
type: 'object',
properties: {
friend_id: { type: ['string', 'number'] },
user_id: { type: ['string', 'number'] },
temp_block: { type: 'boolean' },
temp_both_del: { type: 'boolean' },
},
required: ['friend_id'],
oneOf: [
{ required: ['friend_id'] },
{ required: ['user_id'] },
],
} as const satisfies JSONSchema;
type Payload = FromSchema<typeof SchemaData>;
@@ -18,7 +23,8 @@ export class GoCQHTTPDeleteFriend extends BaseAction<Payload, any> {
payloadSchema = SchemaData;
async _handle(payload: Payload) {
const uid = await this.core.apis.UserApi.getUidByUinV2(payload.friend_id.toString());
const uin = payload.friend_id ?? payload.user_id ?? '';
const uid = await this.core.apis.UserApi.getUidByUinV2(uin.toString());
if (!uid) {
return {
@@ -42,7 +42,7 @@ export default class GoCQHTTPUploadGroupFile extends BaseAction<Payload, null> {
deleteAfterSentFiles: []
};
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;
}
}
@@ -53,7 +53,7 @@ export default class GoCQHTTPUploadPrivateFile extends BaseAction<Payload, null>
deleteAfterSentFiles: []
};
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;
}
}
-2
View File
@@ -2,8 +2,6 @@ import { ActionName } from '../types';
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
import { GetPacketStatusDepends } from "@/onebot/action/packet/GetPacketStatus";
import { AIVoiceChatType } from "@/core/packet/entities/aiChat";
import { NapProtoEncodeStructType } from "@/core/packet/proto/NapProto";
import { IndexNode } from "@/core/packet/proto/oidb/common/Ntv2.RichMediaReq";
const SchemaData = {
type: 'object',
@@ -24,12 +24,11 @@ export class GetGroupMemberList extends BaseAction<Payload, OB11GroupMember[]> {
const noCache = payload.no_cache ? this.stringToBoolean(payload.no_cache) : false;
const memberCache = this.core.apis.GroupApi.groupMemberCache;
let groupMembers;
if (noCache) {
groupMembers = await this.core.apis.GroupApi.getGroupMembersV2(groupIdStr);
} else {
try {
groupMembers = await this.core.apis.GroupApi.getGroupMembersV2(groupIdStr, 3000, noCache);
} catch (error) {
groupMembers = memberCache.get(groupIdStr) ?? await this.core.apis.GroupApi.getGroupMembersV2(groupIdStr);
}
const memberPromises = Array.from(groupMembers.values()).map(item =>
OB11Entities.groupMember(groupIdStr, item)
);
+2 -1
View File
@@ -92,7 +92,7 @@ import { GetGroupFileUrl } from "@/onebot/action/file/GetGroupFileUrl";
import { GetPacketStatus } from "@/onebot/action/packet/GetPacketStatus";
import { FriendPoke } from "@/onebot/action/user/FriendPoke";
import { GetCredentials } from './system/GetCredentials';
import { SetGroupSign } from './extends/SetGroupSign';
import { SendGroupSign, SetGroupSign } from './extends/SetGroupSign';
import { GoCQHTTPGetGroupAtAllRemain } from './go-cqhttp/GetGroupAtAllRemain';
import { GoCQHTTPCheckUrlSafely } from './go-cqhttp/GoCQHTTPCheckUrlSafely';
import { GoCQHTTPGetModelShow } from './go-cqhttp/GoCQHTTPGetModelShow';
@@ -125,6 +125,7 @@ export function createActionMap(obContext: NapCatOneBot11Adapter, core: NapCatCo
new TranslateEnWordToZn(obContext, core),
new GetGroupRootFiles(obContext, core),
new SetGroupSign(obContext, core),
new SendGroupSign(obContext, core),
// onebot11
new SendLike(obContext, core),
new GetMsg(obContext, core),
+12
View File
@@ -2,12 +2,14 @@ import { ChatType, Peer } from '@/core/entities';
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
import BaseAction from '../BaseAction';
import { ActionName } from '../types';
import { MessageUnique } from '@/common/message-unique';
const SchemaData = {
type: 'object',
properties: {
user_id: { type: ['number', 'string'] },
group_id: { type: ['number', 'string'] },
message_id: { type: ['number', 'string'] },
},
} as const satisfies JSONSchema;
@@ -15,6 +17,16 @@ type PlayloadType = FromSchema<typeof SchemaData>;
class MarkMsgAsRead extends BaseAction<PlayloadType, null> {
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) {
const peerUid = await this.core.apis.UserApi.getUidByUinV2(payload.user_id.toString());
if (!peerUid) {
+2
View File
@@ -136,6 +136,8 @@ export enum ActionName {
GetGroupIgnoredNotifies = 'get_group_ignored_notifies',
SetGroupSign = "set_group_sign",
SendGroupSign = "send_group_sign",
GetMiniAppArk = "get_mini_app_ark",
// UploadForwardMsg = "upload_forward_msg",
GetAiRecord = "get_ai_record",
@@ -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;
}
}
+6 -1
View File
@@ -47,6 +47,7 @@ import { LRUCache } from '@/common/lru-cache';
import { NodeIKernelRecentContactListener } from '@/core/listeners/NodeIKernelRecentContactListener';
import { Native } from '@/native';
import { decodeMessage, decodeRecallGroup } from '@/core/packet/proto/old/Message';
import { BotOfflineEvent } from './event/notice/BotOfflineEvent';
//OneBot实现类
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(
proxiedListenerOf(msgListener, this.context.logger),
);
+1 -1
View File
@@ -164,7 +164,7 @@ async function onSettingWindowCreated(view) {
SettingItem(
'<span id="napcat-update-title">Napcat</span>',
void 0,
SettingButton("V3.5.2", "napcat-update-button", "secondary")
SettingButton("V3.6.12", "napcat-update-button", "secondary")
)
]),
SettingList([
+14
View File
@@ -10,6 +10,20 @@
<link rel="stylesheet" href="./assets/webcomponents.css" />
<link rel="stylesheet" href="./assets/style.css" />
<link rel="stylesheet" href="./assets/color.css" />
<style>
body > div {
padding: 12px;
@media screen and (min-width: 900px) {
width: 900px;
margin: 0 auto;
}
}
ob-setting-select {
width: 210px;
}
</style>
<!-- 脚手架 -->
<!-- 渲染脚本 -->
<script>