NapNeko / NapCatQQ

现代化的基于 NTQQ 的 Bot 协议端实现
https://napcat.napneko.icu
Other
2.68k stars 196 forks source link

发送图片出现错误 #41

Closed Linkiesr closed 6 months ago

Linkiesr commented 6 months ago

系统版本

Ubuntu 20.04

QQNT 版本

QQ_3.2.7_240428_amd64_01

NapCat 版本

1.3.5

OneBot 客户端

0

发生了什么?

发送图片出现error报错,图片正常发送,但是没办法获取消息id撤回消息

如何复现

ws反代hoshinobot框架使用setu_renew插件发送图片时出现报错

期望的结果?

能发图也能撤回

NapCat 运行日志

2024-05-27 19:32:11 [DEBUG] 托尔(311684) 
收到消息 [{"msgId":"7373640790118217299","msgRandom":"2780660784","msgSeq":"13510","cntSeq":"0","chatType":2,"msgType":2,"subMsgType":1,"sendType":0,"senderUid":"u_M0pHtK8wwWxBGGfYMMCizQ","peerUid":"9617","channelId":"","guildId":"","guildCode":"0","fromUid":"0","fromAppid":"0","msgTime":"1716809531","msgMeta":"0x","sendStatus":2,"sendRemarkName":"","sendMemberName":"","sendNickName":"愚人","guildName":"","channelName":"","elements":[{"elementType":1,"elementId":"7373640790118217298","extBufForUI":"0x","textElement":{"content":"色图","atType":0,"atUid":"0","atTinyId":"0","atNtUid":"","subElementType":0,"atChannelId":"0","linkInfo":null,"atRoleId":"0","atRoleColor":0,"atRoleName":"","needNotify":0},"faceElement":null,"marketFaceElement":null,"replyElement":null,"picElement":null,"pttElement":null,"videoElement":null,"grayTipElement":null,"arkElement":null,"fileElement":null,"liveGiftElement":null,"markdownElement":null,"structLongMsgElement":null,"multiForwardMsgElement":null,"giphyElement":null,"walletElement":null,"inlineKeyboardElement":null,"textGiftElement":null,"calendarElement":null,"yoloGameResultElement":null,"avRecordElement":null,"structMsgElement":null,"faceBubbleElement":null,"shareLocationElement":null,"tofuRecordElement":null,"taskTopMsgElement":null,"recommendedMsgElement":null,"actionBarElement":null}],"records":[],"emojiLikesList":[],"commentCnt":"0","directMsgFlag":0,"directMsgMembers":[],"peerName":"test","freqLimitInfo":null,"editable":false,"avatarMeta":"","avatarPendant":"","feedId":"","roleId":"0","timeStamp":"0","clientIdentityInfo":null,"isImportMsg":false,"atType":0,"roleType":0,"fromChannelRoleInfo":{"roleId":"0","name":"","color":0},"fromGuildRoleInfo":{"roleId":"0","name":"","color":0},"levelRoleInfo":{"roleId":"0","name":"","color":0},"recallTime":"0","isOnlineMsg":true,"generalFlags":"0x","clientSeq":"0","fileGroupSize":null,"foldingInfo":null,"multiTransInfo":null,"senderUin":"10554","peerUin":"96177","msgAttrs":{},"anonymousExtInfo":null,"nameType":0,"avatarFlag":0,"extInfoForUI":null,"personalMedal":null,"categoryManage":0,"msgEventInfo":null}] 

2024-05-27 19:32:11 [DEBUG] 托尔(311684) 
记录消息到数据库, 消息长id: 7373640790118217299, 短id: -2147469475 

