download: use flt_input

rename: rm downloaded file after upload.
This commit is contained in:
thedragonsinn
2023-12-21 16:29:17 +05:30
parent bbcde8840d
commit 6f2f13aef3
2 changed files with 4 additions and 2 deletions

View File

@@ -30,7 +30,7 @@ async def down_load(bot: BOT, message: Message):
file_name = None
if message.replied and message.replied.media:
if "-f" in message.flags:
file_name = message.input
file_name = message.flt_input
download_coro = telegram_download(
message=message.replied,
response=response,
@@ -41,7 +41,7 @@ async def down_load(bot: BOT, message: Message):
if "-f" in message.flags:
file_name, url = message.flt_input.split()
else:
file_name, url = None, message.input
url = message.flt_input
dl_obj: Download = await Download.setup(
url=url, path=dl_path, message_to_edit=response, custom_file_name=file_name
)

View File

@@ -1,5 +1,6 @@
import asyncio
import os
import shutil
import time
from app import BOT, bot
@@ -59,6 +60,7 @@ async def rename(bot: BOT, message: Message):
progress_args=progress_args,
**media["kwargs"]
)
shutil.rmtree(dl_path, ignore_errors=True)
await response.delete()
except asyncio.exceptions.CancelledError:
await response.edit("Cancelled....")