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,9 +179,8 @@ class VoceChat:
else: else:
action = "send_to_user" action = "send_to_user"
idstr = userid[4:] idstr = userid[4:]
with lock: with lock:
try:
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")) 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
@ -191,6 +189,3 @@ class VoceChat:
return False return False
else: else:
raise Exception("VoceChat发送消息失败连接失败") raise Exception("VoceChat发送消息失败连接失败")
except Exception as msg_e:
logger.error(f"VoceChat发送消息错误{str(msg_e)}")
return False