Example #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}")
Example #3
0
        # 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,
Example #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}"
        )
Example #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}")