Esempio n. 1
0
def countNode(update, context):
    args = update.message.text.split(" ", maxsplit=1)
    if len(args) > 1:
        link = args[1]
        msg = sendMessage(f"Counting: <code>{link}</code>", context.bot,
                          update)
        gd = GoogleDriveHelper()
        result = gd.count(link)
        deleteMessage(context.bot, msg)
        sendMessage(result, context.bot, update)
    else:
        sendMessage("Provide G-Drive Shareable Link to Count.", context.bot,
                    update)
Esempio n. 2
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)
Esempio n. 3
0
def countNode(update, context):
    args = update.message.text.split(" ", maxsplit=1)
    if len(args) > 1:
        link = args[1]
        msg = sendMessage(f"Counting: <code>{link}</code>", context.bot, update)
        gd = GoogleDriveHelper()
        result = gd.count(link)
        deleteMessage(context.bot, msg)
        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}'
        sendMessage(result + cc, context.bot, update)
    else:
        sendMessage("Provide G-Drive Shareable Link to Count.", context.bot, update)
Esempio n. 4
0
def countNode(update, context):
    args = update.message.text.split(" ", maxsplit=1)
    if len(args) > 1:
        link = args[1]
        msg = sendMessage(f"๐Ÿ“š Counting : <code>{link}</code>", context.bot,
                          update)
        gd = GoogleDriveHelper()
        result = gd.count(link)
        deleteMessage(context.bot, msg)
        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'
        sendMessage(result + cc, context.bot, update)
    else:
        sendMessage("Provide G-Drive Shareable Link to Count.", context.bot,
                    update)
Esempio n. 5
0
def countNode(update, context):
    args = update.message.text.split(" ", maxsplit=1)
    reply_to = update.message.reply_to_message
    link = ''
    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)
    if reply_to is not None:
        if len(link) == 0:
            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)
    gdtot_link = is_gdtot_link(link)
    if gdtot_link:
        try:
            link = gdtot(link)
        except DirectDownloadLinkException as e:
            return sendMessage(str(e), context.bot, update)
    if is_gdrive_link(link):
        msg = sendMessage(f"Counting: <code>{link}</code>", context.bot,
                          update)
        gd = GoogleDriveHelper()
        result = gd.count(link)
        deleteMessage(context.bot, msg)
        cc = f'\n\n<b>cc: </b>{tag}'
        sendMessage(result + cc, context.bot, update)
        if gdtot_link:
            gd.deletefile(link)
    else:
        sendMessage(
            'Send Gdrive link along with command or by replying to the link by command',
            context.bot, update)