async def gmute_him(client, message): engine = message.Engine ug = await edit_or_reply(message, engine.get_string("PROCESSING")) text_ = get_text(message) user_ = get_user(message, text_)[0] if not user_: await ug.edit(engine.get_string("REPLY_TO_USER").format("UN-gmute")) return try: userz = await client.get_users(user_) except BaseException as e: await ug.edit(engine.get_string("USER_MISSING").format(e)) return if userz.id == (client.me).id: await ug.edit(engine.get_string("TF_DO_IT").format("UN-gmute")) return if userz.id in Config.AFS: await ug.edit( "`Sudo Users Can't Be Un-Gmutted! Remove Him And Try Again!`") return if not await is_gmuted(userz.id): await ug.edit("`Un-Gmute A Non Gmutted User? Seriously? :/`") return await ungmute(userz.id) ugmu = f"**#Un-Gmutted** \n**User :** `{userz.id}`" await ug.edit(ugmu) log = LogIt(message) await log.log_msg(client, ugmu)
async def ujwal_unmute(client, message): pablo = await edit_or_reply(message, "`Trying To Un-Mute User!`") me_m = client.me me_ = await message.chat.get_member(int(me_m.id)) if not me_.can_restrict_members: await pablo.edit("`Boss, You Don't Have Un-Mute Permission!`") return asplit = get_text(message) userf = get_user(message, asplit)[0] if not userf: await pablo.edit( "`Bruh, Please Reply To User / Give Me Username of ID To Unmute!`") return try: user = await client.get_users(userf) 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 Un-Mute!`") return try: await client.restrict_chat_member( message.chat.id, user.id, ChatPermissions(can_send_messages=True)) except BaseException as e: await pablo.edit( f"`I Am UnAble To UN-Mute That User` \n**Error :** `{e}`") return um = f"**#Un_Muted** \n**User :** [{user.first_name}](tg://user?id={user.id}) \n**Chat :** `{message.chat.title}`" await pablo.edit(um) log = LogIt(message) await log.log_msg(client, um)
async def ujwal_unmute(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_restrict_members: await pablo.edit(engine.get_string("NOT_ADMIN")) return asplit = get_text(message) userf = get_user(message, asplit)[0] if not userf: await pablo.edit( engine.get_string("TO_DO").format("Un-Mute") ) return try: user = await client.get_users(userf) 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("un-mute")) return try: await client.restrict_chat_member( message.chat.id, user.id, ChatPermissions(can_send_messages=True) ) except BaseException as e: await pablo.edit(engine.get_string("FAILED_ADMIN_ACTION").format("Un-mute", e)) return um = f"**#Un_Muted** \n**User :** [{user.first_name}](tg://user?id={user.id}) \n**Chat :** `{message.chat.title}`" await pablo.edit(um) log = LogIt(message) await log.log_msg(client, um)
async def gmute_him(client, message): ug = await edit_or_reply(message, "`Processing..`") text_ = get_text(message) user_ = get_user(message, text_)[0] if not user_: await ug.edit("`Reply To User Or Mention To Un-Gmute Him`") return try: userz = await client.get_users(user_) except: await ug.edit(f"`404 : User Doesn't Exists In This Chat !`") return if userz.id == (client.me).id: await ug.edit("`Oh, This is So Funny Btw :/`") return if userz.id in Config.AFS: await ug.edit( "`Sudo Users Can't Be Un-Gmutted! Remove Him And Try Again!`") return if not await is_gmuted(userz.id): await ug.edit("`Un-Gmute A Non Gmutted User? Seriously? :/`") return await ungmute(userz.id) ugmu = f"**#Un-Gmutted** \n**User :** `{userz.id}`" await ug.edit(ugmu) log = LogIt(message) await log.log_msg(client, ugmu)
async def gmute_him(client, message): 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 Config.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)
async def gmute_him(client, message): g = await edit_or_reply(message, "`Processing..`") text_ = get_text(message) user, reason = get_user(message, text_) if not user: await g.edit("`Reply To User Or Mention To Gmute Him`") return try: userz = await client.get_users(user) except: await g.edit(f"`404 : User Doesn't Exists In This Chat !`") return if not reason: reason = "Just_Gmutted!" if userz.id == (client.me).id: await g.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 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)
async def unban_world(client, message): unbun = await edit_or_reply(message, "`Trying To Un-Ban User!`") me_m = client.me me_ = await message.chat.get_member(int(me_m.id)) if not me_.can_restrict_members: await unbun.edit("`Boss, You Don't Have Un-Ban Permission!`") return text_ = get_text(message) userm, reason = get_user(message, text_) if not userm: await unbun.edit( "`Bruh, Please Reply To User / Give Me Username of ID To UnBan!`") return try: user_ = await client.get_users(userm) except: await unbun.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 unbun.edit("`🙄 Nice Idea, Lets Un-Ban Myself!`") return try: await client.unban_chat_member(message.chat.id, int(user_.id)) except BaseException as e: await unbun.edit(f"`I Un-Able To Un-Ban That User` \n**Error :** `{e}`" ) ub = f"**#UnBanned** \n**User :** [{user_.first_name}](tg://user?id={user_.id}) \n**Chat :** `{message.chat.title}` \n**Reason :** `{reason}`" await unbun.edit(ub) log = LogIt(message) await log.log_msg(client, ub)
async def unban_world(client, message): engine = message.Engine unbun = 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 unbun.edit(engine.get_string("NOT_ADMIN")) return text_ = get_text(message) userm, reason = get_user(message, text_) if not userm: await unbun.edit( engine.get_string("TO_DO").format("Un-Ban") ) return try: user_ = await client.get_users(userm) except BaseException as e: await unbun.edit(engine.get_string("USER_MISSING").format(e)) return userz = user_.id if not reason: reason = "Not Specified!" if userz == me_m.id: await unbun.edit(engine.get_string("TF_DO_IT").format("Un-Ban")) return try: await client.unban_chat_member(message.chat.id, int(user_.id)) except BaseException as e: await unbun.edit(engine.get_string("FAILED_ADMIN_ACTION").format("Un-Ban", e)) ub = f"**#UnBanned** \n**User :** [{user_.first_name}](tg://user?id={user_.id}) \n**Chat :** `{message.chat.title}` \n**Reason :** `{reason}`" await unbun.edit(ub) log = LogIt(message) await log.log_msg(client, ub)
async def pmPermit(client, message): if not message.from_user: message.continue_propagation() if await is_user_approved(message.chat.id): message.continue_propagation() if message.from_user.id in devs_id: await approve_user(message.chat.id) message.continue_propagation() user_ = await client.get_users(message.chat.id) if user_.is_contact: message.continue_propagation() if user_.is_bot: message.continue_propagation() if user_.is_verified: message.continue_propagation() if user_.id == (await client.get_me()).id: message.continue_propagation() 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() if user_.is_support: message.continue_propagation() text = await get_pm_text() log = LogIt(message) capt = await get_thumb() pm_s_ = await get_pm_spam_limit() if message.chat.id not in PM_WARNS: PM_WARNS[message.chat.id] = 0 elif PM_WARNS[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 message.chat.id in OLD_MSG: OLD_MSG.pop(message.chat.id) if message.chat.id in PM_WARNS: PM_WARNS.pop(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() warnings_got = f"{int(PM_WARNS[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[message.chat.id] += 1 if message.chat.id in OLD_MSG: await OLD_MSG[message.chat.id].delete() OLD_MSG[message.chat.id] = holy message.continue_propagation()
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))
async def no_afke(client, message): lol = check_afk() if not lol: message.continue_propagation() 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() 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} ") message.continue_propagation()
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
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
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) )
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)
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)
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)
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)
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", )
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)
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))
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)
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()
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)
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)
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)
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