示例#1
0
async def incoming_message_f(client, message):
    """/leech command or /gleech command"""
    user_command = message.command[0]
    g_id = message.from_user.id
    credit = await message.reply_text(
        f"🧲 Leeching for you <a href='tg://user?id={g_id}'>🤕</a>",
        parse_mode="html")
    # get link from the incoming message
    i_m_sefg = await message.reply_text("processing...", quote=True)
    rep_mess = message.reply_to_message
    is_file = False
    dl_url = ''
    cf_name = ''
    if rep_mess:
        file_name = ''
        if rep_mess.media:
            file = [rep_mess.document, rep_mess.video, rep_mess.audio]
            file_name = [fi for fi in file if fi is not None][0].file_name
        if not rep_mess.media or str(file_name).lower().endswith(".torrent"):
            dl_url, cf_name, _, _ = await extract_link(
                message.reply_to_message, "LEECH")
            LOGGER.info(dl_url)
            LOGGER.info(cf_name)
        else:
            if user_command == LEECH_COMMAND.lower():
                await i_m_sefg.edit("No downloading source provided 🙄")
                return
            is_file = True
            dl_url = rep_mess
    elif len(message.command) == 2:
        dl_url = message.command[1]
        LOGGER.info(dl_url)

    else:
        await i_m_sefg.edit("👺𝙉𝙤 𝙙𝙤𝙬𝙣𝙡𝙤𝙖𝙙𝙞𝙣𝙜 𝙨𝙤𝙪𝙧𝙘𝙚 𝙥𝙧𝙤𝙫𝙞𝙙𝙚𝙙👺")
        return
    if dl_url is not None:

        current_user_id = message.from_user.id
        # create an unique directory
        new_download_location = os.path.join(DOWNLOAD_LOCATION,
                                             str(current_user_id),
                                             str(time.time()))
        # create download directory, if not exist
        if not os.path.isdir(new_download_location):
            os.makedirs(new_download_location)
        aria_i_p = ''
        if not is_file:
            await i_m_sefg.edit_text("extracting links")
            # start the aria2c daemon
            aria_i_p = await aria_start()
            # LOGGER.info(aria_i_p)

        await i_m_sefg.edit_text("Added to downloads. Send /status")
        # try to download the "link"
        is_zip = False
        is_cloud = False
        is_unzip = False

        if user_command == LEECH_UNZIP_COMMAND.lower():
            is_unzip = True
        elif user_command == LEECH_ZIP_COMMAND.lower():
            is_zip = True

        if user_command == GLEECH_COMMAND.lower():
            is_cloud = True
        if user_command == GLEECH_UNZIP_COMMAND.lower():
            is_cloud = True
            is_unzip = True
        elif user_command == GLEECH_ZIP_COMMAND.lower():
            is_cloud = True
            is_zip = True
        sagtus, err_message = await call_apropriate_function(
            aria_i_p,
            dl_url,
            new_download_location,
            i_m_sefg,
            is_zip,
            cf_name,
            is_cloud,
            is_unzip,
            is_file,
            message,
            client,
        )
        if not sagtus:
            # if FAILED, display the error message
            await i_m_sefg.edit_text(err_message)
    else:
        await i_m_sefg.edit_text(
            "**FCUK**! wat have you entered. \nPlease read /help \n"
            f"<b>API Error</b>: {cf_name}")
