TheHamkerCat 5 лет назад
Родитель
Сommit
217722ffd5
52 измененных файлов с 895 добавлено и 342 удалено
  1. 12 9
      sample_config.py
  2. 10 3
      wbb/__init__.py
  3. 52 17
      wbb/__main__.py
  4. 5 2
      wbb/core/decorators/errors.py
  5. 21 6
      wbb/core/decorators/permissions.py
  6. 20 6
      wbb/core/types/InlineQueryResult.py
  7. 3 1
      wbb/modules/__init__.py
  8. 70 24
      wbb/modules/admin.py
  9. 3 1
      wbb/modules/admin_misc.py
  10. 2 1
      wbb/modules/alive.py
  11. 23 12
      wbb/modules/anime.py
  12. 3 1
      wbb/modules/arq.py
  13. 21 7
      wbb/modules/blacklist.py
  14. 15 5
      wbb/modules/blacklist_chat.py
  15. 14 6
      wbb/modules/chatbot.py
  16. 3 1
      wbb/modules/couple.py
  17. 19 7
      wbb/modules/devs.py
  18. 18 6
      wbb/modules/filters.py
  19. 8 4
      wbb/modules/flood.py
  20. 5 2
      wbb/modules/global_stats.py
  21. 29 13
      wbb/modules/greetings.py
  22. 15 5
      wbb/modules/info.py
  23. 6 2
      wbb/modules/inline.py
  24. 30 12
      wbb/modules/karma.py
  25. 6 2
      wbb/modules/locks.py
  26. 33 14
      wbb/modules/misc.py
  27. 15 5
      wbb/modules/music.py
  28. 29 11
      wbb/modules/notes.py
  29. 3 1
      wbb/modules/nsfw.py
  30. 3 1
      wbb/modules/paste.py
  31. 28 9
      wbb/modules/pmpermit.py
  32. 5 2
      wbb/modules/quotly.py
  33. 11 4
      wbb/modules/regex.py
  34. 4 1
      wbb/modules/repo.py
  35. 10 7
      wbb/modules/reverse.py
  36. 30 11
      wbb/modules/rice.py
  37. 5 2
      wbb/modules/spam.py
  38. 33 17
      wbb/modules/stickers.py
  39. 20 8
      wbb/modules/sudo.py
  40. 44 16
      wbb/modules/sudoers.py
  41. 5 3
      wbb/modules/taglogger.py
  42. 2 2
      wbb/modules/trust.py
  43. 9 3
      wbb/modules/userbot.py
  44. 3 1
      wbb/modules/webss.py
  45. 13 5
      wbb/modules/ytdl.py
  46. 14 4
      wbb/utils/aiodownloader/downloader.py
  47. 53 17
      wbb/utils/dbfunctions.py
  48. 3 1
      wbb/utils/files.py
  49. 12 4
      wbb/utils/functions.py
  50. 80 33
      wbb/utils/inlinefuncs.py
  51. 9 3
      wbb/utils/misc.py
  52. 6 2
      wbb/utils/stickerset.py

+ 12 - 9
sample_config.py

@@ -2,16 +2,16 @@ from dotenv import load_dotenv
 
 
 load_dotenv("config.env")
 load_dotenv("config.env")
 
 
-HEROKU = (
-    True  # NOTE Make it false if you're not deploying on heroku or docker.
-)
+HEROKU = True  # NOTE Make it false if you're not deploying on heroku or docker.
 
 
 if HEROKU:
 if HEROKU:
     from os import environ
     from os import environ
 
 
     BOT_TOKEN = environ.get("BOT_TOKEN", None)
     BOT_TOKEN = environ.get("BOT_TOKEN", None)
     API_ID = int(environ.get("API_ID", 6))
     API_ID = int(environ.get("API_ID", 6))
-    API_HASH = environ.get("API_HASH", "eb06d4abfb49dc3eeb1aeb98ae0f581e")
+    API_HASH = environ.get(
+        "API_HASH", "eb06d4abfb49dc3eeb1aeb98ae0f581e"
+    )
     SESSION_STRING = environ.get("SESSION_STRING", None)
     SESSION_STRING = environ.get("SESSION_STRING", None)
     USERBOT_PREFIX = environ.get("USERBOT_PREFIX", ".")
     USERBOT_PREFIX = environ.get("USERBOT_PREFIX", ".")
     SUDO_USERS_ID = list(
     SUDO_USERS_ID = list(
@@ -21,7 +21,9 @@ if HEROKU:
     GBAN_LOG_GROUP_ID = int(environ.get("GBAN_LOG_GROUP_ID", None))
     GBAN_LOG_GROUP_ID = int(environ.get("GBAN_LOG_GROUP_ID", None))
     MESSAGE_DUMP_CHAT = int(environ.get("MESSAGE_DUMP_CHAT", None))
     MESSAGE_DUMP_CHAT = int(environ.get("MESSAGE_DUMP_CHAT", None))
     FERNET_ENCRYPTION_KEY = environ.get("FERNET_ENCRYPTION_KEY", None)
     FERNET_ENCRYPTION_KEY = environ.get("FERNET_ENCRYPTION_KEY", None)
-    WELCOME_DELAY_KICK_SEC = int(environ.get("WELCOME_DELAY_KICK_SEC", None))
+    WELCOME_DELAY_KICK_SEC = int(
+        environ.get("WELCOME_DELAY_KICK_SEC", None)
+    )
     MONGO_DB_URI = environ.get("MONGO_DB_URI", None)
     MONGO_DB_URI = environ.get("MONGO_DB_URI", None)
     ARQ_API_URL = environ.get("ARQ_API_URL", None)
     ARQ_API_URL = environ.get("ARQ_API_URL", None)
     ARQ_API_KEY = environ.get("ARQ_API_KEY", None)
     ARQ_API_KEY = environ.get("ARQ_API_KEY", None)
@@ -29,7 +31,10 @@ if HEROKU:
         True if int(environ.get("LOG_MENTIONS", None)) == 1 else False
         True if int(environ.get("LOG_MENTIONS", None)) == 1 else False
     )
     )
     SPAM_CHECK_EXCEPTION_GROUPS = list(
     SPAM_CHECK_EXCEPTION_GROUPS = list(
-        int(y) for y in environ.get("SPAM_CHECK_EXCEPTION_GROUPS", "").split()
+        int(y)
+        for y in environ.get(
+            "SPAM_CHECK_EXCEPTION_GROUPS", ""
+        ).split()
     )
     )
 else:
 else:
     BOT_TOKEN = "467677575:YZfaakjwd545dfg-N6JStihhuw5gQeZHntc"
     BOT_TOKEN = "467677575:YZfaakjwd545dfg-N6JStihhuw5gQeZHntc"
@@ -44,9 +49,7 @@ else:
     LOG_GROUP_ID = -100125431255
     LOG_GROUP_ID = -100125431255
     GBAN_LOG_GROUP_ID = -100125431255
     GBAN_LOG_GROUP_ID = -100125431255
     MESSAGE_DUMP_CHAT = -1001181696437
     MESSAGE_DUMP_CHAT = -1001181696437
-    FERNET_ENCRYPTION_KEY = (
-        "iKMq0WZMnJKjMQxZWKtv-cplMuF_LoyshXj0XbTGGWM="  # Leave this as it is
-    )
+    FERNET_ENCRYPTION_KEY = "iKMq0WZMnJKjMQxZWKtv-cplMuF_LoyshXj0XbTGGWM="  # Leave this as it is
     WELCOME_DELAY_KICK_SEC = 300
     WELCOME_DELAY_KICK_SEC = 300
     MONGO_DB_URI = "mongodb+srv://username:password@cluster0.ksiis.mongodb.net/YourDataBaseName?retryWrites=true&w=majority"
     MONGO_DB_URI = "mongodb+srv://username:password@cluster0.ksiis.mongodb.net/YourDataBaseName?retryWrites=true&w=majority"
     ARQ_API_KEY = "Get this from @ARQRobot"
     ARQ_API_KEY = "Get this from @ARQRobot"

+ 10 - 3
wbb/__init__.py

@@ -83,7 +83,9 @@ async def load_sudoers():
         if user_id not in sudoers:
         if user_id not in sudoers:
             sudoers.append(user_id)
             sudoers.append(user_id)
             await sudoersdb.update_one(
             await sudoersdb.update_one(
-                {"sudo": "sudo"}, {"$set": {"sudoers": sudoers}}, upsert=True
+                {"sudo": "sudo"},
+                {"$set": {"sudoers": sudoers}},
+                upsert=True,
             )
             )
     SUDOERS = (SUDOERS + sudoers) if sudoers else SUDOERS
     SUDOERS = (SUDOERS + sudoers) if sudoers else SUDOERS
     print("[INFO]: LOADED SUDOERS")
     print("[INFO]: LOADED SUDOERS")
@@ -95,7 +97,10 @@ loop.run_until_complete(load_sudoers())
 if not HEROKU:
 if not HEROKU:
     print("[INFO]: INITIALIZING USERBOT CLIENT")
     print("[INFO]: INITIALIZING USERBOT CLIENT")
     app2 = Client(
     app2 = Client(
-        "userbot", phone_number=PHONE_NUMBER, api_id=API_ID, api_hash=API_HASH
+        "userbot",
+        phone_number=PHONE_NUMBER,
+        api_id=API_ID,
+        api_hash=API_HASH,
     )
     )
 else:
 else:
     print("[INFO]: INITIALIZING USERBOT CLIENT")
     print("[INFO]: INITIALIZING USERBOT CLIENT")
@@ -109,7 +114,9 @@ print("[INFO]: INITIALIZING ARQ CLIENT")
 arq = ARQ(ARQ_API_URL, ARQ_API_KEY, aiohttpsession)
 arq = ARQ(ARQ_API_URL, ARQ_API_KEY, aiohttpsession)
 # Bot client
 # Bot client
 print("[INFO]: INITIALIZING BOT CLIENT")
 print("[INFO]: INITIALIZING BOT CLIENT")
-app = Client("wbb", bot_token=BOT_TOKEN, api_id=API_ID, api_hash=API_HASH)
+app = Client(
+    "wbb", bot_token=BOT_TOKEN, api_id=API_ID, api_hash=API_HASH
+)
 
 
 
 
 BOT_ID = 0
 BOT_ID = 0

+ 52 - 17
wbb/__main__.py

@@ -29,7 +29,8 @@ import uvloop
 from pyrogram import filters, idle
 from pyrogram import filters, idle
 from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
 from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
 
 
-from wbb import BOT_NAME, BOT_USERNAME, USERBOT_NAME, aiohttpsession, app
+from wbb import (BOT_NAME, BOT_USERNAME, USERBOT_NAME, aiohttpsession,
+                 app)
 from wbb.modules import ALL_MODULES
 from wbb.modules import ALL_MODULES
 from wbb.modules.sudoers import bot_sys_stats
 from wbb.modules.sudoers import bot_sys_stats
 from wbb.utils import paginate_modules
 from wbb.utils import paginate_modules
@@ -53,7 +54,9 @@ async def start_bot():
         except Exception:
         except Exception:
             pass
             pass
     for module in ALL_MODULES:
     for module in ALL_MODULES:
-        imported_module = importlib.import_module("wbb.modules." + module)
+        imported_module = importlib.import_module(
+            "wbb.modules." + module
+        )
         if (
         if (
             hasattr(imported_module, "__MODULE__")
             hasattr(imported_module, "__MODULE__")
             and imported_module.__MODULE__
             and imported_module.__MODULE__
@@ -63,7 +66,9 @@ async def start_bot():
                 hasattr(imported_module, "__HELP__")
                 hasattr(imported_module, "__HELP__")
                 and imported_module.__HELP__
                 and imported_module.__HELP__
             ):
             ):
-                HELPABLE[imported_module.__MODULE__.lower()] = imported_module
+                HELPABLE[
+                    imported_module.__MODULE__.lower()
+                ] = imported_module
     bot_modules = ""
     bot_modules = ""
     j = 1
     j = 1
     for i in ALL_MODULES:
     for i in ALL_MODULES:
@@ -73,11 +78,19 @@ async def start_bot():
         else:
         else:
             bot_modules += "|{:<15}".format(i)
             bot_modules += "|{:<15}".format(i)
         j += 1
         j += 1
-    print("+===============================================================+")
-    print("|                              WBB                              |")
-    print("+===============+===============+===============+===============+")
+    print(
+        "+===============================================================+"
+    )
+    print(
+        "|                              WBB                              |"
+    )
+    print(
+        "+===============+===============+===============+===============+"
+    )
     print(bot_modules)
     print(bot_modules)
-    print("+===============+===============+===============+===============+")
+    print(
+        "+===============+===============+===============+===============+"
+    )
     print(f"[INFO]: BOT STARTED AS {BOT_NAME}!")
     print(f"[INFO]: BOT STARTED AS {BOT_NAME}!")
     print(f"[INFO]: USERBOT STARTED AS {USERBOT_NAME}!")
     print(f"[INFO]: USERBOT STARTED AS {USERBOT_NAME}!")
     await idle()
     await idle()
@@ -102,7 +115,8 @@ async def help_command(_, message):
                 ],
                 ],
                 [
                 [
                     InlineKeyboardButton(
                     InlineKeyboardButton(
-                        text="System Stats 💻", callback_data="stats_callback"
+                        text="System Stats 💻",
+                        callback_data="stats_callback",
                     ),
                     ),
                     InlineKeyboardButton(
                     InlineKeyboardButton(
                         text="Support 👨", url="t.me/WBBSupport"
                         text="Support 👨", url="t.me/WBBSupport"
@@ -110,7 +124,9 @@ async def help_command(_, message):
                 ],
                 ],
             ]
             ]
         )
         )
-        await message.reply("Pm Me For More Details.", reply_markup=keyboard)
+        await message.reply(
+            "Pm Me For More Details.", reply_markup=keyboard
+        )
         return
         return
     keyboard = InlineKeyboardMarkup(
     keyboard = InlineKeyboardMarkup(
         [
         [
@@ -125,9 +141,12 @@ async def help_command(_, message):
             ],
             ],
             [
             [
                 InlineKeyboardButton(
                 InlineKeyboardButton(
-                    text="System Stats 🖥", callback_data="stats_callback"
+                    text="System Stats 🖥",
+                    callback_data="stats_callback",
+                ),
+                InlineKeyboardButton(
+                    text="Support 👨", url="t.me/WBBSupport"
                 ),
                 ),
-                InlineKeyboardButton(text="Support 👨", url="t.me/WBBSupport"),
             ],
             ],
             [
             [
                 InlineKeyboardButton(
                 InlineKeyboardButton(
@@ -145,7 +164,9 @@ async def help_command(_, message):
 
 
 async def help_parser(name, keyboard=None):
 async def help_parser(name, keyboard=None):
     if not keyboard:
     if not keyboard:
-        keyboard = InlineKeyboardMarkup(paginate_modules(0, HELPABLE, "help"))
+        keyboard = InlineKeyboardMarkup(
+            paginate_modules(0, HELPABLE, "help")
+        )
     return (
     return (
         """Hello {first_name}! My name is {bot_name}!
         """Hello {first_name}! My name is {bot_name}!
 I'm a group management bot with some usefule features.
 I'm a group management bot with some usefule features.
@@ -164,9 +185,13 @@ General command are:
 
 
 @app.on_callback_query(filters.regex("bot_commands"))
 @app.on_callback_query(filters.regex("bot_commands"))
 async def commands_callbacc(_, CallbackQuery):
 async def commands_callbacc(_, CallbackQuery):
-    text, keyboard = await help_parser(CallbackQuery.from_user.mention)
+    text, keyboard = await help_parser(
+        CallbackQuery.from_user.mention
+    )
     await app.send_message(
     await app.send_message(
-        CallbackQuery.message.chat.id, text=text, reply_markup=keyboard
+        CallbackQuery.message.chat.id,
+        text=text,
+        reply_markup=keyboard,
     )
     )
 
 
     await CallbackQuery.message.delete()
     await CallbackQuery.message.delete()
@@ -175,7 +200,9 @@ async def commands_callbacc(_, CallbackQuery):
 @app.on_callback_query(filters.regex("stats_callback"))
 @app.on_callback_query(filters.regex("stats_callback"))
 async def stats_callbacc(_, CallbackQuery):
 async def stats_callbacc(_, CallbackQuery):
     text = await bot_sys_stats()
     text = await bot_sys_stats()
-    await app.answer_callback_query(CallbackQuery.id, text, show_alert=True)
+    await app.answer_callback_query(
+        CallbackQuery.id, text, show_alert=True
+    )
 
 
 
 
 @app.on_callback_query(filters.regex(r"help_(.*?)"))
 @app.on_callback_query(filters.regex(r"help_(.*?)"))
@@ -207,7 +234,13 @@ General command are:
         await query.message.edit(
         await query.message.edit(
             text=text,
             text=text,
             reply_markup=InlineKeyboardMarkup(
             reply_markup=InlineKeyboardMarkup(
-                [[InlineKeyboardButton("back", callback_data="help_back")]]
+                [
+                    [
+                        InlineKeyboardButton(
+                            "back", callback_data="help_back"
+                        )
+                    ]
+                ]
             ),
             ),
             disable_web_page_preview=True,
             disable_web_page_preview=True,
         )
         )
@@ -244,7 +277,9 @@ General command are:
     elif create_match:
     elif create_match:
         text, keyboard = await help_parser(query)
         text, keyboard = await help_parser(query)
         await query.message.edit(
         await query.message.edit(
-            text=text, reply_markup=keyboard, disable_web_page_preview=True
+            text=text,
+            reply_markup=keyboard,
+            disable_web_page_preview=True,
         )
         )
 
 
     return await client.answer_callback_query(query.id)
     return await client.answer_callback_query(query.id)

+ 5 - 2
wbb/core/decorators/errors.py

@@ -4,7 +4,8 @@ import sys
 import traceback
 import traceback
 from functools import wraps
 from functools import wraps
 
 
-from pyrogram.errors.exceptions.forbidden_403 import ChatWriteForbidden
+from pyrogram.errors.exceptions.forbidden_403 import \
+    ChatWriteForbidden
 
 
 from wbb import LOG_GROUP_ID, app
 from wbb import LOG_GROUP_ID, app
 
 
@@ -45,7 +46,9 @@ def capture_err(func):
             )
             )
             error_feedback = split_limits(
             error_feedback = split_limits(
                 "**ERROR** | `{}` | `{}`\n\n```{}```\n\n```{}```\n".format(
                 "**ERROR** | `{}` | `{}`\n\n```{}```\n\n```{}```\n".format(
-                    0 if not message.from_user else message.from_user.id,
+                    0
+                    if not message.from_user
+                    else message.from_user.id,
                     0 if not message.chat else message.chat.id,
                     0 if not message.chat else message.chat.id,
                     message.text or message.caption,
                     message.text or message.caption,
                     "".join(errors),
                     "".join(errors),

+ 21 - 6
wbb/core/decorators/permissions.py

@@ -24,14 +24,17 @@ SOFTWARE.
 from functools import wraps
 from functools import wraps
 from traceback import format_exc as err
 from traceback import format_exc as err
 
 
-from pyrogram.errors.exceptions.forbidden_403 import ChatWriteForbidden
+from pyrogram.errors.exceptions.forbidden_403 import \
+    ChatWriteForbidden
 from pyrogram.types import Message
 from pyrogram.types import Message
 
 
 from wbb import SUDOERS, app
 from wbb import SUDOERS, app
 from wbb.modules.admin import member_permissions
 from wbb.modules.admin import member_permissions
 
 
 
 
-async def authorised(func, subFunc2, client, message, *args, **kwargs):
+async def authorised(
+    func, subFunc2, client, message, *args, **kwargs
+):
     chatID = message.chat.id
     chatID = message.chat.id
     try:
     try:
         await func(client, message, *args, **kwargs)
         await func(client, message, *args, **kwargs)
@@ -66,14 +69,26 @@ def adminsOnly(permission):
                 # For anonymous admins
                 # For anonymous admins
                 if message.sender_chat:
                 if message.sender_chat:
                     return await authorised(
                     return await authorised(
-                        func, subFunc2, client, message, *args, **kwargs
+                        func,
+                        subFunc2,
+                        client,
+                        message,
+                        *args,
+                        **kwargs,
                     )
                     )
-                return await unauthorised(message, permission, subFunc2)
+                return await unauthorised(
+                    message, permission, subFunc2
+                )
             # For admins and sudo users
             # For admins and sudo users
             userID = message.from_user.id
             userID = message.from_user.id
             permissions = await member_permissions(chatID, userID)
             permissions = await member_permissions(chatID, userID)
-            if userID not in SUDOERS and permission not in permissions:
-                return await unauthorised(message, permission, subFunc2)
+            if (
+                userID not in SUDOERS
+                and permission not in permissions
+            ):
+                return await unauthorised(
+                    message, permission, subFunc2
+                )
             return await authorised(
             return await authorised(
                 func, subFunc2, client, message, *args, **kwargs
                 func, subFunc2, client, message, *args, **kwargs
             )
             )

+ 20 - 6
wbb/core/types/InlineQueryResult.py

@@ -25,7 +25,8 @@ from typing import List, Optional, Union
 
 
 import pyrogram
 import pyrogram
 from pyrogram import raw, types, utils
 from pyrogram import raw, types, utils
-from pyrogram.file_id import DOCUMENT_TYPES, PHOTO_TYPES, FileId, FileType
+from pyrogram.file_id import (DOCUMENT_TYPES, PHOTO_TYPES, FileId,
+                              FileType)
 from pyrogram.types import InlineQueryResult
 from pyrogram.types import InlineQueryResult
 
 
 
 
@@ -97,7 +98,9 @@ class InlineQueryResultAudio(InlineQueryResult):
         reply_markup: "types.InlineKeyboardMarkup" = None,
         reply_markup: "types.InlineKeyboardMarkup" = None,
         input_message_content: "types.InputMessageContent" = None,
         input_message_content: "types.InputMessageContent" = None,
     ):
     ):
-        super().__init__("audio", id, input_message_content, reply_markup)
+        super().__init__(
+            "audio", id, input_message_content, reply_markup
+        )
 
 
         self.audio_url = audio_url
         self.audio_url = audio_url
         self.thumb_url = thumb_url
         self.thumb_url = thumb_url
@@ -142,7 +145,10 @@ class InlineQueryResultAudio(InlineQueryResult):
 
 
         message, entities = (
         message, entities = (
             await utils.parse_text_entities(
             await utils.parse_text_entities(
-                client, self.caption, self.parse_mode, self.caption_entities
+                client,
+                self.caption,
+                self.parse_mode,
+                self.caption_entities,
             )
             )
         ).values()
         ).values()
 
 
@@ -229,7 +235,9 @@ class InlineQueryResultCachedDocument(InlineQueryResult):
         reply_markup: "types.InlineKeyboardMarkup" = None,
         reply_markup: "types.InlineKeyboardMarkup" = None,
         input_message_content: "types.InputMessageContent" = None,
         input_message_content: "types.InputMessageContent" = None,
     ):
     ):
-        super().__init__("file", id, input_message_content, reply_markup)
+        super().__init__(
+            "file", id, input_message_content, reply_markup
+        )
 
 
         self.file_id = file_id
         self.file_id = file_id
         self.title = title
         self.title = title
@@ -245,7 +253,10 @@ class InlineQueryResultCachedDocument(InlineQueryResult):
 
 
         message, entities = (
         message, entities = (
             await utils.parse_text_entities(
             await utils.parse_text_entities(
-                client, self.caption, self.parse_mode, self.caption_entities
+                client,
+                self.caption,
+                self.parse_mode,
+                self.caption_entities,
             )
             )
         ).values()
         ).values()
 
 
@@ -284,7 +295,10 @@ def get_input_file_from_file_id(
 
 
     file_type = decoded.file_type
     file_type = decoded.file_type
 
 
-    if expected_file_type is not None and file_type != expected_file_type:
+    if (
+        expected_file_type is not None
+        and file_type != expected_file_type
+    ):
         raise ValueError(
         raise ValueError(
             f'Expected: "{expected_file_type}", got "{file_type}" file_id instead'
             f'Expected: "{expected_file_type}", got "{file_type}" file_id instead'
         )
         )

+ 3 - 1
wbb/modules/__init__.py

@@ -56,7 +56,9 @@ def __list_all_modules():
             to_load = all_modules
             to_load = all_modules
 
 
         if MOD_NOLOAD:
         if MOD_NOLOAD:
-            return [item for item in to_load if item not in MOD_NOLOAD]
+            return [
+                item for item in to_load if item not in MOD_NOLOAD
+            ]
 
 
         return to_load
         return to_load
 
 

+ 70 - 24
wbb/modules/admin.py

@@ -124,13 +124,18 @@ async def current_chat_permissions(chat_id):
 
 
 
 
 async def list_members(group_id):
 async def list_members(group_id):
-    return [member.user.id async for member in app.iter_chat_members(group_id)]
+    return [
+        member.user.id
+        async for member in app.iter_chat_members(group_id)
+    ]
 
 
 
 
 # Purge Messages
 # Purge Messages
 
 
 
 
-@app.on_message(filters.command("purge") & ~filters.edited & ~filters.private)
+@app.on_message(
+    filters.command("purge") & ~filters.edited & ~filters.private
+)
 @adminsOnly("can_delete_messages")
 @adminsOnly("can_delete_messages")
 async def purgeFunc(client, message: Message):
 async def purgeFunc(client, message: Message):
     chat_id = message.chat.id
     chat_id = message.chat.id
@@ -162,7 +167,9 @@ async def purgeFunc(client, message: Message):
 # Kick members
 # Kick members
 
 
 
 
-@app.on_message(filters.command("kick") & ~filters.edited & ~filters.private)
+@app.on_message(
+    filters.command("kick") & ~filters.edited & ~filters.private
+)
 @adminsOnly("can_restrict_members")
 @adminsOnly("can_restrict_members")
 async def kickFunc(_, message: Message):
 async def kickFunc(_, message: Message):
     user_id, reason = await extract_user_and_reason(message)
     user_id, reason = await extract_user_and_reason(message)
@@ -173,7 +180,9 @@ async def kickFunc(_, message: Message):
             "I can't kick myself, i can leave if you want."
             "I can't kick myself, i can leave if you want."
         )
         )
     if user_id in SUDOERS:
     if user_id in SUDOERS:
-        return await message.reply_text("You Wanna Kick The Elevated One?")
+        return await message.reply_text(
+            "You Wanna Kick The Elevated One?"
+        )
     if user_id in (await list_admins(message.chat.id)):
     if user_id in (await list_admins(message.chat.id)):
         return await message.reply_text(
         return await message.reply_text(
             "I can't kick an admin, You know the rules, so do i."
             "I can't kick an admin, You know the rules, so do i."
@@ -192,7 +201,9 @@ async def kickFunc(_, message: Message):
 # Ban members
 # Ban members
 
 
 
 
-@app.on_message(filters.command("ban") & ~filters.edited & ~filters.private)
+@app.on_message(
+    filters.command("ban") & ~filters.edited & ~filters.private
+)
 @adminsOnly("can_restrict_members")
 @adminsOnly("can_restrict_members")
 async def banFunc(_, message: Message):
 async def banFunc(_, message: Message):
     user_id, reason = await extract_user_and_reason(message)
     user_id, reason = await extract_user_and_reason(message)
@@ -222,7 +233,9 @@ async def banFunc(_, message: Message):
 # Unban members
 # Unban members
 
 
 
 
-@app.on_message(filters.command("unban") & ~filters.edited & ~filters.private)
+@app.on_message(
+    filters.command("unban") & ~filters.edited & ~filters.private
+)
 @adminsOnly("can_restrict_members")
 @adminsOnly("can_restrict_members")
 async def unbanFunc(_, message: Message):
 async def unbanFunc(_, message: Message):
     # we don't need reasons for unban, also, we
     # we don't need reasons for unban, also, we
@@ -244,11 +257,15 @@ async def unbanFunc(_, message: Message):
 # Delete messages
 # Delete messages
 
 
 
 
-@app.on_message(filters.command("del") & ~filters.edited & ~filters.private)
+@app.on_message(
+    filters.command("del") & ~filters.edited & ~filters.private
+)
 @adminsOnly("can_delete_messages")
 @adminsOnly("can_delete_messages")
 async def deleteFunc(_, message: Message):
 async def deleteFunc(_, message: Message):
     if not message.reply_to_message:
     if not message.reply_to_message:
-        return await message.reply_text("Reply To A Message To Delete It")
+        return await message.reply_text(
+            "Reply To A Message To Delete It"
+        )
     await message.reply_to_message.delete()
     await message.reply_to_message.delete()
     await message.delete()
     await message.delete()
 
 
@@ -268,7 +285,9 @@ async def promoteFunc(_, message: Message):
     if user_id == BOT_ID:
     if user_id == BOT_ID:
         return await message.reply_text("I can't promote myself.")
         return await message.reply_text("I can't promote myself.")
     if not bot.can_promote_members:
     if not bot.can_promote_members:
-        return await message.reply_text("I don't have enough permissions")
+        return await message.reply_text(
+            "I don't have enough permissions"
+        )
     await message.chat.promote_member(
     await message.chat.promote_member(
         user_id=user_id,
         user_id=user_id,
         can_change_info=bot.can_change_info,
         can_change_info=bot.can_change_info,
@@ -286,7 +305,9 @@ async def promoteFunc(_, message: Message):
 # Demote Member
 # Demote Member
 
 
 
 
-@app.on_message(filters.command("demote") & ~filters.edited & ~filters.private)
+@app.on_message(
+    filters.command("demote") & ~filters.edited & ~filters.private
+)
 @adminsOnly("can_promote_members")
 @adminsOnly("can_promote_members")
 async def demote(_, message: Message):
 async def demote(_, message: Message):
     user_id = await extract_user(message)
     user_id = await extract_user(message)
@@ -319,18 +340,24 @@ async def demote(_, message: Message):
 # Pin Messages
 # Pin Messages
 
 
 
 
-@app.on_message(filters.command("pin") & ~filters.edited & ~filters.private)
+@app.on_message(
+    filters.command("pin") & ~filters.edited & ~filters.private
+)
 @adminsOnly("can_pin_messages")
 @adminsOnly("can_pin_messages")
 async def pin(_, message: Message):
 async def pin(_, message: Message):
     if not message.reply_to_message:
     if not message.reply_to_message:
-        return await message.reply_text("Reply to a message to pin it.")
+        return await message.reply_text(
+            "Reply to a message to pin it."
+        )
     await message.reply_to_message.pin(disable_notification=True)
     await message.reply_to_message.pin(disable_notification=True)
 
 
 
 
 # Mute members
 # Mute members
 
 
 
 
-@app.on_message(filters.command("mute") & ~filters.edited & ~filters.private)
+@app.on_message(
+    filters.command("mute") & ~filters.edited & ~filters.private
+)
 @adminsOnly("can_restrict_members")
 @adminsOnly("can_restrict_members")
 async def mute(_, message: Message):
 async def mute(_, message: Message):
     user_id, reason = await extract_user_and_reason(message)
     user_id, reason = await extract_user_and_reason(message)
@@ -346,21 +373,25 @@ async def mute(_, message: Message):
         return await message.reply_text(
         return await message.reply_text(
             "I can't mute an admin, You know the rules, so do i."
             "I can't mute an admin, You know the rules, so do i."
         )
         )
-    await message.chat.restrict_member(user_id, permissions=ChatPermissions())
+    await message.chat.restrict_member(
+        user_id, permissions=ChatPermissions()
+    )
     mention = (await app.get_users(user_id)).mention
     mention = (await app.get_users(user_id)).mention
     keyboard = ikb([[("🚨   Unmute   🚨", f"unmute_{user_id}")]])
     keyboard = ikb([[("🚨   Unmute   🚨", f"unmute_{user_id}")]])
     msg = f"""
     msg = f"""
 **Muted User:** {mention}
 **Muted User:** {mention}
 **Muted By:** {message.from_user.mention if message.from_user else 'Anon'}
 **Muted By:** {message.from_user.mention if message.from_user else 'Anon'}
 **Reason:** {reason or 'No Reason Provided.'}"""
 **Reason:** {reason or 'No Reason Provided.'}"""
-    
+
     await message.reply_text(msg, reply_markup=keyboard)
     await message.reply_text(msg, reply_markup=keyboard)
 
 
 
 
 # Unmute members
 # Unmute members
 
 
 
 
-@app.on_message(filters.command("unmute") & ~filters.edited & ~filters.private)
+@app.on_message(
+    filters.command("unmute") & ~filters.edited & ~filters.private
+)
 @adminsOnly("can_restrict_members")
 @adminsOnly("can_restrict_members")
 async def unmute(_, message: Message):
 async def unmute(_, message: Message):
     user_id = await extract_user(message)
     user_id = await extract_user(message)
@@ -389,12 +420,18 @@ async def ban_deleted_accounts(_, message: Message):
             except Exception:
             except Exception:
                 pass
                 pass
             banned_users += 1
             banned_users += 1
-        await message.reply_text(f"Banned {banned_users} Deleted Accounts")
+        await message.reply_text(
+            f"Banned {banned_users} Deleted Accounts"
+        )
     else:
     else:
-        await message.reply_text("There are no deleted accounts in this chat")
+        await message.reply_text(
+            "There are no deleted accounts in this chat"
+        )
 
 
 
 
-@app.on_message(filters.command("warn") & ~filters.edited & ~filters.private)
+@app.on_message(
+    filters.command("warn") & ~filters.edited & ~filters.private
+)
 @adminsOnly("can_restrict_members")
 @adminsOnly("can_restrict_members")
 async def warn_user(_, message: Message):
 async def warn_user(_, message: Message):
     user_id, reason = await extract_user_and_reason(message)
     user_id, reason = await extract_user_and_reason(message)
@@ -416,7 +453,8 @@ async def warn_user(_, message: Message):
     if user_id not in (await list_members(chat_id)):
     if user_id not in (await list_members(chat_id)):
         return await message.reply_text("This user isn't here.")
         return await message.reply_text("This user isn't here.")
     user, warns = await asyncio.gather(
     user, warns = await asyncio.gather(
-        app.get_users(user_id), get_warn(chat_id, await int_to_alpha(user_id))
+        app.get_users(user_id),
+        get_warn(chat_id, await int_to_alpha(user_id)),
     )
     )
     mention = user.mention
     mention = user.mention
     keyboard = ikb([[("🚨  Remove Warn  🚨", f"unwarn_{user_id}")]])
     keyboard = ikb([[("🚨  Remove Warn  🚨", f"unwarn_{user_id}")]])
@@ -498,19 +536,25 @@ async def remove_warnings(_, message: Message):
 # Warns
 # Warns
 
 
 
 
-@app.on_message(filters.command("warns") & ~filters.edited & ~filters.private)
+@app.on_message(
+    filters.command("warns") & ~filters.edited & ~filters.private
+)
 @capture_err
 @capture_err
 async def check_warns(_, message: Message):
 async def check_warns(_, message: Message):
     user_id = await extract_user(message)
     user_id = await extract_user(message)
     if not user_id:
     if not user_id:
         return await message.reply_text("I can't find that user.")
         return await message.reply_text("I can't find that user.")
-    warns = await get_warn(message.chat.id, await int_to_alpha(user_id))
+    warns = await get_warn(
+        message.chat.id, await int_to_alpha(user_id)
+    )
     mention = (await app.get_users(user_id)).mention
     mention = (await app.get_users(user_id)).mention
     if warns:
     if warns:
         warns = warns["warns"]
         warns = warns["warns"]
     else:
     else:
         return await message.reply_text(f"{mention} has no warnings.")
         return await message.reply_text(f"{mention} has no warnings.")
-    return await message.reply_text(f"{mention} has {warns}/3 warnings.")
+    return await message.reply_text(
+        f"{mention} has {warns}/3 warnings."
+    )
 
 
 
 
 # Report
 # Report
@@ -524,7 +568,9 @@ async def check_warns(_, message: Message):
 @capture_err
 @capture_err
 async def report_user(_, message):
 async def report_user(_, message):
     if not message.reply_to_message:
     if not message.reply_to_message:
-        return await message.reply_text("Reply to a message to report user.")
+        return await message.reply_text(
+            "Reply to a message to report user."
+        )
     list_of_admins = await list_admins(message.chat.id)
     list_of_admins = await list_admins(message.chat.id)
     user_mention = message.reply_to_message.from_user.mention
     user_mention = message.reply_to_message.from_user.mention
     text = f"Reported {user_mention} to admins."
     text = f"Reported {user_mention} to admins."

+ 3 - 1
wbb/modules/admin_misc.py

@@ -40,7 +40,9 @@ __HELP__ = """
 @adminsOnly("can_change_info")
 @adminsOnly("can_change_info")
 async def set_chat_title(_, message):
 async def set_chat_title(_, message):
     if len(message.command) < 2:
     if len(message.command) < 2:
-        return await message.reply_text("**Usage:**\n/set_chat_title NEW NAME")
+        return await message.reply_text(
+            "**Usage:**\n/set_chat_title NEW NAME"
+        )
     old_title = message.chat.title
     old_title = message.chat.title
     new_title = message.text.split(None, 1)[1]
     new_title = message.text.split(None, 1)[1]
     await message.chat.set_title(new_title)
     await message.chat.set_title(new_title)

+ 2 - 1
wbb/modules/alive.py

@@ -28,7 +28,8 @@ from wbb import BOT_ID, SUDOERS, USERBOT_PREFIX, app2
 
 
 
 
 @app2.on_message(
 @app2.on_message(
-    filters.command("alive", prefixes=USERBOT_PREFIX) & filters.user(SUDOERS)
+    filters.command("alive", prefixes=USERBOT_PREFIX)
+    & filters.user(SUDOERS)
 )
 )
 async def alive_command_func(_, message):
 async def alive_command_func(_, message):
     await message.delete()
     await message.delete()

+ 23 - 12
wbb/modules/anime.py

@@ -22,7 +22,9 @@ def shorten(description, info="anilist.co"):
     ms_g = ""
     ms_g = ""
     if len(description) > 700:
     if len(description) > 700:
         description = description[0:500] + "...."
         description = description[0:500] + "...."
-        ms_g += f"\n**Description**: __{description}__[More here]({info})"
+        ms_g += (
+            f"\n**Description**: __{description}__[More here]({info})"
+        )
     else:
     else:
         ms_g += f"\n**Description**: __{description}__"
         ms_g += f"\n**Description**: __{description}__"
     return (
     return (
@@ -177,7 +179,9 @@ def format_bytes(size):
 
 
 def return_progress_string(current, total):
 def return_progress_string(current, total):
     filled_length = int(30 * current // total)
     filled_length = int(30 * current // total)
-    return "[" + "=" * filled_length + " " * (30 - filled_length) + "]"
+    return (
+        "[" + "=" * filled_length + " " * (30 - filled_length) + "]"
+    )
 
 
 
 
 def calculate_eta(current, total, start_time):
 def calculate_eta(current, total, start_time):
@@ -186,9 +190,9 @@ def calculate_eta(current, total, start_time):
     end_time = time.time()
     end_time = time.time()
     elapsed_time = end_time - start_time
     elapsed_time = end_time - start_time
     seconds = (elapsed_time * (total / current)) - elapsed_time
     seconds = (elapsed_time * (total / current)) - elapsed_time
-    thing = "".join(str(timedelta(seconds=seconds)).split(".")[:-1]).split(
-        ", "
-    )
+    thing = "".join(
+        str(timedelta(seconds=seconds)).split(".")[:-1]
+    ).split(", ")
     thing[-1] = thing[-1].rjust(8, "0")
     thing[-1] = thing[-1].rjust(8, "0")
     return ", ".join(thing)
     return ", ".join(thing)
 
 
@@ -205,7 +209,9 @@ async def anime_search(_, message):
     search = message.text.split(None, 1)[1]
     search = message.text.split(None, 1)[1]
     variables = {"search": search}
     variables = {"search": search}
     json = (
     json = (
-        requests.post(url, json={"query": anime_query, "variables": variables})
+        requests.post(
+            url, json={"query": anime_query, "variables": variables}
+        )
         .json()["data"]
         .json()["data"]
         .get("Media", None)
         .get("Media", None)
     )
     )
@@ -232,7 +238,9 @@ async def anime_search(_, message):
             .replace("<br>", "")
             .replace("<br>", "")
         )
         )
         msg += shorten(description, info)
         msg += shorten(description, info)
-        image = info.replace("anilist.co/anime/", "img.anili.st/media/")
+        image = info.replace(
+            "anilist.co/anime/", "img.anili.st/media/"
+        )
         if trailer:
         if trailer:
             buttons = [
             buttons = [
                 [
                 [
@@ -265,15 +273,17 @@ async def manga_search(_, message):
     search = message.text.split(None, 1)[1]
     search = message.text.split(None, 1)[1]
     variables = {"search": search}
     variables = {"search": search}
     json = (
     json = (
-        requests.post(url, json={"query": manga_query, "variables": variables})
+        requests.post(
+            url, json={"query": manga_query, "variables": variables}
+        )
         .json()["data"]
         .json()["data"]
         .get("Media", None)
         .get("Media", None)
     )
     )
     ms_g = ""
     ms_g = ""
     if json:
     if json:
-        title, title_native = json["title"].get("romaji", False), json[
-            "title"
-        ].get("native", False)
+        title, title_native = json["title"].get(
+            "romaji", False
+        ), json["title"].get("native", False)
         start_date, status, score = (
         start_date, status, score = (
             json["startDate"].get("year", False),
             json["startDate"].get("year", False),
             json.get("status", False),
             json.get("status", False),
@@ -316,7 +326,8 @@ async def character_search(_, message):
     variables = {"query": search}
     variables = {"query": search}
     json = (
     json = (
         requests.post(
         requests.post(
-            url, json={"query": character_query, "variables": variables}
+            url,
+            json={"query": character_query, "variables": variables},
         )
         )
         .json()["data"]
         .json()["data"]
         .get("Character", None)
         .get("Character", None)

+ 3 - 1
wbb/modules/arq.py

@@ -56,4 +56,6 @@ async def arq_stats(_, message):
 **Bot:** {bot}
 **Bot:** {bot}
 **Address:** {ARQ_API_URL}
 **Address:** {ARQ_API_URL}
 """
 """
-    await message.reply_text(statistics, disable_web_page_preview=True)
+    await message.reply_text(
+        statistics, disable_web_page_preview=True
+    )

+ 21 - 7
wbb/modules/blacklist.py

@@ -49,7 +49,9 @@ __HELP__ = """
 @adminsOnly("can_restrict_members")
 @adminsOnly("can_restrict_members")
 async def save_filters(_, message):
 async def save_filters(_, message):
     if len(message.command) < 2:
     if len(message.command) < 2:
-        return await message.reply_text("Usage:\n/blacklist [WORD|SENTENCE]")
+        return await message.reply_text(
+            "Usage:\n/blacklist [WORD|SENTENCE]"
+        )
     word = message.text.split(None, 1)[1].strip()
     word = message.text.split(None, 1)[1].strip()
     if not word:
     if not word:
         return await message.reply_text(
         return await message.reply_text(
@@ -61,13 +63,17 @@ async def save_filters(_, message):
 
 
 
 
 @app.on_message(
 @app.on_message(
-    filters.command("blacklisted") & ~filters.edited & ~filters.private
+    filters.command("blacklisted")
+    & ~filters.edited
+    & ~filters.private
 )
 )
 @capture_err
 @capture_err
 async def get_filterss(_, message):
 async def get_filterss(_, message):
     data = await get_blacklisted_words(message.chat.id)
     data = await get_blacklisted_words(message.chat.id)
     if not data:
     if not data:
-        await message.reply_text("**No blacklisted words in this chat.**")
+        await message.reply_text(
+            "**No blacklisted words in this chat.**"
+        )
     else:
     else:
         msg = f"List of blacklisted words in {message.chat.title}\n"
         msg = f"List of blacklisted words in {message.chat.title}\n"
         for word in data:
         for word in data:
@@ -81,10 +87,14 @@ async def get_filterss(_, message):
 @adminsOnly("can_restrict_members")
 @adminsOnly("can_restrict_members")
 async def del_filter(_, message):
 async def del_filter(_, message):
     if len(message.command) < 2:
     if len(message.command) < 2:
-        return await message.reply_text("Usage:\n/whitelist [WORD|SENTENCE]")
+        return await message.reply_text(
+            "Usage:\n/whitelist [WORD|SENTENCE]"
+        )
     word = message.text.split(None, 1)[1].strip()
     word = message.text.split(None, 1)[1].strip()
     if not word:
     if not word:
-        return await message.reply_text("Usage:\n/whitelist [WORD|SENTENCE]")
+        return await message.reply_text(
+            "Usage:\n/whitelist [WORD|SENTENCE]"
+        )
     chat_id = message.chat.id
     chat_id = message.chat.id
     deleted = await delete_blacklist_filter(chat_id, word)
     deleted = await delete_blacklist_filter(chat_id, word)
     if deleted:
     if deleted:
@@ -92,7 +102,9 @@ async def del_filter(_, message):
     await message.reply_text("**No such blacklist filter.**")
     await message.reply_text("**No such blacklist filter.**")
 
 
 
 
-@app.on_message(filters.text & ~filters.private, group=blacklist_filters_group)
+@app.on_message(
+    filters.text & ~filters.private, group=blacklist_filters_group
+)
 @capture_err
 @capture_err
 async def blacklist_filters_re(_, message):
 async def blacklist_filters_re(_, message):
     text = message.text.lower().strip()
     text = message.text.lower().strip()
@@ -111,7 +123,9 @@ async def blacklist_filters_re(_, message):
             if user.id in await list_admins(chat_id):
             if user.id in await list_admins(chat_id):
                 return
                 return
             try:
             try:
-                await message.chat.restrict_member(user.id, ChatPermissions())
+                await message.chat.restrict_member(
+                    user.id, ChatPermissions()
+                )
             except Exception:
             except Exception:
                 return
                 return
             await app.send_message(
             await app.send_message(

+ 15 - 5
wbb/modules/blacklist_chat.py

@@ -19,7 +19,9 @@ in which you don't want it to be in.
 """
 """
 
 
 
 
-@app.on_message(filters.command("blacklist_chat") & filters.user(SUDOERS))
+@app.on_message(
+    filters.command("blacklist_chat") & filters.user(SUDOERS)
+)
 @capture_err
 @capture_err
 async def blacklist_chat_func(_, message: Message):
 async def blacklist_chat_func(_, message: Message):
     if len(message.command) != 2:
     if len(message.command) != 2:
@@ -28,7 +30,9 @@ async def blacklist_chat_func(_, message: Message):
         )
         )
     chat_id = int(message.text.strip().split()[1])
     chat_id = int(message.text.strip().split()[1])
     if chat_id in await blacklisted_chats():
     if chat_id in await blacklisted_chats():
-        return await message.reply_text("Chat is already blacklisted.")
+        return await message.reply_text(
+            "Chat is already blacklisted."
+        )
     blacklisted = await blacklist_chat(chat_id)
     blacklisted = await blacklist_chat(chat_id)
     if blacklisted:
     if blacklisted:
         return await message.reply_text(
         return await message.reply_text(
@@ -37,7 +41,9 @@ async def blacklist_chat_func(_, message: Message):
     await message.reply_text("Something wrong happened, check logs.")
     await message.reply_text("Something wrong happened, check logs.")
 
 
 
 
-@app.on_message(filters.command("whitelist_chat") & filters.user(SUDOERS))
+@app.on_message(
+    filters.command("whitelist_chat") & filters.user(SUDOERS)
+)
 @capture_err
 @capture_err
 async def whitelist_chat_func(_, message: Message):
 async def whitelist_chat_func(_, message: Message):
     if len(message.command) != 2:
     if len(message.command) != 2:
@@ -46,7 +52,9 @@ async def whitelist_chat_func(_, message: Message):
         )
         )
     chat_id = int(message.text.strip().split()[1])
     chat_id = int(message.text.strip().split()[1])
     if chat_id not in await blacklisted_chats():
     if chat_id not in await blacklisted_chats():
-        return await message.reply_text("Chat is already whitelisted.")
+        return await message.reply_text(
+            "Chat is already whitelisted."
+        )
     whitelisted = await whitelist_chat(chat_id)
     whitelisted = await whitelist_chat(chat_id)
     if whitelisted:
     if whitelisted:
         return await message.reply_text(
         return await message.reply_text(
@@ -55,7 +63,9 @@ async def whitelist_chat_func(_, message: Message):
     await message.reply_text("Something wrong happened, check logs.")
     await message.reply_text("Something wrong happened, check logs.")
 
 
 
 
-@app.on_message(filters.command("blacklisted_chats") & filters.user(SUDOERS))
+@app.on_message(
+    filters.command("blacklisted_chats") & filters.user(SUDOERS)
+)
 @capture_err
 @capture_err
 async def blacklisted_chats_func(_, message: Message):
 async def blacklisted_chats_func(_, message: Message):
     text = ""
     text = ""

+ 14 - 6
wbb/modules/chatbot.py

@@ -26,8 +26,8 @@ from asyncio import gather, sleep
 from pyrogram import filters
 from pyrogram import filters
 from pyrogram.types import Message
 from pyrogram.types import Message
 
 
-from wbb import (BOT_ID, SUDOERS, USERBOT_ID, USERBOT_PREFIX, USERBOT_USERNAME,
-                 app, app2, arq)
+from wbb import (BOT_ID, SUDOERS, USERBOT_ID, USERBOT_PREFIX,
+                 USERBOT_USERNAME, app, app2, arq)
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.errors import capture_err
 from wbb.modules.userbot import edit_or_reply
 from wbb.modules.userbot import edit_or_reply
 from wbb.utils.filter_groups import chatbot_group
 from wbb.utils.filter_groups import chatbot_group
@@ -52,14 +52,22 @@ async def chat_bot_toggle(db, message: Message):
                 + "Of Mine To Get A Reply"
                 + "Of Mine To Get A Reply"
             )
             )
             return await edit_or_reply(message, text=text)
             return await edit_or_reply(message, text=text)
-        await edit_or_reply(message, text="ChatBot Is Already Enabled.")
+        await edit_or_reply(
+            message, text="ChatBot Is Already Enabled."
+        )
     elif status == "off":
     elif status == "off":
         if chat_id in db:
         if chat_id in db:
             db.remove(chat_id)
             db.remove(chat_id)
-            return await edit_or_reply(message, text="Chatbot Disabled!")
-        await edit_or_reply(message, text="ChatBot Is Already Disabled.")
+            return await edit_or_reply(
+                message, text="Chatbot Disabled!"
+            )
+        await edit_or_reply(
+            message, text="ChatBot Is Already Disabled."
+        )
     else:
     else:
-        await edit_or_reply(message, text="**Usage**\n/chatbot [ON|OFF]")
+        await edit_or_reply(
+            message, text="**Usage**\n/chatbot [ON|OFF]"
+        )
 
 
 
 
 # Enabled | Disable Chatbot
 # Enabled | Disable Chatbot

+ 3 - 1
wbb/modules/couple.py

@@ -61,7 +61,9 @@ tomorrow = str(dt_tom())
 @capture_err
 @capture_err
 async def couple(_, message):
 async def couple(_, message):
     if message.chat.type == "private":
     if message.chat.type == "private":
-        return await message.reply_text("This command only works in groups.")
+        return await message.reply_text(
+            "This command only works in groups."
+        )
     try:
     try:
         chat_id = message.chat.id
         chat_id = message.chat.id
         is_selected = await get_couple(chat_id, today)
         is_selected = await get_couple(chat_id, today)

+ 19 - 7
wbb/modules/devs.py

@@ -15,7 +15,8 @@ from io import StringIO
 from time import time
 from time import time
 
 
 from pyrogram import filters
 from pyrogram import filters
-from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
+from pyrogram.types import (InlineKeyboardButton,
+                            InlineKeyboardMarkup, Message)
 
 
 from wbb import SUDOERS, app
 from wbb import SUDOERS, app
 
 
@@ -82,7 +83,8 @@ async def executor(client, message):
             [
             [
                 [
                 [
                     InlineKeyboardButton(
                     InlineKeyboardButton(
-                        text="⏳", callback_data=f"runtime {t2-t1} Seconds"
+                        text="⏳",
+                        callback_data=f"runtime {t2-t1} Seconds",
                     )
                     )
                 ]
                 ]
             ]
             ]
@@ -107,7 +109,9 @@ async def executor(client, message):
                 ]
                 ]
             ]
             ]
         )
         )
-        await edit_or_reply(message, text=final_output, reply_markup=keyboard)
+        await edit_or_reply(
+            message, text=final_output, reply_markup=keyboard
+        )
 
 
 
 
 @app.on_callback_query(filters.regex(r"runtime"))
 @app.on_callback_query(filters.regex(r"runtime"))
@@ -125,13 +129,17 @@ async def runtime_func_cq(_, cq):
 )
 )
 async def shellrunner(client, message):
 async def shellrunner(client, message):
     if len(message.command) < 2:
     if len(message.command) < 2:
-        return await edit_or_reply(message, text="**Usage:**\n/sh git pull")
+        return await edit_or_reply(
+            message, text="**Usage:**\n/sh git pull"
+        )
     text = message.text.split(None, 1)[1]
     text = message.text.split(None, 1)[1]
     if "\n" in text:
     if "\n" in text:
         code = text.split("\n")
         code = text.split("\n")
         output = ""
         output = ""
         for x in code:
         for x in code:
-            shell = re.split(""" (?=(?:[^'"]|'[^']*'|"[^"]*")*$)""", x)
+            shell = re.split(
+                """ (?=(?:[^'"]|'[^']*'|"[^"]*")*$)""", x
+            )
             try:
             try:
                 process = subprocess.Popen(
                 process = subprocess.Popen(
                     shell,
                     shell,
@@ -140,7 +148,9 @@ async def shellrunner(client, message):
                 )
                 )
             except Exception as err:
             except Exception as err:
                 print(err)
                 print(err)
-                await edit_or_reply(message, text=f"**ERROR:**\n```{err}```")
+                await edit_or_reply(
+                    message, text=f"**ERROR:**\n```{err}```"
+                )
             output += f"**{code}**\n"
             output += f"**{code}**\n"
             output += process.stdout.read()[:-1].decode("utf-8")
             output += process.stdout.read()[:-1].decode("utf-8")
             output += "\n"
             output += "\n"
@@ -179,6 +189,8 @@ async def shellrunner(client, message):
                 caption="`Output`",
                 caption="`Output`",
             )
             )
             return os.remove("output.txt")
             return os.remove("output.txt")
-        await edit_or_reply(message, text=f"**OUTPUT:**\n```{output}```")
+        await edit_or_reply(
+            message, text=f"**OUTPUT:**\n```{output}```"
+        )
     else:
     else:
         await edit_or_reply(message, text="**OUTPUT: **\n`No output`")
         await edit_or_reply(message, text="**OUTPUT: **\n`No output`")

+ 18 - 6
wbb/modules/filters.py

@@ -41,7 +41,9 @@ __HELP__ = """/filters To Get All The Filters In The Chat.
 You can use markdown or html to save text too."""
 You can use markdown or html to save text too."""
 
 
 
 
-@app.on_message(filters.command("filter") & ~filters.edited & ~filters.private)
+@app.on_message(
+    filters.command("filter") & ~filters.edited & ~filters.private
+)
 @adminsOnly("can_change_info")
 @adminsOnly("can_change_info")
 async def save_filters(_, message):
 async def save_filters(_, message):
     if len(message.command) < 2 or not message.reply_to_message:
     if len(message.command) < 2 or not message.reply_to_message:
@@ -57,7 +59,9 @@ async def save_filters(_, message):
         )
         )
     name = message.text.split(None, 1)[1].strip()
     name = message.text.split(None, 1)[1].strip()
     if not name:
     if not name:
-        return await message.reply_text("**Usage**\n__/filter [FILTER_NAME]__")
+        return await message.reply_text(
+            "**Usage**\n__/filter [FILTER_NAME]__"
+        )
     chat_id = message.chat.id
     chat_id = message.chat.id
     _type = "text" if message.reply_to_message.text else "sticker"
     _type = "text" if message.reply_to_message.text else "sticker"
     _filter = {
     _filter = {
@@ -85,14 +89,20 @@ async def get_filterss(_, message):
         await message.reply_text(msg)
         await message.reply_text(msg)
 
 
 
 
-@app.on_message(filters.command("stop") & ~filters.edited & ~filters.private)
+@app.on_message(
+    filters.command("stop") & ~filters.edited & ~filters.private
+)
 @adminsOnly("can_change_info")
 @adminsOnly("can_change_info")
 async def del_filter(_, message):
 async def del_filter(_, message):
     if len(message.command) < 2:
     if len(message.command) < 2:
-        return await message.reply_text("**Usage**\n__/stop [FILTER_NAME]__")
+        return await message.reply_text(
+            "**Usage**\n__/stop [FILTER_NAME]__"
+        )
     name = message.text.split(None, 1)[1].strip()
     name = message.text.split(None, 1)[1].strip()
     if not name:
     if not name:
-        return await message.reply_text("**Usage**\n__/stop [FILTER_NAME]__")
+        return await message.reply_text(
+            "**Usage**\n__/stop [FILTER_NAME]__"
+        )
     chat_id = message.chat.id
     chat_id = message.chat.id
     deleted = await delete_filter(chat_id, name)
     deleted = await delete_filter(chat_id, name)
     if deleted:
     if deleted:
@@ -130,7 +140,9 @@ async def filters_re(_, message):
                     if text[0] == "~":
                     if text[0] == "~":
                         return await message.delete()
                         return await message.delete()
                     return
                     return
-                await message.reply_text(data, disable_web_page_preview=True)
+                await message.reply_text(
+                    data, disable_web_page_preview=True
+                )
             else:
             else:
                 if message.reply_to_message:
                 if message.reply_to_message:
                     await message.reply_to_message.reply_sticker(data)
                     await message.reply_to_message.reply_sticker(data)

+ 8 - 4
wbb/modules/flood.py

@@ -21,13 +21,13 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
 SOFTWARE.
 """
 """
-from asyncio import sleep, get_running_loop
+from asyncio import get_running_loop, sleep
 from time import time
 from time import time
 
 
 from pyrogram import filters
 from pyrogram import filters
 from pyrogram.types import (CallbackQuery, ChatPermissions,
 from pyrogram.types import (CallbackQuery, ChatPermissions,
-                            InlineKeyboardButton, InlineKeyboardMarkup,
-                            Message)
+                            InlineKeyboardButton,
+                            InlineKeyboardMarkup, Message)
 
 
 from wbb import SUDOERS, app
 from wbb import SUDOERS, app
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.errors import capture_err
@@ -111,12 +111,14 @@ async def flood_control_func(_, message: Message):
             f"Imagine flooding the chat in front of me, Muted {mention} for an hour!",
             f"Imagine flooding the chat in front of me, Muted {mention} for an hour!",
             reply_markup=keyboard,
             reply_markup=keyboard,
         )
         )
+
         async def delete():
         async def delete():
             await sleep(3600)
             await sleep(3600)
             try:
             try:
                 await m.delete()
                 await m.delete()
             except Exception:
             except Exception:
                 pass
                 pass
+
         loop = get_running_loop()
         loop = get_running_loop()
         return loop.create_task(delete())
         return loop.create_task(delete())
     DB[chat_id][user_id] += 1
     DB[chat_id][user_id] += 1
@@ -125,7 +127,9 @@ async def flood_control_func(_, message: Message):
 @app.on_callback_query(filters.regex("unmute_"))
 @app.on_callback_query(filters.regex("unmute_"))
 async def flood_callback_func(_, cq: CallbackQuery):
 async def flood_callback_func(_, cq: CallbackQuery):
     from_user = cq.from_user
     from_user = cq.from_user
-    permissions = await member_permissions(cq.message.chat.id, from_user.id)
+    permissions = await member_permissions(
+        cq.message.chat.id, from_user.id
+    )
     permission = "can_restrict_members"
     permission = "can_restrict_members"
     if permission not in permissions:
     if permission not in permissions:
         return await cq.answer(
         return await cq.answer(

+ 5 - 2
wbb/modules/global_stats.py

@@ -32,7 +32,8 @@ from wbb.utils.dbfunctions import (get_blacklist_filters_count,
                                    get_filters_count, get_gbans_count,
                                    get_filters_count, get_gbans_count,
                                    get_karmas_count, get_notes_count,
                                    get_karmas_count, get_notes_count,
                                    get_served_chats, get_served_users,
                                    get_served_chats, get_served_users,
-                                   get_warns_count, remove_served_chat)
+                                   get_warns_count,
+                                   remove_served_chat)
 from wbb.utils.fetch import fetch
 from wbb.utils.fetch import fetch
 from wbb.utils.inlinefuncs import keywords_list
 from wbb.utils.inlinefuncs import keywords_list
 
 
@@ -40,7 +41,9 @@ from wbb.utils.inlinefuncs import keywords_list
 
 
 
 
 @app.on_message(
 @app.on_message(
-    filters.command("gstats") & filters.user(SUDOERS) & ~filters.edited
+    filters.command("gstats")
+    & filters.user(SUDOERS)
+    & ~filters.edited
 )
 )
 @capture_err
 @capture_err
 async def global_stats(_, message):
 async def global_stats(_, message):

+ 29 - 13
wbb/modules/greetings.py

@@ -29,17 +29,18 @@ from random import shuffle
 
 
 from pykeyboard import InlineKeyboard
 from pykeyboard import InlineKeyboard
 from pyrogram import filters
 from pyrogram import filters
-from pyrogram.errors.exceptions.bad_request_400 import (ChatAdminRequired,
-                                                        UserNotParticipant)
+from pyrogram.errors.exceptions.bad_request_400 import (
+    ChatAdminRequired, UserNotParticipant)
 from pyrogram.types import (ChatPermissions, InlineKeyboardButton,
 from pyrogram.types import (ChatPermissions, InlineKeyboardButton,
                             InlineKeyboardMarkup, Message, User)
                             InlineKeyboardMarkup, Message, User)
 
 
 from wbb import SUDOERS, WELCOME_DELAY_KICK_SEC, app
 from wbb import SUDOERS, WELCOME_DELAY_KICK_SEC, app
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.permissions import adminsOnly
 from wbb.core.decorators.permissions import adminsOnly
-from wbb.utils.dbfunctions import (captcha_off, captcha_on, del_welcome,
-                                   get_captcha_cache, get_welcome,
-                                   is_captcha_on, is_gbanned_user, set_welcome,
+from wbb.utils.dbfunctions import (captcha_off, captcha_on,
+                                   del_welcome, get_captcha_cache,
+                                   get_welcome, is_captcha_on,
+                                   is_gbanned_user, set_welcome,
                                    update_captcha_cache)
                                    update_captcha_cache)
 from wbb.utils.filter_groups import welcome_captcha_group
 from wbb.utils.filter_groups import welcome_captcha_group
 from wbb.utils.functions import generate_captcha
 from wbb.utils.functions import generate_captcha
@@ -111,7 +112,9 @@ async def welcome(_, message: Message):
                 continue
                 continue
             if member.is_bot:
             if member.is_bot:
                 continue  # ignore bots
                 continue  # ignore bots
-            await message.chat.restrict_member(member.id, ChatPermissions())
+            await message.chat.restrict_member(
+                member.id, ChatPermissions()
+            )
             text = (
             text = (
                 f"{(member.mention())} Are you human?\n"
                 f"{(member.mention())} Are you human?\n"
                 f"Solve this captcha in {WELCOME_DELAY_KICK_SEC} seconds and 4 attempts or you'll be kicked."
                 f"Solve this captcha in {WELCOME_DELAY_KICK_SEC} seconds and 4 attempts or you'll be kicked."
@@ -194,7 +197,9 @@ async def send_welcome_message(callback_query, pending_user_id):
     text = raw_text.split("~")[0].strip()
     text = raw_text.split("~")[0].strip()
     buttons_text_list = raw_text.split("~")[1].strip().splitlines()
     buttons_text_list = raw_text.split("~")[1].strip().splitlines()
     if "{chat}" in text:
     if "{chat}" in text:
-        text = text.replace("{chat}", callback_query.message.chat.title)
+        text = text.replace(
+            "{chat}", callback_query.message.chat.title
+        )
     if "{name}" in text:
     if "{name}" in text:
         text = text.replace(
         text = text.replace(
             "{name}", (await app.get_users(pending_user_id)).mention
             "{name}", (await app.get_users(pending_user_id)).mention
@@ -251,9 +256,13 @@ async def callback_query_welcome_button(_, callback_query):
                     attempts = iii["attempts"]
                     attempts = iii["attempts"]
                     if attempts >= 3:
                     if attempts >= 3:
                         answers_dicc.remove(iii)
                         answers_dicc.remove(iii)
-                        await button_message.chat.kick_member(pending_user_id)
+                        await button_message.chat.kick_member(
+                            pending_user_id
+                        )
                         await asyncio.sleep(1)
                         await asyncio.sleep(1)
-                        await button_message.chat.unban_member(pending_user_id)
+                        await button_message.chat.unban_member(
+                            pending_user_id
+                        )
                         await button_message.delete()
                         await button_message.delete()
                         await update_captcha_cache(answers_dicc)
                         await update_captcha_cache(answers_dicc)
                         return
                         return
@@ -266,7 +275,8 @@ async def callback_query_welcome_button(_, callback_query):
             shuffle(keyboard)
             shuffle(keyboard)
             keyboard = InlineKeyboardMarkup(keyboard)
             keyboard = InlineKeyboardMarkup(keyboard)
             await button_message.edit(
             await button_message.edit(
-                text=button_message.caption.markdown, reply_markup=keyboard
+                text=button_message.caption.markdown,
+                reply_markup=keyboard,
             )
             )
             return
             return
         await callback_query.answer("Captcha passed successfully!")
         await callback_query.answer("Captcha passed successfully!")
@@ -306,7 +316,9 @@ async def kick_restricted_after_delay(
             if i["user_id"] == user_id:
             if i["user_id"] == user_id:
                 answers_dicc.remove(i)
                 answers_dicc.remove(i)
                 await update_captcha_cache(answers_dicc)
                 await update_captcha_cache(answers_dicc)
-    await _ban_restricted_user_until_date(group_chat, user_id, duration=delay)
+    await _ban_restricted_user_until_date(
+        group_chat, user_id, duration=delay
+    )
 
 
 
 
 async def _ban_restricted_user_until_date(
 async def _ban_restricted_user_until_date(
@@ -316,7 +328,9 @@ async def _ban_restricted_user_until_date(
         member = await group_chat.get_member(user_id)
         member = await group_chat.get_member(user_id)
         if member.status == "restricted":
         if member.status == "restricted":
             until_date = int(datetime.utcnow().timestamp() + duration)
             until_date = int(datetime.utcnow().timestamp() + duration)
-            await group_chat.kick_member(user_id, until_date=until_date)
+            await group_chat.kick_member(
+                user_id, until_date=until_date
+            )
     except UserNotParticipant:
     except UserNotParticipant:
         pass
         pass
 
 
@@ -357,7 +371,9 @@ async def set_welcome_func(_, message):
     chat_id = message.chat.id
     chat_id = message.chat.id
     raw_text = str(message.reply_to_message.text.markdown)
     raw_text = str(message.reply_to_message.text.markdown)
     await set_welcome(chat_id, raw_text)
     await set_welcome(chat_id, raw_text)
-    await message.reply_text("Welcome message has been successfully set.")
+    await message.reply_text(
+        "Welcome message has been successfully set."
+    )
 
 
 
 
 @app.on_message(filters.command("del_welcome") & ~filters.private)
 @app.on_message(filters.command("del_welcome") & ~filters.private)

+ 15 - 5
wbb/modules/info.py

@@ -60,7 +60,9 @@ async def get_user_info(user):
         else "Uncertain"
         else "Uncertain"
     )
     )
     spam_probab = (
     spam_probab = (
-        str(round(spam_probab)) + " %" if spam_probab != 0 else "Uncertain"
+        str(round(spam_probab)) + " %"
+        if spam_probab != 0
+        else "Uncertain"
     )
     )
     caption = f"""
     caption = f"""
 **ID:** `{user_id}`
 **ID:** `{user_id}`
@@ -122,9 +124,13 @@ async def info_func(_, message: Message):
     except Exception as e:
     except Exception as e:
         return await m.edit(str(e))
         return await m.edit(str(e))
     if not photo_id:
     if not photo_id:
-        return await m.edit(info_caption, disable_web_page_preview=True)
+        return await m.edit(
+            info_caption, disable_web_page_preview=True
+        )
     photo = await app.download_media(photo_id)
     photo = await app.download_media(photo_id)
-    await message.reply_photo(photo, caption=info_caption, quote=False)
+    await message.reply_photo(
+        photo, caption=info_caption, quote=False
+    )
     await m.delete()
     await m.delete()
     os.remove(photo)
     os.remove(photo)
 
 
@@ -144,9 +150,13 @@ async def chat_info_func(_, message: Message):
         m = await message.reply_text("Processing")
         m = await message.reply_text("Processing")
         info_caption, photo_id = await get_chat_info(chat)
         info_caption, photo_id = await get_chat_info(chat)
         if not photo_id:
         if not photo_id:
-            return await m.edit(info_caption, disable_web_page_preview=True)
+            return await m.edit(
+                info_caption, disable_web_page_preview=True
+            )
         photo = await app.download_media(photo_id)
         photo = await app.download_media(photo_id)
-        await message.reply_photo(photo, caption=info_caption, quote=False)
+        await message.reply_photo(
+            photo, caption=info_caption, quote=False
+        )
         await m.delete()
         await m.delete()
         os.remove(photo)
         os.remove(photo)
     except Exception as e:
     except Exception as e:

+ 6 - 2
wbb/modules/inline.py

@@ -145,7 +145,9 @@ async def inline_query_handler(client, query):
                 )
                 )
             tex = text.split(None, 1)[1].strip()
             tex = text.split(None, 1)[1].strip()
             answerss = await youtube_func(answers, tex)
             answerss = await youtube_func(answers, tex)
-            await client.answer_inline_query(query.id, results=answerss)
+            await client.answer_inline_query(
+                query.id, results=answerss
+            )
 
 
         elif text.split()[0] == "lyrics":
         elif text.split()[0] == "lyrics":
             if len(text.split()) < 2:
             if len(text.split()) < 2:
@@ -157,7 +159,9 @@ async def inline_query_handler(client, query):
                 )
                 )
             tex = text.split(None, 1)[1].strip()
             tex = text.split(None, 1)[1].strip()
             answerss = await lyrics_func(answers, tex)
             answerss = await lyrics_func(answers, tex)
-            await client.answer_inline_query(query.id, results=answerss)
+            await client.answer_inline_query(
+                query.id, results=answerss
+            )
 
 
         elif text.split()[0] == "gh_user":
         elif text.split()[0] == "gh_user":
             if len(text.split()) < 2:
             if len(text.split()) < 2:

+ 30 - 12
wbb/modules/karma.py

@@ -29,10 +29,12 @@ from pyrogram import filters
 from wbb import app
 from wbb import app
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.permissions import adminsOnly
 from wbb.core.decorators.permissions import adminsOnly
-from wbb.utils.dbfunctions import (alpha_to_int, get_karma, get_karmas,
-                                   int_to_alpha, is_karma_on, karma_off,
-                                   karma_on, update_karma)
-from wbb.utils.filter_groups import karma_negative_group, karma_positive_group
+from wbb.utils.dbfunctions import (alpha_to_int, get_karma,
+                                   get_karmas, int_to_alpha,
+                                   is_karma_on, karma_off, karma_on,
+                                   update_karma)
+from wbb.utils.filter_groups import (karma_negative_group,
+                                     karma_positive_group)
 
 
 __MODULE__ = "Karma"
 __MODULE__ = "Karma"
 __HELP__ = """[UPVOTE] - Use upvote keywords like "+", "+1", "thanks" etc to upvote a message.
 __HELP__ = """[UPVOTE] - Use upvote keywords like "+", "+1", "thanks" etc to upvote a message.
@@ -70,16 +72,22 @@ async def upvote(_, message):
     chat_id = message.chat.id
     chat_id = message.chat.id
     user_id = message.reply_to_message.from_user.id
     user_id = message.reply_to_message.from_user.id
     user_mention = message.reply_to_message.from_user.mention
     user_mention = message.reply_to_message.from_user.mention
-    current_karma = await get_karma(chat_id, await int_to_alpha(user_id))
+    current_karma = await get_karma(
+        chat_id, await int_to_alpha(user_id)
+    )
     if current_karma:
     if current_karma:
         current_karma = current_karma["karma"]
         current_karma = current_karma["karma"]
         karma = current_karma + 1
         karma = current_karma + 1
         new_karma = {"karma": karma}
         new_karma = {"karma": karma}
-        await update_karma(chat_id, await int_to_alpha(user_id), new_karma)
+        await update_karma(
+            chat_id, await int_to_alpha(user_id), new_karma
+        )
     else:
     else:
         karma = 1
         karma = 1
         new_karma = {"karma": karma}
         new_karma = {"karma": karma}
-        await update_karma(chat_id, await int_to_alpha(user_id), new_karma)
+        await update_karma(
+            chat_id, await int_to_alpha(user_id), new_karma
+        )
     await message.reply_text(
     await message.reply_text(
         f"Incremented Karma of {user_mention} By 1 \nTotal Points: {karma}"
         f"Incremented Karma of {user_mention} By 1 \nTotal Points: {karma}"
     )
     )
@@ -110,16 +118,22 @@ async def downvote(_, message):
     chat_id = message.chat.id
     chat_id = message.chat.id
     user_id = message.reply_to_message.from_user.id
     user_id = message.reply_to_message.from_user.id
     user_mention = message.reply_to_message.from_user.mention
     user_mention = message.reply_to_message.from_user.mention
-    current_karma = await get_karma(chat_id, await int_to_alpha(user_id))
+    current_karma = await get_karma(
+        chat_id, await int_to_alpha(user_id)
+    )
     if current_karma:
     if current_karma:
         current_karma = current_karma["karma"]
         current_karma = current_karma["karma"]
         karma = current_karma - 1
         karma = current_karma - 1
         new_karma = {"karma": karma}
         new_karma = {"karma": karma}
-        await update_karma(chat_id, await int_to_alpha(user_id), new_karma)
+        await update_karma(
+            chat_id, await int_to_alpha(user_id), new_karma
+        )
     else:
     else:
         karma = 1
         karma = 1
         new_karma = {"karma": karma}
         new_karma = {"karma": karma}
-        await update_karma(chat_id, await int_to_alpha(user_id), new_karma)
+        await update_karma(
+            chat_id, await int_to_alpha(user_id), new_karma
+        )
     await message.reply_text(
     await message.reply_text(
         f"Decremented Karma Of {user_mention} By 1 \nTotal Points: {karma}"
         f"Decremented Karma Of {user_mention} By 1 \nTotal Points: {karma}"
     )
     )
@@ -130,7 +144,9 @@ async def downvote(_, message):
 async def command_karma(_, message):
 async def command_karma(_, message):
     chat_id = message.chat.id
     chat_id = message.chat.id
     if not message.reply_to_message:
     if not message.reply_to_message:
-        m = await message.reply_text("Analyzing Karma...Will Take 10 Seconds")
+        m = await message.reply_text(
+            "Analyzing Karma...Will Take 10 Seconds"
+        )
         karma = await get_karmas(chat_id)
         karma = await get_karmas(chat_id)
         if not karma:
         if not karma:
             await m.edit("No karma in DB for this chat.")
             await m.edit("No karma in DB for this chat.")
@@ -144,7 +160,9 @@ async def command_karma(_, message):
             karma_dicc[str(user_id)] = user_karma
             karma_dicc[str(user_id)] = user_karma
             karma_arranged = dict(
             karma_arranged = dict(
                 sorted(
                 sorted(
-                    karma_dicc.items(), key=lambda item: item[1], reverse=True
+                    karma_dicc.items(),
+                    key=lambda item: item[1],
+                    reverse=True,
                 )
                 )
             )
             )
         if not karma_dicc:
         if not karma_dicc:

+ 6 - 2
wbb/modules/locks.py

@@ -45,7 +45,9 @@ Example:
     /lock all
     /lock all
 """
 """
 
 
-incorrect_parameters = "Incorrect Parameters, Check Locks Section In Help."
+incorrect_parameters = (
+    "Incorrect Parameters, Check Locks Section In Help."
+)
 data = {
 data = {
     "messages": "can_send_messages",
     "messages": "can_send_messages",
     "stickers": "can_send_stickers",
     "stickers": "can_send_stickers",
@@ -81,7 +83,9 @@ async def tg_lock(message, permissions: list, perm: str, lock: bool):
     await message.reply_text(("Locked." if lock else "Unlocked."))
     await message.reply_text(("Locked." if lock else "Unlocked."))
 
 
 
 
-@app.on_message(filters.command(["lock", "unlock"]) & ~filters.private)
+@app.on_message(
+    filters.command(["lock", "unlock"]) & ~filters.private
+)
 @adminsOnly("can_restrict_members")
 @adminsOnly("can_restrict_members")
 async def locks_func(_, message):
 async def locks_func(_, message):
     if len(message.command) != 2:
     if len(message.command) != 2:

+ 33 - 14
wbb/modules/misc.py

@@ -57,7 +57,9 @@ __HELP__ = """
 
 
 @app.on_message(filters.command("commit") & ~filters.edited)
 @app.on_message(filters.command("commit") & ~filters.edited)
 async def commit(_, message):
 async def commit(_, message):
-    await message.reply_text((await random_line("wbb/utils/commit.txt")))
+    await message.reply_text(
+        (await random_line("wbb/utils/commit.txt"))
+    )
 
 
 
 
 @app.on_message(filters.command("RTFM", "#"))
 @app.on_message(filters.command("RTFM", "#"))
@@ -72,7 +74,9 @@ async def rtfm(_, message):
 
 
 @app.on_message(filters.command("runs") & ~filters.edited)
 @app.on_message(filters.command("runs") & ~filters.edited)
 async def runs(_, message):
 async def runs(_, message):
-    await message.reply_text((await random_line("wbb/utils/runs.txt")))
+    await message.reply_text(
+        (await random_line("wbb/utils/runs.txt"))
+    )
 
 
 
 
 @app.on_message(filters.command("id"))
 @app.on_message(filters.command("id"))
@@ -80,7 +84,9 @@ async def getid(_, message):
     if len(message.command) == 2:
     if len(message.command) == 2:
         try:
         try:
             id = (
             id = (
-                await app.get_users(message.text.split(None, 1)[1].strip())
+                await app.get_users(
+                    message.text.split(None, 1)[1].strip()
+                )
             ).id
             ).id
         except Exception:
         except Exception:
             return await message.reply_text("No Such User")
             return await message.reply_text("No Such User")
@@ -88,9 +94,7 @@ async def getid(_, message):
         return await message.reply_text(text, parse_mode="html")
         return await message.reply_text(text, parse_mode="html")
     text_unping = "<b>Chat ID:</b>"
     text_unping = "<b>Chat ID:</b>"
     if message.chat.username:
     if message.chat.username:
-        text_unping = (
-            f'<a href="https://t.me/{message.chat.username}">{text_unping}</a>'
-        )
+        text_unping = f'<a href="https://t.me/{message.chat.username}">{text_unping}</a>'
     text_unping += f" <code>{message.chat.id}</code>\n"
     text_unping += f" <code>{message.chat.id}</code>\n"
     text = "<b>Message ID:</b>"
     text = "<b>Message ID:</b>"
     if message.link:
     if message.link:
@@ -129,7 +133,9 @@ async def getid(_, message):
     )
     )
     if text_unping != text_ping:
     if text_unping != text_ping:
         await reply.edit_text(
         await reply.edit_text(
-            text_ping, disable_web_page_preview=True, parse_mode="html"
+            text_ping,
+            disable_web_page_preview=True,
+            parse_mode="html",
         )
         )
 
 
 
 
