mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
fix: modelId
This commit is contained in:
@@ -302,13 +302,16 @@ export class NTQQFileApi {
|
|||||||
async downloadMediaByUuid() {
|
async downloadMediaByUuid() {
|
||||||
//napCatCore.session.getRichMediaService().downloadFileForFileUuid();
|
//napCatCore.session.getRichMediaService().downloadFileForFileUuid();
|
||||||
}
|
}
|
||||||
async downloadFileForModelId(peer: Peer, modelId: string, timeout = 1000 * 60 * 2) {
|
async downloadFileForModelId(peer: Peer, modelId: string, unknown: string, timeout = 1000 * 60 * 2) {
|
||||||
const [, fileTransNotifyInfo] = await this.core.eventWrapper.callNormalEventV2(
|
const [, fileTransNotifyInfo] = await this.core.eventWrapper.callNormalEventV2(
|
||||||
'NodeIKernelRichMediaService/downloadFileForModelId',
|
'NodeIKernelRichMediaService/downloadFileForModelId',
|
||||||
'NodeIKernelMsgListener/onRichMediaDownloadComplete',
|
'NodeIKernelMsgListener/onRichMediaDownloadComplete',
|
||||||
[peer, [modelId]],
|
[peer, [modelId], unknown],
|
||||||
() => true,
|
() => true,
|
||||||
(arg) => arg?.commonFileInfo?.fileModelId === modelId,
|
(arg) => {
|
||||||
|
console.log(arg);
|
||||||
|
return arg?.commonFileInfo?.fileModelId === modelId
|
||||||
|
},
|
||||||
1,
|
1,
|
||||||
timeout,
|
timeout,
|
||||||
);
|
);
|
||||||
|
@@ -155,7 +155,7 @@ export interface NodeIKernelRichMediaService {
|
|||||||
}): unknown;
|
}): unknown;
|
||||||
|
|
||||||
//arg3为“”
|
//arg3为“”
|
||||||
downloadFileForModelId(peer: Peer, ModelId: string[]): Promise<unknown>;
|
downloadFileForModelId(peer: Peer, ModelId: string[], unknown: string): Promise<unknown>;
|
||||||
|
|
||||||
//第三个参数 Array<Type>
|
//第三个参数 Array<Type>
|
||||||
// this.fileId = "";
|
// this.fileId = "";
|
||||||
|
@@ -64,7 +64,7 @@ export class GetFileBase extends BaseAction<GetFilePayload, GetFileResponse> {
|
|||||||
const contextModelIdFile = FileNapCatOneBotUUID.decodeModelId(payload.file);
|
const contextModelIdFile = FileNapCatOneBotUUID.decodeModelId(payload.file);
|
||||||
if (contextModelIdFile) {
|
if (contextModelIdFile) {
|
||||||
const { peer, modelId } = contextModelIdFile;
|
const { peer, modelId } = contextModelIdFile;
|
||||||
const downloadPath = await NTQQFileApi.downloadFileForModelId(peer, modelId);
|
const downloadPath = await NTQQFileApi.downloadFileForModelId(peer, modelId,' ');
|
||||||
const res: GetFileResponse = {
|
const res: GetFileResponse = {
|
||||||
file: downloadPath,
|
file: downloadPath,
|
||||||
url: downloadPath,
|
url: downloadPath,
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||||
import BaseAction from '../BaseAction';
|
import BaseAction from '../BaseAction';
|
||||||
import { ActionName } from '../types';
|
import { ActionName } from '../types';
|
||||||
|
import { FileNapCatOneBotUUID } from '@/common/helper';
|
||||||
|
|
||||||
const SchemaData = {
|
const SchemaData = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
@@ -37,6 +38,13 @@ export class GetGroupFileList extends BaseAction<Payload, { FileList: Array<any>
|
|||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
return [];
|
return [];
|
||||||
});
|
});
|
||||||
|
ret.forEach((e) => {
|
||||||
|
let fileModelId = e?.fileInfo?.fileModelId;
|
||||||
|
if (fileModelId) {
|
||||||
|
e.fileModelId = fileModelId;
|
||||||
|
}
|
||||||
|
e.fileId = FileNapCatOneBotUUID.encodeModelId({ chatType: 2, peerUid: payload.group_id.toString() }, fileModelId);
|
||||||
|
});
|
||||||
return { FileList: ret };
|
return { FileList: ret };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user