TheHamkerCat 4 лет назад
Родитель
Сommit
75a4579cda

+ 0 - 1
requirements.txt

@@ -12,7 +12,6 @@ pykeyboard
 pyrogram
 pyrogram
 python-arq
 python-arq
 requests
 requests
-search_engine_parser
 speedtest-cli
 speedtest-cli
 TgCrypto
 TgCrypto
 uvloop
 uvloop

+ 24 - 17
wbb/__main__.py

@@ -29,8 +29,15 @@ import uvloop
 from pyrogram import filters, idle
 from pyrogram import filters, idle
 from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
 from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
 
 
-from wbb import (BOT_NAME, BOT_USERNAME, LOG_GROUP_ID, USERBOT_NAME,
-                 aiohttpsession, app, log)
+from wbb import (
+    BOT_NAME,
+    BOT_USERNAME,
+    LOG_GROUP_ID,
+    USERBOT_NAME,
+    aiohttpsession,
+    app,
+    log,
+)
 from wbb.modules import ALL_MODULES
 from wbb.modules import ALL_MODULES
 from wbb.modules.sudoers import bot_sys_stats
 from wbb.modules.sudoers import bot_sys_stats
 from wbb.utils import paginate_modules
 from wbb.utils import paginate_modules
@@ -48,13 +55,13 @@ async def start_bot():
     for module in ALL_MODULES:
     for module in ALL_MODULES:
         imported_module = importlib.import_module("wbb.modules." + module)
         imported_module = importlib.import_module("wbb.modules." + module)
         if (
         if (
-            hasattr(imported_module, "__MODULE__")
-            and imported_module.__MODULE__
+                hasattr(imported_module, "__MODULE__")
+                and imported_module.__MODULE__
         ):
         ):
             imported_module.__MODULE__ = imported_module.__MODULE__
             imported_module.__MODULE__ = imported_module.__MODULE__
             if (
             if (
-                hasattr(imported_module, "__HELP__")
-                and imported_module.__HELP__
+                    hasattr(imported_module, "__HELP__")
+                    and imported_module.__HELP__
             ):
             ):
                 HELPABLE[
                 HELPABLE[
                     imported_module.__MODULE__.replace(" ", "_").lower()
                     imported_module.__MODULE__.replace(" ", "_").lower()
@@ -133,9 +140,9 @@ home_keyboard_pm = InlineKeyboardMarkup(
 )
 )
 
 
 home_text_pm = (
 home_text_pm = (
-    f"Hey there! My name is {BOT_NAME}. I can manage your "
-    + "group with lots of useful features, feel free to "
-    + "add me to your group."
+        f"Hey there! My name is {BOT_NAME}. I can manage your "
+        + "group with lots of useful features, feel free to "
+        + "add me to your group."
 )
 )
 
 
 keyboard = InlineKeyboardMarkup(
 keyboard = InlineKeyboardMarkup(
@@ -176,8 +183,8 @@ async def start(_, message):
         elif "_" in name:
         elif "_" in name:
             module = name.split("_", 1)[1]
             module = name.split("_", 1)[1]
             text = (
             text = (
-                f"Here is the help for **{HELPABLE[module].__MODULE__}**:\n"
-                + HELPABLE[module].__HELP__
+                    f"Here is the help for **{HELPABLE[module].__MODULE__}**:\n"
+                    + HELPABLE[module].__HELP__
             )
             )
             await message.reply(text, disable_web_page_preview=True)
             await message.reply(text, disable_web_page_preview=True)
         elif name == "help":
         elif name == "help":
@@ -227,8 +234,8 @@ async def help_command(_, message):
             name = (message.text.split(None, 1)[1]).replace(" ", "_").lower()
             name = (message.text.split(None, 1)[1]).replace(" ", "_").lower()
             if str(name) in HELPABLE:
             if str(name) in HELPABLE:
                 text = (
                 text = (
-                    f"Here is the help for **{HELPABLE[name].__MODULE__}**:\n"
-                    + HELPABLE[name].__HELP__
+                        f"Here is the help for **{HELPABLE[name].__MODULE__}**:\n"
+                        + HELPABLE[name].__HELP__
                 )
                 )
                 await message.reply(text, disable_web_page_preview=True)
                 await message.reply(text, disable_web_page_preview=True)
             else:
             else:
@@ -305,10 +312,10 @@ General command are:
     if mod_match:
     if mod_match:
         module = (mod_match.group(1)).replace(" ", "_")
         module = (mod_match.group(1)).replace(" ", "_")
         text = (
         text = (
-            "{} **{}**:\n".format(
-                "Here is the help for", HELPABLE[module].__MODULE__
-            )
-            + HELPABLE[module].__HELP__
+                "{} **{}**:\n".format(
+                    "Here is the help for", HELPABLE[module].__MODULE__
+                )
+                + HELPABLE[module].__HELP__
         )
         )
 
 
         await query.message.edit(
         await query.message.edit(

+ 4 - 4
wbb/core/decorators/permissions.py

@@ -50,8 +50,8 @@ async def authorised(func, subFunc2, client, message, *args, **kwargs):
 async def unauthorised(message: Message, permission, subFunc2):
 async def unauthorised(message: Message, permission, subFunc2):
     chatID = message.chat.id
     chatID = message.chat.id
     text = (
     text = (
-        "You don't have the required permission to perform this action."
-        + f"\n**Permission:** __{permission}__"
+            "You don't have the required permission to perform this action."
+            + f"\n**Permission:** __{permission}__"
     )
     )
     try:
     try:
         await message.reply_text(text)
         await message.reply_text(text)
@@ -68,8 +68,8 @@ def adminsOnly(permission):
             if not message.from_user:
             if not message.from_user:
                 # For anonymous admins
                 # For anonymous admins
                 if (
                 if (
-                    message.sender_chat
-                    and message.sender_chat.id == message.chat.id
+                        message.sender_chat
+                        and message.sender_chat.id == message.chat.id
                 ):
                 ):
                     return await authorised(
                     return await authorised(
                         func,
                         func,

+ 7 - 9
wbb/core/sections.py

@@ -25,7 +25,6 @@ SOFTWARE.
 n = "\n"
 n = "\n"
 w = " "
 w = " "
 
 
-
 bold = lambda x: f"**{x}:** "
 bold = lambda x: f"**{x}:** "
 bold_ul = lambda x: f"**--{x}:**-- "
 bold_ul = lambda x: f"**--{x}:**-- "
 
 
@@ -33,18 +32,17 @@ mono = lambda x: f"`{x}`{n}"
 
 
 
 
 def section(
 def section(
-    title: str,
-    body: dict,
-    indent: int = 2,
-    underline: bool = False,
+        title: str,
+        body: dict,
+        indent: int = 2,
+        underline: bool = False,
 ) -> str:
 ) -> str:
-
     text = (bold_ul(title) + n) if underline else bold(title) + n
     text = (bold_ul(title) + n) if underline else bold(title) + n
 
 
     for key, value in body.items():
     for key, value in body.items():
         text += (
         text += (
-            indent * w
-            + bold(key)
-            + ((value[0] + n) if isinstance(value, list) else mono(value))
+                indent * w
+                + bold(key)
+                + ((value[0] + n) if isinstance(value, list) else mono(value))
         )
         )
     return text
     return text

+ 4 - 5
wbb/core/tasks.py

@@ -17,12 +17,11 @@ def all_tasks():
 
 
 
 
 async def add_task(
 async def add_task(
-    taskFunc,
-    task_name,
-    *args,
-    **kwargs,
+        taskFunc,
+        task_name,
+        *args,
+        **kwargs,
 ):
 ):
-
     async with TASKS_LOCK:
     async with TASKS_LOCK:
         global tasks
         global tasks
 
 

+ 25 - 25
wbb/core/types/InlineQueryResult.py

@@ -82,20 +82,20 @@ class InlineQueryResultAudio(InlineQueryResult):
     """
     """
 
 
     def __init__(
     def __init__(
-        self,
-        audio_url: str,
-        thumb_url: str,
-        title: str,
-        mime_type: str,
-        id: str = None,
-        description: str = None,
-        caption: str = "",
-        performer: str = "",
-        duration: int = 0,
-        parse_mode: Optional[str] = object,
-        caption_entities: List["types.MessageEntity"] = None,
-        reply_markup: "types.InlineKeyboardMarkup" = None,
-        input_message_content: "types.InputMessageContent" = None,
+            self,
+            audio_url: str,
+            thumb_url: str,
+            title: str,
+            mime_type: str,
+            id: str = None,
+            description: str = None,
+            caption: str = "",
+            performer: str = "",
+            duration: int = 0,
+            parse_mode: Optional[str] = object,
+            caption_entities: List["types.MessageEntity"] = None,
+            reply_markup: "types.InlineKeyboardMarkup" = None,
+            input_message_content: "types.InputMessageContent" = None,
     ):
     ):
         super().__init__("audio", id, input_message_content, reply_markup)
         super().__init__("audio", id, input_message_content, reply_markup)
 
 
@@ -217,16 +217,16 @@ class InlineQueryResultCachedDocument(InlineQueryResult):
     """
     """
 
 
     def __init__(
     def __init__(
-        self,
-        file_id: str,
-        title: str = None,
-        id: str = None,
-        description: str = None,
-        caption: str = "",
-        parse_mode: Optional[str] = object,
-        caption_entities: List["types.MessageEntity"] = None,
-        reply_markup: "types.InlineKeyboardMarkup" = None,
-        input_message_content: "types.InputMessageContent" = None,
+            self,
+            file_id: str,
+            title: str = None,
+            id: str = None,
+            description: str = None,
+            caption: str = "",
+            parse_mode: Optional[str] = object,
+            caption_entities: List["types.MessageEntity"] = None,
+            reply_markup: "types.InlineKeyboardMarkup" = None,
+            input_message_content: "types.InputMessageContent" = None,
     ):
     ):
         super().__init__("file", id, input_message_content, reply_markup)
         super().__init__("file", id, input_message_content, reply_markup)
 
 
@@ -274,7 +274,7 @@ class InlineQueryResultCachedDocument(InlineQueryResult):
 
 
 
 
 def get_input_file_from_file_id(
 def get_input_file_from_file_id(
-    file_id: str, expected_file_type: FileType = None
+        file_id: str, expected_file_type: FileType = None
 ) -> Union["raw.types.InputPhoto", "raw.types.InputDocument"]:
 ) -> Union["raw.types.InputPhoto", "raw.types.InputDocument"]:
     try:
     try:
         decoded = FileId.decode(file_id)
         decoded = FileId.decode(file_id)

+ 4 - 2
wbb/core/types/__init__.py

@@ -1,4 +1,6 @@
 # flake8: noqa
 # flake8: noqa
 
 
-from .InlineQueryResult import (InlineQueryResultAudio,
-                                InlineQueryResultCachedDocument)
+from .InlineQueryResult import (
+    InlineQueryResultAudio,
+    InlineQueryResultCachedDocument,
+)

+ 5 - 5
wbb/modules/__init__.py

@@ -37,17 +37,17 @@ def __list_all_modules():
         basename(f)[:-3]
         basename(f)[:-3]
         for f in mod_paths
         for f in mod_paths
         if isfile(f)
         if isfile(f)
-        and f.endswith(".py")
-        and not f.endswith("__init__.py")
-        and not f.endswith("__main__.py")
+           and f.endswith(".py")
+           and not f.endswith("__init__.py")
+           and not f.endswith("__main__.py")
     ]
     ]
 
 
     if MOD_LOAD or MOD_NOLOAD:
     if MOD_LOAD or MOD_NOLOAD:
         to_load = MOD_LOAD
         to_load = MOD_LOAD
         if to_load:
         if to_load:
             if not all(
             if not all(
-                any(mod == module_name for module_name in all_modules)
-                for mod in to_load
+                    any(mod == module_name for module_name in all_modules)
+                    for mod in to_load
             ):
             ):
                 sys.exit()
                 sys.exit()
 
 

+ 22 - 10
wbb/modules/admin.py

@@ -25,16 +25,28 @@ import asyncio
 from time import time
 from time import time
 
 
 from pyrogram import filters
 from pyrogram import filters
-from pyrogram.types import (CallbackQuery, ChatMemberUpdated, ChatPermissions,
-                            Message)
+from pyrogram.types import (
+    CallbackQuery,
+    ChatMemberUpdated,
+    ChatPermissions,
+    Message,
+)
 
 
 from wbb import BOT_ID, SUDOERS, app, log
 from wbb import BOT_ID, SUDOERS, app, log
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.errors import capture_err
 from wbb.core.keyboard import ikb
 from wbb.core.keyboard import ikb
-from wbb.utils.dbfunctions import (add_warn, get_warn, int_to_alpha,
-                                   remove_warns, save_filter)
-from wbb.utils.functions import (extract_user, extract_user_and_reason,
-                                 time_converter)
+from wbb.utils.dbfunctions import (
+    add_warn,
+    get_warn,
+    int_to_alpha,
+    remove_warns,
+    save_filter,
+)
+from wbb.utils.functions import (
+    extract_user,
+    extract_user_and_reason,
+    time_converter,
+)
 
 
 __MODULE__ = "Admin"
 __MODULE__ = "Admin"
 __HELP__ = """/ban - Ban A User
 __HELP__ = """/ban - Ban A User
@@ -168,8 +180,8 @@ async def purgeFunc(_, message: Message):
     message_ids = []
     message_ids = []
 
 
     for message_id in range(
     for message_id in range(
-        message.reply_to_message.message_id,
-        message.message_id,
+            message.reply_to_message.message_id,
+            message.message_id,
     ):
     ):
         message_ids.append(message_id)
         message_ids.append(message_id)
 
 
@@ -654,8 +666,8 @@ async def check_warns(_, message: Message):
 
 
 @app.on_message(
 @app.on_message(
     (
     (
-        filters.command("report")
-        | filters.command(["admins", "admin"], prefixes="@")
+            filters.command("report")
+            | filters.command(["admins", "admin"], prefixes="@")
     )
     )
     & ~filters.edited
     & ~filters.edited
     & ~filters.private
     & ~filters.private

+ 5 - 2
wbb/modules/antiservice.py

@@ -5,8 +5,11 @@ from pyrogram import filters
 
 
 from wbb import app
 from wbb import app
 from wbb.core.decorators.permissions import adminsOnly
 from wbb.core.decorators.permissions import adminsOnly
-from wbb.utils.dbfunctions import (antiservice_off, antiservice_on,
-                                   is_antiservice_on)
+from wbb.utils.dbfunctions import (
+    antiservice_off,
+    antiservice_on,
+    is_antiservice_on,
+)
 
 
 __MODULE__ = "AntiService"
 __MODULE__ = "AntiService"
 __HELP__ = """
 __HELP__ = """

+ 5 - 3
wbb/modules/blacklist.py

@@ -31,9 +31,11 @@ from wbb import SUDOERS, app
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.permissions import adminsOnly
 from wbb.core.decorators.permissions import adminsOnly
 from wbb.modules.admin import list_admins
 from wbb.modules.admin import list_admins
-from wbb.utils.dbfunctions import (delete_blacklist_filter,
-                                   get_blacklisted_words,
-                                   save_blacklist_filter)
+from wbb.utils.dbfunctions import (
+    delete_blacklist_filter,
+    get_blacklisted_words,
+    save_blacklist_filter,
+)
 from wbb.utils.filter_groups import blacklist_filters_group
 from wbb.utils.filter_groups import blacklist_filters_group
 
 
 __MODULE__ = "Blacklist"
 __MODULE__ = "Blacklist"

+ 5 - 2
wbb/modules/blacklist_chat.py

@@ -3,8 +3,11 @@ from pyrogram.types import Message
 
 
 from wbb import SUDOERS, app
 from wbb import SUDOERS, app
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.errors import capture_err
-from wbb.utils.dbfunctions import (blacklist_chat, blacklisted_chats,
-                                   whitelist_chat)
+from wbb.utils.dbfunctions import (
+    blacklist_chat,
+    blacklisted_chats,
+    whitelist_chat,
+)
 
 
 __MODULE__ = "Blacklist Chat"
 __MODULE__ = "Blacklist Chat"
 __HELP__ = """
 __HELP__ = """

+ 5 - 2
wbb/modules/chat_watcher.py

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

+ 13 - 4
wbb/modules/chatbot.py

@@ -26,8 +26,17 @@ from asyncio import gather, sleep
 from pyrogram import filters
 from pyrogram import filters
 from pyrogram.types import Message
 from pyrogram.types import Message
 
 
-from wbb import (BOT_ID, SUDOERS, USERBOT_ID, USERBOT_PREFIX, USERBOT_USERNAME,
-                 app, app2, arq, eor)
+from wbb import (
+    BOT_ID,
+    SUDOERS,
+    USERBOT_ID,
+    USERBOT_PREFIX,
+    USERBOT_USERNAME,
+    app,
+    app2,
+    arq,
+    eor,
+)
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.errors import capture_err
 from wbb.utils.filter_groups import chatbot_group
 from wbb.utils.filter_groups import chatbot_group
 
 
@@ -135,8 +144,8 @@ async def chatbot_talk_ubot(_, message: Message):
         if not message.reply_to_message.from_user:
         if not message.reply_to_message.from_user:
             return
             return
         if (
         if (
-            message.reply_to_message.from_user.id != USERBOT_ID
-            and username not in message.text
+                message.reply_to_message.from_user.id != USERBOT_ID
+                and username not in message.text
         ):
         ):
             return
             return
     else:
     else:

+ 5 - 5
wbb/modules/couple.py

@@ -44,11 +44,11 @@ def dt():
 
 
 def dt_tom():
 def dt_tom():
     a = (
     a = (
-        str(int(dt()[0].split("/")[0]) + 1)
-        + "/"
-        + dt()[0].split("/")[1]
-        + "/"
-        + dt()[0].split("/")[2]
+            str(int(dt()[0].split("/")[0]) + 1)
+            + "/"
+            + dt()[0].split("/")[1]
+            + "/"
+            + dt()[0].split("/")[2]
     )
     )
     return a
     return a
 
 

+ 8 - 4
wbb/modules/filters.py

@@ -29,8 +29,12 @@ from wbb import app
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.permissions import adminsOnly
 from wbb.core.decorators.permissions import adminsOnly
 from wbb.core.keyboard import ikb
 from wbb.core.keyboard import ikb
-from wbb.utils.dbfunctions import (delete_filter, get_filter,
-                                   get_filters_names, save_filter)
+from wbb.utils.dbfunctions import (
+    delete_filter,
+    get_filter,
+    get_filters_names,
+    save_filter,
+)
 from wbb.utils.filter_groups import chat_filters_group
 from wbb.utils.filter_groups import chat_filters_group
 from wbb.utils.functions import extract_text_and_keyb
 from wbb.utils.functions import extract_text_and_keyb
 
 
@@ -54,8 +58,8 @@ async def save_filters(_, message):
             "**Usage:**\nReply to a text or sticker with /filter [FILTER_NAME] to save it."
             "**Usage:**\nReply to a text or sticker with /filter [FILTER_NAME] to save it."
         )
         )
     if (
     if (
-        not message.reply_to_message.text
-        and not message.reply_to_message.sticker
+            not message.reply_to_message.text
+            and not message.reply_to_message.sticker
     ):
     ):
         return await message.reply_text(
         return await message.reply_text(
             "__**You can only save text or stickers in filters.**__"
             "__**You can only save text or stickers in filters.**__"

+ 7 - 4
wbb/modules/flood.py

@@ -25,9 +25,13 @@ from asyncio import get_running_loop, sleep
 from time import time
 from time import time
 
 
 from pyrogram import filters
 from pyrogram import filters
-from pyrogram.types import (CallbackQuery, ChatPermissions,
-                            InlineKeyboardButton, InlineKeyboardMarkup,
-                            Message)
+from pyrogram.types import (
+    CallbackQuery,
+    ChatPermissions,
+    InlineKeyboardButton,
+    InlineKeyboardMarkup,
+    Message,
+)
 
 
 from wbb import SUDOERS, app
 from wbb import SUDOERS, app
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.errors import capture_err
@@ -43,7 +47,6 @@ Anti-Flood system, the one who sends more than 10 messages in a row, gets muted
 /flood [ENABLE|DISABLE] - Turn flood detection on or off
 /flood [ENABLE|DISABLE] - Turn flood detection on or off
 """
 """
 
 
-
 DB = {}  # TODO Use mongodb instead of a fucking dict.
 DB = {}  # TODO Use mongodb instead of a fucking dict.
 
 
 
 

+ 13 - 7
wbb/modules/global_stats.py

@@ -29,12 +29,18 @@ from pyrogram.errors import FloodWait
 from wbb import BOT_ID, BOT_NAME, SUDOERS, USERBOT_NAME, app, app2
 from wbb import BOT_ID, BOT_NAME, SUDOERS, USERBOT_NAME, app, app2
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.errors import capture_err
 from wbb.modules import ALL_MODULES
 from wbb.modules import ALL_MODULES
-from wbb.utils.dbfunctions import (get_blacklist_filters_count,
-                                   get_filters_count, get_gbans_count,
-                                   get_karmas_count, get_notes_count,
-                                   get_rss_feeds_count, get_served_chats,
-                                   get_served_users, get_warns_count,
-                                   remove_served_chat)
+from wbb.utils.dbfunctions import (
+    get_blacklist_filters_count,
+    get_filters_count,
+    get_gbans_count,
+    get_karmas_count,
+    get_notes_count,
+    get_rss_feeds_count,
+    get_served_chats,
+    get_served_users,
+    get_warns_count,
+    remove_served_chat,
+)
 from wbb.utils.http import get
 from wbb.utils.http import get
 from wbb.utils.inlinefuncs import keywords_list
 from wbb.utils.inlinefuncs import keywords_list
 
 
@@ -44,7 +50,7 @@ from wbb.utils.inlinefuncs import keywords_list
 async def clean_db(_, message):
 async def clean_db(_, message):
     served_chats = [int(i["chat_id"]) for i in (await get_served_chats())]
     served_chats = [int(i["chat_id"]) for i in (await get_served_chats())]
     m = await message.reply(
     m = await message.reply(
-        f"__**Cleaning database, Might take around {len(served_chats)*2} seconds.**__",
+        f"__**Cleaning database, Might take around {len(served_chats) * 2} seconds.**__",
     )
     )
     for served_chat in served_chats:
     for served_chat in served_chats:
         try:
         try:

+ 28 - 11
wbb/modules/greetings.py

@@ -28,20 +28,36 @@ from datetime import datetime
 from random import shuffle
 from random import shuffle
 
 
 from pyrogram import filters
 from pyrogram import filters
-from pyrogram.errors.exceptions.bad_request_400 import (ChatAdminRequired,
-                                                        UserNotParticipant)
-from pyrogram.types import (Chat, ChatPermissions, InlineKeyboardButton,
-                            InlineKeyboardMarkup, Message, User)
+from pyrogram.errors.exceptions.bad_request_400 import (
+    ChatAdminRequired,
+    UserNotParticipant,
+)
+from pyrogram.types import (
+    Chat,
+    ChatPermissions,
+    InlineKeyboardButton,
+    InlineKeyboardMarkup,
+    Message,
+    User,
+)
 
 
 from wbb import SUDOERS, WELCOME_DELAY_KICK_SEC, app
 from wbb import SUDOERS, WELCOME_DELAY_KICK_SEC, app
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.permissions import adminsOnly
 from wbb.core.decorators.permissions import adminsOnly
 from wbb.core.keyboard import ikb
 from wbb.core.keyboard import ikb
-from wbb.utils.dbfunctions import (captcha_off, captcha_on, del_welcome,
-                                   get_captcha_cache, get_welcome,
-                                   has_solved_captcha_once, is_captcha_on,
-                                   is_gbanned_user, save_captcha_solved,
-                                   set_welcome, update_captcha_cache)
+from wbb.utils.dbfunctions import (
+    captcha_off,
+    captcha_on,
+    del_welcome,
+    get_captcha_cache,
+    get_welcome,
+    has_solved_captcha_once,
+    is_captcha_on,
+    is_gbanned_user,
+    save_captcha_solved,
+    set_welcome,
+    update_captcha_cache,
+)
 from wbb.utils.filter_groups import welcome_captcha_group
 from wbb.utils.filter_groups import welcome_captcha_group
 from wbb.utils.functions import extract_text_and_keyb, generate_captcha
 from wbb.utils.functions import extract_text_and_keyb, generate_captcha
 
 
@@ -252,8 +268,9 @@ async def callback_query_welcome_button(_, callback_query):
                 keyboard = i["keyboard"]
                 keyboard = i["keyboard"]
 
 
     if not (correct_answer and keyboard):
     if not (correct_answer and keyboard):
-        return await callback_query.answer("Something went wrong, Rejoin the "
-                                           "chat!")
+        return await callback_query.answer(
+            "Something went wrong, Rejoin the " "chat!"
+        )
 
 
     if pending_user_id != pressed_user_id:
     if pending_user_id != pressed_user_id:
         return await callback_query.answer("This is not for you")
         return await callback_query.answer("This is not for you")

+ 5 - 5
wbb/modules/img_pdf.py

@@ -36,10 +36,10 @@ from wbb.core.sections import section
 
 
 
 
 async def convert(
 async def convert(
-    main_message: Message,
-    reply_messages,
-    status_message: Message,
-    start_time: float,
+        main_message: Message,
+        reply_messages,
+        status_message: Message,
+        start_time: float,
 ):
 ):
     m = status_message
     m = status_message
 
 
@@ -78,7 +78,7 @@ async def convert(
             "IMG2PDF",
             "IMG2PDF",
             body={
             body={
                 "Title": pdf.name,
                 "Title": pdf.name,
-                "Size": f"{pdf.__sizeof__() / (10**6)}MB",
+                "Size": f"{pdf.__sizeof__() / (10 ** 6)}MB",
                 "Pages": len(documents),
                 "Pages": len(documents),
                 "Took": f"{elapsed}s",
                 "Took": f"{elapsed}s",
             },
             },

+ 10 - 4
wbb/modules/karma.py

@@ -29,9 +29,16 @@ from wbb import app
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.permissions import adminsOnly
 from wbb.core.decorators.permissions import adminsOnly
 from wbb.core.sections import section
 from wbb.core.sections import section
-from wbb.utils.dbfunctions import (alpha_to_int, get_karma, get_karmas,
-                                   int_to_alpha, is_karma_on, karma_off,
-                                   karma_on, update_karma)
+from wbb.utils.dbfunctions import (
+    alpha_to_int,
+    get_karma,
+    get_karmas,
+    int_to_alpha,
+    is_karma_on,
+    karma_off,
+    karma_on,
+    update_karma,
+)
 from wbb.utils.filter_groups import karma_negative_group, karma_positive_group
 from wbb.utils.filter_groups import karma_negative_group, karma_positive_group
 from wbb.utils.functions import get_user_id_and_usernames
 from wbb.utils.functions import get_user_id_and_usernames
 
 
@@ -42,7 +49,6 @@ __HELP__ = """[UPVOTE] - Use upvote keywords like "+", "+1", "thanks" etc to upv
 Reply to a message with /karma to check a user's karma
 Reply to a message with /karma to check a user's karma
 Send /karma without replying to any message to check karma list of top 10 users"""
 Send /karma without replying to any message to check karma list of top 10 users"""
 
 
-
 regex_upvote = r"^(\+|\+\+|\+1|thx|tnx|ty|thank you|thanx|thanks|pro|cool|good|👍|\+\+ .+)$"
 regex_upvote = r"^(\+|\+\+|\+1|thx|tnx|ty|thank you|thanx|thanks|pro|cool|good|👍|\+\+ .+)$"
 regex_downvote = r"^(-|--|-1|👎|-- .+)$"
 regex_downvote = r"^(-|--|-1|👎|-- .+)$"
 
 

+ 1 - 18
wbb/modules/misc.py

@@ -64,7 +64,7 @@ __HELP__ = """
 /arq
 /arq
     Statistics Of ARQ API.
     Statistics Of ARQ API.
 
 
-/webss [URL]
+/webss | .webss [URL] [FULL_SIZE?, use (y|yes|true) to get full size image. (optional)]
     Take A Screenshot Of A Webpage
     Take A Screenshot Of A Webpage
 
 
 /reverse
 /reverse
@@ -239,23 +239,6 @@ async def json_fetch(_, message):
         await m.edit(str(e))
         await m.edit(str(e))
 
 
 
 
-@app.on_message(filters.command("webss"))
-@capture_err
-async def take_ss(_, message):
-    if len(message.command) != 2:
-        return await message.reply_text("Give A Url To Fetch Screenshot.")
-    url = message.text.split(None, 1)[1]
-    m = await message.reply_text("**Uploading**")
-    try:
-        await app.send_photo(
-            message.chat.id,
-            photo=f"https://webshot.amanoteam.com/print?q={url}",
-        )
-    except Exception:
-        return await m.edit("No Such Website.")
-    await m.delete()
-
-
 @app.on_message(filters.command(["kickme", "banme"]))
 @app.on_message(filters.command(["kickme", "banme"]))
 async def kickbanme(_, message):
 async def kickbanme(_, message):
     await message.reply_text(
     await message.reply_text(

+ 8 - 4
wbb/modules/notes.py

@@ -29,8 +29,12 @@ from wbb import SUDOERS, USERBOT_ID, USERBOT_PREFIX, app, app2, eor
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.permissions import adminsOnly
 from wbb.core.decorators.permissions import adminsOnly
 from wbb.core.keyboard import ikb
 from wbb.core.keyboard import ikb
-from wbb.utils.dbfunctions import (delete_note, get_note, get_note_names,
-                                   save_note)
+from wbb.utils.dbfunctions import (
+    delete_note,
+    get_note,
+    get_note_names,
+    save_note,
+)
 from wbb.utils.functions import extract_text_and_keyb
 from wbb.utils.functions import extract_text_and_keyb
 
 
 __MODULE__ = "Notes"
 __MODULE__ = "Notes"
@@ -57,8 +61,8 @@ async def save_notee(_, message):
         )
         )
 
 
     elif (
     elif (
-        not message.reply_to_message.text
-        and not message.reply_to_message.sticker
+            not message.reply_to_message.text
+            and not message.reply_to_message.sticker
     ):
     ):
         await eor(
         await eor(
             message,
             message,

+ 2 - 2
wbb/modules/pipes.py

@@ -157,7 +157,7 @@ async def show_pipes_func(_, message: Message):
     text = ""
     text = ""
     for count, pipe in enumerate(pipes_list_bot.items(), 1):
     for count, pipe in enumerate(pipes_list_bot.items(), 1):
         text += (
         text += (
-            f"**Pipe:** `{count}`\n**From:** `{pipe[0]}`\n"
-            + f"**To:** `{pipe[1]}`\n\n"
+                f"**Pipe:** `{count}`\n**From:** `{pipe[0]}`\n"
+                + f"**To:** `{pipe[1]}`\n\n"
         )
         )
     await message.reply_text(text)
     await message.reply_text(text)

+ 5 - 2
wbb/modules/pmpermit.py

@@ -27,8 +27,11 @@ from pyrogram.raw.functions.messages import DeleteHistory
 
 
 from wbb import BOT_ID, SUDOERS, USERBOT_ID, USERBOT_PREFIX, app, app2, eor
 from wbb import BOT_ID, SUDOERS, USERBOT_ID, USERBOT_PREFIX, app, app2, eor
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.errors import capture_err
-from wbb.utils.dbfunctions import (approve_pmpermit, disapprove_pmpermit,
-                                   is_pmpermit_approved)
+from wbb.utils.dbfunctions import (
+    approve_pmpermit,
+    disapprove_pmpermit,
+    is_pmpermit_approved,
+)
 
 
 flood = {}
 flood = {}
 
 

+ 6 - 6
wbb/modules/proxy.py

@@ -32,8 +32,8 @@ from wbb.core.keyboard import ikb
 
 
 __MODULE__ = "Proxy"
 __MODULE__ = "Proxy"
 __HELP__ = (
 __HELP__ = (
-    "/proxy - Get socks5 proxy which you can"
-    + " use with telegram or other things"
+        "/proxy - Get socks5 proxy which you can"
+        + " use with telegram or other things"
 )
 )
 
 
 proxies = []
 proxies = []
@@ -53,8 +53,8 @@ def url_from_proxy(proxy: str) -> str:
     user, passwd = creds.split(":")
     user, passwd = creds.split(":")
     host, port = proxy.split(":")
     host, port = proxy.split(":")
     return (
     return (
-        f"https://t.me/socks?server={host}&port="
-        + f"{port}&user={user}&pass={passwd}"
+            f"https://t.me/socks?server={host}&port="
+            + f"{port}&user={user}&pass={passwd}"
     )
     )
 
 
 
 
@@ -92,8 +92,8 @@ async def proxy_callback_func(_, cq: CallbackQuery):
     url = url_from_proxy(proxy)
     url = url_from_proxy(proxy)
     keyb = ikb(
     keyb = ikb(
         {
         {
-            "←": f"proxy_arq_{index-1}",
-            "→": f"proxy_arq_{index+1}",
+            "←": f"proxy_arq_{index - 1}",
+            "→": f"proxy_arq_{index + 1}",
             "Connect": url,
             "Connect": url,
         }
         }
     )
     )

+ 1 - 1
wbb/modules/purge_me.py

@@ -136,7 +136,7 @@ async def purge_me_func(_, message: Message):
     # we have to do it in chunks of 100, i'll choose 99 just
     # we have to do it in chunks of 100, i'll choose 99 just
     # to be safe.
     # to be safe.
     to_delete = [
     to_delete = [
-        message_ids[i : i + 99] for i in range(0, len(message_ids), 99)
+        message_ids[i: i + 99] for i in range(0, len(message_ids), 99)
     ]
     ]
 
 
     for hundred_messages_or_less in to_delete:
     for hundred_messages_or_less in to_delete:

+ 7 - 8
wbb/modules/regex.py

@@ -10,7 +10,6 @@ from wbb.utils.filter_groups import regex_group
 __MODULE__ = "Sed"
 __MODULE__ = "Sed"
 __HELP__ = "**Usage:**\ns/foo/bar"
 __HELP__ = "**Usage:**\ns/foo/bar"
 
 
-
 DELIMITERS = ("/", ":", "|", "_")
 DELIMITERS = ("/", ":", "|", "_")
 
 
 
 
@@ -80,9 +79,9 @@ def infinite_checker(repl):
 
 
 def separate_sed(sed_string):
 def separate_sed(sed_string):
     if (
     if (
-        len(sed_string) >= 3
-        and sed_string[1] in DELIMITERS
-        and sed_string.count(sed_string[1]) >= 2
+            len(sed_string) >= 3
+            and sed_string[1] in DELIMITERS
+            and sed_string.count(sed_string[1]) >= 2
     ):
     ):
         delim = sed_string[1]
         delim = sed_string[1]
         start = counter = 2
         start = counter = 2
@@ -102,11 +101,11 @@ def separate_sed(sed_string):
             return None
             return None
         while counter < len(sed_string):
         while counter < len(sed_string):
             if (
             if (
-                sed_string[counter] == "\\"
-                and counter + 1 < len(sed_string)
-                and sed_string[counter + 1] == delim
+                    sed_string[counter] == "\\"
+                    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:
             elif sed_string[counter] == delim:
                 replace_with = sed_string[start:counter]
                 replace_with = sed_string[start:counter]

+ 5 - 5
wbb/modules/reverse.py

@@ -54,11 +54,11 @@ async def reverse_image_search(client, message: Message):
         )
         )
     reply = message.reply_to_message
     reply = message.reply_to_message
     if (
     if (
-        not reply.document
-        and not reply.photo
-        and not reply.sticker
-        and not reply.animation
-        and not reply.video
+            not reply.document
+            and not reply.photo
+            and not reply.sticker
+            and not reply.animation
+            and not reply.video
     ):
     ):
         return await eor(
         return await eor(
             message,
             message,

+ 7 - 2
wbb/modules/rice.py

@@ -24,8 +24,13 @@ SOFTWARE.
 from re import MULTILINE as RE_MULTILINE
 from re import MULTILINE as RE_MULTILINE
 
 
 from pyrogram import filters
 from pyrogram import filters
-from pyrogram.types import (InlineKeyboardButton, InlineKeyboardMarkup,
-                            InputMediaPhoto, InputMediaVideo, Message)
+from pyrogram.types import (
+    InlineKeyboardButton,
+    InlineKeyboardMarkup,
+    InputMediaPhoto,
+    InputMediaVideo,
+    Message,
+)
 
 
 from wbb import app
 from wbb import app
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.errors import capture_err

+ 7 - 2
wbb/modules/rss.py

@@ -7,8 +7,13 @@ from pyrogram.types import Message
 
 
 from wbb import RSS_DELAY, app, log
 from wbb import RSS_DELAY, app, log
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.errors import capture_err
-from wbb.utils.dbfunctions import (add_rss_feed, get_rss_feeds, is_rss_active,
-                                   remove_rss_feed, update_rss_feed)
+from wbb.utils.dbfunctions import (
+    add_rss_feed,
+    get_rss_feeds,
+    is_rss_active,
+    remove_rss_feed,
+    update_rss_feed,
+)
 from wbb.utils.functions import get_http_status_code, get_urls_from_text
 from wbb.utils.functions import get_http_status_code, get_urls_from_text
 from wbb.utils.rss import Feed
 from wbb.utils.rss import Feed
 
 

+ 27 - 15
wbb/modules/stickers.py

@@ -27,17 +27,29 @@ from asyncio import gather
 from traceback import format_exc
 from traceback import format_exc
 
 
 from pyrogram import filters
 from pyrogram import filters
-from pyrogram.errors import (PeerIdInvalid, ShortnameOccupyFailed,
-                             StickerEmojiInvalid, StickerPngDimensions,
-                             StickerPngNopng, UserIsBlocked)
+from pyrogram.errors import (
+    PeerIdInvalid,
+    ShortnameOccupyFailed,
+    StickerEmojiInvalid,
+    StickerPngDimensions,
+    StickerPngNopng,
+    UserIsBlocked,
+)
 from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
 from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
 
 
 from wbb import BOT_USERNAME, SUDOERS, USERBOT_PREFIX, app, app2, eor
 from wbb import BOT_USERNAME, SUDOERS, USERBOT_PREFIX, app, app2, eor
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.errors import capture_err
-from wbb.utils.files import (get_document_from_file_id,
-                             resize_file_to_sticker_size, upload_document)
-from wbb.utils.stickerset import (add_sticker_to_set, create_sticker,
-                                  create_sticker_set, get_sticker_set_by_name)
+from wbb.utils.files import (
+    get_document_from_file_id,
+    resize_file_to_sticker_size,
+    upload_document,
+)
+from wbb.utils.stickerset import (
+    add_sticker_to_set,
+    create_sticker,
+    create_sticker_set,
+    get_sticker_set_by_name,
+)
 
 
 __MODULE__ = "Stickers"
 __MODULE__ = "Stickers"
 __HELP__ = """
 __HELP__ = """
@@ -141,8 +153,8 @@ async def kang(client, message: Message):
     if len(args) > 1:
     if len(args) > 1:
         sticker_emoji = str(args[1])
         sticker_emoji = str(args[1])
     elif (
     elif (
-        message.reply_to_message.sticker
-        and message.reply_to_message.sticker.emoji
+            message.reply_to_message.sticker
+            and message.reply_to_message.sticker.emoji
     ):
     ):
         sticker_emoji = message.reply_to_message.sticker.emoji
         sticker_emoji = message.reply_to_message.sticker.emoji
     else:
     else:
@@ -217,12 +229,12 @@ async def kang(client, message: Message):
             elif stickerset.set.count >= MAX_STICKERS:
             elif stickerset.set.count >= MAX_STICKERS:
                 packnum += 1
                 packnum += 1
                 packname = (
                 packname = (
-                    "f"
-                    + str(packnum)
-                    + "_"
-                    + str(message.from_user.id)
-                    + "_by_"
-                    + BOT_USERNAME
+                        "f"
+                        + str(packnum)
+                        + "_"
+                        + str(message.from_user.id)
+                        + "_by_"
+                        + BOT_USERNAME
                 )
                 )
                 limit += 1
                 limit += 1
                 continue
                 continue

+ 15 - 4
wbb/modules/sudoers.py

@@ -30,12 +30,22 @@ import psutil
 from pyrogram import filters
 from pyrogram import filters
 from pyrogram.errors import FloodWait
 from pyrogram.errors import FloodWait
 
 
-from wbb import (BOT_ID, GBAN_LOG_GROUP_ID, SUDOERS, USERBOT_USERNAME, app,
-                 bot_start_time)
+from wbb import (
+    BOT_ID,
+    GBAN_LOG_GROUP_ID,
+    SUDOERS,
+    USERBOT_USERNAME,
+    app,
+    bot_start_time,
+)
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.errors import capture_err
 from wbb.utils import formatter
 from wbb.utils import formatter
-from wbb.utils.dbfunctions import (add_gban_user, get_served_chats,
-                                   is_gbanned_user, remove_gban_user)
+from wbb.utils.dbfunctions import (
+    add_gban_user,
+    get_served_chats,
+    is_gbanned_user,
+    remove_gban_user,
+)
 from wbb.utils.functions import extract_user, extract_user_and_reason, restart
 from wbb.utils.functions import extract_user, extract_user_and_reason, restart
 
 
 __MODULE__ = "Sudoers"
 __MODULE__ = "Sudoers"
@@ -57,6 +67,7 @@ __HELP__ = """
 /sh - Execute Shell Code
 /sh - Execute Shell Code
 """
 """
 
 
+
 # Stats Module
 # Stats Module
 
 
 
 

+ 14 - 6
wbb/modules/taglogger.py

@@ -25,8 +25,16 @@ from pykeyboard import InlineKeyboard
 from pyrogram import filters
 from pyrogram import filters
 from pyrogram.types import InlineKeyboardButton, Message
 from pyrogram.types import InlineKeyboardButton, Message
 
 
-from wbb import (BOT_ID, LOG_GROUP_ID, LOG_MENTIONS, USERBOT_ID, USERBOT_NAME,
-                 USERBOT_USERNAME, app, app2)
+from wbb import (
+    BOT_ID,
+    LOG_GROUP_ID,
+    LOG_MENTIONS,
+    USERBOT_ID,
+    USERBOT_NAME,
+    USERBOT_USERNAME,
+    app,
+    app2,
+)
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.errors import capture_err
 from wbb.utils.filter_groups import taglog_group
 from wbb.utils.filter_groups import taglog_group
 
 
@@ -77,7 +85,7 @@ async def tagLoggerFunc(_, message: Message):
     if message.reply_to_message:
     if message.reply_to_message:
         reply_message = message.reply_to_message
         reply_message = message.reply_to_message
         if reply_message.from_user and (
         if reply_message.from_user and (
-            reply_message.from_user.id == USERBOT_ID
+                reply_message.from_user.id == USERBOT_ID
         ):
         ):
             return await sendLog(message)
             return await sendLog(message)
 
 
@@ -88,8 +96,8 @@ async def tagLoggerFunc(_, message: Message):
     else:
     else:
         return
         return
     if (
     if (
-        str(USERBOT_ID) in text
-        or str(USERBOT_USERNAME) in text
-        or USERBOT_NAME in text
+            str(USERBOT_ID) in text
+            or str(USERBOT_USERNAME) in text
+            or USERBOT_NAME in text
     ):
     ):
         await sendLog(message)
         await sendLog(message)

+ 5 - 5
wbb/modules/userbot.py

@@ -51,9 +51,9 @@ async def iter_edit(message: Message, text: str):
             continue
             continue
 
 
         if (
         if (
-            (m.reply_to_message.message_id == message.message_id)
-            and (m.from_user.id == message.from_user.id)
-            and ("→" in m.text)
+                (m.reply_to_message.message_id == message.message_id)
+                and (m.from_user.id == message.from_user.id)
+                and ("→" in m.text)
         ):
         ):
             try:
             try:
                 return await m.edit(text)
                 return await m.edit(text)
@@ -167,8 +167,8 @@ async def shellrunner(_, message: Message):
     if message.reply_to_message:
     if message.reply_to_message:
         r = message.reply_to_message
         r = message.reply_to_message
         if r.reply_markup and isinstance(
         if r.reply_markup and isinstance(
-            r.reply_markup,
-            ReplyKeyboardMarkup,
+                r.reply_markup,
+                ReplyKeyboardMarkup,
         ):
         ):
             return await eor(message, text="INSECURE!")
             return await eor(message, text="INSECURE!")
 
 

+ 62 - 15
wbb/modules/webss.py

@@ -21,32 +21,79 @@ 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
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
 SOFTWARE.
 """
 """
+from asyncio import gather
+from base64 import b64decode
+from io import BytesIO
+
 from pyrogram import filters
 from pyrogram import filters
 from pyrogram.types import Message
 from pyrogram.types import Message
 
 
-from wbb import app
+from wbb import SUDOERS, USERBOT_PREFIX, app, app2, eor
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.errors import capture_err
+from wbb.utils.http import post
+
 
 
-__MODULE__ = "WebSS"
-__HELP__ = "/webss | .webss [URL] - Take A Screenshot Of A Webpage"
+async def take_screenshot(url: str, full: bool = False) -> BytesIO:
+    url = "https://" + url if not url.startswith("http") else url
+    payload = {
+        "url": url,
+        "width": 1920,
+        "height": 1080,
+        "scale": 2,
+        "format": "jpeg",
+    }
+    if full:
+        payload["full"] = True
+    data = await post(
+        "https://webscreenshot.vercel.app/api",
+        data=payload,
+    )
+    if "image" not in data:
+        return None
+    b = data["image"].replace("data:image/jpeg;base64,", "")
+    file = BytesIO(b64decode(b))
+    file.name = "webss.jpg"
+    return file
 
 
 
 
+@app2.on_message(filters.command("webss", USERBOT_PREFIX) & SUDOERS)
 @app.on_message(filters.command("webss"))
 @app.on_message(filters.command("webss"))
 @capture_err
 @capture_err
 async def take_ss(_, message: Message):
 async def take_ss(_, message: Message):
-    try:
-        if len(message.command) != 2:
-            return await message.reply_text("Give A Url To Fetch Screenshot.")
+    if len(message.command) < 2:
+        return await eor(message, text="Give A Url To Fetch Screenshot.")
+
+    if len(message.command) == 2:
         url = message.text.split(None, 1)[1]
         url = message.text.split(None, 1)[1]
-        m = await message.reply_text("**Taking Screenshot**")
-        await m.edit("**Uploading**")
-        try:
-            await message.reply_photo(
-                photo=f"https://webshot.amanoteam.com/print?q={url}",
-                quote=False,
+        full = False
+    elif len(message.command) == 3:
+        url = message.text.split(None, 2)[1]
+        full = message.text.split(None, 2)[2].lower().strip() in [
+            "yes",
+            "y",
+            "1",
+            "true",
+        ]
+    else:
+        return await eor(message, text="Invalid Command.")
+
+    m = await eor(message, text="Capturing screenshot...")
+
+    try:
+        photo = await take_screenshot(url, full)
+        if not photo:
+            return await m.edit("Failed To Take Screenshot")
+
+        m = await m.edit("Uploading...")
+
+        if not full:
+            # Full size images have problem with reply_photo, that's why
+            # we need to only use reply_photo if we're not using full size
+            await gather(
+                *[message.reply_document(photo), message.reply_photo(photo)]
             )
             )
-        except TypeError:
-            return await m.edit("No Such Website.")
+        else:
+            await message.reply_document(photo)
         await m.delete()
         await m.delete()
     except Exception as e:
     except Exception as e:
-        await message.reply_text(str(e))
+        await m.edit(str(e))

+ 4 - 4
wbb/utils/dbfunctions.py

@@ -592,8 +592,8 @@ async def deactivate_pipe(from_chat_id: int, to_chat_id: int):
         return
         return
     for pipe in pipes:
     for pipe in pipes:
         if (
         if (
-            pipe["from_chat_id"] == from_chat_id
-            and pipe["to_chat_id"] == to_chat_id
+                pipe["from_chat_id"] == from_chat_id
+                and pipe["to_chat_id"] == to_chat_id
         ):
         ):
             pipes.remove(pipe)
             pipes.remove(pipe)
     return await pipesdb.update_one(
     return await pipesdb.update_one(
@@ -604,8 +604,8 @@ async def deactivate_pipe(from_chat_id: int, to_chat_id: int):
 async def is_pipe_active(from_chat_id: int, to_chat_id: int) -> bool:
 async def is_pipe_active(from_chat_id: int, to_chat_id: int) -> bool:
     for pipe in await show_pipes():
     for pipe in await show_pipes():
         if (
         if (
-            pipe["from_chat_id"] == from_chat_id
-            and pipe["to_chat_id"] == to_chat_id
+                pipe["from_chat_id"] == from_chat_id
+                and pipe["to_chat_id"] == to_chat_id
         ):
         ):
             return True
             return True
 
 

+ 7 - 8
wbb/utils/downloader.py

@@ -13,9 +13,9 @@ def ensure_status(status_code: int):
 
 
 
 
 async def download_url(
 async def download_url(
-    url,
-    file_path,
-    chunk_size,
+        url,
+        file_path,
+        chunk_size,
 ):
 ):
     file_path = file_path or url.split("/")[-1][:20]
     file_path = file_path or url.split("/")[-1][:20]
 
 
@@ -23,7 +23,6 @@ async def download_url(
         ensure_status(response.status)
         ensure_status(response.status)
 
 
         async with aiofiles.open(file_path, "wb") as f:
         async with aiofiles.open(file_path, "wb") as f:
-
             # Save content in file using aiohttp streamReader.
             # Save content in file using aiohttp streamReader.
             async for chunk in response.content.iter_chunked(chunk_size):
             async for chunk in response.content.iter_chunked(chunk_size):
                 await f.write(chunk)
                 await f.write(chunk)
@@ -32,10 +31,10 @@ async def download_url(
 
 
 
 
 async def download(
 async def download(
-    url: str,
-    file_path: str = None,
-    chunk_size: int = 1000000,  # 1MB chunk
-    task_id: int = int(time()),
+        url: str,
+        file_path: str = None,
+        chunk_size: int = 1000000,  # 1MB chunk
+        task_id: int = int(time()),
 ):
 ):
     """
     """
     :url: url where the file is located
     :url: url where the file is located

+ 3 - 3
wbb/utils/files.py

@@ -59,14 +59,14 @@ async def resize_file_to_sticker_size(file_path: str) -> str:
 
 
 
 
 async def upload_document(
 async def upload_document(
-    client: Client, file_path: str, chat_id: int
+        client: Client, file_path: str, chat_id: int
 ) -> raw.base.InputDocument:
 ) -> raw.base.InputDocument:
     media = await client.send(
     media = await client.send(
         raw.functions.messages.UploadMedia(
         raw.functions.messages.UploadMedia(
             peer=await client.resolve_peer(chat_id),
             peer=await client.resolve_peer(chat_id),
             media=raw.types.InputMediaUploadedDocument(
             media=raw.types.InputMediaUploadedDocument(
                 mime_type=client.guess_mime_type(file_path)
                 mime_type=client.guess_mime_type(file_path)
-                or "application/zip",
+                          or "application/zip",
                 file=await client.save_file(file_path),
                 file=await client.save_file(file_path),
                 attributes=[
                 attributes=[
                     raw.types.DocumentAttributeFilename(
                     raw.types.DocumentAttributeFilename(
@@ -84,7 +84,7 @@ async def upload_document(
 
 
 
 
 async def get_document_from_file_id(
 async def get_document_from_file_id(
-    file_id: str,
+        file_id: str,
 ) -> raw.base.InputDocument:
 ) -> raw.base.InputDocument:
     decoded = FileId.decode(file_id)
     decoded = FileId.decode(file_id)
     return raw.types.InputDocument(
     return raw.types.InputDocument(

+ 7 - 7
wbb/utils/functions.py

@@ -94,7 +94,7 @@ def generate_captcha():
 
 
 def test_speedtest():
 def test_speedtest():
     def speed_convert(size):
     def speed_convert(size):
-        power = 2**10
+        power = 2 ** 10
         zero = 0
         zero = 0
         units = {0: "", 1: "Kb/s", 2: "Mb/s", 3: "Gb/s", 4: "Tb/s"}
         units = {0: "", 1: "Kb/s", 2: "Mb/s", 3: "Gb/s", 4: "Tb/s"}
         while size > power:
         while size > power:
@@ -216,9 +216,9 @@ async def extract_user_and_reason(message, sender_chat=False):
         # if reply to a message and no reason is given
         # if reply to a message and no reason is given
         if not reply.from_user:
         if not reply.from_user:
             if (
             if (
-                reply.sender_chat
-                and reply.sender_chat != message.chat.id
-                and sender_chat
+                    reply.sender_chat
+                    and reply.sender_chat != message.chat.id
+                    and sender_chat
             ):
             ):
                 id_ = reply.sender_chat.id
                 id_ = reply.sender_chat.id
             else:
             else:
@@ -250,9 +250,9 @@ async def extract_user(message):
 
 
 
 
 def get_file_id_from_message(
 def get_file_id_from_message(
-    message,
-    max_file_size=3145728,
-    mime_types=["image/png", "image/jpeg"],
+        message,
+        max_file_size=3145728,
+        mime_types=["image/png", "image/jpeg"],
 ):
 ):
     file_id = None
     file_id = None
     if message.document:
     if message.document:

+ 24 - 11
wbb/utils/inlinefuncs.py

@@ -35,13 +35,26 @@ from pykeyboard import InlineKeyboard
 from pyrogram import __version__ as pyrover
 from pyrogram import __version__ as pyrover
 from pyrogram import filters
 from pyrogram import filters
 from pyrogram.raw.functions import Ping
 from pyrogram.raw.functions import Ping
-from pyrogram.types import (CallbackQuery, InlineKeyboardButton,
-                            InlineQueryResultArticle, InlineQueryResultPhoto,
-                            InputTextMessageContent)
+from pyrogram.types import (
+    CallbackQuery,
+    InlineKeyboardButton,
+    InlineQueryResultArticle,
+    InlineQueryResultPhoto,
+    InputTextMessageContent,
+)
 from search_engine_parser import GoogleSearch
 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 import (
+    BOT_USERNAME,
+    MESSAGE_DUMP_CHAT,
+    SUDOERS,
+    USERBOT_ID,
+    USERBOT_NAME,
+    USERBOT_USERNAME,
+    app,
+    app2,
+    arq,
+)
 from wbb.core.keyboard import ikb
 from wbb.core.keyboard import ikb
 from wbb.core.tasks import _get_tasks_text, all_tasks, rm_task
 from wbb.core.tasks import _get_tasks_text, all_tasks, rm_task
 from wbb.core.types import InlineQueryResultCachedDocument
 from wbb.core.types import InlineQueryResultCachedDocument
@@ -753,12 +766,12 @@ async def execute_code(query):
     languages = (await arq.execute()).result
     languages = (await arq.execute()).result
     if len(text.split()) == 1:
     if len(text.split()) == 1:
         answers = [
         answers = [
-            InlineQueryResultArticle(
-                title=lang,
-                input_message_content=InputTextMessageContent(lang),
-            )
-            for lang in languages
-        ][offset : offset + 25]
+                      InlineQueryResultArticle(
+                          title=lang,
+                          input_message_content=InputTextMessageContent(lang),
+                      )
+                      for lang in languages
+                  ][offset: offset + 25]
         await query.answer(
         await query.answer(
             next_offset=str(offset + 25),
             next_offset=str(offset + 25),
             results=answers,
             results=answers,

+ 20 - 17
wbb/utils/misc.py

@@ -88,23 +88,26 @@ def paginate_modules(page_n, module_dict, prefix, chat=None):
     # can only have a certain amount of buttons side by side
     # can only have a certain amount of buttons side by side
     if len(pairs) > COLUMN_SIZE:
     if len(pairs) > COLUMN_SIZE:
         pairs = pairs[
         pairs = pairs[
-            modulo_page * COLUMN_SIZE : COLUMN_SIZE * (modulo_page + 1)
-        ] + [
-            (
-                EqInlineKeyboardButton(
-                    "❮",
-                    callback_data="{}_prev({})".format(prefix, modulo_page),
-                ),
-                EqInlineKeyboardButton(
-                    "Back",
-                    callback_data="{}_home({})".format(prefix, modulo_page),
-                ),
-                EqInlineKeyboardButton(
-                    "❯",
-                    callback_data="{}_next({})".format(prefix, modulo_page),
-                ),
-            )
-        ]
+                modulo_page * COLUMN_SIZE: COLUMN_SIZE * (modulo_page + 1)
+                ] + [
+                    (
+                        EqInlineKeyboardButton(
+                            "❮",
+                            callback_data="{}_prev({})".format(prefix,
+                                                               modulo_page),
+                        ),
+                        EqInlineKeyboardButton(
+                            "Back",
+                            callback_data="{}_home({})".format(prefix,
+                                                               modulo_page),
+                        ),
+                        EqInlineKeyboardButton(
+                            "❯",
+                            callback_data="{}_next({})".format(prefix,
+                                                               modulo_page),
+                        ),
+                    )
+                ]
 
 
     return pairs
     return pairs
 
 

+ 10 - 10
wbb/utils/stickerset.py

@@ -27,7 +27,7 @@ from pyrogram import Client, errors, raw
 
 
 
 
 async def get_sticker_set_by_name(
 async def get_sticker_set_by_name(
-    client: Client, name: str
+        client: Client, name: str
 ) -> raw.base.messages.StickerSet:
 ) -> raw.base.messages.StickerSet:
     try:
     try:
         return await client.send(
         return await client.send(
@@ -46,11 +46,11 @@ async def get_sticker_set_by_name(
 
 
 
 
 async def create_sticker_set(
 async def create_sticker_set(
-    client: Client,
-    owner: int,
-    title: str,
-    short_name: str,
-    stickers: List[raw.base.InputStickerSetItem],
+        client: Client,
+        owner: int,
+        title: str,
+        short_name: str,
+        stickers: List[raw.base.InputStickerSetItem],
 ) -> raw.base.messages.StickerSet:
 ) -> raw.base.messages.StickerSet:
     return await client.send(
     return await client.send(
         raw.functions.stickers.CreateStickerSet(
         raw.functions.stickers.CreateStickerSet(
@@ -63,9 +63,9 @@ async def create_sticker_set(
 
 
 
 
 async def add_sticker_to_set(
 async def add_sticker_to_set(
-    client: Client,
-    stickerset: raw.base.messages.StickerSet,
-    sticker: raw.base.InputStickerSetItem,
+        client: Client,
+        stickerset: raw.base.messages.StickerSet,
+        sticker: raw.base.InputStickerSetItem,
 ) -> raw.base.messages.StickerSet:
 ) -> raw.base.messages.StickerSet:
     return await client.send(
     return await client.send(
         raw.functions.stickers.AddStickerToSet(
         raw.functions.stickers.AddStickerToSet(
@@ -78,6 +78,6 @@ async def add_sticker_to_set(
 
 
 
 
 async def create_sticker(
 async def create_sticker(
-    sticker: raw.base.InputDocument, emoji: str
+        sticker: raw.base.InputDocument, emoji: str
 ) -> raw.base.InputStickerSetItem:
 ) -> raw.base.InputStickerSetItem:
     return raw.types.InputStickerSetItem(document=sticker, emoji=emoji)
     return raw.types.InputStickerSetItem(document=sticker, emoji=emoji)