加入斗鱼开播下播提醒
This commit is contained in:
@@ -13,6 +13,7 @@ from utils.decorator.plugin_decorators import plugin_stats_decorator
|
||||
from utils.decorator.points_decorator import plugin_points_cost
|
||||
from utils.robot_cmd.robot_command import Feature, PermissionStatus, GroupBotManager
|
||||
from wechat_ipad import WechatAPIClient
|
||||
from wechat_ipad.models.appmsg_xml import DOUYU_MESSAGE_XML
|
||||
|
||||
|
||||
class DouyuRedisManager:
|
||||
@@ -233,10 +234,12 @@ class DouyuPlugin(MessagePluginInterface):
|
||||
async def _notify_groups_live(self, room_id: str, nickname: str, room_name: str):
|
||||
groups = self.redis_manager.groups_for_room(room_id)
|
||||
text = f"🚀 斗鱼开播通知 \n🎤 {nickname} 正在直播中!\n 📌 房间标题:{room_name} \n 👉 点击观看:https://www.douyu.com/{room_id}"
|
||||
xml_content = DOUYU_MESSAGE_XML.format(title=room_name, liver=nickname, roomid=room_id)
|
||||
for gid in groups:
|
||||
if GroupBotManager.get_group_permission(gid, self.feature) == PermissionStatus.ENABLED:
|
||||
try:
|
||||
await self.bot.send_text_message(gid, text)
|
||||
await self.bot.send_link_xml_message(xml_content, gid)
|
||||
except Exception as e:
|
||||
logger.error(f"发送斗鱼开播提醒失败: {e}")
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user