From 15fe2837dc004f875159f8f6f9eeff31aeb55c5d Mon Sep 17 00:00:00 2001 From: linyuchen Date: Mon, 4 Mar 2024 21:52:52 +0800 Subject: [PATCH] fix: gif not work --- src/ntqqapi/constructor.ts | 6 +++--- src/ntqqapi/types.ts | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/ntqqapi/constructor.ts b/src/ntqqapi/constructor.ts index 36c8e67..06989f1 100644 --- a/src/ntqqapi/constructor.ts +++ b/src/ntqqapi/constructor.ts @@ -1,6 +1,6 @@ import { AtType, - ElementType, + ElementType, PicType, SendFaceElement, SendFileElement, SendPicElement, @@ -9,7 +9,7 @@ import { SendTextElement } from "./types"; import {NTQQApi} from "./ntcall"; -import {encodeSilk} from "../common/utils"; +import {encodeSilk, isGIF} from "../common/utils"; import * as fs from "node:fs"; @@ -66,7 +66,7 @@ export class SendMsgElementConstructor { fileName: fileName, sourcePath: path, original: true, - picType: 1001, + picType: isGIF(picPath) ? PicType.gif : PicType.jpg, picSubType: 0, fileUuid: "", fileSubId: "", diff --git a/src/ntqqapi/types.ts b/src/ntqqapi/types.ts index 8d7c6e6..b8e5a61 100644 --- a/src/ntqqapi/types.ts +++ b/src/ntqqapi/types.ts @@ -107,6 +107,10 @@ export interface SendPttElement { } } +export enum PicType { + gif = 2000, + jpg = 1000 +} export interface SendPicElement { elementType: ElementType.PIC, elementId: "", @@ -118,7 +122,7 @@ export interface SendPicElement { fileName: string, sourcePath: string, original: boolean, - picType: number, + picType: PicType, picSubType: number, fileUuid: string, fileSubId: string,