Update astrbot/core/platform/sources/wechatpadpro/wechatpadpro_message_event.py

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
This commit is contained in:
夏目侧耳
2025-05-15 19:12:42 +08:00
committed by GitHub
parent f70b8f0c10
commit 6ea5b7581f
@@ -90,9 +90,15 @@ class WeChatPadProMessageEvent(AstrMessageEvent):
elif isinstance(component, Image):
# 发送图片消息
try:
# 假设 Image 对象有 to_base64() 方法
image_base64 = await component.convert_to_base64() # 需要 Image 组件支持转为 base64
if hasattr(component, "convert_to_base64"):
try:
image_base64 = await component.convert_to_base64()
except Exception as e:
logger.error(f"Error converting image to base64: {e}")
continue
else:
logger.error("Image component missing convert_to_base64, skipping image send.")
continue
# logger.info(f"转换后的base64图片:{image_base64}")
# Base64图片格式校验