fix
This commit is contained in:
parent
07a77e0001
commit
60122644b8
@ -30,7 +30,8 @@ class VoceChatModule(_ModuleBase):
|
|||||||
def init_setting(self) -> Tuple[str, Union[str, bool]]:
|
def init_setting(self) -> Tuple[str, Union[str, bool]]:
|
||||||
return "MESSAGER", "vocechat"
|
return "MESSAGER", "vocechat"
|
||||||
|
|
||||||
def message_parser(self, body: Any, form: Any,
|
@staticmethod
|
||||||
|
def message_parser(body: Any, form: Any,
|
||||||
args: Any) -> Optional[CommingMessage]:
|
args: Any) -> Optional[CommingMessage]:
|
||||||
"""
|
"""
|
||||||
解析消息内容,返回字典,注意以下约定值:
|
解析消息内容,返回字典,注意以下约定值:
|
||||||
@ -58,13 +59,6 @@ class VoceChatModule(_ModuleBase):
|
|||||||
"target": { "gid": 2 } //发送给谁,gid代表是发送给频道,uid代表是发送给个人,此时的数据结构举例:{"uid":1}
|
"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)
|
msg_body = json.loads(body)
|
||||||
# 类型
|
# 类型
|
||||||
|
@ -188,9 +188,12 @@ class VoceChat:
|
|||||||
result = self._client.post_res(f"{self._host}api/bot/{action}/{idstr}", data=caption)
|
result = self._client.post_res(f"{self._host}api/bot/{action}/{idstr}", data=caption)
|
||||||
if result and result.status_code == 200:
|
if result and result.status_code == 200:
|
||||||
return True
|
return True
|
||||||
|
elif result:
|
||||||
|
logger.error(f"VoceChat发送消息失败,错误码:{result.status_code}")
|
||||||
|
return False
|
||||||
else:
|
else:
|
||||||
logger.error(f"VoceChat发送消息失败:{result.text}")
|
logger.error("VoceChat发送消息失败,无法连接")
|
||||||
return False
|
return False
|
||||||
except Exception as msg_e:
|
except Exception as msg_e:
|
||||||
logger.error(f"VoceChat发送消息错误:{str(msg_e)}")
|
logger.error(f"VoceChat发送消息错误:{str(msg_e)}")
|
||||||
return False
|
return False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user