async def list_gengbanned(event): users = list_gbanned() x = await eor(event, get_string("com_1")) msg = "" if not users: return await x.edit("`You haven't GBanned anyone!`") for i in users: try: name = (await ultroid_bot.get_entity(int(i))).first_name except BaseException: name = i msg += f"<strong>User</strong>: <a href=tg://user?id={i}>{name}</a>\n" reason = users[i] msg += f"<strong>Reason</strong>: {reason}\n\n" if reason is not None else "\n" gbanned_users = f"<strong>List of users GBanned by {OWNER_NAME}</strong>:\n\n{msg}" if len(gbanned_users) > 4096: with open("gbanned.txt", "w") as f: f.write( gbanned_users.replace("<strong>", "").replace("</strong>", "").replace( "<a href=tg://user?id=", "").replace("</a>", "")) await x.reply( file="gbanned.txt", message= f"List of users GBanned by [{OWNER_NAME}](tg://user?id={OWNER_ID})", ) os.remove("gbanned.txt") await x.delete() else: await x.edit(gbanned_users, parse_mode="html")
async def gstat_(e): xx = await eor(e, get_string("com_1")) if e.is_private: userid = (await e.get_chat()).id elif e.reply_to_msg_id: userid = (await e.get_reply_message()).sender_id elif e.pattern_match.group(1): try: userid = await get_user_id(e.pattern_match.group(1)) except Exception as err: return await eor(xx, f"{err}", time=10) else: return await eor(xx, "`Reply to some msg or add their id.`", time=5) name = (await e.client.get_entity(userid)).first_name msg = "**" + name + " is " is_banned = is_gbanned(userid) reason = list_gbanned().get(userid) if is_banned: msg += "Globally Banned" msg += f" with reason** `{reason}`" if reason else ".**" else: msg += "not Globally Banned.**" await xx.edit(msg)