add log
This commit is contained in:
parent
60122644b8
commit
45ec668875
@ -75,9 +75,9 @@ class VoceChat:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
if text:
|
if text:
|
||||||
caption = f"*{title}*\n{text}"
|
caption = f"**{title}**\n{text}"
|
||||||
else:
|
else:
|
||||||
caption = f"*{title}*"
|
caption = f"**{title}**"
|
||||||
|
|
||||||
if userid:
|
if userid:
|
||||||
chat_id = userid
|
chat_id = userid
|
||||||
@ -98,7 +98,7 @@ class VoceChat:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
index, image, caption = 1, "", "*%s*" % title
|
index, image, caption = 1, "", "**%s**" % title
|
||||||
for media in medias:
|
for media in medias:
|
||||||
if not image:
|
if not image:
|
||||||
image = media.get_message_image()
|
image = media.get_message_image()
|
||||||
@ -140,7 +140,7 @@ class VoceChat:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
index, caption = 1, "*%s*" % title
|
index, caption = 1, "**%s**" % title
|
||||||
mediainfo = torrents[0].media_info
|
mediainfo = torrents[0].media_info
|
||||||
for context in torrents:
|
for context in torrents:
|
||||||
torrent = context.torrent_info
|
torrent = context.torrent_info
|
||||||
@ -185,6 +185,7 @@ class VoceChat:
|
|||||||
idstr = userid[4:]
|
idstr = userid[4:]
|
||||||
with lock:
|
with lock:
|
||||||
try:
|
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)
|
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
|
||||||
@ -192,8 +193,7 @@ class VoceChat:
|
|||||||
logger.error(f"VoceChat发送消息失败,错误码:{result.status_code}")
|
logger.error(f"VoceChat发送消息失败,错误码:{result.status_code}")
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
logger.error("VoceChat发送消息失败,无法连接")
|
raise Exception("VoceChat发送消息失败,连接失败")
|
||||||
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