ieew / nonebot_adapter_mirai2

nonebot2 的三方 adapter,用以为 nonebot2 提供 MiraiApiHttp2 协议支持
https://ieew.github.io/nonebot_adapter_mirai2/
GNU Affero General Public License v3.0
20 stars 6 forks source link

quote 无法正常使用 #57

Open Well2333 opened 1 year ago

Well2333 commented 1 year ago

在使用quote类型的MessageSegment时,无法通过 mather.send(quote + "some text") 的方式正常发出,其中 quote 的构建方式如下所示,其中的内容与下方示例字典一致,可以确认的是 quote 的构建是没有问题的

image

在发送后,其中 quote 部分会被直接丢弃,发送的消息仅会保留 some text 部分。

我注意到,在bot的send方法中包含了quote字段,但根据 mah的文档,此 quote 仅需要被回复消息的 message_id,也不是 MessageSegment 中的 quote

https://github.com/ieew/nonebot_adapter_mirai2/blob/main/nonebot/adapters/mirai2/bot.py#L39

MikuPy2001 commented 1 year ago

正确使用方式为 await the.finish(res, quote=source_id, at_sender=True) 这和HTTP API的实现方式有关

见这个讨论

Well2333 commented 1 year ago

正确使用方式为 await the.finish(res, quote=source_id, at_sender=True) 这和HTTP API的实现方式有关 #见这个讨论

是的,我在问题中也提到了这点,但是这对跨平台适配造成了极大的困难,类似 OneBot 等协议适配器可以将 Reply 传入 Message 中进行使用,但 mirai2 适配器无法做到这点,导致代码结构会变得更加复杂。

归根到底,还是适配器应该还原协议端的使用方式(即使非常 shit)还是重新设计为更符合 NoneBot 的使用方式。在此适配器中看起来是照搬 mah 的设计方式且完全抛弃 NoneBot 的设计方式,这点对于跨平台来说是致命的了。