File size: 984 Bytes
db78256 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
from .. import LOGGER
from ..helper.ext_utils.bot_utils import sync_to_async, new_task
from ..helper.ext_utils.links_utils import is_gdrive_link
from ..helper.mirror_leech_utils.gdrive_utils.delete import GoogleDriveDelete
from ..helper.telegram_helper.message_utils import auto_delete_message, send_message
@new_task
async def delete_file(_, message):
args = message.text.split()
user = message.from_user or message.sender_chat
if len(args) > 1:
link = args[1]
elif reply_to := message.reply_to_message:
link = reply_to.text.split(maxsplit=1)[0].strip()
else:
link = ""
if is_gdrive_link(link):
LOGGER.info(link)
msg = await sync_to_async(GoogleDriveDelete().deletefile, link, user.id)
else:
msg = (
"Send Gdrive link along with command or by replying to the link by command"
)
reply_message = await send_message(message, msg)
await auto_delete_message(message, reply_message)
|