thehamkercat 5 anos atrás
pai
commit
1b9b9b0698

+ 5 - 5
wbb/__main__.py

@@ -45,13 +45,13 @@ async def start_bot():
     if restart_data:
         try:
             await app.edit_message_text(
-                restart_data['chat_id'],
-                restart_data['message_id'],
-                "**Restarted Successfully**"
-                )
+                restart_data["chat_id"],
+                restart_data["message_id"],
+                "**Restarted Successfully**",
+            )
         except Exception:
             pass
-            
+
     for module in ALL_MODULES:
         imported_module = importlib.import_module("wbb.modules." + module)
         if (

+ 7 - 2
wbb/modules/admin.py

@@ -301,6 +301,7 @@ async def pin(_, message: Message):
         return await message.reply_text("Reply To A Message To Pin.")
     await message.reply_to_message.pin(disable_notification=True)
 
+
 # Mute members
 
 
@@ -470,8 +471,12 @@ async def check_warns(_, message: Message):
         if warns:
             warns = warns["warns"]
         else:
-            return await message.reply_text(f"{mention_user} have no warnings.")
-        return await message.reply_text(f"{mention_user} have {warns}/3 warnings.")
+            return await message.reply_text(
+                f"{mention_user} have no warnings."
+            )
+        return await message.reply_text(
+            f"{mention_user} have {warns}/3 warnings."
+        )
     warns = await get_warn(chat_id, await int_to_alpha(user_id))
     if warns:
         warns = warns["warns"]

+ 6 - 2
wbb/modules/admin_misc.py

@@ -69,12 +69,16 @@ async def set_user_title(_, message):
 @adminsOnly("can_change_info")
 async def set_chat_photo(_, message):
     if not message.reply_to_message:
-        return await message.reply_text("Reply to a photo to set it as chat_photo")
+        return await message.reply_text(
+            "Reply to a photo to set it as chat_photo"
+        )
     if (
         not message.reply_to_message.photo
         and not message.reply_to_message.document
     ):
-        return await message.reply_text("Reply to a photo to set it as chat_photo")
+        return await message.reply_text(
+            "Reply to a photo to set it as chat_photo"
+        )
     photo = await message.reply_to_message.download()
     await message.chat.set_photo(photo)
     await message.reply_text("Successfully Changed Group Photo")

+ 3 - 1
wbb/modules/antiservice.py

@@ -20,7 +20,9 @@ Plugin to delete service messages in a chat!
 @adminsOnly("can_change_info")
 async def anti_service(_, message):
     if len(message.command) != 2:
-        return await message.reply_text("Usage: /antiservice [enable | disable]")
+        return await message.reply_text(
+            "Usage: /antiservice [enable | disable]"
+        )
     status = message.text.split(None, 1)[1].strip()
     status = status.lower()
     chat_id = message.chat.id

+ 3 - 1
wbb/modules/blacklist.py

@@ -52,7 +52,9 @@ async def save_filters(_, message):
         return await message.reply_text("Usage:\n/blacklist [WORD|SENTENCE]")
     word = message.text.split(None, 1)[1].strip()
     if not word:
-        return await message.reply_text("**Usage**\n__/blacklist [WORD|SENTENCE]__")
+        return await message.reply_text(
+            "**Usage**\n__/blacklist [WORD|SENTENCE]__"
+        )
     chat_id = message.chat.id
     await save_blacklist_filter(chat_id, word)
     await message.reply_text(f"__**Blacklisted {word}.**__")

+ 12 - 4
wbb/modules/blacklist_chat.py

@@ -23,13 +23,17 @@ in which you don't want it to be in.
 @capture_err
 async def blacklist_chat_func(_, message: Message):
     if len(message.command) != 2:
-        return await message.reply_text("**Usage:**\n/blacklist_chat [CHAT_ID]")
+        return await message.reply_text(
+            "**Usage:**\n/blacklist_chat [CHAT_ID]"
+        )
     chat_id = int(message.text.strip().split()[1])
     if chat_id in await blacklisted_chats():
         return await message.reply_text("Chat is already blacklisted.")
     blacklisted = await blacklist_chat(chat_id)
     if blacklisted:
-        return await message.reply_text("Chat has been successfully blacklisted")
+        return await message.reply_text(
+            "Chat has been successfully blacklisted"
+        )
     await message.reply_text("Something wrong happened, check logs.")
 
 
@@ -37,13 +41,17 @@ async def blacklist_chat_func(_, message: Message):
 @capture_err
 async def whitelist_chat_func(_, message: Message):
     if len(message.command) != 2:
-        return await message.reply_text("**Usage:**\n/whitelist_chat [CHAT_ID]")
+        return await message.reply_text(
+            "**Usage:**\n/whitelist_chat [CHAT_ID]"
+        )
     chat_id = int(message.text.strip().split()[1])
     if chat_id not in await blacklisted_chats():
         return await message.reply_text("Chat is already whitelisted.")
     whitelisted = await whitelist_chat(chat_id)
     if whitelisted:
-        return await message.reply_text("Chat has been successfully whitelisted")
+        return await message.reply_text(
+            "Chat has been successfully whitelisted"
+        )
     await message.reply_text("Something wrong happened, check logs.")
 
 

+ 6 - 2
wbb/modules/carbon.py

@@ -14,9 +14,13 @@ __HELP__ = "/carbon - Make Carbon Of Code."
 @capture_err
 async def carbon_func(_, message):
     if not message.reply_to_message:
-        return await message.reply_text("Reply to a text message to make carbon.")
+        return await message.reply_text(
+            "Reply to a text message to make carbon."
+        )
     if not message.reply_to_message.text:
-        return await message.reply_text("Reply to a text message to make carbon.")
+        return await message.reply_text(
+            "Reply to a text message to make carbon."
+        )
     m = await message.reply_text("Preparing Carbon")
     carbon = await make_carbon(message.reply_to_message.text)
     await m.edit("Uploading")

+ 3 - 1
wbb/modules/chatbot.py

@@ -112,7 +112,9 @@ async def chatbot_talk(_, message):
 async def chatbot_status_ubot(_, message):
     global active_chats_ubot
     if len(message.text.split()) != 2:
-        return await edit_or_reply(message, text="**Usage**\n.chatbot [ON|OFF]")
+        return await edit_or_reply(
+            message, text="**Usage**\n.chatbot [ON|OFF]"
+        )
     status = message.text.split(None, 1)[1]
     chat_id = message.chat.id
     if status == "ON" or status == "on" or status == "On":

+ 3 - 1
wbb/modules/info.py

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

+ 3 - 1
wbb/modules/paste.py

@@ -64,7 +64,9 @@ async def paste_func(_, message):
         elif message.reply_to_message.document:
             document = message.reply_to_message.document
             if document.file_size > 1048576:
-                return await m.edit("You can only paste files smaller than 1MB.")
+                return await m.edit(
+                    "You can only paste files smaller than 1MB."
+                )
             if "text" not in document.mime_type:
                 return await m.edit("Only text files can be pasted.")
             doc = await message.reply_to_message.download()

+ 2 - 0
wbb/modules/pipes.py

@@ -58,6 +58,8 @@ Show all the active pipes.
 """
 pipes_list_bot = []
 pipes_list_userbot = []
+
+
 async def load_pipes():
     print("[INFO]: LOADING PIPES")
     global pipes_list_bot, pipes_list_userbot

+ 3 - 1
wbb/modules/pmpermit.py

@@ -74,7 +74,9 @@ async def pm_approve(_, message):
         )
     user_id = message.reply_to_message.from_user.id
     if await is_pmpermit_approved(user_id):
-        return await edit_or_reply(message, text="User is already approved to pm")
+        return await edit_or_reply(
+            message, text="User is already approved to pm"
+        )
     await approve_pmpermit(user_id)
     await edit_or_reply(message, text="User is approved to pm")
 

+ 5 - 2
wbb/modules/quotly.py

@@ -4,7 +4,7 @@ from traceback import format_exc
 from pyrogram import filters
 from pyrogram.types import Message
 
-from wbb import app, app2, arq, USERBOT_PREFIX
+from wbb import SUDOERS, USERBOT_PREFIX, app, app2, arq
 from wbb.core.decorators.errors import capture_err
 
 __MODULE__ = "Quotly"
@@ -40,7 +40,10 @@ def isArgInt(message: Message) -> bool:
     except ValueError:
         return [False, 0]
 
-@app2.on_message(filters.command("q", prefixes=USERBOT_PREFIX))
+
+@app2.on_message(
+    filters.command("q", prefixes=USERBOT_PREFIX) & filters.user(SUDOERS)
+)
 @app.on_message(filters.command("q") & ~filters.private)
 @capture_err
 async def quotly_func(client, message: Message):

+ 1 - 1
wbb/modules/regex.py

@@ -131,7 +131,7 @@ def separate_sed(sed_string):
                 and counter + 1 < len(sed_string)
                 and sed_string[counter + 1] == delim
             ):
-                sed_string = sed_string[:counter] + sed_string[counter + 1:]
+                sed_string = sed_string[:counter] + sed_string[counter + 1 :]
 
             elif sed_string[counter] == delim:
                 replace_with = sed_string[start:counter]

+ 3 - 1
wbb/modules/reverse.py

@@ -20,7 +20,9 @@ async def reverse_image_search(_, message):
     if message.from_user.id not in SUDOERS:
         return await message.reply_text("THIS FEATURE IS ONLY FOR SUDO USERS.")
     if not message.reply_to_message:
-        return await message.reply_text("Reply to a message to reverse search it.")
+        return await message.reply_text(
+            "Reply to a message to reverse search it."
+        )
     reply = message.reply_to_message
     if (
         not reply.document

+ 3 - 1
wbb/modules/stickers.py

@@ -94,7 +94,9 @@ async def kang(client, message):
             temp_file_path = await app.download_media(doc)
             image_type = imghdr.what(temp_file_path)
             if image_type not in SUPPORTED_TYPES:
-                return await msg.edit("Format not supported! ({})".format(image_type))
+                return await msg.edit(
+                    "Format not supported! ({})".format(image_type)
+                )
             try:
                 temp_file_path = await resize_file_to_sticker_size(
                     temp_file_path

+ 3 - 1
wbb/modules/sudoers.py

@@ -302,6 +302,8 @@ async def update_restart(_, message):
     await message.reply_text(
         f'```{subprocess.check_output(["git", "pull"]).decode("UTF-8")}```'
     )
-    m = await message.reply_text("**Updated with default branch, restarting now**")
+    m = await message.reply_text(
+        "**Updated with default branch, restarting now**"
+    )
     await start_restart_stage(m.chat.id, m.message_id)
     os.execvp("python3", ["python3", "-m", "wbb"])

+ 8 - 10
wbb/utils/dbfunctions.py

@@ -679,25 +679,23 @@ async def whitelist_chat(chat_id: int) -> bool:
 
 """ Restart stage """
 
+
 async def start_restart_stage(chat_id: int, message_id: int):
     await restart_stagedb.update_one(
-        {
-            "something": "something"
-        },
+        {"something": "something"},
         {
             "$set": {
                 "chat_id": chat_id,
                 "message_id": message_id,
-                }
-            },
-        upsert=True
-    ) 
+            }
+        },
+        upsert=True,
+    )
+
 
 async def clean_restart_stage() -> dict:
     data = await restart_stagedb.find_one({"something": "something"})
     if not data:
         return {}
     await restart_stagedb.delete_one({"something": "something"})
-    return {"chat_id": data['chat_id'], "message_id": data['message_id']}
-
-    
+    return {"chat_id": data["chat_id"], "message_id": data["message_id"]}

+ 1 - 1
wbb/utils/misc.py

@@ -85,7 +85,7 @@ def paginate_modules(page_n, module_dict, prefix, chat=None):
 
     # can only have a certain amount of buttons side by side
     if len(pairs) > 7:
-        pairs = pairs[modulo_page * 7: 7 * (modulo_page + 1)] + [
+        pairs = pairs[modulo_page * 7 : 7 * (modulo_page + 1)] + [
             (
                 EqInlineKeyboardButton(
                     "<",