2024-05-27 19:32:11 [DEBUG] 托尔(311684) 
收到新消息 {"msgId":"7373640790118217299","msgRandom":"2780660784","msgSeq":"13510","cntSeq":"0","chatType":2,"msgType":2,"subMsgType":1,"sendType":0,"senderUid":"u_M0pHtK8wwWxBGGfYMMCizQ","peerUid":"9617","channelId":"","guildId":"","guildCode":"0","fromUid":"0","fromAppid":"0","msgTime":"1716809531","msgMeta":"0x","sendStatus":2,"sendRemarkName":"","sendMemberName":"","sendNickName":"愚人","guildName":"","channelName":"","elements":[{"elementType":1,"elementId":"7373640790118217298","extBufForUI":"0x","textElement":{"content":"色图","atType":0,"atUid":"0","atTinyId":"0","atNtUid":"","subElementType":0,"atChannelId":"0","linkInfo":null,"atRoleId":"0","atRoleColor":0,"atRoleName":"","needNotify":0},"faceElement":null,"marketFaceElement":null,"replyElement":null,"picElement":null,"pttElement":null,"videoElement":null,"grayTipElement":null,"arkElement":null,"fileElement":null,"liveGiftElement":null,"markdownElement":null,"structLongMsgElement":null,"multiForwardMsgElement":null,"giphyElement":null,"walletElement":null,"inlineKeyboardElement":null,"textGiftElement":null,"calendarElement":null,"yoloGameResultElement":null,"avRecordElement":null,"structMsgElement":null,"faceBubbleElement":null,"shareLocationElement":null,"tofuRecordElement":null,"taskTopMsgElement":null,"recommendedMsgElement":null,"actionBarElement":null}],"records":[],"emojiLikesList":[],"commentCnt":"0","directMsgFlag":0,"directMsgMembers":[],"peerName":"test","freqLimitInfo":null,"editable":false,"avatarMeta":"","avatarPendant":"","feedId":"","roleId":"0","timeStamp":"0","clientIdentityInfo":null,"isImportMsg":false,"atType":0,"roleType":0,"fromChannelRoleInfo":{"roleId":"0","name":"","color":0},"fromGuildRoleInfo":{"roleId":"0","name":"","color":0},"levelRoleInfo":{"roleId":"0","name":"","color":0},"recallTime":"0","isOnlineMsg":true,"generalFlags":"0x","clientSeq":"0","fileGroupSize":null,"foldingInfo":null,"multiTransInfo":null,"senderUin":"10554","peerUin":"96177","msgAttrs":{},"anonymousExtInfo":null,"nameType":0,"avatarFlag":0,"extInfoForUI":null,"personalMedal":null,"categoryManage":0,"msgEventInfo":null,"id":-2147469475} 

2024-05-27 19:32:11 [DEBUG] 托尔(311684) 
收到消息:  {"self_id":311684,"user_id":10554,"time":1716809531,"message_id":-2147469475,"message_seq":-2147469475,"real_id":-2147469475,"message_type":"group","sender":{"user_id":10554,"nickname":"愚人","card":"","role":"owner"},"raw_message":"色图","font":14,"sub_type":"normal","message":[{"data":{"text":"色图"},"type":"text"}],"message_format":"array","post_type":"message","group_id":96177} 

2024-05-27 19:32:11 [DEBUG] 托尔(311684) 
ws 消息上报 ws://0.0.0.0:9222/ws {"self_id":311684,"user_id":10554,"time":1716809531,"message_id":-2147469475,"message_seq":-2147469475,"real_id":-2147469475,"message_type":"group","sender":{"user_id":10554,"nickname":"愚人","card":"","role":"owner"},"raw_message":"色图","font":14,"sub_type":"normal","message":[{"data":{"text":"色图"},"type":"text"}],"message_format":"array","post_type":"message","group_id":9615} 

2024-05-27 19:32:11 [DEBUG] 托尔(311684) 
ws 消息上报 ws://172.22.56.47:8080/ws {"self_id":311684,"user_id":10554,"time":1716809531,"message_id":-2147469475,"message_seq":-2147469475,"real_id":-2147469475,"message_type":"group","sender":{"user_id":10554,"nickname":"愚人","card":"","role":"owner"},"raw_message":"色图","font":14,"sub_type":"normal","message":[{"data":{"text":"色图"},"type":"text"}],"message_format":"array","post_type":"message","group_id":9617} 

2024-05-27 19:32:11 [INFO] 托尔(311684) 
群[test(9617)] 愚かな人(10554): 色图

2024-05-27 19:32:12 [DEBUG] 托尔(311684) 
收到反向Websocket消息 {"action":"send_msg","params":{"user_id":10554,"message_type":"group","group_id":9617,"message":[{"type":"text","data":{"text":"「公主们的兔女郎」/「蝶天希」\nPID:101303792"}},{"type":"image","data":{"file":"base64:///9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAzKCsADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NX..."}}]},"echo":{"seq":1}} 

2024-05-27 19:32:12 [INFO] 托尔(311684) 
获取文件类型 jpg /root/.config/QQ/NapCat/temp/4c788734-5bd8-4b39-bfe2-adaf45f189e7 

