Răsfoiți Sursa

fixed filters

TheHamkerCat 5 ani în urmă
părinte
comite
586db89fc2
3 a modificat fișierele cu 11 adăugiri și 8 ștergeri
  1. 3 4
      wbb/__main__.py
  2. 3 3
      wbb/modules/filters.py
  3. 5 1
      wbb/modules/global_stats.py

+ 3 - 4
wbb/__main__.py

@@ -16,9 +16,10 @@ loop = asyncio.get_event_loop()
 
 
 HELPABLE = {}
-
+COMMANDS_COUNT = None
 
 async def start_bot():
+    global COMMANDS_COUNT
     await app.start()
     await get_info(app)
 
@@ -28,8 +29,6 @@ async def start_bot():
             hasattr(imported_module, "__MODULE__")
             and imported_module.__MODULE__
         ):
-            if imported_module.__MODULE__.lower() in MOD_NOLOAD:
-                continue
             imported_module.__MODULE__ = imported_module.__MODULE__
             if (
                 hasattr(imported_module, "__HELP__")
@@ -38,7 +37,7 @@ async def start_bot():
                 HELPABLE[
                     imported_module.__MODULE__.lower()
                 ] = imported_module
-
+    COMMANDS_COUNT = HELPABLE
     bot_modules = ""
     j = 1
     for i in ALL_MODULES:

+ 3 - 3
wbb/modules/filters.py

@@ -79,12 +79,12 @@ async def del_filter(_, message):
 async def filters_re(_, message):
     try:
         if message.text[0] != "/":
-            text = message.text.lower().strip().split(" ")
+            text = message.text.lower().strip()
             if text:
                 chat_id = message.chat.id
                 list_of_filters = await get_filters_names(chat_id)
-                for word in text:
-                    if word in list_of_filters:
+                for word in list_of_filters:
+                    if word in text:
                         _filter = await get_filter(chat_id, word)
                         data_type = _filter['type']
                         data = _filter['data']

+ 5 - 1
wbb/modules/global_stats.py

@@ -3,6 +3,7 @@ from wbb.utils.filter_groups import global_stats_group
 from wbb.utils.errors import capture_err
 from wbb.utils.botinfo import BOT_ID, BOT_NAME
 from wbb.utils.fetch import fetch
+from wbb.modules import ALL_MODULES
 from wbb.utils.dbfunctions import (
     is_served_chat,
     get_served_chats,
@@ -87,10 +88,13 @@ async def global_stats(_, message):
     for developer in developers:
         commits += developer['contributions']
     developers = len(developers)
-
+    
+    # Modules info
+    modules_count = len(ALL_MODULES)
     msg = f"""
 
 **Global Stats of {BOT_NAME}**:
+0 Commands, Across {modules_count} Modules.
 **{gbans}** Globally banned users.
 **{filters_count}** Filters, Across **{filters_chats_count}** chats.
 **{notes_count}** Notes, Across **{notes_chats_count}** chats.