Beispiel #1
0
def cloneNode(update, context):
    if update.message.from_user.last_name:
        last_name = f" {update.message.from_user.last_name}"
    else:
        last_name = ""
    if update.message.from_user.username:
        username = f"@{update.message.from_user.username}"
    else:
        username = ""
    name = f'<a href="tg://user?id={update.message.from_user.id}">{update.message.from_user.first_name}{last_name}</a>'

    args = update.message.text.split(" ", maxsplit=1)
    if len(args) > 1:
        link = args[1]
        msg = f'Bentar lg clonning link google drive nya\n' \
              f'User: buat yang request tadi {username}\n' \
              f'Link: <a href="{link}">{link}</a>'
        sendMessage(msg, context.bot, update)
        gd = GoogleDriveHelper()
        result, button = gd.clone(link)
        LOGGER.info('ID: {} - Username: {} - Message: {}'.format(
            update.message.chat.id, update.message.chat.username,
            update.message.text))
        # deleteMessage(context.bot,msg)
    else:
        sendMessage("Provide G-Drive Shareable Link to Clone.", context.bot,
                    update)
Beispiel #2
0
def cloneNode(update, context):
    if update.message.from_user.last_name:
        last_name = f" {update.message.from_user.last_name}"
    else:
        last_name = ""
    if update.message.from_user.username:
        username = f"- @{update.message.from_user.username}"
    else:
        username = "******"
    name = f'<a href="tg://user?id={update.message.from_user.id}">{update.message.from_user.first_name}{last_name}</a>'

    args = update.message.text.split(" ", maxsplit=1)
    if len(args) > 1:
        link = args[1]
        msg = f"Cloning..." \
              f"User: {name} {username} (<code>{update.message.from_user.id}</code>)\n" \
              f"Message: {update.message.text}"
        sendMessage(msg, context.bot, update)
        gd = GoogleDriveHelper()
        result, button = gd.clone(link)
        # deleteMessage(context.bot,msg)
        if button == "":
            sendMessage(result, context.bot, update)
        else:
            sendMarkup(result, context.bot, update, button)
    else:
        sendMessage("Provide G-Drive Shareable Link to Clone.", context.bot,
                    update)
Beispiel #3
0
def cloneNode(update, context):
    if update.message.from_user.last_name:
        last_name = f" {update.message.from_user.last_name}"
    else:
        last_name = ""
    if update.message.from_user.username:
        username = f"@{update.message.from_user.username}"
    else:
        username = ""
    name = f'<a href="tg://user?id={update.message.from_user.id}">{update.message.from_user.first_name}{last_name}</a>'

    args = update.message.text.split(" ", maxsplit=1)
    if len(args) > 1:
        link = args[1]
        msg = f"<code>Cloning....</code>\n\n<b>Wait Little bit. ๐ŸŒž</b>\n\n" \
              f"<b>๐Ÿ‘ค Upload by :</b> {username}\n\n" \
              f"<b>๐Ÿ”— Drive Link :</b> <code>{link}</code>"
        sendMessage(msg, context.bot, update)
        gd = GoogleDriveHelper()
        result, button = gd.clone(link)
        LOGGER.info('ID: {} - Username: {} - Message: {}'.format(
            update.message.chat.id, update.message.chat.username,
            update.message.text))
        # deleteMessage(context.bot,msg)
        sendMarkup(result, context.bot, update, button)
    else:
        sendMessage(
            "Dammnn ๐Ÿ˜’๐Ÿ˜ \nProvide Google Drive Shareable Link For Clone ๐ŸŒ\n\n๐Ÿ“ข ๐„๐ฑ๐š๐ฆ๐ฉ๐ฅ๐ž:\n <code>/clon1 your Google drive Link</code>\n\n๐Ÿ’ก For More Help Join Support Group\n ๐Ÿ“จ @MaxxBotChat",
            context.bot, update)
