加入系统异常邮件提醒。
This commit is contained in:
13
robot.py
13
robot.py
@@ -17,6 +17,7 @@ from plugin_common.plugin_interface import PluginStatus
|
||||
from plugin_common.plugin_manager import PluginManager
|
||||
from plugin_common.plugin_registry import PluginRegistry
|
||||
from sehuatang.shehuatang import pdf_file_path
|
||||
from utils.email_util import EmailSender
|
||||
from utils.revoke.message_auto_revoke import MessageAutoRevoke
|
||||
from utils.robot_cmd.robot_command import GroupBotManager, Feature, PermissionStatus
|
||||
|
||||
@@ -93,6 +94,12 @@ class Robot:
|
||||
|
||||
# 加载插件
|
||||
self.LOG.info("插件系统初始化完成")
|
||||
self.email_sender = EmailSender(
|
||||
smtp_server="smtp.163.com",
|
||||
smtp_port=465,
|
||||
sender_email="bovine_liu@163.com",
|
||||
sender_password="LTS9BhmX9XhS36QS"
|
||||
)
|
||||
|
||||
def init_wechat_ipad(self):
|
||||
"""初始化wechat_ipad客户端"""
|
||||
@@ -215,6 +222,8 @@ class Robot:
|
||||
self.LOG.error(f"获取新消息失败 {e}")
|
||||
if "用户可能退出" in str(e):
|
||||
self.LOG.error(f"用户可能退出: {e}")
|
||||
self.email_sender.send_wechat_alert("bovine_liu@163.com", f"用户可能退出: {e}", self.wxid,
|
||||
self.nickname)
|
||||
await self.login_twice_auto_auth()
|
||||
await asyncio.sleep(5)
|
||||
continue
|
||||
@@ -315,6 +324,8 @@ class Robot:
|
||||
self.LOG.error(f"wechat_ipad heartbeat: {e}")
|
||||
if "用户可能退出" in str(e):
|
||||
self.LOG.error(f"用户可能退出: {e}")
|
||||
self.email_sender.send_wechat_alert("bovine_liu@163.com", f"用户可能退出: {e}", self.wxid,
|
||||
self.nickname)
|
||||
await self.login_twice_auto_auth()
|
||||
await asyncio.sleep(60)
|
||||
|
||||
@@ -332,6 +343,8 @@ class Robot:
|
||||
self.LOG.error(f"wechat_ipad heartbeat long: {e}")
|
||||
if "用户可能退出" in str(e):
|
||||
self.LOG.error(f"用户可能退出: {e}")
|
||||
self.email_sender.send_wechat_alert("bovine_liu@163.com", f"用户可能退出: {e}", self.wxid,
|
||||
self.nickname)
|
||||
await self.login_twice_auto_auth()
|
||||
await asyncio.sleep(120)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user