diff --git a/app/modules/vocechat/__init__.py b/app/modules/vocechat/__init__.py index 1ea546ee..58f2f95e 100644 --- a/app/modules/vocechat/__init__.py +++ b/app/modules/vocechat/__init__.py @@ -30,7 +30,8 @@ class VoceChatModule(_ModuleBase): def init_setting(self) -> Tuple[str, Union[str, bool]]: return "MESSAGER", "vocechat" - def message_parser(self, body: Any, form: Any, + @staticmethod + def message_parser(body: Any, form: Any, args: Any) -> Optional[CommingMessage]: """ 解析消息内容,返回字典,注意以下约定值: @@ -58,13 +59,6 @@ class VoceChatModule(_ModuleBase): "target": { "gid": 2 } //发送给谁,gid代表是发送给频道,uid代表是发送给个人,此时的数据结构举例:{"uid":1} } """ - # URL参数 - print("----VoceChat Body----") - print(body) - print("----VoceChat from----") - print(form) - print("----VoceChat args----") - print(args) # 报文体 msg_body = json.loads(body) # 类型 diff --git a/app/modules/vocechat/vocechat.py b/app/modules/vocechat/vocechat.py index 01ebcd1b..e6275944 100644 --- a/app/modules/vocechat/vocechat.py +++ b/app/modules/vocechat/vocechat.py @@ -188,9 +188,12 @@ class VoceChat: result = self._client.post_res(f"{self._host}api/bot/{action}/{idstr}", data=caption) if result and result.status_code == 200: return True + elif result: + logger.error(f"VoceChat发送消息失败,错误码:{result.status_code}") + return False else: - logger.error(f"VoceChat发送消息失败:{result.text}") + logger.error("VoceChat发送消息失败,无法连接") return False except Exception as msg_e: logger.error(f"VoceChat发送消息错误:{str(msg_e)}") - return False + return False