Beispiel #4
0
def cloneNode(update, context):
    if update.message.from_user.last_name:
        last_name = f" {update.message.from_user.last_name}"
    else:
        last_name = ""
    if update.message.from_user.username:
        username = f"@{update.message.from_user.username}"
    else:
        username = ""
    name = f'<a href="tg://user?id={update.message.from_user.id}">{update.message.from_user.first_name}{last_name}</a>'
    if username is not None:
        cc = f'\n\n<b>Cloned by :</b> {username}'

    args = update.message.text.split(" ", maxsplit=1)
    if len(args) > 1:
        link = args[1]
        msg = f'<b>Cloning......</b> \n\n' \
              f'<b>User :</b> {username}\n' \
              f'<b>Link :</b> <a href="{link}"><code>{link}</code></a>'
        sendMessage(msg, context.bot, update)
        gd = GoogleDriveHelper()
        result, button = gd.clone(link)
        LOGGER.info('ID: {} - Username: {} - Message: {}'.format(
            update.message.chat.id, update.message.chat.username,
            update.message.text))
        # deleteMessage(context.bot,msg)
        sendMarkup(result + cc, context.bot, update, button)
    else:
        sendMessage("Provide G-Drive Shareable Link to Clone.", context.bot,
                    update)
Beispiel #5
0
def cloneNode(update, context):
    args = update.message.text.split(" ", maxsplit=1)
    if len(args) > 1:
        link = args[1]
        gd = GoogleDriveHelper()
        if CLONE_LIMIT is not None or STOP_DUPLICATE_CLONE:
            msg1 = sendMessage(f"Checking Your Link...", context.bot, update)
            res, clonesize, name = gd.clonehelper(link)
            if res != "":
                deleteMessage(context.bot, msg1)
                sendMessage(res, context.bot, update)
                return
            if STOP_DUPLICATE_CLONE:
                LOGGER.info(f"Checking File/Folder if already in Drive...")
                smsg, button = gd.drive_list(name)
                if smsg:
                    deleteMessage(context.bot, msg1)
                    msg3 = "File/Folder is already available in Drive.\nHere are the search results:"
                    sendMarkup(msg3, context.bot, update, button)
                    return
                else:
                    if CLONE_LIMIT is None:
                        deleteMessage(context.bot, msg1)
            if CLONE_LIMIT is not None:
                LOGGER.info(f"Checking File/Folder Size...")
                limit = CLONE_LIMIT
                limit = limit.split(' ', maxsplit=1)
                limitint = int(limit[0])
                msg2 = f'Failed, Clone limit is {CLONE_LIMIT}.\nYour File/Folder size is {get_readable_file_size(clonesize)}.'
                if 'GB' in limit or 'gb' in limit:
                    if clonesize > limitint * 1024**3:
                        deleteMessage(context.bot, msg1)
                        sendMessage(msg2, context.bot, update)
                        return
                    else:
                        deleteMessage(context.bot, msg1)
                elif 'TB' in limit or 'tb' in limit:
                    if clonesize > limitint * 1024**4:
                        deleteMessage(context.bot, msg1)
                        sendMessage(msg2, context.bot, update)
                        return
                    else:
                        deleteMessage(context.bot, msg1)
        msg = sendMessage(f"Cloning: <code>{link}</code>", context.bot, update)
        result, button = gd.clone(link)
        deleteMessage(context.bot, msg)
        if button == "":
            sendMessage(result, context.bot, update)
        else:
            if update.message.from_user.username:
                uname = f'@{update.message.from_user.username}'
            else:
                uname = f'<a href="tg://user?id={update.message.from_user.id}">{update.message.from_user.first_name}</a>'
            if uname is not None:
                cc = f'\n\ncc: {uname}'
            sendMarkup(result + cc, context.bot, update, button)
    else:
        sendMessage('Provide G-Drive Shareable Link to Clone.', context.bot,
                    update)
Beispiel #6
0
def cloneNode(update,context):
    args = update.message.text.split(" ",maxsplit=1)
    if len(args) > 1:
        link = args[1]
        msg = sendMessage(f"Tunggu sebentar games, sedang menyalin : <code>{link}</code>",context.bot,update)
        gd = GoogleDriveHelper()
        result, button = gd.clone(link)
        deleteMessage(context.bot,msg)
        sendMarkup(result,context.bot,update,button)
    else:
        sendMessage("Tolong kasih link Google Drive yang bisa disalin.",context.bot,update)
