From ce8760a39ab74d826889b63d205d00ca39507045 Mon Sep 17 00:00:00 2001 From: Nepenthe <113700307+pohgxz@users.noreply.github.com> Date: Wed, 30 Oct 2024 21:09:32 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=20(#478)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/onebot/action/file/GetRecord.ts | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/onebot/action/file/GetRecord.ts b/src/onebot/action/file/GetRecord.ts index 742a8b50..c62e1574 100644 --- a/src/onebot/action/file/GetRecord.ts +++ b/src/onebot/action/file/GetRecord.ts @@ -5,9 +5,11 @@ import { promises as fs } from 'fs'; import { decode } from 'silk-wasm'; const FFMPEG_PATH = process.env.FFMPEG_PATH || 'ffmpeg'; -interface Payload extends GetFilePayload { - out_format: 'mp3' | 'amr' | 'wma' | 'm4a' | 'spx' | 'ogg' | 'wav' | 'flac'; -} +const out_format = ['mp3' , 'amr' , 'wma' , 'm4a' , 'spx' , 'ogg' , 'wav' , 'flac']; + +type Payload = { + out_format : string +} & GetFilePayload export default class GetRecord extends GetFileBase { actionName = ActionName.GetRecord; @@ -17,12 +19,19 @@ export default class GetRecord extends GetFileBase { if (payload.out_format && typeof payload.out_format === 'string') { const inputFile = res.file; if (!inputFile) throw new Error('file not found'); + if (!out_format.includes(payload.out_format)) { + throw new Error('转换失败 out_format 字段可能格式不正确'); + } const pcmFile = `${inputFile}.pcm`; const outputFile = `${inputFile}.${payload.out_format}`; try { await fs.access(inputFile); - await this.decodeFile(inputFile, pcmFile); - await this.convertFile(pcmFile, outputFile, payload.out_format); + try { + await fs.access(outputFile); + } catch (error) { + await this.decodeFile(inputFile, pcmFile); + await this.convertFile(pcmFile, outputFile, payload.out_format); + } const base64Data = await fs.readFile(outputFile, { encoding: 'base64' }); res.file = outputFile; res.url = outputFile; @@ -48,7 +57,8 @@ export default class GetRecord extends GetFileBase { private convertFile(inputFile: string, outputFile: string, format: string): Promise { return new Promise((resolve, reject) => { - const ffmpeg = spawn(FFMPEG_PATH, ['-f', 's16le', '-ar', '24000', '-ac', '1', '-i', inputFile, outputFile]); + const params = format === 'amr' ? ['-f', 's16le', '-ar', '24000', '-ac', '1', '-i', inputFile, '-ar', '8000', '-b:a', '12.2k', outputFile] : ['-f', 's16le', '-ar', '24000', '-ac', '1', '-i', inputFile, outputFile]; + const ffmpeg = spawn(FFMPEG_PATH, params); ffmpeg.on('close', (code) => { if (code === 0) { @@ -63,4 +73,4 @@ export default class GetRecord extends GetFileBase { }); }); } -} \ No newline at end of file +} From e631f69621c5ea46c60ed768ab94ffaf90c8e998 Mon Sep 17 00:00:00 2001 From: Mlikiowa Date: Wed, 30 Oct 2024 13:11:06 +0000 Subject: [PATCH 2/9] release: v3.4.0 --- manifest.json | 2 +- package.json | 2 +- src/common/version.ts | 2 +- static/assets/renderer.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/manifest.json b/manifest.json index b7a7cc9f..49492787 100644 --- a/manifest.json +++ b/manifest.json @@ -4,7 +4,7 @@ "name": "NapCatQQ", "slug": "NapCat.Framework", "description": "高性能的 OneBot 11 协议实现", - "version": "3.3.27", + "version": "3.4.0", "icon": "./logo.png", "authors": [ { diff --git a/package.json b/package.json index 31c72f3f..6f3c683b 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "napcat", "private": true, "type": "module", - "version": "3.3.27", + "version": "3.4.0", "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 6d5c48ca..544be4bc 100644 --- a/src/common/version.ts +++ b/src/common/version.ts @@ -1 +1 @@ -export const napCatVersion = '3.3.27'; +export const napCatVersion = '3.4.0'; diff --git a/static/assets/renderer.js b/static/assets/renderer.js index 95acf638..c91b8e83 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.3.27", "napcat-update-button", "secondary") + SettingButton("V3.4.0", "napcat-update-button", "secondary") ) ]), SettingList([ From 42ee83c54ffbb4296b2f1fc39f7636a7273797d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=87=8C=E8=8E=9E=7E=28=3D=5E=E2=96=BD=5E=3D=29?= Date: Thu, 31 Oct 2024 07:25:13 +0800 Subject: [PATCH 3/9] =?UTF-8?q?feat:=20GetStrangerInfo=20=E5=8A=A0?= =?UTF-8?q?=E5=9B=9E=E4=BB=A5=E5=89=8D=E7=9A=84=E5=AE=8C=E6=95=B4=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=20(#479)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/onebot/action/go-cqhttp/GetStrangerInfo.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/onebot/action/go-cqhttp/GetStrangerInfo.ts b/src/onebot/action/go-cqhttp/GetStrangerInfo.ts index e64c48d4..d3b19d3c 100644 --- a/src/onebot/action/go-cqhttp/GetStrangerInfo.ts +++ b/src/onebot/action/go-cqhttp/GetStrangerInfo.ts @@ -25,6 +25,11 @@ export default class GoCQHTTPGetStrangerInfo extends BaseAction Date: Thu, 31 Oct 2024 00:36:50 +0000 Subject: [PATCH 4/9] release: v3.4.1 --- manifest.json | 2 +- package.json | 2 +- src/common/version.ts | 2 +- static/assets/renderer.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/manifest.json b/manifest.json index 49492787..a7b54dc6 100644 --- a/manifest.json +++ b/manifest.json @@ -4,7 +4,7 @@ "name": "NapCatQQ", "slug": "NapCat.Framework", "description": "高性能的 OneBot 11 协议实现", - "version": "3.4.0", + "version": "3.4.1", "icon": "./logo.png", "authors": [ { diff --git a/package.json b/package.json index 6f3c683b..7ee3385d 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "napcat", "private": true, "type": "module", - "version": "3.4.0", + "version": "3.4.1", "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 544be4bc..a5fda1c9 100644 --- a/src/common/version.ts +++ b/src/common/version.ts @@ -1 +1 @@ -export const napCatVersion = '3.4.0'; +export const napCatVersion = '3.4.1'; diff --git a/static/assets/renderer.js b/static/assets/renderer.js index c91b8e83..73a551e3 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.4.0", "napcat-update-button", "secondary") + SettingButton("V3.4.1", "napcat-update-button", "secondary") ) ]), SettingList([ From 4c834fd640f4bf4276c82b92a2d49d342815c1c8 Mon Sep 17 00:00:00 2001 From: Hao Guan <10684225+hguandl@users.noreply.github.com> Date: Thu, 31 Oct 2024 16:10:27 +0800 Subject: [PATCH 5/9] =?UTF-8?q?chore:=20Major=E8=8E=B7=E5=8F=96Appid?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8F=90=E7=A4=BA=20(#480)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/qq-basic-info.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/common/qq-basic-info.ts b/src/common/qq-basic-info.ts index f1d4e0a6..126ec37d 100644 --- a/src/common/qq-basic-info.ts +++ b/src/common/qq-basic-info.ts @@ -85,7 +85,10 @@ export class QQBasicInfoWrapper { // 通过Major拉取 性能差 try { let majorAppid = this.getAppidV2ByMajor(fullVersion); - if (majorAppid) { return { appid: majorAppid, qua: this.getQUAFallback() }; } + if (majorAppid) { + this.context.logger.log(`[QQ版本兼容性检测] 当前版本Appid未内置 通过Major获取 为了更好的性能请尝试更新NapCat`); + return { appid: majorAppid, qua: this.getQUAFallback() }; + } } catch (error) { this.context.logger.log(`[QQ版本兼容性检测] 通过Major 获取Appid异常 请检测NapCat/QQNT是否正常`); } From 6acceb884c99960cdb9b95215be4f7f6edc6a54f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Thu, 31 Oct 2024 18:00:55 +0800 Subject: [PATCH 6/9] fix: #473 --- src/core/apis/group.ts | 4 +- src/core/entities/notify.ts | 44 +++++++++++++++++++ .../listeners/NodeIKernelGroupListener.ts | 4 +- src/onebot/action/group/GetGroupShutList.ts | 2 +- 4 files changed, 50 insertions(+), 4 deletions(-) diff --git a/src/core/apis/group.ts b/src/core/apis/group.ts index c22660b8..6b238d5b 100644 --- a/src/core/apis/group.ts +++ b/src/core/apis/group.ts @@ -54,7 +54,9 @@ export class NTQQGroupApi { }, pskey); } async getGroupShutUpMemberList(groupCode: string) { - return this.context.session.getGroupService().getGroupShutUpMemberList(groupCode); + let data = this.core.eventWrapper.registerListen('NodeIKernelGroupListener/onShutUpMemberListChanged', 1, 1000, (group_id) => group_id === groupCode); + this.context.session.getGroupService().getGroupShutUpMemberList(groupCode); + return (await data)[1]; } async clearGroupNotifiesUnreadCount(uk: boolean) { return this.context.session.getGroupService().clearGroupNotifiesUnreadCount(uk); diff --git a/src/core/entities/notify.ts b/src/core/entities/notify.ts index c8aa4d15..dbf3f63b 100644 --- a/src/core/entities/notify.ts +++ b/src/core/entities/notify.ts @@ -43,6 +43,50 @@ export enum GroupInviteType { BYGROUPMEMBER, BYDISCUSSMEMBER } +export interface ShutUpGroupHonor { + [key: string]: number; +} + +export interface ShutUpGroupMember { + uid: string; + qid: string; + uin: string; + nick: string; + remark: string; + cardType: number; + cardName: string; + role: number; + avatarPath: string; + shutUpTime: number; + isDelete: boolean; + isSpecialConcerned: boolean; + isSpecialShield: boolean; + isRobot: boolean; + groupHonor: ShutUpGroupHonor; + memberRealLevel: number; + memberLevel: number; + globalGroupLevel: number; + globalGroupPoint: number; + memberTitleId: number; + memberSpecialTitle: string; + specialTitleExpireTime: string; + userShowFlag: number; + userShowFlagNew: number; + richFlag: number; + mssVipType: number; + bigClubLevel: number; + bigClubFlag: number; + autoRemark: string; + creditLevel: number; + joinTime: number; + lastSpeakTime: number; + memberFlag: number; + memberFlagExt: number; + memberMobileFlag: number; + memberFlagExt2: number; + isSpecialShielded: boolean; + cardNameId: number; +} export interface GroupNotify { seq: string; // 通知序列号 diff --git a/src/core/listeners/NodeIKernelGroupListener.ts b/src/core/listeners/NodeIKernelGroupListener.ts index e3899b9b..88a9a14c 100644 --- a/src/core/listeners/NodeIKernelGroupListener.ts +++ b/src/core/listeners/NodeIKernelGroupListener.ts @@ -1,4 +1,4 @@ -import { DataSource, Group, GroupListUpdateType, GroupMember, GroupNotify } from '@/core/entities'; +import { DataSource, Group, GroupListUpdateType, GroupMember, GroupNotify, ShutUpGroupMember } from '@/core/entities'; export class NodeIKernelGroupListener { onGroupListInited(listEmpty: boolean): void { } @@ -80,6 +80,6 @@ export class NodeIKernelGroupListener { onSearchMemberChange(...args: unknown[]) { } - onShutUpMemberListChanged(...args: unknown[]) { + onShutUpMemberListChanged(groupCode: string, members: Array) { } } \ No newline at end of file diff --git a/src/onebot/action/group/GetGroupShutList.ts b/src/onebot/action/group/GetGroupShutList.ts index 94fe7d9b..8d63e054 100644 --- a/src/onebot/action/group/GetGroupShutList.ts +++ b/src/onebot/action/group/GetGroupShutList.ts @@ -13,7 +13,7 @@ const SchemaData = { type Payload = FromSchema; -export class GetGroupShutList extends BaseAction { +export class GetGroupShutList extends BaseAction { actionName = ActionName.GetGroupShutList; payloadSchema = SchemaData; From 8d32ccb5d400ce56d15abc5d3b65bc1613f6bc83 Mon Sep 17 00:00:00 2001 From: Mlikiowa Date: Thu, 31 Oct 2024 10:03:19 +0000 Subject: [PATCH 7/9] release: v3.4.2 --- manifest.json | 2 +- package.json | 2 +- src/common/version.ts | 2 +- static/assets/renderer.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/manifest.json b/manifest.json index a7b54dc6..32c6aa3b 100644 --- a/manifest.json +++ b/manifest.json @@ -4,7 +4,7 @@ "name": "NapCatQQ", "slug": "NapCat.Framework", "description": "高性能的 OneBot 11 协议实现", - "version": "3.4.1", + "version": "3.4.2", "icon": "./logo.png", "authors": [ { diff --git a/package.json b/package.json index 7ee3385d..26e6e50f 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "napcat", "private": true, "type": "module", - "version": "3.4.1", + "version": "3.4.2", "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 a5fda1c9..ff72f9c2 100644 --- a/src/common/version.ts +++ b/src/common/version.ts @@ -1 +1 @@ -export const napCatVersion = '3.4.1'; +export const napCatVersion = '3.4.2'; diff --git a/static/assets/renderer.js b/static/assets/renderer.js index 73a551e3..6544a2cc 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.4.1", "napcat-update-button", "secondary") + SettingButton("V3.4.2", "napcat-update-button", "secondary") ) ]), SettingList([ From be5da7cc6f7e7b2902e17535e7952901589286d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Thu, 31 Oct 2024 18:17:41 +0800 Subject: [PATCH 8/9] =?UTF-8?q?fix:=20=E6=AD=A3=E5=90=91ws=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E6=8E=A8=E9=80=81=E4=BA=8B=E4=BB=B6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/onebot/network/passive-websocket.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/onebot/network/passive-websocket.ts b/src/onebot/network/passive-websocket.ts index 8e28f4a2..ea18ebd8 100644 --- a/src/onebot/network/passive-websocket.ts +++ b/src/onebot/network/passive-websocket.ts @@ -143,7 +143,7 @@ export class OB11PassiveWebSocketAdapter implements IOB11NetworkAdapter { private registerHeartBeat() { this.heartbeatIntervalId = setInterval(() => { this.wsClientsMutex.runExclusive(async () => { - this.wsClients.forEach((wsClient) => { + this.wsClientWithEvent.forEach((wsClient) => { if (wsClient.readyState === WebSocket.OPEN) { wsClient.send(JSON.stringify(new OB11HeartbeatEvent(this.core, this.heartbeatInterval, this.core.selfInfo.online, true))); } From 7b1ac224f65b158bf57bc25a11146d762d1a8f5f Mon Sep 17 00:00:00 2001 From: Mlikiowa Date: Thu, 31 Oct 2024 10:18:21 +0000 Subject: [PATCH 9/9] release: v3.4.3 --- manifest.json | 2 +- package.json | 2 +- src/common/version.ts | 2 +- static/assets/renderer.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/manifest.json b/manifest.json index 32c6aa3b..d1ffbaf3 100644 --- a/manifest.json +++ b/manifest.json @@ -4,7 +4,7 @@ "name": "NapCatQQ", "slug": "NapCat.Framework", "description": "高性能的 OneBot 11 协议实现", - "version": "3.4.2", + "version": "3.4.3", "icon": "./logo.png", "authors": [ { diff --git a/package.json b/package.json index 26e6e50f..561456b9 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "napcat", "private": true, "type": "module", - "version": "3.4.2", + "version": "3.4.3", "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 ff72f9c2..29949b41 100644 --- a/src/common/version.ts +++ b/src/common/version.ts @@ -1 +1 @@ -export const napCatVersion = '3.4.2'; +export const napCatVersion = '3.4.3'; diff --git a/static/assets/renderer.js b/static/assets/renderer.js index 6544a2cc..e8d5cd83 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.4.2", "napcat-update-button", "secondary") + SettingButton("V3.4.3", "napcat-update-button", "secondary") ) ]), SettingList([