mirror of
https://github.com/thsrite/MoviePilot-Plugins.git
synced 2026-03-27 10:05:57 +00:00
fix 特定消息强制指定userid
This commit is contained in:
@@ -2,13 +2,14 @@
|
||||
|
||||
### 更新记录
|
||||
|
||||
- 1.4 特定消息强制指定userid
|
||||
- 1.3 防重复发送额外消息
|
||||
- 1.2 fix规则
|
||||
- 1.1 自定义发送额外消息
|
||||
- 1.0 根据正则转发通知到其他WeChat应用
|
||||
|
||||
|
||||
消息转发插件加强版
|
||||
#### 消息转发插件加强版
|
||||
|
||||
根据正则表达式将对应title的消息转发到不同的企业微信应用上
|
||||
|
||||
@@ -16,12 +17,25 @@
|
||||
|
||||
如果某条消息不想指定userid发送,则填写忽略userid正则表达式.
|
||||
|
||||
额外消息配置
|
||||
#### 额外消息配置
|
||||
|
||||
`开始下载 > userid > 后台下载任务已提交,请耐心等候入库通知。 > appid`
|
||||
|
||||
`已添加订阅 > userid > 电视剧正在更新,已添加订阅,待更新后自动下载。 > appid`
|
||||
|
||||
中间用` > `分割
|
||||
|
||||
消息title匹配到`开始下载`的正则
|
||||
|
||||
且消息text中的`用户:`匹配到userid,
|
||||
|
||||
则发送`后台下载任务已提交,请耐心等候入库通知。`额外通知。
|
||||
|
||||
发送给appid为`appid`的企业微信应用。(环境变量配置或者本插件配置均可。)
|
||||
|
||||
|
||||
#### 特定消息指定用户
|
||||
|
||||
`title正则 > text正则 > userid`
|
||||
|
||||
当要发送的消息的title和text均匹配正则,则强制指定该消息的userid
|
||||
@@ -138,7 +138,7 @@
|
||||
"WeChatForward": {
|
||||
"name": "微信消息转发",
|
||||
"description": "根据正则转发通知到其他WeChat应用。",
|
||||
"version": "1.3",
|
||||
"version": "1.4",
|
||||
"icon": "Wechat_A.png",
|
||||
"author": "thsrite",
|
||||
"level": 1
|
||||
|
||||
@@ -22,7 +22,7 @@ class WeChatForward(_PluginBase):
|
||||
# 插件图标
|
||||
plugin_icon = "Wechat_A.png"
|
||||
# 插件版本
|
||||
plugin_version = "1.3"
|
||||
plugin_version = "1.4"
|
||||
# 插件作者
|
||||
plugin_author = "thsrite"
|
||||
# 作者主页
|
||||
@@ -42,6 +42,7 @@ class WeChatForward(_PluginBase):
|
||||
_extra_confs = None
|
||||
_pattern_token = {}
|
||||
_extra_msg_history = {}
|
||||
_specify_confs = {}
|
||||
|
||||
# 企业微信发送消息URL
|
||||
_send_msg_url = f"{settings.WECHAT_PROXY}/cgi-bin/message/send?access_token=%s"
|
||||
@@ -55,6 +56,7 @@ class WeChatForward(_PluginBase):
|
||||
self._pattern = config.get("pattern")
|
||||
self._ignore_userid = config.get("ignore_userid")
|
||||
self._extra_confs = config.get("extra_confs")
|
||||
self._specify_confs = config.get("specify_confs")
|
||||
|
||||
# 获取token存库
|
||||
if self._enabled and self._wechat:
|
||||
@@ -155,10 +157,10 @@ class WeChatForward(_PluginBase):
|
||||
{
|
||||
'component': 'VTextarea',
|
||||
'props': {
|
||||
'model': 'ignore_userid',
|
||||
'rows': '1',
|
||||
'label': '忽略userid',
|
||||
'placeholder': '开始下载|添加下载任务失败'
|
||||
'model': 'extra_confs',
|
||||
'rows': '4',
|
||||
'label': '额外消息配置',
|
||||
'placeholder': '开始下载 > userid > 后台下载任务已提交,请耐心等候入库通知。 > appid'
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -177,10 +179,32 @@ class WeChatForward(_PluginBase):
|
||||
{
|
||||
'component': 'VTextarea',
|
||||
'props': {
|
||||
'model': 'extra_confs',
|
||||
'rows': '5',
|
||||
'label': '额外消息配置',
|
||||
'placeholder': '开始下载 > userid > 后台下载任务已提交,请耐心等候入库通知。 > appid'
|
||||
'model': 'specify_confs',
|
||||
'rows': '2',
|
||||
'label': '特定消息指定用户',
|
||||
'placeholder': 'title > text > userid'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
'component': 'VRow',
|
||||
'content': [
|
||||
{
|
||||
'component': 'VCol',
|
||||
'props': {
|
||||
'cols': 12,
|
||||
},
|
||||
'content': [
|
||||
{
|
||||
'component': 'VTextarea',
|
||||
'props': {
|
||||
'model': 'ignore_userid',
|
||||
'rows': '1',
|
||||
'label': '忽略userid',
|
||||
'placeholder': '开始下载|添加下载任务失败'
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -202,34 +226,14 @@ class WeChatForward(_PluginBase):
|
||||
'type': 'info',
|
||||
'variant': 'tonal',
|
||||
'text': '根据正则表达式,把MoviePilot的消息转发到多个微信应用。'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
'component': 'VRow',
|
||||
'content': [
|
||||
{
|
||||
'component': 'VCol',
|
||||
'props': {
|
||||
'cols': 12,
|
||||
},
|
||||
'content': [
|
||||
{
|
||||
'component': 'VAlert',
|
||||
'props': {
|
||||
'type': 'info',
|
||||
'variant': 'tonal',
|
||||
'text': '应用配置可加注释:'
|
||||
'应用配置可加注释:'
|
||||
'appid:corpid:appsecret#站点通知'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
], {
|
||||
@@ -237,6 +241,7 @@ class WeChatForward(_PluginBase):
|
||||
"wechat": "",
|
||||
"pattern": "",
|
||||
"ignore_userid": "",
|
||||
"specify_confs": "",
|
||||
"extra_confs": ""
|
||||
}
|
||||
|
||||
@@ -276,6 +281,16 @@ class WeChatForward(_PluginBase):
|
||||
if self._ignore_userid and re.search(self._ignore_userid, title):
|
||||
userid = None
|
||||
|
||||
# 特定消息指定用户
|
||||
if self._specify_confs:
|
||||
for specify_conf in self._specify_confs.split("\n"):
|
||||
specify = specify_conf.split(" > ")
|
||||
if len(specify) != 3:
|
||||
continue
|
||||
if re.search(specify[0], title) and re.search(specify[0], text):
|
||||
userid = specify[2]
|
||||
break
|
||||
|
||||
# 发送消息
|
||||
if image:
|
||||
self.__send_image_message(title, text, image, userid, access_token, appid, index)
|
||||
|
||||
Reference in New Issue
Block a user