feat:模块健康检查
This commit is contained in:
@ -16,6 +16,15 @@ class SynologyChatModule(_ModuleBase):
|
||||
def stop(self):
|
||||
pass
|
||||
|
||||
def test(self) -> Tuple[bool, str]:
|
||||
"""
|
||||
测试模块连接性
|
||||
"""
|
||||
state = self.synologychat.get_state()
|
||||
if state:
|
||||
return True, ""
|
||||
return False, "SynologyChat未就续,请检查参数设置、网络连接以及机器人是否可见"
|
||||
|
||||
def init_setting(self) -> Tuple[str, Union[str, bool]]:
|
||||
return "MESSAGER", "synologychat"
|
||||
|
||||
|
@ -25,6 +25,17 @@ class SynologyChat:
|
||||
def check_token(self, token: str) -> bool:
|
||||
return True if token == self._token else False
|
||||
|
||||
def get_state(self) -> bool:
|
||||
"""
|
||||
获取状态
|
||||
"""
|
||||
if not self._webhook_url or not self._token:
|
||||
return False
|
||||
ret = self.__get_bot_users()
|
||||
if ret:
|
||||
return True
|
||||
return False
|
||||
|
||||
def send_msg(self, title: str, text: str = "", image: str = "", userid: str = "") -> Optional[bool]:
|
||||
"""
|
||||
发送Telegram消息
|
||||
|
Reference in New Issue
Block a user