Example #1
0
async def ujwal_mote(client, message):
    pablo = await edit_or_reply(message, "`Trying To Promote User!`")
    me_m = client.me
    me_ = await message.chat.get_member(int(me_m.id))
    if not me_.can_promote_members:
        await pablo.edit("`Boss, You Don't Have Promote Permission!`")
        return
    asplit = get_text(message)
    userl, Res = get_user(message, asplit)
    if not userl:
        await pablo.edit(
            "`Bruh, Please Reply To User / Give Me Username of ID To Promote!`"
        )
        return
    try:
        user = await client.get_users(userl)
    except:
        await pablo.edit(f"`404 : User Doesn't Exists In This Chat !`")
        return
    userz = user.id
    if not Res:
        Res = "Admeme"
    if userz == me_m.id:
        await pablo.edit("`🙄 Nice Idea, Lets Self Promote!`")
        return
    try:
        await client.promote_chat_member(
            message.chat.id,
            user.id,
            can_change_info=me_.can_change_info,
            can_delete_messages=me_.can_delete_messages,
            can_restrict_members=me_.can_restrict_members,
            can_invite_users=me_.can_invite_users,
            can_pin_messages=me_.can_pin_messages,
            can_promote_members=me_.can_promote_members,
        )
    except BaseException as e:
        await pablo.edit(
            f"`I Am Un-Able To Promote This User` \n**Error :** `{e}`")
        return
    p = f"**#Promote** \n**User :** [{user.first_name}](tg://user?id={user.id}) \n**Chat :** `{message.chat.title}` \n**Title :** `{Res}`"
    await pablo.edit(p)
    log = LogIt(message)
    await log.log_msg(client, p)
    try:
        if Res:
            await client.set_administrator_title(message.chat.id, user.id, Res)
    except:
        pass
Example #2
0
async def ujwal_mote(client, message):
    engine = message.Engine
    pablo = 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_promote_members:
        await pablo.edit(engine.get_string("NOT_ADMIN"))
        return
    asplit = get_text(message)
    userl, Res = get_user(message, asplit)
    if not userl:
        await pablo.edit(
            engine.get_string("TO_DO").format("Promote")
        )
        return
    try:
        user = await client.get_users(userl)
    except BaseException as e:
        await pablo.edit(engine.get_string("USER_MISSING").format(e))
        return
    userz = user.id
    if not Res:
        Res = "Admeme"
    if userz == me_m.id:
        await pablo.edit(engine.get_string("TF_DO_IT").format("Promote"))
        return
    try:
        await client.promote_chat_member(
            message.chat.id,
            user.id,
            can_change_info=me_.can_change_info,
            can_delete_messages=me_.can_delete_messages,
            can_restrict_members=me_.can_restrict_members,
            can_invite_users=me_.can_invite_users,
            can_pin_messages=me_.can_pin_messages,
            can_promote_members=me_.can_promote_members,
        )
    except BaseException as e:
        await pablo.edit(engine.get_string("FAILED_ADMIN_ACTION").format("Promote", e))
        return
    p = f"**#Promote** \n**User :** {user.mention} \n**Chat :** `{message.chat.title}` \n**Title :** `{Res}`"
    await pablo.edit(p)
    log = LogIt(message)
    await log.log_msg(client, p)
    try:
        if Res:
            await client.set_administrator_title(message.chat.id, user.id, Res)
    except:
        pass
Example #3
0
async def no_afk_detect_handler(client, message):
    engine = message.Engine
    afk_status = await check_afk()
    back_alivee = datetime.now()
    afk_start = afk_status["time"]
    afk_end = back_alivee.replace(microsecond=0)
    total_afk_time = str((afk_end - afk_start))
    status_msg = await message.reply(engine.get_string("AFK_4").format(total_afk_time))
    await status_msg.delete()
    await no_afk()
    log = LogIt(message)
    await log.log_msg(
        client,
        engine.get_string("AFK_5").format(total_afk_time)
    )
Example #4
0
async def no_afke(client, message):
    engine = message.Engine
    lol = await check_afk()
    back_alivee = datetime.now()
    afk_start = lol["time"]
    afk_end = back_alivee.replace(microsecond=0)
    total_afk_time = str((afk_end - afk_start))
    kk = await message.reply(engine.get_string("AFK_4").format(total_afk_time))
    await kk.delete()
    await no_afk()
    log = LogIt(message)
    await log.log_msg(
        client,
        engine.get_string("AFK_5").format(total_afk_time)
    )
Example #5
0
async def no_afke(client, message):
    lol = await check_afk()
    back_alivee = datetime.now()
    afk_start = lol["time"]
    afk_end = back_alivee.replace(microsecond=0)
    total_afk_time = str((afk_end - afk_start))
    kk = await message.reply(
        f"""__Pro is Back Alive__\n**No Longer afk.**\n `I Was afk for:``{total_afk_time}`""",
    )
    await kk.delete()
    await no_afk()
    log = LogIt(message)
    await log.log_msg(
        client,
        f"#AfkLogger User is Back Alive ! No Longer Afk\n AFK for : {total_afk_time} ",
    )
Example #6
0
async def set_afk(client, message):
    pablo = await edit_or_reply(message, "`Processing..`")
    msge = None
    msge = get_text(message)
    start_1 = datetime.now()
    afk_start = start_1.replace(microsecond=0)
    log = LogIt(message)
    if msge:
        msg = f"**My Master Seems To Be Too Busy 👀.** \n__He Going Afk Because Of__ `{msge}`"
        await log.log_msg(client, f"#AfkLogger Afk Is Active And Reason is {msge}",)
        go_afk(afk_start, msge)
    else:
        msg = f"**I Am Busy And I Am Going Afk**."
        await log.log_msg(client, f"#AfkLogger Afk Is Active",)
        go_afk(afk_start) 
    await pablo.edit(msg)
Example #7
0
async def gbun_him(client, message):
    AFS = await sudo_list()
    engine = message.Engine
    gbun = await edit_or_reply(message, engine.get_string("PROCESSING"))
    text_ = get_text(message)
    user, reason = get_user(message, text_)
    failed = 0
    if not user:
        await gbun.edit(engine.get_string("REPLY_TO_USER").format("gban"))
        return
    try:
        userz = await client.get_users(user)
    except BaseException as e:
        await gbun.edit(engine.get_string("USER_MISSING").format(e))
        return
    if not reason:
        reason = "Private Reason!"
    if userz.id == (client.me).id:
        await gbun.edit(engine.get_string("TF_DO_IT").format("GBan"))
        return
    if userz.id in devs_id:
        await g.edit("`Sadly, I Can't Do That!`")
        return
    if userz.id in AFS:
        await gbun.edit(
            "`Sudo Users Can't Be Gbanned! Remove Him And Try Again!`")
        return
    if await gban_info(userz.id):
        await gbun.edit("`Re-Gban? Seriously? :/`")
        return
    await gbun.edit("`Please, Wait Fectching Your Chats!`")
    chat_dict = await iter_chats(client)
    chat_len = len(chat_dict)
    if not chat_dict:
        gbun.edit("`You Have No Chats! So Sad`")
        return
    await gbun.edit(engine.get_string("GBAN_START"))
    for ujwal in chat_dict:
        try:
            await client.kick_chat_member(ujwal, int(userz.id))
        except:
            failed += 1
    await gban_user(userz.id, reason)
    gbanned = f"**#GBanned** \n**User :** [{userz.first_name}](tg://user?id={userz.id}) \n**Reason :** `{reason}` \n**Affected Chats :** `{chat_len-failed}`"
    await gbun.edit(gbanned)
    log = LogIt(message)
    await log.log_msg(client, gbanned)
Example #8
0
async def gbun_him(client, message):
    gbun = await edit_or_reply(message, "`Processing..`")
    text_ = get_text(message)
    user, reason = get_user(message, text_)
    failed = 0
    if not user:
        await gbun.edit("`Reply To User Or Mention To GBan Him`")
        return
    try:
        userz = await client.get_users(user)
    except:
        await gbun.edit(f"`404 : User Doesn't Exists In This Chat !`")
        return
    if not reason:
        reason = "Private Reason!"
    if userz.id == (client.me).id:
        await gbun.edit("`Oh, This is So Funny Btw :/`")
        return
    if userz.id in devs_id:
        await g.edit("`Sadly, I Can't Do That!`")
        return
    if userz.id in Config.AFS:
        await gbun.edit(
            "`Sudo Users Can't Be Gbanned! Remove Him And Try Again!`")
        return
    if await gban_info(userz.id):
        await gbun.edit("`Re-Gban? Seriously? :/`")
        return
    await gbun.edit("`Please, Wait Fectching Your Chats!`")
    chat_dict = await iter_chats(client)
    chat_len = len(chat_dict)
    if not chat_dict:
        gbun.edit("`You Have No Chats! So Sad`")
        return
    await gbun.edit("`Starting GBans Now!`")
    for ujwal in chat_dict:
        try:
            await client.kick_chat_member(ujwal, int(userz.id))
        except:
            failed += 1
    await gban_user(userz.id, reason)
    gbanned = f"**#GBanned** \n**User :** [{userz.first_name}](tg://user?id={userz.id}) \n**Reason :** `{reason}` \n**Affected Chats :** `{chat_len-failed}`"
    await gbun.edit(gbanned)
    log = LogIt(message)
    await log.log_msg(client, gbanned)
Example #9
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)
Example #10
0
async def activeblack(client, message):
    if not get_chat_blacklist(message.chat.id):
        message.continue_propagation()
    owo = message.text
    if owo is None:
        message.continue_propagation()
    owoo = owo.lower()
    tges = owoo.split(" ")
    for owo in tges:
        if is_blacklist_in_db(message.chat.id, owo):
            try:
                await message.delete()
            except Exception as e:
                logging.error(f"[Blacklist] {e}")
                log = LogIt(message)
                await log.log_msg(
                    client,
                    f"**Blacklist Warning**\n\nI am Not Admin In **{message.chat.title}**, So I cannot Delete That Group's Blacklist messages",
                )
Example #11
0
async def ujwal_demote(client, message):
    engine = message.Engine
    pablo = await edit_or_reply(message, engine.get_string("PROCESSING"))
    me_m = client.me
    await message.chat.get_member(int(me_m.id))
    asplit = get_text(message)
    usero = get_user(message, asplit)[0]
    if not usero:
        await pablo.edit(
            engine.get_string("TO_DO").format("Demote")
        )
        return
    try:
        user = await client.get_users(usero)
    except BaseException as e:
        await pablo.edit(engine.get_string("USER_MISSING").format(e))
        return
    userz = user.id
    if userz == me_m.id:
        await pablo.edit(engine.get_string("TF_DO_IT").format("Demote"))
        return
    try:
        await client.promote_chat_member(
            message.chat.id,
            user.id,
            is_anonymous=None,
            can_change_info=None,
            can_post_messages=None,
            can_edit_messages=None,
            can_delete_messages=None,
            can_restrict_members=None,
            can_invite_users=None,
            can_pin_messages=None,
            can_promote_members=None,
        )
    except BaseException as e:
        await pablo.edit(engine.get_string("FAILED_ADMIN_ACTION").format("Demote", e))
        return
    d = f"**#Demote** \n**User :** {user.mention}\n**Chat :** `{message.chat.title}`"
    await pablo.edit(d)
    log = LogIt(message)
    await log.log_msg(client, d)
Example #12
0
async def activeblack(client, message):
    engine = message.Engine
    if not await get_chat_blacklist(int(message.chat.id)):
        return
    owo = message.text
    if owo is message.text:
        return
    owoo = owo.lower()
    tges = owoo.split(" ")
    for owo in tges:
        if await is_blacklist_in_db(int(message.chat.id), owo):
            try:
                await message.delete()
            except Exception as e:
                logging.error(f"[Blacklist] - {e}")
                log = LogIt(message)
                await log.log_msg(
                    client,
                    engine.get_strings("BLACKLIST_7").format(
                        message.chat.title, e))
Example #13
0
async def ujwal_demote(client, message):
    pablo = await edit_or_reply(message, "`Trying To Demote User!`")
    me_m = client.me
    await message.chat.get_member(int(me_m.id))
    asplit = get_text(message)
    usero = get_user(message, asplit)[0]
    if not usero:
        await pablo.edit(
            "`Bruh, Please Reply To User / Give Me Username of ID To Demote!`")
        return
    try:
        user = await client.get_users(usero)
    except:
        await pablo.edit(f"`404 : User Doesn't Exists In This Chat !`")
        return
    userz = user.id
    if userz == me_m.id:
        await pablo.edit("`🙄 Nice Idea, Lets Self Demote!`")
        return
    try:
        await client.promote_chat_member(
            message.chat.id,
            user.id,
            is_anonymous=False,
            can_change_info=False,
            can_post_messages=False,
            can_edit_messages=False,
            can_delete_messages=False,
            can_restrict_members=False,
            can_invite_users=False,
            can_pin_messages=False,
            can_promote_members=False,
        )
    except BaseException as e:
        await pablo.edit(
            f"`I Wasn't Able To Demote That User` \n**Error :** `{e}`")
        return
    d = f"**#Demote** \n**User :** [{user.first_name}](tg://user?id={user.id}) \n**Chat :** `{message.chat.title}`"
    await pablo.edit(d)
    log = LogIt(message)
    await log.log_msg(client, d)
Example #14
0
async def nsfw_watch(client, message):
    lol = await get_all_nsfw_chats()
    if len(lol) == 0:
        message.continue_propagation()
        return
    if not await is_chat_in_db(int(message.chat.id)):
        message.continue_propagation()
        return
    hot = await is_nsfw(client, message, False)
    if not hot:
        message.continue_propagation()
        return
    else:
        try:
            await message.delete()
            await client.restrict_chat_member(
                int(message.chat.id),
                message.from_user.id,
                ChatPermissions(can_send_messages=False),
            )
        except:
            pass
        lolchat = await client.get_chat(int(message.chat.id))
        ctitle = lolchat.title
        if lolchat.username:
            hehe = lolchat.username
        else:
            hehe = int(message.chat.id)
        midhun = await client.get_users(message.from_user.id)
        await message.delete()
        if midhun.username:
            Escobar = midhun.username
        else:
            Escobar = midhun.id
        log = LogIt(message)
        await log.log_msg(
            client,
            f"**#NSFW_WATCH** \n**Chat :** `{hehe}` \n**Nsfw Sender - User / Bot :** `{Escobar}` \n**Chat Title:** `{ctitle}`",
        )
        message.continue_propagation()
Example #15
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)
Example #16
0
async def set_afk(client, message):
    pablo = await edit_or_reply(message, "`Processing..`")
    msge = None
    msge = get_text(message)
    start_1 = datetime.now()
    afk_start = start_1.replace(microsecond=0)
    log = LogIt(message)
    if msge:
        msg = f"**Senpaiku Sepertinya Terlalu Sibuk 👀.** \n**__Senpai Telah Afk** \n**Alesan Afk__** `{msge}`"
        await log.log_msg(
            client,
            f"#AfkLogger Afk Is Active And Reason is {msge}",
        )
        await go_afk(afk_start, msge)
    else:
        msg = f"**I Am Busy And I Am Going Afk**."
        await log.log_msg(
            client,
            f"#AfkLogger Afk Is Active",
        )
        await go_afk(afk_start)
    await pablo.edit(msg)
Example #17
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)
Example #18
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)
Example #19
0
async def gmute_him(client, message):
    AFS = await sudo_list()
    engine = message.Engine
    g = await edit_or_reply(message, engine.get_string("PROCESSING"))
    text_ = get_text(message)
    user, reason = get_user(message, text_)
    if not user:
        await g.edit(engine.get_string("REPLY_TO_USER").format("gmute"))
        return
    try:
        userz = await client.get_users(user)
    except:
        await g.edit(
            engine.get_string("USER_MISSING").format(
                "User Doesn't Exists In This Chat !"))
        return
    if not reason:
        reason = "Just_Gmutted!"
    if userz.id == (client.me).id:
        await g.edit(engine.get_string("TF_DO_IT").format("Gmute"))
        return
    if userz.id in devs_id:
        await g.edit("`Sadly, I Can't Do That!`")
        return
    if userz.id in AFS:
        await g.edit("`Sudo Users Can't Be Gmutted! Remove Him And Try Again!`"
                     )
        return
    if await is_gmuted(userz.id):
        await g.edit("`Re-Gmute? Seriously? :/`")
        return
    await gmute(userz.id, reason)
    gmu = f"**#Gmutted** \n**User :** `{userz.id}` \n**Reason :** `{reason}`"
    await g.edit(gmu)
    log = LogIt(message)
    await log.log_msg(client, gmu)
Example #20
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)
Example #21
0
async def pmPermit(client, message):
    if not message.from_user:
        message.continue_propagation()
        return
    if await is_user_approved(int(message.chat.id)):
        message.continue_propagation()
        return
    if message.from_user.id in devs_id:
        await approve_user(int(message.chat.id))
        message.continue_propagation()
        return
    user_ = await client.get_users(int(message.chat.id))
    if user_.is_contact:
        message.continue_propagation()
        return
    if user_.is_bot:
        message.continue_propagation()
        return
    if user_.is_verified:
        message.continue_propagation()
        return
    if user_.id == (await client.get_me()).id:
        message.continue_propagation()
        return
    if user_.is_scam:
        await message.reply_text("`Scammer Aren't Welcome To My Masters PM!`")
        await client.block_user(user_.id)
        message.continue_propagation()
        return
    if user_.is_support:
        message.continue_propagation()
        return
    text = await get_pm_text()
    log = LogIt(message)
    capt = await get_thumb()
    pm_s_ = await get_pm_spam_limit()
    if int(message.chat.id) not in PM_WARNS:
        PM_WARNS[int(message.chat.id)] = 0
    elif PM_WARNS[int(message.chat.id)] >= int(pm_s_):
        await message.reply_text(
            f"`Thats It! I Gave You {int(pm_s_)} Warning. Now F**k Off. Blocked And Reported!`"
        )
        await client.block_user(user_.id)
        if int(message.chat.id) in OLD_MSG:
            OLD_MSG.pop(int(message.chat.id))
        if int(message.chat.id) in PM_WARNS:
            PM_WARNS.pop(int(message.chat.id))
        blockeda = f"**#Blocked_PMPERMIT** \n**User :** `{user_.id}` \n**Reason :** `Spam Limit Reached.`"
        await log.log_msg(client, blockeda)
        message.continue_propagation()
        return
    warnings_got = f"{int(PM_WARNS[int(message.chat.id)]) + 1}/{int(pm_s_)}"
    user_firstname = message.from_user.first_name
    me_f = client.me.first_name
    holy = await message.reply_photo(
        capt,
        caption=text.format(user_firstname=user_firstname,
                            warns=warnings_got,
                            boss_firstname=me_f),
    )
    PM_WARNS[int(message.chat.id)] += 1
    if int(message.chat.id) in OLD_MSG:
        await OLD_MSG[int(message.chat.id)].delete()
    OLD_MSG[int(message.chat.id)] = holy
    message.continue_propagation()
Example #22
0
async def pmPermit(client, message):
    if not Config.PM_PSW:
        return
    if not message.from_user:
        return
    if await is_user_approved(int(message.chat.id)):
        return
    if message.from_user.id in devs_id:
        await approve_user(int(message.chat.id))
        return
    user_ = message.from_user
    if user_.is_bot:
        return
    if user_.is_self:
        return
    if user_.is_verified:
        return
    if user_.is_scam:
        await message.reply_text("`Scammer Aren't Welcome To My Masters PM!`")
        await client.block_user(user_.id)
        return
    if user_.is_support:
        return
    text = await get_pm_text()
    log = LogIt(message)
    capt = await get_thumb()
    pm_s_ = await get_pm_spam_limit()
    if int(message.chat.id) not in PM_WARNS:
        PM_WARNS[int(message.chat.id)] = 0
    else:
        PM_WARNS[int(message.chat.id)] += 1
    if PM_WARNS[int(message.chat.id)] >= int(pm_s_):
        await message.reply_text(
            f"`Thats It! I Gave You {int(pm_s_)} Warning. Now F**k Off. Blocked And Reported!`"
        )
        await client.block_user(user_.id)
        if int(message.chat.id) in OLD_MSG:
            OLD_MSG.pop(int(message.chat.id))
        if int(message.chat.id) in PM_WARNS:
            PM_WARNS.pop(int(message.chat.id))
        blockeda = f"**#Blocked_PMPERMIT** \n**User :** `{user_.id}` \n**Reason :** `Spam Limit Reached.`"
        await log.log_msg(client, blockeda)
        return
    warnings_got = f"{int(PM_WARNS[int(message.chat.id)]) + 1}/{int(pm_s_)}"
    user_firstname = message.from_user.first_name
    user_mention = message.from_user.mention
    me_f = client.me.first_name
    de_pic = "logo.jpg"
    if capt:
        holy = await client.copy_message(
            from_chat_id=int(Config.LOG_GRP),
            message_id=int(capt),
            chat_id=int(message.chat.id),
            caption=text.format(user_firstname=user_firstname,
                                warns=warnings_got,
                                boss_firstname=me_f,
                                mention=user_mention),
            reply_to_message_id=message.message_id)
    else:
        holy = await message.reply_photo(
            de_pic,
            caption=text.format(user_firstname=user_firstname,
                                warns=warnings_got,
                                boss_firstname=me_f,
                                mention=user_mention),
        )
    if int(message.chat.id) in OLD_MSG:
        try:
            await OLD_MSG[int(message.chat.id)].delete()
        except:
            pass
    OLD_MSG[int(message.chat.id)] = holy