mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-16 04:45:46 +00:00
fix #183
This commit is contained in:
parent
773cdc5877
commit
3cc2f1dcad
@ -12,11 +12,10 @@ import {
|
||||
SignMusicWrapper
|
||||
} from '@/core';
|
||||
import { getGroupMember } from '@/core/data';
|
||||
import { logDebug, logError, logWarn } from '@/common/utils/log';
|
||||
import { logError, logWarn } from '@/common/utils/log';
|
||||
import { uri2local } from '@/common/utils/file';
|
||||
import { ob11Config } from '@/onebot11/config';
|
||||
import { RequestUtil } from '@/common/utils/request';
|
||||
import fs from 'node:fs';
|
||||
import { MessageUnique } from '@/common/utils/MessageUnique';
|
||||
|
||||
export type MessageContext = {
|
||||
@ -25,12 +24,11 @@ export type MessageContext = {
|
||||
}
|
||||
|
||||
async function handleOb11FileLikeMessage(
|
||||
{ data: { file, name: payloadFileName } }: OB11MessageFileBase,
|
||||
{ data: inputdata }: OB11MessageFileBase,
|
||||
{ deleteAfterSentFiles }: MessageContext
|
||||
) {
|
||||
const uri = file;
|
||||
|
||||
const { path, isLocal, fileName, errMsg } = (await uri2local(uri));
|
||||
//有的奇怪的框架将url作为参数 而不是file 此时优先url
|
||||
let { path, isLocal, fileName, errMsg } = (await uri2local(inputdata?.url || inputdata.file));
|
||||
|
||||
if (errMsg) {
|
||||
logError('文件下载失败', errMsg);
|
||||
@ -41,7 +39,7 @@ async function handleOb11FileLikeMessage(
|
||||
deleteAfterSentFiles.push(path);
|
||||
}
|
||||
|
||||
return { path, fileName: payloadFileName || fileName };
|
||||
return { path, fileName: inputdata.name || fileName };
|
||||
}
|
||||
|
||||
const _handlers: {
|
||||
|
@ -174,6 +174,7 @@ export class OB11Constructor {
|
||||
// message_data["data"]["file"] = element.picElement.sourcePath
|
||||
message_data['data']['file'] = element.picElement.fileName;
|
||||
message_data['data']['subType'] = element.picElement.picSubType;
|
||||
message_data['data']['file_id'] = UUIDConverter.encode(msg.peerUin, msg.msgId);
|
||||
// message_data["data"]["path"] = element.picElement.sourcePath
|
||||
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user