mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
8569a45114 | ||
![]() |
c790311fc3 | ||
![]() |
3c45c8bd80 | ||
![]() |
d5b7b3ae31 | ||
![]() |
43e73a5f24 | ||
![]() |
f3d967ae07 | ||
![]() |
dbe72fa07e | ||
![]() |
8fe37d1c1e | ||
![]() |
31365505d8 | ||
![]() |
b3fbe9e34a | ||
![]() |
5190b26399 | ||
![]() |
29a8db96f4 | ||
![]() |
1a4c2cabfd | ||
![]() |
ef9189055c | ||
![]() |
5cc3719125 |
@@ -1,5 +1,7 @@
|
||||
<div align="center">
|
||||
<img src="https://socialify.git.ci/NapNeko/NapCatQQ/image?font=Jost&logo=https%3A%2F%2Fnapneko.github.io%2Fassets%2Flogo.png&name=1&owner=1&pattern=Diagonal%20Stripes&stargazers=1&theme=Auto" alt="NapCatQQ" width="640" height="320" />
|
||||
|
||||

|
||||
|
||||
</div>
|
||||
|
||||
---
|
||||
|
@@ -4,7 +4,7 @@
|
||||
"name": "NapCatQQ",
|
||||
"slug": "NapCat.Framework",
|
||||
"description": "高性能的 OneBot 11 协议实现",
|
||||
"version": "3.1.2",
|
||||
"version": "3.1.5",
|
||||
"icon": "./logo.png",
|
||||
"authors": [
|
||||
{
|
||||
|
28
package.json
28
package.json
@@ -2,7 +2,7 @@
|
||||
"name": "napcat",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"version": "3.1.2",
|
||||
"version": "3.1.5",
|
||||
"scripts": {
|
||||
"build:framework": "vite build --mode framework",
|
||||
"build:shell": "vite build --mode shell",
|
||||
@@ -13,6 +13,7 @@
|
||||
"devDependencies": {
|
||||
"@babel/preset-typescript": "^7.24.7",
|
||||
"@log4js-node/log4js-api": "^1.0.2",
|
||||
"@protobuf-ts/runtime": "^2.9.4",
|
||||
"@rollup/plugin-node-resolve": "^15.2.3",
|
||||
"@rollup/plugin-typescript": "^11.1.6",
|
||||
"@types/cors": "^2.8.17",
|
||||
@@ -23,29 +24,28 @@
|
||||
"@types/ws": "^8.5.12",
|
||||
"@typescript-eslint/eslint-plugin": "^8.3.0",
|
||||
"@typescript-eslint/parser": "^8.3.0",
|
||||
"ajv": "^8.13.0",
|
||||
"async-mutex": "^0.5.0",
|
||||
"chalk": "^5.3.0",
|
||||
"commander": "^12.1.0",
|
||||
"cors": "^2.8.5",
|
||||
"eslint": "^8.57.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",
|
||||
"image-size": "^1.1.1",
|
||||
"json-schema-to-ts": "^3.1.1",
|
||||
"typescript": "^5.3.3",
|
||||
"vite": "^5.2.6",
|
||||
"vite-plugin-cp": "^4.0.8",
|
||||
"vite-tsconfig-paths": "^4.3.2",
|
||||
"@protobuf-ts/runtime": "^2.9.4",
|
||||
"ajv": "^8.13.0",
|
||||
"fast-xml-parser": "^4.3.6",
|
||||
"chalk": "^5.3.0",
|
||||
"commander": "^12.1.0",
|
||||
"async-mutex": "^0.5.0",
|
||||
"file-type": "^19.0.0",
|
||||
"json-schema-to-ts": "^3.1.1",
|
||||
"image-size": "^1.1.1",
|
||||
"cors": "^2.8.5"
|
||||
"vite-tsconfig-paths": "^4.3.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"qrcode-terminal": "^0.12.0",
|
||||
"fluent-ffmpeg": "^2.1.2",
|
||||
"express": "^5.0.0-beta.2",
|
||||
"fluent-ffmpeg": "^2.1.2",
|
||||
"log4js": "^6.9.1",
|
||||
"qrcode-terminal": "^0.12.0",
|
||||
"silk-wasm": "^3.6.1",
|
||||
"ws": "^8.18.0"
|
||||
}
|
||||
|
@@ -1 +1 @@
|
||||
export const napCatVersion = '3.1.2';
|
||||
export const napCatVersion = '3.1.5';
|
||||
|
@@ -30,7 +30,7 @@ export class NTQQFileApi {
|
||||
context: InstanceContext;
|
||||
core: NapCatCore;
|
||||
rkeyManager: RkeyManager;
|
||||
packetRkey: Array<{ rkey: string; time: number; type: number; }> | undefined;
|
||||
packetRkey: Array<{ rkey: string; time: number; type: number; ttl: bigint }> | undefined;
|
||||
|
||||
constructor(context: InstanceContext, core: NapCatCore) {
|
||||
this.context = context;
|
||||
@@ -378,10 +378,12 @@ export class NTQQFileApi {
|
||||
};
|
||||
try {
|
||||
if (this.core.apis.PacketApi.available) {
|
||||
if ((!this.packetRkey || this.packetRkey[0].time > Date.now() / 1000)) {
|
||||
let rkey_expired_private = !this.packetRkey || this.packetRkey[0].time + Number(this.packetRkey[0].ttl) < Date.now() / 1000;
|
||||
let rkey_expired_group = !this.packetRkey || this.packetRkey[0].time + Number(this.packetRkey[0].ttl) < Date.now() / 1000;
|
||||
if (rkey_expired_private || rkey_expired_group) {
|
||||
this.packetRkey = await this.core.apis.PacketApi.sendRkeyPacket();
|
||||
}
|
||||
if (this.packetRkey.length > 0) {
|
||||
if (this.packetRkey && this.packetRkey.length > 0) {
|
||||
rkeyData.group_rkey = this.packetRkey[1].rkey.slice(6);
|
||||
rkeyData.private_rkey = this.packetRkey[0].rkey.slice(6);
|
||||
rkeyData.online_rkey = true;
|
||||
|
@@ -86,7 +86,10 @@ export class NTQQPacketApi {
|
||||
const retData = new NapProtoMsg(OidbSvcTrpcTcp0X9067_202_Rsp_Body).decode(body);
|
||||
return retData.data.rkeyList;
|
||||
}
|
||||
|
||||
async sendGroupSignPacket(groupCode: string) {
|
||||
const packet = this.packetSession?.packer.packGroupSignReq(this.core.selfInfo.uin, groupCode);
|
||||
await this.sendPacket('OidbSvcTrpcTcp.0xeb7', packet!, true);
|
||||
}
|
||||
async sendStatusPacket(uin: number): Promise<{ status: number; ext_status: number; } | undefined> {
|
||||
let status = 0;
|
||||
try {
|
||||
|
8
src/core/external/appid.json
vendored
8
src/core/external/appid.json
vendored
@@ -50,5 +50,13 @@
|
||||
"9.9.16-28788": {
|
||||
"appid": 537249739,
|
||||
"qua": "V1_WIN_NQ_9.9.16_28788_GW_B"
|
||||
},
|
||||
"9.9.16-28971":{
|
||||
"appid": 537249775,
|
||||
"qua": "V1_WIN_NQ_9.9.16_28971_GW_B"
|
||||
},
|
||||
"3.2.13-28971": {
|
||||
"appid": 537249848,
|
||||
"qua": "V1_LNX_NQ_3.2.13_28971_GW_B"
|
||||
}
|
||||
}
|
6
src/core/external/offset.json
vendored
6
src/core/external/offset.json
vendored
@@ -19,8 +19,12 @@
|
||||
"send": "A0CEC20",
|
||||
"recv": "A0D2520"
|
||||
},
|
||||
"3.2.13-28788-arm64":{
|
||||
"3.2.13-28788-arm64": {
|
||||
"send": "6E91018",
|
||||
"recv": "6E94850"
|
||||
},
|
||||
"9.9.16-28971-x64": {
|
||||
"send": "38079F0",
|
||||
"recv": "380BE24"
|
||||
}
|
||||
}
|
@@ -18,6 +18,7 @@ import { OidbSvcTrpcTcp0x6D6 } from "@/core/packet/proto/oidb/Oidb.0x6D6";
|
||||
import { OidbSvcTrpcTcp0XE37_1200 } from "@/core/packet/proto/oidb/Oidb.0xE37_1200";
|
||||
import { PacketMsgConverter } from "@/core/packet/msg/converter";
|
||||
import { PacketClient } from "@/core/packet/client";
|
||||
import { OidbSvcTrpcTcp0XEB7 } from "./proto/oidb/Oidb.0xEB7";
|
||||
|
||||
export type PacketHexStr = string & { readonly hexNya: unique symbol };
|
||||
|
||||
@@ -321,4 +322,17 @@ export class PacketPacker {
|
||||
})
|
||||
);
|
||||
}
|
||||
packGroupSignReq(uin: string, groupCode: string): PacketHexStr {
|
||||
return this.toHexStr(
|
||||
this.packOidbPacket(0XEB7, 1, new NapProtoMsg(OidbSvcTrpcTcp0XEB7).encode(
|
||||
{
|
||||
body: {
|
||||
uin: uin,
|
||||
groupUin: groupCode,
|
||||
version: "9.0.90"
|
||||
}
|
||||
}
|
||||
), false, false)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -14,6 +14,7 @@ export const OidbSvcTrpcTcp0X9067_202Key = {
|
||||
//Rsp
|
||||
export const OidbSvcTrpcTcp0X9067_202_RkeyList = {
|
||||
rkey: ProtoField(1, ScalarType.STRING),
|
||||
ttl: ProtoField(2, ScalarType.UINT64),
|
||||
time: ProtoField(4, ScalarType.UINT32),
|
||||
type: ProtoField(5, ScalarType.UINT32),
|
||||
|
||||
|
12
src/core/packet/proto/oidb/Oidb.0xEB7.ts
Normal file
12
src/core/packet/proto/oidb/Oidb.0xEB7.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { ScalarType } from "@protobuf-ts/runtime";
|
||||
import { ProtoField } from "../NapProto";
|
||||
|
||||
export const OidbSvcTrpcTcp0XEB7_Body = {
|
||||
uin: ProtoField(1, ScalarType.STRING),
|
||||
groupUin: ProtoField(2, ScalarType.STRING),
|
||||
version: ProtoField(3, ScalarType.STRING),
|
||||
};
|
||||
|
||||
export const OidbSvcTrpcTcp0XEB7 = {
|
||||
body: ProtoField(2, () => OidbSvcTrpcTcp0XEB7_Body),
|
||||
}
|
@@ -239,7 +239,7 @@ export interface NodeIKernelGroupService {
|
||||
|
||||
setMemberShutUp(groupCode: string, memberTimes: { uid: string, timeStamp: number }[]): Promise<void>;
|
||||
|
||||
getGroupRecommendContactArkJson(groupCode: string): unknown;
|
||||
getGroupRecommendContactArkJson(groupCode: string): Promise<GeneralCallResult & { arkJson: string }>;
|
||||
|
||||
getJoinGroupLink(param: {
|
||||
groupCode: string,
|
||||
|
22
src/onebot/action/extends/SetGroupSign.ts
Normal file
22
src/onebot/action/extends/SetGroupSign.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { ActionName } from '../types';
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
|
||||
const SchemaData = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
group_id: { type: 'string' },
|
||||
},
|
||||
required: ['group_id'],
|
||||
} as const satisfies JSONSchema;
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export class SetGroupSign extends BaseAction<Payload, any> {
|
||||
actionName = ActionName.SetGroupSign;
|
||||
payloadSchema = SchemaData;
|
||||
|
||||
async _handle(payload: Payload) {
|
||||
return await this.core.apis.PacketApi.sendGroupSignPacket(payload.group_id);
|
||||
}
|
||||
}
|
@@ -93,6 +93,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';
|
||||
|
||||
|
||||
export type ActionMap = Map<string, BaseAction<any, any>>;
|
||||
@@ -115,6 +116,7 @@ export function createActionMap(obContext: NapCatOneBot11Adapter, core: NapCatCo
|
||||
new SetQQAvatar(obContext, core),
|
||||
new TranslateEnWordToZn(obContext, core),
|
||||
new GetGroupRootFiles(obContext, core),
|
||||
new SetGroupSign(obContext, core),
|
||||
// onebot11
|
||||
new SendLike(obContext, core),
|
||||
new GetMsg(obContext, core),
|
||||
|
@@ -105,11 +105,6 @@ export enum ActionName {
|
||||
ForwardFriendSingleMsg = 'forward_friend_single_msg',
|
||||
ForwardGroupSingleMsg = 'forward_group_single_msg',
|
||||
TranslateEnWordToZn = 'translate_en2zh',
|
||||
GetGroupFileCount = 'get_group_file_count',
|
||||
GetGroupFileList = 'get_group_file_list',
|
||||
SetGroupFileFolder = 'set_group_file_folder',
|
||||
DelGroupFile = 'del_group_file',
|
||||
DelGroupFileFolder = 'del_group_file_folder',
|
||||
SetMsgEmojiLike = 'set_msg_emoji_like',
|
||||
GoCQHTTP_SendForwardMsg = 'send_forward_msg',
|
||||
MarkPrivateMsgAsRead = 'mark_private_msg_as_read',
|
||||
@@ -125,7 +120,7 @@ export enum ActionName {
|
||||
FetchEmojiLike = 'fetch_emoji_like',
|
||||
SetInputStatus = 'set_input_status',
|
||||
GetGroupInfoEx = 'get_group_info_ex',
|
||||
GetGroupIgnoredNotifies = 'get_group_ignored_notifies',
|
||||
GetGroupIgnoreAddRequest = 'get_group_ignore_add_request',
|
||||
DelGroupNotice = '_del_group_notice',
|
||||
FetchUserProfileLike = 'fetch_user_profile_like',
|
||||
FriendPoke = 'friend_poke',
|
||||
@@ -137,8 +132,9 @@ export enum ActionName {
|
||||
|
||||
GetGuildList = 'get_guild_list',
|
||||
GetGuildProfile = 'get_guild_service_profile',
|
||||
GetGroupIgnoreAddRequest = 'get_group_ignore_add_request',
|
||||
// Debug = 'debug',
|
||||
// TestApi01 = 'test_api_01',
|
||||
|
||||
GetGroupIgnoredNotifies = 'get_group_ignored_notifies',
|
||||
|
||||
SetGroupSign = "set_group_sign",
|
||||
// UploadForwardMsg = "upload_forward_msg",
|
||||
}
|
||||
|
@@ -624,12 +624,20 @@ export class OneBotMsgApi {
|
||||
|
||||
[OB11MessageDataType.miniapp]: async () => undefined,
|
||||
|
||||
[OB11MessageDataType.contact]: async ({ data }, context) => {
|
||||
const arkJson = await this.core.apis.UserApi.getBuddyRecommendContactArkJson(data.id.toString(), '');
|
||||
return this.ob11ToRawConverters.json({
|
||||
data: { data: arkJson.arkMsg },
|
||||
type: OB11MessageDataType.json
|
||||
}, context);
|
||||
[OB11MessageDataType.contact]: async ({ data: { type = "qq", id } }, context) => {
|
||||
if(type === "qq"){
|
||||
const arkJson = await this.core.apis.UserApi.getBuddyRecommendContactArkJson(id.toString(), '');
|
||||
return this.ob11ToRawConverters.json({
|
||||
data: { data: arkJson.arkMsg },
|
||||
type: OB11MessageDataType.json
|
||||
}, context);
|
||||
}else if(type === "group"){
|
||||
const arkJson = await this.core.apis.GroupApi.getGroupRecommendContactArkJson(id.toString());
|
||||
return this.ob11ToRawConverters.json({
|
||||
data: { data: arkJson.arkJson },
|
||||
type: OB11MessageDataType.json
|
||||
}, context);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -85,6 +85,7 @@ export interface OB11MessageText {
|
||||
export interface OB11MessageContext {
|
||||
type: OB11MessageDataType.contact,
|
||||
data: {
|
||||
type:"qq"|"group",
|
||||
id: string,
|
||||
}
|
||||
}
|
||||
|
@@ -30,7 +30,7 @@ async function onSettingWindowCreated(view: Element) {
|
||||
SettingItem(
|
||||
'<span id="napcat-update-title">Napcat</span>',
|
||||
undefined,
|
||||
SettingButton('V3.1.2', 'napcat-update-button', 'secondary'),
|
||||
SettingButton('V3.1.5', 'napcat-update-button', 'secondary'),
|
||||
),
|
||||
]),
|
||||
SettingList([
|
||||
|
@@ -164,7 +164,7 @@ async function onSettingWindowCreated(view) {
|
||||
SettingItem(
|
||||
'<span id="napcat-update-title">Napcat</span>',
|
||||
void 0,
|
||||
SettingButton("V3.1.2", "napcat-update-button", "secondary")
|
||||
SettingButton("V3.1.5", "napcat-update-button", "secondary")
|
||||
)
|
||||
]),
|
||||
SettingList([
|
||||
|
Reference in New Issue
Block a user