async def incoming_message_f(client, message):
    """/leech command or /gleech command"""
    user_command = message.command[0]
    #g_id = message.from_user.id
    # u_men = message.from_user.mention
    #credit = await message.reply_text(
    #f"<b>⚙ Leeching For :</b> {u_men}", parse_mode="html"
    #)
    i_m_sefg = await message.reply_text("`Processing...`", quote=True)
    # get link from the incoming message
    if message.reply_to_message:
        dl_url, cf_name, _, _ = await extract_link(message.reply_to_message,
                                                   "LEECH")
        LOGGER.info(dl_url)
        LOGGER.info(cf_name)
    elif len(message.command) == 2:
        dl_url = message.command[1]
        LOGGER.info(dl_url)
        cf_name = None
    else:
        await i_m_sefg.edit(
            "<b>Hey Dude !</b>\n\n 🐈 <code>Reply with Direct /Torrent Link</code>"
        )
        return
    if dl_url is not None:
        await i_m_sefg.edit_text("<b>Extracting Link..🤐</b>")
        # start the aria2c daemon
        aria_i_p = await aria_start()
        # LOGGER.info(aria_i_p)
        current_user_id = message.from_user.id
        # create an unique directory
        new_download_location = os.path.join(DOWNLOAD_LOCATION,
                                             str(current_user_id),
                                             str(time.time()))
        # create download directory, if not exist
        if not os.path.isdir(new_download_location):
            os.makedirs(new_download_location)
        await i_m_sefg.edit_text("<b>Trying To Download....📥</b>")
        # try to download the "link"
        is_zip = False
        is_cloud = False
        is_unzip = False

        if user_command == LEECH_UNZIP_COMMAND.lower():
            is_unzip = True
        elif user_command == LEECH_ZIP_COMMAND.lower():
            is_zip = True

        if user_command == GLEECH_COMMAND.lower():
            is_cloud = True
        if user_command == GLEECH_UNZIP_COMMAND.lower():
            is_cloud = True
            is_unzip = True
        elif user_command == GLEECH_ZIP_COMMAND.lower():
            is_cloud = True
            is_zip = True
        sagtus, err_message = await call_apropriate_function(
            aria_i_p,
            dl_url,
            new_download_location,
            i_m_sefg,
            is_zip,
            cf_name,
            is_cloud,
            is_unzip,
            message,
            client,
        )
        if not sagtus:
            # if FAILED, display the error message
            await i_m_sefg.edit_text(err_message)
    else:
        await i_m_sefg.edit_text("**FCUK**! wat have you entered. \n"
                                 f"<b>API Error</b>: {cf_name}")
示例#3
0
        )
        # create download directory, if not exist
        if not os.path.isdir(new_download_location):
            os.makedirs(new_download_location)
        await i_m_sefg.edit_text("trying to download")
        # try to download the "link"
        is_zip = False
        is_cloud = False
        is_unzip = False

        if user_command == LEECH_UNZIP_COMMAND.lower():
            is_unzip = True
        elif user_command == LEECH_ZIP_COMMAND.lower():
            is_zip = True

        if user_command == GLEECH_COMMAND.lower():
            is_cloud = True
        if user_command == GLEECH_UNZIP_COMMAND.lower():
            is_cloud = True
            is_unzip = True
        elif user_command == GLEECH_ZIP_COMMAND.lower():
            is_cloud = True
            is_zip = True
        sagtus, err_message = await call_apropriate_function(
            aria_i_p,
            dl_url,
            new_download_location,
            i_m_sefg,
            is_zip,
            cf_name,
            is_cloud,
示例#4
0
async def incoming_message_f(client, message):
    """/leech command or /gleech command"""
    user_command = message.command[0]
    g_id = message.from_user.id
    credit = await message.reply_text(
        f"🧲 Leeching for you <a href='tg://user?id={g_id}'>🤕</a>", parse_mode="html"
    )
    i_m_sefg = await message.reply_text("processing...", quote=True)
    # get link from the incoming message
    if message.reply_to_message:
        dl_url, cf_name, _, _ = await extract_link(message.reply_to_message, "LEECH")
        LOGGER.info(dl_url)
        LOGGER.info(cf_name)
    elif len(message.command) == 2:
        dl_url = message.command[1]
        LOGGER.info(dl_url)
        cf_name = None
    else:
        await i_m_sefg.edit("😔 No downloading source provided 🙄")
        return
    if dl_url is not None:
        await i_m_sefg.edit_text("extracting links")
        # start the aria2c daemon
        aria_i_p = await aria_start()
        # LOGGER.info(aria_i_p)
        current_user_id = message.from_user.id
        # create an unique directory
        new_download_location = os.path.join(
            DOWNLOAD_LOCATION, str(current_user_id), str(time.time())
        )
        # create download directory, if not exist
        if not os.path.isdir(new_download_location):
            os.makedirs(new_download_location)
        await i_m_sefg.edit_text("trying to download")
        # try to download the "link"
        is_zip = False
        is_cloud = False
        is_unzip = False

        if user_command == LEECH_UNZIP_COMMAND.lower():
            is_unzip = True
        elif user_command == LEECH_ZIP_COMMAND.lower():
            is_zip = True

        if user_command == GLEECH_COMMAND.lower():
            is_cloud = True
        if user_command == GLEECH_UNZIP_COMMAND.lower():
            is_cloud = True
            is_unzip = True
        elif user_command == GLEECH_ZIP_COMMAND.lower():
            is_cloud = True
            is_zip = True
        sagtus, err_message = await call_apropriate_function(
            aria_i_p,
            dl_url,
            new_download_location,
            i_m_sefg,
            is_zip,
            cf_name,
            is_cloud,
            is_unzip,
            message,
            client,
        )
        if not sagtus:
            # if FAILED, display the error message
            await i_m_sefg.edit_text(err_message)
    else:
        await i_m_sefg.edit_text(
            "**FCUK**! wat have you entered. \nPlease read /help \n"
            f"<b>API Error</b>: {cf_name}"
        )
示例#5
0
async def incoming_message_f(client, message):
    """/leech command or /gleech command"""
    user_command = message.command[0]
    g_id = message.from_user.id
    credit = await message.reply_text(
        f"🧲 Mengupload untukmu <a href='tg://user?id={g_id}'>🤕</a>",
        parse_mode="html")
    i_m_sefg = await message.reply_text("Memproses...", quote=True)
    # get link from the incoming message
    if message.reply_to_message:
        dl_url, cf_name, _, _ = await extract_link(message.reply_to_message,
                                                   "LEECH")
        LOGGER.info(dl_url)
        LOGGER.info(cf_name)
    elif len(message.command) == 2:
        dl_url = message.command[1]
        LOGGER.info(dl_url)
        cf_name = None
    else:
        await i_m_sefg.edit("😔 Tidak ada sumber download yang diberikan 🙄")
        return
    if dl_url is not None:
        await i_m_sefg.edit_text("Mengekstrak link")
        # start the aria2c daemon
        aria_i_p = await aria_start()
        # LOGGER.info(aria_i_p)
        current_user_id = message.from_user.id
        # create an unique directory
        new_download_location = os.path.join(DOWNLOAD_LOCATION,
                                             str(current_user_id),
                                             str(time.time()))
        # create download directory, if not exist
        if not os.path.isdir(new_download_location):
            os.makedirs(new_download_location)
        await i_m_sefg.edit_text("Mencoba mengunduh")
        # try to download the "link"
        is_zip = False
        is_cloud = False
        is_unzip = False

        if user_command == LEECH_UNZIP_COMMAND.lower():
            is_unzip = True
        elif user_command == LEECH_ZIP_COMMAND.lower():
            is_zip = True

        if user_command == GLEECH_COMMAND.lower():
            is_cloud = True
        if user_command == GLEECH_UNZIP_COMMAND.lower():
            is_cloud = True
            is_unzip = True
        elif user_command == GLEECH_ZIP_COMMAND.lower():
            is_cloud = True
            is_zip = True
        sagtus, err_message = await call_apropriate_function(
            aria_i_p,
            dl_url,
            new_download_location,
            i_m_sefg,
            is_zip,
            cf_name,
            is_cloud,
            is_unzip,
            message,
            client,
        )
        if not sagtus:
            # if FAILED, display the error message
            await i_m_sefg.edit_text(err_message)
    else:
        await i_m_sefg.edit_text(
            "**Ha? Apa yang kamu kirimkan, tolong baca pinned message \n"
            f"<b>API Error</b>: {cf_name}")