diff --git a/plugins/group_member_change/main.py b/plugins/group_member_change/main.py
index bb736d3..7b6da90 100644
--- a/plugins/group_member_change/main.py
+++ b/plugins/group_member_change/main.py
@@ -10,6 +10,7 @@ from db.contacts_db import ContactsDBOperator
from utils.robot_cmd.robot_command import Feature, PermissionStatus, GroupBotManager
from utils.wechat.contact_manager import ContactManager
from wechat_ipad import WechatAPIClient
+from wechat_ipad.models.appmsg_xml import LINK_XML
class GroupMemberChangePlugin(MessagePluginInterface):
@@ -134,53 +135,8 @@ class GroupMemberChangePlugin(MessagePluginInterface):
contact_db.save_chatroom_member_simple(roomid, member_details)
except Exception as e:
self.LOG.warning(f"新增群员信息失败: {e}")
- xml_content = f"""
-
- 👏欢迎 {nickname} 加入群聊!🎉
- ⌚时间:{now}
- view
- 5
- 0
-
- https://hot.imsyy.top/#/
-
-
-
-
- {head_url}
-
-
-
-
-
-
-
- 0
-
-
-
-
-
-
-
- 0
-
-
-
-
-
- 0
-
-
-
- Jyunere
- 0
-
- 1
-
-
-
- """
+ xml_content = f"{LINK_XML}".format(nickname=nickname, now=now, head_url=head_url)
+
await bot.send_link_xml_message(xml_content, roomid)
return True, "已发送进群欢迎语"
return False, "无需执行"
diff --git a/plugins/music/main.py b/plugins/music/main.py
index aabc173..3644b57 100644
--- a/plugins/music/main.py
+++ b/plugins/music/main.py
@@ -13,6 +13,8 @@ from wechat_ipad import WechatAPIClient
import aiohttp
+from wechat_ipad.models.appmsg_xml import MUSIC_XML
+
class MusicPlugin(MessagePluginInterface):
"""音乐点播插件"""
@@ -161,52 +163,8 @@ class MusicPlugin(MessagePluginInterface):
play_url = song_info.get("play_url", "")
singer_pic = song_info.get("singer_pic", "")
data_url = song_info.get("data_url", "")
-
- xml_message = f"""
- {song_name}
- {singer_name}-点击三角直接播放
- view
- 3
- 0
-
- {data_url}
- {play_url}
-
-
-
-
-
-
-
-
-
-
-
- 0
-
-
-
-
-
-
-
- 0
-
-
-
-
-
- 0
-
-
- {singer_pic}
-
-0
-
- 49
- 汽水音乐
-
-"""
+ xml_message = f"{MUSIC_XML}".format(song_name=song_name, singer_name=singer_name, play_url=play_url,
+ data_url=data_url, singer_pic=singer_pic)
self.LOG.info(f"发送音乐消息:{xml_message}")
res = await bot.send_app_message(wxid=receiver, xml=xml_message, type=0)
diff --git a/wechat_ipad/models/appmsg_xml.py b/wechat_ipad/models/appmsg_xml.py
new file mode 100644
index 0000000..0976f0b
--- /dev/null
+++ b/wechat_ipad/models/appmsg_xml.py
@@ -0,0 +1,95 @@
+LINK_XML = """
+
+ 👏欢迎 {nickname} 加入群聊!🎉
+ ⌚时间:{now}
+ view
+ 5
+ 0
+
+ https://hot.imsyy.top/#/
+
+
+
+
+ {head_url}
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
+ 0
+
+
+
+Jyunere
+0
+
+ 1
+
+
+
+"""
+
+MUSIC_XML = """
+
+ {song_name}
+ {singer_name}-点击三角直接播放
+ view
+ 3
+ 0
+
+ {data_url}
+ {play_url}
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
+ 0
+
+
+ {singer_pic}
+
+0
+
+ 49
+ 汽水音乐
+
+
+"""