Beispiel #7
0
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 GD-TD Shareable Link to Clone.", bot, update)
Beispiel #8
0
def cloneNode(client: Client, message: Message):
    args = message.text.split(" ", maxsplit=1)
    if len(args) > 1:
        link = args[1]
        msg = sendMessage(f"Cloning: <code>{link}</code>", client, message)
        gd = GoogleDriveHelper()
        result = gd.clone(link)
        deleteMessage(msg)
        sendMessage(result, client, message)
    else:
        sendMessage("Provide G-Drive Shareable Link to Clone.", client,
                    message)
Beispiel #9
0
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(
            "Cung cแบฅp liรชn kแบฟt cรณ thแปƒ chia sแบป trรชn G-Drive ฤ‘แปƒ sao chรฉp.",
            context.bot, update)
Beispiel #10
0
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, button = gd.clone(link)
        deleteMessage(context.bot,msg)
        if button == "":
            sendMessage(result,context.bot,update)
        else:
            sendMarkup(result,context.bot,update,button)
    else:
        sendMessage("Provide Google Drive Shareable Link to Clone.",context.bot,update)
Beispiel #11
0
def cloneNode(update,context):
    args = update.message.text.split(" ",maxsplit=1)
    if len(args) > 1:
        link = args[1]
        msg = sendMessage(f"๐—–๐—น๐—ผ๐—ป๐—ถ๐—ป๐—ด...Sir Please wait๐Ÿค“\n\n Link: <code>{link}</code>",context.bot,update)
        gd = GoogleDriveHelper()
        result, button = gd.clone(link)
        deleteMessage(context.bot,msg)
        if button == "":
            sendMessage(result,context.bot,update)
        else:
            sendMarkup(result,context.bot,update,button)
    else:
        sendMessage("Provide G-Drive Shareable Link to Clone๐Ÿ˜.",context.bot,update)
Beispiel #12
0
def cloneNode(update, context):
    args = update.message.text.split(" ", maxsplit=1)
    if len(args) > 1:
        link = args[1]
        msg = sendMessage(
            f"๐—–๐—น๐—ผ๐—ป๐—ถ๐—ป๐—ด..๐—ช๐—ฎ๐—ถ๐˜ ๐—ฝ๐—น๐˜€.๐Ÿค“\n\n๐Ÿ“จ Link:\n <code>{link}</code>",
            context.bot, update)
        gd = GoogleDriveHelper()
        result, button = gd.clone(link)
        deleteMessage(context.bot, msg)
        sendMarkup(result, context.bot, update, button)
    else:
        sendMessage(
            "Dammnn ๐Ÿ˜’๐Ÿ˜ \nProvide Google Drive Shareable Link For Clone ๐ŸŒ\n\n๐Ÿ“ข ๐„๐ฑ๐š๐ฆ๐ฉ๐ฅ๐ž:\n <code>/clon1 your Google drive Link</code>\n\n๐Ÿ’ก For More Help Join Support Group\n ๐Ÿ“จ @MaxxBotChat",
            context.bot, update)
