async def echo(event): if event.fwd_from: return if event.sender_id == OWNER_ID: pass elif sudo(event.sender_id): pass elif is_admin(event, event.sender_id): pass else: return if event.reply_to_msg_id: previous_message = await event.get_reply_message() try: await event.delete() except Exception: pass k = await tbot.send_message(event.chat_id, previous_message) else: ok = event.pattern_match.group(1) try: await event.delete() except Exception: pass await tbot.send_message(event.chat_id, ok)
async def ban(bon): if not bon.is_group: return if bon.is_group: if not bon.sender_id == OWNER_ID: if not await is_register_admin(bon.input_chat, bon.sender_id): await bon.reply("Only admins can execute this command!") return if not await can_ban_users(message=bon): await bon.reply( "You are missing the following rights to use this command:CanRestrictMembers" ) return user = await get_user_from_event(bon) try: prev = await bon.get_reply_message() await prev.delete() except Exception: pass if user.id == BOT_ID: await bon.reply("You know what I'm not going to do? Ban myself.") return elif sudo(user.id): await bon.reply("I'm not banning one of my sudo users.") return if user: pass else: return if bon.is_group: if await is_register_admin(bon.input_chat, user.id): await bon.reply( "Why would I ban an admin? That sounds like a pretty dumb idea." ) return pass else: return try: await tbot(EditBannedRequest(bon.chat_id, user.id, BANNED_RIGHTS)) await bon.reply( f"Another one bites the dust...!Banned [User](tg://user?id={user.id})." ) except Exception: await bon.reply("I haven't got the rights to do this.") return
async def approve(event): if event.sender_id == OWNER_ID: pass elif event.sender_id in DEV_USERS: pass else: return sender = event.sender_id bl = blacklist.find({}) reply_msg = await event.get_reply_message() iid = reply_msg.sender_id if iid == OWNER_ID: return elif iid in DEV_USERS: return elif iid in SUDO_USERS: return elif sudo(iid): return if event.sender_id == BOT_ID or int(iid) == int(BOT_ID): await event.reply("I am not gonna blacklist myself") return a = blacklist.find({}) for i in a: if iid == i["user"]: await event.reply("This User is Already Blacklisted") return blacklist.insert_one({"user": iid}) await event.reply("Successfully Blacklisted This Retard") loda = "" try: for i in a: k = i["user"] loda += f"{k}\n" except Exception as ok: await e.reply(ok) await event.reply(loda)