コード例 #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)
コード例 #2
0
ファイル: clone.py プロジェクト: rnxyr/slam-mirrorbot
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)
コード例 #3
0
ファイル: count.py プロジェクト: setan69/slam-mirrorbot
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)
コード例 #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)
コード例 #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)