diff --git a/src/core/apis/file.ts b/src/core/apis/file.ts index 021e47b1..5982d6dc 100644 --- a/src/core/apis/file.ts +++ b/src/core/apis/file.ts @@ -271,7 +271,7 @@ export class NTQQFileApi { md5HexStr: md5, fileSize: fileSize, // duration: Math.max(1, Math.round(fileSize / 1024 / 3)), // 一秒钟大概是3kb大小, 小于1秒的按1秒算 - duration: duration || 1, + duration: duration ?? 1, formatType: 1, voiceType: 1, voiceChangeType: 0, @@ -319,30 +319,30 @@ export class NTQQFileApi { filePath: string }) => Promise, (fileTransNotifyInfo: OnRichMediaDownloadCompleteParams) => void - >( - 'NodeIKernelMsgService/downloadRichMedia', - 'NodeIKernelMsgListener/onRichMediaDownloadComplete', - 1, - timeout, - (arg: OnRichMediaDownloadCompleteParams) => { - if (arg.msgId === msgId) { - return true; - } - return false; - }, - { - fileModelId: '0', - downloadSourceType: 0, - triggerType: 1, - msgId: msgId, - chatType: chatType, - peerUid: peerUid, - elementId: elementId, - thumbSize: 0, - downloadType: 1, - filePath: thumbPath, - }, - ); + >( + 'NodeIKernelMsgService/downloadRichMedia', + 'NodeIKernelMsgListener/onRichMediaDownloadComplete', + 1, + timeout, + (arg: OnRichMediaDownloadCompleteParams) => { + if (arg.msgId === msgId) { + return true; + } + return false; + }, + { + fileModelId: '0', + downloadSourceType: 0, + triggerType: 1, + msgId: msgId, + chatType: chatType, + peerUid: peerUid, + elementId: elementId, + thumbSize: 0, + downloadType: 1, + filePath: thumbPath, + }, + ); const msg = await this.core.apis.MsgApi.getMsgsByMsgId({ guildId: '', chatType: chatType, @@ -482,10 +482,10 @@ export class NTQQFileApi { let id = ''; const Listener = this.core.eventWrapper.RegisterListen<(params: OnListener) => void> ( - 'NodeIKernelSearchListener/onSearchFileKeywordsResult', - 1, - 20000, - (params) => id !== '' && params.searchId == id, + 'NodeIKernelSearchListener/onSearchFileKeywordsResult', + 1, + 20000, + (params) => id !== '' && params.searchId == id, ); id = await Event!(keys, 12); const [ret] = (await Listener); diff --git a/src/onebot/action/msg/SendMsg.ts b/src/onebot/action/msg/SendMsg.ts index 01d1f04d..51e41a75 100644 --- a/src/onebot/action/msg/SendMsg.ts +++ b/src/onebot/action/msg/SendMsg.ts @@ -238,9 +238,7 @@ export class SendMsg extends BaseAction { const AllElement: SendMessageElement[][] = [MixElement, ...SingleElement].filter(e => e !== undefined && e.length !== 0); const MsgNodeList: Promise[] = []; for (const sendElementsSplitElement of AllElement) { - MsgNodeList.push(sendMsg(this.CoreContext, selfPeer, sendElementsSplitElement, [], true).catch(_ => new Promise((resolve) => { - resolve(undefined); - }))); + MsgNodeList.push(sendMsg(this.CoreContext, selfPeer, sendElementsSplitElement, [], true).catch(_ => undefined)); } (await Promise.allSettled(MsgNodeList)).map((result) => { if (result.status === 'fulfilled' && result.value) { @@ -301,7 +299,7 @@ export class SendMsg extends BaseAction { }; const logger = this.CoreContext.context.logger; const NTQQMsgApi = this.CoreContext.apis.MsgApi; - //logDebug('克隆的目标消息', msg); + //msg 为待克隆消息 const sendElements: SendMessageElement[] = [];