This commit is contained in:
jxxghp 2024-03-07 17:15:04 +08:00
parent 2b570bf48f
commit 0de952f090

View File

@ -139,7 +139,6 @@ class VoceChat:
try: try:
index, caption = 1, "**%s**" % title index, caption = 1, "**%s**" % title
mediainfo = torrents[0].media_info
for context in torrents: for context in torrents:
torrent = context.torrent_info torrent = context.torrent_info
site_name = torrent.site_name site_name = torrent.site_name
@ -180,17 +179,13 @@ class VoceChat:
else: else:
action = "send_to_user" action = "send_to_user"
idstr = userid[4:] idstr = userid[4:]
with lock: with lock:
try: result = self._client.post_res(f"{self._host}api/bot/{action}/{idstr}", data=caption.encode("utf-8"))
logger.info(f"VoceChat发送消息action={action}, userid={idstr}, text={caption}") if result and result.status_code == 200:
result = self._client.post_res(f"{self._host}api/bot/{action}/{idstr}", data=caption.encode("utf-8")) return True
if result and result.status_code == 200: elif result is not None:
return True logger.error(f"VoceChat发送消息失败错误码{result.status_code}")
elif result is not None: return False
logger.error(f"VoceChat发送消息失败错误码{result.status_code}") else:
return False raise Exception("VoceChat发送消息失败连接失败")
else:
raise Exception("VoceChat发送消息失败连接失败")
except Exception as msg_e:
logger.error(f"VoceChat发送消息错误{str(msg_e)}")
return False