-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclone.py
24 lines (21 loc) · 1020 Bytes
/
clone.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from telegram.ext import CommandHandler
from bot.helper.mirror_utils.upload_utils.gdriveTools import GoogleDriveHelper
from bot.helper.telegram_helper.message_utils import *
from bot.helper.telegram_helper.filters import CustomFilters
from bot.helper.telegram_helper.bot_commands import BotCommands
from bot.helper.ext_utils.bot_utils import new_thread
from bot import dispatcher
@new_thread
def cloneNode(update,context):
args = update.message.text.split(" ",maxsplit=1)
if len(args) > 1:
link = args[1]
msg = sendMessage(f"Cloning: <code>{link}</code>",context.bot,update)
gd = GoogleDriveHelper()
result = gd.clone(link)
deleteMessage(context.bot,msg)
sendMessage(result,context.bot,update)
else:
sendMessage("Provide G-Drive Shareable Link to Clone.",context.bot,update)
clone_handler = CommandHandler(BotCommands.CloneCommand,cloneNode,filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
dispatcher.add_handler(clone_handler)