download: use flt_input
rename: rm downloaded file after upload.
This commit is contained in:
@@ -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
|
||||
)
|
||||
|
||||
@@ -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....")
|
||||
|
||||
Reference in New Issue
Block a user