From 6f2f13aef37a600df1103dcb9fa2e14ecbb0afba Mon Sep 17 00:00:00 2001 From: thedragonsinn <98635854+thedragonsinn@users.noreply.github.com> Date: Thu, 21 Dec 2023 16:29:17 +0530 Subject: [PATCH] download: use flt_input rename: rm downloaded file after upload. --- app/plugins/files/download.py | 4 ++-- app/plugins/files/rename.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/plugins/files/download.py b/app/plugins/files/download.py index 3e68564..fb4ec1d 100644 --- a/app/plugins/files/download.py +++ b/app/plugins/files/download.py @@ -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 ) diff --git a/app/plugins/files/rename.py b/app/plugins/files/rename.py index 1f722c6..7ab5f2d 100644 --- a/app/plugins/files/rename.py +++ b/app/plugins/files/rename.py @@ -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....")