async def fban(event): """Bans a user from connected federations.""" try: from userbot.modules.sql_helper.fban_sql import get_flist except IntegrityError: return await event.edit("**Executando em modo não-SQL!**") if event.is_reply: reply_msg = await event.get_reply_message() fban_id = reply_msg.from_id reason = event.pattern_match.group(1) user_link = f"[{fban_id}](tg://user?id={fban_id})" else: pattern = str(event.pattern_match.group(1)).split() fban_id = pattern[0] reason = " ".join(pattern[1:]) user_link = fban_id self_user = await event.client.get_me() if fban_id == self_user.id or fban_id == "@" + self_user.username: return await event.edit( "**Erro: Esta ação foi impedida pelos protocolos de autopreservação do PurpleBot.**" ) if len((fed_list := get_flist())) == 0: return await event.edit("**Você ainda não se conectou a nenhuma federação!**")
async def unfban(event): """Unbans a user from connected federations.""" try: from userbot.modules.sql_helper.fban_sql import get_flist except IntegrityError: return await event.edit("`Berjalan di mode Non-SQL!`") if event.is_reply: reply_msg = await event.get_reply_message() unfban_id = reply_msg.sender_id reason = event.pattern_match.group(1) user_link = f"[{unfban_id}](tg://user?id={unfban_id})" else: pattern = str(event.pattern_match.group(1)).split() unfban_id = pattern[0] reason = " ".join(pattern[1:]) user_link = unfban_id self_user = await event.client.get_me() if unfban_id == self_user.id or unfban_id == "@" + self_user.username: return await event.edit("`Tunggu, itu ilegal`") if len((fed_list := get_flist())) == 0: return await event.edit("`Anda belum terhubung ke federasi mana pun!`")
async def unfban(event): """Unbans a user from connected federations.""" try: from userbot.modules.sql_helper.fban_sql import get_flist except IntegrityError: return await event.edit("**Running on Non-SQL mode!**") if event.is_reply: reply_msg = await event.get_reply_message() unfban_id = reply_msg.from_id reason = event.pattern_match.group(1) user_link = f"[{unfban_id}](tg://user?id={unfban_id})" else: pattern = str(event.pattern_match.group(1)).split() unfban_id = pattern[0] reason = " ".join(pattern[1:]) user_link = unfban_id self_user = await event.client.get_me() if unfban_id == self_user.id or unfban_id == "@" + self_user.username: return await event.edit("**Wait, that's illegal**") if len((fed_list := get_flist())) == 0: return await event.edit( "**You haven't connected any federations yet!**")
async def unfban(event): """Unbans a user from connected federations.""" try: from userbot.modules.sql_helper.fban_sql import get_flist except IntegrityError: return await event.edit("**Executando em modo não-SQL!**") if event.is_reply: reply_msg = await event.get_reply_message() unfban_id = reply_msg.from_id reason = event.pattern_match.group(1) user_link = f"[{unfban_id}](tg://user?id={unfban_id})" else: pattern = str(event.pattern_match.group(1)).split() unfban_id = pattern[0] reason = " ".join(pattern[1:]) user_link = unfban_id self_user = await event.client.get_me() if unfban_id == self_user.id or unfban_id == "@" + self_user.username: return await event.edit("**Espere, isso é ilegal**") if len((fed_list := get_flist())) == 0: return await event.edit("**Você ainda não se conectou a nenhuma federação!!**")
async def fban(event): """Bans a user from connected federations.""" try: from userbot.modules.sql_helper.fban_sql import get_flist except IntegrityError: return await event.edit("**Executando em modo não SQL!**") if event.is_reply: reply_msg = await event.get_reply_message() fban_id = reply_msg.sender_id reason = event.pattern_match.group(1) else: pattern = str(event.pattern_match.group(1)).split() fban_id = pattern[0] reason = " ".join(pattern[1:]) try: fban_id = await event.client.get_peer_id(fban_id) except: pass if event.sender_id == fban_id: return await event.edit( "**Erro: Esta ação foi impedida pelos protocolos de autopreservação.**" ) if len(fed_list := get_flist()) == 0: return await event.edit( "**Você ainda não se conectou a nenhuma federação!**")
async def fban(event): """Bans a user from connected federations.""" try: from userbot.modules.sql_helper.fban_sql import get_flist except IntegrityError: return await event.edit("`Berjalan di mode Non-SQL!`") if event.is_reply: reply_msg = await event.get_reply_message() fban_id = reply_msg.sender_id reason = event.pattern_match.group(1) user_link = f"[{fban_id}](tg://user?id={fban_id})" else: pattern = str(event.pattern_match.group(1)).split() fban_id = pattern[0] reason = " ".join(pattern[1:]) user_link = fban_id self_user = await event.client.get_me() if fban_id == self_user.id or fban_id == "@" + self_user.username: return await event.edit( "**Kesalahan** : `Tindakan ini telah dicegah oleh protokol pelestarian dari KensurBot.`" ) if len((fed_list := get_flist())) == 0: return await event.edit("`Anda belum terhubung ke federasi mana pun!`")
async def fban(event): """Bans a user from connected federations.""" try: from userbot.modules.sql_helper.fban_sql import get_flist except IntegrityError: return await event.edit("`Running on Non-SQL mode!`") if event.is_reply: reply_msg = await event.get_reply_message() fban_id = reply_msg.sender_id reason = event.pattern_match.group(1) else: pattern = str(event.pattern_match.group(1)).split() fban_id = pattern[0] reason = " ".join(pattern[1:]) try: fban_id = await event.client.get_peer_id(fban_id) except BaseException: pass if event.sender_id == fban_id: return await event.edit( "`Error: Tindakan ini telah dicegah oleh protokol keamanan diri Man-UserBot.`" ) if len((fed_list := get_flist())) == 0: return await event.edit("`Anda belum terhubung ke federasi mana pun!`")
async def unfban(event): """Unfban""" try: from userbot.modules.sql_helper.fban_sql import get_flist except IntegrityError: return await event.edit("**Sql modda işləyir!**") if event.is_reply: reply_msg = await event.get_reply_message() unfban_id = reply_msg.sender_id reason = event.pattern_match.group(1) else: pattern = str(event.pattern_match.group(1)).split() unfban_id = pattern[0] reason = " ".join(pattern[1:]) try: unfban_id = await event.client.get_peer_id(unfban_id) except: pass if event.sender_id == unfban_id: return await event.edit("**Gözləyin, bu qanunsuzdur**") if len(fed_list := get_flist()) == 0: return await event.edit("**Siz heçbir federasiyanın admini deilsiz!**")
async def fban(event): """Bans a user from connected federations.""" try: from userbot.modules.sql_helper.fban_sql import get_flist except IntegrityError: return await event.edit("**Running on Non-SQL mode!**") if event.is_reply: reply_msg = await event.get_reply_message() fban_id = reply_msg.sender_id reason = event.pattern_match.group(1) else: pattern = str(event.pattern_match.group(1)).split() fban_id = pattern[0] reason = " ".join(pattern[1:]) try: fban_id = await event.client.get_peer_id(fban_id) except BaseException: pass if event.sender_id == fban_id: return await event.edit( "**Error: This action has been prevented by KensurBot self preservation protocols.**" ) if len((fed_list := get_flist())) == 0: return await event.edit("**You haven't connected to any federations yet!**")
async def unfban(event): """Unbans a user from connected federations.""" try: from userbot.modules.sql_helper.fban_sql import get_flist except IntegrityError: return await event.edit("**Running on Non-SQL mode!**") if event.is_reply: reply_msg = await event.get_reply_message() unfban_id = reply_msg.sender_id reason = event.pattern_match.group(1) else: pattern = str(event.pattern_match.group(1)).split() unfban_id = pattern[0] reason = " ".join(pattern[1:]) try: unfban_id = await event.client.get_peer_id(unfban_id) except BaseException: pass if event.sender_id == unfban_id: return await event.edit("**Wait, that's illegal**") if len((fed_list := get_flist())) == 0: return await event.edit("**You haven't connected to any federations yet!**")
async def fban(event): """Bans a user from connected federations.""" try: from userbot.modules.sql_helper.fban_sql import get_flist except IntegrityError: return await event.edit("**Running on Non-SQL mode!**") if event.is_reply: reply_msg = await event.get_reply_message() fban_id = reply_msg.from_id reason = event.pattern_match.group(1) user_link = f"[{fban_id}](tg://user?id={fban_id})" else: pattern = str(event.pattern_match.group(1)).split() fban_id = pattern[0] reason = " ".join(pattern[1:]) user_link = fban_id self_user = await event.client.get_me() if fban_id == self_user.id or fban_id == "@" + self_user.username: return await event.edit( "**Error: This action has been prevented by One4uBot self preservation protocols.**" ) if len((fed_list := get_flist())) == 0: return await event.edit( "**You haven't connected to any federations yet!**")
async def unfban(event): """Unbans a user from connected federations.""" try: from userbot.modules.sql_helper.fban_sql import get_flist except IntegrityError: return await event.edit("`Running on Non-SQL mode!`") if event.is_reply: reply_msg = await event.get_reply_message() unfban_id = reply_msg.sender_id reason = event.pattern_match.group(1) else: pattern = str(event.pattern_match.group(1)).split() unfban_id = pattern[0] reason = " ".join(pattern[1:]) try: unfban_id = await event.client.get_peer_id(unfban_id) except BaseException: pass if event.sender_id == unfban_id: return await event.edit("`Tunggu itu ilegal`") if len((fed_list := get_flist())) == 0: return await event.edit("`Anda belum terhubung ke federasi mana pun!`")
async def unfban(event): """Unbans a user from connected federations.""" try: from userbot.modules.sql_helper.fban_sql import get_flist except IntegrityError: return await event.edit("**Executando em modo não SQL!**") if event.is_reply: reply_msg = await event.get_reply_message() unfban_id = reply_msg.sender_id reason = event.pattern_match.group(1) else: pattern = str(event.pattern_match.group(1)).split() unfban_id = pattern[0] reason = " ".join(pattern[1:]) try: unfban_id = await event.client.get_peer_id(unfban_id) except: pass if event.sender_id == unfban_id: return await event.edit("**Espere, isso é ilegal**") if len(fed_list := get_flist()) == 0: return await event.edit( "**Você ainda não se conectou a nenhuma federação!**")
async def listf(event): """List all connected federations.""" try: from userbot.modules.sql_helper.fban_sql import get_flist except IntegrityError: return await event.edit("`Running on Non-SQL mode!`") if len((fed_list := get_flist())) == 0: return await event.edit("`Anda belum terhubung ke federasi mana pun!`")
async def listf(event): """List all connected federations.""" try: from userbot.modules.sql_helper.fban_sql import get_flist except IntegrityError: return await event.edit("**Running on Non-SQL mode!**") if len((fed_list := get_flist())) == 0: return await event.edit("**You haven't connected to any federations yet!**")
async def listf(event): """List all connected federations.""" try: from userbot.modules.sql_helper.fban_sql import get_flist except IntegrityError: return await event.edit("**Executando em modo não-SQL!**") if len((fed_list := get_flist())) == 0: return await event.edit("**Você ainda não se conectou a nenhuma federação!**")
async def listf(event): """List fed""" try: from userbot.modules.sql_helper.fban_sql import get_flist except IntegrityError: return await event.edit("**Sql modda işləyir!**") if len(fed_list := get_flist()) == 0: return await event.edit("**Hələ heç bir federasiyaya qoşulmamısınız!**" )
async def listf(event): """List all connected federations.""" try: from userbot.modules.sql_helper.fban_sql import get_flist except IntegrityError: return await event.edit("**Running on Non-SQL mode!**") fed_list = get_flist() if len(fed_list) == 0: return await event.edit( "**Anda belum terhubung ke federasi mana pun!**") msg = "**Connected federations:**\n\n" for i in fed_list: msg += f"• {i.fed_name}\n" await event.edit(msg)
fban_id = pattern[0] reason = ''.join(pattern[1:]) self_user = await event.client.get_me() if fban_id == self_user.id or fban_id == "@" + self_user.username: return await event.edit( "**Error: This action has been prevented by ProjectIFS self preservation protocols.**" ) if isinstance(fban_id, int): user_link = f"[{fban_id}](tg://user?id={fban_id})" else: user_link = fban_id if len((fed_list := get_flist())) == 0: return await event.edit( "**You haven't connected to any federations yet!**") await event.edit(f"**Fbanning** {user_link}...") failed = [] total = int(0) for i in fed_list: total += 1 chat = int(i.chat_id) try: async with bot.conversation(chat) as conv: await conv.send_message( f"/fban [{fban_id}](tg://user?id={fban_id}) {reason}")
async def fban(event): """Bans a user from connected federations.""" try: from userbot.modules.sql_helper.fban_sql import get_flist except IntegrityError: return await event.edit("**Running on Non-SQL mode!**") match = event.pattern_match.group(2) if event.is_reply: reply_msg = await event.get_reply_message() fban_id = reply_msg.sender_id if event.pattern_match.group(1) == "d": await reply_msg.delete() reason = match else: pattern = match.split() fban_id = pattern[0] reason = " ".join(pattern[1:]) try: fban_id = await event.client.get_peer_id(fban_id) except Exception: pass if event.sender_id == fban_id: return await event.edit( "**Error: Tindakan ini telah dicegah oleh protokol keamanan diri Man-UserBot.**" ) fed_list = get_flist() if len(fed_list) == 0: return await event.edit( "**Anda belum terhubung ke federasi mana pun!**") user_link = f"[{fban_id}](tg://user?id={fban_id})" await event.edit(f"**Fbanning** {user_link}...") failed = [] total = 0 for i in fed_list: total += 1 chat = int(i.chat_id) try: async with bot.conversation(chat) as conv: await conv.send_message(f"/fban {user_link} {reason}") reply = await conv.get_response() await bot.send_read_acknowledge(conv.chat_id, message=reply, clear_mentions=True) if not any(i in reply.text for i in fban_replies): failed.append(i.fed_name) except Exception: failed.append(i.fed_name) reason = reason if reason else "Not specified." if failed: status = f"Failed to fban in {len(failed)}/{total} feds.\n" for i in failed: status += f"• {i}\n" else: status = f"Success! Fbanned in {total} feds." await event.edit( f"**Fbanned **{user_link}!\n**Reason:** {reason}\n**Status:** {status}" )
async def unfban(event): """Unbans a user from connected federations.""" try: from userbot.modules.sql_helper.fban_sql import get_flist except IntegrityError: return await event.edit("**Running on Non-SQL mode!**") match = event.pattern_match.group(1) if event.is_reply: unfban_id = (await event.get_reply_message()).sender_id reason = match else: pattern = match.split() unfban_id = pattern[0] reason = " ".join(pattern[1:]) try: unfban_id = await event.client.get_peer_id(unfban_id) except BaseException: pass if event.sender_id == unfban_id: return await event.edit("**Tunggu, itu illegal**") fed_list = get_flist() if len(fed_list) == 0: return await event.edit( "**Anda belum terhubung ke federasi mana pun!**") user_link = f"[{unfban_id}](tg://user?id={unfban_id})" await event.edit(f"**Un-fbanning **{user_link}**...**") failed = [] total = 0 for i in fed_list: total += 1 chat = int(i.chat_id) try: async with bot.conversation(chat) as conv: await conv.send_message(f"/unfban {user_link} {reason}") reply = await conv.get_response() await bot.send_read_acknowledge(conv.chat_id, message=reply, clear_mentions=True) if not any(i in reply.text for i in unfban_replies): failed.append(i.fed_name) except Exception: failed.append(i.fed_name) reason = reason if reason else "Not specified." if failed: status = f"Failed to un-fban in {len(failed)}/{total} feds.\n" for i in failed: status += f"• {i}\n" else: status = f"Success! Un-fbanned in {total} feds." reason = reason if reason else "Not specified." await event.edit( f"**Un-fbanned** {user_link}!\n**Reason:** {reason}\n**Status:** {status}" )