Beispiel #13
0
def cloneNode(update, context):
    args = update.message.text.split(" ", maxsplit=1)
    if len(args) > 1:
        link = args[1]
        gd = GoogleDriveHelper()
        if CLONE_LIMIT is not None or STOP_DUPLICATE_CLONE:
            res, clonesize, name = gd.clonehelper(link)
            if res != "":
                sendMessage(res, context.bot, update)
                return
            if STOP_DUPLICATE_CLONE:
                LOGGER.info(f"๐Ÿ”Ž Checking File/Folder if already in Drive...")
                smsg, button = gd.drive_list(name)
                if smsg:
                    msg3 = "File/Folder is already available in Drive.\nHere are the search results:"
                    sendMarkup(msg3, context.bot, update, button)
                    return
            if CLONE_LIMIT is not None:
                LOGGER.info(f"Checking File/Folder Size...")
                limit = CLONE_LIMIT
                limit = limit.split(' ', maxsplit=1)
                limitint = int(limit[0])
                msg2 = f'Failed, Clone limit is {CLONE_LIMIT}.\nYour File/Folder size is {get_readable_file_size(clonesize)}.'
                if 'G' in limit[1] or 'g' in limit[1]:
                    if clonesize > limitint * 1024**3:
                        sendMessage(msg2, context.bot, update)
                        return
                elif 'T' in limit[1] or 't' in limit[1]:
                    if clonesize > limitint * 1024**4:
                        sendMessage(msg2, context.bot, update)
                        return
        msg = sendMessage(f"๐Ÿ“š Cloning : <code>{link}</code>", context.bot,
                          update)
        result, button = gd.clone(link)
        deleteMessage(context.bot, msg)
        if button == "":
            sendMessage(result, context.bot, update)
        else:
            if update.message.from_user.username:
                uname = f'@{update.message.from_user.username}'
            else:
                uname = f'<a href="tg://user?id={update.message.from_user.id}">{update.message.from_user.first_name}</a>'
            if uname is not None:
                cc = f'\n\n๐Ÿ‘ค ๐—–๐—น๐—ผ๐—ป๐—ฒ๐—ฟ : {uname}\n\n๐Ÿ”ฅ ๐—ฃ๐—ฟ๐—ถ๐—ถ๐—ถ๐—ถ๐˜†๐—ผ ๐— ๐—ถ๐—ฟ๐—ฟ๐—ผ๐—ฟ ๐—ญ๐—ผ๐—ป๐—˜\n\n๐Ÿ”ฅ ๐—š๐—ฟ๐—ผ๐˜‚๐—ฝ : @PriiiiyoMirror\n\nโ–ซ๏ธ#Uploaded To Team Drive โœ“ \n\n๐Ÿšซ ๐——๐—ผ ๐—ก๐—ผ๐˜ ๐—ฆ๐—ต๐—ฎ๐—ฟ๐—ฒ ๐—œ๐—ป๐—ฑ๐—ฒ๐˜… ๐—Ÿ๐—ถ๐—ป๐—ธ \n\nโœ… ๐—ฃ๐—ผ๐˜„๐—ฒ๐—ฟ๐—ฒ๐—ฑ ๐—•๐˜† : @PriiiiyoBOTs'
            sendMarkup(result + cc, context.bot, update, button)
    else:
        sendMessage('Provide G-Drive Shareable Link to Clone.', context.bot,
                    update)
def cloneNode(update, context):
    args = update.message.text.split(" ", maxsplit=1)
    if len(args) > 1:
        link = args[1]
        msg = sendMessage(f"Menyalin File/Folder : <code>{link}</code>",
                          context.bot, update)
        gd = GoogleDriveHelper()
        result, button = gd.clone(link)
        deleteMessage(context.bot, msg)
        if button == "":
            sendMessage(result, context.bot, update)
        else:
            sendMarkup(result, context.bot, update, button)
    else:
        sendMessage("Berikan G-Drive Shareable Link untuk disalin.",
                    context.bot, update)
Beispiel #15
0
def cloneNode(update, context):
    args = update.message.text.split(" ", maxsplit=1)
    if len(args) > 1:
        link = args[1]
        username = f"@{update.message.from_user.username}"
        msg = f'Cloning...\n' \
              f'User: {username}\n' \
              f'Link: <a href="{link}">{link}</a>'
        sendMessage(msg, context.bot, update)
        gd = GoogleDriveHelper()
        result, button = gd.clone(link)
        deleteMessage(context.bot, msg)
        sendMarkup(result, context.bot, update, button)
    else:
        sendMessage("Provide G-Drive Shareable Link to Clone.", context.bot,
                    update)
Beispiel #16
0
def cloneNode(update, context):
    args = update.message.text.split(" ", maxsplit=1)
    if len(args) > 1:
        link = args[1]
        msg = sendMessage(f"โ›ฝ๐‚๐ฅ๐จ๐ง๐ข๐ง๐ ...โš—๏ธ: <code>{link}</code>", context.bot,
                          update)
        gd = GoogleDriveHelper()
        result, button = gd.clone(link)
        deleteMessage(context.bot, msg)
        if button == "":
            sendMessage(result, context.bot, update)
        else:
            sendMarkup(result, context.bot, update, button)
    else:
        sendMessage("โ›ฝ๐๐ฅ๐ž๐š๐ฌ๐ž ๐๐ซ๐จ๐ฏ๐ข๐๐ž ๐†-๐ƒ๐ซ๐ข๐ฏ๐ž ๐’๐ก๐š๐ซ๐ž๐š๐›๐ฅ๐ž ๐‹๐ข๐ง๐ค ๐“๐จ ๐‚๐ฅ๐จ๐ง๐ž.",
                    context.bot, update)
Beispiel #17
0
def cloneNode(update, context):
    args = update.message.text.split(" ", maxsplit=1)
    if len(args) > 1:
        link = args[1]
        msg = sendMessage(f"๐—–๐—น๐—ผ๐—ป๐—ถ๐—ป๐—ด..๐—ช๐—ฎ๐—ถ๐˜ ๐—ฝ๐—น๐˜€.๐Ÿค“\n\n ๐—Ÿ๐—ถ๐—ป๐—ธ: <code>{link}</code>",
                          context.bot, update)
        gd = GoogleDriveHelper()
        result, button = gd.clone(link)
        deleteMessage(context.bot, msg)
        if button == "":
            sendMessage(result, context.bot, update)
        else:
            sendMarkup(result, context.bot, update, button)
    else:
        sendMessage("๐—ฃ๐—ฟ๐—ผ๐˜ƒ๐—ถ๐—ฑ๐—ฒ ๐—š-๐——๐—ฟ๐—ถ๐˜ƒ๐—ฒ ๐—ฆ๐—ต๐—ฎ๐—ฟ๐—ฒ๐—ฎ๐—ฏ๐—น๐—ฒ ๐—Ÿ๐—ถ๐—ป๐—ธ ๐˜๐—ผ ๐—–๐—น๐—ผ๐—ป๐—ฒ๐Ÿ˜.", context.bot,
                    update)
Beispiel #18
0
def cloneNode(update, context):
    args = update.message.text.split(" ", maxsplit=1)
    if len(args) > 1:
        link = args[1]
        gd = GoogleDriveHelper()
        if CLONE_LIMIT is not None:
            mssg = sendMessage(f"Checking The Size...", context.bot, update)
            limit = CLONE_LIMIT
            limit = limit.split(' ', maxsplit=1)
            limitint = int(limit[0])
            res, clonesizelimit = gd.count(link)
            if clonesizelimit != "":
                msgg = f'Failed, Clone limit is {CLONE_LIMIT}'
                if 'GB' in limit or 'gb' in limit:
                    if clonesizelimit > limitint * 1024**3:
                        deleteMessage(context.bot, mssg)
                        sendMessage(msgg, context.bot, update)
                        return
                    else:
                        deleteMessage(context.bot, mssg)
                elif 'TB' in limit or 'tb' in limit:
                    if clonesizelimit > limitint * 1024**4:
                        deleteMessage(context.bot, mssg)
                        sendMessage(msgg, context.bot, update)
                        return
                    else:
                        deleteMessage(context.bot, mssg)
            else:
                deleteMessage(context.bot, mssg)
                sendMessage(res, context.bot, update)
                return
        msg = sendMessage(f"Cloning: <code>{link}</code>", context.bot, update)
        result, button = gd.clone(link)
        deleteMessage(context.bot, msg)
        if button == "":
            sendMessage(result, context.bot, update)
        else:
            if update.message.from_user.username:
                uname = f'@{update.message.from_user.username}'
            else:
                uname = f'<a href="tg://user?id={update.message.from_user.id}">{update.message.from_user.first_name}</a>'
            if uname is not None:
                cc = f'\n\n#cc: {uname}'
            sendMarkup(result + cc, context.bot, update, button)
    else:
        sendMessage('Provide G-Drive Shareable Link to Clone.', context.bot,
                    update)