@@ -152,7 +158,9 @@ async def random(_, message):
             )
             )
             await message.reply_text(f"`{password}`")
             await message.reply_text(f"`{password}`")
         else:
         else:
-            await message.reply_text("Specify A Length Between 1-1000")
+            await message.reply_text(
+                "Specify A Length Between 1-1000"
+            )
     except ValueError:
     except ValueError:
         await message.reply_text(
         await message.reply_text(
             "Strings Won't Work!, Pass A Positive Integer Less Than 1000"
             "Strings Won't Work!, Pass A Positive Integer Less Than 1000"
@@ -166,7 +174,9 @@ async def random(_, message):
 @capture_err
 @capture_err
 async def encrypt(_, message):
 async def encrypt(_, message):
     if not message.reply_to_message:
     if not message.reply_to_message:
-        return await message.reply_text("Reply To A Message To Encrypt It.")
+        return await message.reply_text(
+            "Reply To A Message To Encrypt It."
+        )
     text = message.reply_to_message.text
     text = message.reply_to_message.text
     text_in_bytes = bytes(text, "utf-8")
     text_in_bytes = bytes(text, "utf-8")
     cipher_suite = Fernet(FERNET_ENCRYPTION_KEY)
     cipher_suite = Fernet(FERNET_ENCRYPTION_KEY)
@@ -182,7 +192,9 @@ async def encrypt(_, message):
 @capture_err
 @capture_err
 async def decrypt(_, message):
 async def decrypt(_, message):
     if not message.reply_to_message:
     if not message.reply_to_message:
-        return await message.reply_text("Reply To A Message To Decrypt It.")
+        return await message.reply_text(
+            "Reply To A Message To Decrypt It."
+        )
     text = message.reply_to_message.text
     text = message.reply_to_message.text
     text_in_bytes = bytes(text, "utf-8")
     text_in_bytes = bytes(text, "utf-8")
     cipher_suite = Fernet(FERNET_ENCRYPTION_KEY)
     cipher_suite = Fernet(FERNET_ENCRYPTION_KEY)
@@ -217,7 +229,9 @@ async def cheat(_, message):
         ftext = text.split()
         ftext = text.split()
         language = ftext[0]
         language = ftext[0]
         query = ftext[1]
         query = ftext[1]
-        data = await fetch_text(f"http://cht.sh/{language}/{query}?QT")
+        data = await fetch_text(
+            f"http://cht.sh/{language}/{query}?QT"
+        )
         if not data:
         if not data:
             return await m.edit("Found Literally Nothing!")
             return await m.edit("Found Literally Nothing!")
         await m.edit(f"`{data}`")
         await m.edit(f"`{data}`")
@@ -245,7 +259,9 @@ async def tr(_, message):
     reply = message.reply_to_message
     reply = message.reply_to_message
     text = message.text or message.reply
     text = message.text or message.reply
     if not text:
     if not text:
-        return await message.reply_text("Reply to a text to translate it")
+        return await message.reply_text(
+            "Reply to a text to translate it"
+        )
     result = await arq.translate(text, lang)
     result = await arq.translate(text, lang)
     if not result.ok:
     if not result.ok:
         return await message.reply_text(result.result)
         return await message.reply_text(result.result)
@@ -267,7 +283,8 @@ async def json_fetch(_, message):
         else:
         else:
             link = await paste(data)
             link = await paste(data)
             await m.edit(
             await m.edit(
-                f"[OUTPUT_TOO_LONG]({link})", disable_web_page_preview=True
+                f"[OUTPUT_TOO_LONG]({link})",
+                disable_web_page_preview=True,
             )
             )
     except Exception as e:
     except Exception as e:
         await m.edit(str(e))
         await m.edit(str(e))
@@ -277,7 +294,9 @@ async def json_fetch(_, message):
 @capture_err
 @capture_err
 async def take_ss(_, message):
 async def take_ss(_, message):
     if len(message.command) != 2:
     if len(message.command) != 2:
-        return await message.reply_text("Give A Url To Fetch Screenshot.")
+        return await message.reply_text(
+            "Give A Url To Fetch Screenshot."
+        )
     url = message.text.split(None, 1)[1]
     url = message.text.split(None, 1)[1]
     m = await message.reply_text("**Uploading**")
     m = await message.reply_text("**Uploading**")
     try:
     try:

+ 15 - 5
wbb/modules/music.py

@@ -80,7 +80,9 @@ def download_youtube_audio(url: str, m=0):
             audio_file = audio_file_opus
             audio_file = audio_file_opus
         thumbnail_url = info_dict["thumbnail"]
         thumbnail_url = info_dict["thumbnail"]
         thumbnail_file = (
         thumbnail_file = (
-            basename + "." + get_file_extension_from_url(thumbnail_url)
+            basename
+            + "."
+            + get_file_extension_from_url(thumbnail_url)
         )
         )
         title = info_dict["title"]
         title = info_dict["title"]
         performer = info_dict["uploader"]
         performer = info_dict["uploader"]
@@ -93,7 +95,9 @@ def download_youtube_audio(url: str, m=0):
 async def music(_, message):
 async def music(_, message):
     global is_downloading
     global is_downloading
     if len(message.command) != 2:
     if len(message.command) != 2:
-        return await message.reply_text("/ytmusic needs a link as argument")
+        return await message.reply_text(
+            "/ytmusic needs a link as argument"
+        )
     url = message.text.split(None, 1)[1]
     url = message.text.split(None, 1)[1]
     if is_downloading:
     if is_downloading:
         return await message.reply_text(
         return await message.reply_text(
@@ -154,7 +158,9 @@ async def download_song(url):
 async def jssong(_, message):
 async def jssong(_, message):
     global is_downloading
     global is_downloading
     if len(message.command) < 2:
     if len(message.command) < 2:
-        return await message.reply_text("/saavn requires an argument.")
+        return await message.reply_text(
+            "/saavn requires an argument."
+        )
     if is_downloading:
     if is_downloading:
         return await message.reply_text(
         return await message.reply_text(
             "Another download is in progress, try again after sometime."
             "Another download is in progress, try again after sometime."
@@ -195,7 +201,9 @@ async def jssong(_, message):
 async def deezsong(_, message):
 async def deezsong(_, message):
     global is_downloading
     global is_downloading
     if len(message.command) < 2:
     if len(message.command) < 2:
-        return await message.reply_text("/deezer requires an argument.")
+        return await message.reply_text(
+            "/deezer requires an argument."
+        )
     if is_downloading:
     if is_downloading:
         return await message.reply_text(
         return await message.reply_text(
             "Another download is in progress, try again after sometime."
             "Another download is in progress, try again after sometime."
@@ -215,7 +223,9 @@ async def deezsong(_, message):
         await m.edit("Downloading")
         await m.edit("Downloading")
         proxy = "http://52.187.67.188:5000"
         proxy = "http://52.187.67.188:5000"
         try:
         try:
-            song = await download_song(f"{proxy}/mirror?url={url}.mp3")
+            song = await download_song(
+                f"{proxy}/mirror?url={url}.mp3"
+            )
         except Exception:
         except Exception:
             song = await download_song(url)
             song = await download_song(url)
         if not song:
         if not song:

+ 29 - 11
wbb/modules/notes.py

@@ -26,8 +26,8 @@ from pyrogram import filters
 from wbb import app
 from wbb import app
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.permissions import adminsOnly
 from wbb.core.decorators.permissions import adminsOnly
-from wbb.utils.dbfunctions import (delete_note, get_note, get_note_names,
-                                   save_note)
+from wbb.utils.dbfunctions import (delete_note, get_note,
+                                   get_note_names, save_note)
 
 
 __MODULE__ = "Notes"
 __MODULE__ = "Notes"
 __HELP__ = """/notes To Get All The Notes In The Chat.
 __HELP__ = """/notes To Get All The Notes In The Chat.
@@ -36,7 +36,9 @@ __HELP__ = """/notes To Get All The Notes In The Chat.
 /delete [NOTE_NAME] To Delete A Note."""
 /delete [NOTE_NAME] To Delete A Note."""
 
 
 
 
-@app.on_message(filters.command("save") & ~filters.edited & ~filters.private)
+@app.on_message(
+    filters.command("save") & ~filters.edited & ~filters.private
+)
 @adminsOnly("can_change_info")
 @adminsOnly("can_change_info")
 async def save_notee(_, message):
 async def save_notee(_, message):
     if len(message.command) < 2 or not message.reply_to_message:
     if len(message.command) < 2 or not message.reply_to_message:
@@ -54,7 +56,9 @@ async def save_notee(_, message):
     else:
     else:
         name = message.text.split(None, 1)[1].strip()
         name = message.text.split(None, 1)[1].strip()
         if not name:
         if not name:
-            return await message.reply_text("**Usage**\n__/save [NOTE_NAME]__")
+            return await message.reply_text(
+                "**Usage**\n__/save [NOTE_NAME]__"
+            )
         _type = "text" if message.reply_to_message.text else "sticker"
         _type = "text" if message.reply_to_message.text else "sticker"
         note = {
         note = {
             "type": _type,
             "type": _type,
@@ -66,7 +70,9 @@ async def save_notee(_, message):
         await message.reply_text(f"__**Saved note {name}.**__")
         await message.reply_text(f"__**Saved note {name}.**__")
 
 
 
 
-@app.on_message(filters.command("notes") & ~filters.edited & ~filters.private)
+@app.on_message(
+    filters.command("notes") & ~filters.edited & ~filters.private
+)
 @capture_err
 @capture_err
 async def get_notes(_, message):
 async def get_notes(_, message):
     _notes = await get_note_names(message.chat.id)
     _notes = await get_note_names(message.chat.id)
@@ -81,7 +87,9 @@ async def get_notes(_, message):
         await message.reply_text(msg)
         await message.reply_text(msg)
 
 
 
 
-@app.on_message(filters.command("get") & ~filters.edited & ~filters.private)
+@app.on_message(
+    filters.command("get") & ~filters.edited & ~filters.private
+)
 @capture_err
 @capture_err
 async def get_one_note(_, message):
 async def get_one_note(_, message):
     if len(message.command) < 2:
     if len(message.command) < 2:
@@ -89,7 +97,9 @@ async def get_one_note(_, message):
     else:
     else:
         name = message.text.split(None, 1)[1].strip()
         name = message.text.split(None, 1)[1].strip()
         if not name:
         if not name:
-            return await message.reply_text("**Usage**\n__/get [NOTE_NAME]__")
+            return await message.reply_text(
+                "**Usage**\n__/get [NOTE_NAME]__"
+            )
         _note = await get_note(message.chat.id, name)
         _note = await get_note(message.chat.id, name)
         if not _note:
         if not _note:
             await message.reply_text("**No such note.**")
             await message.reply_text("**No such note.**")
@@ -102,17 +112,25 @@ async def get_one_note(_, message):
                 await message.reply_sticker(_note["data"])
                 await message.reply_sticker(_note["data"])
 
 
 
 
-@app.on_message(filters.command("delete") & ~filters.edited & ~filters.private)
+@app.on_message(
+    filters.command("delete") & ~filters.edited & ~filters.private
+)
 @adminsOnly("can_change_info")
 @adminsOnly("can_change_info")
 async def del_note(_, message):
 async def del_note(_, message):
     if len(message.command) < 2:
     if len(message.command) < 2:
-        return await message.reply_text("**Usage**\n__/delete [NOTE_NAME]__")
+        return await message.reply_text(
+            "**Usage**\n__/delete [NOTE_NAME]__"
+        )
     name = message.text.split(None, 1)[1].strip()
     name = message.text.split(None, 1)[1].strip()
     if not name:
     if not name:
-        return await message.reply_text("**Usage**\n__/delete [NOTE_NAME]__")
+        return await message.reply_text(
+            "**Usage**\n__/delete [NOTE_NAME]__"
+        )
     chat_id = message.chat.id
     chat_id = message.chat.id
     deleted = await delete_note(chat_id, name)
     deleted = await delete_note(chat_id, name)
     if deleted:
     if deleted:
-        await message.reply_text(f"**Deleted note {name} successfully.**")
+        await message.reply_text(
+            f"**Deleted note {name} successfully.**"
+        )
     else:
     else:
         await message.reply_text("**No such note.**")
         await message.reply_text("**No such note.**")

+ 3 - 1
wbb/modules/nsfw.py

@@ -149,7 +149,9 @@ async def nsfw_scan_command(_, message):
 @adminsOnly("can_change_info")
 @adminsOnly("can_change_info")
 async def nsfw_enable_disable(_, message):
 async def nsfw_enable_disable(_, message):
     if len(message.command) != 2:
     if len(message.command) != 2:
-        await message.reply_text("Usage: /anti_nsfw [enable | disable]")
+        await message.reply_text(
+            "Usage: /anti_nsfw [enable | disable]"
+        )
         return
         return
     status = message.text.split(None, 1)[1].strip()
     status = message.text.split(None, 1)[1].strip()
     status = status.lower()
     status = status.lower()

+ 3 - 1
wbb/modules/paste.py

@@ -37,7 +37,9 @@ from wbb.utils.pastebin import paste
 
 
 __MODULE__ = "Paste"
 __MODULE__ = "Paste"
 __HELP__ = "/paste - To Paste Replied Text Or Document To Nekobin"
 __HELP__ = "/paste - To Paste Replied Text Or Document To Nekobin"
-pattern = re.compile(r"^text/|json$|yaml$|xml$|toml$|x-sh$|x-shellscript$")
+pattern = re.compile(
+    r"^text/|json$|yaml$|xml$|toml$|x-sh$|x-shellscript$"
+)
 
 
 
 
 async def isPreviewUp(preview: str) -> bool:
 async def isPreviewUp(preview: str) -> bool:

+ 28 - 9
wbb/modules/pmpermit.py

@@ -27,7 +27,8 @@ from pyrogram import filters
 from wbb import BOT_ID, SUDOERS, USERBOT_ID, USERBOT_PREFIX, app, app2
 from wbb import BOT_ID, SUDOERS, USERBOT_ID, USERBOT_PREFIX, app, app2
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.errors import capture_err
 from wbb.modules.userbot import edit_or_reply
 from wbb.modules.userbot import edit_or_reply
-from wbb.utils.dbfunctions import (approve_pmpermit, disapprove_pmpermit,
+from wbb.utils.dbfunctions import (approve_pmpermit,
+                                   disapprove_pmpermit,
                                    is_pmpermit_approved)
                                    is_pmpermit_approved)
 
 
 flood = {}
 flood = {}
@@ -56,11 +57,18 @@ async def pmpermit_func(_, message):
     else:
     else:
         flood[str(user_id)] = 1
         flood[str(user_id)] = 1
     if flood[str(user_id)] > 5:
     if flood[str(user_id)] > 5:
-        await message.reply_text("SPAM DETECTED, BLOCKED USER AUTOMATICALLY!")
+        await message.reply_text(
+            "SPAM DETECTED, BLOCKED USER AUTOMATICALLY!"
+        )
         return await app2.block_user(user_id)
         return await app2.block_user(user_id)
-    results = await app2.get_inline_bot_results(BOT_ID, f"pmpermit {user_id}")
+    results = await app2.get_inline_bot_results(
+        BOT_ID, f"pmpermit {user_id}"
+    )
     await app2.send_inline_bot_result(
     await app2.send_inline_bot_result(
-        user_id, results.query_id, results.results[0].id, hide_via=True
+        user_id,
+        results.query_id,
+        results.results[0].id,
+        hide_via=True,
     )
     )
 
 
 
 
@@ -96,7 +104,9 @@ async def pm_disapprove(_, message):
         )
         )
     user_id = message.reply_to_message.from_user.id
     user_id = message.reply_to_message.from_user.id
     if not await is_pmpermit_approved(user_id):
     if not await is_pmpermit_approved(user_id):
-        await edit_or_reply(message, text="User is already disapproved to pm")
+        await edit_or_reply(
+            message, text="User is already disapproved to pm"
+        )
         async for m in app2.iter_history(user_id, limit=6):
         async for m in app2.iter_history(user_id, limit=6):
             if m.reply_markup:
             if m.reply_markup:
                 try:
                 try:
@@ -137,7 +147,9 @@ async def unblock_user_func(_, message):
         )
         )
     user_id = message.reply_to_message.from_user.id
     user_id = message.reply_to_message.from_user.id
     await app2.unblock_user(user_id)
     await app2.unblock_user(user_id)
-    await edit_or_reply(message, text="Successfully Unblocked the user")
+    await edit_or_reply(
+        message, text="Successfully Unblocked the user"
+    )
 
 
 
 
 """ CALLBACK QUERY HANDLER """
 """ CALLBACK QUERY HANDLER """
@@ -148,7 +160,10 @@ flood2 = {}
 @app.on_callback_query(filters.regex("pmpermit"))
 @app.on_callback_query(filters.regex("pmpermit"))
 async def pmpermit_cq(_, cq):
 async def pmpermit_cq(_, cq):
     user_id = cq.from_user.id
     user_id = cq.from_user.id
-    data, victim = cq.data.split(None, 2)[1], cq.data.split(None, 2)[2]
+    data, victim = (
+        cq.data.split(None, 2)[1],
+        cq.data.split(None, 2)[2],
+    )
     if data == "approve":
     if data == "approve":
         if user_id != USERBOT_ID:
         if user_id != USERBOT_ID:
             return await cq.answer("This Button Is Not For You")
             return await cq.answer("This Button Is Not For You")
@@ -164,7 +179,9 @@ async def pmpermit_cq(_, cq):
         async for m in app2.iter_history(user_id, limit=6):
         async for m in app2.iter_history(user_id, limit=6):
             if m.reply_markup:
             if m.reply_markup:
                 await m.delete()
                 await m.delete()
-        await app2.send_message(user_id, "Blocked, Go scam someone else.")
+        await app2.send_message(
+            user_id, "Blocked, Go scam someone else."
+        )
         await app2.block_user(user_id)
         await app2.block_user(user_id)
 
 
     elif data == "approve_me":
     elif data == "approve_me":
@@ -173,7 +190,9 @@ async def pmpermit_cq(_, cq):
         else:
         else:
             flood2[str(user_id)] = 1
             flood2[str(user_id)] = 1
         if flood2[str(user_id)] > 5:
         if flood2[str(user_id)] > 5:
-            await app2.send_message(user_id, "SPAM DETECTED, USER BLOCKED.")
+            await app2.send_message(
+                user_id, "SPAM DETECTED, USER BLOCKED."
+            )
             return await app2.block_user(user_id)
             return await app2.block_user(user_id)
         await app2.send_message(
         await app2.send_message(
             user_id,
             user_id,

+ 5 - 2
wbb/modules/quotly.py

@@ -65,13 +65,16 @@ def isArgInt(message: Message) -> bool:
 
 
 
 
 @app2.on_message(
 @app2.on_message(
-    filters.command("q", prefixes=USERBOT_PREFIX) & filters.user(SUDOERS)
+    filters.command("q", prefixes=USERBOT_PREFIX)
+    & filters.user(SUDOERS)
 )
 )
 @app.on_message(filters.command("q") & ~filters.private)
 @app.on_message(filters.command("q") & ~filters.private)
 @capture_err
 @capture_err
 async def quotly_func(client, message: Message):
 async def quotly_func(client, message: Message):
     if not message.reply_to_message:
     if not message.reply_to_message:
-        return await message.reply_text("Reply to a message to quote it.")
+        return await message.reply_text(
+            "Reply to a message to quote it."
+        )
     if not message.reply_to_message.text:
     if not message.reply_to_message.text:
         return await message.reply_text(
         return await message.reply_text(
             "Replied message has no text, can't quote it."
             "Replied message has no text, can't quote it."

+ 11 - 4
wbb/modules/regex.py

@@ -58,7 +58,8 @@ async def sed(_, message):
 
 
         if not repl:
         if not repl:
             return await message.reply_text(
             return await message.reply_text(
-                "You're trying to replace... " "nothing with something?"
+                "You're trying to replace... "
+                "nothing with something?"
             )
             )
 
 
         try:
         try:
@@ -67,7 +68,9 @@ async def sed(_, message):
                 return await message.reply_text("Nice try -_-")
                 return await message.reply_text("Nice try -_-")
 
 
             if "i" in flags and "g" in flags:
             if "i" in flags and "g" in flags:
-                text = re.sub(repl, repl_with, to_fix, flags=re.I).strip()
+                text = re.sub(
+                    repl, repl_with, to_fix, flags=re.I
+                ).strip()
             elif "i" in flags:
             elif "i" in flags:
                 text = re.sub(
                 text = re.sub(
                     repl, repl_with, to_fix, count=1, flags=re.I
                     repl, repl_with, to_fix, count=1, flags=re.I
@@ -75,7 +78,9 @@ async def sed(_, message):
             elif "g" in flags:
             elif "g" in flags:
                 text = re.sub(repl, repl_with, to_fix).strip()
                 text = re.sub(repl, repl_with, to_fix).strip()
             else:
             else:
-                text = re.sub(repl, repl_with, to_fix, count=1).strip()
+                text = re.sub(
+                    repl, repl_with, to_fix, count=1
+                ).strip()
         except sre_constants.error:
         except sre_constants.error:
             return
             return
 
 
@@ -131,7 +136,9 @@ def separate_sed(sed_string):
                 and counter + 1 < len(sed_string)
                 and counter + 1 < len(sed_string)
                 and sed_string[counter + 1] == delim
                 and sed_string[counter + 1] == delim
             ):
             ):
-                sed_string = sed_string[:counter] + sed_string[counter + 1 :]
+                sed_string = (
+                    sed_string[:counter] + sed_string[counter + 1 :]
+                )
 
 
             elif sed_string[counter] == delim:
             elif sed_string[counter] == delim:
                 replace_with = sed_string[start:counter]
                 replace_with = sed_string[start:counter]

+ 4 - 1
wbb/modules/repo.py

@@ -28,7 +28,10 @@ from wbb.core.decorators.errors import capture_err
 from wbb.utils.fetch import fetch
 from wbb.utils.fetch import fetch
 
 
 __MODULE__ = "Repo"
 __MODULE__ = "Repo"
-__HELP__ = "/repo - To Get My Github Repository Link " "And Support Group Link"
+__HELP__ = (
+    "/repo - To Get My Github Repository Link "
+    "And Support Group Link"
+)
 
 
 
 
 @app.on_message(filters.command("repo") & ~filters.edited)
 @app.on_message(filters.command("repo") & ~filters.edited)

+ 10 - 7
wbb/modules/reverse.py

@@ -1,10 +1,10 @@
 import os
 import os
+from asyncio import get_running_loop
 from random import randint
 from random import randint
 
 
 import aiofiles
 import aiofiles
 import aiohttp
 import aiohttp
 import requests
 import requests
-from asyncio import get_running_loop
 from bs4 import BeautifulSoup
 from bs4 import BeautifulSoup
 from pyrogram import filters
 from pyrogram import filters
 
 
@@ -13,7 +13,6 @@ from wbb.core.decorators.errors import capture_err
 from wbb.modules.nsfw import get_file_id_from_message
 from wbb.modules.nsfw import get_file_id_from_message
 
 
 
 
-
 @app.on_message(filters.command("reverse"))
 @app.on_message(filters.command("reverse"))
 @capture_err
 @capture_err
 async def reverse_image_search(_, message):
 async def reverse_image_search(_, message):
@@ -36,7 +35,9 @@ async def reverse_image_search(_, message):
     file_id = await get_file_id_from_message(reply)
     file_id = await get_file_id_from_message(reply)
     if not file_id:
     if not file_id:
         return m.edit("Can't reverse that")
         return m.edit("Can't reverse that")
-    image = await app.download_media(file_id, f"{randint(1000, 10000)}.jpg")
+    image = await app.download_media(
+        file_id, f"{randint(1000, 10000)}.jpg"
+    )
     await m.edit("Uploading to google's server")
     await m.edit("Uploading to google's server")
     async with aiofiles.open(image, "rb") as f:
     async with aiofiles.open(image, "rb") as f:
         if image:
         if image:
@@ -45,12 +46,16 @@ async def reverse_image_search(_, message):
                 "encoded_image": (image, await f.read()),
                 "encoded_image": (image, await f.read()),
                 "image_content": "",
                 "image_content": "",
             }
             }
+
             def post_non_blocking():
             def post_non_blocking():
                 return requests.post(
                 return requests.post(
                     search_url, files=multipart, allow_redirects=False
                     search_url, files=multipart, allow_redirects=False
-            )
+                )
+
             loop = get_running_loop()
             loop = get_running_loop()
-            response = await loop.run_in_executor(None, post_non_blocking)
+            response = await loop.run_in_executor(
+                None, post_non_blocking
+            )
             location = response.headers.get("Location")
             location = response.headers.get("Location")
             os.remove(image)
             os.remove(image)
         else:
         else:
@@ -76,5 +81,3 @@ async def reverse_image_search(_, message):
     except Exception:
     except Exception:
         text = f"**Result**: [Link]({location})"
         text = f"**Result**: [Link]({location})"
         await m.edit(text)
         await m.edit(text)
-
-

+ 30 - 11
wbb/modules/rice.py

@@ -22,8 +22,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
 SOFTWARE.
 """
 """
 from pyrogram import filters
 from pyrogram import filters
-from pyrogram.types import (InlineKeyboardButton, InlineKeyboardMarkup,
-                            InputMediaPhoto, InputMediaVideo, Message)
+from pyrogram.types import (InlineKeyboardButton,
+                            InlineKeyboardMarkup, InputMediaPhoto,
+                            InputMediaVideo, Message)
 
 
 from wbb import app
 from wbb import app
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.errors import capture_err
@@ -53,7 +54,9 @@ async def rice(_, message: Message):
                     InlineKeyboardButton(
                     InlineKeyboardButton(
                         "Approve (Forward)", callback_data="forward"
                         "Approve (Forward)", callback_data="forward"
                     ),
                     ),
-                    InlineKeyboardButton("Ignore", callback_data="ignore"),
+                    InlineKeyboardButton(
+                        "Ignore", callback_data="ignore"
+                    ),
                 ]
                 ]
             ]
             ]
         ),
         ),
@@ -74,21 +77,29 @@ async def callback_query_forward_rice(_, callback_query):
     await callback_query.answer("Successfully approved")
     await callback_query.answer("Successfully approved")
     m_op = callback_query.message.reply_to_message
     m_op = callback_query.message.reply_to_message
     u_op = m_op.from_user
     u_op = m_op.from_user
-    arg_caption = f"{m_op.caption}\nOP: [{u_op.first_name}]({m_op.link})"
+    arg_caption = (
+        f"{m_op.caption}\nOP: [{u_op.first_name}]({m_op.link})"
+    )
     if m_op.media_group_id:
     if m_op.media_group_id:
         message_id = m_op.message_id
         message_id = m_op.message_id
-        media_group = await app.get_media_group(RICE_GROUP, message_id)
+        media_group = await app.get_media_group(
+            RICE_GROUP, message_id
+        )
         arg_media = []
         arg_media = []
         for m in media_group:
         for m in media_group:
             if m.photo and m.caption:
             if m.photo and m.caption:
                 arg_media.append(
                 arg_media.append(
-                    InputMediaPhoto(m.photo.file_id, caption=arg_caption)
+                    InputMediaPhoto(
+                        m.photo.file_id, caption=arg_caption
+                    )
                 )
                 )
             elif m.photo:
             elif m.photo:
                 arg_media.append(InputMediaPhoto(m.photo.file_id))
                 arg_media.append(InputMediaPhoto(m.photo.file_id))
             elif m.video and m.caption:
             elif m.video and m.caption:
                 arg_media.append(
                 arg_media.append(
-                    InputMediaVideo(m.video.file_id, caption=arg_caption)
+                    InputMediaVideo(
+                        m.video.file_id, caption=arg_caption
+                    )
                 )
                 )
             elif m.video:
             elif m.video:
                 arg_media.append(InputMediaVideo(m.video.file_id))
                 arg_media.append(InputMediaVideo(m.video.file_id))
@@ -110,13 +121,21 @@ async def callback_query_forward_rice(_, callback_query):
 async def callback_query_ignore_rice(_, callback_query):
 async def callback_query_ignore_rice(_, callback_query):
     c_group = callback_query.message.chat
     c_group = callback_query.message.chat
     u_disprover = callback_query.from_user
     u_disprover = callback_query.from_user
-    disprover_status = (await c_group.get_member(u_disprover.id)).status
+    disprover_status = (
+        await c_group.get_member(u_disprover.id)
+    ).status
     m_op = callback_query.message.reply_to_message
     m_op = callback_query.message.reply_to_message
     u_op = m_op.from_user
     u_op = m_op.from_user
     if u_disprover.id == u_op.id:
     if u_disprover.id == u_op.id:
-        await callback_query.answer("Ok, this rice won't be forwarded")
+        await callback_query.answer(
+            "Ok, this rice won't be forwarded"
+        )
     elif disprover_status in ("creator", "administrator"):
     elif disprover_status in ("creator", "administrator"):
-        await m_op.reply_text(f"{u_disprover.mention} ignored this rice")
+        await m_op.reply_text(
+            f"{u_disprover.mention} ignored this rice"
+        )
     else:
     else:
-        return await callback_query.answer("Only admin or OP could ignore it")
+        return await callback_query.answer(
+            "Only admin or OP could ignore it"
+        )
     await callback_query.message.delete()
     await callback_query.message.delete()

+ 5 - 2
wbb/modules/spam.py

@@ -125,7 +125,8 @@ async def spam_p_callback(_, cq: CallbackQuery):
             return
             return
         text = cq.message.text.markdown
         text = cq.message.text.markdown
         text = text.replace(
         text = text.replace(
-            "Alerted", f"Deleted Message With {from_user.mention}'s Approval."
+            "Alerted",
+            f"Deleted Message With {from_user.mention}'s Approval.",
         )
         )
         await cq.message.edit(text)
         await cq.message.edit(text)
         if cq.message.reply_to_message:
         if cq.message.reply_to_message:
@@ -176,4 +177,6 @@ __{dev_forward}__
     await message.reply_text(
     await message.reply_text(
         "Message was flagged as spam, Devs will use it to improve spam protection algorithm."
         "Message was flagged as spam, Devs will use it to improve spam protection algorithm."
     )
     )
-    await app.send_message(LOG_GROUP_ID, msg, disable_web_page_preview=True)
+    await app.send_message(
+        LOG_GROUP_ID, msg, disable_web_page_preview=True
+    )

+ 33 - 17
wbb/modules/stickers.py

@@ -26,27 +26,25 @@ import os
 from traceback import format_exc
 from traceback import format_exc
 
 
 from pyrogram import filters
 from pyrogram import filters
-from pyrogram.errors.exceptions.bad_request_400 import (PeerIdInvalid,
-                                                        ShortnameOccupyFailed,
-                                                        StickerPngDimensions,
-                                                        StickerPngNopng,
-                                                        UserIsBlocked)
+from pyrogram.errors.exceptions.bad_request_400 import (
+    PeerIdInvalid, ShortnameOccupyFailed, StickerPngDimensions,
+    StickerPngNopng, UserIsBlocked)
 from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
 from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
 
 
 from wbb import BOT_USERNAME, app
 from wbb import BOT_USERNAME, app
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.errors import capture_err
 from wbb.utils.files import (get_document_from_file_id,
 from wbb.utils.files import (get_document_from_file_id,
-                             resize_file_to_sticker_size, upload_document)
+                             resize_file_to_sticker_size,
+                             upload_document)
 from wbb.utils.stickerset import (add_sticker_to_set, create_sticker,
 from wbb.utils.stickerset import (add_sticker_to_set, create_sticker,
-                                  create_sticker_set, get_sticker_set_by_name)
+                                  create_sticker_set,
+                                  get_sticker_set_by_name)
 
 
 __MODULE__ = "Stickers"
 __MODULE__ = "Stickers"
 __HELP__ = """/sticker_id - To Get File ID of A Sticker.
 __HELP__ = """/sticker_id - To Get File ID of A Sticker.
 /kang - To Kang A Sticker or Image."""
 /kang - To Kang A Sticker or Image."""
 
 
-MAX_STICKERS = (
-    120  # would be better if we could fetch this limit directly from telegram
-)
+MAX_STICKERS = 120  # would be better if we could fetch this limit directly from telegram
 SUPPORTED_TYPES = ["jpeg", "png", "webp"]
 SUPPORTED_TYPES = ["jpeg", "png", "webp"]
 
 
 
 
@@ -65,7 +63,9 @@ async def sticker_id(_, message):
 @capture_err
 @capture_err
 async def kang(client, message):
 async def kang(client, message):
     if not message.reply_to_message:
     if not message.reply_to_message:
-        return await message.reply_text("Reply to a sticker/image to kang it.")
+        return await message.reply_text(
+            "Reply to a sticker/image to kang it."
+        )
     if not message.from_user:
     if not message.from_user:
         return await message.reply_text(
         return await message.reply_text(
             "You are anon admin, kang stickers in my pm."
             "You are anon admin, kang stickers in my pm."
@@ -85,7 +85,10 @@ async def kang(client, message):
         sticker_emoji = "🤔"
         sticker_emoji = "🤔"
 
 
     # Get the corresponding fileid, resize the file if necessary
     # Get the corresponding fileid, resize the file if necessary
-    doc = message.reply_to_message.photo or message.reply_to_message.document
+    doc = (
+        message.reply_to_message.photo
+        or message.reply_to_message.document
+    )
     try:
     try:
         if message.reply_to_message.sticker:
         if message.reply_to_message.sticker:
             sticker = await create_sticker(
             sticker = await create_sticker(
@@ -112,7 +115,9 @@ async def kang(client, message):
                 )
                 )
                 return False
                 return False
             sticker = await create_sticker(
             sticker = await create_sticker(
-                await upload_document(client, temp_file_path, message.chat.id),
+                await upload_document(
+                    client, temp_file_path, message.chat.id
+                ),
                 sticker_emoji,
                 sticker_emoji,
             )
             )
             if os.path.isfile(temp_file_path):
             if os.path.isfile(temp_file_path):
@@ -134,7 +139,9 @@ async def kang(client, message):
     packname = "f" + str(message.from_user.id) + "_by_" + BOT_USERNAME
     packname = "f" + str(message.from_user.id) + "_by_" + BOT_USERNAME
     try:
     try:
         while True:
         while True:
-            stickerset = await get_sticker_set_by_name(client, packname)
+            stickerset = await get_sticker_set_by_name(
+                client, packname
+            )
             if not stickerset:
             if not stickerset:
                 stickerset = await create_sticker_set(
                 stickerset = await create_sticker_set(
                     client,
                     client,
@@ -165,14 +172,23 @@ async def kang(client, message):
         )
         )
     except (PeerIdInvalid, UserIsBlocked):
     except (PeerIdInvalid, UserIsBlocked):
         keyboard = InlineKeyboardMarkup(
         keyboard = InlineKeyboardMarkup(
-            [[InlineKeyboardButton(text="Start", url=f"t.me/{BOT_USERNAME}")]]
+            [
+                [
+                    InlineKeyboardButton(
+                        text="Start", url=f"t.me/{BOT_USERNAME}"
+                    )
+                ]
+            ]
         )
         )
         await msg.edit(
         await msg.edit(
-            "You Need To Start A Private Chat With Me.", reply_markup=keyboard
+            "You Need To Start A Private Chat With Me.",
+            reply_markup=keyboard,
         )
         )
     except StickerPngNopng:
     except StickerPngNopng:
         await message.reply_text(
         await message.reply_text(
             "Stickers must be png files but the provided image was not a png"
             "Stickers must be png files but the provided image was not a png"
         )
         )
     except StickerPngDimensions:
     except StickerPngDimensions:
-        await message.reply_text("The sticker png dimensions are invalid.")
+        await message.reply_text(
+            "The sticker png dimensions are invalid."
+        )

+ 20 - 8
wbb/modules/sudo.py

@@ -48,18 +48,22 @@ can even delete your account.
 
 
 
 
 @app2.on_message(
 @app2.on_message(
-    filters.command("useradd", prefixes=USERBOT_PREFIX) & filters.user(SUDOERS)
+    filters.command("useradd", prefixes=USERBOT_PREFIX)
+    & filters.user(SUDOERS)
 )
 )
 @capture_err
 @capture_err
 async def useradd(_, message: Message):
 async def useradd(_, message: Message):
     if not message.reply_to_message:
     if not message.reply_to_message:
         return await edit_or_reply(
         return await edit_or_reply(
-            message, text="Reply to someone's message to add him to sudoers."
+            message,
+            text="Reply to someone's message to add him to sudoers.",
         )
         )
     user_id = message.reply_to_message.from_user.id
     user_id = message.reply_to_message.from_user.id
     sudoers = await get_sudoers()
     sudoers = await get_sudoers()
     if user_id in sudoers:
     if user_id in sudoers:
-        return await edit_or_reply(message, text="User is already in sudoers.")
+        return await edit_or_reply(
+            message, text="User is already in sudoers."
+        )
     if user_id == BOT_ID:
     if user_id == BOT_ID:
         return await edit_or_reply(
         return await edit_or_reply(
             message, text="You can't add assistant bot in sudoers."
             message, text="You can't add assistant bot in sudoers."
@@ -71,11 +75,14 @@ async def useradd(_, message: Message):
             text="Successfully added user in sudoers, Bot will be restarted now.",
             text="Successfully added user in sudoers, Bot will be restarted now.",
         )
         )
         return os.execvp("python3", ["python3", "-m", "wbb"])
         return os.execvp("python3", ["python3", "-m", "wbb"])
-    await edit_or_reply(message, text="Something wrong happened, check logs.")
+    await edit_or_reply(
+        message, text="Something wrong happened, check logs."
+    )
 
 
 
 
 @app2.on_message(
 @app2.on_message(
-    filters.command("userdel", prefixes=USERBOT_PREFIX) & filters.user(SUDOERS)
+    filters.command("userdel", prefixes=USERBOT_PREFIX)
+    & filters.user(SUDOERS)
 )
 )
 @capture_err
 @capture_err
 async def userdel(_, message: Message):
 async def userdel(_, message: Message):
@@ -86,7 +93,9 @@ async def userdel(_, message: Message):
         )
         )
     user_id = message.reply_to_message.from_user.id
     user_id = message.reply_to_message.from_user.id
     if user_id not in await get_sudoers():
     if user_id not in await get_sudoers():
-        return await edit_or_reply(message, text="User is not in sudoers.")
+        return await edit_or_reply(
+            message, text="User is not in sudoers."
+        )
     removed = await remove_sudo(user_id)
     removed = await remove_sudo(user_id)
     if removed:
     if removed:
         await edit_or_reply(
         await edit_or_reply(
@@ -94,11 +103,14 @@ async def userdel(_, message: Message):
             text="Successfully removed user from sudoers, Bot will be restarted now.",
             text="Successfully removed user from sudoers, Bot will be restarted now.",
         )
         )
         return os.execvp("python3", ["python3", "-m", "wbb"])
         return os.execvp("python3", ["python3", "-m", "wbb"])
-    await edit_or_reply(message, text="Something wrong happened, check logs.")
+    await edit_or_reply(
+        message, text="Something wrong happened, check logs."
+    )
 
 
 
 
 @app2.on_message(
 @app2.on_message(
-    filters.command("sudoers", prefixes=USERBOT_PREFIX) & filters.user(SUDOERS)
+    filters.command("sudoers", prefixes=USERBOT_PREFIX)
+    & filters.user(SUDOERS)
 )
 )
 @capture_err
 @capture_err
 async def sudoers_list(_, message: Message):
 async def sudoers_list(_, message: Message):

+ 44 - 16
wbb/modules/sudoers.py

@@ -30,8 +30,8 @@ import psutil
 from pyrogram import filters
 from pyrogram import filters
 from pyrogram.errors import FloodWait
 from pyrogram.errors import FloodWait
 
 
-from wbb import (BOT_ID, GBAN_LOG_GROUP_ID, SUDOERS, USERBOT_USERNAME, app,
-                 bot_start_time)
+from wbb import (BOT_ID, GBAN_LOG_GROUP_ID, SUDOERS, USERBOT_USERNAME,
+                 app, bot_start_time)
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.errors import capture_err
 from wbb.utils import formatter
 from wbb.utils import formatter
 from wbb.utils.dbfunctions import (add_gban_user, get_served_chats,
 from wbb.utils.dbfunctions import (add_gban_user, get_served_chats,
@@ -93,13 +93,17 @@ async def ban_globally(_, message):
         user = await app.get_users(user)
         user = await app.get_users(user)
         from_user = message.from_user
         from_user = message.from_user
         if user.id == from_user.id:
         if user.id == from_user.id:
-            await message.reply_text("You want to gban yourself? FOOL!")
+            await message.reply_text(
+                "You want to gban yourself? FOOL!"
+            )
         elif user.id == BOT_ID:
         elif user.id == BOT_ID:
             await message.reply_text(
             await message.reply_text(
                 "Should i gban myself? I'm not fool like you, HUMAN!"
                 "Should i gban myself? I'm not fool like you, HUMAN!"
             )
             )
         elif user.id in SUDOERS:
         elif user.id in SUDOERS:
-            await message.reply_text("You want to ban a sudo user? GET REKT!!")
+            await message.reply_text(
+                "You want to ban a sudo user? GET REKT!!"
+            )
         else:
         else:
             served_chats = await get_served_chats()
             served_chats = await get_served_chats()
             m = await message.reply_text(
             m = await message.reply_text(
@@ -110,7 +114,9 @@ async def ban_globally(_, message):
             number_of_chats = 0
             number_of_chats = 0
             for served_chat in served_chats:
             for served_chat in served_chats:
                 try:
                 try:
-                    await app.kick_chat_member(served_chat["chat_id"], user.id)
+                    await app.kick_chat_member(
+                        served_chat["chat_id"], user.id
+                    )
                     number_of_chats += 1
                     number_of_chats += 1
                     await asyncio.sleep(1)
                     await asyncio.sleep(1)
                 except Exception:
                 except Exception:
@@ -163,11 +169,15 @@ __**New Global Ban**__
             "Should i gban myself? I'm not fool like you, HUMAN!"
             "Should i gban myself? I'm not fool like you, HUMAN!"
         )
         )
     elif user_id in SUDOERS:
     elif user_id in SUDOERS:
-        await message.reply_text("You want to ban a sudo user? GET REKT!!")
+        await message.reply_text(
+            "You want to ban a sudo user? GET REKT!!"
+        )
     else:
     else:
         is_gbanned = await is_gbanned_user(user_id)
         is_gbanned = await is_gbanned_user(user_id)
         if is_gbanned:
         if is_gbanned:
-            await message.reply_text("He's already gbanned, why bully him?")
+            await message.reply_text(
+                "He's already gbanned, why bully him?"
+            )
         else:
         else:
             served_chats = await get_served_chats()
             served_chats = await get_served_chats()
             m = await message.reply_text(
             m = await message.reply_text(
@@ -177,7 +187,9 @@ __**New Global Ban**__
             number_of_chats = 0
             number_of_chats = 0
             for served_chat in served_chats:
             for served_chat in served_chats:
                 try:
                 try:
-                    await app.kick_chat_member(served_chat["chat_id"], user_id)
+                    await app.kick_chat_member(
+                        served_chat["chat_id"], user_id
+                    )
                     number_of_chats += 1
                     number_of_chats += 1
                     await asyncio.sleep(1)
                     await asyncio.sleep(1)
                 except Exception:
                 except Exception:
@@ -234,20 +246,28 @@ async def unban_globally(_, message):
         user = await app.get_users(user)
         user = await app.get_users(user)
         from_user = message.from_user
         from_user = message.from_user
         if user.id == from_user.id:
         if user.id == from_user.id:
-            await message.reply_text("You want to ungban yourself? FOOL!")
+            await message.reply_text(
+                "You want to ungban yourself? FOOL!"
+            )
         elif user.id == BOT_ID:
         elif user.id == BOT_ID:
             await message.reply_text(
             await message.reply_text(
                 "Should i ungban myself? But i'm not gbanned."
                 "Should i ungban myself? But i'm not gbanned."
             )
             )
         elif user.id in SUDOERS:
         elif user.id in SUDOERS:
-            await message.reply_text("Sudo users can't be gbanned/ungbanned.")
+            await message.reply_text(
+                "Sudo users can't be gbanned/ungbanned."
+            )
         else:
         else:
             is_gbanned = await is_gbanned_user(user.id)
             is_gbanned = await is_gbanned_user(user.id)
             if not is_gbanned:
             if not is_gbanned:
-                await message.reply_text("He's already free, why bully him?")
+                await message.reply_text(
+                    "He's already free, why bully him?"
+                )
             else:
             else:
                 await remove_gban_user(user.id)
                 await remove_gban_user(user.id)
-                await message.reply_text(f"Unbanned {user.mention} Globally!")
+                await message.reply_text(
+                    f"Unbanned {user.mention} Globally!"
+                )
         return
         return
 
 
     from_user_id = message.from_user.id
     from_user_id = message.from_user.id
@@ -260,11 +280,15 @@ async def unban_globally(_, message):
             "Should i ungban myself? But i'm not gbanned."
             "Should i ungban myself? But i'm not gbanned."
         )
         )
     elif user_id in SUDOERS:
     elif user_id in SUDOERS:
-        await message.reply_text("Sudo users can't be gbanned/ungbanned.")
+        await message.reply_text(
+            "Sudo users can't be gbanned/ungbanned."
+        )
     else:
     else:
         is_gbanned = await is_gbanned_user(user_id)
         is_gbanned = await is_gbanned_user(user_id)
         if not is_gbanned:
         if not is_gbanned:
-            await message.reply_text("He's already free, why bully him?")
+            await message.reply_text(
+                "He's already free, why bully him?"
+            )
         else:
         else:
             await remove_gban_user(user_id)
             await remove_gban_user(user_id)
             await message.reply_text(f"Unbanned {mention} Globally!")
             await message.reply_text(f"Unbanned {mention} Globally!")
@@ -274,12 +298,16 @@ async def unban_globally(_, message):
 
 
 
 
 @app.on_message(
 @app.on_message(
-    filters.command("broadcast") & filters.user(SUDOERS) & ~filters.edited
+    filters.command("broadcast")
+    & filters.user(SUDOERS)
+    & ~filters.edited
 )
 )
 @capture_err
 @capture_err
 async def broadcast_message(_, message):
 async def broadcast_message(_, message):
     if len(message.command) < 2:
     if len(message.command) < 2:
-        return await message.reply_text("**Usage**:\n/broadcast [MESSAGE]")
+        return await message.reply_text(
+            "**Usage**:\n/broadcast [MESSAGE]"
+        )
     sleep_time = 3
     sleep_time = 3
     text = message.text.split(None, 1)[1]
     text = message.text.split(None, 1)[1]
     sent = 0
     sent = 0

+ 5 - 3
wbb/modules/taglogger.py

@@ -25,8 +25,8 @@ from pykeyboard import InlineKeyboard
 from pyrogram import filters
 from pyrogram import filters
 from pyrogram.types import InlineKeyboardButton, Message
 from pyrogram.types import InlineKeyboardButton, Message
 
 
-from wbb import (BOT_ID, LOG_GROUP_ID, LOG_MENTIONS, USERBOT_ID, USERBOT_NAME,
-                 USERBOT_USERNAME, app, app2)
+from wbb import (BOT_ID, LOG_GROUP_ID, LOG_MENTIONS, USERBOT_ID,
+                 USERBOT_NAME, USERBOT_USERNAME, app, app2)
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.errors import capture_err
 from wbb.utils.filter_groups import taglog_group
 from wbb.utils.filter_groups import taglog_group
 
 
@@ -52,7 +52,9 @@ async def sendLog(message: Message):
 **Bot:** {message.from_user.is_bot}
 **Bot:** {message.from_user.is_bot}
 """
 """
     button = InlineKeyboard(row_width=1)
     button = InlineKeyboard(row_width=1)
-    button.add(InlineKeyboardButton(text="Check Action", url=message.link))
+    button.add(
+        InlineKeyboardButton(text="Check Action", url=message.link)
+    )
     await app.send_message(
     await app.send_message(
         LOG_GROUP_ID,
         LOG_GROUP_ID,
         text=msg,
         text=msg,

+ 2 - 2
wbb/modules/trust.py

@@ -26,8 +26,8 @@ from asyncio import Lock
 from pyrogram import filters
 from pyrogram import filters
 from pyrogram.types import Message
 from pyrogram.types import Message
 
 
-from wbb import (BOT_ID, MESSAGE_DUMP_CHAT, USERBOT_BOT_CHAT_COMMON, app, app2,
-                 arq)
+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.dbfunctions import get_trust_db, update_trust_db
 from wbb.utils.filter_groups import trust_group
 from wbb.utils.filter_groups import trust_group
 
 

+ 9 - 3
wbb/modules/userbot.py

@@ -118,13 +118,17 @@ async def executor(client, message: Message):
 )
 )
 async def shellrunner(client, message: Message):
 async def shellrunner(client, message: Message):
     if len(message.command) < 2:
     if len(message.command) < 2:
-        return await edit_or_reply(message, text="**Usage:**\n/sh git pull")
+        return await edit_or_reply(
+            message, text="**Usage:**\n/sh git pull"
+        )
     text = message.text.split(None, 1)[1]
     text = message.text.split(None, 1)[1]
     if "\n" in text:
     if "\n" in text:
         code = text.split("\n")
         code = text.split("\n")
         output = ""
         output = ""
         for x in code:
         for x in code:
-            shell = re.split(""" (?=(?:[^'"]|'[^']*'|"[^"]*")*$)""", x)
+            shell = re.split(
+                """ (?=(?:[^'"]|'[^']*'|"[^"]*")*$)""", x
+            )
             try:
             try:
                 process = subprocess.Popen(
                 process = subprocess.Popen(
                     shell,
                     shell,
@@ -229,7 +233,9 @@ async def c_cpp_eval(_, message: Message):
     out = pRun.stdout.decode()
     out = pRun.stdout.decode()
     err = f"**RUNTIME ERROR:**\n```{escape(err)}```" if err else None
     err = f"**RUNTIME ERROR:**\n```{escape(err)}```" if err else None
     out = f"**OUTPUT:**\n```{escape(out)}```" if out else None
     out = f"**OUTPUT:**\n```{escape(out)}```" if out else None
-    text = f"**INPUT:**\n```{escape(code)}```\n\n{err if err else out}"
+    text = (
+        f"**INPUT:**\n```{escape(code)}```\n\n{err if err else out}"
+    )
     if len(text) > 4090:
     if len(text) > 4090:
         return await sendFile(message, text)
         return await sendFile(message, text)
     await edit_or_reply(message, text=text)
     await edit_or_reply(message, text=text)

+ 3 - 1
wbb/modules/webss.py

@@ -35,7 +35,9 @@ __HELP__ = "/webss | .webss [URL] - Take A Screenshot Of A Webpage"
 async def take_ss(_, message):
 async def take_ss(_, message):
     try:
     try:
         if len(message.command) != 2:
         if len(message.command) != 2:
-            return await message.reply_text("Give A Url To Fetch Screenshot.")
+            return await message.reply_text(
+                "Give A Url To Fetch Screenshot."
+            )
         url = message.text.split(None, 1)[1]
         url = message.text.split(None, 1)[1]
         m = await message.reply_text("**Taking Screenshot**")
         m = await message.reply_text("**Taking Screenshot**")
         await m.edit("**Uploading**")
         await m.edit("**Uploading**")

+ 13 - 5
wbb/modules/ytdl.py

@@ -32,7 +32,8 @@ from pyrogram.types import InlineKeyboardButton
 
 
 from wbb import app, arq
 from wbb import app, arq
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.errors import capture_err
-from wbb.utils.formatter import convert_seconds_to_minutes as timeFormat
+from wbb.utils.formatter import \
+    convert_seconds_to_minutes as timeFormat
 from wbb.utils.functions import downloader
 from wbb.utils.functions import downloader
 
 
 __MODULE__ = "YoutubeDL"
 __MODULE__ = "YoutubeDL"
@@ -46,7 +47,9 @@ VIDEO_DATA = {}
 @capture_err
 @capture_err
 async def ytdl_func(_, message):
 async def ytdl_func(_, message):
     if len(message.command) != 2:
     if len(message.command) != 2:
-        return await message.reply_text("**Usage:**/ytdl [VIDEO_LINK]")
+        return await message.reply_text(
+            "**Usage:**/ytdl [VIDEO_LINK]"
+        )
     m = await message.reply_text("Processing")
     m = await message.reply_text("Processing")
     url = message.text.split(None, 1)[1]
     url = message.text.split(None, 1)[1]
     results = await arq.ytdl(url)
     results = await arq.ytdl(url)
@@ -72,11 +75,14 @@ async def ytdl_func(_, message):
             "duration": duration,
             "duration": duration,
             "format": format,
             "format": format,
             "thumbnail": thumbnail,
             "thumbnail": thumbnail,
-            "cc": message.from_user.mention if message.from_user else "Anon",
+            "cc": message.from_user.mention
+            if message.from_user
+            else "Anon",
         }
         }
         keyboard.append(
         keyboard.append(
             InlineKeyboardButton(
             InlineKeyboardButton(
-                text=f"{quality} | {size}", callback_data=f"ytdl {data}"
+                text=f"{quality} | {size}",
+                callback_data=f"ytdl {data}",
             )
             )
         )
         )
     buttons.add(*keyboard)
     buttons.add(*keyboard)
@@ -84,7 +90,9 @@ async def ytdl_func(_, message):
 **Title:** {title}
 **Title:** {title}
 **Duration:** {await timeFormat(duration)}
 **Duration:** {await timeFormat(duration)}
 """
 """
-    await message.reply_photo(thumbnail, caption=caption, reply_markup=buttons)
+    await message.reply_photo(
+        thumbnail, caption=caption, reply_markup=buttons
+    )
     await m.delete()
     await m.delete()
 
 
 
 

+ 14 - 4
wbb/utils/aiodownloader/downloader.py

@@ -74,7 +74,9 @@ class DownloadJob:
             # Checkning the response code
             # Checkning the response code
             if 200 <= resp.status < 300:
             if 200 <= resp.status < 300:
                 # Saving the data to the file chunk by chunk.
                 # Saving the data to the file chunk by chunk.
-                async with aiofiles.open(self.file_path, "wb") as file:
+                async with aiofiles.open(
+                    self.file_path, "wb"
+                ) as file:
 
 
                     # Downloading the file using the aiohttp.StreamReader
                     # Downloading the file using the aiohttp.StreamReader
                     async for data in resp.content.iter_chunked(
                     async for data in resp.content.iter_chunked(
@@ -111,7 +113,9 @@ class Handler:
     ):
     ):
 
 
         self._loop = loop or asyncio.get_event_loop()
         self._loop = loop or asyncio.get_event_loop()
-        self._session = session or aiohttp.ClientSession(loop=self._loop)
+        self._session = session or aiohttp.ClientSession(
+            loop=self._loop
+        )
         self._chunk_size = chunk_size
         self._chunk_size = chunk_size
 
 
     def _job_factory(
     def _job_factory(
@@ -143,6 +147,12 @@ class Handler:
 
 
         await task
         await task
         file_name = url.split("/")[-1]
         file_name = url.split("/")[-1]
-        file_name = file_name[0:230] if len(file_name) > 230 else file_name
-        path = os.getcwd() + "/" + file_name if not save_path else save_path
+        file_name = (
+            file_name[0:230] if len(file_name) > 230 else file_name
+        )
+        path = (
+            os.getcwd() + "/" + file_name
+            if not save_path
+            else save_path
+        )
         return path
         return path

+ 53 - 17
wbb/utils/dbfunctions.py

@@ -102,7 +102,9 @@ async def delete_note(chat_id: int, name: str) -> bool:
     if name in notesd:
     if name in notesd:
         del notesd[name]
         del notesd[name]
         await notesdb.update_one(
         await notesdb.update_one(
-            {"chat_id": chat_id}, {"$set": {"notes": notesd}}, upsert=True
+            {"chat_id": chat_id},
+            {"$set": {"notes": notesd}},
+            upsert=True,
         )
         )
         return True
         return True
     return False
     return False
@@ -121,7 +123,10 @@ async def get_filters_count() -> dict:
         filters_name = await get_filters_names(chat["chat_id"])
         filters_name = await get_filters_names(chat["chat_id"])
         filters_count += len(filters_name)
         filters_count += len(filters_name)
         chats_count += 1
         chats_count += 1
-    return {"chats_count": chats_count, "filters_count": filters_count}
+    return {
+        "chats_count": chats_count,
+        "filters_count": filters_count,
+    }
 
 
 
 
 async def _get_filters(chat_id: int) -> Dict[str, int]:
 async def _get_filters(chat_id: int) -> Dict[str, int]:
@@ -152,7 +157,9 @@ async def save_filter(chat_id: int, name: str, _filter: dict):
     _filters = await _get_filters(chat_id)
     _filters = await _get_filters(chat_id)
     _filters[name] = _filter
     _filters[name] = _filter
     await filtersdb.update_one(
     await filtersdb.update_one(
-        {"chat_id": chat_id}, {"$set": {"filters": _filters}}, upsert=True
+        {"chat_id": chat_id},
+        {"$set": {"filters": _filters}},
+        upsert=True,
     )
     )
 
 
 
 
@@ -162,7 +169,9 @@ async def delete_filter(chat_id: int, name: str) -> bool:
     if name in filtersd:
     if name in filtersd:
         del filtersd[name]
         del filtersd[name]
         await filtersdb.update_one(
         await filtersdb.update_one(
-            {"chat_id": chat_id}, {"$set": {"filters": filtersd}}, upsert=True
+            {"chat_id": chat_id},
+            {"$set": {"filters": filtersd}},
+            upsert=True,
         )
         )
         return True
         return True
     return False
     return False
@@ -233,7 +242,9 @@ async def remove_warns(chat_id: int, name: str) -> bool:
     if name in warnsd:
     if name in warnsd:
         del warnsd[name]
         del warnsd[name]
         await warnsdb.update_one(
         await warnsdb.update_one(
-            {"chat_id": chat_id}, {"$set": {"warns": warnsd}}, upsert=True
+            {"chat_id": chat_id},
+            {"$set": {"warns": warnsd}},
+            upsert=True,
         )
         )
         return True
         return True
     return False
     return False
@@ -263,7 +274,9 @@ async def user_global_karma(user_id) -> int:
         return 0
         return 0
     total_karma = 0
     total_karma = 0
     for chat in await chats.to_list(length=1000000):
     for chat in await chats.to_list(length=1000000):
-        karma = await get_karma(chat["chat_id"], await int_to_alpha(user_id))
+        karma = await get_karma(
+            chat["chat_id"], await int_to_alpha(user_id)
+        )
         if karma:
         if karma:
             if int(karma["karma"]) > 0:
             if int(karma["karma"]) > 0:
                 total_karma += int(karma["karma"])
                 total_karma += int(karma["karma"])
@@ -427,7 +440,9 @@ async def save_couple(chat_id: int, date: str, couple: dict):
     lovers = await _get_lovers(chat_id)
     lovers = await _get_lovers(chat_id)
     lovers[date] = couple
     lovers[date] = couple
     await coupledb.update_one(
     await coupledb.update_one(
-        {"chat_id": chat_id}, {"$set": {"couple": lovers}}, upsert=True
+        {"chat_id": chat_id},
+        {"$set": {"couple": lovers}},
+        upsert=True,
     )
     )
 
 
 
 
@@ -554,7 +569,9 @@ async def update_captcha_cache(captcha_dict):
     if not pickle:
     if not pickle:
         return
         return
     await captcha_cachedb.update_one(
     await captcha_cachedb.update_one(
-        {"captcha": "cache"}, {"$set": {"pickled": pickle}}, upsert=True
+        {"captcha": "cache"},
+        {"$set": {"pickled": pickle}},
+        upsert=True,
     )
     )
 
 
 
 
@@ -578,11 +595,16 @@ async def get_blacklist_filters_count() -> dict:
         filters = await get_blacklisted_words(chat["chat_id"])
         filters = await get_blacklisted_words(chat["chat_id"])
         filters_count += len(filters)
         filters_count += len(filters)
         chats_count += 1
         chats_count += 1
-    return {"chats_count": chats_count, "filters_count": filters_count}
+    return {
+        "chats_count": chats_count,
+        "filters_count": filters_count,
+    }
 
 
 
 
 async def get_blacklisted_words(chat_id: int) -> List[str]:
 async def get_blacklisted_words(chat_id: int) -> List[str]:
-    _filters = await blacklist_filtersdb.find_one({"chat_id": chat_id})
+    _filters = await blacklist_filtersdb.find_one(
+        {"chat_id": chat_id}
+    )
     if not _filters:
     if not _filters:
         return []
         return []
     return _filters["filters"]
     return _filters["filters"]
@@ -593,7 +615,9 @@ async def save_blacklist_filter(chat_id: int, word: str):
     _filters = await get_blacklisted_words(chat_id)
     _filters = await get_blacklisted_words(chat_id)
     _filters.append(word)
     _filters.append(word)
     await blacklist_filtersdb.update_one(
     await blacklist_filtersdb.update_one(
-        {"chat_id": chat_id}, {"$set": {"filters": _filters}}, upsert=True
+        {"chat_id": chat_id},
+        {"$set": {"filters": _filters}},
+        upsert=True,
     )
     )
 
 
 
 
@@ -603,7 +627,9 @@ async def delete_blacklist_filter(chat_id: int, word: str) -> bool:
     if word in filtersd:
     if word in filtersd:
         filtersd.remove(word)
         filtersd.remove(word)
         await blacklist_filtersdb.update_one(
         await blacklist_filtersdb.update_one(
-            {"chat_id": chat_id}, {"$set": {"filters": filtersd}}, upsert=True
+            {"chat_id": chat_id},
+            {"$set": {"filters": filtersd}},
+            upsert=True,
         )
         )
         return True
         return True
     return False
     return False
@@ -612,7 +638,9 @@ async def delete_blacklist_filter(chat_id: int, word: str) -> bool:
 """ PIPES SYSTEM """
 """ PIPES SYSTEM """
 
 
 
 
-async def activate_pipe(from_chat_id: int, to_chat_id: int, fetcher: str):
+async def activate_pipe(
+    from_chat_id: int, to_chat_id: int, fetcher: str
+):
     pipes = await show_pipes()
     pipes = await show_pipes()
     pipe = {
     pipe = {
         "from_chat_id": from_chat_id,
         "from_chat_id": from_chat_id,
@@ -689,7 +717,10 @@ async def remove_sudo(user_id: int) -> bool:
 
 
 async def blacklisted_chats() -> list:
 async def blacklisted_chats() -> list:
     chats = blacklist_chatdb.find({"chat_id": {"$lt": 0}})
     chats = blacklist_chatdb.find({"chat_id": {"$lt": 0}})
-    return [chat["chat_id"] for chat in await chats.to_list(length=1000000000)]
+    return [
+        chat["chat_id"]
+        for chat in await chats.to_list(length=1000000000)
+    ]
 
 
 
 
 async def blacklist_chat(chat_id: int) -> bool:
 async def blacklist_chat(chat_id: int) -> bool:
@@ -727,7 +758,10 @@ async def clean_restart_stage() -> dict:
     if not data:
     if not data:
         return {}
         return {}
     await restart_stagedb.delete_one({"something": "something"})
     await restart_stagedb.delete_one({"something": "something"})
-    return {"chat_id": data["chat_id"], "message_id": data["message_id"]}
+    return {
+        "chat_id": data["chat_id"],
+        "message_id": data["message_id"],
+    }
 
 
 
 
 """ TRUST DB """
 """ TRUST DB """
@@ -748,7 +782,9 @@ async def update_trust_db(user_id: int, new_data: float):
     data.append(new_data)
     data.append(new_data)
     try:
     try:
         await trustdb.update_one(
         await trustdb.update_one(
-            {"user_id": user_id}, {"$set": {"data": data}}, upsert=True
+            {"user_id": user_id},
+            {"$set": {"data": data}},
+            upsert=True,
         )
         )
     except Exception:
     except Exception:
-        pass # to prevent stack overflow error
+        pass  # to prevent stack overflow error

+ 3 - 1
wbb/utils/files.py

@@ -83,7 +83,9 @@ async def upload_document(
     )
     )
 
 
 
 
-async def get_document_from_file_id(file_id: str) -> raw.base.InputDocument:
+async def get_document_from_file_id(
+    file_id: str,
+) -> raw.base.InputDocument:
     decoded = FileId.decode(file_id)
     decoded = FileId.decode(file_id)
     return raw.types.InputDocument(
     return raw.types.InputDocument(
         id=decoded.media_id,
         id=decoded.media_id,

+ 12 - 4
wbb/utils/functions.py

@@ -93,7 +93,9 @@ def generate_captcha():
     for t in range(4):
     for t in range(4):
         letter = gen_letter()
         letter = gen_letter()
         correct_answer += letter
         correct_answer += letter
-        draw.text((60 * t + 50, 15), letter, font=font, fill=rndColor2())
+        draw.text(
+            (60 * t + 50, 15), letter, font=font, fill=rndColor2()
+        )
     image = image.filter(ImageFilter.BLUR)
     image = image.filter(ImageFilter.BLUR)
     image.save(file, "jpeg")
     image.save(file, "jpeg")
     return [file, correct_answer, wrong_answers]
     return [file, correct_answer, wrong_answers]
@@ -139,7 +141,9 @@ async def transfer_sh(file):
     async with aiofiles.open(file, "rb") as f:
     async with aiofiles.open(file, "rb") as f:
         params = {file: await f.read()}
         params = {file: await f.read()}
     async with aiohttp.ClientSession() as session:
     async with aiohttp.ClientSession() as session:
-        async with session.post("https://transfer.sh/", data=params) as resp:
+        async with session.post(
+            "https://transfer.sh/", data=params
+        ) as resp:
             download_link = str(await resp.text()).strip()
             download_link = str(await resp.text()).strip()
     return download_link
     return download_link
 
 
@@ -159,7 +163,8 @@ def str_to_obj(string: str):
 async def calc_distance_from_ip(ip1: str, ip2: str) -> float:
 async def calc_distance_from_ip(ip1: str, ip2: str) -> float:
     Radius_Earth = 6371.0088
     Radius_Earth = 6371.0088
     data1, data2 = await gather(
     data1, data2 = await gather(
-        fetch(f"http://ipinfo.io/{ip1}"), fetch(f"http://ipinfo.io/{ip2}")
+        fetch(f"http://ipinfo.io/{ip1}"),
+        fetch(f"http://ipinfo.io/{ip2}"),
     )
     )
     lat1, lon1 = data1["loc"].split(",")
     lat1, lon1 = data1["loc"].split(",")
     lat2, lon2 = data2["loc"].split(",")
     lat2, lon2 = data2["loc"].split(",")
@@ -167,7 +172,10 @@ async def calc_distance_from_ip(ip1: str, ip2: str) -> float:
     lat2, lon2 = radians(float(lat2)), radians(float(lon2))
     lat2, lon2 = radians(float(lat2)), radians(float(lon2))
     dlon = lon2 - lon1
     dlon = lon2 - lon1
     dlat = lat2 - lat1
     dlat = lat2 - lat1
-    a = sin(dlat / 2) ** 2 + cos(lat1) * cos(lat2) * sin(dlon / 2) ** 2
+    a = (
+        sin(dlat / 2) ** 2
+        + cos(lat1) * cos(lat2) * sin(dlon / 2) ** 2
+    )
     c = 2 * atan2(sqrt(a), sqrt(1 - a))
     c = 2 * atan2(sqrt(a), sqrt(1 - a))
     distance = Radius_Earth * c
     distance = Radius_Earth * c
     return distance
     return distance

+ 80 - 33
wbb/utils/inlinefuncs.py

@@ -34,13 +34,15 @@ from pykeyboard import InlineKeyboard
 from pyrogram import __version__ as pyrover
 from pyrogram import __version__ as pyrover
 from pyrogram import filters
 from pyrogram import filters
 from pyrogram.raw.functions import Ping
 from pyrogram.raw.functions import Ping
-from pyrogram.types import (InlineKeyboardButton, InlineQueryResultArticle,
-                            InlineQueryResultPhoto, InputTextMessageContent)
+from pyrogram.types import (InlineKeyboardButton,
+                            InlineQueryResultArticle,
+                            InlineQueryResultPhoto,
+                            InputTextMessageContent)
 from search_engine_parser import GoogleSearch
 from search_engine_parser import GoogleSearch
 
 
 from wbb import (BOT_USERNAME, MESSAGE_DUMP_CHAT, SUDOERS, USERBOT_ID,
 from wbb import (BOT_USERNAME, MESSAGE_DUMP_CHAT, SUDOERS, USERBOT_ID,
-                 USERBOT_NAME, USERBOT_USERNAME, aiohttpsession, app, app2,
-                 arq)
+                 USERBOT_NAME, USERBOT_USERNAME, aiohttpsession, app,
+                 app2, arq)
 from wbb.core.types import InlineQueryResultCachedDocument
 from wbb.core.types import InlineQueryResultCachedDocument
 from wbb.modules.info import get_chat_info, get_user_info
 from wbb.modules.info import get_chat_info, get_user_info
 from wbb.modules.music import download_youtube_audio
 from wbb.modules.music import download_youtube_audio
@@ -78,7 +80,11 @@ async def inline_help_func(__HELP__):
     buttons = InlineKeyboard(row_width=4)
     buttons = InlineKeyboard(row_width=4)
     buttons.add(
     buttons.add(
         *[
         *[
-            (InlineKeyboardButton(text=i, switch_inline_query_current_chat=i))
+            (
+                InlineKeyboardButton(
+                    text=i, switch_inline_query_current_chat=i
+                )
+            )
             for i in keywords_list
             for i in keywords_list
         ]
         ]
     )
     )
@@ -147,7 +153,9 @@ async def translate_func(answers, lang, tex):
             InlineQueryResultArticle(
             InlineQueryResultArticle(
                 title="Error",
                 title="Error",
                 description=result.result,
                 description=result.result,
-                input_message_content=InputTextMessageContent(result.result),
+                input_message_content=InputTextMessageContent(
+                    result.result
+                ),
             )
             )
         )
         )
         return answers
         return answers
@@ -185,7 +193,9 @@ async def urban_func(answers, text):
             InlineQueryResultArticle(
             InlineQueryResultArticle(
                 title="Error",
                 title="Error",
                 description=results.result,
                 description=results.result,
-                input_message_content=InputTextMessageContent(results.result),
+                input_message_content=InputTextMessageContent(
+                    results.result
+                ),
             )
             )
         )
         )
         return answers
         return answers
@@ -242,7 +252,9 @@ async def wall_func(answers, text):
             InlineQueryResultArticle(
             InlineQueryResultArticle(
                 title="Error",
                 title="Error",
                 description=results.result,
                 description=results.result,
-                input_message_content=InputTextMessageContent(results.result),
+                input_message_content=InputTextMessageContent(
+                    results.result
+                ),
             )
             )
         )
         )
         return answers
         return answers
@@ -294,7 +306,9 @@ async def torrent_func(answers, text):
             InlineQueryResultArticle(
             InlineQueryResultArticle(
                 title="Error",
                 title="Error",
                 description=results.result,
                 description=results.result,
-                input_message_content=InputTextMessageContent(results.result),
+                input_message_content=InputTextMessageContent(
+                    results.result
+                ),
             )
             )
         )
         )
         return answers
         return answers
@@ -335,7 +349,9 @@ async def youtube_func(answers, text):
             InlineQueryResultArticle(
             InlineQueryResultArticle(
                 title="Error",
                 title="Error",
                 description=results.result,
                 description=results.result,
-                input_message_content=InputTextMessageContent(results.result),
+                input_message_content=InputTextMessageContent(
+                    results.result
+                ),
             )
             )
         )
         )
         return answers
         return answers
@@ -351,9 +367,7 @@ async def youtube_func(answers, text):
 **Duration:** {i.duration}
 **Duration:** {i.duration}
 **Uploaded:** {i.publish_time}
 **Uploaded:** {i.publish_time}
 **Description:** {i.long_desc}"""
 **Description:** {i.long_desc}"""
-        description = (
-            f"{i.views} | {i.channel} | {i.duration} | {i.publish_time}"
-        )
+        description = f"{i.views} | {i.channel} | {i.duration} | {i.publish_time}"
         answers.append(
         answers.append(
             InlineQueryResultArticle(
             InlineQueryResultArticle(
                 title=i.title,
                 title=i.title,
@@ -375,7 +389,9 @@ async def lyrics_func(answers, text):
             InlineQueryResultArticle(
             InlineQueryResultArticle(
                 title="Error",
                 title="Error",
                 description=song.result,
                 description=song.result,
-                input_message_content=InputTextMessageContent(song.result),
+                input_message_content=InputTextMessageContent(
+                    song.result
+                ),
             )
             )
         )
         )
         return answers
         return answers
@@ -504,10 +520,13 @@ async def tg_search_func(answers, text, user_id):
         buttons.add(
         buttons.add(
             InlineKeyboardButton(
             InlineKeyboardButton(
                 text="Origin",
                 text="Origin",
-                url=message.link if message.link else "https://t.me/telegram",
+                url=message.link
+                if message.link
+                else "https://t.me/telegram",
             ),
             ),
             InlineKeyboardButton(
             InlineKeyboardButton(
-                text="Search again", switch_inline_query_current_chat="search"
+                text="Search again",
+                switch_inline_query_current_chat="search",
             ),
             ),
         )
         )
         name = (
         name = (
@@ -564,7 +583,9 @@ async def music_inline_func(answers, query):
         messages_ids_and_duration.append(
         messages_ids_and_duration.append(
             {
             {
                 "message_id": f_.message_id,
                 "message_id": f_.message_id,
-                "duration": f_.audio.duration if f_.audio.duration else 0,
+                "duration": f_.audio.duration
+                if f_.audio.duration
+                else 0,
             }
             }
         )
         )
     messages = list(
     messages = list(
@@ -577,7 +598,8 @@ async def music_inline_func(answers, query):
     for message_ in messages:
     for message_ in messages:
         answers.append(
         answers.append(
             InlineQueryResultCachedDocument(
             InlineQueryResultCachedDocument(
-                file_id=message_.audio.file_id, title=message_.audio.title
+                file_id=message_.audio.file_id,
+                title=message_.audio.title,
             )
             )
         )
         )
     return answers
     return answers
@@ -590,7 +612,9 @@ async def wiki_func(answers, text):
             InlineQueryResultArticle(
             InlineQueryResultArticle(
                 title="Error",
                 title="Error",
                 description=data.result,
                 description=data.result,
-                input_message_content=InputTextMessageContent(data.result),
+                input_message_content=InputTextMessageContent(
+                    data.result
+                ),
             )
             )
         )
         )
         return answers
         return answers
@@ -627,7 +651,9 @@ async def speedtest_init(query):
     msg = "**Click The Button Below To Perform A Speedtest**"
     msg = "**Click The Button Below To Perform A Speedtest**"
     button = InlineKeyboard(row_width=1)
     button = InlineKeyboard(row_width=1)
     button.add(
     button.add(
-        InlineKeyboardButton(text="Test", callback_data="test_speedtest")
+        InlineKeyboardButton(
+            text="Test", callback_data="test_speedtest"
+        )
     )
     )
     answers.append(
     answers.append(
         InlineQueryResultArticle(
         InlineQueryResultArticle(
@@ -649,7 +675,9 @@ async def test_speedtest_cq(_, cq):
     inline_message_id = cq.inline_message_id
     inline_message_id = cq.inline_message_id
     await app.edit_inline_text(inline_message_id, "**Testing**")
     await app.edit_inline_text(inline_message_id, "**Testing**")
     loop = asyncio.get_running_loop()
     loop = asyncio.get_running_loop()
-    download, upload, info = await loop.run_in_executor(None, test_speedtest)
+    download, upload, info = await loop.run_in_executor(
+        None, test_speedtest
+    )
     msg = f"""
     msg = f"""
 **Download:** `{download}`
 **Download:** `{download}`
 **Upload:** `{upload}`
 **Upload:** `{upload}`
@@ -671,7 +699,8 @@ async def pmpermit_func(answers, user_id, victim):
             text="To Scam You", callback_data="pmpermit to_scam_you a"
             text="To Scam You", callback_data="pmpermit to_scam_you a"
         ),
         ),
         InlineKeyboardButton(
         InlineKeyboardButton(
-            text="For promotion", callback_data="pmpermit to_scam_you a"
+            text="For promotion",
+            callback_data="pmpermit to_scam_you a",
         ),
         ),
         InlineKeyboardButton(
         InlineKeyboardButton(
             text="Approve me", callback_data="pmpermit approve_me a"
             text="Approve me", callback_data="pmpermit approve_me a"
@@ -699,7 +728,9 @@ async def ping_func(answers):
     answers.append(
     answers.append(
         InlineQueryResultArticle(
         InlineQueryResultArticle(
             title=ping,
             title=ping,
-            input_message_content=InputTextMessageContent(f"__**{ping}**__"),
+            input_message_content=InputTextMessageContent(
+                f"__**{ping}**__"
+            ),
         )
         )
     )
     )
     return answers
     return answers
@@ -710,7 +741,9 @@ async def yt_music_func(answers, url):
         url = (await arq.youtube(url)).result[0]
         url = (await arq.youtube(url)).result[0]
         url = f"https://youtube.com{url.url_suffix}"
         url = f"https://youtube.com{url.url_suffix}"
     loop = asyncio.get_running_loop()
     loop = asyncio.get_running_loop()
-    music = await loop.run_in_executor(None, download_youtube_audio, url)
+    music = await loop.run_in_executor(
+        None, download_youtube_audio, url
+    )
     if not music:
     if not music:
         msg = "**ERROR**\n__MUSIC TOO LONG__"
         msg = "**ERROR**\n__MUSIC TOO LONG__"
         answers.append(
         answers.append(
@@ -739,7 +772,9 @@ async def yt_music_func(answers, url):
     os.remove(audio)
     os.remove(audio)
     os.remove(thumbnail)
     os.remove(thumbnail)
     answers.append(
     answers.append(
-        InlineQueryResultCachedDocument(title=title, file_id=m.audio.file_id)
+        InlineQueryResultCachedDocument(
+            title=title, file_id=m.audio.file_id
+        )
     )
     )
     return answers
     return answers
 
 
@@ -788,7 +823,9 @@ async def tmdb_func(answers, query):
             InlineQueryResultArticle(
             InlineQueryResultArticle(
                 title="Error",
                 title="Error",
                 description=response.result,
                 description=response.result,
-                input_message_content=InputTextMessageContent(response.result),
+                input_message_content=InputTextMessageContent(
+                    response.result
+                ),
             )
             )
         )
         )
         return answers
         return answers
@@ -800,7 +837,9 @@ async def tmdb_func(answers, query):
             genre = None
             genre = None
         else:
         else:
             genre = " | ".join(result.genre)
             genre = " | ".join(result.genre)
-        description = result.overview[0:900] if result.overview else "None"
+        description = (
+            result.overview[0:900] if result.overview else "None"
+        )
         caption = f"""
         caption = f"""
 **{result.title}**
 **{result.title}**
 **Type:** {result.type}
 **Type:** {result.type}
@@ -812,7 +851,8 @@ async def tmdb_func(answers, query):
         buttons = InlineKeyboard(row_width=1)
         buttons = InlineKeyboard(row_width=1)
         buttons.add(
         buttons.add(
             InlineKeyboardButton(
             InlineKeyboardButton(
-                "Search Again", switch_inline_query_current_chat="tmdb"
+                "Search Again",
+                switch_inline_query_current_chat="tmdb",
             )
             )
         )
         )
         answers.append(
         answers.append(
@@ -836,13 +876,16 @@ async def pypiSearchFunc(answers: list, query: str) -> list:
             InlineQueryResultArticle(
             InlineQueryResultArticle(
                 title="No Such Package",
                 title="No Such Package",
                 description=result.result,
                 description=result.result,
-                input_message_content=InputTextMessageContent(result.result),
+                input_message_content=InputTextMessageContent(
+                    result.result
+                ),
             )
             )
         )
         )
         return answers
         return answers
     result = result.result
     result = result.result
     pURLS = [
     pURLS = [
-        f"**{key}**: {value}" for key, value in result.projectURLS.items()
+        f"**{key}**: {value}"
+        for key, value in result.projectURLS.items()
     ]
     ]
     pURLS = ("\n" + "\n".join(pURLS)) if pURLS else None
     pURLS = ("\n" + "\n".join(pURLS)) if pURLS else None
     caption = f"""
     caption = f"""
@@ -867,7 +910,8 @@ async def pypiSearchFunc(answers: list, query: str) -> list:
     button.add(
     button.add(
         InlineKeyboardButton(text="Open Page", url=result.pypiURL),
         InlineKeyboardButton(text="Open Page", url=result.pypiURL),
         InlineKeyboardButton(
         InlineKeyboardButton(
-            text="Search Again", switch_inline_query_current_chat="pypi"
+            text="Search Again",
+            switch_inline_query_current_chat="pypi",
         ),
         ),
     )
     )
     answers.append(
     answers.append(
@@ -890,7 +934,9 @@ async def image_func(answers, query):
             InlineQueryResultArticle(
             InlineQueryResultArticle(
                 title="Error",
                 title="Error",
                 description=results.result,
                 description=results.result,
-                input_message_content=InputTextMessageContent(results.result),
+                input_message_content=InputTextMessageContent(
+                    results.result
+                ),
             )
             )
         )
         )
         return answers
         return answers
@@ -898,7 +944,8 @@ async def image_func(answers, query):
     buttons = InlineKeyboard(row_width=2)
     buttons = InlineKeyboard(row_width=2)
     buttons.add(
     buttons.add(
         InlineKeyboardButton(
         InlineKeyboardButton(
-            text="Search again", switch_inline_query_current_chat="image"
+            text="Search again",
+            switch_inline_query_current_chat="image",
         ),
         ),
     )
     )
     for i in results:
     for i in results:

+ 9 - 3
wbb/utils/misc.py

@@ -89,11 +89,15 @@ def paginate_modules(page_n, module_dict, prefix, chat=None):
             (
             (
                 EqInlineKeyboardButton(
                 EqInlineKeyboardButton(
                     "<",
                     "<",
-                    callback_data="{}_prev({})".format(prefix, modulo_page),
+                    callback_data="{}_prev({})".format(
+                        prefix, modulo_page
+                    ),
                 ),
                 ),
                 EqInlineKeyboardButton(
                 EqInlineKeyboardButton(
                     ">",
                     ">",
-                    callback_data="{}_next({})".format(prefix, modulo_page),
+                    callback_data="{}_next({})".format(
+                        prefix, modulo_page
+                    ),
                 ),
                 ),
             )
             )
         ]
         ]
@@ -102,4 +106,6 @@ def paginate_modules(page_n, module_dict, prefix, chat=None):
 
 
 
 
 def is_module_loaded(name):
 def is_module_loaded(name):
-    return (not MOD_LOAD or name in MOD_LOAD) and name not in MOD_NOLOAD
+    return (
+        not MOD_LOAD or name in MOD_LOAD
+    ) and name not in MOD_NOLOAD

+ 6 - 2
wbb/utils/stickerset.py

@@ -32,7 +32,9 @@ async def get_sticker_set_by_name(
     try:
     try:
         return await client.send(
         return await client.send(
             raw.functions.messages.GetStickerSet(
             raw.functions.messages.GetStickerSet(
-                stickerset=raw.types.InputStickerSetShortName(short_name=name)
+                stickerset=raw.types.InputStickerSetShortName(
+                    short_name=name
+                )
             )
             )
         )
         )
     except errors.exceptions.not_acceptable_406.StickersetInvalid:
     except errors.exceptions.not_acceptable_406.StickersetInvalid:
@@ -79,4 +81,6 @@ async def add_sticker_to_set(
 async def create_sticker(
 async def create_sticker(
     sticker: raw.base.InputDocument, emoji: str
     sticker: raw.base.InputDocument, emoji: str
 ) -> raw.base.InputStickerSetItem:
 ) -> raw.base.InputStickerSetItem:
-    return raw.types.InputStickerSetItem(document=sticker, emoji=emoji)
+    return raw.types.InputStickerSetItem(
+        document=sticker, emoji=emoji
+    )