Kaynağa Gözat

Added something

TheHamkerCat 5 yıl önce
ebeveyn
işleme
64707a90de
4 değiştirilmiş dosya ile 11 ekleme ve 4 silme
  1. 1 0
      requirements.txt
  2. 0 2
      wbb/__main__.py
  3. 4 1
      wbb/modules/filters.py
  4. 6 1
      wbb/modules/global_stats.py

+ 1 - 0
requirements.txt

@@ -1,5 +1,6 @@
 python-arq
 TgCrypto
+pillow
 aiohttp
 aiofiles
 future

+ 0 - 2
wbb/__main__.py

@@ -16,7 +16,6 @@ loop = asyncio.get_event_loop()
 
 
 HELPABLE = {}
-COMMANDS_COUNT = None
 
 async def start_bot():
     global COMMANDS_COUNT
@@ -37,7 +36,6 @@ async def start_bot():
                 HELPABLE[
                     imported_module.__MODULE__.lower()
                 ] = imported_module
-    COMMANDS_COUNT = HELPABLE
     bot_modules = ""
     j = 1
     for i in ALL_MODULES:

+ 4 - 1
wbb/modules/filters.py

@@ -6,6 +6,8 @@ from wbb.utils.dbfunctions import (
 from pyrogram import filters
 from wbb.utils.errors import capture_err
 from wbb.utils.filter_groups import chat_filters_group
+import re
+
 
 __MODULE__ = "Filters"
 __HELP__ = """/filters To Get All The Filters In The Chat.
@@ -84,7 +86,8 @@ async def filters_re(_, message):
                 chat_id = message.chat.id
                 list_of_filters = await get_filters_names(chat_id)
                 for word in list_of_filters:
-                    if word in text:
+                    pattern = r"( |^|[^\w])" + re.escape(word) + r"( |$|[^\w])"
+                    if re.search(pattern, text, flags=re.IGNORECASE):
                         _filter = await get_filter(chat_id, word)
                         data_type = _filter['type']
                         data = _filter['data']

+ 6 - 1
wbb/modules/global_stats.py

@@ -91,16 +91,21 @@ async def global_stats(_, message):
     
     # Modules info
     modules_count = len(ALL_MODULES)
+    all_mods_help = ""
+    for module in ALL_MODULES:
+        a = __import__(module)
+        all_mods_help += f"{a.__HELP__}\n"
+    commands_count = len(all_mods_help.splitlines())
     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.
 **{warns_count}** Warns, Across **{warns_chats_count}** chats.
 **{karmas_count}** Karma, Across **{karmas_chats_count}** chats.
 **{total_users}** Users, Across **{len(served_chats)}** chats.
+**{commands_count}** Commands, Across **{modules_count}** Modules.
 **{developers}** Developers And **{commits}** Commits On **[Github]({rurl})**."""
 
     await m.edit(msg, disable_web_page_preview=True)