Browse Source

Decreased line lenght to 79

TheHamkerCat 5 years ago
parent
commit
2e49f9d0da

+ 3 - 1
sample_config.py

@@ -8,7 +8,9 @@ if HEROKU:
     API_HASH = environ.get("API_HASH", "eb06d4abfb49dc3eeb1aeb98ae0f581e")
     API_HASH = environ.get("API_HASH", "eb06d4abfb49dc3eeb1aeb98ae0f581e")
     SESSION_STRING = environ.get("SESSION_STRING", None)
     SESSION_STRING = environ.get("SESSION_STRING", None)
     USERBOT_PREFIX = environ.get("USERBOT_PREFIX", 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))
     LOG_GROUP_ID = int(environ.get("LOG_GROUP_ID", None))
     GBAN_LOG_GROUP_ID = int(environ.get("GBAN_LOG_GROUP_ID", None))
     GBAN_LOG_GROUP_ID = int(environ.get("GBAN_LOG_GROUP_ID", None))
     MESSAGE_DUMP_CHAT = int(environ.get("MESSAGE_DUMP_CHAT", None))
     MESSAGE_DUMP_CHAT = int(environ.get("MESSAGE_DUMP_CHAT", None))

+ 20 - 6
wbb/__main__.py

@@ -43,9 +43,15 @@ async def start_bot():
     global COMMANDS_COUNT
     global COMMANDS_COUNT
     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[imported_module.__MODULE__.lower()] = imported_module
                 HELPABLE[imported_module.__MODULE__.lower()] = imported_module
     bot_modules = ""
     bot_modules = ""
     j = 1
     j = 1
@@ -85,7 +91,9 @@ async def help_command(_, message):
                     InlineKeyboardButton(
                     InlineKeyboardButton(
                         text="System Stats 💻", callback_data="stats_callback"
                         text="System Stats 💻", callback_data="stats_callback"
                     ),
                     ),
-                    InlineKeyboardButton(text="Support 👨", url="t.me/WBBSupport"),
+                    InlineKeyboardButton(
+                        text="Support 👨", url="t.me/WBBSupport"
+                    ),
                 ],
                 ],
             ]
             ]
         )
         )
@@ -94,7 +102,9 @@ async def help_command(_, message):
     keyboard = InlineKeyboardMarkup(
     keyboard = 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",
@@ -175,7 +185,9 @@ General command are:
     if mod_match:
     if mod_match:
         module = mod_match.group(1)
         module = mod_match.group(1)
         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__
         )
         )
 
 
@@ -210,7 +222,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,
         )
         )
 
 

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

