async def add_user_s_to_contact(client, message): msg_ = await edit_or_reply(message, "`Please Wait!`") text_ = get_text(message) userk = get_user(message, text_)[0] try: user_ = await client.get_users(userk) except: await msg_.edit(f"`404 : Unable To Get To This User!`") return custom_name = get_text(message) or user_.first_name await client.add_contact(user_.id, custom_name) await msg_.edit(f"`Added {user_.first_name} To Contacts!`")
async def whois(client, message): user_photo = None msg_ = await edit_or_reply(message, "`Hang On!`") text_ = get_text(message) userk = get_user(message, text_)[0] if not userk: await msg_.edit("`Mention A User Boss!`") return try: user_ = await client.get_users(userk) except: await msg_.edit(f"`404 : Unable To Get To This User!`") return if user_.photo: user_photo = await client.download_media(user_.photo.big_file_id) user_info = f"<b><u>User Info Of</b></u> {user_.mention} \n\n" user_info += f"✱ <b>User ID :</b> <code>{user_.id}</code> \n" user_info += f"✱ <b>FirstName :</b> <code>{user_.first_name}</code> \n" user_info += f"✱ <b>LastName :</b> <code>{user_.last_name}</code> \n" if user_.last_name else f"✱ <b>LastName :</b> <code>Not Set</code> \n" user_info += f"✱ <b>DC :</b> <code>{user_.dc_id}</code> \n" if user_.dc_id else f"✱ <b>DC :</b> <code>No PFP</code> \n" user_info += f"✱ <b>Status :</b> <code>{user_.status}</code> \n" if user_.status else f"✱ <b>Status :</b> <code>Bot Can't Have Last Seen</code> \n" user_info += f"✱ <b>Username :</b> <code>{user_.username}</code> \n" if user_.username else f"✱ <b>Username :</b> <code>User Doesn't Have A UserName</code> \n" user_info += f"✱ <b>Is Scam :</b> <code>{user_.is_scam}</code> \n" user_info += f"✱ <b>Is Bot :</b> <code>{user_.is_bot}</code> \n" user_info += f"✱ <b>Is Verified :</b> <code>{user_.is_verified}</code> \n" user_info += f"✱ <b>Is Contact :</b> <code>{user_.is_contact}</code> \n" common = await client.get_common_chats(user_.id) user_info += f"✱ <b>Total Groups In Common :</b> <code>{len(common)}</code> \n" if user_.id in devs_id: user_info += f"\n <code>Wow! This User is One Of My Developer</code> \n" if gban_info(user_.id): user_info += f"\n This User Is Gbanned For Reason : <code>{gban_info(user_.id)}</code> \n" if is_gmuted(user_.id): user_info += f"\n This User Is Gmutted! \n" if user_photo: await msg_.delete() if message.reply_to_message: await client.send_photo( message.chat.id, user_photo, caption=user_info, reply_to_message_id=message.reply_to_message.message_id) else: await client.send_photo(message.chat.id, user_photo, caption=user_info, parse_mode="html") os.remove(user_photo) else: await msg_.edit(user_info)
async def add_user_s_to_contact(client, message): engine = message.Engine msg_ = await edit_or_reply(message, engine.get_string("PROCESSING")) text_ = get_text(message) userk = get_user(message, text_)[0] try: user_ = await client.get_users(userk) except BaseException as e: await msg_.edit(engine.get_string("USER_MISSING").format(e)) return custom_name = get_text(message) or user_.first_name await client.add_contact(user_.id, custom_name) await msg_.edit( engine.get_string("ADDED_CONTACT").format(user_.first_name))
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 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 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 rm_s_sudo(client, message): engine = message.Engine msg_ = await edit_or_reply(message, engine.get_string("PROCESSING")) text_ = get_text(message) user = get_user(message, text_)[0] if not user: await msg_.edit(engine.get_string("REPLY_TO_USER").format("Un-Sudo")) return try: user = await client.get_users(user) except BaseException as e: await msg_.edit(engine.get_string("USER_MISSING").format(e)) return if not await is_user_sudo(user.id): return await msg_.edit(engine.get_string("USER_ALREADY_NOT_IN_SUDODB").format(user.mention)) await rm_sudo(int(user.id)) await msg_.edit(engine.get_string("RM_FROM_SUDO").format(user.mention))
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 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 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 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)
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)
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 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)