ytdl fix a bug

This commit is contained in:
omg-xtao 2022-10-25 21:25:43 +08:00 committed by GitHub
parent 57c234eb7d
commit fb62e4d654
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -82,12 +82,13 @@ async def start_download(message: Message, url: str):
except Exception as e: except Exception as e:
result["status"] = False result["status"] = False
result["error"] = str(e) result["error"] = str(e)
if not result["status"]: else:
with contextlib.suppress(Exception): with contextlib.suppress(Exception):
await message.edit(f"下载/发送文件失败,发生错误:{result['error']}") await message.edit(f"下载/发送文件失败,发生错误:{result['error']}")
ytdl_is_downloading = False ytdl_is_downloading = False
with contextlib.suppress(Exception): with contextlib.suppress(Exception):
shutil.rmtree("data/ytdl") shutil.rmtree("data/ytdl")
if result["status"]:
await message.safe_delete() await message.safe_delete()