2024-05-27 19:32:12 [DEBUG] 托尔(311684) 
图片信息 {"md5HexStr":"6a4128529dfd84fdb5c8fde49f6d26c2","fileSize":"571217","picWidth":2752,"picHeight":3274,"fileName":"4c788734-5bd8-4b39-bfe2-adaf45f189e7.jpg","sourcePath":"/root/.config/QQ/nt_qq_66f96a7de606c72a4c69795ee69623a0/nt_data/Pic/2024-05/Ori/6a4128529dfd84fdb5c8fde49f6d26c2.jpg","original":true,"picType":1000,"picSubType":0,"fileUuid":"","fileSubId":"","thumbFileSize":0,"summary":""} 

2024-05-27 19:32:12 [INFO] 托尔(311684) 
发送消息 给群聊 群[test(9617)] : 「公主们的兔女郎」/「蝶天希」
PID:101303792

[图片]https://gchat.qpic.cn/gchatpic_new/0/0-0-6A4128529DFD84FDB5C8FDE49F6D26C2/0

2024-05-27 19:32:12 [DEBUG] 托尔(311684) 
记录消息到数据库, 消息长id: 7447857824302034051, 短id: -2147469474 

2024-05-27 19:32:13 [ERROR] 托尔(311684) 
发生错误 {"errno":-2,"syscall":"unlink","code":"ENOENT","path":"/root/.config/QQ/NapCat/temp/4c788734-5bd8-4b39-bfe2-adaf45f189e7.jpg"} 

2024-05-27 19:32:13 [DEBUG] 托尔(311684) 
ws 消息上报 ws://172.22.56.47:8080/ws {"status":"failed","retcode":1200,"data":null,"message":"Error: ENOENT: no such file or directory, unlink '/root/.config/QQ/NapCat/temp/4c788734-5bd8-4b39-bfe2-adaf45f189e7.jpg'\n    at Object.unlinkSync (node:fs:1883:3)\n    at /root/qqbot/Napcat/NapCat.linux.x64/napcat.cjs:21726:14801\n    at Array.forEach (<anonymous>)\n    at SendMsg._handle (/root/qqbot/Napcat/NapCat.linux.x64/napcat.cjs:21726:14767)\n    at async SendMsg.websocketHandle (/root/qqbot/Napcat/NapCat.linux.x64/napcat.cjs:21718:8166)\n    at async ReverseWebsocket.onmessage (/root/qqbot/Na...","wording":"Error: ENOENT: no such file or directory, unlink '/root/.config/QQ/NapCat/temp/4c788734-5bd8-4b39-bfe2-adaf45f189e7.jpg'\n    at Object.unlinkSync (node:fs:1883:3)\n    at /root/qqbot/Napcat/NapCat.linux.x64/napcat.cjs:21726:14801\n    at Array.forEach (<anonymous>)\n    at SendMsg._handle (/root/qqbot/Napcat/NapCat.linux.x64/napcat.cjs:21726:14767)\n    at async SendMsg.websocketHandle (/root/qqbot/Napcat/NapCat.linux.x64/napcat.cjs:21718:8166)\n    at async ReverseWebsocket.onmessage (/root/qqbot/Na...","echo":{"seq":1}} 

2024-05-27 19:32:13 [DEBUG] 托尔(311684) 
更新消息, shortId:undefined, seq: 13511, msgId: 7447857824302034051

OneBot 客户端运行日志

