This commit is contained in:
jxxghp 2024-03-06 16:20:39 +08:00
parent 07a77e0001
commit 60122644b8
2 changed files with 7 additions and 10 deletions

View File

@ -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)
# 类型

View File

@ -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