Jelajahi Sumber

Fixed 'stack overflow' error

thehamkercat 5 tahun lalu
induk
melakukan
0e846ad17a
2 mengubah file dengan 5 tambahan dan 18 penghapusan
  1. 3 16
      wbb/__init__.py
  2. 2 2
      wbb/modules/trust.py

+ 3 - 16
wbb/__init__.py

@@ -123,13 +123,13 @@ USERBOT_NAME = ""
 USERBOT_USERNAME = ""
 USERBOT_DC_ID = 0
 USERBOT_MENTION = ""
-USERBOT_BOT_CHAT_DIFFERENCE = []
+USERBOT_BOT_CHAT_COMMON = []
 
 
 def get_info(app, app2):
     global BOT_ID, BOT_NAME, BOT_USERNAME, BOT_DC_ID, BOT_MENTION
     global USERBOT_ID, USERBOT_NAME, USERBOT_USERNAME, USERBOT_DC_ID, USERBOT_MENTION
-    global USERBOT_BOT_CHAT_DIFFERENCE
+    global USERBOT_BOT_CHAT_COMMON
     getme = app.get_me()
     getme2 = app2.get_me()
     BOT_ID = getme.id
@@ -152,20 +152,7 @@ def get_info(app, app2):
     USERBOT_MENTION = getme2.mention
     USERBOT_DC_ID = getme2.dc_id
 
-    all_ub_chats = [
-        i.chat.id
-        for i in app2.iter_dialogs()
-        if i.chat.type in ["group", "supergroup", "private"]
-    ]
-    ub_b_common_chats = [i.id for i in app2.get_common_chats(BOT_USERNAME)]
-    USERBOT_BOT_CHAT_DIFFERENCE = list(
-        set(all_ub_chats).difference(ub_b_common_chats)
-    )
-    USERBOT_BOT_CHAT_DIFFERENCE = [
-        x
-        for x in USERBOT_BOT_CHAT_DIFFERENCE
-        if x not in SPAM_CHECK_EXCEPTION_GROUPS
-    ]
+    USERBOT_BOT_CHAT_COMMON = [i.id for i in app2.get_common_chats(BOT_USERNAME)] + SPAM_CHECK_EXCEPTION_GROUPS
 
 
 print("[INFO]: STARTING BOT CLIENT")

+ 2 - 2
wbb/modules/trust.py

@@ -26,7 +26,7 @@ from asyncio import sleep
 from pyrogram import filters
 from pyrogram.types import Message
 
-from wbb import (BOT_ID, MESSAGE_DUMP_CHAT, USERBOT_BOT_CHAT_DIFFERENCE, app,
+from wbb import (BOT_ID, MESSAGE_DUMP_CHAT, USERBOT_BOT_CHAT_COMMON, app,
                  app2, arq)
 from wbb.utils.dbfunctions import get_trust_db, update_trust_db
 from wbb.utils.filter_groups import trust_group
@@ -47,7 +47,7 @@ async def get_spam_data(message: Message, text: str):
 @app2.on_message(
     (filters.text | filters.caption)
     & ~filters.chat(BOT_ID)
-    & filters.chat(USERBOT_BOT_CHAT_DIFFERENCE)
+    & ~filters.chat(USERBOT_BOT_CHAT_COMMON)
     & ~filters.me,
     group=trust_group,
 )