Path: blob/master/bot/modules/gd_delete.py
1621 views
from .. import LOGGER1from ..helper.ext_utils.bot_utils import sync_to_async, new_task2from ..helper.ext_utils.links_utils import is_gdrive_link3from ..helper.mirror_leech_utils.gdrive_utils.delete import GoogleDriveDelete4from ..helper.telegram_helper.message_utils import auto_delete_message, send_message567@new_task8async def delete_file(_, message):9args = message.text.split()10user = message.from_user or message.sender_chat11if len(args) > 1:12link = args[1]13elif reply_to := message.reply_to_message:14link = reply_to.text.split(maxsplit=1)[0].strip()15else:16link = ""17if is_gdrive_link(link):18LOGGER.info(link)19msg = await sync_to_async(GoogleDriveDelete().deletefile, link, user.id)20else:21msg = (22"Send Gdrive link along with command or by replying to the link by command"23)24reply_message = await send_message(message, msg)25await auto_delete_message(message, reply_message)262728293031