diff --git a/README.md b/README.md index b0c64730..69209608 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@
- NapCatQQ + + ![Logo](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) +
--- diff --git a/manifest.json b/manifest.json index 1b814087..c9eac215 100644 --- a/manifest.json +++ b/manifest.json @@ -4,7 +4,7 @@ "name": "NapCatQQ", "slug": "NapCat.Framework", "description": "高性能的 OneBot 11 协议实现", - "version": "3.1.4", + "version": "3.1.5", "icon": "./logo.png", "authors": [ { diff --git a/package.json b/package.json index d9132e18..b8020306 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "napcat", "private": true, "type": "module", - "version": "3.1.4", + "version": "3.1.5", "scripts": { "build:framework": "vite build --mode framework", "build:shell": "vite build --mode shell", diff --git a/src/common/forward-msg-builder.ts b/src/common/forward-msg-builder.ts index 2771156b..4c18e72e 100644 --- a/src/common/forward-msg-builder.ts +++ b/src/common/forward-msg-builder.ts @@ -50,9 +50,29 @@ interface ForwardAdaptMsgElement { } export class ForwardMsgBuilder { - private static build(resId: string, msg: ForwardAdaptMsg[]): ForwardMsgJson { + private static build(resId: string, msg: ForwardAdaptMsg[], source?: string, news?: ForwardMsgJsonMetaDetail["news"], summary?: string, prompt?: string): ForwardMsgJson { const id = crypto.randomUUID(); const isGroupMsg = msg.some(m => m.isGroupMsg); + if (!source) { + source = isGroupMsg ? "群聊的聊天记录" : + msg.length + ? Array.from(new Set(msg.map(m => m.senderName))) + .join('和') + '的聊天记录' + : '聊天记录'; + } + if (!news) { + news = msg.length === 0 ? [{ + text: "Nya~ This message is send from NapCat.Packet!", + }] : msg.map(m => ({ + text: `${m.senderName}: ${m.msg?.map(msg => msg.preview).join('')}`, + })); + } + if (!summary) { + summary = `查看${msg.length}条转发消息`; + } + if (!prompt) { + prompt = "[聊天记录]"; + } return { app: "com.tencent.multimsg", config: { @@ -62,29 +82,21 @@ export class ForwardMsgBuilder { type: "normal", width: 300 }, - desc: "[聊天记录]", + desc: prompt, extra: { filename: id, tsum: msg.length, }, meta: { detail: { - news: msg.length === 0 ? [{ - text: "Nya~ This message is send from NapCat.Packet!", - }] : msg.map(m => ({ - text: `${m.senderName}: ${m.msg?.map(msg => msg.preview).join('')}`, - })), + news, resid: resId, - source: isGroupMsg ? "群聊的聊天记录" : - msg.length - ? Array.from(new Set(msg.map(m => m.senderName))) - .join('和') + '的聊天记录' - : '聊天记录', - summary: `查看${msg.length}条转发消息`, + source, + summary, uniseq: id, } }, - prompt: "[聊天记录]", + prompt, ver: "0.0.0.5", view: "contact", }; @@ -94,13 +106,13 @@ export class ForwardMsgBuilder { return this.build(resId, []); } - static fromPacketMsg(resId: string, packetMsg: PacketMsg[]): ForwardMsgJson { + static fromPacketMsg(resId: string, packetMsg: PacketMsg[], source?: string, news?: ForwardMsgJsonMetaDetail["news"], summary?: string, prompt?: string): ForwardMsgJson { return this.build(resId, packetMsg.map(msg => ({ senderName: msg.senderName, isGroupMsg: msg.groupId !== undefined, msg: msg.msg.map(m => ({ preview: m.valid? m.toPreview() : "[该消息类型暂不支持查看]", })) - }))); + })), source, news, summary, prompt); } } diff --git a/src/common/version.ts b/src/common/version.ts index 4235ff80..942b9be5 100644 --- a/src/common/version.ts +++ b/src/common/version.ts @@ -1 +1 @@ -export const napCatVersion = '3.1.4'; +export const napCatVersion = '3.1.5'; diff --git a/src/core/external/appid.json b/src/core/external/appid.json index 2d2f05f9..5dd23607 100644 --- a/src/core/external/appid.json +++ b/src/core/external/appid.json @@ -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" } } \ No newline at end of file diff --git a/src/core/external/offset.json b/src/core/external/offset.json index 91c5983d..f2f01f21 100644 --- a/src/core/external/offset.json +++ b/src/core/external/offset.json @@ -19,8 +19,20 @@ "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" + }, + "3.2.13-28971-x64": { + "send": "A0CEF60", + "recv": "A0D2860" + }, + "3.2.12-28971-arm64": { + "send": "6E91318", + "recv": "6E94B50" } } \ No newline at end of file diff --git a/src/onebot/action/msg/SendMsg.ts b/src/onebot/action/msg/SendMsg.ts index eab2b2ae..0454cd16 100644 --- a/src/onebot/action/msg/SendMsg.ts +++ b/src/onebot/action/msg/SendMsg.ts @@ -117,7 +117,7 @@ export class SendMsg extends BaseAction { if (getSpecialMsgNum(payload, OB11MessageDataType.node)) { const packetMode = this.core.apis.PacketApi.available; const returnMsgAndResId = packetMode - ? await this.handleForwardedNodesPacket(peer, messages as OB11MessageNode[]) + ? await this.handleForwardedNodesPacket(peer, messages as OB11MessageNode[], payload.source, payload.news, payload.summary, payload.prompt) : await this.handleForwardedNodes(peer, messages as OB11MessageNode[]); if (returnMsgAndResId.message) { const msgShortId = MessageUnique.createUniqueMsgId({ @@ -146,7 +146,7 @@ export class SendMsg extends BaseAction { } // TODO: recursively handle forwarded nodes - private async handleForwardedNodesPacket(msgPeer: Peer, messageNodes: OB11MessageNode[]): Promise<{ + private async handleForwardedNodesPacket(msgPeer: Peer, messageNodes: OB11MessageNode[], source?: string, news?: { text: string }[], summary?: string, prompt?: string): Promise<{ message: RawMessage | null, res_id?: string }> { @@ -172,7 +172,7 @@ export class SendMsg extends BaseAction { } } const resid = await this.core.apis.PacketApi.sendUploadForwardMsg(packetMsg, msgPeer.chatType === ChatType.KCHATTYPEGROUP ? +msgPeer.peerUid : 0); - const forwardJson = ForwardMsgBuilder.fromPacketMsg(resid, packetMsg); + const forwardJson = ForwardMsgBuilder.fromPacketMsg(resid, packetMsg, source, news, summary, prompt); const finallySendElements = { elementType: ElementType.ARK, elementId: "", diff --git a/src/onebot/types/message.ts b/src/onebot/types/message.ts index d4890e34..8921afb3 100644 --- a/src/onebot/types/message.ts +++ b/src/onebot/types/message.ts @@ -221,6 +221,10 @@ export interface OB11PostSendMsg { message: OB11MessageMixType; messages?: OB11MessageMixType; // 兼容 go-cqhttp auto_escape?: boolean | string + source?: string, + news?: { text: string }[], + summary?: string, + prompt?: string } export interface OB11PostContext { message_type?: 'private' | 'group' diff --git a/src/webui/ui/NapCat.ts b/src/webui/ui/NapCat.ts index 274792a7..f1e072db 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('V3.1.4', 'napcat-update-button', 'secondary'), + SettingButton('V3.1.5', 'napcat-update-button', 'secondary'), ), ]), SettingList([ diff --git a/static/assets/renderer.js b/static/assets/renderer.js index f2e95309..90ea8978 100644 --- a/static/assets/renderer.js +++ b/static/assets/renderer.js @@ -164,7 +164,7 @@ async function onSettingWindowCreated(view) { SettingItem( 'Napcat', void 0, - SettingButton("V3.1.4", "napcat-update-button", "secondary") + SettingButton("V3.1.5", "napcat-update-button", "secondary") ) ]), SettingList([