[Bug?]: 私聊中的撤回会报错
Closed this issue · 7 comments
Zhosen12 commented
请确保您已阅读以上注意事项,并勾选下方的确认框。
- 我已经仔细阅读上述内容
- 我已经使用 最新构建 测试过,问题依旧存在。
- 我已经在 Issue Tracker 中找过我要提出的问题,没有找到相同问题的ISSUE。
- 我已知晓并同意,此处仅用于汇报程序中存在的问题。若这个 Issue 是关于其他非程序本身问题,则我的 Issue 可能会被无条件自动关闭或/并锁定。(其它疑问请考虑加入TG群询问或在discussions中提问)
Lagrange项目
OneBot
所使用/依赖的Lagrange项目对应的commit
运行环境
Windows
运行架构
x64
连接方式
反向 WebSocket
重现步骤
#我是使用nonebot2框架写的,推断是私聊中撤回消息的过程有问题,因为群聊可以,我猜测不是nonebot和我编写的问题,我找到了一个已经解决的类似issue #260 但我依旧无法撤回私聊中bot发送的消息
期望的结果是什么?
应当撤回”正在获取...“这条消息,
实际的结果是什么?
但只有在群聊中生效,私聊中无效
简单的复现代码/链接(可选)
from nonebot.adapters.onebot.v11 import Bot
import asyncio
@example.handle()
async def _(bot: OBot, event: LOMessageEvent, args: Message = CommandArg()):
msg = await bot.send(event, LOMessage("正在获取..."))
await asyncio.sleep(1)
##############################################
await bot.delete_msg(message_id=msg['message_id']) # 这行会报错 nonebot.adapters.onebot.v11.exception.ActionFailed: ActionFailed(status='failed', retcode=200, data=None, echo='2')
##############################################
await example.finish()
Trace 级别日志记录(可选)
info: Lagrange.Core.BotContext[0]
[2024-08-18 18:47:13] [MessagingLogic] [VERBOSE]: [MessageChain(114514)] [Text]: #mcb 33
trce: Lagrange.OneBot.Core.Network.Service.ReverseWSService[2]
[ReverseWSService] Send(9a36302a-edab-439d-9be3-23027e75f206): {"message_type":"private","sub_type":"friend","message_id":1318184227,"user_id":114514,"
message":[{"type":"text","data":{"text":"#mcb 33"}}],"raw_message":"#mcb 33","font":0,"sender":{"user_id":114514,"nickname":"nickname","sex":"unknown"},"target_id":666666,"time":1723978033,"self_id":666666,"post_type":"message"}
trce: Lagrange.OneBot.Core.Network.Service.ReverseWSService[3]
[ReverseWSService] Receive(9a36302a-edab-439d-9be3-23027e75f206): {"action": "send_msg", "params": {"user_id": 114514, "message_type": "private", "message": [{"type": "text", "data": {"text": "正在获取...(已替换)"}}]}, "echo": "8"}
trce: Lagrange.Core.BotContext[0]
[2024-08-18 18:47:13] [ServiceContext] [DEBUG]: Outgoing SSOFrame: MessageSvc.PbSendMsg
trce: Lagrange.Core.BotContext[0]
[2024-08-18 18:47:16] [ServiceContext] [DEBUG]: Outgoing SSOFrame: Heartbeat.Alive
trce: Lagrange.Core.BotContext[0]
[2024-08-18 18:47:17] [ServiceContext] [DEBUG]: Incoming SSOFrame: MessageSvc.PbSendMsg
trce: Lagrange.OneBot.Core.Network.Service.ReverseWSService[2]
[ReverseWSService] Send(9a36302a-edab-439d-9be3-23027e75f206): {"status":"ok","retcode":0,"data":{"message_id":18027444},"echo":"8"}
trce: Lagrange.OneBot.Core.Network.Service.ReverseWSService[2]
[ReverseWSService] Send(9a36302a-edab-439d-9be3-23027e75f206): {"interval":5000,"status":{"app_initialized":true,"app_enabled":true,"app_good":true,"online":true,"good":true},"meta_event_type":"heartbeat","time":1723978037,"self_id":666666,"post_type":"meta_event"}
trce: Lagrange.OneBot.Core.Network.Service.ReverseWSService[3]
[ReverseWSService] Receive(9a36302a-edab-439d-9be3-23027e75f206): {"action": "send_msg", "params": {"user_id": 114514, "message_type": "private", "mess
age": [{"type": "text", "data": {"text": "https://zh.minecraft.wiki/w/33?variant=zh-cn"}}, {"type": "image", "data": {"file": "screenshot.png", "type": null, "cache": "true", "proxy": "true", "timeout": null}}]}, "echo": "9"}
trce: Lagrange.Core.BotContext[0]
[2024-08-18 18:47:18] [ServiceContext] [DEBUG]: Outgoing SSOFrame: OidbSvcTrpcTcp.0x11c5_100
trce: Lagrange.Core.BotContext[0]
[2024-08-18 18:47:18] [ServiceContext] [DEBUG]: Incoming SSOFrame: OidbSvcTrpcTcp.0x11c5_100
trce: Lagrange.Core.BotContext[0]
[2024-08-18 18:47:18] [ServiceContext] [DEBUG]: Outgoing SSOFrame: MessageSvc.PbSendMsg
trce: Lagrange.Core.BotContext[0]
[2024-08-18 18:47:19] [ServiceContext] [DEBUG]: Incoming SSOFrame: MessageSvc.PbSendMsg
trce: Lagrange.OneBot.Core.Network.Service.ReverseWSService[2]
[ReverseWSService] Send(9a36302a-edab-439d-9be3-23027e75f206): {"status":"ok","retcode":0,"data":{"message_id":18106923},"echo":"9"}
trce: Lagrange.OneBot.Core.Network.Service.ReverseWSService[3]
[ReverseWSService] Receive(9a36302a-edab-439d-9be3-23027e75f206): {"action": "delete_msg", "params": {"message_id": 18027444}, "echo": "10"}
warn: Lagrange.OneBot.Core.Operation.OperationService[0]
Unexpected error encountered while handling message.
System.Exception: Exception of type 'System.Exception' was thrown.
at Lagrange.OneBot.Core.Operation.Message.DeleteMessageOperation.HandleOperation(BotContext context, JsonNode payload)
at Lagrange.OneBot.Core.Operation.OperationService.HandleOperation(MsgRecvEventArgs e)
trce: Lagrange.OneBot.Core.Network.Service.ReverseWSService[2]
[ReverseWSService] Send(9a36302a-edab-439d-9be3-23027e75f206): {"status":"failed","retcode":200,"data":null,"echo":"10"}
trce: Lagrange.OneBot.Core.Network.Service.ReverseWSService[2]
[ReverseWSService] Send(9a36302a-edab-439d-9be3-23027e75f206): {"interval":5000,"status":{"app_initialized":true,"app_enabled":true,"app_good":true,"online":true,"good":true},"meta_event_type":"heartbeat","time":1723978042,"self_id":666666,"post_type":"meta_event"}
补充说明(可选)
群聊中的撤回在旧版qq依旧可见(只是提一下,可能也就我用旧版了)
另外,第一次写issue,有不对的地方请指出,感谢
dogdie233 commented
刚想试着复现,发现根本没有撤回私聊消息的API(Core)
@Linwenxuan04
Zhosen12 commented
刚想试着复现,发现根本没有撤回私聊消息的API(Core) @Linwenxuan04
所以现在是不支持私聊撤回么,我以为delete_msg是群聊和私聊通用的
dogdie233 commented
刚想试着复现,发现根本没有撤回私聊消息的API(Core) @Linwenxuan04
所以现在是不支持私聊撤回么,我以为delete_msg是群聊和私聊通用的
按Onebot的规范,是通用的,但是拉格兰只写了群聊撤回的协议
Zhosen12 commented
刚想试着复现,发现根本没有撤回私聊消息的API(Core) @Linwenxuan04
所以现在是不支持私聊撤回么,我以为delete_msg是群聊和私聊通用的
按Onebot的规范,是通用的,但是拉格兰只写了群聊撤回的协议
那我这个issu是不是直接关了比较好
dogdie233 commented
那我这个issu是不是直接关了比较好
开着吧
pk5ls20 commented
刚想试着复现,发现根本没有撤回私聊消息的API(Core) @Linwenxuan04
efce0c2 已实现,再试试(?