AstrBot icon indicating copy to clipboard operation
AstrBot copied to clipboard

[Bug]wechatpadpro 无法转发收到的图片、视频等媒体信息

Open NiceAir opened this issue 1 year ago • 0 comments

发生了什么

源代码wechatpadpro部分中发送图片、视频的方式继承了gewe的,但是解析图片视频的方式并不完善,导致按照解析图片的方式去转发收到的图片时,无法发送。

astrbot的wechatpadpro_adapter.py 714行文件保存的图片信息为图片的image_bs64_data信息,在做转发时唯一能拿到的图片信息也只能是image_bs64_data。但是拿到image_bs64_data之后进行发送时,报错 向 wechatpadpro:FriendMessage:wxid_qmy0i8rjurtx22 发送消息失败:image file is truncated

使用image_bs64_data进行发送图片的代码如下: ` match message_type: case "image": from astrbot.core.platform.sources.wechatpadpro.wechatpadpro_message_event import WeChatPadProMessageEvent assert isinstance(event, WeChatPadProMessageEvent) image_bs64_data = event.adapter.cached_images.get(str(new_msg_id), "") message_segments.append(Image.fromBase64(image_bs64_data))

 message_chain = MessageChain(message_segments)
 await self.context.send_message(session, message_chain) 

`

由于没有解析视频信息,同样也无法做到转发视频

如何复现?

拿到图片的new_msg_id后,用该new_msg_id发送图片

AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器

v3.5.14 本地,wechatpadpro

操作系统

macOS

报错日志

Image

你愿意提交 PR 吗?

  • [x] 是的,我愿意提交 PR!

Code of Conduct

  • [x] 我已阅读并同意遵守该项目的 行为准则。

NiceAir avatar Jun 10 '25 11:06 NiceAir