Browse Source

Karma aligned

thehamkercat 5 năm trước cách đây
mục cha
commit
540f508d63
53 tập tin đã thay đổi với 192 bổ sung và 566 xóa
  1. 1 3
      sample_config.py
  2. 2 1
      wbb/__init__.py
  3. 6 21
      wbb/__main__.py
  4. 0 1
      wbb/core/decorators/errors.py
  5. 3 9
      wbb/core/types/InlineQueryResult.py
  6. 24 68
      wbb/modules/admin.py
  7. 3 11
      wbb/modules/admin_misc.py
  8. 0 1
      wbb/modules/alive.py
  9. 10 17
      wbb/modules/anime.py
  10. 1 4
      wbb/modules/antiservice.py
  11. 0 1
      wbb/modules/arq.py
  12. 5 16
      wbb/modules/blacklist.py
  13. 0 1
      wbb/modules/blacklist_chat.py
  14. 0 1
      wbb/modules/carbon.py
  15. 6 23
      wbb/modules/chatbot.py
  16. 2 7
      wbb/modules/couple.py
  17. 1 4
      wbb/modules/covid.py
  18. 2 11
      wbb/modules/devs.py
  19. 4 14
      wbb/modules/filters.py
  20. 1 4
      wbb/modules/genstr.py
  21. 1 4
      wbb/modules/global_stats.py
  22. 6 19
      wbb/modules/greetings.py
  23. 1 4
      wbb/modules/images.py
  24. 2 1
      wbb/modules/info.py
  25. 18 54
      wbb/modules/inline.py
  26. 13 11
      wbb/modules/karma.py
  27. 3 11
      wbb/modules/locks.py
  28. 10 15
      wbb/modules/misc.py
  29. 4 13
      wbb/modules/music.py
  30. 6 22
      wbb/modules/notes.py
  31. 2 7
      wbb/modules/paste.py
  32. 1 6
      wbb/modules/pipes.py
  33. 4 13
      wbb/modules/pmpermit.py
  34. 2 7
      wbb/modules/quotly.py
  35. 0 1
      wbb/modules/reddit.py
  36. 1 4
      wbb/modules/regex.py
  37. 3 10
      wbb/modules/repo.py
  38. 2 7
      wbb/modules/reverse.py
  39. 3 10
      wbb/modules/rice.py
  40. 2 8
      wbb/modules/stickers.py
  41. 4 10
      wbb/modules/sudo.py
  42. 8 25
      wbb/modules/sudoers.py
  43. 1 4
      wbb/modules/telegraph.py
  44. 0 1
      wbb/modules/tts.py
  45. 1 4
      wbb/modules/userbot.py
  46. 0 1
      wbb/modules/webss.py
  47. 4 12
      wbb/utils/aiodownloader/downloader.py
  48. 3 11
      wbb/utils/dbfunctions.py
  49. 1 2
      wbb/utils/files.py
  50. 0 1
      wbb/utils/functions.py
  51. 13 40
      wbb/utils/inlinefuncs.py
  52. 1 6
      wbb/utils/json_prettify.py
  53. 1 4
      wbb/utils/misc.py

+ 1 - 3
sample_config.py

@@ -8,9 +8,7 @@ if HEROKU:
     API_HASH = environ.get("API_HASH", "eb06d4abfb49dc3eeb1aeb98ae0f581e")
     SESSION_STRING = environ.get("SESSION_STRING", None)
     USERBOT_PREFIX = environ.get("USERBOT_PREFIX", None)
-    SUDO_USERS_ID = list(
-        int(x) for x in environ.get("SUDO_USERS_ID", "").split()
-    )
+    SUDO_USERS_ID = list(int(x) for x in environ.get("SUDO_USERS_ID", "").split())
     LOG_GROUP_ID = int(environ.get("LOG_GROUP_ID", None))
     GBAN_LOG_GROUP_ID = int(environ.get("GBAN_LOG_GROUP_ID", None))
     MESSAGE_DUMP_CHAT = int(environ.get("MESSAGE_DUMP_CHAT", None))

+ 2 - 1
wbb/__init__.py

@@ -29,9 +29,10 @@ from os import path
 from motor.motor_asyncio import AsyncIOMotorClient as MongoClient
 from pyrogram import Client
 from pyromod import listen
-from Python_ARQ import ARQ
 from telegraph import Telegraph
 
+from Python_ARQ import ARQ
+
 print("[INFO]: INITIALIZING")
 is_config = path.exists("config.py")
 if is_config:

+ 6 - 21
wbb/__main__.py

@@ -28,7 +28,6 @@ import re
 import uvloop
 from pyrogram import filters, idle
 from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
-
 from wbb import BOT_NAME, BOT_USERNAME, USERBOT_NAME, app
 from wbb.modules import ALL_MODULES
 from wbb.modules.sudoers import bot_sys_stats
@@ -43,15 +42,9 @@ async def start_bot():
     global COMMANDS_COUNT
     for module in ALL_MODULES:
         imported_module = importlib.import_module("wbb.modules." + module)
-        if (
-            hasattr(imported_module, "__MODULE__")
-            and imported_module.__MODULE__
-        ):
+        if hasattr(imported_module, "__MODULE__") and imported_module.__MODULE__:
             imported_module.__MODULE__ = imported_module.__MODULE__
-            if (
-                hasattr(imported_module, "__HELP__")
-                and imported_module.__HELP__
-            ):
+            if hasattr(imported_module, "__HELP__") and imported_module.__HELP__:
                 HELPABLE[imported_module.__MODULE__.lower()] = imported_module
     bot_modules = ""
     j = 1
@@ -91,9 +84,7 @@ async def help_command(_, message):
                     InlineKeyboardButton(
                         text="System Stats 💻", callback_data="stats_callback"
                     ),
-                    InlineKeyboardButton(
-                        text="Support 👨", url="t.me/WBBSupport"
-                    ),
+                    InlineKeyboardButton(text="Support 👨", url="t.me/WBBSupport"),
                 ],
             ]
         )
