diff --git a/robot.py b/robot.py index 9612cbb..8b18aee 100644 --- a/robot.py +++ b/robot.py @@ -31,6 +31,7 @@ from utils.sehuatang.shehuatang_undetected import pdf_file_path_undetected from utils.wechat.contact_manager import ContactManager from utils.wechat.message_to_db import MessageStorage from wechat_ipad import WechatAPIClient +from wechat_ipad.models.appmsg_xml import LINK_XML_NEWS from wechat_ipad.models.message import WxMessage, MessageType # 定义全局信号量,限制最大并发 10 @@ -515,6 +516,19 @@ class Robot: except Exception as e: self.LOG.error(f"send_group_image_message:{feature.description} error:{e}") + async def send_group_xml_message(self, msg: str, feature: Feature): + """向所有启用了特定功能的群发送文本消息""" + try: + receivers = self.gbm.get_group_list() + if not receivers: + return + + for r in receivers: + if self.gbm.get_group_permission(r, feature) == PermissionStatus.ENABLED: + await self.ipad_bot.send_link_message(r, msg) + except Exception as e: + self.LOG.error(f"send_group_xml_message:{feature.description} error:{e}") + async def send_group_file_message(self, path: str, feature: Feature): try: receivers = self.gbm.get_group_list() @@ -693,6 +707,8 @@ class Robot: await self.send_group_txt_message(news, Feature.DAILY_NEWS) path = News().get_news_60s() await self.send_group_image_message(path, Feature.DAILY_NEWS) + + await self.send_group_xml_message(LINK_XML_NEWS, Feature.DAILY_NEWS) except Exception as e: self.LOG.error(f"newsBaiduReportAuto error:{e}") diff --git a/wechat_ipad/models/appmsg_xml.py b/wechat_ipad/models/appmsg_xml.py index 8e24aeb..78a331a 100644 --- a/wechat_ipad/models/appmsg_xml.py +++ b/wechat_ipad/models/appmsg_xml.py @@ -184,3 +184,52 @@ VIDEO_XML_MESSAGE = """ """ + + +LINK_XML_NEWS = """ + + 实时新闻热点 + 点击查看实时新闻热点 + view + 5 + 0 + + https://newsnow.busiyi.world/ + + + + + https://wx.qlogo.cn/mmhead/ver_1/dhelVOGwHxiasCJI1…ibwpC1LtKOgnicETlWCx10G1iahWtTAGAfr6jX9oOcxMp/132 + + + + + + + + 0 + + + + + + + + 0 + + + + + + 0 + + + +Jyunere +0 + + 1 + + + +""" \ No newline at end of file