TheHamkerCat 5 år sedan
förälder
incheckning
5ce2637d94
2 ändrade filer med 12 tillägg och 3 borttagningar
  1. 8 2
      wbb/modules/global_stats.py
  2. 4 1
      wbb/modules/karma.py

+ 8 - 2
wbb/modules/global_stats.py

@@ -15,6 +15,7 @@ from wbb.utils.dbfunctions import (
     get_gbans_count
 )
 from pyrogram import filters
+
 import asyncio
 
 @app.on_message(filters.text, group=global_stats_group)
@@ -58,9 +59,14 @@ async def global_stats(_, message):
             served_chats.remove(served_chat)
             pass
     for i in served_chats:
-        mc = (await app.get_chat(i)).members_count
+        try:
+            mc = (await app.get_chat(i)).members_count
+            total_users += int(mc)
+        except Exception:
+            await remove_served_chat(served_chat)
+            pass
         await asyncio.sleep(3)
-        total_users += int(mc)
+        
 
     # Gbans count
     gbans = await get_gbans_count()

+ 4 - 1
wbb/modules/karma.py

@@ -95,7 +95,10 @@ async def karma(_, message):
         for i in karma:
             user_id = await alpha_to_int(i)
             user_karma = karma[i]['karma']
-            user_name = (await app.get_users(user_id)).username
+            try:
+                user_name = (await app.get_users(user_id)).username
+            except Exception:
+                continue
             karma_dicc[user_name] = user_karma
 
             karma_arranged = dict(