mirror of
https://github.com/d0zingcat/MoviePilot-Plugins.git
synced 2026-05-13 15:09:12 +00:00
feat:增加群组编码,支持发送群组消息
This commit is contained in:
@@ -571,11 +571,14 @@
|
|||||||
"name": "PushPlus消息推送",
|
"name": "PushPlus消息推送",
|
||||||
"description": "支持使用PushPlus发送消息通知。",
|
"description": "支持使用PushPlus发送消息通知。",
|
||||||
"labels": "消息通知",
|
"labels": "消息通知",
|
||||||
"version": "1.0",
|
"version": "1.2",
|
||||||
"icon": "Pushplus_A.png",
|
"icon": "Pushplus_A.png",
|
||||||
"author": "cheng",
|
"author": "cheng",
|
||||||
"level": 1,
|
"level": 1,
|
||||||
"v2": true
|
"v2": true,
|
||||||
|
"history": {
|
||||||
|
"v1.2": "增加群组编码,支持发送群组消息"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"DownloadSiteTag": {
|
"DownloadSiteTag": {
|
||||||
"name": "下载任务分类与标签",
|
"name": "下载任务分类与标签",
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class PushPlusMsg(_PluginBase):
|
|||||||
# 插件图标
|
# 插件图标
|
||||||
plugin_icon = "Pushplus_A.png"
|
plugin_icon = "Pushplus_A.png"
|
||||||
# 插件版本
|
# 插件版本
|
||||||
plugin_version = "1.1"
|
plugin_version = "1.2"
|
||||||
# 插件作者
|
# 插件作者
|
||||||
plugin_author = "cheng"
|
plugin_author = "cheng"
|
||||||
# 作者主页
|
# 作者主页
|
||||||
@@ -31,12 +31,14 @@ class PushPlusMsg(_PluginBase):
|
|||||||
_enabled = False
|
_enabled = False
|
||||||
_token = None
|
_token = None
|
||||||
_msgtypes = []
|
_msgtypes = []
|
||||||
|
_topic = None # 新增topic字段
|
||||||
|
|
||||||
def init_plugin(self, config: dict = None):
|
def init_plugin(self, config: dict = None):
|
||||||
if config:
|
if config:
|
||||||
self._enabled = config.get("enabled")
|
self._enabled = config.get("enabled")
|
||||||
self._token = config.get("token")
|
self._token = config.get("token")
|
||||||
self._msgtypes = config.get("msgtypes") or []
|
self._msgtypes = config.get("msgtypes") or []
|
||||||
|
self._topic = config.get("topic") # 新增topic字段
|
||||||
|
|
||||||
def get_state(self) -> bool:
|
def get_state(self) -> bool:
|
||||||
return self._enabled and (True if self._token else False)
|
return self._enabled and (True if self._token else False)
|
||||||
@@ -105,6 +107,27 @@ class PushPlusMsg(_PluginBase):
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'component': 'VRow',
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'VCol',
|
||||||
|
'props': {
|
||||||
|
'cols': 12
|
||||||
|
},
|
||||||
|
'content': [
|
||||||
|
{
|
||||||
|
'component': 'VTextField',
|
||||||
|
'props': {
|
||||||
|
'model': 'topic',
|
||||||
|
'label': '群组编码',
|
||||||
|
'placeholder': '输入群组编码(可选)',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
'component': 'VRow',
|
'component': 'VRow',
|
||||||
'content': [
|
'content': [
|
||||||
@@ -154,6 +177,7 @@ class PushPlusMsg(_PluginBase):
|
|||||||
], {
|
], {
|
||||||
"enabled": False,
|
"enabled": False,
|
||||||
'token': '',
|
'token': '',
|
||||||
|
'topic': '',
|
||||||
'msgtypes': []
|
'msgtypes': []
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,8 +223,12 @@ class PushPlusMsg(_PluginBase):
|
|||||||
"title": title,
|
"title": title,
|
||||||
"content": text,
|
"content": text,
|
||||||
"template": "txt",
|
"template": "txt",
|
||||||
"channel": "wechat"
|
"channel": "wechat",
|
||||||
}
|
}
|
||||||
|
# 如果配置了topic,添加到请求参数
|
||||||
|
if self._topic:
|
||||||
|
event_info["topic"] = self._topic
|
||||||
|
|
||||||
res = RequestUtils(content_type="application/json").post_res(sc_url, json=event_info)
|
res = RequestUtils(content_type="application/json").post_res(sc_url, json=event_info)
|
||||||
if res and res.status_code == 200:
|
if res and res.status_code == 200:
|
||||||
ret_json = res.json()
|
ret_json = res.json()
|
||||||
@@ -221,4 +249,4 @@ class PushPlusMsg(_PluginBase):
|
|||||||
"""
|
"""
|
||||||
退出插件
|
退出插件
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
Reference in New Issue
Block a user