@@ -97,7 +97,10 @@ class InlineQueryResultAudio(InlineQueryResult):
 
 
     async def write(self, client: "pyrogram.Client"):
     async def write(self, client: "pyrogram.Client"):
         audio = raw.types.InputWebDocument(
         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(
         thumb = raw.types.InputWebDocument(
@@ -128,7 +131,9 @@ class InlineQueryResultAudio(InlineQueryResult):
             thumb=thumb,
             thumb=thumb,
             content=audio,
             content=audio,
             send_message=(
             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
                 if self.input_message_content
                 else raw.types.InputBotInlineMessageMediaAuto(
                 else raw.types.InputBotInlineMessageMediaAuto(
                     reply_markup=await self.reply_markup.write(client)
                     reply_markup=await self.reply_markup.write(client)
@@ -228,7 +233,9 @@ class InlineQueryResultCachedDocument(InlineQueryResult):
             description=self.description,
             description=self.description,
             document=document,
             document=document,
             send_message=(
             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
                 if self.input_message_content
                 else raw.types.InputBotInlineMessageMediaAuto(
                 else raw.types.InputBotInlineMessageMediaAuto(
                     reply_markup=await self.reply_markup.write(client)
                     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):
     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:
     if file_type in PHOTO_TYPES:
         return raw.types.InputPhoto(
         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):
 async def list_admins(chat_id: int):
     list_of_admins = []
     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)
         list_of_admins.append(member.user.id)
     return list_of_admins
     return list_of_admins
 
 
@@ -139,7 +141,9 @@ async def purge(client, message):
                     message_ids.append(a_s_message_id)
                     message_ids.append(a_s_message_id)
                     if len(message_ids) == 100:
                     if len(message_ids) == 100:
                         await client.delete_messages(
                         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 = []
                         message_ids = []
                 if len(message_ids) > 0:
                 if len(message_ids) > 0:
@@ -148,7 +152,8 @@ async def purge(client, message):
                     )
                     )
             else:
             else:
                 await message.reply_text(
                 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:
         else:
             await message.reply_text("Your Don't Have Enough Permissions!")
             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
         from_user_id = message.from_user.id
         chat_id = message.chat.id
         chat_id = message.chat.id
         permissions = await member_permissions(chat_id, from_user_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.")
             await message.reply_text("You don't have enough permissions.")
             return
             return
         if len(message.command) == 2:
         if len(message.command) == 2:
@@ -202,7 +210,10 @@ async def ban(_, message):
         from_user_id = message.from_user.id
         from_user_id = message.from_user.id
         chat_id = message.chat.id
         chat_id = message.chat.id
         permissions = await member_permissions(chat_id, from_user_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.")
             await message.reply_text("You don't have enough permissions.")
             return
             return
         if len(message.command) == 2:
         if len(message.command) == 2:
@@ -233,7 +244,10 @@ async def unban(_, message):
         from_user_id = message.from_user.id
         from_user_id = message.from_user.id
         chat_id = message.chat.id
         chat_id = message.chat.id
         permissions = await member_permissions(chat_id, from_user_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.")
             await message.reply_text("You don't have enough permissions.")
             return
             return
         if len(message.command) == 2:
         if len(message.command) == 2:
@@ -264,9 +278,13 @@ async def delete(_, message):
         from_user_id = message.from_user.id
         from_user_id = message.from_user.id
         chat_id = message.chat.id
         chat_id = message.chat.id
         permissions = await member_permissions(chat_id, from_user_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(
             await message.reply_text(
-                "You Don't Have Enough Permissions," + " Consider Deleting Yourself!"
+                "You Don't Have Enough Permissions,"
+                + " Consider Deleting Yourself!"
             )
             )
             return
             return
         await message.reply_to_message.delete()
         await message.reply_to_message.delete()
@@ -285,7 +303,10 @@ async def promote(_, message):
         from_user_id = message.from_user.id
         from_user_id = message.from_user.id
         chat_id = message.chat.id
         chat_id = message.chat.id
         permissions = await member_permissions(chat_id, from_user_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")
             await message.reply_text("You don't have enough permissions")
             return
             return
         bot = await app.get_chat_member(chat_id, BOT_ID)
         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
         from_user_id = message.from_user.id
         chat_id = message.chat.id
         chat_id = message.chat.id
         permissions = await member_permissions(chat_id, from_user_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.")
             await message.reply_text("You don't have enough permissions.")
             return
             return
         if len(message.command) == 2:
         if len(message.command) == 2:
@@ -363,7 +387,9 @@ async def mute(_, message):
         if user_id in SUDOERS:
         if user_id in SUDOERS:
             await message.reply_text("You Wanna Mute The Elevated One?")
             await message.reply_text("You Wanna Mute The Elevated One?")
             return
             return
-        await message.chat.restrict_member(user_id, permissions=ChatPermissions())
+        await message.chat.restrict_member(
+            user_id, permissions=ChatPermissions()
+        )
         await message.reply_text("Muted!")
         await message.reply_text("Muted!")
     except Exception as e:
     except Exception as e:
         await message.reply_text(str(e))
         await message.reply_text(str(e))
@@ -379,7 +405,10 @@ async def unmute(_, message):
         from_user_id = message.from_user.id
         from_user_id = message.from_user.id
         chat_id = message.chat.id
         chat_id = message.chat.id
         permissions = await member_permissions(chat_id, from_user_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.")
             await message.reply_text("You don't have enough permissions.")
             return
             return
         if len(message.command) == 2:
         if len(message.command) == 2:
@@ -420,7 +449,9 @@ async def ban_deleted_accounts(_, message):
                         print(str(e))
                         print(str(e))
                         pass
                         pass
                     banned_users += 1
                     banned_users += 1
-                await message.reply_text(f"Banned {banned_users} Deleted Accounts")
+                await message.reply_text(
+                    f"Banned {banned_users} Deleted Accounts"
+                )
             else:
             else:
                 await message.reply_text("No Deleted Accounts In This Chat")
                 await message.reply_text("No Deleted Accounts In This Chat")
                 return
                 return
@@ -454,12 +485,16 @@ async def warn_user(_, message):
                 await message.reply_text("I wouldn't do that if i were you.")
                 await message.reply_text("I wouldn't do that if i were you.")
             else:
             else:
                 if user_id in await list_members(chat_id):
                 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:
                     if warns:
                         warns = warns["warns"]
                         warns = warns["warns"]
                     else:
                     else:
                         warn = {"warns": 1}
                         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(
                         await message.reply_text(
                             f"Warned {mention} !, 1/3 warnings now."
                             f"Warned {mention} !, 1/3 warnings now."
                         )
                         )
@@ -469,10 +504,14 @@ async def warn_user(_, message):
                         await message.reply_text(
                         await message.reply_text(
                             f"Number of warns of {mention} exceeded, Banned!"
                             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:
                     else:
                         warn = {"warns": warns + 1}
                         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(
                         await message.reply_text(
                             f"Warned {mention} !, {warns+1}/3 warnings now."
                             f"Warned {mention} !, {warns+1}/3 warnings now."
                         )
                         )
@@ -491,7 +530,9 @@ async def warn_user(_, message):
 @capture_err
 @capture_err
 async def remove_warnings(_, message):
 async def remove_warnings(_, message):
     if not message.reply_to_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
         return
     try:
     try:
         from_user_id = message.from_user.id
         from_user_id = message.from_user.id
@@ -521,7 +562,9 @@ async def remove_warnings(_, message):
 @capture_err
 @capture_err
 async def check_warns(_, message):
 async def check_warns(_, message):
     if not message.reply_to_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
         return
     try:
     try:
         user_id = message.reply_to_message.from_user.id
         user_id = message.reply_to_message.from_user.id
@@ -535,7 +578,9 @@ async def check_warns(_, message):
             else:
             else:
                 await message.reply_text(f"{mention_user} have no warnings.")
                 await message.reply_text(f"{mention_user} have no warnings.")
                 return
                 return
-            await message.reply_text(f"{mention_user} have {warns}/3 warnings.")
+            await message.reply_text(
+                f"{mention_user} have {warns}/3 warnings."
+            )
             return
             return
         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:
         if warns:
@@ -543,7 +588,9 @@ async def check_warns(_, message):
         else:
         else:
             await message.reply_text(f"{mention_user} have no warnings.")
             await message.reply_text(f"{mention_user} have no warnings.")
             return
             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:
     except Exception as e:
         await message.reply_text(str(e))
         await message.reply_text(str(e))
 
 
@@ -552,7 +599,8 @@ async def check_warns(_, message):
 
 
 
 
 @app.on_message(
 @app.on_message(
-    filters.command(["report", "admins"], prefixes=["@", "/"]) & ~filters.edited
+    filters.command(["report", "admins"], prefixes=["@", "/"])
+    & ~filters.edited
 )
 )
 @capture_err
 @capture_err
 async def report_user(_, message):
 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.")
                 await message.reply_text("You Don't Have Enough Permissions.")
                 return
                 return
         if not message.reply_to_message:
         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
             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
             return
         photo = await message.reply_to_message.download()
         photo = await message.reply_to_message.download()
         await message.chat.set_photo(photo)
         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()
     end_time = time.time()
     elapsed_time = end_time - start_time
     elapsed_time = end_time - start_time
     seconds = (elapsed_time * (total / current)) - elapsed_time
     seconds = (elapsed_time * (total / current)) - elapsed_time
-    thing = "".join(str(timedelta(seconds=seconds)).split(".")[:-1]).split(", ")
+    thing = "".join(str(timedelta(seconds=seconds)).split(".")[:-1]).split(
+        ", "
+    )
     thing[-1] = thing[-1].rjust(8, "0")
     thing[-1] = thing[-1].rjust(8, "0")
     return ", ".join(thing)
     return ", ".join(thing)
 
 
@@ -203,7 +205,9 @@ async def anime_search(_, message):
     search = message.text.split(None, 1)[1]
     search = message.text.split(None, 1)[1]
     variables = {"search": search}
     variables = {"search": search}
     json = (
     json = (
-        requests.post(url, json={"query": anime_query, "variables": variables})
+        requests.post(
+            url, json={"query": anime_query, "variables": variables}
+        )
         .json()["data"]
         .json()["data"]
         .get("Media", None)
         .get("Media", None)
     )
     )
@@ -243,7 +247,9 @@ async def anime_search(_, message):
         if image:
         if image:
             try:
             try:
                 await message.reply_photo(
                 await message.reply_photo(
-                    image, caption=msg, reply_markup=InlineKeyboardMarkup(buttons)
+                    image,
+                    caption=msg,
+                    reply_markup=InlineKeyboardMarkup(buttons),
                 )
                 )
             except Exception:
             except Exception:
                 msg += f" [✔️️]({image})"
                 msg += f" [✔️️]({image})"
@@ -261,15 +267,17 @@ async def manga_search(_, message):
     search = message.text.split(None, 1)[1]
     search = message.text.split(None, 1)[1]
     variables = {"search": search}
     variables = {"search": search}
     json = (
     json = (
-        requests.post(url, json={"query": manga_query, "variables": variables})
+        requests.post(
+            url, json={"query": manga_query, "variables": variables}
+        )
         .json()["data"]
         .json()["data"]
         .get("Media", None)
         .get("Media", None)
     )
     )
     ms_g = ""
     ms_g = ""
     if json:
     if json:
-        title, title_native = json["title"].get("romaji", False), json["title"].get(
-            "native", False
-        )
+        title, title_native = json["title"].get("romaji", False), json[
+            "title"
+        ].get("native", False)
         start_date, status, score = (
         start_date, status, score = (
             json["startDate"].get("year", False),
             json["startDate"].get("year", False),
             json.get("status", False),
             json.get("status", False),
@@ -311,14 +319,14 @@ async def character_search(_, message):
     search = message.text.split(None, 1)[1]
     search = message.text.split(None, 1)[1]
     variables = {"query": search}
     variables = {"query": search}
     json = (
     json = (
-        requests.post(url, json={"query": character_query, "variables": variables})
+        requests.post(
+            url, json={"query": character_query, "variables": variables}
+        )
         .json()["data"]
         .json()["data"]
         .get("Character", None)
         .get("Character", None)
     )
     )
     if json:
     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']}"
         description = f"{json['description']}"
         site_url = json.get("siteUrl")
         site_url = json.get("siteUrl")
         ms_g += shorten(description, site_url)
         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."
             "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)

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

+ 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))
 @app.on_message(filters.command("blacklist_chat") & filters.user(SUDOERS))
+@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:
         await message.reply_text("**Usage:**\n/blacklist_chat [CHAT_ID]")
         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))
 @app.on_message(filters.command("whitelist_chat") & filters.user(SUDOERS))
+@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:
         await message.reply_text("**Usage:**\n/whitelist_chat [CHAT_ID]")
         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))
 @app.on_message(filters.command("blacklisted_chats") & filters.user(SUDOERS))
+@capture_err
 async def blacklisted_chats_func(_, message: Message):
 async def blacklisted_chats_func(_, message: Message):
     text = ""
     text = ""
     for count, chat_id in enumerate(await blacklisted_chats(), 1):
     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 status == "ON" or status == "on" or status == "On":
         if chat_id not in active_chats_bot:
         if chat_id not in active_chats_bot:
             active_chats_bot.append(chat_id)
             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)
             await message.reply_text(text)
             return
             return
         await message.reply_text("ChatBot Is Already Enabled.")
         await message.reply_text("ChatBot Is Already Enabled.")
@@ -78,7 +81,11 @@ async def lunaQuery(query: str, user_id: int):
 
 
 
 
 @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
@@ -91,7 +98,9 @@ async def chatbot_talk(_, message):
         return
         return
     query = message.text
     query = message.text
     await app2.send_chat_action(message.chat.id, "typing")
     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 app2.send_chat_action(message.chat.id, "cancel")
     await message.reply_text(response)
     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 status == "ON" or status == "on" or status == "On":
         if chat_id not in active_chats_ubot:
         if chat_id not in active_chats_ubot:
             active_chats_ubot.append(chat_id)
             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)
             await edit_or_reply(message, text=text)
             return
             return
         await edit_or_reply(message, text="ChatBot Is Already Enabled.")
         await edit_or_reply(message, text="ChatBot Is Already Enabled.")
@@ -134,7 +146,8 @@ async def chatbot_status_ubot(_, message):
 
 
 
 
 @app2.on_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
 @capture_err
 async def chatbot_talk_ubot(_, message):
 async def chatbot_talk_ubot(_, message):
@@ -152,7 +165,9 @@ async def chatbot_talk_ubot(_, message):
         if username not in query:
         if username not in query:
             return
             return
     await app2.send_chat_action(message.chat.id, "typing")
     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 app2.send_chat_action(message.chat.id, "cancel")
     await message.reply_text(response)
     await message.reply_text(response)
 
 
@@ -167,6 +182,8 @@ async def chatbot_talk_ubot_pm(_, message):
         return
         return
     query = message.text
     query = message.text
     await app2.send_chat_action(message.chat.id, "typing")
     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 message.reply_text(response)
     await app2.send_chat_action(message.chat.id, "cancel")
     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} = ❤️
 {c1_mention} + {c2_mention} = ❤️
 
 
 __New couple of the day may be chosen at 12AM {tomorrow}__"""
 __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}
             couple = {"c1_id": c1_id, "c2_id": c2_id}
             await save_couple(chat_id, today, couple)
             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}) = ❤️
 [{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}__"""
 __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:
     except Exception as e:
         print(e)
         print(e)
         await message.reply_text(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:
     if len(message.command) != 1:
         country = message.text.split(None, 1)[1].strip()
         country = message.text.split(None, 1)[1].strip()
         country = country.replace(" ", "")
         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)
         data = await json_prettify(data)
         await app.send_message(message.chat.id, text=data)
         await app.send_message(message.chat.id, text=data)
         return
         return

+ 12 - 6
wbb/modules/devs.py

@@ -50,9 +50,6 @@ async def executor(client, message):
         await message.delete()
         await message.delete()
         return
         return
     t1 = time()
     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_stderr = sys.stderr
     old_stdout = sys.stdout
     old_stdout = sys.stdout
     redirected_output = sys.stdout = StringIO()
     redirected_output = sys.stdout = StringIO()
@@ -82,7 +79,13 @@ async def executor(client, message):
             out_file.write(str(evaluation.strip()))
             out_file.write(str(evaluation.strip()))
         t2 = time()
         t2 = time()
         keyboard = InlineKeyboardMarkup(
         keyboard = InlineKeyboardMarkup(
-            [[InlineKeyboardButton(text="⏳", callback_data=f"runtime {t2-t1} Seconds")]]
+            [
+                [
+                    InlineKeyboardButton(
+                        text="⏳", callback_data=f"runtime {t2-t1} Seconds"
+                    )
+                ]
+            ]
         )
         )
         await message.reply_document(
         await message.reply_document(
             document=filename,
             document=filename,
@@ -98,7 +101,8 @@ async def executor(client, message):
             [
             [
                 [
                 [
                     InlineKeyboardButton(
                     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,
                 value=exc_obj,
                 tb=exc_tb,
                 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
             return
         output = process.stdout.read()[:-1].decode("utf-8")
         output = process.stdout.read()[:-1].decode("utf-8")
     if str(output) == "\n":
     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."""
 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
 @capture_err
 async def save_filters(_, message):
 async def save_filters(_, message):
     chat_id = message.chat.id
     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."
             "**Usage:**\nReply to a text or sticker with /filter [FILTER_NAME] to save it."
         )
         )
         return
         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(
         await message.reply_text(
             "__**You can only save text or stickers in filters.**__"
             "__**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}.**__")
     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
 @capture_err
 async def get_filterss(_, message):
 async def get_filterss(_, message):
     _filters = await get_filters_names(message.chat.id)
     _filters = await get_filters_names(message.chat.id)
@@ -140,7 +147,9 @@ async def filters_re(_, message):
                         await message.reply_to_message.reply_text(
                         await message.reply_to_message.reply_text(
                             data, disable_web_page_preview=True
                             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:
                 else:
                     if message.reply_to_message:
                     if message.reply_to_message:
                         await message.reply_to_message.reply_sticker(data)
                         await message.reply_to_message.reply_sticker(data)

+ 5 - 2
wbb/modules/genstr.py

@@ -69,7 +69,9 @@ async def genstr(_, message):
         )
         )
 
 
     except TimeoutError:
     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
         return
     otp_code = otp.text
     otp_code = otp.text
     try:
     try:
@@ -105,7 +107,8 @@ async def genstr(_, message):
         session_string = await temp_client.export_session_string()
         session_string = await temp_client.export_session_string()
         await temp_client.disconnect()
         await temp_client.disconnect()
         await app.send_message(
         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:
     except Exception as e:
         await app.send_message(chat.id, f"**ERROR:** `{str(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"""
 """ 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
 @capture_err
 async def global_stats(_, message):
 async def global_stats(_, message):
     m = await app.send_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
     # 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)
         answers_dicc.append(verification_data)
         # keyboard for later use with callback query
         # keyboard for later use with callback query
         button_message = await message.reply_photo(
         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)
         os.remove(captcha_image)
         """ Save captcha answers etc in mongodb in case bot gets crashed or restarted. """
         """ Save captcha answers etc in mongodb in case bot gets crashed or restarted. """
         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)
 
 
@@ -191,7 +196,9 @@ async def send_welcome_message(callback_query, pending_user_id):
     if "{chat}" in text:
     if "{chat}" in text:
         text = text.replace("{chat}", callback_query.message.chat.title)
         text = text.replace("{chat}", callback_query.message.chat.title)
     if "{name}" in text:
     if "{name}" in text:
-        text = text.replace("{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)
     buttons = InlineKeyboard(row_width=2)
     list_of_buttons = []
     list_of_buttons = []
     for button_string in buttons_text_list:
     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_string = button_string.split(",")
         button_text = button_string[0].strip()
         button_text = button_string[0].strip()
         button_url = button_string[1].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)
     buttons.add(*list_of_buttons)
     await app.send_message(
     await app.send_message(
         callback_query.message.chat.id,
         callback_query.message.chat.id,
@@ -244,7 +253,9 @@ async def callback_query_welcome_button(_, callback_query):
                         answers_dicc.remove(iii)
                         answers_dicc.remove(iii)
                         await button_message.chat.kick_member(pending_user_id)
                         await button_message.chat.kick_member(pending_user_id)
                         await asyncio.sleep(1)
                         await asyncio.sleep(1)
-                        await button_message.chat.unban_member(pending_user_id)
+                        await button_message.chat.unban_member(
+                            pending_user_id
+                        )
                         await button_message.delete()
                         await button_message.delete()
                         await update_captcha_cache(answers_dicc)
                         await update_captcha_cache(answers_dicc)
                         return
                         return
@@ -279,7 +290,9 @@ async def callback_query_welcome_button(_, callback_query):
         return
         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
     """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
     """
     """
@@ -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)
     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 == "restricted":
         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)
 @app.on_message(filters.command("cat") & ~filters.edited)
 @capture_err
 @capture_err
 async def cat(_, message):
 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())
         data = json.loads(url.read().decode())
     cat_url = data[0]["url"]
     cat_url = data[0]["url"]
     await message.reply_photo(cat_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 = []
         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
+            )
             return
             return
         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:
                 await client.answer_inline_query(
                 await client.answer_inline_query(
@@ -101,7 +105,9 @@ async def inline_query_handler(client, query):
                 return
                 return
             tex = text.split(None, 1)[1].strip()
             tex = text.split(None, 1)[1].strip()
             answerss = await shortify(tex)
             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":
         elif text.split()[0] == "wall":
             if len(text.split()) < 2:
             if len(text.split()) < 2:
@@ -196,7 +202,9 @@ async def inline_query_handler(client, query):
                 return
                 return
             tex = text.split(None, 1)[1].strip()
             tex = text.split(None, 1)[1].strip()
             answerss = await github_user_func(answers, tex)
             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":
         elif text.split()[0] == "gh_repo":
             if len(text.split()) < 2:
             if len(text.split()) < 2:
@@ -209,7 +217,9 @@ async def inline_query_handler(client, query):
                 return
                 return
             tex = text.split(None, 1)[1].strip()
             tex = text.split(None, 1)[1].strip()
             answerss = await github_repo_func(answers, tex)
             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":
         elif text.split()[0] == "search":
             if len(text.split()) < 2:
             if len(text.split()) < 2:
@@ -223,7 +233,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:
@@ -236,7 +248,9 @@ async def inline_query_handler(client, query):
                 return
                 return
             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:
@@ -249,11 +263,15 @@ async def inline_query_handler(client, query):
                 return
                 return
             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)
-            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
             return
 
 
         elif text.split()[0] == "paste":
         elif text.split()[0] == "paste":
@@ -267,7 +285,9 @@ async def inline_query_handler(client, query):
                 return
                 return
             link = text.strip().split()[1]
             link = text.strip().split()[1]
             answerss = await pastebin_func(answers, link)
             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
             return
 
 
         elif text.split()[0] == "carbon":
         elif text.split()[0] == "carbon":
@@ -281,19 +301,25 @@ async def inline_query_handler(client, query):
                 return
                 return
             link = text.split()[1]
             link = text.split()[1]
             answerss = await carbon_inline_func(answers, link)
             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
             return
 
 
         elif text.split()[0] == "pmpermit":
         elif text.split()[0] == "pmpermit":
             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
+            )
             return
             return
 
 
         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
+            )
             return
             return
 
 
         elif text.split()[0] == "nsfw_scan":
         elif text.split()[0] == "nsfw_scan":
@@ -307,7 +333,9 @@ async def inline_query_handler(client, query):
                 return
                 return
             tex = text.split(None, 1)[1].strip()
             tex = text.split(None, 1)[1].strip()
             answerss = await nsfw_scan_func(answers, tex)
             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":
         elif text.split()[0] == "ytmusic":
             if len(text.split()) < 2:
             if len(text.split()) < 2:
@@ -321,7 +349,9 @@ async def inline_query_handler(client, query):
             tex = query.query.split(None, 1)[1].strip()
             tex = query.query.split(None, 1)[1].strip()
             user_id = query.from_user.id
             user_id = query.from_user.id
             answerss = await yt_music_func(answers, tex, 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":
         elif text.split()[0] == "info":
             if len(text.split()) < 2:
             if len(text.split()) < 2:
@@ -334,7 +364,9 @@ async def inline_query_handler(client, query):
                 return
                 return
             tex = text.split()[1].strip()
             tex = text.split()[1].strip()
             answerss = await user_info_inline_func(answers, tex)
             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":
         elif text.split()[0] == "chat_info":
             if len(text.split()) < 2:
             if len(text.split()) < 2:
@@ -347,7 +379,9 @@ async def inline_query_handler(client, query):
                 return
                 return
             tex = text.split()[1].strip()
             tex = text.split()[1].strip()
             answerss = await chat_info_inline_func(answers, tex)
             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":
         elif text.split()[0] == "tmdb":
             if len(text.split()) < 2:
             if len(text.split()) < 2:
@@ -361,7 +395,9 @@ async def inline_query_handler(client, query):
                 return
                 return
             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
+            )
     except Exception as e:
     except Exception as e:
         e = traceback.format_exc()
         e = traceback.format_exc()
         print(e, " InLine")
         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"""
 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|👎)$"
 regex_downvote = r"^(\-|\-\-|\-1|👎)$"
 
 
 
 
@@ -137,7 +139,9 @@ async def karma(_, message):
             user_karma = karma[i]["karma"]
             user_karma = karma[i]["karma"]
             karma_dicc[str(user_id)] = user_karma
             karma_dicc[str(user_id)] = user_karma
             karma_arranged = dict(
             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:
         if not karma_arranged:
             await message.reply_text("No karma in DB for this chat.")
             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.remove(perm) if lock else permissions.append(perm))
     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:
-        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
         return
     await message.reply_text(("Locked." if lock else "Unlocked."))
     await message.reply_text(("Locked." if lock else "Unlocked."))
 
 
@@ -96,7 +100,10 @@ async def locks_func(_, message):
             return
             return
 
 
         permissions = await member_permissions(chat_id, user_id)
         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.")
             await message.reply_text("You Don't Have Enough Permissions.")
             return
             return
 
 

+ 14 - 10
wbb/modules/misc.py

@@ -64,7 +64,9 @@ async def rtfm(_, message):
     if not message.reply_to_message:
     if not message.reply_to_message:
         await message.reply_text("Reply To A Message lol")
         await message.reply_text("Reply To A Message lol")
         return
         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)
 @app.on_message(filters.command("runs") & ~filters.edited)
@@ -81,9 +83,7 @@ async def getid(_, message):
         return
         return
     text_unping = "<b>Chat ID:</b>"
     text_unping = "<b>Chat ID:</b>"
     if message.chat.username:
     if message.chat.username:
-        text_unping = (
-            f'<a href="https://t.me/{message.chat.username}">{text_unping}</a>'
-        )
+        text_unping = f'<a href="https://t.me/{message.chat.username}">{text_unping}</a>'
     text_unping += f" <code>{message.chat.id}</code>\n"
     text_unping += f" <code>{message.chat.id}</code>\n"
     text = "<b>Message ID:</b>"
     text = "<b>Message ID:</b>"
     if message.link:
     if message.link:
@@ -113,9 +113,7 @@ async def getid(_, message):
             text_unping += "\n"
             text_unping += "\n"
             text = "<b>Forwarded User ID:</b>"
             text = "<b>Forwarded User ID:</b>"
             if reply.forward_from.username:
             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 += f" <code>{reply.forward_from.id}</code>\n"
             text_unping += text
             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'
             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
 @capture_err
 async def random(_, message):
 async def random(_, message):
     if len(message.command) != 2:
     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
         return
     length = message.text.split(None, 1)[1]
     length = message.text.split(None, 1)[1]
 
 
     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")
@@ -187,7 +189,9 @@ async def decrypt(_, message):
 
 
 
 
 async def fetch_text(url):
 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:
         async with session.get(url) as resp:
             data = await resp.text()
             data = await resp.text()
     return data
     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)
         info_dict = ydl.extract_info(url, download=False)
         if int(float(info_dict["duration"])) > 600:
         if int(float(info_dict["duration"])) > 600:
             if m != 0:
             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
             is_downloading = False
             return
             return
         ydl.process_info(info_dict)
         ydl.process_info(info_dict)
@@ -77,14 +79,18 @@ async def download_youtube_audio(url: str, m=0):
             os.remove(audio_file)
             os.remove(audio_file)
             audio_file = audio_file_opus
             audio_file = audio_file_opus
         thumbnail_url = info_dict["thumbnail"]
         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"]
         title = info_dict["title"]
         performer = info_dict["uploader"]
         performer = info_dict["uploader"]
         duration = int(float(info_dict["duration"]))
         duration = int(float(info_dict["duration"]))
     return [title, performer, duration, audio_file, thumbnail_file]
     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
 @capture_err
 async def music(_, message):
 async def music(_, message):
     global is_downloading
     global is_downloading
@@ -98,7 +104,9 @@ async def music(_, message):
         )
         )
         return
         return
     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:
         (
         (
             title,
             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."
             "**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**")
         await message.reply_text("**You don't have enough permissions**")
     else:
     else:
         name = message.text.split(None, 1)[1].strip()
         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.**")
             await message.reply_text("**No such note.**")
         else:
         else:
             if _note["type"] == "text":
             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:
             else:
                 await message.reply_sticker(_note["data"])
                 await message.reply_sticker(_note["data"])
 
 
 
 
-@app.on_message(filters.command("delete") & ~filters.edited & ~filters.private)
+@app.on_message(
+    filters.command("delete") & ~filters.edited & ~filters.private
+)
 @capture_err
 @capture_err
 async def del_note(_, message):
 async def del_note(_, message):
     if len(message.command) < 2:
     if len(message.command) < 2:
         await message.reply_text("**Usage**\n__/delete [NOTE_NAME]__")
         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**")
         await message.reply_text("**You don't have enough permissions**")
 
 
     else:
     else:

+ 6 - 2
wbb/modules/paste.py

@@ -58,10 +58,14 @@ async def paste_func(_, message):
 
 
         elif message.reply_to_message.document:
         elif message.reply_to_message.document:
             if message.reply_to_message.document.file_size > 1048576:
             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
                 return
             m = await message.reply_text("Pasting...")
             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")
             i = open(doc_file, "r")
             link = await paste(i.read())
             link = await paste(i.read())
             preview = link + "/preview.png"
             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)
                     app.listen(USERBOT_ID), message.copy(BOT_ID)
                 )
                 )
                 caption = f"Forwarded from `{pipe['from_chat_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(
                 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 asyncio.sleep(10)
                 await temp.delete()
                 await temp.delete()

+ 14 - 5
wbb/modules/pmpermit.py

@@ -70,7 +70,9 @@ async def pmpermit_func(_, message):
 @capture_err
 @capture_err
 async def pm_approve(_, message):
 async def pm_approve(_, message):
     if not message.reply_to_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
         return
     user_id = message.reply_to_message.from_user.id
     user_id = message.reply_to_message.from_user.id
     if await is_pmpermit_approved(user_id):
     if await is_pmpermit_approved(user_id):
@@ -87,7 +89,9 @@ async def pm_approve(_, message):
 )
 )
 async def pm_disapprove(_, message):
 async def pm_disapprove(_, message):
     if not message.reply_to_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
         return
     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):
@@ -111,7 +115,9 @@ async def pm_disapprove(_, message):
 @capture_err
 @capture_err
 async def block_user_func(_, message):
 async def block_user_func(_, message):
     if not message.reply_to_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
         return
     user_id = message.reply_to_message.from_user.id
     user_id = message.reply_to_message.from_user.id
     await app2.block_user(user_id)
     await app2.block_user(user_id)
@@ -125,7 +131,9 @@ async def block_user_func(_, message):
 )
 )
 async def unblock_user_func(_, message):
 async def unblock_user_func(_, message):
     if not message.reply_to_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
         return
     user_id = message.reply_to_message.from_user.id
     user_id = message.reply_to_message.from_user.id
     await app2.unblock_user(user_id)
     await app2.unblock_user(user_id)
@@ -171,5 +179,6 @@ async def pmpermit_cq(_, cq):
             await app2.block_user(user_id)
             await app2.block_user(user_id)
             return
             return
         await app2.send_message(
         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 import filters
 from pyrogram.types import Message
 from pyrogram.types import Message
 
 
-from wbb import app, app2, arq
+from wbb import app, arq
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.errors import capture_err
 
 
 __MODULE__ = "Quotly"
 __MODULE__ = "Quotly"
@@ -38,12 +38,15 @@ def isArgInt(message: Message) -> bool:
 
 
 
 
 @app.on_message(filters.command("q"))
 @app.on_message(filters.command("q"))
+@capture_err
 async def quotly_func(_, message: Message):
 async def quotly_func(_, message: Message):
     if not message.reply_to_message:
     if not message.reply_to_message:
         await message.reply_text("Reply to a message to quote it.")
         await message.reply_text("Reply to a message to quote it.")
         return
         return
     if not message.reply_to_message.text:
     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
         return
     m = await message.reply_text("Quoting Messages")
     m = await message.reply_text("Quoting Messages")
     if len(message.command) < 2:
     if len(message.command) < 2:
@@ -74,12 +77,16 @@ async def quotly_func(_, message: Message):
                 )
                 )
                 return
                 return
             reply_message = await app.get_messages(
             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
             reply_message = reply_message.reply_to_message
             messages = [reply_message, message.reply_to_message]
             messages = [reply_message, message.reply_to_message]
     else:
     else:
-        await m.edit("Incorrect argument, check quotly module in help section.")
+        await m.edit(
+            "Incorrect argument, check quotly module in help section."
+        )
         return
         return
     try:
     try:
         sticker = await quotify(messages)
         sticker = await quotify(messages)

+ 5 - 2
wbb/modules/regex.py

@@ -37,7 +37,8 @@ DELIMITERS = ("/", ":", "|", "_")
 
 
 
 
 @app.on_message(
 @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):
 async def sed(_, message):
     if not message.text:
     if not message.text:
@@ -70,7 +71,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:

+ 9 - 3
wbb/modules/repo.py

@@ -28,7 +28,9 @@ from wbb.core.decorators.errors import capture_err
 from wbb.utils.fetch import fetch
 from wbb.utils.fetch import fetch
 
 
 __MODULE__ = "Repo"
 __MODULE__ = "Repo"
-__HELP__ = "/repo - To Get My Github Repository Link " "And Support Group Link"
+__HELP__ = (
+    "/repo - To Get My Github Repository Link " "And Support Group Link"
+)
 
 
 
 
 @app.on_message(filters.command("repo") & ~filters.edited)
 @app.on_message(filters.command("repo") & ~filters.edited)
@@ -40,7 +42,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 +52,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
+    )

+ 10 - 3
wbb/modules/reverse.py

@@ -59,7 +59,9 @@ async def reverse_image_search(_, message):
 
 
     if reply.animation:
     if reply.animation:
         if not reply.animation.thumbs:
         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
             return
         file_id = reply.animation.thumbs[0].file_id
         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:
     async with aiofiles.open(image, "rb") as f:
         if image:
         if image:
             search_url = "http://www.google.com/searchbyimage/upload"
             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")
             location = response.headers.get("Location")
             os.remove(image)
             os.remove(image)
         else:
         else:

+ 9 - 3
wbb/modules/rice.py

@@ -50,7 +50,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"),
                 ]
                 ]
             ]
             ]
@@ -79,11 +81,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)

+ 7 - 2
wbb/modules/stickers.py

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

+ 11 - 5
wbb/modules/sudo.py

@@ -48,7 +48,8 @@ can even delete your account.
 
 
 
 
 @app2.on_message(
 @app2.on_message(
-    filters.command("useradd", prefixes=USERBOT_PREFIX) & filters.user(SUDOERS)
+    filters.command("useradd", prefixes=USERBOT_PREFIX)
+    & filters.user(SUDOERS)
 )
 )
 @capture_err
 @capture_err
 async def useradd(_, message: Message):
 async def useradd(_, message: Message):
@@ -63,7 +64,9 @@ async def useradd(_, message: Message):
         await edit_or_reply(message, text="User is already in sudoers.")
         await edit_or_reply(message, text="User is already in sudoers.")
         return
         return
     if user_id == BOT_ID:
     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
         return
     added = await add_sudo(user_id)
     added = await add_sudo(user_id)
     if added:
     if added:
@@ -77,13 +80,15 @@ async def useradd(_, message: Message):
 
 
 
 
 @app2.on_message(
 @app2.on_message(
-    filters.command("userdel", prefixes=USERBOT_PREFIX) & filters.user(SUDOERS)
+    filters.command("userdel", prefixes=USERBOT_PREFIX)
+    & filters.user(SUDOERS)
 )
 )
 @capture_err
 @capture_err
 async def userdel(_, message: Message):
 async def userdel(_, message: Message):
     if not message.reply_to_message:
     if not message.reply_to_message:
         await edit_or_reply(
         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
         return
     user_id = message.reply_to_message.from_user.id
     user_id = message.reply_to_message.from_user.id
@@ -102,7 +107,8 @@ async def userdel(_, message: Message):
 
 
 
 
 @app2.on_message(
 @app2.on_message(
-    filters.command("sudoers", prefixes=USERBOT_PREFIX) & filters.user(SUDOERS)
+    filters.command("sudoers", prefixes=USERBOT_PREFIX)
+    & filters.user(SUDOERS)
 )
 )
 @capture_err
 @capture_err
 async def sudoers_list(_, message: Message):
 async def sudoers_list(_, message: Message):

+ 30 - 10
wbb/modules/sudoers.py

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

+ 9 - 7
wbb/modules/userbot.py

@@ -57,9 +57,6 @@ async def executor(client, message):
     except IndexError:
     except IndexError:
         await message.delete()
         await message.delete()
         return
         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_stderr = sys.stderr
     old_stdout = sys.stdout
     old_stdout = sys.stdout
     redirected_output = sys.stdout = StringIO()
     redirected_output = sys.stdout = StringIO()
@@ -82,7 +79,9 @@ async def executor(client, message):
         evaluation = stdout
         evaluation = stdout
     else:
     else:
         evaluation = "Success"
         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:
     if len(final_output) > 4096:
         filename = "output.txt"
         filename = "output.txt"
         with open(filename, "w+", encoding="utf8") as out_file:
         with open(filename, "w+", encoding="utf8") as out_file:
@@ -123,7 +122,8 @@ async def shellrunner(client, message):
             except Exception as err:
             except Exception as err:
                 print(err)
                 print(err)
                 await edit_or_reply(
                 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 += f"**{code}**\n"
             output += process.stdout.read()[:-1].decode("utf-8")
             output += process.stdout.read()[:-1].decode("utf-8")
@@ -167,9 +167,11 @@ async def shellrunner(client, message):
             os.remove("output.txt")
             os.remove("output.txt")
             return
             return
         await edit_or_reply(
         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:
     else:
         await edit_or_reply(
         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_name = file_url.split("/")[~0]
         self.file_path = (
         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
         self.completed = False
@@ -75,7 +77,9 @@ class DownloadJob:
                 async with aiofiles.open(self.file_path, "wb") as file:
                 async with aiofiles.open(self.file_path, "wb") as file:
 
 
                     # Downloading the file using the aiohttp.StreamReader
                     # Downloading the file using the aiohttp.StreamReader
-                    async for data in resp.content.iter_chunked(self._chunk_size):
+                    async for data in resp.content.iter_chunked(
+                        self._chunk_size
+                    ):
                         await file.write(data)
                         await file.write(data)
                         self._downloaded(self._chunk_size)
                         self._downloaded(self._chunk_size)
 
 
@@ -119,9 +123,13 @@ class Handler:
         :param save_path: save path for the download
         :param save_path: save path for the download
         :return:
         :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.
         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):
 async def activate_pipe(from_chat_id: int, to_chat_id: int, fetcher: str):
     pipes = await show_pipes()
     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)
     pipes.append(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
@@ -594,7 +598,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
@@ -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:
 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
 
 
 
 
@@ -647,7 +657,9 @@ async def remove_sudo(user_id: int) -> bool:
 
 
 async def blacklisted_chats() -> list:
 async def blacklisted_chats() -> list:
     chats = blacklist_chatdb.find({"chat_id": {"$lt": 0}})
     chats = blacklist_chatdb.find({"chat_id": {"$lt": 0}})
-    return [chat["chat_id"] for chat in await chats.to_list(length=1000000000)]
+    return [
+        chat["chat_id"] for chat in await chats.to_list(length=1000000000)
+    ]
 
 
 
 
 async def blacklist_chat(chat_id: int) -> bool:
 async def blacklist_chat(chat_id: int) -> bool:

+ 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(

+ 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"
     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"""
@@ -163,7 +165,8 @@ __**Translated from {i.src} to {lang}**__
                 input_message_content=InputTextMessageContent(msg),
                 input_message_content=InputTextMessageContent(msg),
             ),
             ),
             InlineQueryResultArticle(
             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)
     payload = json.dumps(payload)
     async with aiohttp.ClientSession() as session:
     async with aiohttp.ClientSession() as session:
         async with session.post(
         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:
         ) as resp:
             data = await resp.json()
             data = await resp.json()
     msg = data["link"]
     msg = data["link"]
@@ -419,7 +424,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} | " + f"{i.duration} | {i.publish_time}"
+        description = (
+            f"{i.views} | {i.channel} | " + f"{i.duration} | {i.publish_time}"
+        )
         answers.append(
         answers.append(
             InlineQueryResultArticle(
             InlineQueryResultArticle(
                 title=i.title,
                 title=i.title,
@@ -470,7 +477,9 @@ async def github_user_func(answers, text):
     result = await fetch(URL)
     result = await fetch(URL)
     buttons = InlineKeyboard(row_width=1)
     buttons = InlineKeyboard(row_width=1)
     buttons.add(
     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"""
     caption = f"""
 **Info Of {result['name']}**
 **Info Of {result['name']}**
@@ -486,7 +495,9 @@ async def github_user_func(answers, text):
 **Following:** `{result['following']}`"""
 **Following:** `{result['following']}`"""
     answers.append(
     answers.append(
         InlineQueryResultPhoto(
         InlineQueryResultPhoto(
-            photo_url=result["avatar_url"], caption=caption, reply_markup=buttons
+            photo_url=result["avatar_url"],
+            caption=caption,
+            reply_markup=buttons,
         )
         )
     )
     )
     return answers
     return answers
@@ -507,7 +518,9 @@ async def github_repo_func(answers, text):
         commits += developer["contributions"]
         commits += developer["contributions"]
     buttons = InlineKeyboard(row_width=1)
     buttons = InlineKeyboard(row_width=1)
     buttons.add(
     buttons.add(
-        InlineKeyboardButton("Open On Github", url=f"https://github.com/{text}")
+        InlineKeyboardButton(
+            "Open On Github", url=f"https://github.com/{text}"
+        )
     )
     )
     caption = f"""
     caption = f"""
 **Info Of {r['full_name']}**
 **Info Of {r['full_name']}**
@@ -571,7 +584,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}
@@ -625,7 +640,9 @@ 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 = list(
+        {v["duration"]: v for v in messages_ids_and_duration}.values()
+    )
     messages_ids = []
     messages_ids = []
     for ff_ in messages:
     for ff_ in messages:
         messages_ids.append(ff_["message_id"])
         messages_ids.append(ff_["message_id"])
@@ -682,7 +699,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",
@@ -732,7 +751,9 @@ async def pastebin_func(answers, link):
                 InlineQueryResultArticle(
                 InlineQueryResultArticle(
                     title="DOCUMENT TOO BIG",
                     title="DOCUMENT TOO BIG",
                     description="Maximum supported size is 1MB",
                     description="Maximum supported size is 1MB",
-                    input_message_content=InputTextMessageContent("DOCUMENT TOO BIG"),
+                    input_message_content=InputTextMessageContent(
+                        "DOCUMENT TOO BIG"
+                    ),
                 )
                 )
             )
             )
             return answers
             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
     await app.send_photo(MESSAGE_DUMP_CHAT, preview)  # To Pre-cache the media
     buttons = InlineKeyboard(row_width=1)
     buttons = InlineKeyboard(row_width=1)
     buttons.add(InlineKeyboardButton(text="Paste Link", url=link))
     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
     return answers
 
 
 
 
@@ -769,7 +792,9 @@ async def pmpermit_func(answers, user_id, victim):
         InlineKeyboardButton(
         InlineKeyboardButton(
             text="For promotion", callback_data="pmpermit to_scam_you a"
             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(
         InlineKeyboardButton(
             text="Approve", callback_data=f"pmpermit approve {victim}"
             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"
     ping = f"{str(round((t2 - t1), 6) * 100)} ms"
     answers.append(
     answers.append(
         InlineQueryResultArticle(
         InlineQueryResultArticle(
-            title=ping, input_message_content=InputTextMessageContent(f"__**{ping}**__")
+            title=ping,
+            input_message_content=InputTextMessageContent(f"__**{ping}**__"),
         )
         )
     )
     )
     return answers
     return answers
@@ -846,7 +872,13 @@ async def yt_music_func(answers, url, user_id):
     if "http" not in url:
     if "http" not in url:
         url = (await arq.youtube(url)).result[0]
         url = (await arq.youtube(url)).result[0]
         url = f"https://youtube.com{url.url_suffix}"
         url = f"https://youtube.com{url.url_suffix}"
-    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(
     m = await app.send_audio(
         MESSAGE_DUMP_CHAT,
         MESSAGE_DUMP_CHAT,
         audio,
         audio,
@@ -880,7 +912,9 @@ async def carbon_inline_func(answers, link):
                 InlineQueryResultArticle(
                 InlineQueryResultArticle(
                     title="DOCUMENT TOO BIG",
                     title="DOCUMENT TOO BIG",
                     description="Maximum supported size is 1MB",
                     description="Maximum supported size is 1MB",
-                    input_message_content=InputTextMessageContent("DOCUMENT TOO BIG"),
+                    input_message_content=InputTextMessageContent(
+                        "DOCUMENT TOO BIG"
+                    ),
                 )
                 )
             )
             )
             return answers
             return answers
@@ -897,7 +931,9 @@ async def carbon_inline_func(answers, link):
     buttons.add(InlineKeyboardButton(text="Paste Link", url=link))
     buttons.add(InlineKeyboardButton(text="Paste Link", url=link))
     answers.append(
     answers.append(
         InlineQueryResultCachedDocument(
         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
     return answers
@@ -936,7 +972,9 @@ async def tmdb_func(answers, query):
             InlineQueryResultArticle(
             InlineQueryResultArticle(
                 title="Error",
                 title="Error",
                 description=response.result,
                 description=response.result,
-                input_message_content=InputTextMessageContent(response.result),
+                input_message_content=InputTextMessageContent(
+                    response.result
+                ),
             )
             )
         )
         )
         return answers
         return answers
@@ -965,7 +1003,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}",

+ 6 - 1
wbb/utils/json_prettify.py

@@ -27,7 +27,12 @@ async def json_object_prettify(objecc):
     dicc = objecc.__dict__
     dicc = objecc.__dict__
     output = ""
     output = ""
     for key, value in dicc.items():
     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
             continue
         output += f"**{key}:** `{value}`\n"
         output += f"**{key}:** `{value}`\n"
     return output
     return output

+ 3 - 1
wbb/utils/misc.py

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