Ver código fonte

Decreased line lenght to 79

TheHamkerCat 5 anos atrás
pai
commit
2e49f9d0da

+ 3 - 1
sample_config.py

@@ -8,7 +8,9 @@ if HEROKU:
     API_HASH = environ.get("API_HASH", "eb06d4abfb49dc3eeb1aeb98ae0f581e")
     SESSION_STRING = environ.get("SESSION_STRING", None)
     USERBOT_PREFIX = environ.get("USERBOT_PREFIX", None)
-    SUDO_USERS_ID = list(int(x) for x in environ.get("SUDO_USERS_ID", "").split())
+    SUDO_USERS_ID = list(
+        int(x) for x in environ.get("SUDO_USERS_ID", "").split()
+    )
     LOG_GROUP_ID = int(environ.get("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))

+ 20 - 6
wbb/__main__.py

@@ -43,9 +43,15 @@ async def start_bot():
     global COMMANDS_COUNT
     for module in ALL_MODULES:
         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__
-            if hasattr(imported_module, "__HELP__") and imported_module.__HELP__:
+            if (
+                hasattr(imported_module, "__HELP__")
+                and imported_module.__HELP__
+            ):
                 HELPABLE[imported_module.__MODULE__.lower()] = imported_module
     bot_modules = ""
     j = 1
@@ -85,7 +91,9 @@ async def help_command(_, message):
                     InlineKeyboardButton(
                         text="System Stats 💻", callback_data="stats_callback"
                     ),
-                    InlineKeyboardButton(text="Support 👨", url="t.me/WBBSupport"),
+                    InlineKeyboardButton(
+                        text="Support 👨", url="t.me/WBBSupport"
+                    ),
                 ],
             ]
         )
@@ -94,7 +102,9 @@ async def help_command(_, message):
     keyboard = InlineKeyboardMarkup(
         [
             [
-                InlineKeyboardButton(text="Commands ❓", callback_data="bot_commands"),
+                InlineKeyboardButton(
+                    text="Commands ❓", callback_data="bot_commands"
+                ),
                 InlineKeyboardButton(
                     text="Repo 🛠",
                     url="https://github.com/thehamkercat/WilliamButcherBot",
@@ -175,7 +185,9 @@ General command are:
     if mod_match:
         module = mod_match.group(1)
         text = (
-            "{} **{}**:\n".format("Here is the help for", HELPABLE[module].__MODULE__)
+            "{} **{}**:\n".format(
+                "Here is the help for", HELPABLE[module].__MODULE__
+            )
             + HELPABLE[module].__HELP__
         )
 
@@ -210,7 +222,9 @@ General command are:
     elif back_match:
         await query.message.edit(
             text=top_text,
-            reply_markup=InlineKeyboardMarkup(paginate_modules(0, HELPABLE, "help")),
+            reply_markup=InlineKeyboardMarkup(
+                paginate_modules(0, HELPABLE, "help")
+            ),
             disable_web_page_preview=True,
         )
 

+ 13 - 4
wbb/core/types/InlineQueryResult.py

@@ -97,7 +97,10 @@ class InlineQueryResultAudio(InlineQueryResult):
 
     async def write(self, client: "pyrogram.Client"):
         audio = raw.types.InputWebDocument(
-            url=self.audio_url, size=0, mime_type=self.mime_type, attributes=[]
+            url=self.audio_url,
+            size=0,
+            mime_type=self.mime_type,
+            attributes=[],
         )
 
         thumb = raw.types.InputWebDocument(
@@ -128,7 +131,9 @@ class InlineQueryResultAudio(InlineQueryResult):
             thumb=thumb,
             content=audio,
             send_message=(
-                await self.input_message_content.write(client, self.reply_markup)
+                await self.input_message_content.write(
+                    client, self.reply_markup
+                )
                 if self.input_message_content
                 else raw.types.InputBotInlineMessageMediaAuto(
                     reply_markup=await self.reply_markup.write(client)
@@ -228,7 +233,9 @@ class InlineQueryResultCachedDocument(InlineQueryResult):
             description=self.description,
             document=document,
             send_message=(
-                await self.input_message_content.write(client, self.reply_markup)
+                await self.input_message_content.write(
+                    client, self.reply_markup
+                )
                 if self.input_message_content
                 else raw.types.InputBotInlineMessageMediaAuto(
                     reply_markup=await self.reply_markup.write(client)
@@ -260,7 +267,9 @@ def get_input_file_from_file_id(
         )
 
     if file_type in (FileType.THUMBNAIL, FileType.CHAT_PHOTO):
-        raise ValueError(f"This file_id can only be used for download: {file_id}")
+        raise ValueError(
+            f"This file_id can only be used for download: {file_id}"
+        )
 
     if file_type in PHOTO_TYPES:
         return raw.types.InputPhoto(

+ 70 - 22
wbb/modules/admin.py

@@ -50,7 +50,9 @@ __HELP__ = """/ban - Ban A User
 
 async def list_admins(chat_id: int):
     list_of_admins = []
-    async for member in app.iter_chat_members(chat_id, filter="administrators"):
+    async for member in app.iter_chat_members(
+        chat_id, filter="administrators"
+    ):
         list_of_admins.append(member.user.id)
     return list_of_admins
 
@@ -139,7 +141,9 @@ async def purge(client, message):
                     message_ids.append(a_s_message_id)
                     if len(message_ids) == 100:
                         await client.delete_messages(
-                            chat_id=chat_id, message_ids=message_ids, revoke=True
+                            chat_id=chat_id,
+                            message_ids=message_ids,
+                            revoke=True,
                         )
                         message_ids = []
                 if len(message_ids) > 0:
@@ -148,7 +152,8 @@ async def purge(client, message):
                     )
             else:
                 await message.reply_text(
-                    "Reply To A Message To Delete It," " Don't Make Fun Of Yourself!"
+                    "Reply To A Message To Delete It,"
+                    " Don't Make Fun Of Yourself!"
                 )
         else:
             await message.reply_text("Your Don't Have Enough Permissions!")
@@ -168,7 +173,10 @@ async def kick(_, message):
         from_user_id = message.from_user.id
         chat_id = message.chat.id
         permissions = await member_permissions(chat_id, from_user_id)
-        if "can_restrict_members" not in permissions and from_user_id not in SUDOERS:
+        if (
+            "can_restrict_members" not in permissions
+            and from_user_id not in SUDOERS
+        ):
             await message.reply_text("You don't have enough permissions.")
             return
         if len(message.command) == 2:
@@ -202,7 +210,10 @@ async def ban(_, message):
         from_user_id = message.from_user.id
         chat_id = message.chat.id
         permissions = await member_permissions(chat_id, from_user_id)
-        if "can_restrict_members" not in permissions and from_user_id not in SUDOERS:
+        if (
+            "can_restrict_members" not in permissions
+            and from_user_id not in SUDOERS
+        ):
             await message.reply_text("You don't have enough permissions.")
             return
         if len(message.command) == 2:
@@ -233,7 +244,10 @@ async def unban(_, message):
         from_user_id = message.from_user.id
         chat_id = message.chat.id
         permissions = await member_permissions(chat_id, from_user_id)
-        if "can_restrict_members" not in permissions and from_user_id not in SUDOERS:
+        if (
+            "can_restrict_members" not in permissions
+            and from_user_id not in SUDOERS
+        ):
             await message.reply_text("You don't have enough permissions.")
             return
         if len(message.command) == 2:
@@ -264,9 +278,13 @@ async def delete(_, message):
         from_user_id = message.from_user.id
         chat_id = message.chat.id
         permissions = await member_permissions(chat_id, from_user_id)
-        if "can_delete_messages" not in permissions and from_user_id not in SUDOERS:
+        if (
+            "can_delete_messages" not in permissions
+            and from_user_id not in SUDOERS
+        ):
             await message.reply_text(
-                "You Don't Have Enough Permissions," + " Consider Deleting Yourself!"
+                "You Don't Have Enough Permissions,"
+                + " Consider Deleting Yourself!"
             )
             return
         await message.reply_to_message.delete()
@@ -285,7 +303,10 @@ async def promote(_, message):
         from_user_id = message.from_user.id
         chat_id = message.chat.id
         permissions = await member_permissions(chat_id, from_user_id)
-        if "can_promote_members" not in permissions and from_user_id not in SUDOERS:
+        if (
+            "can_promote_members" not in permissions
+            and from_user_id not in SUDOERS
+        ):
             await message.reply_text("You don't have enough permissions")
             return
         bot = await app.get_chat_member(chat_id, BOT_ID)
@@ -348,7 +369,10 @@ async def mute(_, message):
         from_user_id = message.from_user.id
         chat_id = message.chat.id
         permissions = await member_permissions(chat_id, from_user_id)
-        if "can_restrict_members" not in permissions and from_user_id not in SUDOERS:
+        if (
+            "can_restrict_members" not in permissions
+            and from_user_id not in SUDOERS
+        ):
             await message.reply_text("You don't have enough permissions.")
             return
         if len(message.command) == 2:
@@ -363,7 +387,9 @@ async def mute(_, message):
         if user_id in SUDOERS:
             await message.reply_text("You Wanna Mute The Elevated One?")
             return
-        await message.chat.restrict_member(user_id, permissions=ChatPermissions())
+        await message.chat.restrict_member(
+            user_id, permissions=ChatPermissions()
+        )
         await message.reply_text("Muted!")
     except Exception as e:
         await message.reply_text(str(e))
@@ -379,7 +405,10 @@ async def unmute(_, message):
         from_user_id = message.from_user.id
         chat_id = message.chat.id
         permissions = await member_permissions(chat_id, from_user_id)
-        if "can_restrict_members" not in permissions and from_user_id not in SUDOERS:
+        if (
+            "can_restrict_members" not in permissions
+            and from_user_id not in SUDOERS
+        ):
             await message.reply_text("You don't have enough permissions.")
             return
         if len(message.command) == 2:
@@ -420,7 +449,9 @@ async def ban_deleted_accounts(_, message):
                         print(str(e))
                         pass
                     banned_users += 1
-                await message.reply_text(f"Banned {banned_users} Deleted Accounts")
+                await message.reply_text(
+                    f"Banned {banned_users} Deleted Accounts"
+                )
             else:
                 await message.reply_text("No Deleted Accounts In This Chat")
                 return
@@ -454,12 +485,16 @@ async def warn_user(_, message):
                 await message.reply_text("I wouldn't do that if i were you.")
             else:
                 if user_id in await list_members(chat_id):
-                    warns = await get_warn(chat_id, await int_to_alpha(user_id))
+                    warns = await get_warn(
+                        chat_id, await int_to_alpha(user_id)
+                    )
                     if warns:
                         warns = warns["warns"]
                     else:
                         warn = {"warns": 1}
-                        await add_warn(chat_id, await int_to_alpha(user_id), warn)
+                        await add_warn(
+                            chat_id, await int_to_alpha(user_id), warn
+                        )
                         await message.reply_text(
                             f"Warned {mention} !, 1/3 warnings now."
                         )
@@ -469,10 +504,14 @@ async def warn_user(_, message):
                         await message.reply_text(
                             f"Number of warns of {mention} exceeded, Banned!"
                         )
-                        await remove_warns(chat_id, await int_to_alpha(user_id))
+                        await remove_warns(
+                            chat_id, await int_to_alpha(user_id)
+                        )
                     else:
                         warn = {"warns": warns + 1}
-                        await add_warn(chat_id, await int_to_alpha(user_id), warn)
+                        await add_warn(
+                            chat_id, await int_to_alpha(user_id), warn
+                        )
                         await message.reply_text(
                             f"Warned {mention} !, {warns+1}/3 warnings now."
                         )
@@ -491,7 +530,9 @@ async def warn_user(_, message):
 @capture_err
 async def remove_warnings(_, message):
     if not message.reply_to_message:
-        await message.reply_text("Reply to a message to remove a user's warnings.")
+        await message.reply_text(
+            "Reply to a message to remove a user's warnings."
+        )
         return
     try:
         from_user_id = message.from_user.id
@@ -521,7 +562,9 @@ async def remove_warnings(_, message):
 @capture_err
 async def check_warns(_, message):
     if not message.reply_to_message:
-        await message.reply_text("Reply to a message to check a user's warnings.")
+        await message.reply_text(
+            "Reply to a message to check a user's warnings."
+        )
         return
     try:
         user_id = message.reply_to_message.from_user.id
@@ -535,7 +578,9 @@ async def check_warns(_, message):
             else:
                 await message.reply_text(f"{mention_user} have no warnings.")
                 return
-            await message.reply_text(f"{mention_user} have {warns}/3 warnings.")
+            await message.reply_text(
+                f"{mention_user} have {warns}/3 warnings."
+            )
             return
         warns = await get_warn(chat_id, await int_to_alpha(user_id))
         if warns:
@@ -543,7 +588,9 @@ async def check_warns(_, message):
         else:
             await message.reply_text(f"{mention_user} have no warnings.")
             return
-        await message.reply_text(f"{mention_from_user} have {warns}/3 warnings.")
+        await message.reply_text(
+            f"{mention_from_user} have {warns}/3 warnings."
+        )
     except Exception as e:
         await message.reply_text(str(e))
 
@@ -552,7 +599,8 @@ async def check_warns(_, message):
 
 
 @app.on_message(
-    filters.command(["report", "admins"], prefixes=["@", "/"]) & ~filters.edited
+    filters.command(["report", "admins"], prefixes=["@", "/"])
+    & ~filters.edited
 )
 @capture_err
 async def report_user(_, message):

+ 10 - 3
wbb/modules/admin_misc.py

@@ -101,10 +101,17 @@ async def set_chat_photo(_, message):
                 await message.reply_text("You Don't Have Enough Permissions.")
                 return
         if not message.reply_to_message:
-            await message.reply_text("Reply to a photo to set it as chat_photo")
+            await message.reply_text(
+                "Reply to a photo to set it as chat_photo"
+            )
             return
-        if not message.reply_to_message.photo and not message.reply_to_message.document:
-            await message.reply_text("Reply to a photo to set it as chat_photo")
+        if (
+            not message.reply_to_message.photo
+            and not message.reply_to_message.document
+        ):
+            await message.reply_text(
+                "Reply to a photo to set it as chat_photo"
+            )
             return
         photo = await message.reply_to_message.download()
         await message.chat.set_photo(photo)

+ 19 - 11
wbb/modules/anime.py

@@ -186,7 +186,9 @@ def calculate_eta(current, total, start_time):
     end_time = time.time()
     elapsed_time = end_time - start_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")
     return ", ".join(thing)
 
@@ -203,7 +205,9 @@ async def anime_search(_, message):
     search = message.text.split(None, 1)[1]
     variables = {"search": search}
     json = (
-        requests.post(url, json={"query": anime_query, "variables": variables})
+        requests.post(
+            url, json={"query": anime_query, "variables": variables}
+        )
         .json()["data"]
         .get("Media", None)
     )
@@ -243,7 +247,9 @@ async def anime_search(_, message):
         if image:
             try:
                 await message.reply_photo(
-                    image, caption=msg, reply_markup=InlineKeyboardMarkup(buttons)
+                    image,
+                    caption=msg,
+                    reply_markup=InlineKeyboardMarkup(buttons),
                 )
             except Exception:
                 msg += f" [✔️️]({image})"
@@ -261,15 +267,17 @@ async def manga_search(_, message):
     search = message.text.split(None, 1)[1]
     variables = {"search": search}
     json = (
-        requests.post(url, json={"query": manga_query, "variables": variables})
+        requests.post(
+            url, json={"query": manga_query, "variables": variables}
+        )
         .json()["data"]
         .get("Media", None)
     )
     ms_g = ""
     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 = (
             json["startDate"].get("year", False),
             json.get("status", False),
@@ -311,14 +319,14 @@ async def character_search(_, message):
     search = message.text.split(None, 1)[1]
     variables = {"query": search}
     json = (
-        requests.post(url, json={"query": character_query, "variables": variables})
+        requests.post(
+            url, json={"query": character_query, "variables": variables}
+        )
         .json()["data"]
         .get("Character", None)
     )
     if json:
-        ms_g = (
-            f"**{json.get('name').get('full')}**(`{json.get('name').get('native')}`)\n"
-        )
+        ms_g = f"**{json.get('name').get('full')}**(`{json.get('name').get('native')}`)\n"
         description = f"{json['description']}"
         site_url = json.get("siteUrl")
         ms_g += shorten(description, site_url)

+ 3 - 1
wbb/modules/antiservice.py

@@ -42,7 +42,9 @@ async def anti_service(_, message):
             "Disabled AntiService System. I won't Be Deleting Service Message from Now on."
         )
     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)

+ 15 - 5
wbb/modules/blacklist.py

@@ -43,7 +43,9 @@ __HELP__ = """
 """
 
 
-@app.on_message(filters.command("blacklist") & ~filters.edited & ~filters.private)
+@app.on_message(
+    filters.command("blacklist") & ~filters.edited & ~filters.private
+)
 @capture_err
 async def save_filters(_, message):
     if len(message.command) < 2:
@@ -63,7 +65,9 @@ async def save_filters(_, message):
     await message.reply_text(f"__**Blacklisted {word}.**__")
 
 
-@app.on_message(filters.command("blacklisted") & ~filters.edited & ~filters.private)
+@app.on_message(
+    filters.command("blacklisted") & ~filters.edited & ~filters.private
+)
 @capture_err
 async def get_filterss(_, message):
     data = await get_blacklisted_words(message.chat.id)
@@ -76,7 +80,9 @@ async def get_filterss(_, message):
         await message.reply_text(msg)
 
 
-@app.on_message(filters.command("whitelist") & ~filters.edited & ~filters.private)
+@app.on_message(
+    filters.command("whitelist") & ~filters.edited & ~filters.private
+)
 @capture_err
 async def del_filter(_, message):
     if len(message.command) < 2:
@@ -99,7 +105,9 @@ async def del_filter(_, message):
         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
+)
 async def blacklist_filters_re(_, message):
     text = message.text.lower().strip()
     if not text:
@@ -118,7 +126,9 @@ async def blacklist_filters_re(_, message):
                 if user.id in await list_admins(chat_id):
                     return
                 try:
-                    await message.chat.restrict_member(user.id, ChatPermissions())
+                    await message.chat.restrict_member(
+                        user.id, ChatPermissions()
+                    )
                 except Exception:
                     return
                 await app.send_message(

+ 3 - 0
wbb/modules/blacklist_chat.py

@@ -20,6 +20,7 @@ in which you don't want it to be in.
 
 
 @app.on_message(filters.command("blacklist_chat") & filters.user(SUDOERS))
+@capture_err
 async def blacklist_chat_func(_, message: Message):
     if len(message.command) != 2:
         await message.reply_text("**Usage:**\n/blacklist_chat [CHAT_ID]")
@@ -36,6 +37,7 @@ async def blacklist_chat_func(_, message: Message):
 
 
 @app.on_message(filters.command("whitelist_chat") & filters.user(SUDOERS))
+@capture_err
 async def whitelist_chat_func(_, message: Message):
     if len(message.command) != 2:
         await message.reply_text("**Usage:**\n/whitelist_chat [CHAT_ID]")
@@ -52,6 +54,7 @@ async def whitelist_chat_func(_, message: Message):
 
 
 @app.on_message(filters.command("blacklisted_chats") & filters.user(SUDOERS))
+@capture_err
 async def blacklisted_chats_func(_, message: Message):
     text = ""
     for count, chat_id in enumerate(await blacklisted_chats(), 1):

+ 24 - 7
wbb/modules/chatbot.py

@@ -54,7 +54,10 @@ async def chatbot_status(_, message):
     if status == "ON" or status == "on" or status == "On":
         if chat_id not in active_chats_bot:
             active_chats_bot.append(chat_id)
-            text = "Chatbot Enabled Reply To Any Message " + "Of Mine To Get A Reply"
+            text = (
+                "Chatbot Enabled Reply To Any Message "
+                + "Of Mine To Get A Reply"
+            )
             await message.reply_text(text)
             return
         await message.reply_text("ChatBot Is Already Enabled.")
@@ -78,7 +81,11 @@ async def lunaQuery(query: str, user_id: int):
 
 
 @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,
 )
 @capture_err
@@ -91,7 +98,9 @@ async def chatbot_talk(_, message):
         return
     query = message.text
     await app2.send_chat_action(message.chat.id, "typing")
-    response = await lunaQuery(query, message.from_user.id if message.from_user else 0)
+    response = await lunaQuery(
+        query, message.from_user.id if message.from_user else 0
+    )
     await app2.send_chat_action(message.chat.id, "cancel")
     await message.reply_text(response)
 
@@ -115,7 +124,10 @@ async def chatbot_status_ubot(_, message):
     if status == "ON" or status == "on" or status == "On":
         if chat_id not in active_chats_ubot:
             active_chats_ubot.append(chat_id)
-            text = "Chatbot Enabled Reply To Any Message " + "Of Mine To Get A Reply"
+            text = (
+                "Chatbot Enabled Reply To Any Message "
+                + "Of Mine To Get A Reply"
+            )
             await edit_or_reply(message, text=text)
             return
         await edit_or_reply(message, text="ChatBot Is Already Enabled.")
@@ -134,7 +146,8 @@ async def chatbot_status_ubot(_, message):
 
 
 @app2.on_message(
-    ~filters.me & ~filters.private & filters.text & ~filters.edited, group=chatbot_group
+    ~filters.me & ~filters.private & filters.text & ~filters.edited,
+    group=chatbot_group,
 )
 @capture_err
 async def chatbot_talk_ubot(_, message):
@@ -152,7 +165,9 @@ async def chatbot_talk_ubot(_, message):
         if username not in query:
             return
     await app2.send_chat_action(message.chat.id, "typing")
-    response = await lunaQuery(query, message.from_user.id if message.from_user else 0)
+    response = await lunaQuery(
+        query, message.from_user.id if message.from_user else 0
+    )
     await app2.send_chat_action(message.chat.id, "cancel")
     await message.reply_text(response)
 
@@ -167,6 +182,8 @@ async def chatbot_talk_ubot_pm(_, message):
         return
     query = message.text
     await app2.send_chat_action(message.chat.id, "typing")
-    response = await lunaQuery(query, message.from_user.id if message.from_user else 0)
+    response = await lunaQuery(
+        query, message.from_user.id if message.from_user else 0
+    )
     await message.reply_text(response)
     await app2.send_chat_action(message.chat.id, "cancel")

+ 6 - 2
wbb/modules/couple.py

@@ -85,7 +85,9 @@ async def couple(_, message):
 {c1_mention} + {c2_mention} = ❤️
 
 __New couple of the day may be chosen at 12AM {tomorrow}__"""
-            await app.send_message(message.chat.id, text=couple_selection_message)
+            await app.send_message(
+                message.chat.id, text=couple_selection_message
+            )
             couple = {"c1_id": c1_id, "c2_id": c2_id}
             await save_couple(chat_id, today, couple)
 
@@ -98,7 +100,9 @@ __New couple of the day may be chosen at 12AM {tomorrow}__"""
 [{c1_name}](tg://openmessage?user_id={c1_id}) + [{c2_name}](tg://openmessage?user_id={c2_id}) = ❤️
 
 __New couple of the day may be chosen at 12AM {tomorrow}__"""
-            await app.send_message(message.chat.id, text=couple_selection_message)
+            await app.send_message(
+                message.chat.id, text=couple_selection_message
+            )
     except Exception as e:
         print(e)
         await message.reply_text(e)

+ 3 - 1
wbb/modules/covid.py

@@ -44,7 +44,9 @@ async def covid(_, message):
     if len(message.command) != 1:
         country = message.text.split(None, 1)[1].strip()
         country = country.replace(" ", "")
-        data = await fetch(f"https://corona.lmao.ninja/v2/countries/{country}")
+        data = await fetch(
+            f"https://corona.lmao.ninja/v2/countries/{country}"
+        )
         data = await json_prettify(data)
         await app.send_message(message.chat.id, text=data)
         return

+ 12 - 6
wbb/modules/devs.py

@@ -50,9 +50,6 @@ async def executor(client, message):
         await message.delete()
         return
     t1 = time()
-    reply_to_id = message.message_id
-    if message.reply_to_message:
-        reply_to_id = message.reply_to_message.message_id
     old_stderr = sys.stderr
     old_stdout = sys.stdout
     redirected_output = sys.stdout = StringIO()
@@ -82,7 +79,13 @@ async def executor(client, message):
             out_file.write(str(evaluation.strip()))
         t2 = time()
         keyboard = InlineKeyboardMarkup(
-            [[InlineKeyboardButton(text="⏳", callback_data=f"runtime {t2-t1} Seconds")]]
+            [
+                [
+                    InlineKeyboardButton(
+                        text="⏳", callback_data=f"runtime {t2-t1} Seconds"
+                    )
+                ]
+            ]
         )
         await message.reply_document(
             document=filename,
@@ -98,7 +101,8 @@ async def executor(client, message):
             [
                 [
                     InlineKeyboardButton(
-                        text="⏳", callback_data=f"runtime {round(t2-t1, 3)} Seconds"
+                        text="⏳",
+                        callback_data=f"runtime {round(t2-t1, 3)} Seconds",
                     )
                 ]
             ]
@@ -158,7 +162,9 @@ async def shellrunner(client, message):
                 value=exc_obj,
                 tb=exc_tb,
             )
-            await edit_or_reply(message, text=f"**ERROR:**\n```{''.join(errors)}```")
+            await edit_or_reply(
+                message, text=f"**ERROR:**\n```{''.join(errors)}```"
+            )
             return
         output = process.stdout.read()[:-1].decode("utf-8")
     if str(output) == "\n":

+ 13 - 4
wbb/modules/filters.py

@@ -44,7 +44,9 @@ __HELP__ = """/filters To Get All The Filters In The Chat.
 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
+)
 @capture_err
 async def save_filters(_, message):
     chat_id = message.chat.id
@@ -54,7 +56,10 @@ async def save_filters(_, message):
             "**Usage:**\nReply to a text or sticker with /filter [FILTER_NAME] to save it."
         )
         return
-    if not message.reply_to_message.text and not message.reply_to_message.sticker:
+    if (
+        not message.reply_to_message.text
+        and not message.reply_to_message.sticker
+    ):
         await message.reply_text(
             "__**You can only save text or stickers in filters.**__"
         )
@@ -78,7 +83,9 @@ async def save_filters(_, message):
     await message.reply_text(f"__**Saved filter {name}.**__")
 
 
-@app.on_message(filters.command("filters") & ~filters.edited & ~filters.private)
+@app.on_message(
+    filters.command("filters") & ~filters.edited & ~filters.private
+)
 @capture_err
 async def get_filterss(_, message):
     _filters = await get_filters_names(message.chat.id)
@@ -140,7 +147,9 @@ async def filters_re(_, message):
                         await message.reply_to_message.reply_text(
                             data, disable_web_page_preview=True
                         )
-                    await message.reply_text(data, disable_web_page_preview=True)
+                    await message.reply_text(
+                        data, disable_web_page_preview=True
+                    )
                 else:
                     if message.reply_to_message:
                         await message.reply_to_message.reply_sticker(data)

+ 5 - 2
wbb/modules/genstr.py

@@ -69,7 +69,9 @@ async def genstr(_, message):
         )
 
     except TimeoutError:
-        await message.reply_text("Time limit reached of 5 min. Process Cancelled.")
+        await message.reply_text(
+            "Time limit reached of 5 min. Process Cancelled."
+        )
         return
     otp_code = otp.text
     try:
@@ -105,7 +107,8 @@ async def genstr(_, message):
         session_string = await temp_client.export_session_string()
         await temp_client.disconnect()
         await app.send_message(
-            chat.id, text=f"**HERE IS YOUR STRING SESSION:**\n```{session_string}```"
+            chat.id,
+            text=f"**HERE IS YOUR STRING SESSION:**\n```{session_string}```",
         )
     except Exception as e:
         await app.send_message(chat.id, f"**ERROR:** `{str(e)}`")

+ 6 - 2
wbb/modules/global_stats.py

@@ -39,11 +39,15 @@ from wbb.utils.inlinefuncs import keywords_list
 """ CHAT WATCHER IS IN filters.py"""
 
 
-@app.on_message(filters.command("gstats") & filters.user(SUDOERS) & ~filters.edited)
+@app.on_message(
+    filters.command("gstats") & filters.user(SUDOERS) & ~filters.edited
+)
 @capture_err
 async def global_stats(_, message):
     m = await app.send_message(
-        message.chat.id, text="__**Analysing Stats**__", disable_web_page_preview=True
+        message.chat.id,
+        text="__**Analysing Stats**__",
+        disable_web_page_preview=True,
     )
 
     # For bot served chat and users count

+ 22 - 7
wbb/modules/greetings.py

@@ -167,13 +167,18 @@ async def welcome(_, message: Message):
         answers_dicc.append(verification_data)
         # keyboard for later use with callback query
         button_message = await message.reply_photo(
-            photo=captcha_image, caption=text, reply_markup=keyboard, quote=True
+            photo=captcha_image,
+            caption=text,
+            reply_markup=keyboard,
+            quote=True,
         )
         os.remove(captcha_image)
         """ Save captcha answers etc in mongodb in case bot gets crashed or restarted. """
         await update_captcha_cache(answers_dicc)
         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)
 
@@ -191,7 +196,9 @@ async def send_welcome_message(callback_query, pending_user_id):
     if "{chat}" in text:
         text = text.replace("{chat}", callback_query.message.chat.title)
     if "{name}" in text:
-        text = text.replace("{name}", (await app.get_users(pending_user_id)).mention)
+        text = text.replace(
+            "{name}", (await app.get_users(pending_user_id)).mention
+        )
     buttons = InlineKeyboard(row_width=2)
     list_of_buttons = []
     for button_string in buttons_text_list:
@@ -201,7 +208,9 @@ async def send_welcome_message(callback_query, pending_user_id):
         button_string = button_string.split(",")
         button_text = button_string[0].strip()
         button_url = button_string[1].strip()
-        list_of_buttons.append(InlineKeyboardButton(text=button_text, url=button_url))
+        list_of_buttons.append(
+            InlineKeyboardButton(text=button_text, url=button_url)
+        )
     buttons.add(*list_of_buttons)
     await app.send_message(
         callback_query.message.chat.id,
@@ -244,7 +253,9 @@ async def callback_query_welcome_button(_, callback_query):
                         answers_dicc.remove(iii)
                         await button_message.chat.kick_member(pending_user_id)
                         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 update_captcha_cache(answers_dicc)
                         return
@@ -279,7 +290,9 @@ async def callback_query_welcome_button(_, callback_query):
         return
 
 
-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
     button message and join message and then kick him
     """
@@ -298,7 +311,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)
 
 
-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:
         member = await group_chat.get_member(user_id)
         if member.status == "restricted":

+ 3 - 1
wbb/modules/images.py

@@ -44,7 +44,9 @@ async def delete_message_with_delay(delay, message):
 @app.on_message(filters.command("cat") & ~filters.edited)
 @capture_err
 async def cat(_, message):
-    with urllib.request.urlopen("https://api.thecatapi.com/v1/images/search") as url:
+    with urllib.request.urlopen(
+        "https://api.thecatapi.com/v1/images/search"
+    ) as url:
         data = json.loads(url.read().decode())
     cat_url = data[0]["url"]
     await message.reply_photo(cat_url)

+ 54 - 18
wbb/modules/inline.py

@@ -39,11 +39,15 @@ async def inline_query_handler(client, query):
         answers = []
         if text.strip() == "":
             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
+            )
             return
         elif text.split()[0] == "alive":
             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":
             if len(text.split()) < 3:
                 await client.answer_inline_query(
@@ -101,7 +105,9 @@ async def inline_query_handler(client, query):
                 return
             tex = text.split(None, 1)[1].strip()
             answerss = await shortify(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] == "wall":
             if len(text.split()) < 2:
@@ -196,7 +202,9 @@ async def inline_query_handler(client, query):
                 return
             tex = text.split(None, 1)[1].strip()
             answerss = await github_user_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] == "gh_repo":
             if len(text.split()) < 2:
@@ -209,7 +217,9 @@ async def inline_query_handler(client, query):
                 return
             tex = text.split(None, 1)[1].strip()
             answerss = await github_repo_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] == "search":
             if len(text.split()) < 2:
@@ -223,7 +233,9 @@ async def inline_query_handler(client, query):
             user_id = query.from_user.id
             tex = text.split(None, 1)[1].strip()
             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":
             if len(text.split()) < 2:
@@ -236,7 +248,9 @@ async def inline_query_handler(client, query):
                 return
             tex = text.split(None, 1)[1].strip()
             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":
             if len(text.split()) < 2:
@@ -249,11 +263,15 @@ async def inline_query_handler(client, query):
                 return
             tex = text.split(None, 1)[1].strip()
             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":
             answerss = await speedtest_init(query)
-            await client.answer_inline_query(query.id, results=answerss, cache_time=2)
+            await client.answer_inline_query(
+                query.id, results=answerss, cache_time=2
+            )
             return
 
         elif text.split()[0] == "paste":
@@ -267,7 +285,9 @@ async def inline_query_handler(client, query):
                 return
             link = text.strip().split()[1]
             answerss = await pastebin_func(answers, link)
-            await client.answer_inline_query(query.id, results=answerss, cache_time=2)
+            await client.answer_inline_query(
+                query.id, results=answerss, cache_time=2
+            )
             return
 
         elif text.split()[0] == "carbon":
@@ -281,19 +301,25 @@ async def inline_query_handler(client, query):
                 return
             link = text.split()[1]
             answerss = await carbon_inline_func(answers, link)
-            await client.answer_inline_query(query.id, results=answerss, cache_time=2)
+            await client.answer_inline_query(
+                query.id, results=answerss, cache_time=2
+            )
             return
 
         elif text.split()[0] == "pmpermit":
             user_id = query.from_user.id
             victim = text.split()[1]
             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
+            )
             return
 
         elif text.split()[0] == "ping":
             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
+            )
             return
 
         elif text.split()[0] == "nsfw_scan":
@@ -307,7 +333,9 @@ async def inline_query_handler(client, query):
                 return
             tex = text.split(None, 1)[1].strip()
             answerss = await nsfw_scan_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] == "ytmusic":
             if len(text.split()) < 2:
@@ -321,7 +349,9 @@ async def inline_query_handler(client, query):
             tex = query.query.split(None, 1)[1].strip()
             user_id = query.from_user.id
             answerss = await yt_music_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] == "info":
             if len(text.split()) < 2:
@@ -334,7 +364,9 @@ async def inline_query_handler(client, query):
                 return
             tex = text.split()[1].strip()
             answerss = await user_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] == "chat_info":
             if len(text.split()) < 2:
@@ -347,7 +379,9 @@ async def inline_query_handler(client, query):
                 return
             tex = text.split()[1].strip()
             answerss = await chat_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":
             if len(text.split()) < 2:
@@ -361,7 +395,9 @@ async def inline_query_handler(client, query):
                 return
             tex = text.split()[1].strip()
             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
+            )
     except Exception as e:
         e = traceback.format_exc()
         print(e, " InLine")

+ 6 - 2
wbb/modules/karma.py

@@ -39,7 +39,9 @@ Reply to a message with /karma to check a user's karma
 Send /karma without replying to any message to chek karma list of top 10 users"""
 
 
-regex_upvote = r"^((?i)\+|\+\+|\+1|thx|tnx|ty|thank you|thanx|thanks|pro|cool|good|👍)$"
+regex_upvote = (
+    r"^((?i)\+|\+\+|\+1|thx|tnx|ty|thank you|thanx|thanks|pro|cool|good|👍)$"
+)
 regex_downvote = r"^(\-|\-\-|\-1|👎)$"
 
 
@@ -137,7 +139,9 @@ async def karma(_, message):
             user_karma = karma[i]["karma"]
             karma_dicc[str(user_id)] = user_karma
             karma_arranged = dict(
-                sorted(karma_dicc.items(), key=lambda item: item[1], reverse=True)
+                sorted(
+                    karma_dicc.items(), key=lambda item: item[1], reverse=True
+                )
             )
         if not karma_arranged:
             await message.reply_text("No karma in DB for this chat.")

+ 10 - 3
wbb/modules/locks.py

@@ -72,9 +72,13 @@ async def tg_lock(message, permissions: list, perm: str, lock: bool):
     (permissions.remove(perm) if lock else permissions.append(perm))
     permissions = {perm: True for perm in list(set(permissions))}
     try:
-        await app.set_chat_permissions(message.chat.id, ChatPermissions(**permissions))
+        await app.set_chat_permissions(
+            message.chat.id, ChatPermissions(**permissions)
+        )
     except ChatNotModified:
-        await message.reply_text("To unlock this, you have to unlock 'messages' first.")
+        await message.reply_text(
+            "To unlock this, you have to unlock 'messages' first."
+        )
         return
     await message.reply_text(("Locked." if lock else "Unlocked."))
 
@@ -96,7 +100,10 @@ async def locks_func(_, message):
             return
 
         permissions = await member_permissions(chat_id, user_id)
-        if "can_restrict_members" not in permissions and user_id not in SUDOERS:
+        if (
+            "can_restrict_members" not in permissions
+            and user_id not in SUDOERS
+        ):
             await message.reply_text("You Don't Have Enough Permissions.")
             return
 

+ 14 - 10
wbb/modules/misc.py

@@ -64,7 +64,9 @@ async def rtfm(_, message):
     if not message.reply_to_message:
         await message.reply_text("Reply To A Message lol")
         return
-    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") & ~filters.edited)
@@ -81,9 +83,7 @@ async def getid(_, message):
         return
     text_unping = "<b>Chat ID:</b>"
     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 = "<b>Message ID:</b>"
     if message.link:
@@ -113,9 +113,7 @@ async def getid(_, message):
             text_unping += "\n"
             text = "<b>Forwarded User ID:</b>"
             if reply.forward_from.username:
-                text = (
-                    f'<a href="https://t.me/{reply.forward_from.username}">{text}</a>'
-                )
+                text = f'<a href="https://t.me/{reply.forward_from.username}">{text}</a>'
             text += f" <code>{reply.forward_from.id}</code>\n"
             text_unping += text
             text_ping += f'\n<b><a href="tg://user?id={reply.forward_from.id}">Forwarded User ID:</a></b> <code>{reply.forward_from.id}</code>\n'
@@ -135,14 +133,18 @@ async def getid(_, message):
 @capture_err
 async def random(_, message):
     if len(message.command) != 2:
-        await message.reply_text('"/random" Needs An Argurment.' " Ex: `/random 5`")
+        await message.reply_text(
+            '"/random" Needs An Argurment.' " Ex: `/random 5`"
+        )
         return
     length = message.text.split(None, 1)[1]
 
     try:
         if 1 < int(length) < 1000:
             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}`")
         else:
             await message.reply_text("Specify A Length Between 1-1000")
@@ -187,7 +189,9 @@ async def decrypt(_, message):
 
 
 async def fetch_text(url):
-    async with aiohttp.ClientSession(headers={"user-agent": "curl"}) as session:
+    async with aiohttp.ClientSession(
+        headers={"user-agent": "curl"}
+    ) as session:
         async with session.get(url) as resp:
             data = await resp.text()
     return data

+ 12 - 4
wbb/modules/music.py

@@ -63,7 +63,9 @@ async def download_youtube_audio(url: str, m=0):
         info_dict = ydl.extract_info(url, download=False)
         if int(float(info_dict["duration"])) > 600:
             if m != 0:
-                await m.edit("This music cannot be downloaded as it's too long.")
+                await m.edit(
+                    "This music cannot be downloaded as it's too long."
+                )
             is_downloading = False
             return
         ydl.process_info(info_dict)
@@ -77,14 +79,18 @@ async def download_youtube_audio(url: str, m=0):
             os.remove(audio_file)
             audio_file = audio_file_opus
         thumbnail_url = info_dict["thumbnail"]
-        thumbnail_file = basename + "." + get_file_extension_from_url(thumbnail_url)
+        thumbnail_file = (
+            basename + "." + get_file_extension_from_url(thumbnail_url)
+        )
         title = info_dict["title"]
         performer = info_dict["uploader"]
         duration = int(float(info_dict["duration"]))
     return [title, performer, duration, audio_file, thumbnail_file]
 
 
-@app.on_message(filters.command("ytmusic") & ~filters.edited & filters.user(SUDOERS))
+@app.on_message(
+    filters.command("ytmusic") & ~filters.edited & filters.user(SUDOERS)
+)
 @capture_err
 async def music(_, message):
     global is_downloading
@@ -98,7 +104,9 @@ async def music(_, message):
         )
         return
     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:
         (
             title,

+ 21 - 6
wbb/modules/notes.py

@@ -44,10 +44,18 @@ async def save_notee(_, message):
             "**Usage:**\nReply to a text or sticker with /save [NOTE_NAME] to save it."
         )
 
-    elif not message.reply_to_message.text and not message.reply_to_message.sticker:
-        await message.reply_text("__**You can only save text or stickers in notes.**__")
+    elif (
+        not message.reply_to_message.text
+        and not message.reply_to_message.sticker
+    ):
+        await message.reply_text(
+            "__**You can only save text or stickers in notes.**__"
+        )
 
-    elif len(await member_permissions(message.chat.id, message.from_user.id)) < 1:
+    elif (
+        len(await member_permissions(message.chat.id, message.from_user.id))
+        < 1
+    ):
         await message.reply_text("**You don't have enough permissions**")
     else:
         name = message.text.split(None, 1)[1].strip()
@@ -95,18 +103,25 @@ async def get_one_note(_, message):
             await message.reply_text("**No such note.**")
         else:
             if _note["type"] == "text":
-                await message.reply_text(_note["data"], disable_web_page_preview=True)
+                await message.reply_text(
+                    _note["data"], disable_web_page_preview=True
+                )
             else:
                 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
+)
 @capture_err
 async def del_note(_, message):
     if len(message.command) < 2:
         await message.reply_text("**Usage**\n__/delete [NOTE_NAME]__")
 
-    elif len(await member_permissions(message.chat.id, message.from_user.id)) < 1:
+    elif (
+        len(await member_permissions(message.chat.id, message.from_user.id))
+        < 1
+    ):
         await message.reply_text("**You don't have enough permissions**")
 
     else:

+ 6 - 2
wbb/modules/paste.py

@@ -58,10 +58,14 @@ async def paste_func(_, message):
 
         elif message.reply_to_message.document:
             if message.reply_to_message.document.file_size > 1048576:
-                await message.reply_text("You can only paste files smaller than 1MB.")
+                await message.reply_text(
+                    "You can only paste files smaller than 1MB."
+                )
                 return
             m = await message.reply_text("Pasting...")
-            doc_file = await message.reply_to_message.download(file_name="paste.txt")
+            doc_file = await message.reply_to_message.download(
+                file_name="paste.txt"
+            )
             i = open(doc_file, "r")
             link = await paste(i.read())
             preview = link + "/preview.png"

+ 9 - 2
wbb/modules/pipes.py

@@ -95,9 +95,16 @@ async def pipes_worker_userbot(_, message: Message):
                     app.listen(USERBOT_ID), message.copy(BOT_ID)
                 )
                 caption = f"Forwarded from `{pipe['from_chat_id']}`"
-                caption = f"{temp.caption}\n\n{caption}" if temp.caption else caption
+                caption = (
+                    f"{temp.caption}\n\n{caption}"
+                    if temp.caption
+                    else caption
+                )
                 await app.copy_message(
-                    pipe["to_chat_id"], USERBOT_ID, m.message_id, caption=caption
+                    pipe["to_chat_id"],
+                    USERBOT_ID,
+                    m.message_id,
+                    caption=caption,
                 )
                 await asyncio.sleep(10)
                 await temp.delete()

+ 14 - 5
wbb/modules/pmpermit.py

@@ -70,7 +70,9 @@ async def pmpermit_func(_, message):
 @capture_err
 async def pm_approve(_, message):
     if not message.reply_to_message:
-        await edit_or_reply(message, text="Reply to a user's message to approve.")
+        await edit_or_reply(
+            message, text="Reply to a user's message to approve."
+        )
         return
     user_id = message.reply_to_message.from_user.id
     if await is_pmpermit_approved(user_id):
@@ -87,7 +89,9 @@ async def pm_approve(_, message):
 )
 async def pm_disapprove(_, message):
     if not message.reply_to_message:
-        await edit_or_reply(message, text="Reply to a user's message to approve.")
+        await edit_or_reply(
+            message, text="Reply to a user's message to approve."
+        )
         return
     user_id = message.reply_to_message.from_user.id
     if not await is_pmpermit_approved(user_id):
@@ -111,7 +115,9 @@ async def pm_disapprove(_, message):
 @capture_err
 async def block_user_func(_, message):
     if not message.reply_to_message:
-        await edit_or_reply(message, text="Reply to a user's message to block.")
+        await edit_or_reply(
+            message, text="Reply to a user's message to block."
+        )
         return
     user_id = message.reply_to_message.from_user.id
     await app2.block_user(user_id)
@@ -125,7 +131,9 @@ async def block_user_func(_, message):
 )
 async def unblock_user_func(_, message):
     if not message.reply_to_message:
-        await edit_or_reply(message, text="Reply to a user's message to unblock.")
+        await edit_or_reply(
+            message, text="Reply to a user's message to unblock."
+        )
         return
     user_id = message.reply_to_message.from_user.id
     await app2.unblock_user(user_id)
@@ -171,5 +179,6 @@ async def pmpermit_cq(_, cq):
             await app2.block_user(user_id)
             return
         await app2.send_message(
-            user_id, "I'm busy right now, will approve you shortly, DO NOT SPAM."
+            user_id,
+            "I'm busy right now, will approve you shortly, DO NOT SPAM.",
         )

+ 11 - 4
wbb/modules/quotly.py

@@ -3,7 +3,7 @@ from io import BytesIO
 from pyrogram import filters
 from pyrogram.types import Message
 
-from wbb import app, app2, arq
+from wbb import app, arq
 from wbb.core.decorators.errors import capture_err
 
 __MODULE__ = "Quotly"
@@ -38,12 +38,15 @@ def isArgInt(message: Message) -> bool:
 
 
 @app.on_message(filters.command("q"))
+@capture_err
 async def quotly_func(_, message: Message):
     if not message.reply_to_message:
         await message.reply_text("Reply to a message to quote it.")
         return
     if not message.reply_to_message.text:
-        await message.reply_text("Replied message has no text, can't quote it.")
+        await message.reply_text(
+            "Replied message has no text, can't quote it."
+        )
         return
     m = await message.reply_text("Quoting Messages")
     if len(message.command) < 2:
@@ -74,12 +77,16 @@ async def quotly_func(_, message: Message):
                 )
                 return
             reply_message = await app.get_messages(
-                message.chat.id, message.reply_to_message.message_id, replies=1
+                message.chat.id,
+                message.reply_to_message.message_id,
+                replies=1,
             )
             reply_message = reply_message.reply_to_message
             messages = [reply_message, message.reply_to_message]
     else:
-        await m.edit("Incorrect argument, check quotly module in help section.")
+        await m.edit(
+            "Incorrect argument, check quotly module in help section."
+        )
         return
     try:
         sticker = await quotify(messages)

+ 5 - 2
wbb/modules/regex.py

@@ -37,7 +37,8 @@ DELIMITERS = ("/", ":", "|", "_")
 
 
 @app.on_message(
-    filters.regex(r"s([{}]).*?\1.*".format("".join(DELIMITERS))), group=regex_group
+    filters.regex(r"s([{}]).*?\1.*".format("".join(DELIMITERS))),
+    group=regex_group,
 )
 async def sed(_, message):
     if not message.text:
@@ -70,7 +71,9 @@ async def sed(_, message):
             if "i" in flags and "g" in flags:
                 text = re.sub(repl, repl_with, to_fix, flags=re.I).strip()
             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:
                 text = re.sub(repl, repl_with, to_fix).strip()
             else:

+ 9 - 3
wbb/modules/repo.py

@@ -28,7 +28,9 @@ from wbb.core.decorators.errors import capture_err
 from wbb.utils.fetch import fetch
 
 __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)
@@ -40,7 +42,9 @@ async def repo(_, message):
     list_of_users = ""
     count = 1
     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
 
     text = f"""[Github](https://github.com/thehamkercat/WilliamButcherBot) | [Group](t.me/PatheticProgrammers)
@@ -48,4 +52,6 @@ async def repo(_, message):
 | Contributors |
 ----------------```
 {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
+    )

+ 10 - 3
wbb/modules/reverse.py

@@ -59,7 +59,9 @@ async def reverse_image_search(_, message):
 
     if reply.animation:
         if not reply.animation.thumbs:
-            await m.edit("Gif Has No Thumbnail, so it cannot be reverse searched")
+            await m.edit(
+                "Gif Has No Thumbnail, so it cannot be reverse searched"
+            )
             return
         file_id = reply.animation.thumbs[0].file_id
 
@@ -71,8 +73,13 @@ async def reverse_image_search(_, message):
     async with aiofiles.open(image, "rb") as f:
         if image:
             search_url = "http://www.google.com/searchbyimage/upload"
-            multipart = {"encoded_image": (image, await f.read()), "image_content": ""}
-            response = requests.post(search_url, files=multipart, allow_redirects=False)
+            multipart = {
+                "encoded_image": (image, await f.read()),
+                "image_content": "",
+            }
+            response = requests.post(
+                search_url, files=multipart, allow_redirects=False
+            )
             location = response.headers.get("Location")
             os.remove(image)
         else:

+ 9 - 3
wbb/modules/rice.py

@@ -50,7 +50,9 @@ async def rice(_, message: Message):
         reply_markup=InlineKeyboardMarkup(
             [
                 [
-                    InlineKeyboardButton("Approve (Forward)", callback_data="forward"),
+                    InlineKeyboardButton(
+                        "Approve (Forward)", callback_data="forward"
+                    ),
                     InlineKeyboardButton("Ignore", callback_data="ignore"),
                 ]
             ]
@@ -79,11 +81,15 @@ async def callback_query_forward_rice(_, callback_query):
         arg_media = []
         for m in media_group:
             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:
                 arg_media.append(InputMediaPhoto(m.photo.file_id))
             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:
                 arg_media.append(InputMediaVideo(m.video.file_id))
         m_cp = await app.send_media_group(RICE_CHANNEL, arg_media)

+ 7 - 2
wbb/modules/stickers.py

@@ -73,7 +73,10 @@ async def kang(client, message):
     args = message.text.split()
     if len(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
     else:
         sticker_emoji = "🤔"
@@ -82,7 +85,9 @@ async def kang(client, message):
     doc = message.reply_to_message.photo or message.reply_to_message.document
     if message.reply_to_message.sticker:
         sticker = await create_sticker(
-            await get_document_from_file_id(message.reply_to_message.sticker.file_id),
+            await get_document_from_file_id(
+                message.reply_to_message.sticker.file_id
+            ),
             sticker_emoji,
         )
     elif doc:

+ 11 - 5
wbb/modules/sudo.py

@@ -48,7 +48,8 @@ can even delete your account.
 
 
 @app2.on_message(
-    filters.command("useradd", prefixes=USERBOT_PREFIX) & filters.user(SUDOERS)
+    filters.command("useradd", prefixes=USERBOT_PREFIX)
+    & filters.user(SUDOERS)
 )
 @capture_err
 async def useradd(_, message: Message):
@@ -63,7 +64,9 @@ async def useradd(_, message: Message):
         await edit_or_reply(message, text="User is already in sudoers.")
         return
     if user_id == BOT_ID:
-        await edit_or_reply(message, text="You can't add assistant bot in sudoers.")
+        await edit_or_reply(
+            message, text="You can't add assistant bot in sudoers."
+        )
         return
     added = await add_sudo(user_id)
     if added:
@@ -77,13 +80,15 @@ async def useradd(_, message: Message):
 
 
 @app2.on_message(
-    filters.command("userdel", prefixes=USERBOT_PREFIX) & filters.user(SUDOERS)
+    filters.command("userdel", prefixes=USERBOT_PREFIX)
+    & filters.user(SUDOERS)
 )
 @capture_err
 async def userdel(_, message: Message):
     if not message.reply_to_message:
         await edit_or_reply(
-            message, text="Reply to someone's message to remove him to sudoers."
+            message,
+            text="Reply to someone's message to remove him to sudoers.",
         )
         return
     user_id = message.reply_to_message.from_user.id
@@ -102,7 +107,8 @@ async def userdel(_, message: Message):
 
 
 @app2.on_message(
-    filters.command("sudoers", prefixes=USERBOT_PREFIX) & filters.user(SUDOERS)
+    filters.command("sudoers", prefixes=USERBOT_PREFIX)
+    & filters.user(SUDOERS)
 )
 @capture_err
 async def sudoers_list(_, message: Message):

+ 30 - 10
wbb/modules/sudoers.py

@@ -81,7 +81,9 @@ async def get_stats(_, message):
 async def ban_globally(_, message):
     if not message.reply_to_message:
         if len(message.command) < 3:
-            await message.reply_text("**Usage:**\n/gban [USERNAME | USER_ID] [REASON]")
+            await message.reply_text(
+                "**Usage:**\n/gban [USERNAME | USER_ID] [REASON]"
+            )
             return
         user = message.text.split(None, 2)[1]
         reason = message.text.split(None, 2)[2]
@@ -96,7 +98,9 @@ async def ban_globally(_, message):
                 "Should i gban myself? I'm not fool like you, HUMAN!"
             )
         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:
             served_chats = await get_served_chats()
             m = await message.reply_text(
@@ -107,7 +111,9 @@ async def ban_globally(_, message):
             number_of_chats = 0
             for served_chat in served_chats:
                 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
                     await asyncio.sleep(1)
                 except Exception:
@@ -131,7 +137,9 @@ __**New Global Ban**__
 **Chats:** `{number_of_chats}`"""
             try:
                 m2 = await app.send_message(
-                    GBAN_LOG_GROUP_ID, text=ban_text, disable_web_page_preview=True
+                    GBAN_LOG_GROUP_ID,
+                    text=ban_text,
+                    disable_web_page_preview=True,
                 )
                 await m.edit(
                     f"Banned {user.mention} Globally!\nAction Log: {m2.link}",
@@ -154,7 +162,9 @@ __**New Global Ban**__
     if user_id == from_user_id:
         await message.reply_text("You want to gban yourself? FOOL!")
     elif user_id == BOT_ID:
-        await message.reply_text("Should i gban myself? I'm not fool like you, HUMAN!")
+        await message.reply_text(
+            "Should i gban myself? I'm not fool like you, HUMAN!"
+        )
     elif user_id in SUDOERS:
         await message.reply_text("You want to ban a sudo user? GET REKT!!")
     else:
@@ -170,7 +180,9 @@ __**New Global Ban**__
             number_of_chats = 0
             for served_chat in served_chats:
                 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
                     await asyncio.sleep(1)
                 except Exception:
@@ -196,7 +208,9 @@ __**New Global Ban**__
 **Chats:** `{number_of_chats}`"""
             try:
                 m2 = await app.send_message(
-                    GBAN_LOG_GROUP_ID, text=ban_text, disable_web_page_preview=True
+                    GBAN_LOG_GROUP_ID,
+                    text=ban_text,
+                    disable_web_page_preview=True,
                 )
                 await m.edit(
                     f"Banned {mention} Globally!\nAction Log: {m2.link}",
@@ -229,7 +243,9 @@ async def unban_globally(_, message):
         if user.id == from_user.id:
             await message.reply_text("You want to ungban yourself? FOOL!")
         elif user.id == BOT_ID:
-            await message.reply_text("Should i ungban myself? But i'm not gbanned.")
+            await message.reply_text(
+                "Should i ungban myself? But i'm not gbanned."
+            )
         elif user.id in SUDOERS:
             await message.reply_text("Sudo users can't be gbanned/ungbanned.")
         else:
@@ -247,7 +263,9 @@ async def unban_globally(_, message):
     if user_id == from_user_id:
         await message.reply_text("You want to ungban yourself? FOOL!")
     elif user_id == BOT_ID:
-        await message.reply_text("Should i ungban myself? But i'm not gbanned.")
+        await message.reply_text(
+            "Should i ungban myself? But i'm not gbanned."
+        )
     elif user_id in SUDOERS:
         await message.reply_text("Sudo users can't be gbanned/ungbanned.")
     else:
@@ -262,7 +280,9 @@ async def unban_globally(_, message):
 # Broadcast
 
 
-@app.on_message(filters.command("broadcast") & filters.user(SUDOERS) & ~filters.edited)
+@app.on_message(
+    filters.command("broadcast") & filters.user(SUDOERS) & ~filters.edited
+)
 @capture_err
 async def broadcast_message(_, message):
     if len(message.command) < 2:

+ 3 - 1
wbb/modules/telegraph.py

@@ -31,7 +31,9 @@ async def tgphoto(client, message):
     msg = await message.reply_text("`Uploading to Telegraph...`")
     userid = str(message.chat.id)
     path = f"./DOWNLOADS/{userid}.jpg"
-    path = await client.download_media(message=message.reply_to_message, file_name=path)
+    path = await client.download_media(
+        message=message.reply_to_message, file_name=path
+    )
     try:
         tlink = upload_file(path)
     except Exception:

+ 9 - 7
wbb/modules/userbot.py

@@ -57,9 +57,6 @@ async def executor(client, message):
     except IndexError:
         await message.delete()
         return
-    reply_to_id = message.message_id
-    if message.reply_to_message:
-        reply_to_id = message.reply_to_message.message_id
     old_stderr = sys.stderr
     old_stdout = sys.stdout
     redirected_output = sys.stdout = StringIO()
@@ -82,7 +79,9 @@ async def executor(client, message):
         evaluation = stdout
     else:
         evaluation = "Success"
-    final_output = f"**INPUT:**\n```{cmd}```\n\n**OUTPUT**:\n```{evaluation.strip()}```"
+    final_output = (
+        f"**INPUT:**\n```{cmd}```\n\n**OUTPUT**:\n```{evaluation.strip()}```"
+    )
     if len(final_output) > 4096:
         filename = "output.txt"
         with open(filename, "w+", encoding="utf8") as out_file:
@@ -123,7 +122,8 @@ async def shellrunner(client, message):
             except Exception as err:
                 print(err)
                 await edit_or_reply(
-                    message, text=f"**INPUT:**\n```{text}```\n\n**ERROR:**\n```{err}```"
+                    message,
+                    text=f"**INPUT:**\n```{text}```\n\n**ERROR:**\n```{err}```",
                 )
             output += f"**{code}**\n"
             output += process.stdout.read()[:-1].decode("utf-8")
@@ -167,9 +167,11 @@ async def shellrunner(client, message):
             os.remove("output.txt")
             return
         await edit_or_reply(
-            message, text=f"**INPUT:**\n```{text}```\n\n**OUTPUT:**\n```{output}```"
+            message,
+            text=f"**INPUT:**\n```{text}```\n\n**OUTPUT:**\n```{output}```",
         )
     else:
         await edit_or_reply(
-            message, text=f"**INPUT:**\n```{text}```\n\n**OUTPUT: **\n`No output`"
+            message,
+            text=f"**INPUT:**\n```{text}```\n\n**OUTPUT: **\n`No output`",
         )

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

@@ -30,7 +30,9 @@ class DownloadJob:
 
         self.file_name = file_url.split("/")[~0]
         self.file_path = (
-            os.path.join(save_path, self.file_name) if save_path else self.file_name
+            os.path.join(save_path, self.file_name)
+            if save_path
+            else self.file_name
         )
 
         self.completed = False
@@ -75,7 +77,9 @@ class DownloadJob:
                 async with aiofiles.open(self.file_path, "wb") as file:
 
                     # Downloading the file using the aiohttp.StreamReader
-                    async for data in resp.content.iter_chunked(self._chunk_size):
+                    async for data in resp.content.iter_chunked(
+                        self._chunk_size
+                    ):
                         await file.write(data)
                         self._downloaded(self._chunk_size)
 
@@ -119,9 +123,13 @@ class Handler:
         :param save_path: save path for the download
         :return:
         """
-        return DownloadJob(self._session, file_url, save_path, self._chunk_size)
+        return DownloadJob(
+            self._session, file_url, save_path, self._chunk_size
+        )
 
-    async def download(self, url: str, save_path: Optional[str] = None) -> DownloadJob:
+    async def download(
+        self, url: str, save_path: Optional[str] = None
+    ) -> DownloadJob:
         """
         Downloads a bulk of files from the given list of urls to the given path.
 

+ 16 - 4
wbb/utils/dbfunctions.py

@@ -582,7 +582,11 @@ async def delete_blacklist_filter(chat_id: int, word: str) -> bool:
 
 async def activate_pipe(from_chat_id: int, to_chat_id: int, fetcher: str):
     pipes = await show_pipes()
-    pipe = {"from_chat_id": from_chat_id, "to_chat_id": to_chat_id, "fetcher": fetcher}
+    pipe = {
+        "from_chat_id": from_chat_id,
+        "to_chat_id": to_chat_id,
+        "fetcher": fetcher,
+    }
     pipes.append(pipe)
     return await pipesdb.update_one(
         {"pipe": "pipe"}, {"$set": {"pipes": pipes}}, upsert=True
@@ -594,7 +598,10 @@ async def deactivate_pipe(from_chat_id: int, to_chat_id: int):
     if not pipes:
         return
     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)
     return await pipesdb.update_one(
         {"pipe": "pipe"}, {"$set": {"pipes": pipes}}, upsert=True
@@ -603,7 +610,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:
     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
 
 
@@ -647,7 +657,9 @@ async def remove_sudo(user_id: int) -> bool:
 
 async def blacklisted_chats() -> list:
     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:

+ 2 - 1
wbb/utils/files.py

@@ -65,7 +65,8 @@ async def upload_document(
         raw.functions.messages.UploadMedia(
             peer=await client.resolve_peer(chat_id),
             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),
                 attributes=[
                     raw.types.DocumentAttributeFilename(

+ 59 - 19
wbb/utils/inlinefuncs.py

@@ -118,7 +118,9 @@ async def alive_function(answers):
     ubot_state = "Dead" if not await app2.get_me() else "Alive"
     buttons.add(
         InlineKeyboardButton("Stats", callback_data="stats_callback"),
-        InlineKeyboardButton("Go Inline!", switch_inline_query_current_chat=""),
+        InlineKeyboardButton(
+            "Go Inline!", switch_inline_query_current_chat=""
+        ),
     )
 
     msg = f"""
@@ -163,7 +165,8 @@ __**Translated from {i.src} to {lang}**__
                 input_message_content=InputTextMessageContent(msg),
             ),
             InlineQueryResultArticle(
-                title=i.text, input_message_content=InputTextMessageContent(i.text)
+                title=i.text,
+                input_message_content=InputTextMessageContent(i.text),
             ),
         ]
     )
@@ -339,7 +342,9 @@ async def shortify(url):
     payload = json.dumps(payload)
     async with aiohttp.ClientSession() as session:
         async with session.post(
-            "https://api-ssl.bitly.com/v4/shorten", headers=header, data=payload
+            "https://api-ssl.bitly.com/v4/shorten",
+            headers=header,
+            data=payload,
         ) as resp:
             data = await resp.json()
     msg = data["link"]
@@ -419,7 +424,9 @@ async def youtube_func(answers, text):
 **Duration:** {i.duration}
 **Uploaded:** {i.publish_time}
 **Description:** {i.long_desc}"""
-        description = f"{i.views} | {i.channel} | " + f"{i.duration} | {i.publish_time}"
+        description = (
+            f"{i.views} | {i.channel} | " + f"{i.duration} | {i.publish_time}"
+        )
         answers.append(
             InlineQueryResultArticle(
                 title=i.title,
@@ -470,7 +477,9 @@ async def github_user_func(answers, text):
     result = await fetch(URL)
     buttons = InlineKeyboard(row_width=1)
     buttons.add(
-        InlineKeyboardButton(text="Open On Github", url=f"https://github.com/{text}")
+        InlineKeyboardButton(
+            text="Open On Github", url=f"https://github.com/{text}"
+        )
     )
     caption = f"""
 **Info Of {result['name']}**
@@ -486,7 +495,9 @@ async def github_user_func(answers, text):
 **Following:** `{result['following']}`"""
     answers.append(
         InlineQueryResultPhoto(
-            photo_url=result["avatar_url"], caption=caption, reply_markup=buttons
+            photo_url=result["avatar_url"],
+            caption=caption,
+            reply_markup=buttons,
         )
     )
     return answers
@@ -507,7 +518,9 @@ async def github_repo_func(answers, text):
         commits += developer["contributions"]
     buttons = InlineKeyboard(row_width=1)
     buttons.add(
-        InlineKeyboardButton("Open On Github", url=f"https://github.com/{text}")
+        InlineKeyboardButton(
+            "Open On Github", url=f"https://github.com/{text}"
+        )
     )
     caption = f"""
 **Info Of {r['full_name']}**
@@ -571,7 +584,9 @@ async def tg_search_func(answers, text, user_id):
             ),
         )
         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"""
 **Query:** {text}
@@ -625,7 +640,9 @@ async def music_inline_func(answers, query):
                 "duration": f_.audio.duration if f_.audio.duration else 0,
             }
         )
-    messages = list({v["duration"]: v for v in messages_ids_and_duration}.values())
+    messages = list(
+        {v["duration"]: v for v in messages_ids_and_duration}.values()
+    )
     messages_ids = []
     for ff_ in messages:
         messages_ids.append(ff_["message_id"])
@@ -682,7 +699,9 @@ async def speedtest_init(query):
         return answers
     msg = "**Click The Button Below To Perform A Speedtest**"
     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(
         InlineQueryResultArticle(
             title="Click Here",
@@ -732,7 +751,9 @@ async def pastebin_func(answers, link):
                 InlineQueryResultArticle(
                     title="DOCUMENT TOO BIG",
                     description="Maximum supported size is 1MB",
-                    input_message_content=InputTextMessageContent("DOCUMENT TOO BIG"),
+                    input_message_content=InputTextMessageContent(
+                        "DOCUMENT TOO BIG"
+                    ),
                 )
             )
             return answers
@@ -753,7 +774,9 @@ async def pastebin_func(answers, link):
     await app.send_photo(MESSAGE_DUMP_CHAT, preview)  # To Pre-cache the media
     buttons = InlineKeyboard(row_width=1)
     buttons.add(InlineKeyboardButton(text="Paste Link", url=link))
-    answers.append(InlineQueryResultPhoto(photo_url=preview, reply_markup=buttons))
+    answers.append(
+        InlineQueryResultPhoto(photo_url=preview, reply_markup=buttons)
+    )
     return answers
 
 
@@ -769,7 +792,9 @@ async def pmpermit_func(answers, user_id, victim):
         InlineKeyboardButton(
             text="For promotion", 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(
             text="Approve", callback_data=f"pmpermit approve {victim}"
         ),
@@ -792,7 +817,8 @@ async def ping_func(answers):
     ping = f"{str(round((t2 - t1), 6) * 100)} ms"
     answers.append(
         InlineQueryResultArticle(
-            title=ping, input_message_content=InputTextMessageContent(f"__**{ping}**__")
+            title=ping,
+            input_message_content=InputTextMessageContent(f"__**{ping}**__"),
         )
     )
     return answers
@@ -846,7 +872,13 @@ async def yt_music_func(answers, url, user_id):
     if "http" not in url:
         url = (await arq.youtube(url)).result[0]
         url = f"https://youtube.com{url.url_suffix}"
-    title, performer, duration, audio, thumbnail = await download_youtube_audio(url)
+    (
+        title,
+        performer,
+        duration,
+        audio,
+        thumbnail,
+    ) = await download_youtube_audio(url)
     m = await app.send_audio(
         MESSAGE_DUMP_CHAT,
         audio,
@@ -880,7 +912,9 @@ async def carbon_inline_func(answers, link):
                 InlineQueryResultArticle(
                     title="DOCUMENT TOO BIG",
                     description="Maximum supported size is 1MB",
-                    input_message_content=InputTextMessageContent("DOCUMENT TOO BIG"),
+                    input_message_content=InputTextMessageContent(
+                        "DOCUMENT TOO BIG"
+                    ),
                 )
             )
             return answers
@@ -897,7 +931,9 @@ async def carbon_inline_func(answers, link):
     buttons.add(InlineKeyboardButton(text="Paste Link", url=link))
     answers.append(
         InlineQueryResultCachedDocument(
-            file_id=carbon.document.file_id, title="Carbon", reply_markup=buttons
+            file_id=carbon.document.file_id,
+            title="Carbon",
+            reply_markup=buttons,
         )
     )
     return answers
@@ -936,7 +972,9 @@ async def tmdb_func(answers, query):
             InlineQueryResultArticle(
                 title="Error",
                 description=response.result,
-                input_message_content=InputTextMessageContent(response.result),
+                input_message_content=InputTextMessageContent(
+                    response.result
+                ),
             )
         )
         return answers
@@ -965,7 +1003,9 @@ async def tmdb_func(answers, query):
         )
         answers.append(
             InlineQueryResultPhoto(
-                photo_url=result.backdrop if result.backdrop else result.poster,
+                photo_url=result.backdrop
+                if result.backdrop
+                else result.poster,
                 caption=caption,
                 title=result.title,
                 description=f"{genre} • {result.releaseDate} • {result.rating} • {description}",

+ 6 - 1
wbb/utils/json_prettify.py

@@ -27,7 +27,12 @@ async def json_object_prettify(objecc):
     dicc = objecc.__dict__
     output = ""
     for key, value in dicc.items():
-        if key == "pinned_message" or key == "photo" or key == "_" or key == "_client":
+        if (
+            key == "pinned_message"
+            or key == "photo"
+            or key == "_"
+            or key == "_client"
+        ):
             continue
         output += f"**{key}:** `{value}`\n"
     return output

+ 3 - 1
wbb/utils/misc.py

@@ -45,7 +45,9 @@ def paginate_modules(page_n, module_dict, prefix, chat=None):
             [
                 EqInlineKeyboardButton(
                     x.__MODULE__,
-                    callback_data="{}_module({})".format(prefix, x.__MODULE__.lower()),
+                    callback_data="{}_module({})".format(
+                        prefix, x.__MODULE__.lower()
+                    ),
                 )
                 for x in module_dict.values()
             ]