This commit is contained in:
jxxghp 2024-03-06 17:02:07 +08:00
parent 45ec668875
commit 523d458489

View File

@ -185,11 +185,11 @@ class VoceChat:
idstr = userid[4:] idstr = userid[4:]
with lock: with lock:
try: try:
logger.info(f"VoceChat发送消息action={action}, userid={userid}, text={caption}") logger.info(f"VoceChat发送消息action={action}, userid={idstr}, text={caption}")
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.encode("utf-8"))
if result and result.status_code == 200: if result and result.status_code == 200:
return True return True
elif result: elif result is not None:
logger.error(f"VoceChat发送消息失败错误码{result.status_code}") logger.error(f"VoceChat发送消息失败错误码{result.status_code}")
return False return False
else: else: