We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Message
目前的需求是获取引用消息的内容,获取消息详情的 api message/view 的返回值是 ChannelMessage,该怎么将它转为 nonebot 中的 Message 呢?
message/view
ChannelMessage
nonebot
适配器中有 MessageDeserializer 来反序列化,但它似乎是处理消息事件中的字段,和消息详情的返回值有些区别,例如: Image 是这么反序列化的,
MessageDeserializer
Image
nonebot-adapter-kaiheila/nonebot/adapters/kaiheila/message.py
Lines 343 to 346 in 09efbee
“attachments”
id_='90625bd9-d961-4dac-b43b-0c004b5f367b' type=2 content='https://img.kookapp.cn/assets/2024-03/Yxv60BzCYN0hl0u0.gif' embeds=[] attachments=None
和这个类似的需求是 chatrecorder 插件,为了记录机器人发出的消息,需要将序列化后的消息反序列化回去,目前 chatrecorder 中是这么写的: https://github.com/noneplugin/nonebot-plugin-chatrecorder/blob/5f390660e3c0567d1ed41134968261623cdd2f54/nonebot_plugin_chatrecorder/adapters/kaiheila.py#L78-L96
chatrecorder
The text was updated successfully, but these errors were encountered:
明白你的意图,api和返回值和实际的消息event是有出入,这里如果已经存储了被引用的消息,是否可以通过msg_id来查询
Sorry, something went wrong.
No branches or pull requests
目前的需求是获取引用消息的内容,获取消息详情的 api
message/view
的返回值是ChannelMessage
,该怎么将它转为nonebot
中的Message
呢?适配器中有
MessageDeserializer
来反序列化,但它似乎是处理消息事件中的字段,和消息详情的返回值有些区别,例如:Image
是这么反序列化的,nonebot-adapter-kaiheila/nonebot/adapters/kaiheila/message.py
Lines 343 to 346 in 09efbee
但一个
Image
消息message/view
的结果中并没有“attachments”
:和这个类似的需求是 chatrecorder 插件,为了记录机器人发出的消息,需要将序列化后的消息反序列化回去,目前
chatrecorder
中是这么写的:https://github.com/noneplugin/nonebot-plugin-chatrecorder/blob/5f390660e3c0567d1ed41134968261623cdd2f54/nonebot_plugin_chatrecorder/adapters/kaiheila.py#L78-L96
The text was updated successfully, but these errors were encountered: