Esempio n. 1
0
async def ph(client, message):
    pablo = await edit_or_reply(message, "`Processing.....`")
    Hell = get_text(message)
    if not Hell:
        await pablo.edit(
            "`Please Give Me A Valid Input. You Can Check Help Menu To Know More!`"
        )
        return
    Escobar = Hell.split(":")
    username = Escobar[0]
    try:
        texto = Escobar[1]
    except:
        await pablo.edit(
            "`Please Give Me A Valid Input. You Can Check Help Menu To Know More!`"
        )
        return
    img = Image.open(
        "./bot_utils_files/image_templates/ph_comment_templete.jpg")
    d1 = ImageDraw.Draw(img)
    myFont = ImageFont.truetype("./bot_utils_files/Fonts/ph_comment_font.TTF",
                                100)
    d1.text((300, 700), username, font=myFont, fill=(135, 98, 87))
    d1.text((12, 1000), texto, font=myFont, fill=(203, 202, 202))
    img.save("FRIDAYOT.jpg")
    file_name = "FRIDAYOT.jpg"
    ok = file_name
    if message.reply_to_message:
        await client.send_photo(
            message.chat.id,
            photo=ok,
            reply_to_message_id=message.reply_to_message.message_id,
        )
    else:
        await client.send_photo(message.chat.id, photo=ok)
    if os.path.exists(ok):
        os.remove(ok)
    await pablo.delete()
Esempio n. 2
0
async def ujwal_s_ticker(client, message):
    msg_ = await edit_or_reply(message, "`Processing.....`")
    text = get_text(message)
    if not text:
        msg_.edit("`Give Me Text As Input!`")
        returm
    sticktext = textwrap.wrap(text, width=10)
    sticktext = "\n".join(sticktext)
    R = random.randint(0, 256)
    G = random.randint(0, 256)
    B = random.randint(0, 256)
    image = Image.new("RGBA", (512, 512), (255, 255, 255, 0))
    draw = ImageDraw.Draw(image)
    font_ = choose_random_font()
    fontsize = 230
    font = ImageFont.truetype(font_, size=fontsize)
    while draw.multiline_textsize(sticktext, font=font) > (512, 512):
        fontsize -= 3
        font = ImageFont.truetype(font_, size=fontsize)
    width, height = draw.multiline_textsize(sticktext, font=font)
    draw.multiline_text(((512 - width) / 2, (512 - height) / 2),
                        sticktext,
                        font=font,
                        fill=(R, G, B))
    ok = "sticklet.webp"
    image.save(ok, "WebP")
    if message.reply_to_message:
        await client.send_sticker(
            message.chat.id,
            sticker=ok,
            reply_to_message_id=message.reply_to_message.message_id,
        )
    else:
        await client.send_sticker(message.chat.id, sticker=ok)
    await msg_.delete()
    for files in (font_, ok):
        if files and os.path.exists(files):
            os.remove(files)
Esempio n. 3
0
async def ban_world(client, message):
    bun = await edit_or_reply(message, "`Trying To Ban User!`")
    me_m = client.me
    me_ = await message.chat.get_member(int(me_m.id))
    if not me_.can_restrict_members:
        await bun.edit("`Boss, You Don't Have Ban Permission!`")
        return
    text_ = get_text(message)
    userk, reason = get_user(message, text_)
    if not userk:
        await bun.edit(
            "`Bruh, Please Reply To User / Give Me Username of ID To Ban!`")
        return
    try:
        user_ = await client.get_users(userk)
    except:
        await bun.edit(f"`404 : User Doesn't Exists In This Chat !`")
        return
    userz = user_.id
    if not reason:
        reason = "Not Specified!"
    if userz == me_m.id:
        await bun.edit("`🙄 Nice Idea, Lets Leave This Chat!`")
        return
    try:
        user_ = await client.get_users(userz)
    except:
        await bun.edit(f"`404 : User Doesn't Exists In This Chat !`")
        return
    try:
        await client.kick_chat_member(message.chat.id, int(user_.id))
    except BaseException as e:
        await bun.edit(f"`I Am Un-able To Ban That User` \n**Error :** `{e}`")
        return
    b = f"**#Banned** \n**User :** [{user_.first_name}](tg://user?id={user_.id}) \n**Chat :** `{message.chat.title}` \n**Reason :** `{reason}`"
    await bun.edit(b)
    log = LogIt(message)
    await log.log_msg(client, b)
Esempio n. 4
0
async def ban_world(client, message):
    engine = message.Engine
    bun = await edit_or_reply(message, engine.get_string("PROCESSING"))
    me_m = client.me
    me_ = await message.chat.get_member(int(me_m.id))
    if not me_.can_restrict_members:
        await bun.edit(engine.get_string("NOT_ADMIN"))
        return
    text_ = get_text(message)
    userk, reason = get_user(message, text_)
    if not userk:
        await bun.edit(engine.get_string("TO_DO").format("Ban"))
        return
    try:
        user_ = await client.get_users(userk)
    except BaseException as e:
        await bun.edit(engine.get_string("USER_MISSING").format(e))
        return
    userz = user_.id
    if not reason:
        reason = "Not Specified!"
    if userz == me_m.id:
        await bun.edit(engine.get_string("TF_DO_IT").format("Ban"))
        return
    try:
        user_ = await client.get_users(userz)
    except BaseException as e:
        await bun.edit(engine.get_string("USER_MISSING").format(e))
        return
    try:
        await client.kick_chat_member(message.chat.id, int(user_.id))
    except BaseException as e:
        await bun.edit(engine.get_string("FAILED_ADMIN_ACTION").format("Ban", e))
        return
    b = f"**#Banned** \n**User :** [{user_.first_name}](tg://user?id={user_.id}) \n**Chat :** `{message.chat.title}` \n**Reason :** `{reason}`"
    await bun.edit(b)
    log = LogIt(message)
    await log.log_msg(client, b)
Esempio n. 5
0
async def eval(client, message):
    stark = await edit_or_reply(message, "`Running Code... Please Wait!`")
    cmd = get_text(message)
    if not cmd:
        await stark.edit(
            "Invalid Command Syntax, Please Check Help Menu To Know More!")
        return
    if message.reply_to_message:
        message.reply_to_message.message_id
    old_stderr = sys.stderr
    old_stdout = sys.stdout
    redirected_output = sys.stdout = io.StringIO()
    redirected_error = sys.stderr = io.StringIO()
    stdout, stderr, exc = None, None, None
    try:
        await aexec(cmd, client, message)
    except Exception:
        exc = traceback.format_exc()
    stdout = redirected_output.getvalue()
    stderr = redirected_error.getvalue()
    sys.stdout = old_stdout
    sys.stderr = old_stderr
    evaluation = ""
    if exc:
        evaluation = exc
    elif stderr:
        evaluation = stderr
    elif stdout:
        evaluation = stdout
    else:
        evaluation = "Success!"
    final_output = EVAL.format(code=cmd, result=evaluation)
    if len(cmd) >= 1023:
        capt = "Eval Result!"
    else:
        capt = cmd
    await edit_or_send_as_file(final_output, message, client, capt,
                               "eval-result")
Esempio n. 6
0
async def ungbun_him(client, message):
    AFS = await sudo_list()
    engine = message.Engine
    ungbun = await edit_or_reply(message, engine.get_string("PROCESSING"))
    text_ = get_text(message)
    user = get_user(message, text_)[0]
    failed = 0
    if not user:
        await ungbun.edit(engine.get_string("REPLY_TO_USER").format("Un-Gban"))
        return
    try:
        userz = await client.get_users(user)
    except BaseException as e:
        await ungbun.edit(engine.get_string("USER_MISSING").format(e))
        return
    if userz.id == (client.me).id:
        await ungbun.edit(engine.get_string("TF_DO_IT").format("Un-GBan"))
        return
    if not await gban_info(userz.id):
        await ungbun.edit("`Un-Gban A Ungbanned User? Seriously? :/`")
        return
    await ungbun.edit("`Please, Wait Fectching Your Chats!`")
    chat_dict = await iter_chats(client)
    chat_len = len(chat_dict)
    if not chat_dict:
        ungbun.edit("`You Have No Chats! So Sad`")
        return
    await ungbun.edit("`Starting Un-GBans Now!`")
    for ujwal in chat_dict:
        try:
            await client.unban_chat_member(ujwal, int(userz.id))
        except:
            failed += 1
    await ungban_user(userz.id)
    ungbanned = f"**#Un_GBanned** \n**User :** [{userz.first_name}](tg://user?id={userz.id}) \n**Affected Chats :** `{chat_len-failed}`"
    await ungbun.edit(ungbanned)
    log = LogIt(message)
    await log.log_msg(client, ungbanned)
Esempio n. 7
0
async def fgs(client, message):
    pablo = await edit_or_reply(message, "`Processing.....`")
    Hell = get_text(message)
    if not Hell:
        await pablo.edit(
            "`Please Give Me A Valid Input. You Can Check Help Menu To Know More!`"
        )
        return
    Escobar = Hell.split(":")
    search = Escobar[0]
    try:
        result = Escobar[1]
    except:
        await pablo.edit(
            "`Please Give Me A Valid Input. You Can Check Help Menu To Know More!`"
        )
        return
    photo = Image.open("./bot_utils_files/image_templates/google_search_templete.jpg")
    drawing = ImageDraw.Draw(photo)
    blue = (0, 0, 255)
    black = (0, 0, 0)
    font1 = ImageFont.truetype("./bot_utils_files/Fonts/ProductSans-BoldItalic.ttf", 20)
    font2 = ImageFont.truetype("./bot_utils_files/Fonts/ProductSans-Light.ttf", 23)
    drawing.text((450, 258), result, fill=blue, font=font1)
    drawing.text((270, 37), search, fill=black, font=font2)
    file_name = "fgs.jpg"
    photo.save(file_name)
    await pablo.delete()
    if message.reply_to_message:
        await client.send_photo(
            message.chat.id,
            photo=file_name,
            reply_to_message_id=message.reply_to_message.message_id,
        )
    else:
        await client.send_photo(message.chat.id, photo=file_name)
    if os.path.exists(file_name):
        os.remove(file_name)
Esempio n. 8
0
async def ekart(client, message):
    pablo = await edit_or_reply(message, "`Processing.....`")
    input_str = get_text(message)
    if not input_str:
        await pablo.edit(
            "`Please Give Me A Valid Input. You Can Check Help Menu To Know More!`"
        )
        return
    urlo = (
        "https://track.aftership.com/trackings?courier=ekart&tracking-numbers="
        + str(input_str))

    url = "https://ekart-api-chi.vercel.app/check?id=" + str(input_str)
    r = requests.get(url)
    h = r.json()
    merchant = h.get("merchant_name")
    order_status = h.get("order_status")
    kk = h.get("updates")
    oqwz = kk[0]
    aq = oqwz.get("Date")
    ar = oqwz.get("Time")
    place = oqwz.get("Place")
    status = oqwz.get("Status")

    caption = f""" <b>Ekart Tracking </b>
Merchant Name:- {merchant}
Order Status:- {order_status}
Tracking Id:- {input_str}
Latest Update
Date:- {aq}
Time:- {ar}
Place:- {place}
Status:- {status}
Detailed link:- {urlo}
<u><b>Ekart Search Completed By Friday.
Get Your Own Friday From @FRIDAYCHAT.</b></u>
"""
    await pablo.edit(caption, parse_mode="HTML")
Esempio n. 9
0
async def adityalogo(client, message):
    event = await edit_or_reply(message, "`Processing.....`")
    text = get_text(message)
    if not text:
        await event.edit(
            "`Please Give Me A Valid Input. You Can Check Help Menu To Know More!`"
        )
        return
    img = Image.open("./bot_utils_files/image_templates/black_blank_image.jpg")
    draw = ImageDraw.Draw(img)
    font = ImageFont.truetype("./bot_utils_files/Fonts/Streamster.ttf", 220)
    image_widthz, image_heightz = img.size
    w, h = draw.textsize(text, font=font)
    h += int(h * 0.21)
    draw.text(
        ((image_widthz - w) / 2, (image_heightz - h) / 2),
        text,
        font=font,
        fill=(255, 255, 0),
    )
    file_name = "*****@*****.**"
    await client.send_chat_action(message.chat.id, "upload_photo")
    img.save(file_name, "png")
    if message.reply_to_message:
        await client.send_photo(
            message.chat.id,
            photo=file_name,
            caption="Made Using FridayUserBot",
            reply_to_message_id=message.reply_to_message.message_id,
        )
    else:
        await client.send_photo(message.chat.id,
                                photo=file_name,
                                caption="Made Using FridayUserBot")
    await client.send_chat_action(message.chat.id, "cancel")
    await event.delete()
    if os.path.exists(file_name):
        os.remove(file_name)
Esempio n. 10
0
async def fgs(client, message):
    engine = message.Engine
    pablo = await edit_or_reply(message, engine.get_string("PROCESSING"))
    Hell = get_text(message)
    if not Hell:
        await pablo.edit(engine.get_string("INPUT_REQ").format("Text"))
        return
    Escobar = Hell.split(":")
    search = Escobar[0]
    try:
        result = Escobar[1]
    except:
        await pablo.edit(engine.get_string("INPUT_REQ").format("Text"))
        return
    photo = Image.open(
        "./bot_utils_files/image_templates/google_search_templete.jpg")
    drawing = ImageDraw.Draw(photo)
    blue = (0, 0, 255)
    black = (0, 0, 0)
    font1 = ImageFont.truetype(
        "./bot_utils_files/Fonts/ProductSans-BoldItalic.ttf", 20)
    font2 = ImageFont.truetype("./bot_utils_files/Fonts/ProductSans-Light.ttf",
                               23)
    drawing.text((450, 258), result, fill=blue, font=font1)
    drawing.text((270, 37), search, fill=black, font=font2)
    file_name = "fgs.jpg"
    photo.save(file_name)
    await pablo.delete()
    if message.reply_to_message:
        await client.send_photo(
            message.chat.id,
            photo=file_name,
            reply_to_message_id=message.reply_to_message.message_id,
        )
    else:
        await client.send_photo(message.chat.id, photo=file_name)
    if os.path.exists(file_name):
        os.remove(file_name)
Esempio n. 11
0
async def momify(client, message):
    engine = message.Engine
    owo = await edit_or_reply(message, engine.get_string("PROCESSING"))
    img = await convert_to_image(message, client)
    hmm = get_text(message)
    if not hmm:
        await owo.edit(engine.get_string("INPUT_REQ").format("Text"))
        returbn
    if not img:
        await owo.edit(
            engine.get_string("NEEDS_REPLY").format("a valid media first"))
        return
    if not os.path.exists(img):
        await owo.edit(engine.get_string("INVALID_MEDIA"))
        return
    if ";" in hmm:
        stark = hmm.split(";", 1)
        first_txt = stark[0]
        second_txt = stark[1]
        top_text = first_txt
        bottom_text = second_txt
        generate_meme(img, top_text=top_text, bottom_text=bottom_text)
    else:
        top_text = hmm
        bottom_text = ""
        generate_meme(img, top_text=top_text, bottom_text=bottom_text)
    imgpath = "memeimg.webp"
    if message.reply_to_message:
        await client.send_sticker(
            message.chat.id,
            sticker=imgpath,
            reply_to_message_id=message.reply_to_message.message_id,
        )
    else:
        await client.send_sticker(message.chat.id, sticker=imgpath)
    if os.path.exists(imgpath):
        os.remove(imgpath)
    await owo.delete()
Esempio n. 12
0
async def getfakecertificate(client, message):
    pablo = await edit_or_reply(message, "`Processing.....`")
    text = get_text(message)
    if not text:
        await pablo.edit("Please Give Name For Certificate")
        return
    famous_people = [
        "Modi", "Trump", "Albert", "Gandhi", "Chsaiujwal", "Aditya"
    ]
    img = Image.open(
        "./bot_utils_files/image_templates/certificate_templete.png")
    d1 = ImageDraw.Draw(img)
    myFont = ImageFont.truetype("./bot_utils_files/Fonts/impact.ttf", 200)
    myFont2 = ImageFont.truetype("./bot_utils_files/Fonts/impact.ttf", 70)
    myFont3 = ImageFont.truetype("./bot_utils_files/Fonts/Streamster.ttf", 50)
    d1.text((1433, 1345), text, font=myFont, fill=(51, 51, 51))
    TZ = pytz.timezone(Config.TZ)
    datetime_tz = datetime.now(TZ)
    oof = datetime_tz.strftime(f"%Y/%m/%d")
    d1.text((961, 2185), oof, font=myFont2, fill=(51, 51, 51))
    d1.text((2441, 2113),
            random.choice(famous_people),
            font=myFont3,
            fill=(51, 51, 51))
    file_name = "certificate.png"
    ok = file_name
    img.save(ok, "PNG")
    if message.reply_to_message:
        await client.send_photo(
            message.chat.id,
            photo=ok,
            reply_to_message_id=message.reply_to_message.message_id,
        )
    else:
        await client.send_photo(message.chat.id, photo=ok)
    await pablo.delete()
    if os.path.exists(ok):
        os.remove(ok)
Esempio n. 13
0
async def pasty(client, message):
    pablo = await edit_or_reply(message, "`Pasting to Pasty.....`")
    tex_t = get_text(message)
    message_s = tex_t
    if not tex_t:
        if not message.reply_to_message:
            await pablo.edit("`Reply To File / Give Me Text To Paste!`")
            return
        if not message.reply_to_message.text:
            file = await message.reply_to_message.download()
            m_list = open(file, "r").read()
            message_s = m_list
            os.remove(file)
        else:
            message_s = message.reply_to_message.text

    ext = "py"
    x = await p_paste(message_s, ext)
    p_link = x["url"]
    p_raw = x["raw"]

    pasted = f"**Pasted to Pasty**\n**Link:** [Pasty]({p_link})\n**Raw Link:** [Raw]({p_raw})"
    await pablo.edit(pasted, disable_web_page_preview=True)
Esempio n. 14
0
async def wow_nice(client, message):
    engine = message.Engine
    msg_ = await edit_or_reply(message, engine.get_string("PROCESSING"))
    random_s = random.randint(0, 63)
    te_t = get_text(message)
    if not te_t:
        msg_.edit(engine.get_string("INPUT_REQ").format("Text"))
        return
    text = f"#{random_s} {te_t}"
    nice = await client.get_inline_bot_results(bot="stickerizerbot", query=text)
    if message.reply_to_message:
        await client.send_inline_bot_result(
            message.chat.id,
            nice.query_id,
            nice.results[0].id,
            reply_to_message_id=message.reply_to_message.message_id,
            hide_via=True,
        )
    else:
        await client.send_inline_bot_result(
            message.chat.id, nice.query_id, nice.results[0].id, hide_via=True
        )
    await msg_.delete()
Esempio n. 15
0
async def set_afk(client, message):
    engine = message.Engine
    pablo = await edit_or_reply(message, engine.get_string("PROCESSING"))
    msge = None
    msge = get_text(message)
    start_1 = datetime.now()
    afk_start = start_1.replace(microsecond=0)
    log = LogIt(message)
    if msge:
        msg = engine.get_string("AFK_1").format(msge)
        await log.log_msg(
            client,
            engine.get_string("AFK_2").format(msge)
        )
        await go_afk(afk_start, msge)
    else:
        msg = engine.get_string("AFK_3")
        await log.log_msg(
            client,
            engine.get_string("AFK_2").format("Not Specified.")
        )
        await go_afk(afk_start)
    await pablo.edit(msg)
Esempio n. 16
0
async def paste(client, message):
    pablo = await edit_or_reply(message, "`Please Wait.....`")
    tex_t = get_text(message)
    message_s = tex_t
    if not tex_t:
        if not message.reply_to_message:
            await pablo.edit("`Reply To File / Give Me Text To Paste!`")
            return
        if not message.reply_to_message.text:
            file = await message.reply_to_message.download()
            m_list = open(file, "r").read()
            message_s = m_list
            os.remove(file)
        elif message.reply_to_message.text:
            message_s = message.reply_to_message.text
    key = (requests.post("https://nekobin.com/api/documents",
                         json={
                             "content": message_s
                         }).json().get("result").get("key"))
    url = f"https://nekobin.com/{key}"
    raw = f"https://nekobin.com/raw/{key}"
    reply_text = f"Pasted Text To [NekoBin]({url}) And For Raw [Click Here]({raw})"
    await pablo.edit(reply_text)
Esempio n. 17
0
async def wow_nice(client, message):
    msg_ = await edit_or_reply(message, "`Please Wait!`")
    random_s = random.randint(0, 63)
    te_t = get_text(message)
    if not te_t:
        msg_.edit("`Give Input Boss!`")
        return
    text = f"#{random_s} {te_t}"
    nice = await client.get_inline_bot_results(bot="stickerizerbot",
                                               query=text)
    if message.reply_to_message:
        await client.send_inline_bot_result(
            message.chat.id,
            nice.query_id,
            nice.results[0].id,
            reply_to_message_id=message.reply_to_message.message_id,
            hide_via=True)
    else:
        await client.send_inline_bot_result(message.chat.id,
                                            nice.query_id,
                                            nice.results[0].id,
                                            hide_via=True)
    await msg_.delete()
Esempio n. 18
0
async def rename(client, message):
    pablo = await edit_or_reply(message, "`Processing..`")
    fname = get_text(message)
    if not fname:
        await pablo.edit("Please Give New Name For File With Extension")
        return
    if not message.reply_to_message:
        await pablo.edit("Please Reply To A File To Rename")
        return
    await pablo.edit("⚡️`Rename and upload in progress, please wait!`⚡️")
    file_name = None
    try:
        file_name = message.reply_to_message.document.file_name
    except:
        pass
    if file_name:
        Kk = fname.split(".")
        try:
            Kk[1]
        except:
            f**k = file_name.rpartition(".")[-1]
            fname = f"{fname}.{f**k}"
    EsCoBaR = await message.reply_to_message.download(fname)
    caption = ""
    if message.reply_to_message.caption:
        caption = message.reply_to_message.caption
    c_time = time.time()
    await client.send_document(
        message.chat.id,
        EsCoBaR,
        caption=caption,
        progress=progress,
        progress_args=(pablo, c_time, f"`Uploading {fname}`", EsCoBaR),
    )
    await pablo.edit(
        "File Renamed and Uploaded. By White Devil X. Get your White Devil X from @WhiteDevilot"
    )
Esempio n. 19
0
async def fetch_webshoot(client, message):
    msg_ = await edit_or_reply(
        message,
        "<code>Please Wait Until I Capture This Clear Shot!</code>",
        parse_mode="html")
    url_ = get_text(message)
    if not url_:
        await msg_.edit("<code>Give Me Url To Fetch A Screen Shot.</code>",
                        parse_mode="html")
        return
    if not await check_if_url_is_valid(url_):
        return await msg_.edit("<code>This is An Invalid Url.</code>",
                               parse_mode="html")
    screen_shot_image = await screen_shot_(url_)
    img_ = await download_img(screen_shot_image)
    img_size = humanbytes(os.stat(img_).st_size)
    if not img_:
        return await msg_.edit(
            "<code>Something Isn't Right. Did You Give Me Valid Url?</code>",
            parse_mode="html")
    capt_ = f"<b><u>WebShot Captured</b></u> \n<b>URL :</b> <code>{url_}</code> \n<b>SIZE :</b> <code>{img_size}</code>"
    if message.reply_to_message:
        await client.send_document(
            message.chat.id,
            img_,
            caption=capt_,
            parse_mode="html",
            reply_to_message_id=message.reply_to_message.message_id,
        )
    else:
        await client.send_document(message.chat.id,
                                   img_,
                                   parse_mode="html",
                                   caption=capt_)
    if os.path.exists(img_):
        os.remove(img_)
    await msg_.delete()
Esempio n. 20
0
async def chnnlpdf(client, message):
    engine = message.Engine
    pablo = await edit_or_reply(message, engine.get_string("FILE_TOOLS_1"))
    rndm = uuid.uuid4().hex
    un = get_text(message)
    dirz = f"./{rndm}/"
    photo_count = 0
    os.makedirs(dirz)
    if un:
        chnnl = un
    else:
        chnnl = message.chat.id
    images_path = []
    async for msg in client.iter_history(chnnl):
        if msg.photo:
            rndmname = uuid.uuid4().hex
            file_name = os.path.join(dirz + rndmname + ".jpg")
            photo_count += 1
            try:
                file_path = await msg.download(file_name=file_name)
                images_path.append(file_path)
            except Exception as e:
                logging.info(f"Failed To Download - {e}")
    if not images_path:
        await pablo.edit(
            engine.get_string("IMAGE_NOT_FOUND").format("This Chat"))
        shutil.rmtree(dirz)
        return
    with open("*****@*****.**", "wb") as f:
        f.write(img2pdf.convert(images_path))
    capt = f"**CONVERTED** \n**Total Images :** `{len(images_path)}` \n**Channel / Group :** `{chnnl}`"
    await client.send_document(message.chat.id,
                               "*****@*****.**",
                               caption=capt)
    os.remove("*****@*****.**")
    shutil.rmtree(dirz)
    await pablo.delete()
Esempio n. 21
0
async def anime(client, message):
    pablo = await edit_or_reply(message, "`Searching For Anime.....`")
    anime = get_text(message)
    if not anime:
        await pablo.edit(
            "`Please Give Me A Valid Input. You Can Check Help Menu To Know More!`"
        )
        return
    lmao = anime.split(":", 1)
    try:
        site = lmao[1]
    except BaseException:
        site = "animeonline360"
        await pablo.edit(
            "Please Provide Site Name From Next Time. Now Continuing With Default Site."
        )

    lol = lmao[0]
    why = site.lower()
    Twist = get_anime_class(why)
    try:
        search = Twist.search(lol)
    except BaseException:
        await ommhg.edit("Please Try Different Site. Given Site Is Down.")

    title1 = search[0].title
    url1 = search[0].url
    title2 = search[1].title
    url2 = search[1].url
    title3 = search[2].title
    url3 = search[2].url
    title4 = search[3].title
    url4 = search[3].url
    title5 = search[4].title
    url5 = search[4].url
    NopZ = f"<b><u>Anime Search Complete</b></u> \n\n\n<b>Title</b>:-  <code>{title1}</code> \n<b>URL Link</b>:- {url1}\n\n<b>Title</b>:-  <code>{title2}</code> \n<b>URL Link</b>:- {url2}\n\n<b>Title</b>:-  <code>{title3}</code>\n<b>URL Link</b>:- {url3}\n\n<b>Title</b>:-  <code>{title4}</code> \n<b>URL Link</b>:- {url4}\n\n<b>Title</b>:-  <code>{title5}</code> \n<b>URL Link</b>:- {url5}\n\n<b>Links Gathered By cpbot\nGet Your Own cpbot From @cpbotCHAT</b>"
    await pablo.edit(NopZ, parse_mode="html")
Esempio n. 22
0
async def adityalogo(client, message):
    engine = message.Engine
    event = await edit_or_reply(message, engine.get_string("PROCESSING"))
    text = get_text(message)
    if not text:
        await event.edit(engine.get_string("INPUT_REQ").format("Text"))
        return
    img = Image.open("./bot_utils_files/image_templates/black_blank_image.jpg")
    draw = ImageDraw.Draw(img)
    font = ImageFont.truetype("./bot_utils_files/Fonts/Streamster.ttf", 220)
    image_widthz, image_heightz = img.size
    w, h = draw.textsize(text, font=font)
    h += int(h * 0.21)
    draw.text(
        ((image_widthz - w) / 2, (image_heightz - h) / 2),
        text,
        font=font,
        fill=(255, 255, 0),
    )
    file_name = "*****@*****.**"
    await client.send_chat_action(message.chat.id, "upload_photo")
    img.save(file_name, "png")
    if message.reply_to_message:
        await client.send_photo(
            message.chat.id,
            photo=file_name,
            caption="Made Using FridayUserBot",
            reply_to_message_id=message.reply_to_message.message_id,
        )
    else:
        await client.send_photo(
            message.chat.id, photo=file_name, caption="Made Using FridayUserBot"
        )
    await client.send_chat_action(message.chat.id, "cancel")
    await event.delete()
    if os.path.exists(file_name):
        os.remove(file_name)