Beispiel #19
0
def cloneNode(update, context):
    args = update.message.text.split(" ", maxsplit=1)
    if len(args) > 1:
        link = args[1]
        msg = sendMessage(f"<b>โ›ฝCสŸแดษดษชษดษข...</b>: <code>{link}</code>",
                          context.bot, update)
        gd = GoogleDriveHelper()
        result, button = gd.clone(link)
        deleteMessage(context.bot, msg)
        if button == "":
            sendMessage(result, context.bot, update)
        else:
            sendMarkup(result, context.bot, update, button)
    else:
        sendMessage(
            "<b>๐Ÿ—ผPสŸแด‡แด€sแด‡ Sแด‡ษดแด… G-Dส€ษชแด แด‡ โ™ป๏ธSสœแด€ส€แด‡แด€ส™สŸแด‡ FแดสŸแด…แด‡ส€ ID แดส€ Lษชษดแด‹ Tแด CสŸแดษดแด‡</b>.",
            context.bot, update)
Beispiel #20
0
def cloneNode(update,context):
    args = update.message.text.split(" ",maxsplit=1)
    if update.message.from_user.username:
        uname = f"@{update.message.from_user.username}"
    else:
        uname = f'<a href="tg://user?id={update.message.from_user.id}">{update.message.from_user.first_name}</a>'
    if uname is not None:
            cc = f'\n\nCloned by: {uname}'
    if len(args) > 1:
        link = args[1]
        msg = sendMessage(f"รฐลธโ€œยฆ: <code>{link}</code>",context.bot,update)
        gd = GoogleDriveHelper()
        result, button = gd.clone(link)
        deleteMessage(context.bot,msg)
        if button == "":
            sendMessage(result,context.bot,update)
        else:
            sendMarkup(result + cc,context.bot,update,button)
    else:
        sendMessage("Provide G-Drive Shareable Link to Clone.",context.bot,update)
Beispiel #21
0
def cloneNode(update, context):
    args = update.message.text.split(" ", maxsplit=1)
    if update.message.from_user.username:
        uname = f"@{update.message.from_user.username}"
    else:
        uname = f'\n\n Credit Goes TO โซท[ส˜ฯพแธ‚]โซธ'
    if uname is not None:
        cc = f'\n\n Credit Goes TO โซท[ส˜ฯพแธ‚]โซธ'
    if len(args) > 1:
        link = args[1]
        msg = sendMessage(f"Cloning: <code>{link}</code>", context.bot, update)
        gd = GoogleDriveHelper()
        result, button = gd.clone(link)
        deleteMessage(context.bot, msg)
        if button == "":
            sendMessage(result, context.bot, update)
        else:
            sendMarkup(result + cc, context.bot, update, button)
    else:
        sendMessage("Provide G-Drive Shareable Link to Clone.", context.bot,
                    update)
Beispiel #22
0
def cloneNode(update, context):
    args = update.message.text.split(" ", maxsplit=1)
    if update.message.from_user.username:
        uname = f"@{update.message.from_user.username}"
    else:
        uname = f'<a href="tg://user?id={update.message.from_user.id}">{update.message.from_user.first_name}</a>'
    if uname is not None:
        cc = f'\n\n<b>๐Ÿ‘ค๐š„๐š™๐š•๐š˜๐šŠ๐š๐šŽ๐š› :</b> {uname}'
    if len(args) > 1:
        link = args[1]
        msg = sendMessage(f"๐ŸŒˆ๐™ฒ๐š•๐š˜๐š—๐š’๐š—๐š๐ŸŒˆ: <code>{link}</code>", context.bot,
                          update)
        gd = GoogleDriveHelper()
        result, button = gd.clone(link)
        deleteMessage(context.bot, msg)
        if button == "":
            sendMessage(result, context.bot, update)
        else:
            sendMarkup(result + cc, context.bot, update, button)
    else:
        sendMessage("๐™ฟ๐š›๐š˜๐šŸ๐š’๐š๐šŽ ๐™ถ-๐™ณ๐š›๐š’๐šŸ๐šŽ ๐š‚๐š‘๐šŠ๐š›๐šŽ๐šŠ๐š‹๐š•๐šŽ ๐™ป๐š’๐š—๐š” ๐š๐š˜ ๐™ฒ๐š•๐š˜๐š—๐šŽ๐Ÿ˜.", context.bot,
                    update)
