| 141 | |
| 142 | @StreamBot.on_message(filters.command('ban') & filters.user(Var.OWNER_ID)) |
| 143 | async def do_ban(bot , message): |
| 144 | userid = message.text.split(" ", 2)[1] if len(message.text.split(" ", 1)) > 1 else None |
| 145 | reason = message.text.split(" ", 2)[2] if len(message.text.split(" ", 2)) > 2 else None |
| 146 | if not userid: |
| 147 | return await message.reply('<b>ᴘʟᴇᴀsᴇ ᴀᴅᴅ ᴀ ᴠᴀʟɪᴅ ᴜsᴇʀ/ᴄʜᴀɴɴᴇʟ ɪᴅ ᴡɪᴛʜ ᴛʜɪs ᴄᴏᴍᴍᴀɴᴅ\n\nᴇx : /ban (user/channel_id) (banning reason[Optional]) \nʀᴇᴀʟ ᴇx : <code>/ban 1234567899</code>\nᴡɪᴛʜ ʀᴇᴀsᴏɴ ᴇx:<code>/ban 1234567899 seding adult links to bot</code>\nᴛᴏ ʙᴀɴ ᴀ ᴄʜᴀɴɴᴇʟ :\n<code>/ban CHANEL_ID</code>\nᴇx : <code>/ban -1001234567899</code></b>') |
| 148 | text = await message.reply("<b>ʟᴇᴛ ᴍᴇ ᴄʜᴇᴄᴋ 👀</b>") |
| 149 | banSts = await db.ban_user(userid) |
| 150 | if banSts == True: |
| 151 | await text.edit( |
| 152 | text=f"<b><code>{userid}</code> ʜᴀs ʙᴇᴇɴ ʙᴀɴɴᴇᴅ sᴜᴄᴄᴇssғᴜʟʟʏ\n\nSʜᴏᴜʟᴅ I sᴇɴᴅ ᴀɴ ᴀʟᴇʀᴛ ᴛᴏ ᴛʜᴇ ʙᴀɴɴᴇᴅ ᴜsᴇʀ?</b>", |
| 153 | reply_markup=InlineKeyboardMarkup( |
| 154 | [ |
| 155 | [ |
| 156 | InlineKeyboardButton("ʏᴇs ✅", callback_data=f"sendAlert_{userid}_{reason if reason else 'no reason provided'}"), |
| 157 | InlineKeyboardButton("ɴᴏ ❌", callback_data=f"noAlert_{userid}"), |
| 158 | ], |
| 159 | ] |
| 160 | ), |
| 161 | ) |
| 162 | else: |
| 163 | await text.edit(f"<b>Cᴏɴᴛʀᴏʟʟ ʏᴏᴜʀ ᴀɴɢᴇʀ ʙʀᴏ...\n<code>{userid}</code> ɪs ᴀʟʀᴇᴀᴅʏ ʙᴀɴɴᴇᴅ !!</b>") |
| 164 | return |
| 165 | |
| 166 | |
| 167 | @StreamBot.on_message(filters.command('unban') & filters.user(Var.OWNER_ID)) |