chore: 屏蔽部分代码

This commit is contained in:
手瓜一十雪 2024-08-09 15:30:04 +08:00
parent 7178095aef
commit 245eabe85f

View File

@ -75,69 +75,69 @@ export class NTQQFileApi {
async downloadMediaByUuid() { async downloadMediaByUuid() {
//napCatCore.session.getRichMediaService().downloadFileForFileUuid(); //napCatCore.session.getRichMediaService().downloadFileForFileUuid();
} }
async downloadMedia(msgId: string, chatType: ChatType, peerUid: string, elementId: string, thumbPath: string, sourcePath: string, timeout = 1000 * 60 * 2, force: boolean = false) { // async downloadMedia(msgId: string, chatType: ChatType, peerUid: string, elementId: string, thumbPath: string, sourcePath: string, timeout = 1000 * 60 * 2, force: boolean = false) {
//logDebug('receive downloadMedia task', msgId, chatType, peerUid, elementId, thumbPath, sourcePath, timeout, force); // //logDebug('receive downloadMedia task', msgId, chatType, peerUid, elementId, thumbPath, sourcePath, timeout, force);
// 用于下载收到的消息中的图片等 // // 用于下载收到的消息中的图片等
if (sourcePath && fs.existsSync(sourcePath)) { // if (sourcePath && fs.existsSync(sourcePath)) {
if (force) { // if (force) {
try { // try {
await fsPromises.unlink(sourcePath); // await fsPromises.unlink(sourcePath);
} catch (e) { // } catch (e) {
// // //
} // }
} else { // } else {
return sourcePath; // return sourcePath;
} // }
} // }
const data = await this.core.eventWrapper.CallNormalEvent< // const data = await this.core.eventWrapper.CallNormalEvent<
( // (
params: { // params: {
fileModelId: string, // fileModelId: string,
downloadSourceType: number, // downloadSourceType: number,
triggerType: number, // triggerType: number,
msgId: string, // msgId: string,
chatType: ChatType, // chatType: ChatType,
peerUid: string, // peerUid: string,
elementId: string, // elementId: string,
thumbSize: number, // thumbSize: number,
downloadType: number, // downloadType: number,
filePath: string // filePath: string
}) => Promise<unknown>, // }) => Promise<unknown>,
(fileTransNotifyInfo: OnRichMediaDownloadCompleteParams) => void // (fileTransNotifyInfo: OnRichMediaDownloadCompleteParams) => void
>( // >(
'NodeIKernelMsgService/downloadRichMedia', // 'NodeIKernelMsgService/downloadRichMedia',
'NodeIKernelMsgListener/onRichMediaDownloadComplete', // 'NodeIKernelMsgListener/onRichMediaDownloadComplete',
1, // 1,
timeout, // timeout,
(arg: OnRichMediaDownloadCompleteParams) => { // (arg: OnRichMediaDownloadCompleteParams) => {
if (arg.msgId === msgId) { // if (arg.msgId === msgId) {
return true; // return true;
} // }
return false; // return false;
}, // },
{ // {
fileModelId: '0', // fileModelId: '0',
downloadSourceType: 0, // downloadSourceType: 0,
triggerType: 1, // triggerType: 1,
msgId: msgId, // msgId: msgId,
chatType: chatType, // chatType: chatType,
peerUid: peerUid, // peerUid: peerUid,
elementId: elementId, // elementId: elementId,
thumbSize: 0, // thumbSize: 0,
downloadType: 1, // downloadType: 1,
filePath: thumbPath // filePath: thumbPath
} // }
); // );
let filePath = data[1].filePath; // let filePath = data[1].filePath;
if (filePath.startsWith('\\')) { // if (filePath.startsWith('\\')) {
// log('filePath start with \\'); // // log('filePath start with \\');
const downloadPath = sessionConfig.defaultFileDownloadPath; // const downloadPath = sessionConfig.defaultFileDownloadPath;
//logDebug('downloadPath', downloadPath); // //logDebug('downloadPath', downloadPath);
filePath = path.join(downloadPath, filePath); // filePath = path.join(downloadPath, filePath);
// 下载路径是下载文件夹的相对路径 // // 下载路径是下载文件夹的相对路径
} // }
return filePath; // return filePath;
} // }
async getImageSize(filePath: string): Promise<ISizeCalculationResult | undefined> { async getImageSize(filePath: string): Promise<ISizeCalculationResult | undefined> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {