async def catgban(cat): await cat.edit("`Ungbaning this Nibba...`") start = datetime.now() user, reason = await get_user_from_event(cat) if not user: return if gban_sql.is_gbanned(user.id): gban_sql.catungban(user.id) else: await cat.edit( f"The [user](tg://user?id={user.id}) is not in your gbanned list" ) return san = [] san = await admin_groups(cat) count = 0 sandy = len(san) if sandy == 0: await cat.edit("you are not admin of atleast one group ") return await cat.edit( f"`Initiating Ungban of the` [user](tg://user?id={user.id}) `in {len(san)} groups`" ) for i in range(sandy): try: await cat.client(EditBannedRequest(san[i], user.id, UNBAN_RIGHTS)) await asyncio.sleep(0.5) count += 1 except BadRequestError: await borg.send_message( BOTLOG_CHATID, f"You don't have required permission in :\nCHAT: {cat.chat.title}(`{cat.chat_id}`)\nFor unbaning here", ) end = datetime.now() cattaken = (end - start).seconds if reason: await cat.edit( f"[{user.first_name}](tg://user?id={user.id}) was ungbanned in `{count}` groups in `{cattaken} seconds`!!\nReason: `{reason}`" ) else: await cat.edit( f"[{user.first_name}](tg://user?id={user.id}) was ungbanned in `{count}` groups in `{cattaken} seconds`!!" ) if BOTLOG and count != 0: await borg.send_message( BOTLOG_CHATID, f"#UNGBAN\nGlobal UNBAN\nUser: [{user.first_name}](tg://user?id={user.id})\nID: {user.id}\ \nReason: `{reason}`\nUnbanned in `{count}` groups\nTime taken = `{cattaken} seconds`", )
async def catgban(cat): await cat.edit("`Gbaning this gey...`") start = datetime.now() user, reason = await get_user_from_event(cat) if user: pass else: return if user.id == (await cat.client.get_me()).id: await cat.edit("`Why would i ban myself.. KEK`") return if user.id in PEPE_ID: await cat.edit("`Why would I ban my DEVELOPER.. LMAO`") return if gban_sql.is_gbanned(user.id): await cat.edit(f"The [user](tg://user?id={user.id}) is already in Gbanned list any way checking again") else: gban_sql.catgban(user.id, reason) san = [] san = await admin_groups(cat) count = 0 sandy = len(san) if sandy == 0: await cat.edit("`You are not admin of atleast one group.. USELESS`") return await cat.edit(f"`Initiating Gban of the` [User](tg://user?id={user.id}) `in {len(san)} groups`") for i in range(0, sandy): try: await cat.client(EditBannedRequest(san[i], user.id, BANNED_RIGHTS)) await asyncio.sleep(0.5) count += 1 except BadRequestError: await borg.send_message(BOTLOG_CHATID, f"You don't have required permission in :\nCHAT: {cat.chat.title}(`{cat.chat_id}`)\nFor baning here") try: reply = await cat.get_reply_message() if reply: await reply.delete() except BadRequestError: await cat.edit("`I dont have message deleting rights here! But still he was gbanned!`") end = datetime.now() cattaken = (end - start).seconds if reason: await cat.edit(f"[{user.first_name}](tg://user?id={user.id}) was gbanned in `{count}` groups in `{cattaken} seconds`!!\nReason: `{reason}`") else: await cat.edit(f"[{user.first_name}](tg://user?id={user.id}) was gbanned in `{count}` groups in `{cattaken} seconds`!!") if BOTLOG: if count != 0: await borg.send_message(BOTLOG_CHATID, f"#GBAN\nGlobal BAN\nUser: [{user.first_name}](tg://user?id={user.id})\nID: `{user.id}`\ \nReason: `{reason}`\nBanned in `{count}` groups\nTime taken = `{cattaken} seconds`")