From 523d458489755a765d0ef90b5170c8d66aae46cb Mon Sep 17 00:00:00 2001 From: jxxghp Date: Wed, 6 Mar 2024 17:02:07 +0800 Subject: [PATCH] fix bug --- app/modules/vocechat/vocechat.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/modules/vocechat/vocechat.py b/app/modules/vocechat/vocechat.py index a2641c0a..9f8abd95 100644 --- a/app/modules/vocechat/vocechat.py +++ b/app/modules/vocechat/vocechat.py @@ -185,11 +185,11 @@ class VoceChat: idstr = userid[4:] with lock: try: - logger.info(f"VoceChat发送消息:action={action}, userid={userid}, text={caption}") - result = self._client.post_res(f"{self._host}api/bot/{action}/{idstr}", data=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.encode("utf-8")) if result and result.status_code == 200: return True - elif result: + elif result is not None: logger.error(f"VoceChat发送消息失败,错误码:{result.status_code}") return False else: