TheHamkerCat пре 2 година
родитељ
комит
912838c815
46 измењених фајлова са 438 додато и 169 уклоњено
  1. 20 18
      sample_config.py
  2. 4 1
      wbb/__init__.py
  3. 38 12
      wbb/__main__.py
  4. 7 2
      wbb/core/decorators/permissions.py
  5. 2 2
      wbb/modules/admin.py
  6. 3 1
      wbb/modules/admin_misc.py
  7. 11 3
      wbb/modules/antiservice.py
  8. 1 0
      wbb/modules/autoapprove.py
  9. 3 1
      wbb/modules/autocorrect.py
  10. 3 1
      wbb/modules/blacklist.py
  11. 17 5
      wbb/modules/blacklist_chat.py
  12. 6 2
      wbb/modules/carbon.py
  13. 5 1
      wbb/modules/chat_watcher.py
  14. 7 2
      wbb/modules/chatbot.py
  15. 2 2
      wbb/modules/couple.py
  16. 3 1
      wbb/modules/create.py
  17. 2 1
      wbb/modules/dice.py
  18. 21 9
      wbb/modules/filters.py
  19. 5 1
      wbb/modules/flood.py
  20. 22 8
      wbb/modules/greetings.py
  21. 3 1
      wbb/modules/info.py
  22. 40 14
      wbb/modules/inline.py
  23. 3 1
      wbb/modules/locks.py
  24. 6 2
      wbb/modules/misc.py
  25. 6 2
      wbb/modules/music.py
  26. 22 8
      wbb/modules/notes.py
  27. 3 1
      wbb/modules/parse_preview.py
  28. 4 2
      wbb/modules/paste.py
  29. 5 2
      wbb/modules/pipes.py
  30. 16 5
      wbb/modules/pmpermit.py
  31. 3 1
      wbb/modules/purge_me.py
  32. 6 2
      wbb/modules/quotly.py
  33. 3 1
      wbb/modules/regex.py
  34. 6 2
      wbb/modules/repo.py
  35. 9 5
      wbb/modules/reverse.py
  36. 17 5
      wbb/modules/rice.py
  37. 13 4
      wbb/modules/stickers.py
  38. 3 1
      wbb/modules/sudo.py
  39. 10 4
      wbb/modules/sudoers.py
  40. 10 3
      wbb/modules/taglogger.py
  41. 3 1
      wbb/modules/webss.py
  42. 23 10
      wbb/utils/dbfunctions.py
  43. 2 1
      wbb/utils/files.py
  44. 32 12
      wbb/utils/inlinefuncs.py
  45. 7 3
      wbb/utils/misc.py
  46. 1 3
      wbb/utils/rss.py

+ 20 - 18
sample_config.py

@@ -2,22 +2,24 @@ import os
 
 
 from dotenv import load_dotenv
 from dotenv import load_dotenv
 
 
-load_dotenv("config.env" if os.path.isfile("config.env") else "sample_config.env")
+load_dotenv(
+    "config.env" if os.path.isfile("config.env") else "sample_config.env"
+)
 
 
-BOT_TOKEN = os.environ.get('BOT_TOKEN')
-API_ID = int(os.environ.get('API_ID'))
-SESSION_STRING = os.environ.get('SESSION_STRING', '')
-API_HASH = os.environ.get('API_HASH')
-USERBOT_PREFIX = os.environ.get('USERBOT_PREFIX', '.')
-PHONE_NUMBER = os.environ.get('PHONE_NUMBER')
-SUDO_USERS_ID = list(map(int, os.environ.get('SUDO_USERS_ID', '').split()))
-LOG_GROUP_ID = int(os.environ.get('LOG_GROUP_ID'))
-GBAN_LOG_GROUP_ID = int(os.environ.get('GBAN_LOG_GROUP_ID'))
-MESSAGE_DUMP_CHAT = int(os.environ.get('MESSAGE_DUMP_CHAT'))
-WELCOME_DELAY_KICK_SEC = int(os.environ.get('WELCOME_DELAY_KICK_SEC', 600))
-MONGO_URL = os.environ.get('MONGO_URL')
-ARQ_API_KEY = os.environ.get('ARQ_API_KEY')
-ARQ_API_URL = os.environ.get('ARQ_API_URL', 'https://arq.hamker.dev')
-LOG_MENTIONS = os.environ.get('LOG_MENTIONS', 'True').lower() in ['true', '1']
-RSS_DELAY = int(os.environ.get('RSS_DELAY', 300))
-PM_PERMIT = os.environ.get('PM_PERMIT', 'True').lower() in ['true', '1']
+BOT_TOKEN = os.environ.get("BOT_TOKEN")
+API_ID = int(os.environ.get("API_ID"))
+SESSION_STRING = os.environ.get("SESSION_STRING", "")
+API_HASH = os.environ.get("API_HASH")
+USERBOT_PREFIX = os.environ.get("USERBOT_PREFIX", ".")
+PHONE_NUMBER = os.environ.get("PHONE_NUMBER")
+SUDO_USERS_ID = list(map(int, os.environ.get("SUDO_USERS_ID", "").split()))
+LOG_GROUP_ID = int(os.environ.get("LOG_GROUP_ID"))
+GBAN_LOG_GROUP_ID = int(os.environ.get("GBAN_LOG_GROUP_ID"))
+MESSAGE_DUMP_CHAT = int(os.environ.get("MESSAGE_DUMP_CHAT"))
+WELCOME_DELAY_KICK_SEC = int(os.environ.get("WELCOME_DELAY_KICK_SEC", 600))
+MONGO_URL = os.environ.get("MONGO_URL")
+ARQ_API_KEY = os.environ.get("ARQ_API_KEY")
+ARQ_API_URL = os.environ.get("ARQ_API_URL", "https://arq.hamker.dev")
+LOG_MENTIONS = os.environ.get("LOG_MENTIONS", "True").lower() in ["true", "1"]
+RSS_DELAY = int(os.environ.get("RSS_DELAY", 300))
+PM_PERMIT = os.environ.get("PM_PERMIT", "True").lower() in ["true", "1"]

+ 4 - 1
wbb/__init__.py

@@ -110,7 +110,10 @@ if not SESSION_STRING:
     )
     )
 else:
 else:
     app2 = Client(
     app2 = Client(
-        name="userbot", api_id=API_ID, api_hash=API_HASH, session_string=SESSION_STRING
+        name="userbot",
+        api_id=API_ID,
+        api_hash=API_HASH,
+        session_string=SESSION_STRING,
     )
     )
 
 
 aiohttpsession = ClientSession()
 aiohttpsession = ClientSession()

+ 38 - 12
wbb/__main__.py

@@ -56,9 +56,15 @@ async def start_bot():
 
 
     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 hasattr(imported_module, "__MODULE__") and imported_module.__MODULE__:
+        if (
+            hasattr(imported_module, "__MODULE__")
+            and imported_module.__MODULE__
+        ):
             imported_module.__MODULE__ = imported_module.__MODULE__
             imported_module.__MODULE__ = imported_module.__MODULE__
-            if hasattr(imported_module, "__HELP__") and imported_module.__HELP__:
+            if (
+                hasattr(imported_module, "__HELP__")
+                and imported_module.__HELP__
+            ):
                 HELPABLE[
                 HELPABLE[
                     imported_module.__MODULE__.replace(" ", "_").lower()
                     imported_module.__MODULE__.replace(" ", "_").lower()
                 ] = imported_module
                 ] = imported_module
@@ -109,7 +115,9 @@ async def start_bot():
 home_keyboard_pm = InlineKeyboardMarkup(
 home_keyboard_pm = InlineKeyboardMarkup(
     [
     [
         [
         [
-            InlineKeyboardButton(text="Commands ❓", callback_data="bot_commands"),
+            InlineKeyboardButton(
+                text="Commands ❓", callback_data="bot_commands"
+            ),
             InlineKeyboardButton(
             InlineKeyboardButton(
                 text="Repo 🛠",
                 text="Repo 🛠",
                 url="https://github.com/thehamkercat/WilliamButcherBot",
                 url="https://github.com/thehamkercat/WilliamButcherBot",
@@ -120,7 +128,9 @@ home_keyboard_pm = InlineKeyboardMarkup(
                 text="System Stats 🖥",
                 text="System Stats 🖥",
                 callback_data="stats_callback",
                 callback_data="stats_callback",
             ),
             ),
-            InlineKeyboardButton(text="Support 👨", url="http://t.me/WBBSupport"),
+            InlineKeyboardButton(
+                text="Support 👨", url="http://t.me/WBBSupport"
+            ),
         ],
         ],
         [
         [
             InlineKeyboardButton(
             InlineKeyboardButton(
@@ -163,12 +173,16 @@ keyboard = InlineKeyboardMarkup(
 @app.on_message(filters.command("start"))
 @app.on_message(filters.command("start"))
 async def start(_, message):
 async def start(_, message):
     if message.chat.type != ChatType.PRIVATE:
     if message.chat.type != ChatType.PRIVATE:
-        return await message.reply("Pm Me For More Details.", reply_markup=keyboard)
+        return await message.reply(
+            "Pm Me For More Details.", reply_markup=keyboard
+        )
     if len(message.text.split()) > 1:
     if len(message.text.split()) > 1:
         name = (message.text.split(None, 1)[1]).lower()
         name = (message.text.split(None, 1)[1]).lower()
         if name == "mkdwn_help":
         if name == "mkdwn_help":
             await message.reply(
             await message.reply(
-                MARKDOWN, parse_mode=ParseMode.HTML, disable_web_page_preview=True
+                MARKDOWN,
+                parse_mode=ParseMode.HTML,
+                disable_web_page_preview=True,
             )
             )
         elif "_" in name:
         elif "_" in name:
             module = name.split("_", 1)[1]
             module = name.split("_", 1)[1]
@@ -212,9 +226,13 @@ async def help_command(_, message):
                     reply_markup=key,
                     reply_markup=key,
                 )
                 )
             else:
             else:
-                await message.reply("PM Me For More Details.", reply_markup=keyboard)
+                await message.reply(
+                    "PM Me For More Details.", reply_markup=keyboard
+                )
         else:
         else:
-            await message.reply("Pm Me For More Details.", reply_markup=keyboard)
+            await message.reply(
+                "Pm Me For More Details.", reply_markup=keyboard
+            )
     else:
     else:
         if len(message.command) >= 2:
         if len(message.command) >= 2:
             name = (message.text.split(None, 1)[1]).replace(" ", "_").lower()
             name = (message.text.split(None, 1)[1]).replace(" ", "_").lower()
@@ -225,14 +243,18 @@ async def help_command(_, message):
                 )
                 )
                 await message.reply(text, disable_web_page_preview=True)
                 await message.reply(text, disable_web_page_preview=True)
             else:
             else:
-                text, help_keyboard = await help_parser(message.from_user.first_name)
+                text, help_keyboard = await help_parser(
+                    message.from_user.first_name
+                )
                 await message.reply(
                 await message.reply(
                     text,
                     text,
                     reply_markup=help_keyboard,
                     reply_markup=help_keyboard,
                     disable_web_page_preview=True,
                     disable_web_page_preview=True,
                 )
                 )
         else:
         else:
-            text, help_keyboard = await help_parser(message.from_user.first_name)
+            text, help_keyboard = await help_parser(
+                message.from_user.first_name
+            )
             await message.reply(
             await message.reply(
                 text, reply_markup=help_keyboard, disable_web_page_preview=True
                 text, reply_markup=help_keyboard, disable_web_page_preview=True
             )
             )
@@ -294,7 +316,9 @@ General command are:
     if mod_match:
     if mod_match:
         module = (mod_match.group(1)).replace(" ", "_")
         module = (mod_match.group(1)).replace(" ", "_")
         text = (
         text = (
-            "{} **{}**:\n".format("Here is the help for", HELPABLE[module].__MODULE__)
+            "{} **{}**:\n".format(
+                "Here is the help for", HELPABLE[module].__MODULE__
+            )
             + HELPABLE[module].__HELP__
             + HELPABLE[module].__HELP__
         )
         )
 
 
@@ -335,7 +359,9 @@ General command are:
     elif back_match:
     elif back_match:
         await query.message.edit(
         await query.message.edit(
             text=top_text,
             text=top_text,
-            reply_markup=InlineKeyboardMarkup(paginate_modules(0, HELPABLE, "help")),
+            reply_markup=InlineKeyboardMarkup(
+                paginate_modules(0, HELPABLE, "help")
+            ),
             disable_web_page_preview=True,
             disable_web_page_preview=True,
         )
         )
 
 

+ 7 - 2
wbb/core/decorators/permissions.py

@@ -67,7 +67,10 @@ def adminsOnly(permission):
             chatID = message.chat.id
             chatID = message.chat.id
             if not message.from_user:
             if not message.from_user:
                 # For anonymous admins
                 # For anonymous admins
-                if message.sender_chat and message.sender_chat.id == message.chat.id:
+                if (
+                    message.sender_chat
+                    and message.sender_chat.id == message.chat.id
+                ):
                     return await authorised(
                     return await authorised(
                         func,
                         func,
                         subFunc2,
                         subFunc2,
@@ -82,7 +85,9 @@ def adminsOnly(permission):
             permissions = await member_permissions(chatID, userID)
             permissions = await member_permissions(chatID, userID)
             if userID not in SUDOERS and permission not in permissions:
             if userID not in SUDOERS and permission not in permissions:
                 return await unauthorised(message, permission, subFunc2)
                 return await unauthorised(message, permission, subFunc2)
-            return await authorised(func, subFunc2, client, message, *args, **kwargs)
+            return await authorised(
+                func, subFunc2, client, message, *args, **kwargs
+            )
 
 
         return subFunc2
         return subFunc2
 
 

+ 2 - 2
wbb/modules/admin.py

@@ -449,7 +449,7 @@ async def promoteFunc(_, 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.")
-    
+
     bot = (await app.get_chat_member(message.chat.id, BOT_ID)).privileges
     bot = (await app.get_chat_member(message.chat.id, BOT_ID)).privileges
     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.")
@@ -459,7 +459,7 @@ async def promoteFunc(_, message: Message):
         return await message.reply_text("I don't have enough permissions")
         return await message.reply_text("I don't have enough permissions")
 
 
     umention = (await app.get_users(user_id)).mention
     umention = (await app.get_users(user_id)).mention
-    
+
     if message.command[0][0] == "f":
     if message.command[0][0] == "f":
         await message.chat.promote_member(
         await message.chat.promote_member(
             user_id=user_id,
             user_id=user_id,

+ 3 - 1
wbb/modules/admin_misc.py

@@ -79,7 +79,9 @@ async def set_chat_photo(_, message):
     reply = message.reply_to_message
     reply = message.reply_to_message
 
 
     if not reply:
     if not reply:
-        return await message.reply_text("Reply to a photo to set it as chat_photo")
+        return await message.reply_text(
+            "Reply to a photo to set it as chat_photo"
+        )
 
 
     file = reply.document or reply.photo
     file = reply.document or reply.photo
     if not file:
     if not file:

+ 11 - 3
wbb/modules/antiservice.py

@@ -5,7 +5,11 @@ from pyrogram import filters
 
 
 from wbb import app
 from wbb import app
 from wbb.core.decorators.permissions import adminsOnly
 from wbb.core.decorators.permissions import adminsOnly
-from wbb.utils.dbfunctions import antiservice_off, antiservice_on, is_antiservice_on
+from wbb.utils.dbfunctions import (
+    antiservice_off,
+    antiservice_on,
+    is_antiservice_on,
+)
 
 
 __MODULE__ = "AntiService"
 __MODULE__ = "AntiService"
 __HELP__ = """
 __HELP__ = """
@@ -19,7 +23,9 @@ Plugin to delete service messages in a chat!
 @adminsOnly("can_change_info")
 @adminsOnly("can_change_info")
 async def anti_service(_, message):
 async def anti_service(_, message):
     if len(message.command) != 2:
     if len(message.command) != 2:
-        return await message.reply_text("Usage: /antiservice [enable | disable]")
+        return await message.reply_text(
+            "Usage: /antiservice [enable | disable]"
+        )
     status = message.text.split(None, 1)[1].strip()
     status = message.text.split(None, 1)[1].strip()
     status = status.lower()
     status = status.lower()
     chat_id = message.chat.id
     chat_id = message.chat.id
@@ -34,7 +40,9 @@ async def anti_service(_, message):
             "Disabled AntiService System. I won't Be Deleting Service Message from Now on."
             "Disabled AntiService System. I won't Be Deleting Service Message from Now on."
         )
         )
     else:
     else:
-        await message.reply_text("Unknown Suffix, Use /antiservice [enable|disable]")
+        await message.reply_text(
+            "Unknown Suffix, Use /antiservice [enable|disable]"
+        )
 
 
 
 
 @app.on_message(filters.service, group=11)
 @app.on_message(filters.service, group=11)

+ 1 - 0
wbb/modules/autoapprove.py

@@ -7,6 +7,7 @@ from pyrogram.types import (
     InlineKeyboardMarkup,
     InlineKeyboardMarkup,
     Message,
     Message,
 )
 )
+
 from wbb import SUDOERS, app, db
 from wbb import SUDOERS, app, db
 from wbb.core.decorators.permissions import adminsOnly
 from wbb.core.decorators.permissions import adminsOnly
 from wbb.modules.admin import member_permissions
 from wbb.modules.admin import member_permissions

+ 3 - 1
wbb/modules/autocorrect.py

@@ -42,7 +42,9 @@ async def autocorrect_ubot_toggle(_, message: Message):
         IS_ENABLED = False
         IS_ENABLED = False
         await eor(message, text="Disabled!")
         await eor(message, text="Disabled!")
     else:
     else:
-        return await eor(message, text="Wrong argument, Pass (ENABLE|DISABLE).")
+        return await eor(
+            message, text="Wrong argument, Pass (ENABLE|DISABLE)."
+        )
 
 
 
 
 @app2.on_message(
 @app2.on_message(

+ 3 - 1
wbb/modules/blacklist.py

@@ -53,7 +53,9 @@ async def save_filters(_, message):
         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("**Usage**\n__/blacklist [WORD|SENTENCE]__")
+        return await message.reply_text(
+            "**Usage**\n__/blacklist [WORD|SENTENCE]__"
+        )
     chat_id = message.chat.id
     chat_id = message.chat.id
     await save_blacklist_filter(chat_id, word)
     await save_blacklist_filter(chat_id, word)
     await message.reply_text(f"__**Blacklisted {word}.**__")
     await message.reply_text(f"__**Blacklisted {word}.**__")

+ 17 - 5
wbb/modules/blacklist_chat.py

@@ -3,7 +3,11 @@ from pyrogram.types import 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
-from wbb.utils.dbfunctions import blacklist_chat, blacklisted_chats, whitelist_chat
+from wbb.utils.dbfunctions import (
+    blacklist_chat,
+    blacklisted_chats,
+    whitelist_chat,
+)
 
 
 __MODULE__ = "Blacklist Chat"
 __MODULE__ = "Blacklist Chat"
 __HELP__ = """
 __HELP__ = """
@@ -22,13 +26,17 @@ in which you don't want it to be in.
 @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:
-        return await message.reply_text("**Usage:**\n/blacklist_chat [CHAT_ID]")
+        return await message.reply_text(
+            "**Usage:**\n/blacklist_chat [CHAT_ID]"
+        )
     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("Chat has been successfully blacklisted")
+        return await message.reply_text(
+            "Chat has been successfully blacklisted"
+        )
     await message.reply_text("Something wrong happened, check logs.")
     await message.reply_text("Something wrong happened, check logs.")
 
 
 
 
@@ -36,13 +44,17 @@ async def blacklist_chat_func(_, message: Message):
 @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:
-        return await message.reply_text("**Usage:**\n/whitelist_chat [CHAT_ID]")
+        return await message.reply_text(
+            "**Usage:**\n/whitelist_chat [CHAT_ID]"
+        )
     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("Chat has been successfully whitelisted")
+        return await message.reply_text(
+            "Chat has been successfully whitelisted"
+        )
     await message.reply_text("Something wrong happened, check logs.")
     await message.reply_text("Something wrong happened, check logs.")
 
 
 
 

+ 6 - 2
wbb/modules/carbon.py

@@ -33,9 +33,13 @@ from wbb.utils.functions import make_carbon
 @capture_err
 @capture_err
 async def carbon_func(_, message):
 async def carbon_func(_, message):
     if not message.reply_to_message:
     if not message.reply_to_message:
-        return await message.reply_text("Reply to a text message to make carbon.")
+        return await message.reply_text(
+            "Reply to a text message to make carbon."
+        )
     if not message.reply_to_message.text:
     if not message.reply_to_message.text:
-        return await message.reply_text("Reply to a text message to make carbon.")
+        return await message.reply_text(
+            "Reply to a text message to make carbon."
+        )
     m = await message.reply_text("Preparing Carbon")
     m = await message.reply_text("Preparing Carbon")
     carbon = await make_carbon(message.reply_to_message.text)
     carbon = await make_carbon(message.reply_to_message.text)
     await m.edit("Uploading")
     await m.edit("Uploading")

+ 5 - 1
wbb/modules/chat_watcher.py

@@ -22,7 +22,11 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
 SOFTWARE.
 """
 """
 from wbb import app
 from wbb import app
-from wbb.utils.dbfunctions import add_served_chat, add_served_user, blacklisted_chats
+from wbb.utils.dbfunctions import (
+    add_served_chat,
+    add_served_user,
+    blacklisted_chats,
+)
 from wbb.utils.filter_groups import chat_watcher_group
 from wbb.utils.filter_groups import chat_watcher_group
 
 
 
 

+ 7 - 2
wbb/modules/chatbot.py

@@ -96,7 +96,11 @@ async def type_and_send(message: Message):
 
 
 
 
 @app.on_message(
 @app.on_message(
-    filters.text & filters.reply & ~filters.bot & ~filters.via_bot & ~filters.forwarded,
+    filters.text
+    & filters.reply
+    & ~filters.bot
+    & ~filters.via_bot
+    & ~filters.forwarded,
     group=chatbot_group,
     group=chatbot_group,
 )
 )
 @capture_err
 @capture_err
@@ -126,7 +130,8 @@ async def chatbot_talk(_, message: Message):
 async def chatbot_status_ubot(_, message: Message):
 async def chatbot_status_ubot(_, message: Message):
     if len(message.text.split()) != 2:
     if len(message.text.split()) != 2:
         return await eor(
         return await eor(
-            message, text=f"**Usage:**\n{USERBOT_PREFIX}chatbot [ENABLE|DISABLE]"
+            message,
+            text=f"**Usage:**\n{USERBOT_PREFIX}chatbot [ENABLE|DISABLE]",
         )
         )
     await chat_bot_toggle(message, is_userbot=True)
     await chat_bot_toggle(message, is_userbot=True)
 
 

+ 2 - 2
wbb/modules/couple.py

@@ -23,8 +23,8 @@ SOFTWARE.
 """
 """
 import random
 import random
 from datetime import datetime
 from datetime import datetime
-import pytz
 
 
+import pytz
 from pyrogram import enums, filters
 from pyrogram import enums, filters
 
 
 from wbb import app
 from wbb import app
@@ -38,7 +38,7 @@ __HELP__ = "/detect_gay - To Choose Couple Of The Day"
 # Date and time
 # Date and time
 def dt():
 def dt():
     # Set the timezone to Indian Standard Time
     # Set the timezone to Indian Standard Time
-    ist_timezone = pytz.timezone('Asia/Kolkata')
+    ist_timezone = pytz.timezone("Asia/Kolkata")
 
 
     # Get the current time in IST
     # Get the current time in IST
     ist_now = datetime.now(ist_timezone)
     ist_now = datetime.now(ist_timezone)

+ 3 - 1
wbb/modules/create.py

@@ -40,7 +40,9 @@ async def create(_, message):
     group_type = message.command[1]
     group_type = message.command[1]
     split = message.command[2:]
     split = message.command[2:]
     group_name = " ".join(split)
     group_name = " ".join(split)
-    desc = "Welcome To My " + ("Supergroup" if group_type == "s" else "Channel")
+    desc = "Welcome To My " + (
+        "Supergroup" if group_type == "s" else "Channel"
+    )
     if group_type == "b":  # for basicgroup
     if group_type == "b":  # for basicgroup
         chat = await app2.create_group(group_name, BOT_USERNAME)
         chat = await app2.create_group(group_name, BOT_USERNAME)
         link = await app2.get_chat(chat.id)
         link = await app2.get_chat(chat.id)

+ 2 - 1
wbb/modules/dice.py

@@ -14,7 +14,8 @@ __HELP__ = """
     filters.command("dice", prefixes=USERBOT_PREFIX)
     filters.command("dice", prefixes=USERBOT_PREFIX)
     & SUDOERS
     & SUDOERS
     & ~filters.forwarded
     & ~filters.forwarded
-    & ~filters.via_bot)
+    & ~filters.via_bot
+)
 @app.on_message(filters.command("dice"))
 @app.on_message(filters.command("dice"))
 async def throw_dice(client, message: Message):
 async def throw_dice(client, message: Message):
     six = (message.from_user.id in SUDOERS) if message.from_user else False
     six = (message.from_user.id in SUDOERS) if message.from_user else False

+ 21 - 9
wbb/modules/filters.py

@@ -25,23 +25,27 @@ SOFTWARE.
 import re
 import re
 
 
 from pyrogram import filters
 from pyrogram import filters
-from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, CallbackQuery
+from pyrogram.types import (
+    CallbackQuery,
+    InlineKeyboardButton,
+    InlineKeyboardMarkup,
+)
 
 
 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.core.keyboard import ikb
 from wbb.core.keyboard import ikb
+from wbb.modules.admin import member_permissions
+from wbb.modules.notes import extract_urls
 from wbb.utils.dbfunctions import (
 from wbb.utils.dbfunctions import (
     delete_filter,
     delete_filter,
+    deleteall_filters,
     get_filter,
     get_filter,
     get_filters_names,
     get_filters_names,
     save_filter,
     save_filter,
-    deleteall_filters,
 )
 )
 from wbb.utils.filter_groups import chat_filters_group
 from wbb.utils.filter_groups import chat_filters_group
-from wbb.utils.functions import extract_text_and_keyb, check_format
-from wbb.modules.admin import member_permissions
-from wbb.modules.notes import extract_urls
+from wbb.utils.functions import check_format, extract_text_and_keyb
 
 
 __MODULE__ = "Filters"
 __MODULE__ = "Filters"
 __HELP__ = """/filters To Get All The Filters In The Chat.
 __HELP__ = """/filters To Get All The Filters In The Chat.
@@ -72,10 +76,14 @@ async def save_filters(_, message):
         replied_message = message.reply_to_message
         replied_message = message.reply_to_message
         if not replied_message:
         if not replied_message:
             replied_message = message
             replied_message = message
-        text = message.text.markdown if message.text else message.caption.markdown
+        text = (
+            message.text.markdown if message.text else message.caption.markdown
+        )
         name = text.split(None, 1)[1].strip()
         name = 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
         text = name.split(" ", 1)
         text = name.split(" ", 1)
         if len(text) > 1:
         if len(text) > 1:
@@ -217,7 +225,9 @@ async def filters_re(_, message):
             keyb = None
             keyb = None
             if data:
             if data:
                 if "{chat}" in data:
                 if "{chat}" in data:
-                    data = data.replace("{chat}", (await app.get_chat(chat_id)).title)
+                    data = data.replace(
+                        "{chat}", (await app.get_chat(chat_id)).title
+                    )
                 if "{name}" in data:
                 if "{name}" in data:
                     data = data.replace(
                     data = data.replace(
                         "{name}", (await app.get_users(user_id)).mention
                         "{name}", (await app.get_users(user_id)).mention
@@ -296,7 +306,9 @@ async def stop_all(_, message):
         keyboard = InlineKeyboardMarkup(
         keyboard = InlineKeyboardMarkup(
             [
             [
                 [
                 [
-                    InlineKeyboardButton("YES, DO IT", callback_data="stop_yes"),
+                    InlineKeyboardButton(
+                        "YES, DO IT", callback_data="stop_yes"
+                    ),
                     InlineKeyboardButton("Cancel", callback_data="stop_no"),
                     InlineKeyboardButton("Cancel", callback_data="stop_no"),
                 ]
                 ]
             ]
             ]

+ 5 - 1
wbb/modules/flood.py

@@ -57,7 +57,11 @@ def reset_flood(chat_id, user_id=0):
 
 
 
 
 @app.on_message(
 @app.on_message(
-    ~filters.service & ~filters.me & ~filters.private & ~filters.channel & ~filters.bot,
+    ~filters.service
+    & ~filters.me
+    & ~filters.private
+    & ~filters.channel
+    & ~filters.bot,
     group=flood_group,
     group=flood_group,
 )
 )
 @capture_err
 @capture_err

+ 22 - 8
wbb/modules/greetings.py

@@ -42,10 +42,11 @@ from pyrogram.types import (
     User,
     User,
 )
 )
 
 
-from wbb import SUDOERS, WELCOME_DELAY_KICK_SEC, BOT_USERNAME, app
+from wbb import BOT_USERNAME, 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.core.keyboard import ikb
 from wbb.core.keyboard import ikb
+from wbb.modules.notes import extract_urls
 from wbb.utils.dbfunctions import (
 from wbb.utils.dbfunctions import (
     captcha_off,
     captcha_off,
     captcha_on,
     captcha_on,
@@ -60,8 +61,11 @@ from wbb.utils.dbfunctions import (
     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 extract_text_and_keyb, generate_captcha, check_format
-from wbb.modules.notes import extract_urls
+from wbb.utils.functions import (
+    check_format,
+    extract_text_and_keyb,
+    generate_captcha,
+)
 
 
 __MODULE__ = "Greetings"
 __MODULE__ = "Greetings"
 __HELP__ = """
 __HELP__ = """
@@ -211,7 +215,9 @@ async def handle_new_member(message: Message, member, chat):
     await update_captcha_cache(answers_dicc)
     await update_captcha_cache(answers_dicc)
 
 
     asyncio.create_task(
     asyncio.create_task(
-        kick_restricted_after_delay(WELCOME_DELAY_KICK_SEC, button_message, member)
+        kick_restricted_after_delay(
+            WELCOME_DELAY_KICK_SEC, button_message, member
+        )
     )
     )
     await asyncio.sleep(0.5)
     await asyncio.sleep(0.5)
 
 
@@ -294,7 +300,9 @@ async def callback_query_welcome_button(_, callback_query):
                 keyboard = i["keyboard"]
                 keyboard = i["keyboard"]
 
 
     if not (correct_answer and keyboard):
     if not (correct_answer and keyboard):
-        return await callback_query.answer("Something went wrong, Rejoin the " "chat!")
+        return await callback_query.answer(
+            "Something went wrong, Rejoin the " "chat!"
+        )
 
 
     if pending_user_id != pressed_user_id:
     if pending_user_id != pressed_user_id:
         return await callback_query.answer("This is not for you")
         return await callback_query.answer("This is not for you")
@@ -350,7 +358,9 @@ async def callback_query_welcome_button(_, callback_query):
     return await send_welcome_message(chat, pending_user_id, True)
     return await send_welcome_message(chat, pending_user_id, True)
 
 
 
 
-async def kick_restricted_after_delay(delay, button_message: Message, user: User):
+async def kick_restricted_after_delay(
+    delay, button_message: Message, user: User
+):
     """If the new member is still restricted after the delay, delete
     """If the new member is still restricted after the delay, delete
     button message and join message and then kick him
     button message and join message and then kick him
     """
     """
@@ -367,7 +377,9 @@ async def kick_restricted_after_delay(delay, button_message: Message, user: User
     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(group_chat, user_id: int, duration: int):
+async def _ban_restricted_user_until_date(
+    group_chat, user_id: int, duration: int
+):
     try:
     try:
         member = await group_chat.get_member(user_id)
         member = await group_chat.get_member(user_id)
         if member.status == ChatMemberStatus.RESTRICTED:
         if member.status == ChatMemberStatus.RESTRICTED:
@@ -479,7 +491,9 @@ async def get_welcome_func(_, message):
     if not raw_text:
     if not raw_text:
         return await message.reply_text("No welcome message set.")
         return await message.reply_text("No welcome message set.")
     if not message.from_user:
     if not message.from_user:
-        return await message.reply_text("You're anon, can't send welcome message.")
+        return await message.reply_text(
+            "You're anon, can't send welcome message."
+        )
 
 
     await send_welcome_message(chat, message.from_user.id)
     await send_welcome_message(chat, message.from_user.id)
 
 

+ 3 - 1
wbb/modules/info.py

@@ -124,7 +124,9 @@ async def info_func(_, message: Message):
 async def chat_info_func(_, message: Message):
 async def chat_info_func(_, message: Message):
     try:
     try:
         if len(message.command) > 2:
         if len(message.command) > 2:
-            return await message.reply_text("**Usage:**/chat_info [USERNAME|ID]")
+            return await message.reply_text(
+                "**Usage:**/chat_info [USERNAME|ID]"
+            )
 
 
         if len(message.command) == 1:
         if len(message.command) == 1:
             chat = message.chat.id
             chat = message.chat.id

+ 40 - 14
wbb/modules/inline.py

@@ -25,10 +25,11 @@ SOFTWARE.
 
 
 import traceback
 import traceback
 
 
-from wbb import app, BOT_USERNAME 
-from wbb.utils.inlinefuncs import *
 from pyrogram import filters
 from pyrogram import filters
 
 
+from wbb import BOT_USERNAME, app
+from wbb.utils.inlinefuncs import *
+
 __MODULE__ = "Inline"
 __MODULE__ = "Inline"
 __HELP__ = f"""
 __HELP__ = f"""
 
 
@@ -51,6 +52,7 @@ async def inline(_, message):
     text = "**Here are the commands available for inline**"
     text = "**Here are the commands available for inline**"
     await message.reply_text(text=text, reply_markup=buttons)
     await message.reply_text(text=text, reply_markup=buttons)
 
 
+
 @app.on_inline_query()
 @app.on_inline_query()
 async def inline_query_handler(client, query):
 async def inline_query_handler(client, query):
     try:
     try:
@@ -58,10 +60,14 @@ async def inline_query_handler(client, query):
         answers = []
         answers = []
         if text.strip() == "":
         if text.strip() == "":
             answerss = await inline_help_func(__HELP__)
             answerss = await inline_help_func(__HELP__)
-            await client.answer_inline_query(query.id, results=answerss, cache_time=10)
+            await client.answer_inline_query(
+                query.id, results=answerss, cache_time=10
+            )
         elif text.split()[0] == "alive":
         elif text.split()[0] == "alive":
             answerss = await alive_function(answers)
             answerss = await alive_function(answers)
-            await client.answer_inline_query(query.id, results=answerss, cache_time=10)
+            await client.answer_inline_query(
+                query.id, results=answerss, cache_time=10
+            )
         elif text.split()[0] == "tr":
         elif text.split()[0] == "tr":
             if len(text.split()) < 3:
             if len(text.split()) < 3:
                 return await client.answer_inline_query(
                 return await client.answer_inline_query(
@@ -117,7 +123,9 @@ async def inline_query_handler(client, query):
                 )
                 )
             tex = text.split(None, 1)[1].strip()
             tex = text.split(None, 1)[1].strip()
             answerss = await wall_func(answers, tex)
             answerss = await wall_func(answers, tex)
-            await client.answer_inline_query(query.id, results=answerss, cache_time=2)
+            await client.answer_inline_query(
+                query.id, results=answerss, cache_time=2
+            )
 
 
         elif text.split()[0] == "torrent":
         elif text.split()[0] == "torrent":
             if len(text.split()) < 2:
             if len(text.split()) < 2:
@@ -169,7 +177,9 @@ async def inline_query_handler(client, query):
             user_id = query.from_user.id
             user_id = query.from_user.id
             tex = text.split(None, 1)[1].strip()
             tex = text.split(None, 1)[1].strip()
             answerss = await tg_search_func(answers, tex, user_id)
             answerss = await tg_search_func(answers, tex, user_id)
-            await client.answer_inline_query(query.id, results=answerss, cache_time=2)
+            await client.answer_inline_query(
+                query.id, results=answerss, cache_time=2
+            )
 
 
         elif text.split()[0] == "music":
         elif text.split()[0] == "music":
             if len(text.split()) < 2:
             if len(text.split()) < 2:
@@ -181,7 +191,9 @@ async def inline_query_handler(client, query):
                 )
                 )
             tex = text.split(None, 1)[1].strip()
             tex = text.split(None, 1)[1].strip()
             answerss = await music_inline_func(answers, tex)
             answerss = await music_inline_func(answers, tex)
-            await client.answer_inline_query(query.id, results=answerss, cache_time=2)
+            await client.answer_inline_query(
+                query.id, results=answerss, cache_time=2
+            )
 
 
         elif text.split()[0] == "wiki":
         elif text.split()[0] == "wiki":
             if len(text.split()) < 2:
             if len(text.split()) < 2:
@@ -193,7 +205,9 @@ async def inline_query_handler(client, query):
                 )
                 )
             tex = text.split(None, 1)[1].strip()
             tex = text.split(None, 1)[1].strip()
             answerss = await wiki_func(answers, tex)
             answerss = await wiki_func(answers, tex)
-            await client.answer_inline_query(query.id, results=answerss, cache_time=2)
+            await client.answer_inline_query(
+                query.id, results=answerss, cache_time=2
+            )
 
 
         elif text.split()[0] == "speedtest":
         elif text.split()[0] == "speedtest":
             answerss = await speedtest_init(query)
             answerss = await speedtest_init(query)
@@ -205,11 +219,15 @@ async def inline_query_handler(client, query):
             user_id = query.from_user.id
             user_id = query.from_user.id
             victim = text.split()[1]
             victim = text.split()[1]
             answerss = await pmpermit_func(answers, user_id, victim)
             answerss = await pmpermit_func(answers, user_id, victim)
-            await client.answer_inline_query(query.id, results=answerss, cache_time=2)
+            await client.answer_inline_query(
+                query.id, results=answerss, cache_time=2
+            )
 
 
         elif text.split()[0] == "ping":
         elif text.split()[0] == "ping":
             answerss = await ping_func(answers)
             answerss = await ping_func(answers)
-            await client.answer_inline_query(query.id, results=answerss, cache_time=2)
+            await client.answer_inline_query(
+                query.id, results=answerss, cache_time=2
+            )
 
 
         elif text.split()[0] == "ytmusic":
         elif text.split()[0] == "ytmusic":
             if len(text.split()) < 2:
             if len(text.split()) < 2:
@@ -221,7 +239,9 @@ async def inline_query_handler(client, query):
                 )
                 )
             tex = query.query.split(None, 1)[1].strip()
             tex = query.query.split(None, 1)[1].strip()
             answerss = await yt_music_func(answers, tex)
             answerss = await yt_music_func(answers, tex)
-            await client.answer_inline_query(query.id, results=answerss, cache_time=2)
+            await client.answer_inline_query(
+                query.id, results=answerss, cache_time=2
+            )
 
 
         elif text.split()[0] == "info":
         elif text.split()[0] == "info":
             if len(text.split()) < 2:
             if len(text.split()) < 2:
@@ -233,7 +253,9 @@ async def inline_query_handler(client, query):
                 )
                 )
             tex = text.split()[1].strip()
             tex = text.split()[1].strip()
             answerss = await info_inline_func(answers, tex)
             answerss = await info_inline_func(answers, tex)
-            await client.answer_inline_query(query.id, results=answerss, cache_time=2)
+            await client.answer_inline_query(
+                query.id, results=answerss, cache_time=2
+            )
 
 
         elif text.split()[0] == "tmdb":
         elif text.split()[0] == "tmdb":
             if len(text.split()) < 2:
             if len(text.split()) < 2:
@@ -246,7 +268,9 @@ async def inline_query_handler(client, query):
                 )
                 )
             tex = text.split()[1].strip()
             tex = text.split()[1].strip()
             answerss = await tmdb_func(answers, tex)
             answerss = await tmdb_func(answers, tex)
-            await client.answer_inline_query(query.id, results=answerss, cache_time=2)
+            await client.answer_inline_query(
+                query.id, results=answerss, cache_time=2
+            )
 
 
         elif text.split()[0] == "image":
         elif text.split()[0] == "image":
             if len(text.split()) < 2:
             if len(text.split()) < 2:
@@ -269,7 +293,9 @@ async def inline_query_handler(client, query):
         elif text.strip() == "tasks":
         elif text.strip() == "tasks":
             user_id = query.from_user.id
             user_id = query.from_user.id
             answerss = await task_inline_func(user_id)
             answerss = await task_inline_func(user_id)
-            await client.answer_inline_query(query.id, results=answerss, cache_time=1)
+            await client.answer_inline_query(
+                query.id, results=answerss, cache_time=1
+            )
 
 
     except Exception as e:
     except Exception as e:
         e = traceback.format_exc()
         e = traceback.format_exc()

+ 3 - 1
wbb/modules/locks.py

@@ -101,7 +101,9 @@ async def tg_lock(message, permissions: list, perm: str, lock: bool):
     permissions = {perm: True for perm in list(set(permissions))}
     permissions = {perm: True for perm in list(set(permissions))}
 
 
     try:
     try:
-        await app.set_chat_permissions(message.chat.id, ChatPermissions(**permissions))
+        await app.set_chat_permissions(
+            message.chat.id, ChatPermissions(**permissions)
+        )
     except ChatNotModified:
     except ChatNotModified:
         return await message.reply_text(
         return await message.reply_text(
             "To unlock this, you have to unlock 'messages' first."
             "To unlock this, you have to unlock 'messages' first."

+ 6 - 2
wbb/modules/misc.py

@@ -166,7 +166,9 @@ async def rtfm(_, message):
     await message.delete()
     await message.delete()
     if not message.reply_to_message:
     if not message.reply_to_message:
         return await message.reply_text("Reply To A Message lol")
         return await message.reply_text("Reply To A Message lol")
-    await message.reply_to_message.reply_text("Are You Lost? READ THE FUCKING DOCS!")
+    await message.reply_to_message.reply_text(
+        "Are You Lost? READ THE FUCKING DOCS!"
+    )
 
 
 
 
 @app.on_message(filters.command("runs"))
 @app.on_message(filters.command("runs"))
@@ -227,7 +229,9 @@ async def random(_, message):
     try:
     try:
         if 1 < int(length) < 1000:
         if 1 < int(length) < 1000:
             alphabet = string.ascii_letters + string.digits
             alphabet = string.ascii_letters + string.digits
-            password = "".join(secrets.choice(alphabet) for i in range(int(length)))
+            password = "".join(
+                secrets.choice(alphabet) for i in range(int(length))
+            )
             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")

+ 6 - 2
wbb/modules/music.py

@@ -54,7 +54,9 @@ def download_youtube_audio(arq_resp):
     performer = r.channel
     performer = r.channel
 
 
     m, s = r.duration.split(":")
     m, s = r.duration.split(":")
-    duration = int(datetime.timedelta(minutes=int(m), seconds=int(s)).total_seconds())
+    duration = int(
+        datetime.timedelta(minutes=int(m), seconds=int(s)).total_seconds()
+    )
 
 
     if duration > 1800:
     if duration > 1800:
         return
         return
@@ -89,7 +91,9 @@ async def music(_, message):
             "Another download is in progress, try again after sometime."
             "Another download is in progress, try again after sometime."
         )
         )
     is_downloading = True
     is_downloading = True
-    m = await message.reply_text(f"Downloading {url}", disable_web_page_preview=True)
+    m = await message.reply_text(
+        f"Downloading {url}", disable_web_page_preview=True
+    )
     try:
     try:
         loop = get_running_loop()
         loop = get_running_loop()
         arq_resp = await arq.youtube(url)
         arq_resp = await arq.youtube(url)

+ 22 - 8
wbb/modules/notes.py

@@ -25,21 +25,25 @@ SOFTWARE.
 from re import findall
 from re import findall
 
 
 from pyrogram import filters
 from pyrogram import filters
-from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, CallbackQuery
+from pyrogram.types import (
+    CallbackQuery,
+    InlineKeyboardButton,
+    InlineKeyboardMarkup,
+)
 
 
 from wbb import SUDOERS, USERBOT_ID, USERBOT_PREFIX, app, app2, eor
 from wbb import SUDOERS, USERBOT_ID, USERBOT_PREFIX, app, app2, eor
 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.core.keyboard import ikb
 from wbb.core.keyboard import ikb
+from wbb.modules.admin import member_permissions
 from wbb.utils.dbfunctions import (
 from wbb.utils.dbfunctions import (
     delete_note,
     delete_note,
+    deleteall_notes,
     get_note,
     get_note,
     get_note_names,
     get_note_names,
     save_note,
     save_note,
-    deleteall_notes,
 )
 )
-from wbb.modules.admin import member_permissions
-from wbb.utils.functions import extract_text_and_keyb, check_format
+from wbb.utils.functions import check_format, extract_text_and_keyb
 
 
 __MODULE__ = "Notes"
 __MODULE__ = "Notes"
 __HELP__ = """/notes To Get All The Notes In The Chat.
 __HELP__ = """/notes To Get All The Notes In The Chat.
@@ -88,10 +92,16 @@ async def save_notee(_, message):
             replied_message = message.reply_to_message
             replied_message = message.reply_to_message
             if not replied_message:
             if not replied_message:
                 replied_message = message
                 replied_message = message
-            text = message.text.markdown if message.text else message.caption.markdown
+            text = (
+                message.text.markdown
+                if message.text
+                else message.caption.markdown
+            )
             name = text.split(None, 1)[1].strip()
             name = text.split(None, 1)[1].strip()
             if not name:
             if not name:
-                return await eor(message, text="**Usage**\n__/save [NOTE_NAME]__")
+                return await eor(
+                    message, text="**Usage**\n__/save [NOTE_NAME]__"
+                )
             text = name.split(" ", 1)
             text = name.split(" ", 1)
             if len(text) > 1:
             if len(text) > 1:
                 name = text[0]
                 name = text[0]
@@ -250,7 +260,9 @@ async def get_one_note(_, message):
         if "{chat}" in data:
         if "{chat}" in data:
             data = data.replace("{chat}", (await app.get_chat(chat_id)).title)
             data = data.replace("{chat}", (await app.get_chat(chat_id)).title)
         if "{name}" in data:
         if "{name}" in data:
-            data = data.replace("{name}", (await app.get_users(user_id)).mention)
+            data = data.replace(
+                "{name}", (await app.get_users(user_id)).mention
+            )
         if findall(r"\[.+\,.+\]", data):
         if findall(r"\[.+\,.+\]", data):
             keyboard = extract_text_and_keyb(ikb, data)
             keyboard = extract_text_and_keyb(ikb, data)
             if keyboard:
             if keyboard:
@@ -347,7 +359,9 @@ async def delete_all(_, message):
         keyboard = InlineKeyboardMarkup(
         keyboard = InlineKeyboardMarkup(
             [
             [
                 [
                 [
-                    InlineKeyboardButton("YES, DO IT", callback_data="delete_yes"),
+                    InlineKeyboardButton(
+                        "YES, DO IT", callback_data="delete_yes"
+                    ),
                     InlineKeyboardButton("Cancel", callback_data="delete_no"),
                     InlineKeyboardButton("Cancel", callback_data="delete_no"),
                 ]
                 ]
             ]
             ]

+ 3 - 1
wbb/modules/parse_preview.py

@@ -42,7 +42,9 @@ async def parse(_, message: Message):
 
 
     body = {
     body = {
         "Title": [wpp.title or "Null"],
         "Title": [wpp.title or "Null"],
-        "Description": [(wpp.description[:50] + "...") if wpp.description else "Null"],
+        "Description": [
+            (wpp.description[:50] + "...") if wpp.description else "Null"
+        ],
         "URL": [wpp.display_url or "Null"],
         "URL": [wpp.display_url or "Null"],
         "Author": [wpp.author or "Null"],
         "Author": [wpp.author or "Null"],
         "Site Name": [wpp.site_name or "Null"],
         "Site Name": [wpp.site_name or "Null"],

+ 4 - 2
wbb/modules/paste.py

@@ -39,7 +39,7 @@ pattern = re.compile(r"^text/|json$|yaml$|xml$|toml$|x-sh$|x-shellscript$")
 
 
 
 
 @app2.on_message(
 @app2.on_message(
-    filters.command("paste", prefixes=USERBOT_PREFIX) 
+    filters.command("paste", prefixes=USERBOT_PREFIX)
     & ~filters.forwarded
     & ~filters.forwarded
     & ~filters.via_bot
     & ~filters.via_bot
     & SUDOERS
     & SUDOERS
@@ -52,7 +52,9 @@ async def paste_func(_, message: Message):
     r = message.reply_to_message
     r = message.reply_to_message
 
 
     if not r.text and not r.document:
     if not r.text and not r.document:
-        return await eor(message, text="Only text and documents are supported.")
+        return await eor(
+            message, text="Only text and documents are supported."
+        )
 
 
     m = await eor(message, text="Pasting...")
     m = await eor(message, text="Pasting...")
 
 

+ 5 - 2
wbb/modules/pipes.py

@@ -78,7 +78,9 @@ async def pipes_worker_userbot(_, message: Message):
         to_chat_id = pipes_list_bot[chat_id]
         to_chat_id = pipes_list_bot[chat_id]
 
 
         if not message.text:
         if not message.text:
-            m, temp = await asyncio.gather(app.listen(USERBOT_ID), message.copy(BOT_ID))
+            m, temp = await asyncio.gather(
+                app.listen(USERBOT_ID), message.copy(BOT_ID)
+            )
             caption = f"{temp.caption}{caption}" if temp.caption else caption
             caption = f"{temp.caption}{caption}" if temp.caption else caption
 
 
             await app.copy_message(
             await app.copy_message(
@@ -155,6 +157,7 @@ async def show_pipes_func(_, message: Message):
     text = ""
     text = ""
     for count, pipe in enumerate(pipes_list_bot.items(), 1):
     for count, pipe in enumerate(pipes_list_bot.items(), 1):
         text += (
         text += (
-            f"**Pipe:** `{count}`\n**From:** `{pipe[0]}`\n" + f"**To:** `{pipe[1]}`\n\n"
+            f"**Pipe:** `{count}`\n**From:** `{pipe[0]}`\n"
+            + f"**To:** `{pipe[1]}`\n\n"
         )
         )
     await message.reply_text(text)
     await message.reply_text(text)

+ 16 - 5
wbb/modules/pmpermit.py

@@ -25,7 +25,16 @@ SOFTWARE.
 from pyrogram import filters
 from pyrogram import filters
 from pyrogram.raw.functions.messages import DeleteHistory
 from pyrogram.raw.functions.messages import DeleteHistory
 
 
-from wbb import BOT_ID, PM_PERMIT, SUDOERS, USERBOT_ID, USERBOT_PREFIX, app, app2, eor
+from wbb import (
+    BOT_ID,
+    PM_PERMIT,
+    SUDOERS,
+    USERBOT_ID,
+    USERBOT_PREFIX,
+    app,
+    app2,
+    eor,
+)
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.errors import capture_err
 from wbb.utils.dbfunctions import (
 from wbb.utils.dbfunctions import (
     approve_pmpermit,
     approve_pmpermit,
@@ -70,7 +79,7 @@ async def pmpermit_func(_, message):
 
 
 @app2.on_message(
 @app2.on_message(
     filters.command("approve", prefixes=USERBOT_PREFIX)
     filters.command("approve", prefixes=USERBOT_PREFIX)
-    & SUDOERS 
+    & SUDOERS
     & ~filters.via_bot
     & ~filters.via_bot
     & ~filters.forwarded
     & ~filters.forwarded
 )
 )
@@ -87,13 +96,15 @@ async def pm_approve(_, message):
 
 
 @app2.on_message(
 @app2.on_message(
     filters.command("disapprove", prefixes=USERBOT_PREFIX)
     filters.command("disapprove", prefixes=USERBOT_PREFIX)
-    & SUDOERS 
+    & SUDOERS
     & ~filters.via_bot
     & ~filters.via_bot
     & ~filters.forwarded
     & ~filters.forwarded
 )
 )
 async def pm_disapprove(_, message):
 async def pm_disapprove(_, message):
     if not message.reply_to_message:
     if not message.reply_to_message:
-        return await eor(message, text="Reply to a user's message to disapprove.")
+        return await eor(
+            message, text="Reply to a user's message to disapprove."
+        )
     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 eor(message, text="User is already disapproved to pm")
         await eor(message, text="User is already disapproved to pm")
@@ -126,7 +137,7 @@ async def block_user_func(_, message):
 
 
 @app2.on_message(
 @app2.on_message(
     filters.command("unblock", prefixes=USERBOT_PREFIX)
     filters.command("unblock", prefixes=USERBOT_PREFIX)
-    & SUDOERS 
+    & SUDOERS
     & ~filters.via_bot
     & ~filters.via_bot
     & ~filters.forwarded
     & ~filters.forwarded
 )
 )

+ 3 - 1
wbb/modules/purge_me.py

@@ -140,7 +140,9 @@ async def purge_me_func(_, message: Message):
     # because we can't delete more than 100 messages at once,
     # because we can't delete more than 100 messages at once,
     # we have to do it in chunks of 100, i'll choose 99 just
     # we have to do it in chunks of 100, i'll choose 99 just
     # to be safe.
     # to be safe.
-    to_delete = [message_ids[i : i + 99] for i in range(0, len(message_ids), 99)]
+    to_delete = [
+        message_ids[i : i + 99] for i in range(0, len(message_ids), 99)
+    ]
 
 
     for hundred_messages_or_less in to_delete:
     for hundred_messages_or_less in to_delete:
         await app2.delete_messages(
         await app2.delete_messages(

+ 6 - 2
wbb/modules/quotly.py

@@ -76,7 +76,9 @@ 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("Replied message has no text, can't quote it.")
+        return await message.reply_text(
+            "Replied message has no text, can't quote it."
+        )
     m = await message.reply_text("Quoting Messages")
     m = await message.reply_text("Quoting Messages")
     if len(message.command) < 2:
     if len(message.command) < 2:
         messages = [message.reply_to_message]
         messages = [message.reply_to_message]
@@ -116,7 +118,9 @@ async def quotly_func(client, message: Message):
             )
             )
             messages = [reply_message]
             messages = [reply_message]
     else:
     else:
-        return await m.edit("Incorrect argument, check quotly module in help section.")
+        return await m.edit(
+            "Incorrect argument, check quotly module in help section."
+        )
     try:
     try:
         if not message:
         if not message:
             return await m.edit("Something went wrong.")
             return await m.edit("Something went wrong.")

+ 3 - 1
wbb/modules/regex.py

@@ -45,7 +45,9 @@ async def sed(_, message):
             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(repl, repl_with, to_fix, count=1, flags=re.I).strip()
+                text = re.sub(
+                    repl, repl_with, to_fix, count=1, flags=re.I
+                ).strip()
             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:

+ 6 - 2
wbb/modules/repo.py

@@ -40,7 +40,9 @@ async def repo(_, message):
     list_of_users = ""
     list_of_users = ""
     count = 1
     count = 1
     for user in users:
     for user in users:
-        list_of_users += f"**{count}.** [{user['login']}]({user['html_url']})\n"
+        list_of_users += (
+            f"**{count}.** [{user['login']}]({user['html_url']})\n"
+        )
         count += 1
         count += 1
 
 
     text = f"""[Github](https://github.com/thehamkercat/WilliamButcherBot) | [Group](t.me/PatheticProgrammers)
     text = f"""[Github](https://github.com/thehamkercat/WilliamButcherBot) | [Group](t.me/PatheticProgrammers)
@@ -48,4 +50,6 @@ async def repo(_, message):
 | Contributors |
 | Contributors |
 ----------------```
 ----------------```
 {list_of_users}"""
 {list_of_users}"""
-    await app.send_message(message.chat.id, text=text, disable_web_page_preview=True)
+    await app.send_message(
+        message.chat.id, text=text, disable_web_page_preview=True
+    )

+ 9 - 5
wbb/modules/reverse.py

@@ -54,7 +54,9 @@ async def get_soup(url: str, headers):
 @capture_err
 @capture_err
 async def reverse_image_search(client, message: Message):
 async def reverse_image_search(client, message: Message):
     if not message.reply_to_message:
     if not message.reply_to_message:
-        return await eor(message, text="Reply to a message to reverse search it.")
+        return await eor(
+            message, text="Reply to a message to reverse search it."
+        )
     reply = message.reply_to_message
     reply = message.reply_to_message
     if (
     if (
         not reply.document
         not reply.document
@@ -81,7 +83,9 @@ async def reverse_image_search(client, message: Message):
             }
             }
 
 
             def post_non_blocking():
             def post_non_blocking():
-                return requests.post(search_url, files=multipart, allow_redirects=False)
+                return requests.post(
+                    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)
@@ -106,9 +110,9 @@ async def reverse_image_search(client, message: Message):
 
 
     # Pass if no images detected
     # Pass if no images detected
     try:
     try:
-        url = "https://google.com" + soup.find_all("a", {"class": "ekf0x hSQtef"})[
-            0
-        ].get("href")
+        url = "https://google.com" + soup.find_all(
+            "a", {"class": "ekf0x hSQtef"}
+        )[0].get("href")
 
 
         soup = await get_soup(url, headers=headers)
         soup = await get_soup(url, headers=headers)
 
 

+ 17 - 5
wbb/modules/rice.py

@@ -59,7 +59,9 @@ async def rice(_, message: Message):
         reply_markup=InlineKeyboardMarkup(
         reply_markup=InlineKeyboardMarkup(
             [
             [
                 [
                 [
-                    InlineKeyboardButton("Approve (Forward)", callback_data="forward"),
+                    InlineKeyboardButton(
+                        "Approve (Forward)", callback_data="forward"
+                    ),
                     InlineKeyboardButton("Ignore", callback_data="ignore"),
                     InlineKeyboardButton("Ignore", callback_data="ignore"),
                 ]
                 ]
             ]
             ]
@@ -75,7 +77,10 @@ async def callback_query_forward_rice(_, callback_query):
     u_approver = callback_query.from_user
     u_approver = callback_query.from_user
     c_group = callback_query.message.chat
     c_group = callback_query.message.chat
     approver_status = (await c_group.get_member(u_approver.id)).status
     approver_status = (await c_group.get_member(u_approver.id)).status
-    if not approver_status in (ChatMemberStatus.ADMINISTRATOR, ChatMemberStatus.OWNER):
+    if not approver_status in (
+        ChatMemberStatus.ADMINISTRATOR,
+        ChatMemberStatus.OWNER,
+    ):
         await callback_query.answer("Only admin can approve this!")
         await callback_query.answer("Only admin can approve this!")
         return
         return
     await callback_query.answer("Successfully approved")
     await callback_query.answer("Successfully approved")
@@ -88,11 +93,15 @@ async def callback_query_forward_rice(_, callback_query):
         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(InputMediaPhoto(m.photo.file_id, caption=arg_caption))
+                arg_media.append(
+                    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(InputMediaVideo(m.video.file_id, caption=arg_caption))
+                arg_media.append(
+                    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))
         m_cp = await app.send_media_group(RICE_CHANNEL, arg_media)
         m_cp = await app.send_media_group(RICE_CHANNEL, arg_media)
@@ -118,7 +127,10 @@ async def callback_query_ignore_rice(_, callback_query):
     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 [ChatMemberStatus.ADMINISTRATOR, ChatMemberStatus.OWNER]:
+    elif disprover_status in [
+        ChatMemberStatus.ADMINISTRATOR,
+        ChatMemberStatus.OWNER,
+    ]:
         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")

+ 13 - 4
wbb/modules/stickers.py

@@ -146,14 +146,19 @@ async def kang(client, message: 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("You are anon admin, kang stickers in my pm.")
+        return await message.reply_text(
+            "You are anon admin, kang stickers in my pm."
+        )
     msg = await message.reply_text("Kanging Sticker..")
     msg = await message.reply_text("Kanging Sticker..")
 
 
     # Find the proper emoji
     # Find the proper emoji
     args = message.text.split()
     args = message.text.split()
     if len(args) > 1:
     if len(args) > 1:
         sticker_emoji = str(args[1])
         sticker_emoji = str(args[1])
-    elif message.reply_to_message.sticker and message.reply_to_message.sticker.emoji:
+    elif (
+        message.reply_to_message.sticker
+        and message.reply_to_message.sticker.emoji
+    ):
         sticker_emoji = message.reply_to_message.sticker.emoji
         sticker_emoji = message.reply_to_message.sticker.emoji
     else:
     else:
         sticker_emoji = "🤔"
         sticker_emoji = "🤔"
@@ -175,9 +180,13 @@ async def kang(client, message: Message):
             temp_file_path = await app.download_media(doc)
             temp_file_path = await app.download_media(doc)
             image_type = imghdr.what(temp_file_path)
             image_type = imghdr.what(temp_file_path)
             if image_type not in SUPPORTED_TYPES:
             if image_type not in SUPPORTED_TYPES:
-                return await msg.edit("Format not supported! ({})".format(image_type))
+                return await msg.edit(
+                    "Format not supported! ({})".format(image_type)
+                )
             try:
             try:
-                temp_file_path = await resize_file_to_sticker_size(temp_file_path)
+                temp_file_path = await resize_file_to_sticker_size(
+                    temp_file_path
+                )
             except OSError as e:
             except OSError as e:
                 await msg.edit_text("Something wrong happened.")
                 await msg.edit_text("Something wrong happened.")
                 raise Exception(
                 raise Exception(

+ 3 - 1
wbb/modules/sudo.py

@@ -64,7 +64,9 @@ async def useradd(_, message: Message):
     if user_id in sudoers:
     if user_id in sudoers:
         return await eor(message, text=f"{umention} is already in sudoers.")
         return await eor(message, text=f"{umention} is already in sudoers.")
     if user_id == BOT_ID:
     if user_id == BOT_ID:
-        return await eor(message, text="You can't add assistant bot in sudoers.")
+        return await eor(
+            message, text="You can't add assistant bot in sudoers."
+        )
 
 
     await add_sudo(user_id)
     await add_sudo(user_id)
 
 

+ 10 - 4
wbb/modules/sudoers.py

@@ -44,9 +44,9 @@ from wbb.utils import formatter
 from wbb.utils.dbfunctions import (
 from wbb.utils.dbfunctions import (
     add_gban_user,
     add_gban_user,
     get_served_chats,
     get_served_chats,
+    get_served_users,
     is_gbanned_user,
     is_gbanned_user,
     remove_gban_user,
     remove_gban_user,
-    get_served_users,
 )
 )
 from wbb.utils.functions import extract_user, extract_user_and_reason, restart
 from wbb.utils.functions import extract_user, extract_user_and_reason, restart
 
 
@@ -191,7 +191,9 @@ async def broadcast_message(_, message):
 
 
     reply_markup = None
     reply_markup = None
     if reply_message.reply_markup:
     if reply_message.reply_markup:
-        reply_markup = InlineKeyboardMarkup(reply_message.reply_markup.inline_keyboard)
+        reply_markup = InlineKeyboardMarkup(
+            reply_message.reply_markup.inline_keyboard
+        )
     sent = 0
     sent = 0
     schats = await get_served_chats()
     schats = await get_served_chats()
     chats = [int(chat["chat_id"]) for chat in schats]
     chats = [int(chat["chat_id"]) for chat in schats]
@@ -226,7 +228,9 @@ async def update_restart(_, message):
         await message.reply_text(f"```{out}```")
         await message.reply_text(f"```{out}```")
     except Exception as e:
     except Exception as e:
         return await message.reply_text(str(e))
         return await message.reply_text(str(e))
-    m = await message.reply_text("**Updated with default branch, restarting now.**")
+    m = await message.reply_text(
+        "**Updated with default branch, restarting now.**"
+    )
     await restart(m)
     await restart(m)
 
 
 
 
@@ -242,7 +246,9 @@ async def broadcast_message(_, message):
 
 
     reply_markup = None
     reply_markup = None
     if reply_message.reply_markup:
     if reply_message.reply_markup:
-        reply_markup = InlineKeyboardMarkup(reply_message.reply_markup.inline_keyboard)
+        reply_markup = InlineKeyboardMarkup(
+            reply_message.reply_markup.inline_keyboard
+        )
 
 
     m = await message.reply_text(
     m = await message.reply_text(
         f"Broadcast in progress, will take {len(chats) * sleep_time} seconds."
         f"Broadcast in progress, will take {len(chats) * sleep_time} seconds."

+ 10 - 3
wbb/modules/taglogger.py

@@ -70,7 +70,8 @@ async def sendLog(message: Message):
 
 
 
 
 @app2.on_message(
 @app2.on_message(
-    ~filters.me & ~filters.chat([LOG_GROUP_ID, BOT_ID])
+    ~filters.me
+    & ~filters.chat([LOG_GROUP_ID, BOT_ID])
     & ~filters.private
     & ~filters.private
     & ~filters.forwarded
     & ~filters.forwarded
     & ~filters.via_bot,
     & ~filters.via_bot,
@@ -84,7 +85,9 @@ async def tagLoggerFunc(_, message: Message):
         return
         return
     if message.reply_to_message:
     if message.reply_to_message:
         reply_message = message.reply_to_message
         reply_message = message.reply_to_message
-        if reply_message.from_user and (reply_message.from_user.id == USERBOT_ID):
+        if reply_message.from_user and (
+            reply_message.from_user.id == USERBOT_ID
+        ):
             return await sendLog(message)
             return await sendLog(message)
 
 
     if message.text:
     if message.text:
@@ -93,5 +96,9 @@ async def tagLoggerFunc(_, message: Message):
         text = message.caption
         text = message.caption
     else:
     else:
         return
         return
-    if str(USERBOT_ID) in text or str(USERBOT_USERNAME) in text or USERBOT_NAME in text:
+    if (
+        str(USERBOT_ID) in text
+        or str(USERBOT_USERNAME) in text
+        or USERBOT_NAME in text
+    ):
         await sendLog(message)
         await sendLog(message)

+ 3 - 1
wbb/modules/webss.py

@@ -94,7 +94,9 @@ async def take_ss(_, message: Message):
         if not full:
         if not full:
             # Full size images have problem with reply_photo, that's why
             # Full size images have problem with reply_photo, that's why
             # we need to only use reply_photo if we're not using full size
             # we need to only use reply_photo if we're not using full size
-            await gather(*[message.reply_document(photo), message.reply_photo(photo)])
+            await gather(
+                *[message.reply_document(photo), message.reply_photo(photo)]
+            )
         else:
         else:
             await message.reply_document(photo)
             await message.reply_document(photo)
         await m.delete()
         await m.delete()

+ 23 - 10
wbb/utils/dbfunctions.py

@@ -459,6 +459,7 @@ async def save_captcha_solved(chat_id: int, user_id: int):
         upsert=True,
         upsert=True,
     )
     )
 
 
+
 async def is_antiservice_on(chat_id: int) -> bool:
 async def is_antiservice_on(chat_id: int) -> bool:
     chat = await antiservicedb.find_one({"chat_id": chat_id})
     chat = await antiservicedb.find_one({"chat_id": chat_id})
     if not chat:
     if not chat:
@@ -505,8 +506,8 @@ async def get_welcome(chat_id: int) -> (str, str, str):
     data = await welcomedb.find_one({"chat_id": chat_id})
     data = await welcomedb.find_one({"chat_id": chat_id})
     if not data:
     if not data:
         return "", "", ""
         return "", "", ""
-        
-    welcome = data.get("welcome", "")    
+
+    welcome = data.get("welcome", "")
     raw_text = data.get("raw_text", "")
     raw_text = data.get("raw_text", "")
     file_id = data.get("file_id", "")
     file_id = data.get("file_id", "")
 
 
@@ -514,12 +515,14 @@ async def get_welcome(chat_id: int) -> (str, str, str):
 
 
 
 
 async def set_welcome(chat_id: int, welcome: str, raw_text: str, file_id: str):
 async def set_welcome(chat_id: int, welcome: str, raw_text: str, file_id: str):
-    update_data = {"welcome": welcome, "raw_text": raw_text, "file_id": file_id}
+    update_data = {
+        "welcome": welcome,
+        "raw_text": raw_text,
+        "file_id": file_id,
+    }
 
 
     return await welcomedb.update_one(
     return await welcomedb.update_one(
-        {"chat_id": chat_id},
-        {"$set": update_data},
-        upsert=True
+        {"chat_id": chat_id}, {"$set": update_data}, upsert=True
     )
     )
 
 
 
 
@@ -609,7 +612,10 @@ async def deactivate_pipe(from_chat_id: int, to_chat_id: int):
     if not pipes:
     if not pipes:
         return
         return
     for pipe in pipes:
     for pipe in pipes:
-        if pipe["from_chat_id"] == from_chat_id and pipe["to_chat_id"] == to_chat_id:
+        if (
+            pipe["from_chat_id"] == from_chat_id
+            and pipe["to_chat_id"] == to_chat_id
+        ):
             pipes.remove(pipe)
             pipes.remove(pipe)
     return await pipesdb.update_one(
     return await pipesdb.update_one(
         {"pipe": "pipe"}, {"$set": {"pipes": pipes}}, upsert=True
         {"pipe": "pipe"}, {"$set": {"pipes": pipes}}, upsert=True
@@ -618,7 +624,10 @@ async def deactivate_pipe(from_chat_id: int, to_chat_id: int):
 
 
 async def is_pipe_active(from_chat_id: int, to_chat_id: int) -> bool:
 async def is_pipe_active(from_chat_id: int, to_chat_id: int) -> bool:
     for pipe in await show_pipes():
     for pipe in await show_pipes():
-        if pipe["from_chat_id"] == from_chat_id and pipe["to_chat_id"] == to_chat_id:
+        if (
+            pipe["from_chat_id"] == from_chat_id
+            and pipe["to_chat_id"] == to_chat_id
+        ):
             return True
             return True
 
 
 
 
@@ -774,7 +783,9 @@ async def add_chatbot(chat_id: int, is_userbot: bool = False):
         list_id["userbot"].append(chat_id)
         list_id["userbot"].append(chat_id)
     else:
     else:
         list_id["bot"].append(chat_id)
         list_id["bot"].append(chat_id)
-    await chatbotdb.update_one({"chatbot": "chatbot"}, {"$set": list_id}, upsert=True)
+    await chatbotdb.update_one(
+        {"chatbot": "chatbot"}, {"$set": list_id}, upsert=True
+    )
 
 
 
 
 async def rm_chatbot(chat_id: int, is_userbot: bool = False):
 async def rm_chatbot(chat_id: int, is_userbot: bool = False):
@@ -783,4 +794,6 @@ async def rm_chatbot(chat_id: int, is_userbot: bool = False):
         list_id["userbot"].remove(chat_id)
         list_id["userbot"].remove(chat_id)
     else:
     else:
         list_id["bot"].remove(chat_id)
         list_id["bot"].remove(chat_id)
-    await chatbotdb.update_one({"chatbot": "chatbot"}, {"$set": list_id}, upsert=True)
+    await chatbotdb.update_one(
+        {"chatbot": "chatbot"}, {"$set": list_id}, upsert=True
+    )

+ 2 - 1
wbb/utils/files.py

@@ -65,7 +65,8 @@ async def upload_document(
         raw.functions.messages.UploadMedia(
         raw.functions.messages.UploadMedia(
             peer=await client.resolve_peer(chat_id),
             peer=await client.resolve_peer(chat_id),
             media=raw.types.InputMediaUploadedDocument(
             media=raw.types.InputMediaUploadedDocument(
-                mime_type=client.guess_mime_type(file_path) or "application/zip",
+                mime_type=client.guess_mime_type(file_path)
+                or "application/zip",
                 file=await client.save_file(file_path),
                 file=await client.save_file(file_path),
                 attributes=[
                 attributes=[
                     raw.types.DocumentAttributeFilename(
                     raw.types.DocumentAttributeFilename(

+ 32 - 12
wbb/utils/inlinefuncs.py

@@ -40,9 +40,9 @@ from pyrogram.types import (
     CallbackQuery,
     CallbackQuery,
     InlineKeyboardButton,
     InlineKeyboardButton,
     InlineQueryResultArticle,
     InlineQueryResultArticle,
+    InlineQueryResultCachedDocument,
     InlineQueryResultPhoto,
     InlineQueryResultPhoto,
     InputTextMessageContent,
     InputTextMessageContent,
-    InlineQueryResultCachedDocument,
 )
 )
 from search_engine_parser import GoogleSearch
 from search_engine_parser import GoogleSearch
 
 
@@ -122,7 +122,9 @@ async def alive_function(answers):
     ubot_state = "Dead" if not await app2.get_me() else "Alive"
     ubot_state = "Dead" if not await app2.get_me() else "Alive"
     buttons.add(
     buttons.add(
         InlineKeyboardButton("Stats", callback_data="stats_callback"),
         InlineKeyboardButton("Stats", callback_data="stats_callback"),
-        InlineKeyboardButton("Go Inline!", switch_inline_query_current_chat=""),
+        InlineKeyboardButton(
+            "Go Inline!", switch_inline_query_current_chat=""
+        ),
     )
     )
 
 
     msg = f"""
     msg = f"""
@@ -178,7 +180,9 @@ __**Translated from {result.src} to {result.dest}**__
             ),
             ),
             InlineQueryResultArticle(
             InlineQueryResultArticle(
                 title=result.translatedText,
                 title=result.translatedText,
-                input_message_content=InputTextMessageContent(result.translatedText),
+                input_message_content=InputTextMessageContent(
+                    result.translatedText
+                ),
             ),
             ),
         ]
         ]
     )
     )
@@ -327,7 +331,9 @@ 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,
@@ -410,7 +416,9 @@ async def tg_search_func(answers, text, user_id):
             ),
             ),
         )
         )
         name = (
         name = (
-            message.from_user.first_name if message.from_user.first_name else "NO NAME"
+            message.from_user.first_name
+            if message.from_user.first_name
+            else "NO NAME"
         )
         )
         caption = f"""
         caption = f"""
 **Query:** {text}
 **Query:** {text}
@@ -464,8 +472,10 @@ async def music_inline_func(answers, query):
                 "duration": f_.audio.duration if f_.audio.duration else 0,
                 "duration": f_.audio.duration if f_.audio.duration else 0,
             }
             }
         )
         )
-    messages = list({v["duration"]: v for v in messages_ids_and_duration}.values())
-    messages_ids = [ff_['id'] for ff_ in messages]
+    messages = list(
+        {v["duration"]: v for v in messages_ids_and_duration}.values()
+    )
+    messages_ids = [ff_["id"] for ff_ in messages]
     messages = await app.get_messages(chat_id, messages_ids[0:48])
     messages = await app.get_messages(chat_id, messages_ids[0:48])
     return [
     return [
         InlineQueryResultCachedDocument(
         InlineQueryResultCachedDocument(
@@ -519,7 +529,9 @@ async def speedtest_init(query):
         return answers
         return answers
     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(InlineKeyboardButton(text="Test", callback_data="test_speedtest"))
+    button.add(
+        InlineKeyboardButton(text="Test", callback_data="test_speedtest")
+    )
     answers.append(
     answers.append(
         InlineQueryResultArticle(
         InlineQueryResultArticle(
             title="Click Here",
             title="Click Here",
@@ -565,7 +577,9 @@ async def pmpermit_func(answers, user_id, victim):
             text="For promotion",
             text="For promotion",
             callback_data="pmpermit to_scam_you a",
             callback_data="pmpermit to_scam_you a",
         ),
         ),
-        InlineKeyboardButton(text="Approve me", callback_data="pmpermit approve_me a"),
+        InlineKeyboardButton(
+            text="Approve me", callback_data="pmpermit approve_me a"
+        ),
         InlineKeyboardButton(
         InlineKeyboardButton(
             text="Approve", callback_data=f"pmpermit approve {victim}"
             text="Approve", callback_data=f"pmpermit approve {victim}"
         ),
         ),
@@ -631,7 +645,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, document_file_id=m.audio.file_id)
+        InlineQueryResultCachedDocument(
+            title=title, document_file_id=m.audio.file_id
+        )
     )
     )
     return answers
     return answers
 
 
@@ -701,7 +717,9 @@ async def tmdb_func(answers, query):
         )
         )
         answers.append(
         answers.append(
             InlineQueryResultPhoto(
             InlineQueryResultPhoto(
-                photo_url=result.backdrop if result.backdrop else result.poster,
+                photo_url=result.backdrop
+                if result.backdrop
+                else result.poster,
                 caption=caption,
                 caption=caption,
                 title=result.title,
                 title=result.title,
                 description=f"{genre} • {result.releaseDate} • {result.rating} • {description}",
                 description=f"{genre} • {result.releaseDate} • {result.rating} • {description}",
@@ -785,7 +803,9 @@ async def execute_code(query):
             answers.append(
             answers.append(
                 InlineQueryResultArticle(
                 InlineQueryResultArticle(
                     title="Error",
                     title="Error",
-                    input_message_content=InputTextMessageContent(response.result),
+                    input_message_content=InputTextMessageContent(
+                        response.result
+                    ),
                 )
                 )
             )
             )
         else:
         else:

+ 7 - 3
wbb/utils/misc.py

@@ -87,7 +87,9 @@ def paginate_modules(page_n, module_dict, prefix, chat=None):
 
 
     # can only have a certain amount of buttons side by side
     # can only have a certain amount of buttons side by side
     if len(pairs) > COLUMN_SIZE:
     if len(pairs) > COLUMN_SIZE:
-        pairs = pairs[modulo_page * COLUMN_SIZE : COLUMN_SIZE * (modulo_page + 1)] + [
+        pairs = pairs[
+            modulo_page * COLUMN_SIZE : COLUMN_SIZE * (modulo_page + 1)
+        ] + [
             (
             (
                 EqInlineKeyboardButton(
                 EqInlineKeyboardButton(
                     "❮",
                     "❮",
@@ -104,8 +106,10 @@ def paginate_modules(page_n, module_dict, prefix, chat=None):
             )
             )
         ]
         ]
     else:
     else:
-        pairs = pairs[modulo_page * COLUMN_SIZE : COLUMN_SIZE * (modulo_page + 1)] + [
-            (   
+        pairs = pairs[
+            modulo_page * COLUMN_SIZE : COLUMN_SIZE * (modulo_page + 1)
+        ] + [
+            (
                 EqInlineKeyboardButton(
                 EqInlineKeyboardButton(
                     "Back",
                     "Back",
                     callback_data="{}_home({})".format(prefix, modulo_page),
                     callback_data="{}_home({})".format(prefix, modulo_page),

+ 1 - 3
wbb/utils/rss.py

@@ -16,9 +16,7 @@ class Feed:
         self.summary = entry.get("summary") or ""
         self.summary = entry.get("summary") or ""
 
 
     def parsed(self):
     def parsed(self):
-        text = (
-            f"**Title:** [{self.title.strip()}]({self.link or 'https://google.com'})\n"
-        )
+        text = f"**Title:** [{self.title.strip()}]({self.link or 'https://google.com'})\n"
         if self.author:
         if self.author:
             text += f"**Author:** {self.author}\n"
             text += f"**Author:** {self.author}\n"
         if self.published:
         if self.published: