feat wechat消息转发插件--根据正则转发通知到其他wechat应用,解决只能配置一个wechat通知问题

This commit is contained in:
thsrite
2023-08-07 12:05:45 +08:00
parent 69fc865908
commit af64f1829e
3 changed files with 408 additions and 0 deletions

View File

@ -3,11 +3,13 @@ from typing import Optional, Union, List, Tuple, Any
from app.core.config import settings
from app.core.context import Context, MediaInfo
from app.core.event import EventManager
from app.log import logger
from app.modules import _ModuleBase, checkMessage
from app.modules.wechat.WXBizMsgCrypt3 import WXBizMsgCrypt
from app.modules.wechat.wechat import WeChat
from app.schemas import MessageChannel, CommingMessage, Notification
from app.schemas.types import EventType
from app.utils.dom import DomUtils
@ -121,6 +123,14 @@ class WechatModule(_ModuleBase):
:param message: 消息内容
:return: 成功或失败
"""
# 发送事件
EventManager().send_event(etype=EventType.WechatMessage,
data={
"title": message.title,
"text": message.text,
"image": message.image,
"userid": message.userid,
})
return self.wechat.send_msg(title=message.title, text=message.text,
image=message.image, userid=message.userid)