加入转发图片内容
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import xml.etree.ElementTree as ET
|
||||
from typing import Dict, Any, List, Optional, Tuple
|
||||
|
||||
from base.plugin_common.message_plugin_interface import MessagePluginInterface
|
||||
from base.plugin_common.plugin_interface import PluginStatus
|
||||
from utils.robot_cmd.robot_command import GroupBotManager, PermissionStatus
|
||||
from utils.wechat.contact_manager import ContactManager
|
||||
from db.connection import DBConnectionManager
|
||||
from db.group_virtual_redis import GroupVirtualRedisDB
|
||||
from utils.wechat.contact_manager import ContactManager
|
||||
from wechat_ipad import WechatAPIClient
|
||||
from wechat_ipad.models.message import WxMessage, MessageType
|
||||
|
||||
@@ -174,15 +174,14 @@ class GroupVirtualPlugin(MessagePluginInterface):
|
||||
await self.bot.send_text_message(group["id"], forward_content)
|
||||
|
||||
# 图片消息 暂时不支持。
|
||||
# elif msg_type == 3:
|
||||
# # 先发送前缀
|
||||
# for group in chat_group["groups"]:
|
||||
# if group["id"] != roomid:
|
||||
# self.message_util.send_text(f"{prefix}[图片]", group["id"])
|
||||
# # 转发图片
|
||||
# image_path = message.get("file_path", "")
|
||||
# if image_path and os.path.exists(image_path):
|
||||
# self.message_util.send_image(image_path, group["id"])
|
||||
elif msg_type == MessageType.IMAGE:
|
||||
# 先发送前缀
|
||||
for group in chat_group["groups"]:
|
||||
if group["id"] != roomid:
|
||||
await self.bot.send_text_message(group["id"], f"{prefix}[图片]")
|
||||
# 转发图片
|
||||
xml_content = message.get("content", "")
|
||||
await self.bot.send_cdn_img_msg(group["id"], xml_content)
|
||||
|
||||
def _get_chat_group(self, chat_group_id: str) -> Optional[Dict[str, Any]]:
|
||||
"""获取虚拟聊天组"""
|
||||
|
||||
@@ -661,7 +661,7 @@ class MessageMixin(WechatAPIClientBase):
|
||||
|
||||
async with aiohttp.ClientSession() as session:
|
||||
json_param = {"Wxid": self.wxid, "ToWxid": wxid, "Content": xml}
|
||||
response = await session.post(f'http://{self.ip}:{self.port}/SendCDNImgMsg', json=json_param)
|
||||
response = await session.post(f'http://{self.ip}:{self.port}/Msg/SendCDNImg', json=json_param)
|
||||
json_resp = await response.json()
|
||||
|
||||
if json_resp.get("Success"):
|
||||
|
||||
Reference in New Issue
Block a user