From 3021b03296add7f95f30b394bd500cf2efcf2d8e Mon Sep 17 00:00:00 2001 From: thedragonsinn <98635854+thedragonsinn@users.noreply.github.com> Date: Wed, 18 Sep 2024 14:12:42 +0530 Subject: [PATCH] revert [kick]: until_date below 30s is useless hence revert back to manually unbanning after 2s. --- app/plugins/admin/ban.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/app/plugins/admin/ban.py b/app/plugins/admin/ban.py index 55e9719..5178600 100644 --- a/app/plugins/admin/ban.py +++ b/app/plugins/admin/ban.py @@ -1,4 +1,4 @@ -from datetime import datetime, timedelta +import asyncio from pyrogram.types import User @@ -31,11 +31,9 @@ async def kick_user(bot: BOT, message: Message): return try: - await bot.ban_chat_member( - chat_id=message.chat.id, - user_id=user.id, - until_date=datetime.utcnow() + timedelta(seconds=8), - ) + await bot.ban_chat_member(chat_id=message.chat.id, user_id=user.id) + await asyncio.sleep(2) + await bot.unban_chat_member(chat_id=message.chat.id, user_id=user.id) await message.reply( text=f"{message.cmd.capitalize()}ed: {user.mention}\nReason: {reason}" )