[BUG] 通过get_file扩展接口获取群文件错误:file not found
系统版本
docker mlikiowa/napcat-docker:latest
QQNT 版本
最新
NapCat 版本
2.0.34
OneBot 客户端
最新
发生了什么?
通过/get_file接口下载收到的群文件时,报错:Error: file not found
如何复现
请求: $client = new \GuzzleHttp\Client([ 'base_uri' => '127.0.0.1:3000', 'timeout' => 2.0, 'verify' => false, ]); $response = $client->post('get_file', [ 'form_params' => [ 'file_id' => '00000000-320a-035f-66c4-5bec7033b6f0', ], ]);
返回: { "status": "failed", "retcode": 200, "data": null, "message": "Error: file not found", "wording": "Error: file not found", "echo": null }
其中file_id分别尝试从均不能返回文件信息 1、"notice_type":"group_upload"的上报消息中获取id({"time":1724144620,"self_id":1055152278,"post_type":"notice","group_id":839111023,"user_id":60111102,"notice_type":"group_upload","file":{"id":"/7e079f92-cfd2-4fce-9385-ee18025b3208","name":"测试.xlsx","size":51050,"busid":102}}) 2、"post_type":"message"的上报消息中获取file_id({"self_id":1055152278,"user_id":60111102,"time":1724144620,"message_id":376207430,"message_seq":376207430,"real_id":376207430,"message_type":"group","sender":{"user_id":61111102,"nickname":"Ra222lk","card":"1x伟","role":"owner"},"raw_message":"[CQ:file,file=测试.xlsx,path=,url=,file_id=00000000-320a-035f-66c4-5bec7033b6f0,file_size=51050]","font":14,"sub_type":"normal","message":[{"data":{"file":"测试.xlsx","path":"","url":"","file_id":"00000000-320a-035f-66c4-5bec7033b6f0","file_size":"51050"},"type":"file"}],"message_format":"array","post_type":"message","group_id":839517023})
期望的结果?
1、返回文件下载信息 2、设置了enableLocalFile2Url:true,但是上报的群文件消息并没有url相关信息
NapCat 运行日志
No response
OneBot 客户端运行日志
No response
抱歉哦 最近修坏了
@MliKiowa 请问这个能修复吗
可以 未来几个版本修复
催更
催更
你不准催
催更
你不准催
就催就催
同吹
已修
尝试测试看看?
尝试测试看看?
2.2.22貌似也不好使
日志
2024-08-29 20:23:12 [INFO] () | [NapCat] [Core] NapCat.Core Version: 2.2.22
2024-08-29 20:23:12 [INFO] () | [NapCat] [WebUi] Current WebUi is running at http://0.0.0.0:6099
2024-08-29 20:23:12 [INFO] () | [NapCat] [WebUi] Login URL is http://0.0.0.0:6099/webui
2024-08-29 20:23:12 [INFO] () | [NapCat] [WebUi] Login Token is rxyxh33twnn
2024-08-29 20:23:12 [INFO] () | 没有 -q 指令指定快速登录,将使用二维码登录方式
2024-08-29 20:23:12 [INFO] () | 可用于快速登录的 QQ:
1. 3565647342 沫沫
2024-08-29 20:23:12 [WARN] () | 请扫描下面的二维码,然后在手Q上授权登录:
2024-08-29 20:23:12 [WARN] () |
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█ ▄▄▄▄▄ ██▄▄ ▀ ▀█ █ ▄█▀▄█▄█ ▄▄▄▄▄ █
█ █ █ █▀▄ █▀▀▄█▀█ ▀ ▀▀▀█ █ █ █
█ █▄▄▄█ █▄▀ █▄█▄█▀▀▄█▄▄ ▄▄█ █▄▄▄█ █
█▄▄▄▄▄▄▄█▄▀▄█ █▄█ █▄▀ █ ▀▄█▄▄▄▄▄▄▄█
█▄ ▀▀█▄▄ ▀▄ █▄▄█▀ ▄▀▄█▀█▀▄██▀ ▄▀▀██
██ ▄▀██▄█▄▄▀ ▄██ ▀▄██ ▄▀▀▄▀▀ ▄▀▄██
█▄ █▄▀ ▄█▄ █▀█ ▀ █▀▀ ▄█ ▄███ █
█▀█▄▀▄▄▄ █▄█▀█▀ ███▀▀▄▀█▀ ▄█▀█▀▄▀█
█ █ ▄▄█ ▀█▄▄▀ ██▀█ ▄▄▀▄▄▀▀▄▀█ ▀█
█▄ ▀ ▀▄▄█▀▀▀▀▄▄▄▄▄▄▀▄██ ▄█▀██▄█▀█▄█
█ ▀▄█▀▄ █ ▀▄▀▄██▄▄▀█▄▄ ▀██▀ ▀█ ██
█ █▀▄▄ ▄ █▀█▀█▀▄▄▄▄▀█▄▄▀▀ ▀▄██
█▄▄▄▄▄▄▄▄ ▀ ▄▄█ ▀▀▀ █▀█ ▄▄▄ ▀▀▄▀█
█ ▄▄▄▄▄ █ ▄ ▄▄ ▄▄█ ▀ ▄▀ █▄█ ▀ ▄▀█
█ █ █ ██▄█▄ ▄▀▀▀█▀▄▀█▀▀▄ ▄▄ ▄█▄██
█ █▄▄▄█ █▀▄▀▄▄▄▄ ██▄ ▄▄▀███▄ █▄█
█▄▄▄▄▄▄▄█▄▄███▄█▄████▄▄▄█▄██▄▄▄█▄██
二维码解码URL: https://txz.qq.com/p?k=afg-*59xCDp0TKbQR5NJIggMDchGFmqX&f=1600001604
如果控制台二维码无法扫码,可以复制解码url到二维码生成网站生成二维码再扫码,也可以打开下方的二维码路径图片进行扫码。
2024-08-29 20:23:12 [WARN] () | 二维码已保存到 C:\Users\Administrator\Desktop\NapCatQQ\qrcode.png
2024-08-29 20:23:54 [DEBUG] () | 本账号数据/缓存目录: C:\Users\Administrator\Documents\Tencent Files\NapCat\data
2024-08-29 20:23:54 [DEBUG] () | [Core] [Config] 配置文件C:\Users\Administrator\Desktop\NapCatQQ\config\napcat_3565647342.json加载 {"fileLog":true,"consoleLog":true,"fileLogLevel":"info","consoleLogLevel":"info"}
2024-08-29 20:23:54 [INFO] () | [Notice] [OneBot11]
HTTP服务 未启动, :3000
HTTP上报服务 未启动, 上报地址:
WebSocket服务 已启动, 127.0.0.1:5000
WebSocket反向服务 未启动, 反向地址:
2024-08-29 20:23:54 [INFO] () | [OneBot] [WebSocket Server] Server Started undefined:undefined
2024-08-29 20:23:54 [INFO] 沫沫(3565647342) | 接收 <- 群聊 (群 676832751 的 2219349024) 这个我也订阅了
2024-08-29 20:23:54 [INFO] 沫沫(3565647342) | 接收 <- 群聊 (群 676832751 的 2814721302) 名称是什么
2024-08-29 20:23:54 [INFO] 沫沫(3565647342) | 接收 <- 群聊 (群 676832751 的 2219349024) 隐人的都质量特高
2024-08-29 20:23:54 [INFO] 沫沫(3565647342) | 接收 <- 群聊 (群 676832751 的 2814721302) 我也要订阅
2024-08-29 20:23:54 [INFO] 沫沫(3565647342) | 接收 <- 群聊 (群 676832751 的 2814721302) 我的壁纸都不涩
2024-08-29 20:23:54 [INFO] 沫沫(3565647342) | 接收 <- 群聊 (群 676832751 的 242847058) 瞬
2024-08-29 20:23:54 [INFO] 沫沫(3565647342) | 接收 <- 群聊 (群 795067231 的 3410538982) [图片 2B6BD31845D8B303BE5883686F23691D.jpg]
2024-08-29 20:24:39 [INFO] 沫沫(3565647342) | 接收 <- 群聊 (群 676832751 的 3494149397) 要不要早睡
2024-08-29 20:24:41 [INFO] 沫沫(3565647342) | 接收 <- 群聊 (群 1097364579 的 523321293) [文件 青春永驻的悠悠球露台.wld]
2024-08-29 20:24:42 [ERROR] 沫沫(3565647342) | 发生错误 Error: file not found
at GetFile._handle (file:///C:/Users/Administrator/Desktop/NapCatQQ/napcat.mjs:29401:11)
at async GetFile.websocketHandle (file:///C:/Users/Administrator/Desktop/NapCatQQ/napcat.mjs:27815:23)
at async OB11PassiveWebSocketAdapter.handleMessage (file:///C:/Users/Administrator/Desktop/NapCatQQ/napcat.mjs:13386:23)
2024-08-29 20:24:42 [ERROR] 沫沫(3565647342) | 发生错误 Error: file not found
at GetFile._handle (file:///C:/Users/Administrator/Desktop/NapCatQQ/napcat.mjs:29401:11)
at async GetFile.websocketHandle (file:///C:/Users/Administrator/Desktop/NapCatQQ/napcat.mjs:27815:23)
at async OB11PassiveWebSocketAdapter.handleMessage (file:///C:/Users/Administrator/Desktop/NapCatQQ/napcat.mjs:13386:23)
2024-08-29 20:25:07 [INFO] 沫沫(3565647342) | 接收 <- 群聊 (群 816771079 的 2449759802) [表情 ] [表情 ] [表情 ]
2024-08-29 20:26:39 [INFO] 沫沫(3565647342) | 接收 <- 群聊 (群 676832751 的 242847058) 睡
稍等 2.2.24 能够接收消息文件 但是不能通过api群文件下载 晚点再修
稍等 2.2.24 能够接收消息文件 但是不能通过api群文件下载 晚点再修
OK
2.2.26 (可能)已修复
2.2.26 (可能)已修复
依然失败
经测试2.2.26还是提示file_not_found 请求参数:
$response = $client->post('get_file', [
'json' => [
'file_id' => '/421fbf6b-78b5-47e4-ae5f-a65ef64725f6',
],
]);
响应:
{
"status": "failed",
"retcode": 200,
"data": null,
"message": "Error: file not found",
"wording": "Error: file not found"
}
稍等
已修复,即将发版
2.2.27还是报错
2.2.27还是报错
使用 fileId
2.2.27还是报错
使用 fileId
我使用的fileid,这是我的代码,我检查过FileId没有问题
internal static async ValueTask GroupFile(GroupUpLoadFileEventArgs args)
{
try
{
if (args.UpLoad.Size > 1024 * 1024 * 30)
return;
var (status, fileinfo) = await args.OneBotAPI.GetFile(args.UpLoad.ID);
if (status.RetCode != MomoAPI.Enumeration.ApiType.ApiStatusType.Ok || string.IsNullOrEmpty(fileinfo.Base64))
return;
var buffer = Convert.FromBase64String(fileinfo.Base64);
foreach (var server in MorMorAPI.Setting.Servers)
{
if (server != null && server.WaitFile != null)
{
if (server.Groups.Contains(args.GroupId))
{
server.WaitFile.TrySetResult(buffer);
}
}
}
}
catch (Exception e)
{
await args.OneBotAPI.SendGroupMessage(args.GroupId,"[GetFile] Error" + e.Message);
}
}
这是日志
2024-08-30 12:43:16 [INFO] () | [NapCat] [Core] NapCat.Core Version: 2.2.27
2024-08-30 12:43:17 [INFO] () | [NapCat] [WebUi] Current WebUi is running at http://0.0.0.0:6099
2024-08-30 12:43:17 [INFO] () | [NapCat] [WebUi] Login URL is http://0.0.0.0:6099/webui
2024-08-30 12:43:17 [INFO] () | 没有 -q 指令指定快速登录,将使用二维码登录方式
2024-08-30 12:43:17 [INFO] () | 可用于快速登录的 QQ:
1. 3565647342 沫沫
2024-08-30 12:43:17 [WARN] () | 请扫描下面的二维码,然后在手Q上授权登录:
2024-08-30 12:43:17 [WARN] () |
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
█ ▄▄▄▄▄ █ ██▀▀▄█▄▀▄▀▀▀▀ ███ ▄▄▄▄▄ █
█ █ █ █ ▀█ ▀█ ▄▄ ▀█▄▄███ █ █ █
█ █▄▄▄█ █▀ █▄ ▀▄▀▄ █▀▄█▀█ █▄▄▄█ █
█▄▄▄▄▄▄▄█▄█ ▀▄█▄▀▄▀▄▀▄▀▄▀ █▄▄▄▄▄▄▄█
█ █▀▄▄▄███▄█▄▀▄ ▄▄▄▀▄▄ ▄▀█ █▄ ▄▄█
█▄█▄▀▄█▄▄▄ ▄█▀██▄▄▀▄█ ▀ ▀▀▀▄█▀▄▄██
█ ██▄▄▀▄ █▀▄▀▀▄▀▀▀██ ▄▄▀▄▀▄█▄▄█▄▄█
█ ▄▄█▄▀▄ ▄▄▀ ▄██▄▄ ▀██ █ ▀ ▀ ▄▄██
█ ▄ ▄▄▀▄▀▀▀▀█▄▀▄▀██▀▀▄▄ ██▀▄ ▄▀██▄█
█▄ ██▀█▄ ▀ ██▀██▄█▀▄▀▄▀▄ ▄▀ ▀▄▄██
█▀▄▀▀▄▀▄▀█ ▄▀▀▄▀▀▄█▄▄▄▀ ▀ ▄ ▄▀██▄█
███▄ ▀█▄ ▄▀▀ ▄█▀ █▀ ██ ▄▄ ▄██▄▄██
█▄▄█▄██▄▄▀▄▀█▄▀▄▄▀▄▀▄█▄ ▄ ▄▄▄ ▀ ██
█ ▄▄▄▄▄ █▀ ██▀▄▄ ▄▀ ▀▀ ██ █▄█ ▄█▄██
█ █ █ █▄█▀▄ ▀▄█ █ ▄▄ ▀▄▄ ▄ ▄█▀ █
█ █▄▄▄█ █▀ ▄ ▀██▄█ ▀▀▀▀██ ▄▄ ▄▄█▄██
█▄▄▄▄▄▄▄█▄▄████▄█▄██▄█▄██▄▄▄█▄▄██▄█
二维码解码URL: https://txz.qq.com/p?k=TdlKVsres0uw6FpcH-KHyh6YFwgyWTMg&f=1600001604
如果控制台二维码无法扫码,可以复制解码url到二维码生成网站生成二维码再扫码,也可以打开下方的二维码路径图片进行扫码。
2024-08-30 12:43:17 [WARN] () | 二维码已保存到 C:\Users\Administrator\Desktop\NapCatQQ\qrcode.png
2024-08-30 12:43:50 [DEBUG] () | 本账号数据/缓存目录: C:\Users\Administrator\Documents\Tencent Files\NapCat\data
2024-08-30 12:43:50 [DEBUG] () | [Core] [Config] 配置文件C:\Users\Administrator\Desktop\NapCatQQ\config\napcat_3565647342.json加载 {"fileLog":true,"consoleLog":true,"fileLogLevel":"info","consoleLogLevel":"info"}
2024-08-30 12:43:50 [INFO] () | [Notice] [OneBot11]
HTTP服务 未启动, :3000
HTTP上报服务 未启动, 上报地址:
WebSocket服务 已启动, 127.0.0.1:5000
WebSocket反向服务 未启动, 反向地址:
2024-08-30 12:43:50 [INFO] () | [OneBot] [WebSocket Server] Server Started undefined:undefined
2024-08-30 12:44:09 [INFO] 沫沫(3565647342) | 接收 <- 临时消息 (2747277822)
2024-08-30 12:44:24 [INFO] 沫沫(3565647342) | 接收 <- 群聊 (群 1097364579 的 523321293) [文件 青春永驻的悠悠球露台.wld]
2024-08-30 12:44:24 [ERROR] 沫沫(3565647342) | 发生错误 Error: file not found
at GetFile._handle (file:///C:/Users/Administrator/Desktop/NapCatQQ/napcat.mjs:29457:11)
at async GetFile.websocketHandle (file:///C:/Users/Administrator/Desktop/NapCatQQ/napcat.mjs:27889:23)
at async OB11PassiveWebSocketAdapter.handleMessage (file:///C:/Users/Administrator/Desktop/NapCatQQ/napcat.mjs:13426:23)
2024-08-30 12:44:24 [ERROR] 沫沫(3565647342) | 发生错误 Error: file not found
at GetFile._handle (file:///C:/Users/Administrator/Desktop/NapCatQQ/napcat.mjs:29457:11)
at async GetFile.websocketHandle (file:///C:/Users/Administrator/Desktop/NapCatQQ/napcat.mjs:27889:23)
at async OB11PassiveWebSocketAdapter.handleMessage (file:///C:/Users/Administrator/Desktop/NapCatQQ/napcat.mjs:13426:23)
2024-08-30 12:46:13 [INFO] 沫沫(3565647342) | 接收 <- 群聊 (群 1097364579 的 523321293) [文件 惊异_盒子.wld]
2024-08-30 12:46:13 [ERROR] 沫沫(3565647342) | 发生错误 Error: file not found
at GetFile._handle (file:///C:/Users/Administrator/Desktop/NapCatQQ/napcat.mjs:29457:11)
at async GetFile.websocketHandle (file:///C:/Users/Administrator/Desktop/NapCatQQ/napcat.mjs:27889:23)
at async OB11PassiveWebSocketAdapter.handleMessage (file:///C:/Users/Administrator/Desktop/NapCatQQ/napcat.mjs:13426:23)
2024-08-30 12:46:13 [ERROR] 沫沫(3565647342) | 发生错误 Error: file not found
at GetFile._handle (file:///C:/Users/Administrator/Desktop/NapCatQQ/napcat.mjs:29457:11)
at async GetFile.websocketHandle (file:///C:/Users/Administrator/Desktop/NapCatQQ/napcat.mjs:27889:23)
at async OB11PassiveWebSocketAdapter.handleMessage (file:///C:/Users/Administrator/Desktop/NapCatQQ/napcat.mjs:13426:23)
你输出下看看
fileid我看看
收到上报的文件消息时fileID和通过get_group_file_list接口获取到的fileId不一样? 1、文件消息就是post_type=notice,接收到的fileId为:/dff35e6f-4182-4eab-bc54-787d5c3832612
{"time":1724995568,"self_id":1055152278,"post_type":"notice","group_id":839517023,"user_id":60202,"notice_type":"group_upload","file":{"id":"\/dff35e6f-4182-4eab-bc54-787d5c383261","name":"test2-20240830.txt","size":8,"busid":102}}
2、通过get_group_file_list接口获取到的fileId:NapCatOneBot-ModeldFile-2-839517023-7408800526304131934
v2.2.27调用get_file时,传入1和2的id还是都不能下载,。 这俩fileId应该是同一个值才对吧?
docker运行日志:
下个版本修
https://github.com/NapNeko/NapCatQQ/actions/runs/10628883191
可用于测试
https://github.com/NapNeko/NapCatQQ/actions/runs/10628883191
可用于测试
依然失败
1、文件消息就是post_type=notice,接收到的fileId为:/dff35e6f-4182-4eab-bc54-787d5c3832612
https://github.com/NapNeko/NapCatQQ/actions/runs/10632975674
修复了上报 fileId 的问题,将其格式化再上报,应该可以用于下载文件,麻烦再次尝试。这个 Issue 已经拖了若干个构建版本了,也感谢配合测试。如果无问题可以自行关闭。
1、文件消息就是post_type=notice,接收到的fileId为:/dff35e6f-4182-4eab-bc54-787d5c3832612
https://github.com/NapNeko/NapCatQQ/actions/runs/10632975674
修复了上报
fileId的问题,将其格式化再上报,应该可以用于下载文件,麻烦再次尝试。这个 Issue 已经拖了若干个构建版本了,也感谢配合测试。如果无问题可以自行关闭。
该版调用API不会返回结果,直到NapCat报错
at Timeout.sendDataCallback [as _onTimeout] (file:///C:/Users/Administrator/Desktop/NapCatShell/napcat.mjs:7470:18)
at listOnTimeout (node:internal/timers:573:17)
at process.processTimers (node:internal/timers:514:7)
2024-08-30 21:32:37 [ERROR] 沫沫(3565647342) | 发生错误 Error: Timeout: NTEvent serviceAndMethod:NodeIKernelMsgService/downloadRichMedia ListenerName:NodeIKernelMsgListener/onRichMediaDownloadComplete EventRet:
undefined
已经确认是我们源代码的问题,2.2.28 已修复。