这里是反代的报错:
[2024-05-27 19:42:04,386 涩图] INFO: Message -2147469467 triggered send_search_setu.
[2024-05-27 19:42:05,905 涩图] ERROR: <class 'aiocqhttp.exceptions.ActionFailed'> occured when send_search_setu handling message -2147469467.
[2024-05-27 19:42:05,905 涩图] ERROR: <ActionFailed status='failed', retcode=1200, data=None, message="Error: ENOENT: no such file or directory, unlink '/root/.config/QQ/NapCat/temp/ddbc743d-09c4-4bbb-a677-c1d3df2891bd.jpg'\n    at Object.unlinkSync (node:fs:1883:3)\n    at /root/qqbot/Napcat/NapCat.linux.x64/napcat.cjs:21726:14801\n    at Array.forEach (<anonymous>)\n    at SendMsg._handle (/root/qqbot/Napcat/NapCat.linux.x64/napcat.cjs:21726:14767)\n    at async SendMsg.websocketHandle (/root/qqbot/Napcat/NapCat.linux.x64/napcat.cjs:21718:8166)\n    at async ReverseWebsocket.onmessage (/root/qqbot/Napcat/NapCat.linux.x64/napcat.cjs:22353:8613)\n    at async WebSocket.<anonymous> (/root/qqbot/Napcat/NapCat.linux.x64/napcat.cjs:22353:11945)", wording="Error: ENOENT: no such file or directory, unlink '/root/.config/QQ/NapCat/temp/ddbc743d-09c4-4bbb-a677-c1d3df2891bd.jpg'\n    at Object.unlinkSync (node:fs:1883:3)\n    at /root/qqbot/Napcat/NapCat.linux.x64/napcat.cjs:21726:14801\n    at Array.forEach (<anonymous>)\n    at SendMsg._handle (/root/qqbot/Napcat/NapCat.linux.x64/napcat.cjs:21726:14767)\n    at async SendMsg.websocketHandle (/root/qqbot/Napcat/NapCat.linux.x64/napcat.cjs:21718:8166)\n    at async ReverseWebsocket.onmessage (/root/qqbot/Napcat/NapCat.linux.x64/napcat.cjs:22353:8613)\n    at async WebSocket.<anonymous> (/root/qqbot/Napcat/NapCat.linux.x64/napcat.cjs:22353:11945)", echo={'seq': 1}>
Traceback (most recent call last):
  File "/root/qqbot/HoshinoBot/hoshino/msghandler.py", line 28, in handle_message
    await service_func.func(bot, event)
  File "/root/qqbot/HoshinoBot/hoshino/modules/setu_renew/__init__.py", line 291, in send_search_setu
    result_list = await send_msg(msg_list, ev)
  File "/root/qqbot/HoshinoBot/hoshino/modules/setu_renew/__init__.py", line 142, in send_msg
    result_list.append(await hoshino.get_bot().send(ev, msg))
  File "/usr/local/lib/python3.8/dist-packages/aiocqhttp/__init__.py", line 271, in send
    return await self.send_msg(**params)
  File "/usr/local/lib/python3.8/dist-packages/aiocqhttp/__init__.py", line 238, in call_action
    return await self._api.call_action(action=action, **params)
  File "/usr/local/lib/python3.8/dist-packages/aiocqhttp/api_impl.py", line 178, in call_action
    result = await self._wsr_api.call_action(action, **params)
  File "/usr/local/lib/python3.8/dist-packages/aiocqhttp/api_impl.py", line 153, in call_action
    return _handle_api_result(await
  File "/usr/local/lib/python3.8/dist-packages/aiocqhttp/api_impl.py", line 38, in _handle_api_result
    raise ActionFailed(result=result)
aiocqhttp.exceptions.ActionFailed: <ActionFailed status='failed', retcode=1200, data=None, message="Error: ENOENT: no such file or directory, unlink '/root/.config/QQ/NapCat/temp/ddbc743d-09c4-4bbb-a677-c1d3df2891bd.jpg'\n    at Object.unlinkSync (node:fs:1883:3)\n    at /root/qqbot/Napcat/NapCat.linux.x64/napcat.cjs:21726:14801\n    at Array.forEach (<anonymous>)\n    at SendMsg._handle (/root/qqbot/Napcat/NapCat.linux.x64/napcat.cjs:21726:14767)\n    at async SendMsg.websocketHandle (/root/qqbot/Napcat/NapCat.linux.x64/napcat.cjs:21718:8166)\n    at async ReverseWebsocket.onmessage (/root/qqbot/Napcat/NapCat.linux.x64/napcat.cjs:22353:8613)\n    at async WebSocket.<anonymous> (/root/qqbot/Napcat/NapCat.linux.x64/napcat.cjs:22353:11945)", wording="Error: ENOENT: no such file or directory, unlink '/root/.config/QQ/NapCat/temp/ddbc743d-09c4-4bbb-a677-c1d3df2891bd.jpg'\n    at Object.unlinkSync (node:fs:1883:3)\n    at /root/qqbot/Napcat/NapCat.linux.x64/napcat.cjs:21726:14801\n    at Array.forEach (<anonymous>)\n    at SendMsg._handle (/root/qqbot/Napcat/NapCat.linux.x64/napcat.cjs:21726:14767)\n    at async SendMsg.websocketHandle (/root/qqbot/Napcat/NapCat.linux.x64/napcat.cjs:21718:8166)\n    at async ReverseWebsocket.onmessage (/root/qqbot/Napcat/NapCat.linux.x64/napcat.cjs:22353:8613)\n    at async WebSocket.<anonymous> (/root/qqbot/Napcat/NapCat.linux.x64/napcat.cjs:22353:11945)", echo={'seq': 1}>
[2024-05-27 19:42:05,907 nonebot] INFO: Message -2147469467 is ignored: Handled by Hoshino
Linkiesr commented 6 months ago

升级到1.4.0解决了