加入新闻链接信息,每次新闻发送三个链接
This commit is contained in:
16
robot.py
16
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}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user