From 2bf8d8f79110bd0039be7a2aba6b782176923094 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, 21 Nov 2024 13:06:13 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E6=A0=87=E5=87=86=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/apis/collection.ts | 2 +- src/core/apis/file.ts | 29 +++++++++++++++++------------ src/core/entities/msg.ts | 12 ++++++++---- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/core/apis/collection.ts b/src/core/apis/collection.ts index 262a8c6a..c805b442 100644 --- a/src/core/apis/collection.ts +++ b/src/core/apis/collection.ts @@ -1,4 +1,4 @@ -import { InstanceContext, NapCatCore } from '..'; +import { InstanceContext, NapCatCore } from '@/core'; export class NTQQCollectionApi { context: InstanceContext; diff --git a/src/core/apis/file.ts b/src/core/apis/file.ts index 1a94151c..6b5893c4 100644 --- a/src/core/apis/file.ts +++ b/src/core/apis/file.ts @@ -36,7 +36,11 @@ export class NTQQFileApi { constructor(context: InstanceContext, core: NapCatCore) { this.context = context; this.core = core; - this.rkeyManager = new RkeyManager(['https://rkey.napneko.icu/rkeys', 'https://llob.linyuchen.net/rkey', 'http://napcat-sign.wumiao.wang:2082/rkey'], this.context.logger); + this.rkeyManager = new RkeyManager([ + 'https://rkey.napneko.icu/rkeys' + ], + this.context.logger + ); } async copyFile(filePath: string, destPath: string) { @@ -102,7 +106,7 @@ export class NTQQFileApi { fileName: fileName || _fileName, folderId: folderId, filePath: path, - fileSize: (fileSize).toString(), + fileSize: fileSize.toString(), }, }; } @@ -125,7 +129,7 @@ export class NTQQFileApi { fileName: fileName, sourcePath: path, original: true, - picType: isGIF(picPath) ? PicType.GIF : PicType.JGP, + picType: isGIF(picPath) ? PicType.NEWPIC_GIF : PicType.NEWPIC_JPEG, picSubType: subType, fileUuid: '', fileSubId: '', @@ -138,7 +142,8 @@ export class NTQQFileApi { async createValidSendVideoElement(context: MessageContext, filePath: string, fileName: string = '', diyThumbPath: string = ''): Promise { const logger = this.core.context.logger; let videoInfo = { - width: 1920, height: 1080, + width: 1920, + height: 1080, time: 15, format: 'mp4', size: 0, @@ -300,18 +305,18 @@ export class NTQQFileApi { element.elementType === ElementType.FILE ) { switch (element.elementType) { - case ElementType.PIC: + case ElementType.PIC: element.picElement!.sourcePath = elementResults[elementIndex]; - break; - case ElementType.VIDEO: + break; + case ElementType.VIDEO: element.videoElement!.filePath = elementResults[elementIndex]; - break; - case ElementType.PTT: + break; + case ElementType.PTT: element.pttElement!.filePath = elementResults[elementIndex]; - break; - case ElementType.FILE: + break; + case ElementType.FILE: element.fileElement!.filePath = elementResults[elementIndex]; - break; + break; } elementIndex++; } diff --git a/src/core/entities/msg.ts b/src/core/entities/msg.ts index 90b2a6dc..762256a4 100644 --- a/src/core/entities/msg.ts +++ b/src/core/entities/msg.ts @@ -104,10 +104,15 @@ export enum NTMsgType { * 图片类型枚举 */ export enum PicType { - GIF = 2000, - JGP = 1000 + NEWPIC_APNG = 2001, + NEWPIC_BMP = 1005, + NEWPIC_GIF = 2000, + NEWPIC_JPEG = 1000, + NEWPIC_PNG = 1001, + NEWPIC_PROGERSSIV_JPEG = 1003, + NEWPIC_SHARPP = 1004, + NEWPIC_WEBP = 1002 } - /** * 图片子类型枚举 */ @@ -116,7 +121,6 @@ export enum PicSubType { Face = 1 // 表情包小图 //...待补全 其余见NT Android } - /** * 消息@类型枚举 */