mirror of
https://github.com/ClovertaTheTrilobita/SanYeCao-Nonebot.git
synced 2026-04-01 22:04:51 +00:00
fix(image): 优化图片发送异常处理
This commit is contained in:
parent
ef11f27d2b
commit
fad831c912
1 changed files with 5 additions and 4 deletions
|
|
@ -42,10 +42,11 @@ async def handle_function(message: MessageEvent):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
for file_path in file_paths:
|
for file_path in file_paths:
|
||||||
await random_keyword_image.send(MessageSegment.file_image(Path(file_path)))
|
try:
|
||||||
except Exception as e:
|
await random_keyword_image.send(MessageSegment.file_image(Path(file_path)))
|
||||||
print(e)
|
except Exception as e:
|
||||||
await random_keyword_image.send("图被外星人抢走啦,请重试")
|
print(f"发送文件 {file_path} 时出错: {e}")
|
||||||
|
await random_keyword_image.send("某个图被外星人抢走啦,请重试")
|
||||||
finally:
|
finally:
|
||||||
# 删除所有临时文件
|
# 删除所有临时文件
|
||||||
for file_path in file_paths:
|
for file_path in file_paths:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue