From 018aca4db257df2c13671ad8532df47ce9089cd4 Mon Sep 17 00:00:00 2001 From: pk5ls20 Date: Sun, 3 Nov 2024 02:45:58 +0800 Subject: [PATCH] fix: type hint --- src/core/apis/packet.ts | 4 ++-- src/onebot/action/group/GetAiRecord.ts | 2 +- src/onebot/action/group/SendGroupAiRecord.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/apis/packet.ts b/src/core/apis/packet.ts index a0de8a5f..f112da87 100644 --- a/src/core/apis/packet.ts +++ b/src/core/apis/packet.ts @@ -5,7 +5,7 @@ import offset from '@/core/external/offset.json'; import { PacketClient, RecvPacketData } from '@/core/packet/client'; import { PacketSession } from "@/core/packet/session"; import { OidbPacket, PacketHexStr } from "@/core/packet/packer"; -import { NapProtoEncodeStructType, NapProtoMsg } from '@/core/packet/proto/NapProto'; +import { NapProtoEncodeStructType, NapProtoDecodeStructType, NapProtoMsg } from '@/core/packet/proto/NapProto'; import { OidbSvcTrpcTcp0X9067_202_Rsp_Body } from '@/core/packet/proto/oidb/Oidb.0x9067_202'; import { OidbSvcTrpcTcpBase, OidbSvcTrpcTcpBaseRsp } from '@/core/packet/proto/oidb/OidbBase'; import { OidbSvcTrpcTcp0XFE1_2RSP } from '@/core/packet/proto/oidb/Oidb.0XFE1_2'; @@ -223,7 +223,7 @@ export class NTQQPacketApi { }); } - async sendAiVoiceChatReq(groupUin: number, voiceId: string, text: string, chatType: AIVoiceChatType): Promise> { + async sendAiVoiceChatReq(groupUin: number, voiceId: string, text: string, chatType: AIVoiceChatType): Promise> { let reqTime = 0; const reqMaxTime = 30; const sessionId = crypto.randomBytes(4).readUInt32BE(0); diff --git a/src/onebot/action/group/GetAiRecord.ts b/src/onebot/action/group/GetAiRecord.ts index 5f60fc8b..c17b0345 100644 --- a/src/onebot/action/group/GetAiRecord.ts +++ b/src/onebot/action/group/GetAiRecord.ts @@ -23,6 +23,6 @@ export class GetAiRecord extends GetPacketStatusDepends { async _handle(payload: Payload) { const rawRsp = await this.core.apis.PacketApi.sendAiVoiceChatReq(+payload.group_id, payload.character, payload.text, AIVoiceChatType.Sound); - return await this.core.apis.PacketApi.sendGroupPttFileDownloadReq(+payload.group_id, rawRsp.msgInfoBody![0].index as NapProtoEncodeStructType); + return await this.core.apis.PacketApi.sendGroupPttFileDownloadReq(+payload.group_id, rawRsp.msgInfoBody[0].index); } } diff --git a/src/onebot/action/group/SendGroupAiRecord.ts b/src/onebot/action/group/SendGroupAiRecord.ts index 173eee80..2ed5cdfa 100644 --- a/src/onebot/action/group/SendGroupAiRecord.ts +++ b/src/onebot/action/group/SendGroupAiRecord.ts @@ -27,7 +27,7 @@ export class SendGroupAiRecord extends GetPacketStatusDepends); + const url = await this.core.apis.PacketApi.sendGroupPttFileDownloadReq(+payload.group_id, rawRsp.msgInfoBody[0].index); const { path, fileName, errMsg, success} = (await uri2local(this.core.NapCatTempPath, url)); if (!success) { throw new Error(errMsg);