@@ -102,9 +93,7 @@ async def help_command(_, message):
     keyboard = InlineKeyboardMarkup(
         [
             [
-                InlineKeyboardButton(
-                    text="Commands ❓", callback_data="bot_commands"
-                ),
+                InlineKeyboardButton(text="Commands ❓", callback_data="bot_commands"),
                 InlineKeyboardButton(
                     text="Repo 🛠",
                     url="https://github.com/thehamkercat/WilliamButcherBot",
@@ -185,9 +174,7 @@ General command are:
     if mod_match:
         module = mod_match.group(1)
         text = (
-            "{} **{}**:\n".format(
-                "Here is the help for", HELPABLE[module].__MODULE__
-            )
+            "{} **{}**:\n".format("Here is the help for", HELPABLE[module].__MODULE__)
             + HELPABLE[module].__HELP__
         )
 
@@ -222,9 +209,7 @@ General command are:
     elif back_match:
         await query.message.edit(
             text=top_text,
-            reply_markup=InlineKeyboardMarkup(
-                paginate_modules(0, HELPABLE, "help")
-            ),
+            reply_markup=InlineKeyboardMarkup(paginate_modules(0, HELPABLE, "help")),
             disable_web_page_preview=True,
         )
 

+ 0 - 1
wbb/core/decorators/errors.py

@@ -4,7 +4,6 @@ import traceback
 from functools import wraps
 
 from pyrogram.errors.exceptions.forbidden_403 import ChatWriteForbidden
-
 from wbb import LOG_GROUP_ID, app
 
 

+ 3 - 9
wbb/core/types/InlineQueryResult.py

@@ -131,9 +131,7 @@ class InlineQueryResultAudio(InlineQueryResult):
             thumb=thumb,
             content=audio,
             send_message=(
-                await self.input_message_content.write(
-                    client, self.reply_markup
-                )
+                await self.input_message_content.write(client, self.reply_markup)
                 if self.input_message_content
                 else raw.types.InputBotInlineMessageMediaAuto(
                     reply_markup=await self.reply_markup.write(client)
@@ -233,9 +231,7 @@ class InlineQueryResultCachedDocument(InlineQueryResult):
             description=self.description,
             document=document,
             send_message=(
-                await self.input_message_content.write(
-                    client, self.reply_markup
-                )
+                await self.input_message_content.write(client, self.reply_markup)
                 if self.input_message_content
                 else raw.types.InputBotInlineMessageMediaAuto(
                     reply_markup=await self.reply_markup.write(client)
@@ -267,9 +263,7 @@ def get_input_file_from_file_id(
         )
 
     if file_type in (FileType.THUMBNAIL, FileType.CHAT_PHOTO):
-        raise ValueError(
-            f"This file_id can only be used for download: {file_id}"
-        )
+        raise ValueError(f"This file_id can only be used for download: {file_id}")
 
     if file_type in PHOTO_TYPES:
         return raw.types.InputPhoto(

+ 24 - 68
wbb/modules/admin.py

@@ -25,7 +25,6 @@ import asyncio
 
 from pyrogram import filters
 from pyrogram.types import ChatPermissions
-
 from wbb import BOT_ID, SUDOERS, app
 from wbb.core.decorators.errors import capture_err
 from wbb.utils.dbfunctions import (add_warn, get_warn, int_to_alpha,
@@ -51,9 +50,7 @@ __HELP__ = """/ban - Ban A User
 
 async def list_admins(chat_id: int):
     list_of_admins = []
-    async for member in app.iter_chat_members(
-        chat_id, filter="administrators"
-    ):
+    async for member in app.iter_chat_members(chat_id, filter="administrators"):
         list_of_admins.append(member.user.id)
     return list_of_admins
 
@@ -153,8 +150,7 @@ async def purge(client, message):
                     )
             else:
                 await message.reply_text(
-                    "Reply To A Message To Delete It,"
-                    " Don't Make Fun Of Yourself!"
+                    "Reply To A Message To Delete It," " Don't Make Fun Of Yourself!"
                 )
         else:
             await message.reply_text("Your Don't Have Enough Permissions!")
@@ -174,10 +170,7 @@ async def kick(_, message):
         from_user_id = message.from_user.id
         chat_id = message.chat.id
         permissions = await member_permissions(chat_id, from_user_id)
-        if (
-            "can_restrict_members" not in permissions
-            and from_user_id not in SUDOERS
-        ):
+        if "can_restrict_members" not in permissions and from_user_id not in SUDOERS:
             await message.reply_text("You don't have enough permissions.")
             return
         if len(message.command) == 2:
@@ -211,10 +204,7 @@ async def ban(_, message):
         from_user_id = message.from_user.id
         chat_id = message.chat.id
         permissions = await member_permissions(chat_id, from_user_id)
-        if (
-            "can_restrict_members" not in permissions
-            and from_user_id not in SUDOERS
-        ):
+        if "can_restrict_members" not in permissions and from_user_id not in SUDOERS:
             await message.reply_text("You don't have enough permissions.")
             return
         if len(message.command) == 2:
@@ -245,10 +235,7 @@ async def unban(_, message):
         from_user_id = message.from_user.id
         chat_id = message.chat.id
         permissions = await member_permissions(chat_id, from_user_id)
-        if (
-            "can_restrict_members" not in permissions
-            and from_user_id not in SUDOERS
-        ):
+        if "can_restrict_members" not in permissions and from_user_id not in SUDOERS:
             await message.reply_text("You don't have enough permissions.")
             return
         if len(message.command) == 2:
@@ -279,13 +266,9 @@ async def delete(_, message):
         from_user_id = message.from_user.id
         chat_id = message.chat.id
         permissions = await member_permissions(chat_id, from_user_id)
-        if (
-            "can_delete_messages" not in permissions
-            and from_user_id not in SUDOERS
-        ):
+        if "can_delete_messages" not in permissions and from_user_id not in SUDOERS:
             await message.reply_text(
-                "You Don't Have Enough Permissions,"
-                + " Consider Deleting Yourself!"
+                "You Don't Have Enough Permissions," + " Consider Deleting Yourself!"
             )
             return
         await message.reply_to_message.delete()
@@ -304,10 +287,7 @@ async def promote(_, message):
         from_user_id = message.from_user.id
         chat_id = message.chat.id
         permissions = await member_permissions(chat_id, from_user_id)
-        if (
-            "can_promote_members" not in permissions
-            and from_user_id not in SUDOERS
-        ):
+        if "can_promote_members" not in permissions and from_user_id not in SUDOERS:
             await message.reply_text("You don't have enough permissions")
             return
         bot = await app.get_chat_member(chat_id, BOT_ID)
@@ -337,8 +317,10 @@ async def promote(_, message):
     except Exception as e:
         await message.reply_text(str(e))
 
+
 # Demote Member
 
+
 @app.on_message(filters.command("demote") & ~filters.edited)
 @capture_err
 async def demote(_, message):
@@ -375,6 +357,7 @@ async def demote(_, message):
     except Exception as e:
         await message.reply_text(str(e))
 
+
 # Pin Messages
 
 
@@ -407,10 +390,7 @@ async def mute(_, message):
         from_user_id = message.from_user.id
         chat_id = message.chat.id
         permissions = await member_permissions(chat_id, from_user_id)
-        if (
-            "can_restrict_members" not in permissions
-            and from_user_id not in SUDOERS
-        ):
+        if "can_restrict_members" not in permissions and from_user_id not in SUDOERS:
             await message.reply_text("You don't have enough permissions.")
             return
         if len(message.command) == 2:
@@ -425,9 +405,7 @@ async def mute(_, message):
         if user_id in SUDOERS:
             await message.reply_text("You Wanna Mute The Elevated One?")
             return
-        await message.chat.restrict_member(
-            user_id, permissions=ChatPermissions()
-        )
+        await message.chat.restrict_member(user_id, permissions=ChatPermissions())
         await message.reply_text("Muted!")
     except Exception as e:
         await message.reply_text(str(e))
@@ -443,10 +421,7 @@ async def unmute(_, message):
         from_user_id = message.from_user.id
         chat_id = message.chat.id
         permissions = await member_permissions(chat_id, from_user_id)
-        if (
-            "can_restrict_members" not in permissions
-            and from_user_id not in SUDOERS
-        ):
+        if "can_restrict_members" not in permissions and from_user_id not in SUDOERS:
             await message.reply_text("You don't have enough permissions.")
             return
         if len(message.command) == 2:
@@ -487,9 +462,7 @@ async def ban_deleted_accounts(_, message):
                         print(str(e))
                         pass
                     banned_users += 1
-                await message.reply_text(
-                    f"Banned {banned_users} Deleted Accounts"
-                )
+                await message.reply_text(f"Banned {banned_users} Deleted Accounts")
             else:
                 await message.reply_text("No Deleted Accounts In This Chat")
                 return
@@ -523,16 +496,12 @@ async def warn_user(_, message):
                 await message.reply_text("I wouldn't do that if i were you.")
             else:
                 if user_id in await list_members(chat_id):
-                    warns = await get_warn(
-                        chat_id, await int_to_alpha(user_id)
-                    )
+                    warns = await get_warn(chat_id, await int_to_alpha(user_id))
                     if warns:
                         warns = warns["warns"]
                     else:
                         warn = {"warns": 1}
-                        await add_warn(
-                            chat_id, await int_to_alpha(user_id), warn
-                        )
+                        await add_warn(chat_id, await int_to_alpha(user_id), warn)
                         await message.reply_text(
                             f"Warned {mention} !, 1/3 warnings now."
                         )
@@ -542,14 +511,10 @@ async def warn_user(_, message):
                         await message.reply_text(
                             f"Number of warns of {mention} exceeded, Banned!"
                         )
-                        await remove_warns(
-                            chat_id, await int_to_alpha(user_id)
-                        )
+                        await remove_warns(chat_id, await int_to_alpha(user_id))
                     else:
                         warn = {"warns": warns + 1}
-                        await add_warn(
-                            chat_id, await int_to_alpha(user_id), warn
-                        )
+                        await add_warn(chat_id, await int_to_alpha(user_id), warn)
                         await message.reply_text(
                             f"Warned {mention} !, {warns+1}/3 warnings now."
                         )
@@ -568,9 +533,7 @@ async def warn_user(_, message):
 @capture_err
 async def remove_warnings(_, message):
     if not message.reply_to_message:
-        await message.reply_text(
-            "Reply to a message to remove a user's warnings."
-        )
+        await message.reply_text("Reply to a message to remove a user's warnings.")
         return
     try:
         from_user_id = message.from_user.id
@@ -600,9 +563,7 @@ async def remove_warnings(_, message):
 @capture_err
 async def check_warns(_, message):
     if not message.reply_to_message:
-        await message.reply_text(
-            "Reply to a message to check a user's warnings."
-        )
+        await message.reply_text("Reply to a message to check a user's warnings.")
         return
     try:
         user_id = message.reply_to_message.from_user.id
@@ -616,9 +577,7 @@ async def check_warns(_, message):
             else:
                 await message.reply_text(f"{mention_user} have no warnings.")
                 return
-            await message.reply_text(
-                f"{mention_user} have {warns}/3 warnings."
-            )
+            await message.reply_text(f"{mention_user} have {warns}/3 warnings.")
             return
         warns = await get_warn(chat_id, await int_to_alpha(user_id))
         if warns:
@@ -626,9 +585,7 @@ async def check_warns(_, message):
         else:
             await message.reply_text(f"{mention_user} have no warnings.")
             return
-        await message.reply_text(
-            f"{mention_from_user} have {warns}/3 warnings."
-        )
+        await message.reply_text(f"{mention_from_user} have {warns}/3 warnings.")
     except Exception as e:
         await message.reply_text(str(e))
 
@@ -637,8 +594,7 @@ async def check_warns(_, message):
 
 
 @app.on_message(
-    filters.command(["report", "admins"], prefixes=["@", "/"])
-    & ~filters.edited
+    filters.command(["report", "admins"], prefixes=["@", "/"]) & ~filters.edited
 )
 @capture_err
 async def report_user(_, message):

+ 3 - 11
wbb/modules/admin_misc.py

@@ -24,7 +24,6 @@ SOFTWARE.
 import os
 
 from pyrogram import filters
-
 from wbb import SUDOERS, app
 from wbb.core.decorators.errors import capture_err
 from wbb.modules.admin import member_permissions
@@ -101,17 +100,10 @@ async def set_chat_photo(_, message):
                 await message.reply_text("You Don't Have Enough Permissions.")
                 return
         if not message.reply_to_message:
-            await message.reply_text(
-                "Reply to a photo to set it as chat_photo"
-            )
+            await message.reply_text("Reply to a photo to set it as chat_photo")
             return
-        if (
-            not message.reply_to_message.photo
-            and not message.reply_to_message.document
-        ):
-            await message.reply_text(
-                "Reply to a photo to set it as chat_photo"
-            )
+        if not message.reply_to_message.photo and not message.reply_to_message.document:
+            await message.reply_text("Reply to a photo to set it as chat_photo")
             return
         photo = await message.reply_to_message.download()
         await message.chat.set_photo(photo)

+ 0 - 1
wbb/modules/alive.py

@@ -23,7 +23,6 @@ SOFTWARE.
 """
 
 from pyrogram import filters
-
 from wbb import BOT_ID, SUDOERS, USERBOT_PREFIX, app2
 
 

+ 10 - 17
wbb/modules/anime.py

@@ -6,7 +6,6 @@ from datetime import timedelta
 import requests
 from pyrogram import filters
 from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
-
 from wbb import app
 from wbb.core.decorators.errors import capture_err
 
@@ -186,9 +185,7 @@ def calculate_eta(current, total, start_time):
     end_time = time.time()
     elapsed_time = end_time - start_time
     seconds = (elapsed_time * (total / current)) - elapsed_time
-    thing = "".join(str(timedelta(seconds=seconds)).split(".")[:-1]).split(
-        ", "
-    )
+    thing = "".join(str(timedelta(seconds=seconds)).split(".")[:-1]).split(", ")
     thing[-1] = thing[-1].rjust(8, "0")
     return ", ".join(thing)
 
@@ -205,9 +202,7 @@ async def anime_search(_, message):
     search = message.text.split(None, 1)[1]
     variables = {"search": search}
     json = (
-        requests.post(
-            url, json={"query": anime_query, "variables": variables}
-        )
+        requests.post(url, json={"query": anime_query, "variables": variables})
         .json()["data"]
         .get("Media", None)
     )
@@ -267,17 +262,15 @@ async def manga_search(_, message):
     search = message.text.split(None, 1)[1]
     variables = {"search": search}
     json = (
-        requests.post(
-            url, json={"query": manga_query, "variables": variables}
-        )
+        requests.post(url, json={"query": manga_query, "variables": variables})
         .json()["data"]
         .get("Media", None)
     )
     ms_g = ""
     if json:
-        title, title_native = json["title"].get("romaji", False), json[
-            "title"
-        ].get("native", False)
+        title, title_native = json["title"].get("romaji", False), json["title"].get(
+            "native", False
+        )
         start_date, status, score = (
             json["startDate"].get("year", False),
             json.get("status", False),
@@ -319,14 +312,14 @@ async def character_search(_, message):
     search = message.text.split(None, 1)[1]
     variables = {"query": search}
     json = (
-        requests.post(
-            url, json={"query": character_query, "variables": variables}
-        )
+        requests.post(url, json={"query": character_query, "variables": variables})
         .json()["data"]
         .get("Character", None)
     )
     if json:
-        ms_g = f"**{json.get('name').get('full')}**(`{json.get('name').get('native')}`)\n"
+        ms_g = (
+            f"**{json.get('name').get('full')}**(`{json.get('name').get('native')}`)\n"
+        )
         description = f"{json['description']}"
         site_url = json.get("siteUrl")
         ms_g += shorten(description, site_url)

+ 1 - 4
wbb/modules/antiservice.py

@@ -2,7 +2,6 @@
 # Kang With Proper Credits
 
 from pyrogram import filters
-
 from wbb import app
 from wbb.core.decorators.errors import capture_err
 from wbb.modules.admin import member_permissions
@@ -42,9 +41,7 @@ async def anti_service(_, message):
             "Disabled AntiService System. I won't Be Deleting Service Message from Now on."
         )
     else:
-        await message.reply_text(
-            "Unknown Suffix, Use /antiservice [enable|disable]"
-        )
+        await message.reply_text("Unknown Suffix, Use /antiservice [enable|disable]")
 
 
 @app.on_message(filters.service, group=11)

+ 0 - 1
wbb/modules/arq.py

@@ -22,7 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
 """
 from pyrogram import filters
-
 from wbb import ARQ_API_URL, app, arq
 
 

+ 5 - 16
wbb/modules/blacklist.py

@@ -26,7 +26,6 @@ import traceback
 
 from pyrogram import filters
 from pyrogram.types import ChatPermissions
-
 from wbb import SUDOERS, app
 from wbb.core.decorators.errors import capture_err
 from wbb.modules.admin import list_admins, member_permissions
@@ -43,9 +42,7 @@ __HELP__ = """
 """
 
 
-@app.on_message(
-    filters.command("blacklist") & ~filters.edited & ~filters.private
-)
+@app.on_message(filters.command("blacklist") & ~filters.edited & ~filters.private)
 @capture_err
 async def save_filters(_, message):
     if len(message.command) < 2:
@@ -65,9 +62,7 @@ async def save_filters(_, message):
     await message.reply_text(f"__**Blacklisted {word}.**__")
 
 
-@app.on_message(
-    filters.command("blacklisted") & ~filters.edited & ~filters.private
-)
+@app.on_message(filters.command("blacklisted") & ~filters.edited & ~filters.private)
 @capture_err
 async def get_filterss(_, message):
     data = await get_blacklisted_words(message.chat.id)
@@ -80,9 +75,7 @@ async def get_filterss(_, message):
         await message.reply_text(msg)
 
 
-@app.on_message(
-    filters.command("whitelist") & ~filters.edited & ~filters.private
-)
+@app.on_message(filters.command("whitelist") & ~filters.edited & ~filters.private)
 @capture_err
 async def del_filter(_, message):
     if len(message.command) < 2:
@@ -105,9 +98,7 @@ async def del_filter(_, message):
         await message.reply_text("**No such blacklist filter.**")
 
 
-@app.on_message(
-    filters.text & ~filters.private, group=blacklist_filters_group
-)
+@app.on_message(filters.text & ~filters.private, group=blacklist_filters_group)
 async def blacklist_filters_re(_, message):
     text = message.text.lower().strip()
     if not text:
@@ -126,9 +117,7 @@ async def blacklist_filters_re(_, message):
                 if user.id in await list_admins(chat_id):
                     return
                 try:
-                    await message.chat.restrict_member(
-                        user.id, ChatPermissions()
-                    )
+                    await message.chat.restrict_member(user.id, ChatPermissions())
                 except Exception:
                     return
                 await app.send_message(

+ 0 - 1
wbb/modules/blacklist_chat.py

@@ -1,6 +1,5 @@
 from pyrogram import filters
 from pyrogram.types import Message
-
 from wbb import SUDOERS, app
 from wbb.core.decorators.errors import capture_err
 from wbb.utils.dbfunctions import (blacklist_chat, blacklisted_chats,

+ 0 - 1
wbb/modules/carbon.py

@@ -1,7 +1,6 @@
 import os
 
 from pyrogram import filters
-
 from wbb import app
 from wbb.core.decorators.errors import capture_err
 from wbb.utils.functions import make_carbon

+ 6 - 23
wbb/modules/chatbot.py

@@ -22,7 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
 """
 from pyrogram import filters
-
 from wbb import (BOT_ID, SUDOERS, USERBOT_ID, USERBOT_PREFIX, USERBOT_USERNAME,
                  app, app2, arq)
 from wbb.core.decorators.errors import capture_err
@@ -54,10 +53,7 @@ async def chatbot_status(_, message):
     if status == "ON" or status == "on" or status == "On":
         if chat_id not in active_chats_bot:
             active_chats_bot.append(chat_id)
-            text = (
-                "Chatbot Enabled Reply To Any Message "
-                + "Of Mine To Get A Reply"
-            )
+            text = "Chatbot Enabled Reply To Any Message " + "Of Mine To Get A Reply"
             await message.reply_text(text)
             return
         await message.reply_text("ChatBot Is Already Enabled.")
@@ -81,11 +77,7 @@ async def lunaQuery(query: str, user_id: int):
 
 
 @app.on_message(
-    filters.text
-    & filters.reply
-    & ~filters.bot
-    & ~filters.via_bot
-    & ~filters.forwarded,
+    filters.text & filters.reply & ~filters.bot & ~filters.via_bot & ~filters.forwarded,
     group=chatbot_group,
 )
 @capture_err
@@ -98,9 +90,7 @@ async def chatbot_talk(_, message):
         return
     query = message.text
     await app2.send_chat_action(message.chat.id, "typing")
-    response = await lunaQuery(
-        query, message.from_user.id if message.from_user else 0
-    )
+    response = await lunaQuery(query, message.from_user.id if message.from_user else 0)
     await app2.send_chat_action(message.chat.id, "cancel")
     await message.reply_text(response)
 
@@ -124,10 +114,7 @@ async def chatbot_status_ubot(_, message):
     if status == "ON" or status == "on" or status == "On":
         if chat_id not in active_chats_ubot:
             active_chats_ubot.append(chat_id)
-            text = (
-                "Chatbot Enabled Reply To Any Message "
-                + "Of Mine To Get A Reply"
-            )
+            text = "Chatbot Enabled Reply To Any Message " + "Of Mine To Get A Reply"
             await edit_or_reply(message, text=text)
             return
         await edit_or_reply(message, text="ChatBot Is Already Enabled.")
@@ -165,9 +152,7 @@ async def chatbot_talk_ubot(_, message):
         if username not in query:
             return
     await app2.send_chat_action(message.chat.id, "typing")
-    response = await lunaQuery(
-        query, message.from_user.id if message.from_user else 0
-    )
+    response = await lunaQuery(query, message.from_user.id if message.from_user else 0)
     await app2.send_chat_action(message.chat.id, "cancel")
     await message.reply_text(response)
 
@@ -182,8 +167,6 @@ async def chatbot_talk_ubot_pm(_, message):
         return
     query = message.text
     await app2.send_chat_action(message.chat.id, "typing")
-    response = await lunaQuery(
-        query, message.from_user.id if message.from_user else 0
-    )
+    response = await lunaQuery(query, message.from_user.id if message.from_user else 0)
     await message.reply_text(response)
     await app2.send_chat_action(message.chat.id, "cancel")

+ 2 - 7
wbb/modules/couple.py

@@ -25,7 +25,6 @@ import random
 from datetime import datetime
 
 from pyrogram import filters
-
 from wbb import app
 from wbb.core.decorators.errors import capture_err
 from wbb.utils.dbfunctions import get_couple, save_couple
@@ -85,9 +84,7 @@ async def couple(_, message):
 {c1_mention} + {c2_mention} = ❤️
 
 __New couple of the day may be chosen at 12AM {tomorrow}__"""
-            await app.send_message(
-                message.chat.id, text=couple_selection_message
-            )
+            await app.send_message(message.chat.id, text=couple_selection_message)
             couple = {"c1_id": c1_id, "c2_id": c2_id}
             await save_couple(chat_id, today, couple)
 
@@ -100,9 +97,7 @@ __New couple of the day may be chosen at 12AM {tomorrow}__"""
 [{c1_name}](tg://openmessage?user_id={c1_id}) + [{c2_name}](tg://openmessage?user_id={c2_id}) = ❤️
 
 __New couple of the day may be chosen at 12AM {tomorrow}__"""
-            await app.send_message(
-                message.chat.id, text=couple_selection_message
-            )
+            await app.send_message(message.chat.id, text=couple_selection_message)
     except Exception as e:
         print(e)
         await message.reply_text(e)

+ 1 - 4
wbb/modules/covid.py

@@ -22,7 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
 """
 from pyrogram import filters
-
 from wbb import app
 from wbb.core.decorators.errors import capture_err
 from wbb.utils.fetch import fetch
@@ -44,9 +43,7 @@ async def covid(_, message):
     if len(message.command) != 1:
         country = message.text.split(None, 1)[1].strip()
         country = country.replace(" ", "")
-        data = await fetch(
-            f"https://corona.lmao.ninja/v2/countries/{country}"
-        )
+        data = await fetch(f"https://corona.lmao.ninja/v2/countries/{country}")
         data = await json_prettify(data)
         await app.send_message(message.chat.id, text=data)
         return

+ 2 - 11
wbb/modules/devs.py

@@ -16,7 +16,6 @@ from time import time
 
 from pyrogram import filters
 from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
-
 from wbb import SUDOERS, app
 
 __MODULE__ = "Devs"
@@ -79,13 +78,7 @@ async def executor(client, message):
             out_file.write(str(evaluation.strip()))
         t2 = time()
         keyboard = InlineKeyboardMarkup(
-            [
-                [
-                    InlineKeyboardButton(
-                        text="⏳", callback_data=f"runtime {t2-t1} Seconds"
-                    )
-                ]
-            ]
+            [[InlineKeyboardButton(text="⏳", callback_data=f"runtime {t2-t1} Seconds")]]
         )
         await message.reply_document(
             document=filename,
@@ -162,9 +155,7 @@ async def shellrunner(client, message):
                 value=exc_obj,
                 tb=exc_tb,
             )
-            await edit_or_reply(
-                message, text=f"**ERROR:**\n```{''.join(errors)}```"
-            )
+            await edit_or_reply(message, text=f"**ERROR:**\n```{''.join(errors)}```")
             return
         output = process.stdout.read()[:-1].decode("utf-8")
     if str(output) == "\n":

+ 4 - 14
wbb/modules/filters.py

@@ -25,7 +25,6 @@ import re
 import traceback
 
 from pyrogram import filters
-
 from wbb import SUDOERS, app
 from wbb.core.decorators.errors import capture_err
 from wbb.modules.admin import member_permissions
@@ -44,9 +43,7 @@ __HELP__ = """/filters To Get All The Filters In The Chat.
 You can use markdown or html to save text too."""
 
 
-@app.on_message(
-    filters.command("filter") & ~filters.edited & ~filters.private
-)
+@app.on_message(filters.command("filter") & ~filters.edited & ~filters.private)
 @capture_err
 async def save_filters(_, message):
     chat_id = message.chat.id
@@ -56,10 +53,7 @@ async def save_filters(_, message):
             "**Usage:**\nReply to a text or sticker with /filter [FILTER_NAME] to save it."
         )
         return
-    if (
-        not message.reply_to_message.text
-        and not message.reply_to_message.sticker
-    ):
+    if not message.reply_to_message.text and not message.reply_to_message.sticker:
         await message.reply_text(
             "__**You can only save text or stickers in filters.**__"
         )
@@ -83,9 +77,7 @@ async def save_filters(_, message):
     await message.reply_text(f"__**Saved filter {name}.**__")
 
 
-@app.on_message(
-    filters.command("filters") & ~filters.edited & ~filters.private
-)
+@app.on_message(filters.command("filters") & ~filters.edited & ~filters.private)
 @capture_err
 async def get_filterss(_, message):
     _filters = await get_filters_names(message.chat.id)
@@ -147,9 +139,7 @@ async def filters_re(_, message):
                         await message.reply_to_message.reply_text(
                             data, disable_web_page_preview=True
                         )
-                    await message.reply_text(
-                        data, disable_web_page_preview=True
-                    )
+                    await message.reply_text(data, disable_web_page_preview=True)
                 else:
                     if message.reply_to_message:
                         await message.reply_to_message.reply_sticker(data)

+ 1 - 4
wbb/modules/genstr.py

@@ -4,7 +4,6 @@ from asyncio.exceptions import TimeoutError
 from pyrogram import Client, filters
 from pyrogram.errors import (PhoneCodeExpired, PhoneCodeInvalid,
                              PhoneNumberInvalid, SessionPasswordNeeded)
-
 from wbb import app
 from wbb.core.decorators.errors import capture_err
 
@@ -69,9 +68,7 @@ async def genstr(_, message):
         )
 
     except TimeoutError:
-        await message.reply_text(
-            "Time limit reached of 5 min. Process Cancelled."
-        )
+        await message.reply_text("Time limit reached of 5 min. Process Cancelled.")
         return
     otp_code = otp.text
     try:

+ 1 - 4
wbb/modules/global_stats.py

@@ -24,7 +24,6 @@ SOFTWARE.
 import asyncio
 
 from pyrogram import filters
-
 from wbb import BOT_ID, BOT_NAME, SUDOERS, app
 from wbb.core.decorators.errors import capture_err
 from wbb.modules import ALL_MODULES
@@ -39,9 +38,7 @@ from wbb.utils.inlinefuncs import keywords_list
 """ CHAT WATCHER IS IN filters.py"""
 
 
-@app.on_message(
-    filters.command("gstats") & filters.user(SUDOERS) & ~filters.edited
-)
+@app.on_message(filters.command("gstats") & filters.user(SUDOERS) & ~filters.edited)
 @capture_err
 async def global_stats(_, message):
     m = await app.send_message(

+ 6 - 19
wbb/modules/greetings.py

@@ -33,7 +33,6 @@ from pyrogram.errors.exceptions.bad_request_400 import (ChatAdminRequired,
                                                         UserNotParticipant)
 from pyrogram.types import (ChatPermissions, InlineKeyboardButton,
                             InlineKeyboardMarkup, Message, User)
-
 from wbb import SUDOERS, WELCOME_DELAY_KICK_SEC, app
 from wbb.core.decorators.errors import capture_err
 from wbb.modules.admin import member_permissions
@@ -176,9 +175,7 @@ async def welcome(_, message: Message):
         """ Save captcha answers etc in mongodb in case bot gets crashed or restarted. """
         await update_captcha_cache(answers_dicc)
         asyncio.create_task(
-            kick_restricted_after_delay(
-                WELCOME_DELAY_KICK_SEC, button_message, member
-            )
+            kick_restricted_after_delay(WELCOME_DELAY_KICK_SEC, button_message, member)
         )
         await asyncio.sleep(0.5)
 
@@ -196,9 +193,7 @@ async def send_welcome_message(callback_query, pending_user_id):
     if "{chat}" in text:
         text = text.replace("{chat}", callback_query.message.chat.title)
     if "{name}" in text:
-        text = text.replace(
-            "{name}", (await app.get_users(pending_user_id)).mention
-        )
+        text = text.replace("{name}", (await app.get_users(pending_user_id)).mention)
     buttons = InlineKeyboard(row_width=2)
     list_of_buttons = []
     for button_string in buttons_text_list:
@@ -208,9 +203,7 @@ async def send_welcome_message(callback_query, pending_user_id):
         button_string = button_string.split(",")
         button_text = button_string[0].strip()
         button_url = button_string[1].strip()
-        list_of_buttons.append(
-            InlineKeyboardButton(text=button_text, url=button_url)
-        )
+        list_of_buttons.append(InlineKeyboardButton(text=button_text, url=button_url))
     buttons.add(*list_of_buttons)
     await app.send_message(
         callback_query.message.chat.id,
@@ -253,9 +246,7 @@ async def callback_query_welcome_button(_, callback_query):
                         answers_dicc.remove(iii)
                         await button_message.chat.kick_member(pending_user_id)
                         await asyncio.sleep(1)
-                        await button_message.chat.unban_member(
-                            pending_user_id
-                        )
+                        await button_message.chat.unban_member(pending_user_id)
                         await button_message.delete()
                         await update_captcha_cache(answers_dicc)
                         return
@@ -290,9 +281,7 @@ async def callback_query_welcome_button(_, callback_query):
         return
 
 
-async def kick_restricted_after_delay(
-    delay, button_message: Message, user: User
-):
+async def kick_restricted_after_delay(delay, button_message: Message, user: User):
     """If the new member is still restricted after the delay, delete
     button message and join message and then kick him
     """
@@ -311,9 +300,7 @@ async def kick_restricted_after_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:
         member = await group_chat.get_member(user_id)
         if member.status == "restricted":

+ 1 - 4
wbb/modules/images.py

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

+ 2 - 1
wbb/modules/info.py

@@ -2,7 +2,6 @@ import os
 
 from pyrogram import filters
 from pyrogram.types import Message
-
 from wbb import SUDOERS, app
 from wbb.core.decorators.errors import capture_err
 from wbb.utils.dbfunctions import is_gbanned_user, user_global_karma
@@ -16,6 +15,8 @@ __HELP__ = """
 
 async def get_user_info(user):
     user = await app.get_users(user)
+    if not user.first_name:
+        return ["Deleted account", None]
     user_id = user.id
     username = user.username
     first_name = user.first_name

+ 18 - 54
wbb/modules/inline.py

@@ -39,15 +39,11 @@ async def inline_query_handler(client, query):
         answers = []
         if text.strip() == "":
             answerss = await inline_help_func(__HELP__)
-            await client.answer_inline_query(
-                query.id, results=answerss, cache_time=10
-            )
+            await client.answer_inline_query(query.id, results=answerss, cache_time=10)
             return
         elif text.split()[0] == "alive":
             answerss = await alive_function(answers)
-            await client.answer_inline_query(
-                query.id, results=answerss, cache_time=10
-            )
+            await client.answer_inline_query(query.id, results=answerss, cache_time=10)
         elif text.split()[0] == "tr":
             if len(text.split()) < 3:
                 await client.answer_inline_query(
@@ -105,9 +101,7 @@ async def inline_query_handler(client, query):
                 return
             tex = text.split(None, 1)[1].strip()
             answerss = await shortify(tex)
-            await client.answer_inline_query(
-                query.id, results=answerss, cache_time=2
-            )
+            await client.answer_inline_query(query.id, results=answerss, cache_time=2)
 
         elif text.split()[0] == "wall":
             if len(text.split()) < 2:
@@ -202,9 +196,7 @@ async def inline_query_handler(client, query):
                 return
             tex = text.split(None, 1)[1].strip()
             answerss = await github_user_func(answers, tex)
-            await client.answer_inline_query(
-                query.id, results=answerss, cache_time=2
-            )
+            await client.answer_inline_query(query.id, results=answerss, cache_time=2)
 
         elif text.split()[0] == "gh_repo":
             if len(text.split()) < 2:
@@ -217,9 +209,7 @@ async def inline_query_handler(client, query):
                 return
             tex = text.split(None, 1)[1].strip()
             answerss = await github_repo_func(answers, tex)
-            await client.answer_inline_query(
-                query.id, results=answerss, cache_time=2
-            )
+            await client.answer_inline_query(query.id, results=answerss, cache_time=2)
 
         elif text.split()[0] == "search":
             if len(text.split()) < 2:
@@ -233,9 +223,7 @@ async def inline_query_handler(client, query):
             user_id = query.from_user.id
             tex = text.split(None, 1)[1].strip()
             answerss = await tg_search_func(answers, tex, user_id)
-            await client.answer_inline_query(
-                query.id, results=answerss, cache_time=2
-            )
+            await client.answer_inline_query(query.id, results=answerss, cache_time=2)
 
         elif text.split()[0] == "music":
             if len(text.split()) < 2:
@@ -248,9 +236,7 @@ async def inline_query_handler(client, query):
                 return
             tex = text.split(None, 1)[1].strip()
             answerss = await music_inline_func(answers, tex)
-            await client.answer_inline_query(
-                query.id, results=answerss, cache_time=2
-            )
+            await client.answer_inline_query(query.id, results=answerss, cache_time=2)
 
         elif text.split()[0] == "wiki":
             if len(text.split()) < 2:
@@ -263,15 +249,11 @@ async def inline_query_handler(client, query):
                 return
             tex = text.split(None, 1)[1].strip()
             answerss = await wiki_func(answers, tex)
-            await client.answer_inline_query(
-                query.id, results=answerss, cache_time=2
-            )
+            await client.answer_inline_query(query.id, results=answerss, cache_time=2)
 
         elif text.split()[0] == "speedtest":
             answerss = await speedtest_init(query)
-            await client.answer_inline_query(
-                query.id, results=answerss, cache_time=2
-            )
+            await client.answer_inline_query(query.id, results=answerss, cache_time=2)
             return
 
         elif text.split()[0] == "paste":
@@ -285,9 +267,7 @@ async def inline_query_handler(client, query):
                 return
             link = text.strip().split()[1]
             answerss = await pastebin_func(answers, link)
-            await client.answer_inline_query(
-                query.id, results=answerss, cache_time=2
-            )
+            await client.answer_inline_query(query.id, results=answerss, cache_time=2)
             return
 
         elif text.split()[0] == "carbon":
@@ -301,25 +281,19 @@ async def inline_query_handler(client, query):
                 return
             link = text.split()[1]
             answerss = await carbon_inline_func(answers, link)
-            await client.answer_inline_query(
-                query.id, results=answerss, cache_time=2
-            )
+            await client.answer_inline_query(query.id, results=answerss, cache_time=2)
             return
 
         elif text.split()[0] == "pmpermit":
             user_id = query.from_user.id
             victim = text.split()[1]
             answerss = await pmpermit_func(answers, user_id, victim)
-            await client.answer_inline_query(
-                query.id, results=answerss, cache_time=2
-            )
+            await client.answer_inline_query(query.id, results=answerss, cache_time=2)
             return
 
         elif text.split()[0] == "ping":
             answerss = await ping_func(answers)
-            await client.answer_inline_query(
-                query.id, results=answerss, cache_time=2
-            )
+            await client.answer_inline_query(query.id, results=answerss, cache_time=2)
             return
 
         elif text.split()[0] == "nsfw_scan":
@@ -333,9 +307,7 @@ async def inline_query_handler(client, query):
                 return
             tex = text.split(None, 1)[1].strip()
             answerss = await nsfw_scan_func(answers, tex)
-            await client.answer_inline_query(
-                query.id, results=answerss, cache_time=2
-            )
+            await client.answer_inline_query(query.id, results=answerss, cache_time=2)
 
         elif text.split()[0] == "ytmusic":
             if len(text.split()) < 2:
@@ -349,9 +321,7 @@ async def inline_query_handler(client, query):
             tex = query.query.split(None, 1)[1].strip()
             user_id = query.from_user.id
             answerss = await yt_music_func(answers, tex, user_id)
-            await client.answer_inline_query(
-                query.id, results=answerss, cache_time=2
-            )
+            await client.answer_inline_query(query.id, results=answerss, cache_time=2)
 
         elif text.split()[0] == "info":
             if len(text.split()) < 2:
@@ -364,9 +334,7 @@ async def inline_query_handler(client, query):
                 return
             tex = text.split()[1].strip()
             answerss = await user_info_inline_func(answers, tex)
-            await client.answer_inline_query(
-                query.id, results=answerss, cache_time=2
-            )
+            await client.answer_inline_query(query.id, results=answerss, cache_time=2)
 
         elif text.split()[0] == "chat_info":
             if len(text.split()) < 2:
@@ -379,9 +347,7 @@ async def inline_query_handler(client, query):
                 return
             tex = text.split()[1].strip()
             answerss = await chat_info_inline_func(answers, tex)
-            await client.answer_inline_query(
-                query.id, results=answerss, cache_time=2
-            )
+            await client.answer_inline_query(query.id, results=answerss, cache_time=2)
 
         elif text.split()[0] == "tmdb":
             if len(text.split()) < 2:
@@ -395,9 +361,7 @@ async def inline_query_handler(client, query):
                 return
             tex = text.split()[1].strip()
             answerss = await tmdb_func(answers, tex)
-            await client.answer_inline_query(
-                query.id, results=answerss, cache_time=2
-            )
+            await client.answer_inline_query(query.id, results=answerss, cache_time=2)
     except Exception as e:
         e = traceback.format_exc()
         print(e, " InLine")

+ 13 - 11
wbb/modules/karma.py

@@ -21,8 +21,9 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
 """
-from pyrogram import filters
+import asyncio
 
+from pyrogram import filters
 from wbb import app
 from wbb.core.decorators.errors import capture_err
 from wbb.modules.admin import member_permissions
@@ -39,9 +40,7 @@ Reply to a message with /karma to check a user's karma
 Send /karma without replying to any message to chek karma list of top 10 users"""
 
 
-regex_upvote = (
-    r"^((?i)\+|\+\+|\+1|thx|tnx|ty|thank you|thanx|thanks|pro|cool|good|👍)$"
-)
+regex_upvote = r"^((?i)\+|\+\+|\+1|thx|tnx|ty|thank you|thanx|thanks|pro|cool|good|👍)$"
 regex_downvote = r"^(\-|\-\-|\-1|👎)$"
 
 
@@ -128,8 +127,8 @@ async def downvote(_, message):
 @capture_err
 async def karma(_, message):
     chat_id = message.chat.id
-
     if not message.reply_to_message:
+        m = await message.reply_text("Analyzing Karma...Will Take 20 Seconds")
         karma = await get_karmas(chat_id)
         msg = f"**Karma list of {message.chat.title}:- **\n"
         limit = 0
@@ -139,25 +138,28 @@ async def karma(_, message):
             user_karma = karma[i]["karma"]
             karma_dicc[str(user_id)] = user_karma
             karma_arranged = dict(
-                sorted(
-                    karma_dicc.items(), key=lambda item: item[1], reverse=True
-                )
+                sorted(karma_dicc.items(), key=lambda item: item[1], reverse=True)
             )
         if not karma_arranged:
-            await message.reply_text("No karma in DB for this chat.")
+            await m.edit("No karma in DB for this chat.")
             return
         for user_idd, karma_count in karma_arranged.items():
             if limit > 9:
                 break
             try:
                 user = await app.get_users(int(user_idd))
+                await asyncio.sleep(2)
             except Exception:
                 continue
             first_name = user.first_name
+            if not first_name:
+                continue
             username = user.username
-            msg += f"{first_name} [{username if username else ''} `{user_idd}`]: `{karma_count}`\n"
+            msg += (
+                f"**{karma_count}**  {(first_name[0:12] + '...') if len(first_name) > 12 else first_name}  `{('@' + username) if username else user_idd}`\n"
+            )
             limit += 1
-        await message.reply_text(msg)
+        await m.edit(msg)
     else:
         user_id = message.reply_to_message.from_user.id
         karma = await get_karma(chat_id, await int_to_alpha(user_id))

+ 3 - 11
wbb/modules/locks.py

@@ -24,7 +24,6 @@ SOFTWARE.
 from pyrogram import filters
 from pyrogram.errors.exceptions.bad_request_400 import ChatNotModified
 from pyrogram.types import ChatPermissions
-
 from wbb import SUDOERS, app
 from wbb.core.decorators.errors import capture_err
 from wbb.modules.admin import current_chat_permissions, member_permissions
@@ -72,13 +71,9 @@ async def tg_lock(message, permissions: list, perm: str, lock: bool):
     (permissions.remove(perm) if lock else permissions.append(perm))
     permissions = {perm: True for perm in list(set(permissions))}
     try:
-        await app.set_chat_permissions(
-            message.chat.id, ChatPermissions(**permissions)
-        )
+        await app.set_chat_permissions(message.chat.id, ChatPermissions(**permissions))
     except ChatNotModified:
-        await message.reply_text(
-            "To unlock this, you have to unlock 'messages' first."
-        )
+        await message.reply_text("To unlock this, you have to unlock 'messages' first.")
         return
     await message.reply_text(("Locked." if lock else "Unlocked."))
 
@@ -100,10 +95,7 @@ async def locks_func(_, message):
             return
 
         permissions = await member_permissions(chat_id, user_id)
-        if (
-            "can_restrict_members" not in permissions
-            and user_id not in SUDOERS
-        ):
+        if "can_restrict_members" not in permissions and user_id not in SUDOERS:
             await message.reply_text("You Don't Have Enough Permissions.")
             return
 

+ 10 - 15
wbb/modules/misc.py

@@ -28,7 +28,6 @@ import aiohttp
 from cryptography.fernet import Fernet
 from googletrans import Translator
 from pyrogram import filters
-
 from wbb import FERNET_ENCRYPTION_KEY, app
 from wbb.core.decorators.errors import capture_err
 from wbb.utils import random_line
@@ -64,9 +63,7 @@ async def rtfm(_, message):
     if not message.reply_to_message:
         await message.reply_text("Reply To A Message lol")
         return
-    await message.reply_to_message.reply_text(
-        "Are You Lost? READ THE FUCKING DOCS!"
-    )
+    await message.reply_to_message.reply_text("Are You Lost? READ THE FUCKING DOCS!")
 
 
 @app.on_message(filters.command("runs") & ~filters.edited)
@@ -83,7 +80,9 @@ async def getid(_, message):
         return
     text_unping = "<b>Chat ID:</b>"
     if message.chat.username:
-        text_unping = f'<a href="https://t.me/{message.chat.username}">{text_unping}</a>'
+        text_unping = (
+            f'<a href="https://t.me/{message.chat.username}">{text_unping}</a>'
+        )
     text_unping += f" <code>{message.chat.id}</code>\n"
     text = "<b>Message ID:</b>"
     if message.link:
@@ -113,7 +112,9 @@ async def getid(_, message):
             text_unping += "\n"
             text = "<b>Forwarded User ID:</b>"
             if reply.forward_from.username:
-                text = f'<a href="https://t.me/{reply.forward_from.username}">{text}</a>'
+                text = (
+                    f'<a href="https://t.me/{reply.forward_from.username}">{text}</a>'
+                )
             text += f" <code>{reply.forward_from.id}</code>\n"
             text_unping += text
             text_ping += f'\n<b><a href="tg://user?id={reply.forward_from.id}">Forwarded User ID:</a></b> <code>{reply.forward_from.id}</code>\n'
@@ -133,18 +134,14 @@ async def getid(_, message):
 @capture_err
 async def random(_, message):
     if len(message.command) != 2:
-        await message.reply_text(
-            '"/random" Needs An Argurment.' " Ex: `/random 5`"
-        )
+        await message.reply_text('"/random" Needs An Argurment.' " Ex: `/random 5`")
         return
     length = message.text.split(None, 1)[1]
 
     try:
         if 1 < int(length) < 1000:
             alphabet = string.ascii_letters + string.digits
-            password = "".join(
-                secrets.choice(alphabet) for i in range(int(length))
-            )
+            password = "".join(secrets.choice(alphabet) for i in range(int(length)))
             await message.reply_text(f"`{password}`")
         else:
             await message.reply_text("Specify A Length Between 1-1000")
@@ -189,9 +186,7 @@ async def decrypt(_, message):
 
 
 async def fetch_text(url):
-    async with aiohttp.ClientSession(
-        headers={"user-agent": "curl"}
-    ) as session:
+    async with aiohttp.ClientSession(headers={"user-agent": "curl"}) as session:
         async with session.get(url) as resp:
             data = await resp.text()
     return data

+ 4 - 13
wbb/modules/music.py

@@ -32,7 +32,6 @@ import aiohttp
 import ffmpeg
 import youtube_dl
 from pyrogram import filters
-
 from wbb import SUDOERS, app, arq
 from wbb.core.decorators.errors import capture_err
 from wbb.utils.pastebin import paste
@@ -63,9 +62,7 @@ async def download_youtube_audio(url: str, m=0):
         info_dict = ydl.extract_info(url, download=False)
         if int(float(info_dict["duration"])) > 600:
             if m != 0:
-                await m.edit(
-                    "This music cannot be downloaded as it's too long."
-                )
+                await m.edit("This music cannot be downloaded as it's too long.")
             is_downloading = False
             return
         ydl.process_info(info_dict)
@@ -79,18 +76,14 @@ async def download_youtube_audio(url: str, m=0):
             os.remove(audio_file)
             audio_file = audio_file_opus
         thumbnail_url = info_dict["thumbnail"]
-        thumbnail_file = (
-            basename + "." + get_file_extension_from_url(thumbnail_url)
-        )
+        thumbnail_file = basename + "." + get_file_extension_from_url(thumbnail_url)
         title = info_dict["title"]
         performer = info_dict["uploader"]
         duration = int(float(info_dict["duration"]))
     return [title, performer, duration, audio_file, thumbnail_file]
 
 
-@app.on_message(
-    filters.command("ytmusic") & ~filters.edited & filters.user(SUDOERS)
-)
+@app.on_message(filters.command("ytmusic") & ~filters.edited & filters.user(SUDOERS))
 @capture_err
 async def music(_, message):
     global is_downloading
@@ -104,9 +97,7 @@ async def music(_, message):
         )
         return
     is_downloading = True
-    m = await message.reply_text(
-        f"Downloading {url}", disable_web_page_preview=True
-    )
+    m = await message.reply_text(f"Downloading {url}", disable_web_page_preview=True)
     try:
         (
             title,

+ 6 - 22
wbb/modules/notes.py

@@ -22,7 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
 """
 from pyrogram import filters
-
 from wbb import app
 from wbb.core.decorators.errors import capture_err
 from wbb.modules.admin import member_permissions
@@ -44,18 +43,10 @@ async def save_notee(_, message):
             "**Usage:**\nReply to a text or sticker with /save [NOTE_NAME] to save it."
         )
 
-    elif (
-        not message.reply_to_message.text
-        and not message.reply_to_message.sticker
-    ):
-        await message.reply_text(
-            "__**You can only save text or stickers in notes.**__"
-        )
+    elif not message.reply_to_message.text and not message.reply_to_message.sticker:
+        await message.reply_text("__**You can only save text or stickers in notes.**__")
 
-    elif (
-        len(await member_permissions(message.chat.id, message.from_user.id))
-        < 1
-    ):
+    elif len(await member_permissions(message.chat.id, message.from_user.id)) < 1:
         await message.reply_text("**You don't have enough permissions**")
     else:
         name = message.text.split(None, 1)[1].strip()
@@ -103,25 +94,18 @@ async def get_one_note(_, message):
             await message.reply_text("**No such note.**")
         else:
             if _note["type"] == "text":
-                await message.reply_text(
-                    _note["data"], disable_web_page_preview=True
-                )
+                await message.reply_text(_note["data"], disable_web_page_preview=True)
             else:
                 await message.reply_sticker(_note["data"])
 
 
-@app.on_message(
-    filters.command("delete") & ~filters.edited & ~filters.private
-)
+@app.on_message(filters.command("delete") & ~filters.edited & ~filters.private)
 @capture_err
 async def del_note(_, message):
     if len(message.command) < 2:
         await message.reply_text("**Usage**\n__/delete [NOTE_NAME]__")
 
-    elif (
-        len(await member_permissions(message.chat.id, message.from_user.id))
-        < 1
-    ):
+    elif len(await member_permissions(message.chat.id, message.from_user.id)) < 1:
         await message.reply_text("**You don't have enough permissions**")
 
     else:

+ 2 - 7
wbb/modules/paste.py

@@ -25,7 +25,6 @@ import asyncio
 import os
 
 from pyrogram import filters
-
 from wbb import app
 from wbb.core.decorators.errors import capture_err
 from wbb.utils.functions import get_http_status_code
@@ -58,14 +57,10 @@ async def paste_func(_, message):
 
         elif message.reply_to_message.document:
             if message.reply_to_message.document.file_size > 1048576:
-                await message.reply_text(
-                    "You can only paste files smaller than 1MB."
-                )
+                await message.reply_text("You can only paste files smaller than 1MB.")
                 return
             m = await message.reply_text("Pasting...")
-            doc_file = await message.reply_to_message.download(
-                file_name="paste.txt"
-            )
+            doc_file = await message.reply_to_message.download(file_name="paste.txt")
             i = open(doc_file, "r")
             link = await paste(i.read())
             preview = link + "/preview.png"

+ 1 - 6
wbb/modules/pipes.py

@@ -25,7 +25,6 @@ import asyncio
 
 from pyrogram import filters
 from pyrogram.types import Message
-
 from wbb import BOT_ID, SUDOERS, USERBOT_ID, app, app2
 from wbb.core.decorators.errors import capture_err
 from wbb.utils.dbfunctions import (activate_pipe, deactivate_pipe,
@@ -95,11 +94,7 @@ async def pipes_worker_userbot(_, message: Message):
                     app.listen(USERBOT_ID), message.copy(BOT_ID)
                 )
                 caption = f"Forwarded from `{pipe['from_chat_id']}`"
-                caption = (
-                    f"{temp.caption}\n\n{caption}"
-                    if temp.caption
-                    else caption
-                )
+                caption = f"{temp.caption}\n\n{caption}" if temp.caption else caption
                 await app.copy_message(
                     pipe["to_chat_id"],
                     USERBOT_ID,

+ 4 - 13
wbb/modules/pmpermit.py

@@ -23,7 +23,6 @@ SOFTWARE.
 """
 
 from pyrogram import filters
-
 from wbb import BOT_ID, SUDOERS, USERBOT_ID, USERBOT_PREFIX, app, app2
 from wbb.core.decorators.errors import capture_err
 from wbb.modules.userbot import edit_or_reply
@@ -70,9 +69,7 @@ async def pmpermit_func(_, message):
 @capture_err
 async def pm_approve(_, message):
     if not message.reply_to_message:
-        await edit_or_reply(
-            message, text="Reply to a user's message to approve."
-        )
+        await edit_or_reply(message, text="Reply to a user's message to approve.")
         return
     user_id = message.reply_to_message.from_user.id
     if await is_pmpermit_approved(user_id):
@@ -89,9 +86,7 @@ async def pm_approve(_, message):
 )
 async def pm_disapprove(_, message):
     if not message.reply_to_message:
-        await edit_or_reply(
-            message, text="Reply to a user's message to approve."
-        )
+        await edit_or_reply(message, text="Reply to a user's message to approve.")
         return
     user_id = message.reply_to_message.from_user.id
     if not await is_pmpermit_approved(user_id):
@@ -115,9 +110,7 @@ async def pm_disapprove(_, message):
 @capture_err
 async def block_user_func(_, message):
     if not message.reply_to_message:
-        await edit_or_reply(
-            message, text="Reply to a user's message to block."
-        )
+        await edit_or_reply(message, text="Reply to a user's message to block.")
         return
     user_id = message.reply_to_message.from_user.id
     await app2.block_user(user_id)
@@ -131,9 +124,7 @@ async def block_user_func(_, message):
 )
 async def unblock_user_func(_, message):
     if not message.reply_to_message:
-        await edit_or_reply(
-            message, text="Reply to a user's message to unblock."
-        )
+        await edit_or_reply(message, text="Reply to a user's message to unblock.")
         return
     user_id = message.reply_to_message.from_user.id
     await app2.unblock_user(user_id)

+ 2 - 7
wbb/modules/quotly.py

@@ -2,7 +2,6 @@ from io import BytesIO
 
 from pyrogram import filters
 from pyrogram.types import Message
-
 from wbb import app, arq
 from wbb.core.decorators.errors import capture_err
 
@@ -44,9 +43,7 @@ async def quotly_func(_, message: Message):
         await message.reply_text("Reply to a message to quote it.")
         return
     if not message.reply_to_message.text:
-        await message.reply_text(
-            "Replied message has no text, can't quote it."
-        )
+        await message.reply_text("Replied message has no text, can't quote it.")
         return
     m = await message.reply_text("Quoting Messages")
     if len(message.command) < 2:
@@ -83,9 +80,7 @@ async def quotly_func(_, message: Message):
             )
             messages = [reply_message]
     else:
-        await m.edit(
-            "Incorrect argument, check quotly module in help section."
-        )
+        await m.edit("Incorrect argument, check quotly module in help section.")
         return
     try:
         sticker = await quotify(messages)

+ 0 - 1
wbb/modules/reddit.py

@@ -22,7 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
 """
 from pyrogram import filters
-
 from wbb import app, arq
 from wbb.core.decorators.errors import capture_err
 

+ 1 - 4
wbb/modules/regex.py

@@ -25,7 +25,6 @@ import re
 import sre_constants
 
 from pyrogram import filters
-
 from wbb import app
 from wbb.utils.filter_groups import regex_group
 
@@ -71,9 +70,7 @@ async def sed(_, message):
             if "i" in flags and "g" in flags:
                 text = re.sub(repl, repl_with, to_fix, flags=re.I).strip()
             elif "i" in flags:
-                text = re.sub(
-                    repl, repl_with, to_fix, count=1, flags=re.I
-                ).strip()
+                text = re.sub(repl, repl_with, to_fix, count=1, flags=re.I).strip()
             elif "g" in flags:
                 text = re.sub(repl, repl_with, to_fix).strip()
             else:

+ 3 - 10
wbb/modules/repo.py

@@ -22,15 +22,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
 """
 from pyrogram import filters
-
 from wbb import app
 from wbb.core.decorators.errors import capture_err
 from wbb.utils.fetch import fetch
 
 __MODULE__ = "Repo"
-__HELP__ = (
-    "/repo - To Get My Github Repository Link " "And Support Group Link"
-)
+__HELP__ = "/repo - To Get My Github Repository Link " "And Support Group Link"
 
 
 @app.on_message(filters.command("repo") & ~filters.edited)
@@ -42,9 +39,7 @@ async def repo(_, message):
     list_of_users = ""
     count = 1
     for user in users:
-        list_of_users += (
-            f"**{count}.** [{user['login']}]({user['html_url']})\n"
-        )
+        list_of_users += f"**{count}.** [{user['login']}]({user['html_url']})\n"
         count += 1
 
     text = f"""[Github](https://github.com/thehamkercat/WilliamButcherBot) | [Group](t.me/PatheticProgrammers)
@@ -52,6 +47,4 @@ async def repo(_, message):
 | Contributors |
 ----------------```
 {list_of_users}"""
-    await app.send_message(
-        message.chat.id, text=text, disable_web_page_preview=True
-    )
+    await app.send_message(message.chat.id, text=text, disable_web_page_preview=True)

+ 2 - 7
wbb/modules/reverse.py

@@ -6,7 +6,6 @@ import aiohttp
 import requests
 from bs4 import BeautifulSoup
 from pyrogram import filters
-
 from wbb import SUDOERS, app
 from wbb.core.decorators.errors import capture_err
 
@@ -59,9 +58,7 @@ async def reverse_image_search(_, message):
 
     if reply.animation:
         if not reply.animation.thumbs:
-            await m.edit(
-                "Gif Has No Thumbnail, so it cannot be reverse searched"
-            )
+            await m.edit("Gif Has No Thumbnail, so it cannot be reverse searched")
             return
         file_id = reply.animation.thumbs[0].file_id
 
@@ -77,9 +74,7 @@ async def reverse_image_search(_, message):
                 "encoded_image": (image, await f.read()),
                 "image_content": "",
             }
-            response = requests.post(
-                search_url, files=multipart, allow_redirects=False
-            )
+            response = requests.post(search_url, files=multipart, allow_redirects=False)
             location = response.headers.get("Location")
             os.remove(image)
         else:

+ 3 - 10
wbb/modules/rice.py

@@ -24,7 +24,6 @@ SOFTWARE.
 from pyrogram import filters
 from pyrogram.types import (InlineKeyboardButton, InlineKeyboardMarkup,
                             InputMediaPhoto, InputMediaVideo, Message)
-
 from wbb import app
 from wbb.core.decorators.errors import capture_err
 
@@ -50,9 +49,7 @@ async def rice(_, message: Message):
         reply_markup=InlineKeyboardMarkup(
             [
                 [
-                    InlineKeyboardButton(
-                        "Approve (Forward)", callback_data="forward"
-                    ),
+                    InlineKeyboardButton("Approve (Forward)", callback_data="forward"),
                     InlineKeyboardButton("Ignore", callback_data="ignore"),
                 ]
             ]
@@ -81,15 +78,11 @@ async def callback_query_forward_rice(_, callback_query):
         arg_media = []
         for m in media_group:
             if m.photo and m.caption:
-                arg_media.append(
-                    InputMediaPhoto(m.photo.file_id, caption=arg_caption)
-                )
+                arg_media.append(InputMediaPhoto(m.photo.file_id, caption=arg_caption))
             elif m.photo:
                 arg_media.append(InputMediaPhoto(m.photo.file_id))
             elif m.video and m.caption:
-                arg_media.append(
-                    InputMediaVideo(m.video.file_id, caption=arg_caption)
-                )
+                arg_media.append(InputMediaVideo(m.video.file_id, caption=arg_caption))
             elif m.video:
                 arg_media.append(InputMediaVideo(m.video.file_id))
         m_cp = await app.send_media_group(RICE_CHANNEL, arg_media)

+ 2 - 8
wbb/modules/stickers.py

@@ -30,7 +30,6 @@ from pyrogram.errors.exceptions.bad_request_400 import (PeerIdInvalid,
                                                         StickerPngNopng,
                                                         UserIsBlocked)
 from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
-
 from wbb import BOT_USERNAME, app
 from wbb.core.decorators.errors import capture_err
 from wbb.utils.files import (get_document_from_file_id,
@@ -73,10 +72,7 @@ async def kang(client, message):
     args = message.text.split()
     if len(args) > 1:
         sticker_emoji = str(args[1])
-    elif (
-        message.reply_to_message.sticker
-        and message.reply_to_message.sticker.emoji
-    ):
+    elif message.reply_to_message.sticker and message.reply_to_message.sticker.emoji:
         sticker_emoji = message.reply_to_message.sticker.emoji
     else:
         sticker_emoji = "🤔"
@@ -85,9 +81,7 @@ async def kang(client, message):
     doc = message.reply_to_message.photo or message.reply_to_message.document
     if message.reply_to_message.sticker:
         sticker = await create_sticker(
-            await get_document_from_file_id(
-                message.reply_to_message.sticker.file_id
-            ),
+            await get_document_from_file_id(message.reply_to_message.sticker.file_id),
             sticker_emoji,
         )
     elif doc:

+ 4 - 10
wbb/modules/sudo.py

@@ -25,7 +25,6 @@ import os
 
 from pyrogram import filters
 from pyrogram.types import Message
-
 from wbb import BOT_ID, SUDOERS, USERBOT_PREFIX, app2
 from wbb.core.decorators.errors import capture_err
 from wbb.modules.userbot import edit_or_reply
@@ -48,8 +47,7 @@ can even delete your account.
 
 
 @app2.on_message(
-    filters.command("useradd", prefixes=USERBOT_PREFIX)
-    & filters.user(SUDOERS)
+    filters.command("useradd", prefixes=USERBOT_PREFIX) & filters.user(SUDOERS)
 )
 @capture_err
 async def useradd(_, message: Message):
@@ -64,9 +62,7 @@ async def useradd(_, message: Message):
         await edit_or_reply(message, text="User is already in sudoers.")
         return
     if user_id == BOT_ID:
-        await edit_or_reply(
-            message, text="You can't add assistant bot in sudoers."
-        )
+        await edit_or_reply(message, text="You can't add assistant bot in sudoers.")
         return
     added = await add_sudo(user_id)
     if added:
@@ -80,8 +76,7 @@ async def useradd(_, message: Message):
 
 
 @app2.on_message(
-    filters.command("userdel", prefixes=USERBOT_PREFIX)
-    & filters.user(SUDOERS)
+    filters.command("userdel", prefixes=USERBOT_PREFIX) & filters.user(SUDOERS)
 )
 @capture_err
 async def userdel(_, message: Message):
@@ -107,8 +102,7 @@ async def userdel(_, message: Message):
 
 
 @app2.on_message(
-    filters.command("sudoers", prefixes=USERBOT_PREFIX)
-    & filters.user(SUDOERS)
+    filters.command("sudoers", prefixes=USERBOT_PREFIX) & filters.user(SUDOERS)
 )
 @capture_err
 async def sudoers_list(_, message: Message):

+ 8 - 25
wbb/modules/sudoers.py

@@ -28,7 +28,6 @@ import time
 
 import psutil
 from pyrogram import filters
-
 from wbb import (BOT_ID, GBAN_LOG_GROUP_ID, SUDOERS, USERBOT_USERNAME, app,
                  bot_start_time)
 from wbb.core.decorators.errors import capture_err
@@ -81,9 +80,7 @@ async def get_stats(_, message):
 async def ban_globally(_, message):
     if not message.reply_to_message:
         if len(message.command) < 3:
-            await message.reply_text(
-                "**Usage:**\n/gban [USERNAME | USER_ID] [REASON]"
-            )
+            await message.reply_text("**Usage:**\n/gban [USERNAME | USER_ID] [REASON]")
             return
         user = message.text.split(None, 2)[1]
         reason = message.text.split(None, 2)[2]
@@ -98,9 +95,7 @@ async def ban_globally(_, message):
                 "Should i gban myself? I'm not fool like you, HUMAN!"
             )
         elif user.id in SUDOERS:
-            await message.reply_text(
-                "You want to ban a sudo user? GET REKT!!"
-            )
+            await message.reply_text("You want to ban a sudo user? GET REKT!!")
         else:
             served_chats = await get_served_chats()
             m = await message.reply_text(
@@ -111,9 +106,7 @@ async def ban_globally(_, message):
             number_of_chats = 0
             for served_chat in served_chats:
                 try:
-                    await app.kick_chat_member(
-                        served_chat["chat_id"], user.id
-                    )
+                    await app.kick_chat_member(served_chat["chat_id"], user.id)
                     number_of_chats += 1
                     await asyncio.sleep(1)
                 except Exception:
@@ -162,9 +155,7 @@ __**New Global Ban**__
     if user_id == from_user_id:
         await message.reply_text("You want to gban yourself? FOOL!")
     elif user_id == BOT_ID:
-        await message.reply_text(
-            "Should i gban myself? I'm not fool like you, HUMAN!"
-        )
+        await message.reply_text("Should i gban myself? I'm not fool like you, HUMAN!")
     elif user_id in SUDOERS:
         await message.reply_text("You want to ban a sudo user? GET REKT!!")
     else:
@@ -180,9 +171,7 @@ __**New Global Ban**__
             number_of_chats = 0
             for served_chat in served_chats:
                 try:
-                    await app.kick_chat_member(
-                        served_chat["chat_id"], user_id
-                    )
+                    await app.kick_chat_member(served_chat["chat_id"], user_id)
                     number_of_chats += 1
                     await asyncio.sleep(1)
                 except Exception:
@@ -243,9 +232,7 @@ async def unban_globally(_, message):
         if user.id == from_user.id:
             await message.reply_text("You want to ungban yourself? FOOL!")
         elif user.id == BOT_ID:
-            await message.reply_text(
-                "Should i ungban myself? But i'm not gbanned."
-            )
+            await message.reply_text("Should i ungban myself? But i'm not gbanned.")
         elif user.id in SUDOERS:
             await message.reply_text("Sudo users can't be gbanned/ungbanned.")
         else:
@@ -263,9 +250,7 @@ async def unban_globally(_, message):
     if user_id == from_user_id:
         await message.reply_text("You want to ungban yourself? FOOL!")
     elif user_id == BOT_ID:
-        await message.reply_text(
-            "Should i ungban myself? But i'm not gbanned."
-        )
+        await message.reply_text("Should i ungban myself? But i'm not gbanned.")
     elif user_id in SUDOERS:
         await message.reply_text("Sudo users can't be gbanned/ungbanned.")
     else:
@@ -280,9 +265,7 @@ async def unban_globally(_, message):
 # Broadcast
 
 
-@app.on_message(
-    filters.command("broadcast") & filters.user(SUDOERS) & ~filters.edited
-)
+@app.on_message(filters.command("broadcast") & filters.user(SUDOERS) & ~filters.edited)
 @capture_err
 async def broadcast_message(_, message):
     if len(message.command) < 2:

+ 1 - 4
wbb/modules/telegraph.py

@@ -6,7 +6,6 @@ import os
 
 from pyrogram import filters
 from telegraph import upload_file
-
 from wbb import app
 from wbb.core.decorators.errors import capture_err
 
@@ -31,9 +30,7 @@ async def tgphoto(client, message):
     msg = await message.reply_text("`Uploading to Telegraph...`")
     userid = str(message.chat.id)
     path = f"./DOWNLOADS/{userid}.jpg"
-    path = await client.download_media(
-        message=message.reply_to_message, file_name=path
-    )
+    path = await client.download_media(message=message.reply_to_message, file_name=path)
     try:
         tlink = upload_file(path)
     except Exception:

+ 0 - 1
wbb/modules/tts.py

@@ -27,7 +27,6 @@ from googletrans import Translator
 from gtts import gTTS
 from pyrogram import filters
 from pyrogram.types import Message
-
 from wbb import app
 from wbb.core.decorators.errors import capture_err
 

+ 1 - 4
wbb/modules/userbot.py

@@ -15,7 +15,6 @@ from io import StringIO
 
 from pyrogram import filters
 from pyrogram.types import Message
-
 from wbb import SUDOERS, USERBOT_PREFIX, app, app2
 
 __MODULE__ = "Userbot"
@@ -79,9 +78,7 @@ async def executor(client, message):
         evaluation = stdout
     else:
         evaluation = "Success"
-    final_output = (
-        f"**INPUT:**\n```{cmd}```\n\n**OUTPUT**:\n```{evaluation.strip()}```"
-    )
+    final_output = f"**INPUT:**\n```{cmd}```\n\n**OUTPUT**:\n```{evaluation.strip()}```"
     if len(final_output) > 4096:
         filename = "output.txt"
         with open(filename, "w+", encoding="utf8") as out_file:

+ 0 - 1
wbb/modules/webss.py

@@ -22,7 +22,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
 """
 from pyrogram import filters
-
 from wbb import app
 from wbb.core.decorators.errors import capture_err
 

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

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

+ 3 - 11
wbb/utils/dbfunctions.py

@@ -598,10 +598,7 @@ async def deactivate_pipe(from_chat_id: int, to_chat_id: int):
     if not pipes:
         return
     for pipe in pipes:
-        if (
-            pipe["from_chat_id"] == from_chat_id
-            and pipe["to_chat_id"] == to_chat_id
-        ):
+        if pipe["from_chat_id"] == from_chat_id and pipe["to_chat_id"] == to_chat_id:
             pipes.remove(pipe)
     return await pipesdb.update_one(
         {"pipe": "pipe"}, {"$set": {"pipes": pipes}}, upsert=True
@@ -610,10 +607,7 @@ async def deactivate_pipe(from_chat_id: int, to_chat_id: int):
 
 async def is_pipe_active(from_chat_id: int, to_chat_id: int) -> bool:
     for pipe in await show_pipes():
-        if (
-            pipe["from_chat_id"] == from_chat_id
-            and pipe["to_chat_id"] == to_chat_id
-        ):
+        if pipe["from_chat_id"] == from_chat_id and pipe["to_chat_id"] == to_chat_id:
             return True
 
 
@@ -657,9 +651,7 @@ async def remove_sudo(user_id: int) -> bool:
 
 async def blacklisted_chats() -> list:
     chats = blacklist_chatdb.find({"chat_id": {"$lt": 0}})
-    return [
-        chat["chat_id"] for chat in await chats.to_list(length=1000000000)
-    ]
+    return [chat["chat_id"] for chat in await chats.to_list(length=1000000000)]
 
 
 async def blacklist_chat(chat_id: int) -> bool:

+ 1 - 2
wbb/utils/files.py

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

+ 0 - 1
wbb/utils/functions.py

@@ -32,7 +32,6 @@ import aiohttp
 import speedtest
 from carbonnow import Carbon
 from PIL import Image, ImageDraw, ImageFilter, ImageFont
-
 from wbb.utils import aiodownloader
 from wbb.utils.fetch import fetch
 

+ 13 - 40
wbb/utils/inlinefuncs.py

@@ -40,7 +40,6 @@ from pyrogram.raw.functions import Ping
 from pyrogram.types import (InlineKeyboardButton, InlineQueryResultArticle,
                             InlineQueryResultPhoto, InputTextMessageContent)
 from search_engine_parser import GoogleSearch
-
 from wbb import (BOT_USERNAME, MESSAGE_DUMP_CHAT, SUDOERS, USERBOT_ID,
                  USERBOT_NAME, USERBOT_USERNAME, app, app2, arq)
 from wbb.core.types import InlineQueryResultCachedDocument
@@ -118,9 +117,7 @@ async def alive_function(answers):
     ubot_state = "Dead" if not await app2.get_me() else "Alive"
     buttons.add(
         InlineKeyboardButton("Stats", callback_data="stats_callback"),
-        InlineKeyboardButton(
-            "Go Inline!", switch_inline_query_current_chat=""
-        ),
+        InlineKeyboardButton("Go Inline!", switch_inline_query_current_chat=""),
     )
 
     msg = f"""
@@ -424,9 +421,7 @@ async def youtube_func(answers, text):
 **Duration:** {i.duration}
 **Uploaded:** {i.publish_time}
 **Description:** {i.long_desc}"""
-        description = (
-            f"{i.views} | {i.channel} | " + f"{i.duration} | {i.publish_time}"
-        )
+        description = f"{i.views} | {i.channel} | " + f"{i.duration} | {i.publish_time}"
         answers.append(
             InlineQueryResultArticle(
                 title=i.title,
@@ -477,9 +472,7 @@ async def github_user_func(answers, text):
     result = await fetch(URL)
     buttons = InlineKeyboard(row_width=1)
     buttons.add(
-        InlineKeyboardButton(
-            text="Open On Github", url=f"https://github.com/{text}"
-        )
+        InlineKeyboardButton(text="Open On Github", url=f"https://github.com/{text}")
     )
     caption = f"""
 **Info Of {result['name']}**
@@ -518,9 +511,7 @@ async def github_repo_func(answers, text):
         commits += developer["contributions"]
     buttons = InlineKeyboard(row_width=1)
     buttons.add(
-        InlineKeyboardButton(
-            "Open On Github", url=f"https://github.com/{text}"
-        )
+        InlineKeyboardButton("Open On Github", url=f"https://github.com/{text}")
     )
     caption = f"""
 **Info Of {r['full_name']}**
@@ -584,9 +575,7 @@ async def tg_search_func(answers, text, user_id):
             ),
         )
         name = (
-            message.from_user.first_name
-            if message.from_user.first_name
-            else "NO NAME"
+            message.from_user.first_name if message.from_user.first_name else "NO NAME"
         )
         caption = f"""
 **Query:** {text}
@@ -640,9 +629,7 @@ async def music_inline_func(answers, query):
                 "duration": f_.audio.duration if f_.audio.duration else 0,
             }
         )
-    messages = list(
-        {v["duration"]: v for v in messages_ids_and_duration}.values()
-    )
+    messages = list({v["duration"]: v for v in messages_ids_and_duration}.values())
     messages_ids = []
     for ff_ in messages:
         messages_ids.append(ff_["message_id"])
@@ -699,9 +686,7 @@ async def speedtest_init(query):
         return answers
     msg = "**Click The Button Below To Perform A Speedtest**"
     button = InlineKeyboard(row_width=1)
-    button.add(
-        InlineKeyboardButton(text="Test", callback_data="test_speedtest")
-    )
+    button.add(InlineKeyboardButton(text="Test", callback_data="test_speedtest"))
     answers.append(
         InlineQueryResultArticle(
             title="Click Here",
@@ -751,9 +736,7 @@ async def pastebin_func(answers, link):
                 InlineQueryResultArticle(
                     title="DOCUMENT TOO BIG",
                     description="Maximum supported size is 1MB",
-                    input_message_content=InputTextMessageContent(
-                        "DOCUMENT TOO BIG"
-                    ),
+                    input_message_content=InputTextMessageContent("DOCUMENT TOO BIG"),
                 )
             )
             return answers
@@ -774,9 +757,7 @@ async def pastebin_func(answers, link):
     await app.send_photo(MESSAGE_DUMP_CHAT, preview)  # To Pre-cache the media
     buttons = InlineKeyboard(row_width=1)
     buttons.add(InlineKeyboardButton(text="Paste Link", url=link))
-    answers.append(
-        InlineQueryResultPhoto(photo_url=preview, reply_markup=buttons)
-    )
+    answers.append(InlineQueryResultPhoto(photo_url=preview, reply_markup=buttons))
     return answers
 
 
@@ -792,9 +773,7 @@ async def pmpermit_func(answers, user_id, victim):
         InlineKeyboardButton(
             text="For promotion", callback_data="pmpermit to_scam_you a"
         ),
-        InlineKeyboardButton(
-            text="Approve me", callback_data="pmpermit approve_me a"
-        ),
+        InlineKeyboardButton(text="Approve me", callback_data="pmpermit approve_me a"),
         InlineKeyboardButton(
             text="Approve", callback_data=f"pmpermit approve {victim}"
         ),
@@ -912,9 +891,7 @@ async def carbon_inline_func(answers, link):
                 InlineQueryResultArticle(
                     title="DOCUMENT TOO BIG",
                     description="Maximum supported size is 1MB",
-                    input_message_content=InputTextMessageContent(
-                        "DOCUMENT TOO BIG"
-                    ),
+                    input_message_content=InputTextMessageContent("DOCUMENT TOO BIG"),
                 )
             )
             return answers
@@ -972,9 +949,7 @@ async def tmdb_func(answers, query):
             InlineQueryResultArticle(
                 title="Error",
                 description=response.result,
-                input_message_content=InputTextMessageContent(
-                    response.result
-                ),
+                input_message_content=InputTextMessageContent(response.result),
             )
         )
         return answers
@@ -1003,9 +978,7 @@ async def tmdb_func(answers, query):
         )
         answers.append(
             InlineQueryResultPhoto(
-                photo_url=result.backdrop
-                if result.backdrop
-                else result.poster,
+                photo_url=result.backdrop if result.backdrop else result.poster,
                 caption=caption,
                 title=result.title,
                 description=f"{genre} • {result.releaseDate} • {result.rating} • {description}",

+ 1 - 6
wbb/utils/json_prettify.py

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

+ 1 - 4
wbb/utils/misc.py

@@ -24,7 +24,6 @@ SOFTWARE.
 from math import ceil
 
 from pyrogram.types import InlineKeyboardButton
-
 from wbb import MOD_LOAD, MOD_NOLOAD
 
 
@@ -45,9 +44,7 @@ def paginate_modules(page_n, module_dict, prefix, chat=None):
             [
                 EqInlineKeyboardButton(
                     x.__MODULE__,
-                    callback_data="{}_module({})".format(
-                        prefix, x.__MODULE__.lower()
-                    ),
+                    callback_data="{}_module({})".format(prefix, x.__MODULE__.lower()),
                 )
                 for x in module_dict.values()
             ]