Esempio n. 23
0
async def chnnlpdf(client, message):
    pablo = await edit_or_reply(message, "`Fetching All Images From This Channel!`")
    rndm = uuid.uuid4().hex
    un = get_text(message)
    dirz = f"./{rndm}/"
    photo_count = 0
    text_count = 0
    os.makedirs(dirz)
    if un:
        chnnl = un
    else:
        chnnl = message.chat.id
    async for msg in client.search_messages(chnnl, filter="photo"):
        rndmname = uuid.uuid4().hex
        file_name = os.path.join(dirz + rndmname + ".jpg")
        photo_count += 1
        try:
            await msg.download(file_name=file_name)
        except Exception as e:
            logging.info(e)
    text_count + photo_count
    images_path = []
    images_names = os.listdir(dirz)
    for i in images_names:
        path = os.path.join(dirz, i)
        images_path.append(path)
    if not images_path:
        await pablo.edit("`No Images Found!`")
        shutil.rmtree(dirz)
        return
    with open("*****@*****.**", "wb") as f:
        f.write(img2pdf.convert(images_path))
    capt = f"**CONVERTED** \n**Total Images :** `{len(images_path)}` \n**Channel / Group :** `{chnnl}`"
    await client.send_document(message.chat.id, "*****@*****.**", caption=capt)
    os.remove("*****@*****.**")
    shutil.rmtree(dirz)
    await pablo.delete()
Esempio n. 24
0
async def rename(client, message):
    engine = message.Engine
    pablo = await edit_or_reply(message, engine.get_string("PROCESSING"))
    fname = get_text(message)
    if not fname:
        await pablo.edit(engine.get_string("INPUT_REQ").format("File Name"))
        return
    if not message.reply_to_message:
        await pablo.edit(engine.get_string("NEEDS_REPLY").format("Media"))
        return
    await pablo.edit(engine.get_string("R_P"))
    file_name = None
    try:
        file_name = message.reply_to_message.document.file_name
    except:
        pass
    if file_name:
        Kk = fname.split(".")
        try:
            Kk[1]
        except:
            f**k = file_name.rpartition(".")[-1]
            fname = f"{fname}.{f**k}"
    EsCoBaR = await message.reply_to_message.download(fname)
    caption = ""
    if message.reply_to_message.caption:
        caption = message.reply_to_message.caption
    c_time = time.time()
    await client.send_document(
        message.chat.id,
        EsCoBaR,
        caption=caption,
        progress=progress,
        progress_args=(pablo, c_time, f"`Uploading {fname}`", EsCoBaR),
    )
    await pablo.delete()
Esempio n. 25
0
async def momify(client, message):
    owo = await edit_or_reply(message, "`Making Memes! Look There, OwO`")
    img = await convert_to_image(message, client)
    hmm = get_text(message)
    if not hmm:
        await owo.edit("`Give Text :/`")
        returbn
    if not img:
        await owo.edit("`Reply to a valid media first.`")
        return
    if not os.path.exists(img):
        await owo.edit("`Invalid Media!`")
        return
    if ";" in hmm:
        stark = hmm.split(";", 1)
        first_txt = stark[0]
        second_txt = stark[1]
        top_text = first_txt
        bottom_text = second_txt
        generate_meme(img, top_text=top_text, bottom_text=bottom_text)
    else:
        top_text = hmm
        bottom_text = ""
        generate_meme(img, top_text=top_text, bottom_text=bottom_text)
    imgpath = "memeimg.webp"
    if message.reply_to_message:
        await client.send_sticker(
            message.chat.id,
            sticker=imgpath,
            reply_to_message_id=message.reply_to_message.message_id,
        )
    else:
        await client.send_sticker(message.chat.id, sticker=imgpath)
    if os.path.exists(imgpath):
        os.remove(imgpath)
    await owo.delete()
Esempio n. 26
0
async def brm(client, message):
    pablo = await edit_or_reply(message, "`Processing..`")
    bd = get_text(message)
    Jill = 0
    if not bd:
        await pablo.edit("`Check Help Menu On How To Use This Command!`")
        return
    if bd.lower() == "all":
        await pablo.edit("`Removing All Channel From DB.`")
        all = await get_all_broadcast_chats()
        for chnnl in all:
            await rmbroadcast_chat(chnnl["chat_id"])
            Jill += 1
        await pablo.edit(f"Successfully Removed {Jill} Groups/Channels from dB")
    else:
        chnl_id = await get_final_id(bd, client)
        if not chnl_id:
            await pablo.edit("`Invalid Channel Id/Username`")
            return
        if not await is_broadcast_chat_in_db(chnl_id):
            await pablo.edit("`This Channel is Not In dB!`")
            return
        await add_broadcast_chat(chnl_id)
        await pablo.edit(f"`Successfully Added {bd} in dB!`")
Esempio n. 27
0
async def ungbun_him(client, message):
    ungbun = await edit_or_reply(message, "`Processing..`")
    text_ = get_text(message)
    user = get_user(message, text_)[0]
    failed = 0
    if not user:
        await ungbun.edit("`Reply To User Or Mention To Un-GBan Him`")
        return
    try:
        userz = await client.get_users(user)
    except:
        await ungbun.edit(f"`404 : User Doesn't Exists!`")
        return
    if userz.id == (client.me).id:
        await ungbun.edit("`Oh, This is So Funny Btw :/`")
        return
    if not await gban_info(userz.id):
        await ungbun.edit("`Un-Gban A Ungbanned User? Seriously? :/`")
        return
    await ungbun.edit("`Please, Wait Fectching Your Chats!`")
    chat_dict = await iter_chats(client)
    chat_len = len(chat_dict)
    if not chat_dict:
        ungbun.edit("`You Have No Chats! So Sad`")
        return
    await ungbun.edit("`Starting Un-GBans Now!`")
    for ujwal in chat_dict:
        try:
            await client.unban_chat_member(ujwal, int(userz.id))
        except:
            failed += 1
    await ungban_user(userz.id)
    ungbanned = f"**#Un_GBanned** \n**User :** [{userz.first_name}](tg://user?id={userz.id}) \n**Affected Chats :** `{chat_len-failed}`"
    await ungbun.edit(ungbanned)
    log = LogIt(message)
    await log.log_msg(client, ungbanned)
Esempio n. 28
0
async def badd(client, message):
    engine = message.Engine
    pablo = await edit_or_reply(message, engine.get_string("PROCESSING"))
    bd = get_text(message)
    if not bd:
        await pablo.edit(engine.get_string("INPUT_REQ").format("Chat ID"))
        return
    if bd.lower() == "all":
        await pablo.edit(engine.get_string("BROADCAST_2"))
        sed = 0
        oks = 0
        zxz = ["channel", "supergroup"]
        nd = ["creator", "administrator"]
        async for dialog in client.iter_dialogs():
            if dialog.chat.type in zxz:
                x = await client.get_chat_member(dialog.chat.id,
                                                 message.from_user.id)
                if x.status in nd:
                    if not await is_broadcast_chat_in_db(dialog.chat.id):
                        await add_broadcast_chat(dialog.chat.id)
                        oks += 1
                    else:
                        sed += 1
        await pablo.edit(
            engine.get_string("BROADCAST_1").format(oks, oks + sed))
    else:
        chnl_id = await get_final_id(bd, client)
        if not chnl_id:
            await pablo.edit(engine.get_string('CHAT_NOT_IN_DB'))
            return
        chnl_id = int(chnl_id)
        if await is_broadcast_chat_in_db(chnl_id):
            await pablo.edit(engine.get_string("INVALID_CHAT_ID"))
            return
        await add_broadcast_chat(chnl_id)
        await pablo.edit(engine.get_string("BROADCAST_3").format(bd))
Esempio n. 29
0
async def pur_ge_me(client, message):
    nice_p = await edit_or_reply(message, "`Processing...`")
    msg_ids = []
    to_purge = get_text(message)
    if not to_purge:
        nice_p.edit("`Give No Of Message To Purge :/`")
        return
    if not to_purge.isdigit():
        nice_p.edit("`Give No Of Message To Purge :/`")
        return
    async for msg in client.search_messages(
        message.chat.id, query="", limit=int(to_purge), from_user="******"
    ):
        msg_ids.append(msg.message_id)
        if len(msg_ids) >= 100:
            await client.delete_messages(
                chat_id=message.chat.id, message_ids=msg_ids, revoke=True
            )
            msg_ids.clear()
    if msg_ids:
        await client.delete_messages(
            chat_id=message.chat.id, message_ids=msg_ids, revoke=True
        )
    await client.send_message(message.chat.id, f"`Purged {to_purge} Messages!`")
Esempio n. 30
0
async def add_mail_to_db(client, message):
    pablo = await edit_or_reply(message, "`Processing.....`")
    mail_id = get_text(message)
    if not mail_id:
        await pablo.edit(
            "`Please Give Me A Valid Input. You Can Check Help Menu To Know More!`"
        )
        return
    lmao = mail_id.split("@", 1)
    try:
        domain = lmao[1]
    except BaseException:
        await pablo.edit(
            "`What are you providing me lmao?. Check Help Menu Idiot!`")
        return
    if domain.lower() in supported_domains:
        pass
    else:
        await pablo.edit(
            "`Oops, I don't Support that Domain! Check Help Menu To Get Supported Site List!`"
        )
        return
    await add_mail_update_mail(mail_id)
    await pablo.edit(f"`Your Mail ID {mail_id} successfully added to dB`")