diff --git a/plugins/douyu/main.py b/plugins/douyu/main.py
index 6106ee7..bca8ca3 100644
--- a/plugins/douyu/main.py
+++ b/plugins/douyu/main.py
@@ -203,6 +203,8 @@ class DouyuPlugin(MessagePluginInterface):
show_status = room_info.get("show_status")
nickname = room_info.get("nickname", "")
room_name = room_info.get("room_name", "")
+ avatar = room_info.get("avatar", {}) or {}
+ thumb_url = str(avatar.get("small", "") or "").strip().strip("`").strip()
prev = self.redis_manager.get_room_status(room_id) or {}
prev_live = prev.get("is_live")
curr_live = True if show_status == 1 else False
@@ -215,10 +217,10 @@ class DouyuPlugin(MessagePluginInterface):
if prev_live is None and curr_live is False:
continue
if prev_live is None and curr_live is True:
- await self._notify_groups_live(room_id, nickname, room_name)
+ await self._notify_groups_live(room_id, nickname, room_name, thumb_url)
continue
if prev_live is False and curr_live is True:
- await self._notify_groups_live(room_id, nickname, room_name)
+ await self._notify_groups_live(room_id, nickname, room_name, thumb_url)
continue
if prev_live is True and curr_live is False:
await self._notify_groups_offline(room_id, nickname, room_name)
@@ -230,10 +232,10 @@ class DouyuPlugin(MessagePluginInterface):
except Exception as e:
logger.error(f"斗鱼定时任务异常: {e}")
- async def _notify_groups_live(self, room_id: str, nickname: str, room_name: str):
+ async def _notify_groups_live(self, room_id: str, nickname: str, room_name: str, thumb_url: 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)
+ xml_content = DOUYU_MESSAGE_XML.format(title=room_name, liver=nickname, roomid=room_id, thumburl=thumb_url)
for gid in groups:
if GroupBotManager.get_group_permission(gid, self.feature) == PermissionStatus.ENABLED:
try:
diff --git a/wechat_ipad/models/appmsg_xml.py b/wechat_ipad/models/appmsg_xml.py
index 16417b3..c4933d6 100644
--- a/wechat_ipad/models/appmsg_xml.py
+++ b/wechat_ipad/models/appmsg_xml.py
@@ -242,7 +242,7 @@ LINK_XML_NEWS = """
"""
-DOUYU_MESSAGE_XML ="""
+DOUYU_MESSAGE_XML = """
正在直播:{title},请点击观看
主播: {liver}
@@ -273,7 +273,7 @@ DOUYU_MESSAGE_XML ="""
2
-
+ {thumburl}