Beispiel #23
0
def cloneNode(update, context):
    args = update.message.text.split(" ", maxsplit=1)
    if update.message.from_user.username:
        uname = f"@{update.message.from_user.username}"
    else:
        uname = f'<a href="tg://user?id={update.message.from_user.id}">{update.message.from_user.first_name}</a>'
    if uname is not None:
        cc = f'\n\ncc: {uname}'
    if len(args) > 1:
        link = args[1]
        msg = sendMessage(
            f'โ˜ป ใ€Œ  Cloning  ใ€ โ˜ป\n\nโšก <b>Its Fast AF Boi</b> โšก\n\n<a href="{link}">๐Ÿ‘€  GIVEN LINK  ๐Ÿ‘€</a>',
            context.bot, update)
        gd = GoogleDriveHelper()
        result, button = gd.clone(link)
        deleteMessage(context.bot, msg)
        if button == "":
            sendMessage(result, context.bot, update)
        else:
            sendMarkup(result + cc, context.bot, update, button)
    else:
        sendMessage("Provide G-Drive Shareable Link to Clone.", context.bot,
                    update)
Beispiel #24
0
def cloneNode(update, context):
    args = update.message.text.split(" ", maxsplit=1)
    reply_to = update.message.reply_to_message
    if len(args) > 1:
        link = args[1]
        if update.message.from_user.username:
            tag = f"@{update.message.from_user.username}"
        else:
            tag = update.message.from_user.mention_html(
                update.message.from_user.first_name)
    elif reply_to is not None:
        link = reply_to.text
        if reply_to.from_user.username:
            tag = f"@{reply_to.from_user.username}"
        else:
            tag = reply_to.from_user.mention_html(
                reply_to.from_user.first_name)
    else:
        link = ''
    gdtot_link = is_gdtot_link(link)
    if gdtot_link:
        try:
            msg = sendMessage(f"Processing: <code>{link}</code>", context.bot,
                              update)
            link = gdtot(link)
            deleteMessage(context.bot, msg)
        except DirectDownloadLinkException as e:
            deleteMessage(context.bot, msg)
            return sendMessage(str(e), context.bot, update)
    if is_gdrive_link(link):
        gd = GoogleDriveHelper()
        res, size, name, files = gd.helper(link)
        if res != "":
            return sendMessage(res, context.bot, update)
        if STOP_DUPLICATE:
            LOGGER.info('Checking File/Folder if already in Drive...')
            smsg, button = gd.drive_list(name, True, True)
            if smsg:
                msg3 = "File/Folder is already available in Drive.\nHere are the search results:"
                sendMarkup(msg3, context.bot, update, button)
                if gdtot_link:
                    gd.deletefile(link)
                return
        if CLONE_LIMIT is not None:
            LOGGER.info('Checking File/Folder Size...')
            if size > CLONE_LIMIT * 1024**3:
                msg2 = f'Failed, Clone limit is {CLONE_LIMIT}GB.\nYour File/Folder size is {get_readable_file_size(size)}.'
                return sendMessage(msg2, context.bot, update)
        if files <= 10:
            msg = sendMessage(f"Cloning: <code>{link}</code>", context.bot,
                              update)
            result, button = gd.clone(link)
            deleteMessage(context.bot, msg)
        else:
            drive = GoogleDriveHelper(name)
            gid = ''.join(random.SystemRandom().choices(string.ascii_letters +
                                                        string.digits,
                                                        k=12))
            clone_status = CloneStatus(drive, size, update, gid)
            with download_dict_lock:
                download_dict[update.message.message_id] = clone_status
            sendStatusMessage(update, context.bot)
            result, button = drive.clone(link)
            with download_dict_lock:
                del download_dict[update.message.message_id]
                count = len(download_dict)
            try:
                if count == 0:
                    Interval[0].cancel()
                    del Interval[0]
                    delete_all_messages()
                else:
                    update_all_messages()
            except IndexError:
                pass
        cc = f'\n\n<b>cc: </b>{tag}'
        if button in ["cancelled", ""]:
            sendMessage(f"{tag} {result}", context.bot, update)
        else:
            sendMarkup(result + cc, context.bot, update, button)
        if gdtot_link:
            gd.deletefile(link)
    else:
        sendMessage(
            'Send Gdrive or gdtot link along with command or by replying to the link by command',
            context.bot, update)