txlyre há 2 meses atrás
pai
commit
7d70bfdbec
1 ficheiros alterados com 10 adições e 3 exclusões
  1. 10 3
      main.py

+ 10 - 3
main.py

@@ -49,10 +49,13 @@ USE_LOLS_API = os.getenv("USE_LOLS_API", "yes") == "yes"
 bot = TelegramClient("captcha_bot", API_ID, API_HASH).start(bot_token=BOT_TOKEN)
 pending = {}
 
+
 async def lols_check(user_id):
     try:
         async with aiohttp.ClientSession() as session:
-            async with session.get(f"https://api.lols.bot/account?id={user_id}") as response:
+            async with session.get(
+                f"https://api.lols.bot/account?id={user_id}"
+            ) as response:
                 data = await response.json()
 
                 banned = data.get("banned", False)
@@ -64,6 +67,7 @@ async def lols_check(user_id):
 
     return True
 
+
 class PendingUser:
     def __init__(self, peer_id, user_id):
         self.peer_id = peer_id
@@ -125,7 +129,7 @@ class PendingUser:
                 pass
 
     async def check_captcha(self, captcha):
-        captcha = captcha.strip().upper()
+        captcha = captcha.replace(" ", "").strip().upper()
 
         if captcha == self.captcha:
             del pending[self.user_id]
@@ -172,7 +176,9 @@ class PendingUser:
                     self.peer_id,
                     self.user_id,
                     ChatBannedRights(
-                        until_date=None if forever else datetime.now() + timedelta(minutes=5),
+                        until_date=None
+                        if forever
+                        else datetime.now() + timedelta(minutes=5),
                         view_messages=True,
                     ),
                 )
@@ -180,6 +186,7 @@ class PendingUser:
         except Exception:
             pass
 
+
 @bot.on(events.ChatAction)
 async def handler(event):
     if event.chat_id not in ALLOWED_GROUPS: