浏览代码

Pyrogram 2.0 (#205)

˹ᴧɴσɴʏᴍσᴜs ꭙ˼ 3 年之前
父节点
当前提交
39e703dd4b
共有 83 个文件被更改,包括 604 次插入 和 973 次删除
  1. 1 1
      LICENSE
  2. 1 1
      requirements.txt
  3. 1 1
      sample_config.py
  4. 1 1
      str_gen.py
  5. 6 4
      wbb/__init__.py
  6. 28 51
      wbb/__main__.py
  7. 1 1
      wbb/core/decorators/misc.py
  8. 5 10
      wbb/core/decorators/permissions.py
  9. 1 1
      wbb/core/filters.py
  10. 1 1
      wbb/core/keyboard.py
  11. 8 8
      wbb/core/sections.py
  12. 4 4
      wbb/core/tasks.py
  13. 33 39
      wbb/core/types/InlineQueryResult.py
  14. 1 4
      wbb/core/types/__init__.py
  15. 6 6
      wbb/modules/__init__.py
  16. 1 1
      wbb/modules/__main__.py
  17. 68 122
      wbb/modules/admin.py
  18. 5 19
      wbb/modules/admin_misc.py
  19. 1 1
      wbb/modules/alive.py
  20. 3 7
      wbb/modules/anonymize.py
  21. 4 16
      wbb/modules/antiservice.py
  22. 2 5
      wbb/modules/arq.py
  23. 4 11
      wbb/modules/autocorrect.py
  24. 7 18
      wbb/modules/blacklist.py
  25. 8 32
      wbb/modules/blacklist_chat.py
  26. 4 11
      wbb/modules/carbon.py
  27. 2 6
      wbb/modules/chat_watcher.py
  28. 16 22
      wbb/modules/chatbot.py
  29. 10 10
      wbb/modules/couple.py
  30. 2 5
      wbb/modules/create.py
  31. 1 1
      wbb/modules/crypto.py
  32. 1 1
      wbb/modules/dice.py
  33. 2 4
      wbb/modules/download_upload.py
  34. 8 19
      wbb/modules/filters.py
  35. 5 10
      wbb/modules/flood.py
  36. 9 8
      wbb/modules/global_stats.py
  37. 17 32
      wbb/modules/greetings.py
  38. 7 7
      wbb/modules/img_pdf.py
  39. 4 6
      wbb/modules/info.py
  40. 13 37
      wbb/modules/inline.py
  41. 16 12
      wbb/modules/iplookup.py
  42. 5 8
      wbb/modules/karma.py
  43. 4 8
      wbb/modules/locks.py
  44. 19 30
      wbb/modules/misc.py
  45. 4 4
      wbb/modules/mongo_backup.py
  46. 10 14
      wbb/modules/music.py
  47. 7 17
      wbb/modules/notes.py
  48. 2 6
      wbb/modules/parse_preview.py
  49. 3 5
      wbb/modules/paste.py
  50. 7 10
      wbb/modules/pipes.py
  51. 9 20
      wbb/modules/pmpermit.py
  52. 3 5
      wbb/modules/purge_me.py
  53. 8 12
      wbb/modules/quotly.py
  54. 2 2
      wbb/modules/reddit.py
  55. 8 11
      wbb/modules/regex.py
  56. 4 8
      wbb/modules/repo.py
  57. 12 16
      wbb/modules/reverse.py
  58. 9 15
      wbb/modules/rice.py
  59. 11 6
      wbb/modules/rss.py
  60. 14 23
      wbb/modules/stickers.py
  61. 2 5
      wbb/modules/sudo.py
  62. 9 11
      wbb/modules/sudoers.py
  63. 4 13
      wbb/modules/taglogger.py
  64. 1 1
      wbb/modules/telegraph.py
  65. 2 2
      wbb/modules/tts.py
  66. 13 24
      wbb/modules/userbot.py
  67. 3 5
      wbb/modules/webss.py
  68. 1 1
      wbb/utils/__init__.py
  69. 5 4
      wbb/utils/constants.py
  70. 8 13
      wbb/utils/dbfunctions.py
  71. 7 7
      wbb/utils/downloader.py
  72. 4 5
      wbb/utils/files.py
  73. 1 1
      wbb/utils/filter_groups.py
  74. 1 1
      wbb/utils/formatter.py
  75. 12 11
      wbb/utils/functions.py
  76. 1 1
      wbb/utils/http.py
  77. 34 52
      wbb/utils/inlinefuncs.py
  78. 1 1
      wbb/utils/json_prettify.py
  79. 17 22
      wbb/utils/misc.py
  80. 1 1
      wbb/utils/pastebin.py
  81. 1 1
      wbb/utils/read_lines.py
  82. 3 1
      wbb/utils/rss.py
  83. 14 14
      wbb/utils/stickerset.py

+ 1 - 1
LICENSE

@@ -1,6 +1,6 @@
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
requirements.txt

@@ -9,7 +9,7 @@ motor
 pillow
 pillow
 psutil
 psutil
 pykeyboard
 pykeyboard
-pyrogram==1.4.16
+pyrogram
 python-arq
 python-arq
 requests
 requests
 search-engine-parser
 search-engine-parser

+ 1 - 1
sample_config.py

@@ -1,6 +1,6 @@
 BOT_TOKEN = "467677575:YZfaakjwd545dfg-N6JStihhuw5gQeZHntc"
 BOT_TOKEN = "467677575:YZfaakjwd545dfg-N6JStihhuw5gQeZHntc"
 API_ID = 123456
 API_ID = 123456
-SESSION_STRING = "" # Check Readme to generate sessions; need for userbot
+SESSION_STRING = ""  # Check Readme to generate sessions; need for userbot
 API_HASH = "dfxcgs5s12hdcxfgdfz"
 API_HASH = "dfxcgs5s12hdcxfgdfz"
 USERBOT_PREFIX = "."
 USERBOT_PREFIX = "."
 PHONE_NUMBER = "+916969696969"  # Need for Userbot
 PHONE_NUMBER = "+916969696969"  # Need for Userbot

+ 1 - 1
str_gen.py

@@ -5,7 +5,7 @@ API_HASH = input("\nEnter Your API_HASH:\n > ")
 
 
 print("\n\n Enter Phone number when asked.\n\n")
 print("\n\n Enter Phone number when asked.\n\n")
 
 
-i = c(":memory:", api_id=API_ID, api_hash=API_HASH)
+i = c("wbb", api_id=API_ID, api_hash=API_HASH, in_memory=True)
 
 
 with i:
 with i:
     ss = i.export_session_string()
     ss = i.export_session_string()

+ 6 - 4
wbb/__init__.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -103,13 +103,15 @@ loop.run_until_complete(load_sudoers())
 
 
 if not SESSION_STRING:
 if not SESSION_STRING:
     app2 = Client(
     app2 = Client(
-        "userbot",
-        phone_number=PHONE_NUMBER,
+        name="userbot",
         api_id=API_ID,
         api_id=API_ID,
         api_hash=API_HASH,
         api_hash=API_HASH,
+        phone_number=PHONE_NUMBER,
     )
     )
 else:
 else:
-    app2 = Client(SESSION_STRING, api_id=API_ID, api_hash=API_HASH)
+    app2 = Client(
+        name="userbot", api_id=API_ID, api_hash=API_HASH, session_string=SESSION_STRING
+    )
 
 
 aiohttpsession = ClientSession()
 aiohttpsession = ClientSession()
 
 

+ 28 - 51
wbb/__main__.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -26,9 +26,10 @@ import importlib
 import re
 import re
 from contextlib import closing, suppress
 from contextlib import closing, suppress
 
 
-from uvloop import install
 from pyrogram import filters, idle
 from pyrogram import filters, idle
+from pyrogram.enums import ChatType, ParseMode
 from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
 from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
+from uvloop import install
 
 
 from wbb import (
 from wbb import (
     BOT_NAME,
     BOT_NAME,
@@ -55,15 +56,9 @@ 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 (
-                hasattr(imported_module, "__MODULE__")
-                and imported_module.__MODULE__
-        ):
+        if hasattr(imported_module, "__MODULE__") and imported_module.__MODULE__:
             imported_module.__MODULE__ = imported_module.__MODULE__
             imported_module.__MODULE__ = imported_module.__MODULE__
-            if (
-                    hasattr(imported_module, "__HELP__")
-                    and imported_module.__HELP__
-            ):
+            if hasattr(imported_module, "__HELP__") and imported_module.__HELP__:
                 HELPABLE[
                 HELPABLE[
                     imported_module.__MODULE__.replace(" ", "_").lower()
                     imported_module.__MODULE__.replace(" ", "_").lower()
                 ] = imported_module
                 ] = imported_module
@@ -114,9 +109,7 @@ async def start_bot():
 home_keyboard_pm = InlineKeyboardMarkup(
 home_keyboard_pm = InlineKeyboardMarkup(
     [
     [
         [
         [
-            InlineKeyboardButton(
-                text="Commands ❓", callback_data="bot_commands"
-            ),
+            InlineKeyboardButton(text="Commands ❓", callback_data="bot_commands"),
             InlineKeyboardButton(
             InlineKeyboardButton(
                 text="Repo 🛠",
                 text="Repo 🛠",
                 url="https://github.com/thehamkercat/WilliamButcherBot",
                 url="https://github.com/thehamkercat/WilliamButcherBot",
@@ -127,9 +120,7 @@ home_keyboard_pm = InlineKeyboardMarkup(
                 text="System Stats 🖥",
                 text="System Stats 🖥",
                 callback_data="stats_callback",
                 callback_data="stats_callback",
             ),
             ),
-            InlineKeyboardButton(
-                text="Support 👨", url="http://t.me/WBBSupport"
-            ),
+            InlineKeyboardButton(text="Support 👨", url="http://t.me/WBBSupport"),
         ],
         ],
         [
         [
             InlineKeyboardButton(
             InlineKeyboardButton(
@@ -141,9 +132,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(
@@ -169,23 +160,21 @@ keyboard = InlineKeyboardMarkup(
 )
 )
 
 
 
 
-@app.on_message(~filters.edited & filters.command("start"))
+@app.on_message(filters.command("start"))
 async def start(_, message):
 async def start(_, message):
-    if message.chat.type != "private":
-        return await message.reply(
-            "Pm Me For More Details.", reply_markup=keyboard
-        )
+    if message.chat.type != ChatType.PRIVATE:
+        return await message.reply("Pm Me For More Details.", reply_markup=keyboard)
     if len(message.text.split()) > 1:
     if len(message.text.split()) > 1:
         name = (message.text.split(None, 1)[1]).lower()
         name = (message.text.split(None, 1)[1]).lower()
         if name == "mkdwn_help":
         if name == "mkdwn_help":
             await message.reply(
             await message.reply(
-                MARKDOWN, parse_mode="html", disable_web_page_preview=True
+                MARKDOWN, parse_mode=ParseMode.HTML, disable_web_page_preview=True
             )
             )
         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":
@@ -202,9 +191,9 @@ async def start(_, message):
     return
     return
 
 
 
 
-@app.on_message(~filters.edited & filters.command("help"))
+@app.on_message(filters.command("help"))
 async def help_command(_, message):
 async def help_command(_, message):
-    if message.chat.type != "private":
+    if message.chat.type != ChatType.PRIVATE:
         if len(message.command) >= 2:
         if len(message.command) >= 2:
             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:
@@ -223,35 +212,27 @@ async def help_command(_, message):
                     reply_markup=key,
                     reply_markup=key,
                 )
                 )
             else:
             else:
-                await message.reply(
-                    "PM Me For More Details.", reply_markup=keyboard
-                )
+                await message.reply("PM Me For More Details.", reply_markup=keyboard)
         else:
         else:
-            await message.reply(
-                "Pm Me For More Details.", reply_markup=keyboard
-            )
+            await message.reply("Pm Me For More Details.", reply_markup=keyboard)
     else:
     else:
         if len(message.command) >= 2:
         if len(message.command) >= 2:
             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:
-                text, help_keyboard = await help_parser(
-                    message.from_user.first_name
-                )
+                text, help_keyboard = await help_parser(message.from_user.first_name)
                 await message.reply(
                 await message.reply(
                     text,
                     text,
                     reply_markup=help_keyboard,
                     reply_markup=help_keyboard,
                     disable_web_page_preview=True,
                     disable_web_page_preview=True,
                 )
                 )
         else:
         else:
-            text, help_keyboard = await help_parser(
-                message.from_user.first_name
-            )
+            text, help_keyboard = await help_parser(message.from_user.first_name)
             await message.reply(
             await message.reply(
                 text, reply_markup=help_keyboard, disable_web_page_preview=True
                 text, reply_markup=help_keyboard, disable_web_page_preview=True
             )
             )
@@ -302,7 +283,7 @@ async def help_button(client, query):
     create_match = re.match(r"help_create", query.data)
     create_match = re.match(r"help_create", query.data)
     top_text = f"""
     top_text = f"""
 Hello {query.from_user.first_name}, My name is {BOT_NAME}.
 Hello {query.from_user.first_name}, My name is {BOT_NAME}.
-I'm a group management bot with some usefule features.
+I'm a group management bot with some useful features.
 You can choose an option below, by clicking a button.
 You can choose an option below, by clicking a button.
 Also you can ask anything in Support Group.
 Also you can ask anything in Support Group.
 
 
@@ -313,10 +294,8 @@ 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(
@@ -356,9 +335,7 @@ General command are:
     elif back_match:
     elif back_match:
         await query.message.edit(
         await query.message.edit(
             text=top_text,
             text=top_text,
-            reply_markup=InlineKeyboardMarkup(
-                paginate_modules(0, HELPABLE, "help")
-            ),
+            reply_markup=InlineKeyboardMarkup(paginate_modules(0, HELPABLE, "help")),
             disable_web_page_preview=True,
             disable_web_page_preview=True,
         )
         )
 
 

+ 1 - 1
wbb/core/decorators/misc.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal

+ 5 - 10
wbb/core/decorators/permissions.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -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)
@@ -67,10 +67,7 @@ def adminsOnly(permission):
             chatID = message.chat.id
             chatID = message.chat.id
             if not message.from_user:
             if not message.from_user:
                 # For anonymous admins
                 # For anonymous admins
-                if (
-                        message.sender_chat
-                        and message.sender_chat.id == message.chat.id
-                ):
+                if message.sender_chat and message.sender_chat.id == message.chat.id:
                     return await authorised(
                     return await authorised(
                         func,
                         func,
                         subFunc2,
                         subFunc2,
@@ -85,9 +82,7 @@ def adminsOnly(permission):
             permissions = await member_permissions(chatID, userID)
             permissions = await member_permissions(chatID, userID)
             if userID not in SUDOERS and permission not in permissions:
             if userID not in SUDOERS and permission not in permissions:
                 return await unauthorised(message, permission, subFunc2)
                 return await unauthorised(message, permission, subFunc2)
-            return await authorised(
-                func, subFunc2, client, message, *args, **kwargs
-            )
+            return await authorised(func, subFunc2, client, message, *args, **kwargs)
 
 
         return subFunc2
         return subFunc2
 
 

+ 1 - 1
wbb/core/filters.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
wbb/core/keyboard.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal

+ 8 - 8
wbb/core/sections.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -32,17 +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 - 4
wbb/core/tasks.py

@@ -17,10 +17,10 @@ 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

+ 33 - 39
wbb/core/types/InlineQueryResult.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -66,8 +66,8 @@ class InlineQueryResultAudio(InlineQueryResult):
         parse_mode (``str``, *optional*):
         parse_mode (``str``, *optional*):
             By default, texts are parsed using both Markdown and HTML styles.
             By default, texts are parsed using both Markdown and HTML styles.
             You can combine both syntaxes together.
             You can combine both syntaxes together.
-            Pass "markdown" or "md" to enable Markdown-style parsing only.
-            Pass "html" to enable HTML-style parsing only.
+            Pass `ParseMode.MARKDOWN` to enable Markdown-style parsing only.
+            Pass `ParseMode.HTML` to enable HTML-style parsing only.
             Pass None to completely disable style parsing.
             Pass None to completely disable style parsing.
 
 
         caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
         caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
@@ -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)
 
 
@@ -157,9 +157,7 @@ class InlineQueryResultAudio(InlineQueryResult):
             thumb=thumb,
             thumb=thumb,
             content=audio,
             content=audio,
             send_message=(
             send_message=(
-                await self.input_message_content.write(
-                    client, self.reply_markup
-                )
+                await self.input_message_content.write(client, self.reply_markup)
                 if self.input_message_content
                 if self.input_message_content
                 else raw.types.InputBotInlineMessageMediaAuto(
                 else raw.types.InputBotInlineMessageMediaAuto(
                     reply_markup=await self.reply_markup.write(client)
                     reply_markup=await self.reply_markup.write(client)
@@ -203,8 +201,8 @@ class InlineQueryResultCachedDocument(InlineQueryResult):
         parse_mode (``str``, *optional*):
         parse_mode (``str``, *optional*):
             By default, texts are parsed using both Markdown and HTML styles.
             By default, texts are parsed using both Markdown and HTML styles.
             You can combine both syntaxes together.
             You can combine both syntaxes together.
-            Pass "markdown" or "md" to enable Markdown-style parsing only.
-            Pass "html" to enable HTML-style parsing only.
+            Pass `ParseMode.MARKDOWN` to enable Markdown-style parsing only.
+            Pass `ParseMode.HTML` to enable HTML-style parsing only.
             Pass None to completely disable style parsing.
             Pass None to completely disable style parsing.
         caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
         caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
                 List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
                 List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
@@ -217,16 +215,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)
 
 
@@ -258,9 +256,7 @@ class InlineQueryResultCachedDocument(InlineQueryResult):
             description=self.description,
             description=self.description,
             document=document,
             document=document,
             send_message=(
             send_message=(
-                await self.input_message_content.write(
-                    client, self.reply_markup
-                )
+                await self.input_message_content.write(client, self.reply_markup)
                 if self.input_message_content
                 if self.input_message_content
                 else raw.types.InputBotInlineMessageMediaAuto(
                 else raw.types.InputBotInlineMessageMediaAuto(
                     reply_markup=await self.reply_markup.write(client)
                     reply_markup=await self.reply_markup.write(client)
@@ -274,7 +270,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)
@@ -292,9 +288,7 @@ def get_input_file_from_file_id(
         )
         )
 
 
     if file_type in (FileType.THUMBNAIL, FileType.CHAT_PHOTO):
     if file_type in (FileType.THUMBNAIL, FileType.CHAT_PHOTO):
-        raise ValueError(
-            f"This file_id can only be used for download: {file_id}"
-        )
+        raise ValueError(f"This file_id can only be used for download: {file_id}")
 
 
     if file_type in PHOTO_TYPES:
     if file_type in PHOTO_TYPES:
         return raw.types.InputPhoto(
         return raw.types.InputPhoto(

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

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

+ 6 - 6
wbb/modules/__init__.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -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()
 
 

+ 1 - 1
wbb/modules/__main__.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal

+ 68 - 122
wbb/modules/admin.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -23,17 +23,13 @@ SOFTWARE.
 """
 """
 import asyncio
 import asyncio
 import re
 import re
-
 from contextlib import suppress
 from contextlib import suppress
 from time import time
 from time import time
-from pyrogram.errors import FloodWait
+
 from pyrogram import filters
 from pyrogram import filters
-from pyrogram.types import (
-    CallbackQuery,
-    ChatMemberUpdated,
-    ChatPermissions,
-    Message,
-)
+from pyrogram.enums import ChatMembersFilter, ChatType
+from pyrogram.errors import FloodWait
+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
@@ -45,11 +41,7 @@ from wbb.utils.dbfunctions import (
     remove_warns,
     remove_warns,
     save_filter,
     save_filter,
 )
 )
-from wbb.utils.functions import (
-    extract_user,
-    extract_user_and_reason,
-    time_converter,
-)
+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
@@ -82,7 +74,7 @@ __HELP__ = """/ban - Ban A User
 async def member_permissions(chat_id: int, user_id: int):
 async def member_permissions(chat_id: int, user_id: int):
     perms = []
     perms = []
     try:
     try:
-        member = await app.get_chat_member(chat_id, user_id)
+        member = (await app.get_chat_member(chat_id, user_id)).privileges
     except Exception:
     except Exception:
         return []
         return []
     if member.can_post_messages:
     if member.can_post_messages:
@@ -101,8 +93,8 @@ async def member_permissions(chat_id: int, user_id: int):
         perms.append("can_invite_users")
         perms.append("can_invite_users")
     if member.can_pin_messages:
     if member.can_pin_messages:
         perms.append("can_pin_messages")
         perms.append("can_pin_messages")
-    if member.can_manage_voice_chats:
-        perms.append("can_manage_voice_chats")
+    if member.can_manage_video_chats:
+        perms.append("can_manage_video_chats")
     return perms
     return perms
 
 
 
 
@@ -122,8 +114,8 @@ async def list_admins(chat_id: int):
         "last_updated_at": time(),
         "last_updated_at": time(),
         "data": [
         "data": [
             member.user.id
             member.user.id
-            async for member in app.iter_chat_members(
-                chat_id, filter="administrators"
+            async for member in app.get_chat_members(
+                chat_id, filter=ChatMembersFilter.ADMINISTRATORS
             )
             )
         ],
         ],
     }
     }
@@ -140,8 +132,8 @@ async def admin_cache_func(_, cmu: ChatMemberUpdated):
             "last_updated_at": time(),
             "last_updated_at": time(),
             "data": [
             "data": [
                 member.user.id
                 member.user.id
-                async for member in app.iter_chat_members(
-                    cmu.chat.id, filter="administrators"
+                async for member in app.get_chat_members(
+                    cmu.chat.id, filter=ChatMembersFilter.ADMINISTRATORS
                 )
                 )
             ],
             ],
         }
         }
@@ -151,7 +143,7 @@ async def admin_cache_func(_, cmu: ChatMemberUpdated):
 # Purge Messages
 # Purge Messages
 
 
 
 
-@app.on_message(filters.command("purge") & ~filters.edited & ~filters.private)
+@app.on_message(filters.command("purge") & ~filters.private)
 @adminsOnly("can_delete_messages")
 @adminsOnly("can_delete_messages")
 async def purgeFunc(_, message: Message):
 async def purgeFunc(_, message: Message):
     repliedmsg = message.reply_to_message
     repliedmsg = message.reply_to_message
@@ -162,18 +154,18 @@ async def purgeFunc(_, message: Message):
 
 
     cmd = message.command
     cmd = message.command
     if len(cmd) > 1 and cmd[1].isdigit():
     if len(cmd) > 1 and cmd[1].isdigit():
-        purge_to = repliedmsg.message_id + int(cmd[1])
-        if purge_to > message.message_id:
-            purge_to = message.message_id
+        purge_to = repliedmsg.id + int(cmd[1])
+        if purge_to > message.id:
+            purge_to = message.id
     else:
     else:
-        purge_to = message.message_id   
+        purge_to = message.id
 
 
     chat_id = message.chat.id
     chat_id = message.chat.id
     message_ids = []
     message_ids = []
 
 
     for message_id in range(
     for message_id in range(
-            repliedmsg.message_id,
-            purge_to,
+        repliedmsg.id,
+        purge_to,
     ):
     ):
         message_ids.append(message_id)
         message_ids.append(message_id)
 
 
@@ -200,18 +192,14 @@ async def purgeFunc(_, message: Message):
 # Kick members
 # Kick members
 
 
 
 
-@app.on_message(
-    filters.command(["kick", "dkick"]) & ~filters.edited & ~filters.private
-)
+@app.on_message(filters.command(["kick", "dkick"]) & ~filters.private)
 @adminsOnly("can_restrict_members")
 @adminsOnly("can_restrict_members")
 async def kickFunc(_, message: Message):
 async def kickFunc(_, message: Message):
     user_id, reason = await extract_user_and_reason(message)
     user_id, reason = await extract_user_and_reason(message)
     if not user_id:
     if not user_id:
         return await message.reply_text("I can't find that user.")
         return await message.reply_text("I can't find that user.")
     if user_id == BOT_ID:
     if user_id == BOT_ID:
-        return await message.reply_text(
-            "I can't kick myself, i can leave if you want."
-        )
+        return await message.reply_text("I can't kick myself, i can leave if you want.")
     if user_id in SUDOERS:
     if user_id in SUDOERS:
         return await message.reply_text("You Wanna Kick The Elevated One?")
         return await message.reply_text("You Wanna Kick The Elevated One?")
     if user_id in (await list_admins(message.chat.id)):
     if user_id in (await list_admins(message.chat.id)):
@@ -234,11 +222,7 @@ async def kickFunc(_, message: Message):
 # Ban members
 # Ban members
 
 
 
 
-@app.on_message(
-    filters.command(["ban", "dban", "tban"])
-    & ~filters.edited
-    & ~filters.private
-)
+@app.on_message(filters.command(["ban", "dban", "tban"]) & ~filters.private)
 @adminsOnly("can_restrict_members")
 @adminsOnly("can_restrict_members")
 async def banFunc(_, message: Message):
 async def banFunc(_, message: Message):
     user_id, reason = await extract_user_and_reason(message, sender_chat=True)
     user_id, reason = await extract_user_and_reason(message, sender_chat=True)
@@ -246,13 +230,9 @@ async def banFunc(_, message: Message):
     if not user_id:
     if not user_id:
         return await message.reply_text("I can't find that user.")
         return await message.reply_text("I can't find that user.")
     if user_id == BOT_ID:
     if user_id == BOT_ID:
-        return await message.reply_text(
-            "I can't ban myself, i can leave if you want."
-        )
+        return await message.reply_text("I can't ban myself, i can leave if you want.")
     if user_id in SUDOERS:
     if user_id in SUDOERS:
-        return await message.reply_text(
-            "You Wanna Ban The Elevated One?, RECONSIDER!"
-        )
+        return await message.reply_text("You Wanna Ban The Elevated One?, RECONSIDER!")
     if user_id in (await list_admins(message.chat.id)):
     if user_id in (await list_admins(message.chat.id)):
         return await message.reply_text(
         return await message.reply_text(
             "I can't ban an admin, You know the rules, so do i."
             "I can't ban an admin, You know the rules, so do i."
@@ -297,7 +277,7 @@ async def banFunc(_, message: Message):
 # Unban members
 # Unban members
 
 
 
 
-@app.on_message(filters.command("unban") & ~filters.edited & ~filters.private)
+@app.on_message(filters.command("unban") & ~filters.private)
 @adminsOnly("can_restrict_members")
 @adminsOnly("can_restrict_members")
 async def unban_func(_, message: Message):
 async def unban_func(_, message: Message):
     # we don't need reasons for unban, also, we
     # we don't need reasons for unban, also, we
@@ -325,21 +305,15 @@ async def unban_func(_, message: Message):
 # Ban users listed in a message
 # Ban users listed in a message
 
 
 
 
-@app.on_message(
-    SUDOERS & filters.command("listban") & ~filters.edited & ~filters.private
-)
+@app.on_message(SUDOERS & filters.command("listban") & ~filters.private)
 async def list_ban_(c, message: Message):
 async def list_ban_(c, message: Message):
     userid, msglink_reason = await extract_user_and_reason(message)
     userid, msglink_reason = await extract_user_and_reason(message)
     if not userid or not msglink_reason:
     if not userid or not msglink_reason:
         return await message.reply_text(
         return await message.reply_text(
             "Provide a userid/username along with message link and reason to list-ban"
             "Provide a userid/username along with message link and reason to list-ban"
         )
         )
-    if (
-        len(msglink_reason.split(" ")) == 1
-    ):  # message link included with the reason
-        return await message.reply_text(
-            "You must provide a reason to list-ban"
-        )
+    if len(msglink_reason.split(" ")) == 1:  # message link included with the reason
+        return await message.reply_text("You must provide a reason to list-ban")
     # seperate messge link from reason
     # seperate messge link from reason
     lreason = msglink_reason.split()
     lreason = msglink_reason.split()
     messagelink, reason = lreason[0], " ".join(lreason[1:])
     messagelink, reason = lreason[0], " ".join(lreason[1:])
@@ -352,9 +326,7 @@ async def list_ban_(c, message: Message):
     if userid == BOT_ID:
     if userid == BOT_ID:
         return await message.reply_text("I can't ban myself.")
         return await message.reply_text("I can't ban myself.")
     if userid in SUDOERS:
     if userid in SUDOERS:
-        return await message.reply_text(
-            "You Wanna Ban The Elevated One?, RECONSIDER!"
-        )
+        return await message.reply_text("You Wanna Ban The Elevated One?, RECONSIDER!")
     splitted = messagelink.split("/")
     splitted = messagelink.split("/")
     uname, mid = splitted[-2], int(splitted[-1])
     uname, mid = splitted[-2], int(splitted[-1])
     m = await message.reply_text(
     m = await message.reply_text(
@@ -391,9 +363,7 @@ async def list_ban_(c, message: Message):
 # Unban users listed in a message
 # Unban users listed in a message
 
 
 
 
-@app.on_message(
-    SUDOERS & filters.command("listunban") & ~filters.edited & ~filters.private
-)
+@app.on_message(SUDOERS & filters.command("listunban") & ~filters.private)
 async def list_unban_(c, message: Message):
 async def list_unban_(c, message: Message):
     userid, msglink = await extract_user_and_reason(message)
     userid, msglink = await extract_user_and_reason(message)
     if not userid or not msglink:
     if not userid or not msglink:
@@ -401,9 +371,7 @@ async def list_unban_(c, message: Message):
             "Provide a userid/username along with message link to list-unban"
             "Provide a userid/username along with message link to list-unban"
         )
         )
 
 
-    if not re.search(
-        r"(https?://)?t(elegram)?\.me/\w+/\d+", msglink
-    ):  # validate link
+    if not re.search(r"(https?://)?t(elegram)?\.me/\w+/\d+", msglink):  # validate link
         return await message.reply_text("Invalid message link provided")
         return await message.reply_text("Invalid message link provided")
 
 
     splitted = msglink.split("/")
     splitted = msglink.split("/")
@@ -440,7 +408,7 @@ async def list_unban_(c, message: Message):
 # Delete messages
 # Delete messages
 
 
 
 
-@app.on_message(filters.command("del") & ~filters.edited & ~filters.private)
+@app.on_message(filters.command("del") & ~filters.private)
 @adminsOnly("can_delete_messages")
 @adminsOnly("can_delete_messages")
 async def deleteFunc(_, message: Message):
 async def deleteFunc(_, message: Message):
     if not message.reply_to_message:
     if not message.reply_to_message:
@@ -452,11 +420,7 @@ async def deleteFunc(_, message: Message):
 # Promote Members
 # Promote Members
 
 
 
 
-@app.on_message(
-    filters.command(["promote", "fullpromote"])
-    & ~filters.edited
-    & ~filters.private
-)
+@app.on_message(filters.command(["promote", "fullpromote"]) & ~filters.private)
 @adminsOnly("can_promote_members")
 @adminsOnly("can_promote_members")
 async def promoteFunc(_, message: Message):
 async def promoteFunc(_, message: Message):
     user_id = await extract_user(message)
     user_id = await extract_user(message)
@@ -478,7 +442,7 @@ async def promoteFunc(_, message: Message):
             can_pin_messages=bot.can_pin_messages,
             can_pin_messages=bot.can_pin_messages,
             can_promote_members=bot.can_promote_members,
             can_promote_members=bot.can_promote_members,
             can_manage_chat=bot.can_manage_chat,
             can_manage_chat=bot.can_manage_chat,
-            can_manage_voice_chats=bot.can_manage_voice_chats,
+            can_manage_video_chats=bot.can_manage_video_chats,
         )
         )
         return await message.reply_text(f"Fully Promoted! {umention}")
         return await message.reply_text(f"Fully Promoted! {umention}")
 
 
@@ -491,7 +455,7 @@ async def promoteFunc(_, message: Message):
         can_pin_messages=False,
         can_pin_messages=False,
         can_promote_members=False,
         can_promote_members=False,
         can_manage_chat=bot.can_manage_chat,
         can_manage_chat=bot.can_manage_chat,
-        can_manage_voice_chats=bot.can_manage_voice_chats,
+        can_manage_video_chats=bot.can_manage_video_chats,
     )
     )
     await message.reply_text(f"Promoted! {umention}")
     await message.reply_text(f"Promoted! {umention}")
 
 
@@ -499,7 +463,7 @@ async def promoteFunc(_, message: Message):
 # Demote Member
 # Demote Member
 
 
 
 
-@app.on_message(filters.command("demote") & ~filters.edited & ~filters.private)
+@app.on_message(filters.command("demote") & ~filters.private)
 @adminsOnly("can_promote_members")
 @adminsOnly("can_promote_members")
 async def demote(_, message: Message):
 async def demote(_, message: Message):
     user_id = await extract_user(message)
     user_id = await extract_user(message)
@@ -520,7 +484,7 @@ async def demote(_, message: Message):
         can_pin_messages=False,
         can_pin_messages=False,
         can_promote_members=False,
         can_promote_members=False,
         can_manage_chat=False,
         can_manage_chat=False,
-        can_manage_voice_chats=False,
+        can_manage_video_chats=False,
     )
     )
     umention = (await app.get_users(user_id)).mention
     umention = (await app.get_users(user_id)).mention
     await message.reply_text(f"Demoted! {umention}")
     await message.reply_text(f"Demoted! {umention}")
@@ -529,9 +493,7 @@ async def demote(_, message: Message):
 # Pin Messages
 # Pin Messages
 
 
 
 
-@app.on_message(
-    filters.command(["pin", "unpin"]) & ~filters.edited & ~filters.private
-)
+@app.on_message(filters.command(["pin", "unpin"]) & ~filters.private)
 @adminsOnly("can_pin_messages")
 @adminsOnly("can_pin_messages")
 async def pin(_, message: Message):
 async def pin(_, message: Message):
     if not message.reply_to_message:
     if not message.reply_to_message:
@@ -556,9 +518,7 @@ async def pin(_, message: Message):
 # Mute members
 # Mute members
 
 
 
 
-@app.on_message(
-    filters.command(["mute", "tmute"]) & ~filters.edited & ~filters.private
-)
+@app.on_message(filters.command(["mute", "tmute"]) & ~filters.private)
 @adminsOnly("can_restrict_members")
 @adminsOnly("can_restrict_members")
 async def mute(_, message: Message):
 async def mute(_, message: Message):
     user_id, reason = await extract_user_and_reason(message)
     user_id, reason = await extract_user_and_reason(message)
@@ -567,15 +527,13 @@ async def mute(_, message: Message):
     if user_id == BOT_ID:
     if user_id == BOT_ID:
         return await message.reply_text("I can't mute myself.")
         return await message.reply_text("I can't mute myself.")
     if user_id in SUDOERS:
     if user_id in SUDOERS:
-        return await message.reply_text(
-            "You wanna mute the elevated one?, RECONSIDER!"
-        )
+        return await message.reply_text("You wanna mute the elevated one?, RECONSIDER!")
     if user_id in (await list_admins(message.chat.id)):
     if user_id in (await list_admins(message.chat.id)):
         return await message.reply_text(
         return await message.reply_text(
             "I can't mute an admin, You know the rules, so do i."
             "I can't mute an admin, You know the rules, so do i."
         )
         )
     mention = (await app.get_users(user_id)).mention
     mention = (await app.get_users(user_id)).mention
-    keyboard = ikb({"🚨   Unmute   🚨": f"unmute_{user_id}"})
+    keyboard = ikb({"🚨  Unmute  🚨": f"unmute_{user_id}"})
     msg = (
     msg = (
         f"**Muted User:** {mention}\n"
         f"**Muted User:** {mention}\n"
         f"**Muted By:** {message.from_user.mention if message.from_user else 'Anon'}\n"
         f"**Muted By:** {message.from_user.mention if message.from_user else 'Anon'}\n"
@@ -610,7 +568,7 @@ async def mute(_, message: Message):
 # Unmute members
 # Unmute members
 
 
 
 
-@app.on_message(filters.command("unmute") & ~filters.edited & ~filters.private)
+@app.on_message(filters.command("unmute") & ~filters.private)
 @adminsOnly("can_restrict_members")
 @adminsOnly("can_restrict_members")
 async def unmute(_, message: Message):
 async def unmute(_, message: Message):
     user_id = await extract_user(message)
     user_id = await extract_user(message)
@@ -624,11 +582,7 @@ async def unmute(_, message: Message):
 # Ban deleted accounts
 # Ban deleted accounts
 
 
 
 
-@app.on_message(
-    filters.command("ban_ghosts")
-    & ~filters.private
-    & ~filters.edited
-)
+@app.on_message(filters.command("ban_ghosts") & ~filters.private)
 @adminsOnly("can_restrict_members")
 @adminsOnly("can_restrict_members")
 async def ban_deleted_accounts(_, message: Message):
 async def ban_deleted_accounts(_, message: Message):
     chat_id = message.chat.id
     chat_id = message.chat.id
@@ -636,7 +590,7 @@ async def ban_deleted_accounts(_, message: Message):
     banned_users = 0
     banned_users = 0
     m = await message.reply("Finding ghosts...")
     m = await message.reply("Finding ghosts...")
 
 
-    async for i in app.iter_chat_members(chat_id):
+    async for i in app.get_chat_members(chat_id):
         if i.user.is_deleted:
         if i.user.is_deleted:
             deleted_users.append(i.user.id)
             deleted_users.append(i.user.id)
     if len(deleted_users) > 0:
     if len(deleted_users) > 0:
@@ -651,9 +605,7 @@ async def ban_deleted_accounts(_, message: Message):
         await m.edit("There are no deleted accounts in this chat")
         await m.edit("There are no deleted accounts in this chat")
 
 
 
 
-@app.on_message(
-    filters.command(["warn", "dwarn"]) & ~filters.edited & ~filters.private
-)
+@app.on_message(filters.command(["warn", "dwarn"]) & ~filters.private)
 @adminsOnly("can_restrict_members")
 @adminsOnly("can_restrict_members")
 async def warn_user(_, message: Message):
 async def warn_user(_, message: Message):
     user_id, reason = await extract_user_and_reason(message)
     user_id, reason = await extract_user_and_reason(message)
@@ -661,13 +613,9 @@ async def warn_user(_, message: Message):
     if not user_id:
     if not user_id:
         return await message.reply_text("I can't find that user.")
         return await message.reply_text("I can't find that user.")
     if user_id == BOT_ID:
     if user_id == BOT_ID:
-        return await message.reply_text(
-            "I can't warn myself, i can leave if you want."
-        )
+        return await message.reply_text("I can't warn myself, i can leave if you want.")
     if user_id in SUDOERS:
     if user_id in SUDOERS:
-        return await message.reply_text(
-            "You Wanna Warn The Elevated One?, RECONSIDER!"
-        )
+        return await message.reply_text("You Wanna Warn The Elevated One?, RECONSIDER!")
     if user_id in (await list_admins(chat_id)):
     if user_id in (await list_admins(chat_id)):
         return await message.reply_text(
         return await message.reply_text(
             "I can't warn an admin, You know the rules, so do i."
             "I can't warn an admin, You know the rules, so do i."
@@ -686,9 +634,7 @@ async def warn_user(_, message: Message):
         await message.reply_to_message.delete()
         await message.reply_to_message.delete()
     if warns >= 2:
     if warns >= 2:
         await message.chat.ban_member(user_id)
         await message.chat.ban_member(user_id)
-        await message.reply_text(
-            f"Number of warns of {mention} exceeded, BANNED!"
-        )
+        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:
     else:
         warn = {"warns": warns + 1}
         warn = {"warns": warns + 1}
@@ -730,9 +676,7 @@ async def remove_warning(_, cq: CallbackQuery):
 # Rmwarns
 # Rmwarns
 
 
 
 
-@app.on_message(
-    filters.command("rmwarns") & ~filters.edited & ~filters.private
-)
+@app.on_message(filters.command("rmwarns") & ~filters.private)
 @adminsOnly("can_restrict_members")
 @adminsOnly("can_restrict_members")
 async def remove_warnings(_, message: Message):
 async def remove_warnings(_, message: Message):
     if not message.reply_to_message:
     if not message.reply_to_message:
@@ -755,7 +699,7 @@ async def remove_warnings(_, message: Message):
 # Warns
 # Warns
 
 
 
 
-@app.on_message(filters.command("warns") & ~filters.edited & ~filters.private)
+@app.on_message(filters.command("warns") & ~filters.private)
 @capture_err
 @capture_err
 async def check_warns(_, message: Message):
 async def check_warns(_, message: Message):
     user_id = await extract_user(message)
     user_id = await extract_user(message)
@@ -774,19 +718,13 @@ async def check_warns(_, message: Message):
 
 
 
 
 @app.on_message(
 @app.on_message(
-    (
-            filters.command("report")
-            | filters.command(["admins", "admin"], prefixes="@")
-    )
-    & ~filters.edited
+    (filters.command("report") | filters.command(["admins", "admin"], prefixes="@"))
     & ~filters.private
     & ~filters.private
 )
 )
 @capture_err
 @capture_err
 async def report_user(_, message):
 async def report_user(_, message):
     if not message.reply_to_message:
     if not message.reply_to_message:
-        return await message.reply_text(
-            "Reply to a message to report that user."
-        )
+        return await message.reply_text("Reply to a message to report that user.")
 
 
     reply = message.reply_to_message
     reply = message.reply_to_message
     reply_id = reply.from_user.id if reply.from_user else reply.sender_chat.id
     reply_id = reply.from_user.id if reply.from_user else reply.sender_chat.id
@@ -797,7 +735,11 @@ async def report_user(_, message):
     list_of_admins = await list_admins(message.chat.id)
     list_of_admins = await list_admins(message.chat.id)
     linked_chat = (await app.get_chat(message.chat.id)).linked_chat
     linked_chat = (await app.get_chat(message.chat.id)).linked_chat
     if linked_chat is not None:
     if linked_chat is not None:
-        if reply_id in list_of_admins or reply_id == message.chat.id or reply_id == linked_chat.id:
+        if (
+            reply_id in list_of_admins
+            or reply_id == message.chat.id
+            or reply_id == linked_chat.id
+        ):
             return await message.reply_text(
             return await message.reply_text(
                 "Do you know that the user you are replying is an admin ?"
                 "Do you know that the user you are replying is an admin ?"
             )
             )
@@ -807,10 +749,12 @@ async def report_user(_, message):
                 "Do you know that the user you are replying is an admin ?"
                 "Do you know that the user you are replying is an admin ?"
             )
             )
 
 
-    user_mention = reply.from_user.mention if reply.from_user else reply.sender_chat.title
+    user_mention = (
+        reply.from_user.mention if reply.from_user else reply.sender_chat.title
+    )
     text = f"Reported {user_mention} to admins!"
     text = f"Reported {user_mention} to admins!"
     admin_data = await app.get_chat_members(
     admin_data = await app.get_chat_members(
-        chat_id=message.chat.id, filter="administrators"
+        chat_id=message.chat.id, filter=ChatMembersFilter.ADMINISTRATORS
     )  # will it giv floods ?
     )  # will it giv floods ?
     for admin in admin_data:
     for admin in admin_data:
         if admin.user.is_bot or admin.user.is_deleted:
         if admin.user.is_bot or admin.user.is_deleted:
@@ -821,15 +765,17 @@ async def report_user(_, message):
     await message.reply_to_message.reply_text(text)
     await message.reply_to_message.reply_text(text)
 
 
 
 
-@app.on_message(filters.command("invite") & ~filters.edited)
+@app.on_message(filters.command("invite"))
 @adminsOnly("can_invite_users")
 @adminsOnly("can_invite_users")
 async def invite(_, message):
 async def invite(_, message):
-    if message.chat.type in ["group", "supergroup"]:
-        link = (await app.get_chat(message.chat.id)).invite_link 
+    if message.chat.type in [ChatType.GROUP, ChatType.SUPERGROUP]:
+        link = (await app.get_chat(message.chat.id)).invite_link
         if not link:
         if not link:
             link = await app.export_chat_invite_link(message.chat.id)
             link = await app.export_chat_invite_link(message.chat.id)
         text = f"Here's This Group Invite Link.\n\n{link}"
         text = f"Here's This Group Invite Link.\n\n{link}"
         if message.reply_to_message:
         if message.reply_to_message:
-            await message.reply_to_message.reply_text(text, disable_web_page_preview=True)
+            await message.reply_to_message.reply_text(
+                text, disable_web_page_preview=True
+            )
         else:
         else:
             await message.reply_text(text, disable_web_page_preview=True)
             await message.reply_text(text, disable_web_page_preview=True)

+ 5 - 19
wbb/modules/admin_misc.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -36,11 +36,7 @@ __HELP__ = """
 """
 """
 
 
 
 
-@app.on_message(
-    filters.command("set_chat_title")
-    & ~filters.private
-    & ~filters.edited
-)
+@app.on_message(filters.command("set_chat_title") & ~filters.private)
 @adminsOnly("can_change_info")
 @adminsOnly("can_change_info")
 async def set_chat_title(_, message):
 async def set_chat_title(_, message):
     if len(message.command) < 2:
     if len(message.command) < 2:
@@ -53,11 +49,7 @@ async def set_chat_title(_, message):
     )
     )
 
 
 
 
-@app.on_message(
-    filters.command("set_user_title")
-    & ~filters.private
-    & ~filters.edited
-)
+@app.on_message(filters.command("set_user_title") & ~filters.private)
 @adminsOnly("can_change_info")
 @adminsOnly("can_change_info")
 async def set_user_title(_, message):
 async def set_user_title(_, message):
     if not message.reply_to_message:
     if not message.reply_to_message:
@@ -81,19 +73,13 @@ async def set_user_title(_, message):
     )
     )
 
 
 
 
-@app.on_message(
-    filters.command("set_chat_photo")
-    & ~filters.private
-    & ~filters.edited
-)
+@app.on_message(filters.command("set_chat_photo") & ~filters.private)
 @adminsOnly("can_change_info")
 @adminsOnly("can_change_info")
 async def set_chat_photo(_, message):
 async def set_chat_photo(_, message):
     reply = message.reply_to_message
     reply = message.reply_to_message
 
 
     if not reply:
     if not reply:
-        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")
 
 
     file = reply.document or reply.photo
     file = reply.document or reply.photo
     if not file:
     if not file:

+ 1 - 1
wbb/modules/alive.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal

+ 3 - 7
wbb/modules/anonymize.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -38,9 +38,7 @@ from wbb.modules.userbot import eor
 from wbb.utils.functions import extract_user
 from wbb.utils.functions import extract_user
 
 
 
 
-@app2.on_message(
-    filters.command("anonymize", prefixes=USERBOT_PREFIX) & SUDOERS
-)
+@app2.on_message(filters.command("anonymize", prefixes=USERBOT_PREFIX) & SUDOERS)
 async def change_profile(_, message: Message):
 async def change_profile(_, message: Message):
     m = await eor(message, text="Anonymizing...")
     m = await eor(message, text="Anonymizing...")
     try:
     try:
@@ -66,9 +64,7 @@ async def change_profile(_, message: Message):
     image.close()
     image.close()
 
 
 
 
-@app2.on_message(
-    filters.command("impersonate", prefixes=USERBOT_PREFIX) & SUDOERS
-)
+@app2.on_message(filters.command("impersonate", prefixes=USERBOT_PREFIX) & SUDOERS)
 async def impersonate(_, message: Message):
 async def impersonate(_, message: Message):
     user_id = await extract_user(message)
     user_id = await extract_user(message)
 
 

+ 4 - 16
wbb/modules/antiservice.py

@@ -5,11 +5,7 @@ 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__ = """
@@ -19,17 +15,11 @@ Plugin to delete service messages in a chat!
 """
 """
 
 
 
 
-@app.on_message(
-    filters.command("antiservice")
-    & ~filters.private
-    & ~filters.edited
-)
+@app.on_message(filters.command("antiservice") & ~filters.private)
 @adminsOnly("can_change_info")
 @adminsOnly("can_change_info")
 async def anti_service(_, message):
 async def anti_service(_, message):
     if len(message.command) != 2:
     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 = message.text.split(None, 1)[1].strip()
     status = status.lower()
     status = status.lower()
     chat_id = message.chat.id
     chat_id = message.chat.id
@@ -44,9 +34,7 @@ async def anti_service(_, message):
             "Disabled AntiService System. I won't Be Deleting Service Message from Now on."
             "Disabled AntiService System. I won't Be Deleting Service Message from Now on."
         )
         )
     else:
     else:
-        await message.reply_text(
-            "Unknown Suffix, Use /antiservice [enable|disable]"
-        )
+        await message.reply_text("Unknown Suffix, Use /antiservice [enable|disable]")
 
 
 
 
 @app.on_message(filters.service, group=11)
 @app.on_message(filters.service, group=11)

+ 2 - 5
wbb/modules/arq.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -27,10 +27,7 @@ from wbb import app, arq
 from wbb.core.sections import section
 from wbb.core.sections import section
 
 
 
 
-@app.on_message(
-    filters.command("arq")
-    & ~filters.edited
-)
+@app.on_message(filters.command("arq"))
 async def arq_stats(_, message):
 async def arq_stats(_, message):
     data = await arq.stats()
     data = await arq.stats()
     if not data.ok:
     if not data.ok:

+ 4 - 11
wbb/modules/autocorrect.py

@@ -6,10 +6,7 @@ from wbb.modules.userbot import eor
 from wbb.utils.filter_groups import autocorrect_group
 from wbb.utils.filter_groups import autocorrect_group
 
 
 
 
-@app.on_message(
-    filters.command("autocorrect")
-    & ~filters.edited
-)
+@app.on_message(filters.command("autocorrect"))
 async def autocorrect_bot(_, message: Message):
 async def autocorrect_bot(_, message: Message):
     if not message.reply_to_message:
     if not message.reply_to_message:
         return await message.reply_text("Reply to a text message.")
         return await message.reply_text("Reply to a text message.")
@@ -27,9 +24,7 @@ async def autocorrect_bot(_, message: Message):
 IS_ENABLED = False
 IS_ENABLED = False
 
 
 
 
-@app2.on_message(
-    filters.command("autocorrect", prefixes=USERBOT_PREFIX) & SUDOERS
-)
+@app2.on_message(filters.command("autocorrect", prefixes=USERBOT_PREFIX) & SUDOERS)
 async def autocorrect_ubot_toggle(_, message: Message):
 async def autocorrect_ubot_toggle(_, message: Message):
     global IS_ENABLED
     global IS_ENABLED
     if len(message.command) != 2:
     if len(message.command) != 2:
@@ -42,13 +37,11 @@ async def autocorrect_ubot_toggle(_, message: Message):
         IS_ENABLED = False
         IS_ENABLED = False
         await eor(message, text="Disabled!")
         await eor(message, text="Disabled!")
     else:
     else:
-        return await eor(
-            message, text="Wrong argument, Pass (ENABLE|DISABLE)."
-        )
+        return await eor(message, text="Wrong argument, Pass (ENABLE|DISABLE).")
 
 
 
 
 @app2.on_message(
 @app2.on_message(
-    filters.text & ~filters.edited & filters.user(USERBOT_ID),
+    filters.text & filters.user(USERBOT_ID),
     group=autocorrect_group,
     group=autocorrect_group,
 )
 )
 async def autocorrect_ubot(_, message: Message):
 async def autocorrect_ubot(_, message: Message):

+ 7 - 18
wbb/modules/blacklist.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -46,41 +46,33 @@ __HELP__ = """
 """
 """
 
 
 
 
-@app.on_message(
-    filters.command("blacklist") & ~filters.edited & ~filters.private
-)
+@app.on_message(filters.command("blacklist") & ~filters.private)
 @adminsOnly("can_restrict_members")
 @adminsOnly("can_restrict_members")
 async def save_filters(_, message):
 async def save_filters(_, message):
     if len(message.command) < 2:
     if len(message.command) < 2:
         return await message.reply_text("Usage:\n/blacklist [WORD|SENTENCE]")
         return await message.reply_text("Usage:\n/blacklist [WORD|SENTENCE]")
     word = message.text.split(None, 1)[1].strip()
     word = message.text.split(None, 1)[1].strip()
     if not word:
     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
     chat_id = message.chat.id
     await save_blacklist_filter(chat_id, word)
     await save_blacklist_filter(chat_id, word)
     await message.reply_text(f"__**Blacklisted {word}.**__")
     await message.reply_text(f"__**Blacklisted {word}.**__")
 
 
 
 
-@app.on_message(
-    filters.command("blacklisted") & ~filters.edited & ~filters.private
-)
+@app.on_message(filters.command("blacklisted") & ~filters.private)
 @capture_err
 @capture_err
 async def get_filterss(_, message):
 async def get_filterss(_, message):
     data = await get_blacklisted_words(message.chat.id)
     data = await get_blacklisted_words(message.chat.id)
     if not data:
     if not data:
         await message.reply_text("**No blacklisted words in this chat.**")
         await message.reply_text("**No blacklisted words in this chat.**")
     else:
     else:
-        msg = f"List of blacklisted words in {message.chat.title}\n"
+        msg = f"List of blacklisted words in {message.chat.title} :\n"
         for word in data:
         for word in data:
             msg += f"**-** `{word}`\n"
             msg += f"**-** `{word}`\n"
         await message.reply_text(msg)
         await message.reply_text(msg)
 
 
 
 
-@app.on_message(
-    filters.command("whitelist") & ~filters.edited & ~filters.private
-)
+@app.on_message(filters.command("whitelist") & ~filters.private)
 @adminsOnly("can_restrict_members")
 @adminsOnly("can_restrict_members")
 async def del_filter(_, message):
 async def del_filter(_, message):
     if len(message.command) < 2:
     if len(message.command) < 2:
@@ -95,10 +87,7 @@ async def del_filter(_, message):
     await message.reply_text("**No such blacklist filter.**")
     await message.reply_text("**No such blacklist filter.**")
 
 
 
 
-@app.on_message(
-    filters.text
-    & ~filters.private
-    & ~filters.edited, group=blacklist_filters_group)
+@app.on_message(filters.text & ~filters.private, group=blacklist_filters_group)
 @capture_err
 @capture_err
 async def blacklist_filters_re(_, message):
 async def blacklist_filters_re(_, message):
     text = message.text.lower().strip()
     text = message.text.lower().strip()

+ 8 - 32
wbb/modules/blacklist_chat.py

@@ -3,11 +3,7 @@ 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__ = """
@@ -22,55 +18,35 @@ in which you don't want it to be in.
 """
 """
 
 
 
 
-@app.on_message(
-    filters.command("blacklist_chat")
-    & SUDOERS
-    & ~filters.edited
-)
+@app.on_message(filters.command("blacklist_chat") & SUDOERS)
 @capture_err
 @capture_err
 async def blacklist_chat_func(_, message: Message):
 async def blacklist_chat_func(_, message: Message):
     if len(message.command) != 2:
     if len(message.command) != 2:
-        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])
     chat_id = int(message.text.strip().split()[1])
     if chat_id in await blacklisted_chats():
     if chat_id in await blacklisted_chats():
         return await message.reply_text("Chat is already blacklisted.")
         return await message.reply_text("Chat is already blacklisted.")
     blacklisted = await blacklist_chat(chat_id)
     blacklisted = await blacklist_chat(chat_id)
     if blacklisted:
     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.")
     await message.reply_text("Something wrong happened, check logs.")
 
 
 
 
-@app.on_message(
-    filters.command("whitelist_chat")
-    & SUDOERS
-    & ~filters.edited
-)
+@app.on_message(filters.command("whitelist_chat") & SUDOERS)
 @capture_err
 @capture_err
 async def whitelist_chat_func(_, message: Message):
 async def whitelist_chat_func(_, message: Message):
     if len(message.command) != 2:
     if len(message.command) != 2:
-        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])
     chat_id = int(message.text.strip().split()[1])
     if chat_id not in await blacklisted_chats():
     if chat_id not in await blacklisted_chats():
         return await message.reply_text("Chat is already whitelisted.")
         return await message.reply_text("Chat is already whitelisted.")
     whitelisted = await whitelist_chat(chat_id)
     whitelisted = await whitelist_chat(chat_id)
     if whitelisted:
     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.")
     await message.reply_text("Something wrong happened, check logs.")
 
 
 
 
-@app.on_message(
-    filters.command("blacklisted_chats")
-    & SUDOERS
-    & ~filters.edited
-)
+@app.on_message(filters.command("blacklisted_chats") & SUDOERS)
 @capture_err
 @capture_err
 async def blacklisted_chats_func(_, message: Message):
 async def blacklisted_chats_func(_, message: Message):
     text = ""
     text = ""

+ 4 - 11
wbb/modules/carbon.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -29,20 +29,13 @@ from wbb.core.decorators.errors import capture_err
 from wbb.utils.functions import make_carbon
 from wbb.utils.functions import make_carbon
 
 
 
 
-@app.on_message(
-    filters.command("carbon")
-    & ~filters.edited
-)
+@app.on_message(filters.command("carbon"))
 @capture_err
 @capture_err
 async def carbon_func(_, message):
 async def carbon_func(_, message):
     if not message.reply_to_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:
     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")
     m = await message.reply_text("Preparing Carbon")
     carbon = await make_carbon(message.reply_to_message.text)
     carbon = await make_carbon(message.reply_to_message.text)
     await m.edit("Uploading")
     await m.edit("Uploading")

+ 2 - 6
wbb/modules/chat_watcher.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -22,11 +22,7 @@ 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
 
 
 
 

+ 16 - 22
wbb/modules/chatbot.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -23,7 +23,7 @@ SOFTWARE.
 """
 """
 from asyncio import gather, sleep
 from asyncio import gather, sleep
 
 
-from pyrogram import filters
+from pyrogram import enums, filters
 from pyrogram.types import Message
 from pyrogram.types import Message
 
 
 from wbb import (
 from wbb import (
@@ -38,8 +38,8 @@ from wbb import (
     eor,
     eor,
 )
 )
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.errors import capture_err
+from wbb.utils.dbfunctions import add_chatbot, check_chatbot, rm_chatbot
 from wbb.utils.filter_groups import chatbot_group
 from wbb.utils.filter_groups import chatbot_group
-from wbb.utils.dbfunctions import check_chatbot, add_chatbot, rm_chatbot
 
 
 __MODULE__ = "ChatBot"
 __MODULE__ = "ChatBot"
 __HELP__ = """
 __HELP__ = """
@@ -48,6 +48,7 @@ __HELP__ = """
 There's one module of this available for userbot also
 There's one module of this available for userbot also
 check userbot module help."""
 check userbot module help."""
 
 
+
 async def chat_bot_toggle(message: Message, is_userbot: bool):
 async def chat_bot_toggle(message: Message, is_userbot: bool):
     status = message.text.split(None, 1)[1].lower()
     status = message.text.split(None, 1)[1].lower()
     chat_id = message.chat.id
     chat_id = message.chat.id
@@ -71,7 +72,7 @@ async def chat_bot_toggle(message: Message, is_userbot: bool):
 # Enabled | Disable Chatbot
 # Enabled | Disable Chatbot
 
 
 
 
-@app.on_message(filters.command("chatbot") & ~filters.edited)
+@app.on_message(filters.command("chatbot"))
 @capture_err
 @capture_err
 async def chatbot_status(_, message: Message):
 async def chatbot_status(_, message: Message):
     if len(message.command) != 2:
     if len(message.command) != 2:
@@ -88,19 +89,14 @@ async def type_and_send(message: Message):
     chat_id = message.chat.id
     chat_id = message.chat.id
     user_id = message.from_user.id if message.from_user else 0
     user_id = message.from_user.id if message.from_user else 0
     query = message.text.strip()
     query = message.text.strip()
-    await message._client.send_chat_action(chat_id, "typing")
+    await message._client.send_chat_action(chat_id, enums.ChatAction.TYPING)
     response, _ = await gather(lunaQuery(query, user_id), sleep(3))
     response, _ = await gather(lunaQuery(query, user_id), sleep(3))
     await message.reply_text(response)
     await message.reply_text(response)
-    await message._client.send_chat_action(chat_id, "cancel")
+    await message._client.send_chat_action(chat_id, enums.ChatAction.CANCEL)
 
 
 
 
 @app.on_message(
 @app.on_message(
-    filters.text
-    & filters.reply
-    & ~filters.bot
-    & ~filters.via_bot
-    & ~filters.forwarded
-    & ~filters.edited,
+    filters.text & filters.reply & ~filters.bot & ~filters.via_bot & ~filters.forwarded,
     group=chatbot_group,
     group=chatbot_group,
 )
 )
 @capture_err
 @capture_err
@@ -120,20 +116,18 @@ async def chatbot_talk(_, message: Message):
 # FOR USERBOT
 # FOR USERBOT
 
 
 
 
-@app2.on_message(
-    filters.command("chatbot", prefixes=USERBOT_PREFIX)
-    & ~filters.edited
-    & SUDOERS
-)
+@app2.on_message(filters.command("chatbot", prefixes=USERBOT_PREFIX) & SUDOERS)
 @capture_err
 @capture_err
 async def chatbot_status_ubot(_, message: Message):
 async def chatbot_status_ubot(_, message: Message):
     if len(message.text.split()) != 2:
     if len(message.text.split()) != 2:
-        return await eor(message, text="**Usage:**\n.chatbot [ENABLE|DISABLE]")
+        return await eor(
+            message, text=f"**Usage:**\n{USERBOT_PREFIX}chatbot [ENABLE|DISABLE]"
+        )
     await chat_bot_toggle(message, is_userbot=True)
     await chat_bot_toggle(message, is_userbot=True)
 
 
 
 
 @app2.on_message(
 @app2.on_message(
-    ~filters.me & ~filters.private & filters.text & ~filters.edited,
+    ~filters.me & ~filters.private & filters.text,
     group=chatbot_group,
     group=chatbot_group,
 )
 )
 @capture_err
 @capture_err
@@ -146,8 +140,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:
@@ -157,7 +151,7 @@ async def chatbot_talk_ubot(_, message: Message):
 
 
 
 
 @app2.on_message(
 @app2.on_message(
-    filters.text & filters.private & ~filters.me & ~filters.edited,
+    filters.text & filters.private & ~filters.me,
     group=(chatbot_group + 1),
     group=(chatbot_group + 1),
 )
 )
 @capture_err
 @capture_err

+ 10 - 10
wbb/modules/couple.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -24,7 +24,7 @@ SOFTWARE.
 import random
 import random
 from datetime import datetime
 from datetime import datetime
 
 
-from pyrogram import filters
+from pyrogram import enums, filters
 
 
 from wbb import app
 from wbb import app
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.errors import capture_err
@@ -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
 
 
@@ -61,10 +61,10 @@ def tomorrow():
     return str(dt_tom())
     return str(dt_tom())
 
 
 
 
-@app.on_message(filters.command("detect_gay") & ~filters.edited)
+@app.on_message(filters.command("detect_gay"))
 @capture_err
 @capture_err
 async def couple(_, message):
 async def couple(_, message):
-    if message.chat.type == "private":
+    if message.chat.type == enums.ChatType.PRIVATE:
         return await message.reply_text("This command only works in groups.")
         return await message.reply_text("This command only works in groups.")
 
 
     m = await message.reply("Detecting gay among us...")
     m = await message.reply("Detecting gay among us...")
@@ -74,7 +74,7 @@ async def couple(_, message):
         is_selected = await get_couple(chat_id, today())
         is_selected = await get_couple(chat_id, today())
         if not is_selected:
         if not is_selected:
             list_of_users = []
             list_of_users = []
-            async for i in app.iter_chat_members(message.chat.id):
+            async for i in app.get_chat_members(message.chat.id):
                 if not i.user.is_bot:
                 if not i.user.is_bot:
                     list_of_users.append(i.user.id)
                     list_of_users.append(i.user.id)
             if len(list_of_users) < 2:
             if len(list_of_users) < 2:

+ 2 - 5
wbb/modules/create.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -32,7 +32,6 @@ from wbb.modules.userbot import eor
     SUDOERS
     SUDOERS
     & ~filters.forwarded
     & ~filters.forwarded
     & ~filters.via_bot
     & ~filters.via_bot
-    & ~filters.edited
     & filters.command("create", prefixes=USERBOT_PREFIX)
     & filters.command("create", prefixes=USERBOT_PREFIX)
 )
 )
 async def create(_, message):
 async def create(_, message):
@@ -41,9 +40,7 @@ async def create(_, message):
     group_type = message.command[1]
     group_type = message.command[1]
     split = message.command[2:]
     split = message.command[2:]
     group_name = " ".join(split)
     group_name = " ".join(split)
-    desc = "Welcome To My " + (
-        "Supergroup" if group_type == "s" else "Channel"
-    )
+    desc = "Welcome To My " + ("Supergroup" if group_type == "s" else "Channel")
     if group_type == "b":  # for basicgroup
     if group_type == "b":  # for basicgroup
         _id = await app2.create_group(group_name, BOT_USERNAME)
         _id = await app2.create_group(group_name, BOT_USERNAME)
         link = await app2.get_chat(_id["id"])
         link = await app2.get_chat(_id["id"])

+ 1 - 1
wbb/modules/crypto.py

@@ -13,7 +13,7 @@ __HELP__ = """
 """
 """
 
 
 
 
-@app.on_message(filters.command("crypto") & ~filters.edited)
+@app.on_message(filters.command("crypto"))
 @capture_err
 @capture_err
 async def crypto(_, message):
 async def crypto(_, message):
     if len(message.command) < 2:
     if len(message.command) < 2:

+ 1 - 1
wbb/modules/dice.py

@@ -11,7 +11,7 @@ __HELP__ = """
 
 
 
 
 @app2.on_message(filters.command("dice", prefixes=USERBOT_PREFIX) & SUDOERS)
 @app2.on_message(filters.command("dice", prefixes=USERBOT_PREFIX) & SUDOERS)
-@app.on_message(filters.command("dice") & ~filters.edited)
+@app.on_message(filters.command("dice"))
 async def throw_dice(client, message: Message):
 async def throw_dice(client, message: Message):
     six = (message.from_user.id in SUDOERS) if message.from_user else False
     six = (message.from_user.id in SUDOERS) if message.from_user else False
 
 

+ 2 - 4
wbb/modules/download_upload.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -36,9 +36,7 @@ from wbb.core.tasks import add_task, rm_task
 from wbb.utils.downloader import download
 from wbb.utils.downloader import download
 
 
 
 
-@app2.on_message(
-    SUDOERS & filters.command("download", prefixes=USERBOT_PREFIX)
-)
+@app2.on_message(SUDOERS & filters.command("download", prefixes=USERBOT_PREFIX))
 async def download_func(_, message: Message):
 async def download_func(_, message: Message):
     reply = message.reply_to_message
     reply = message.reply_to_message
     start = time()
     start = time()

+ 8 - 19
wbb/modules/filters.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -50,25 +50,20 @@ Checkout /markdownhelp to know more about formattings and other syntax.
 """
 """
 
 
 
 
-@app.on_message(filters.command("filter") & ~filters.edited & ~filters.private)
+@app.on_message(filters.command("filter") & ~filters.private)
 @adminsOnly("can_change_info")
 @adminsOnly("can_change_info")
 async def save_filters(_, message):
 async def save_filters(_, message):
     if len(message.command) < 2 or not message.reply_to_message:
     if len(message.command) < 2 or not message.reply_to_message:
         return await message.reply_text(
         return await message.reply_text(
             "**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 (
-            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:
         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.**__"
         )
         )
     name = message.text.split(None, 1)[1].strip()
     name = message.text.split(None, 1)[1].strip()
     if not name:
     if not name:
-        return await message.reply_text(
-            "**Usage:**\n__/filter [FILTER_NAME]__"
-        )
+        return await message.reply_text("**Usage:**\n__/filter [FILTER_NAME]__")
     chat_id = message.chat.id
     chat_id = message.chat.id
     _type = "text" if message.reply_to_message.text else "sticker"
     _type = "text" if message.reply_to_message.text else "sticker"
     _filter = {
     _filter = {
@@ -81,22 +76,20 @@ async def save_filters(_, message):
     await message.reply_text(f"__**Saved filter {name}.**__")
     await message.reply_text(f"__**Saved filter {name}.**__")
 
 
 
 
-@app.on_message(
-    filters.command("filters") & ~filters.edited & ~filters.private
-)
+@app.on_message(filters.command("filters") & ~filters.private)
 @capture_err
 @capture_err
 async def get_filterss(_, message):
 async def get_filterss(_, message):
     _filters = await get_filters_names(message.chat.id)
     _filters = await get_filters_names(message.chat.id)
     if not _filters:
     if not _filters:
         return await message.reply_text("**No filters in this chat.**")
         return await message.reply_text("**No filters in this chat.**")
     _filters.sort()
     _filters.sort()
-    msg = f"List of filters in {message.chat.title}\n"
+    msg = f"List of filters in {message.chat.title} :\n"
     for _filter in _filters:
     for _filter in _filters:
         msg += f"**-** `{_filter}`\n"
         msg += f"**-** `{_filter}`\n"
     await message.reply_text(msg)
     await message.reply_text(msg)
 
 
 
 
-@app.on_message(filters.command("stop") & ~filters.edited & ~filters.private)
+@app.on_message(filters.command("stop") & ~filters.private)
 @adminsOnly("can_change_info")
 @adminsOnly("can_change_info")
 async def del_filter(_, message):
 async def del_filter(_, message):
     if len(message.command) < 2:
     if len(message.command) < 2:
@@ -113,11 +106,7 @@ async def del_filter(_, message):
 
 
 
 
 @app.on_message(
 @app.on_message(
-    filters.text
-    & ~filters.edited
-    & ~filters.private
-    & ~filters.via_bot
-    & ~filters.forwarded,
+    filters.text & ~filters.private & ~filters.via_bot & ~filters.forwarded,
     group=chat_filters_group,
     group=chat_filters_group,
 )
 )
 @capture_err
 @capture_err

+ 5 - 10
wbb/modules/flood.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -57,12 +57,7 @@ def reset_flood(chat_id, user_id=0):
 
 
 
 
 @app.on_message(
 @app.on_message(
-    ~filters.service
-    & ~filters.me
-    & ~filters.private
-    & ~filters.channel
-    & ~filters.bot
-    & ~filters.edited,
+    ~filters.service & ~filters.me & ~filters.private & ~filters.channel & ~filters.bot,
     group=flood_group,
     group=flood_group,
 )
 )
 @capture_err
 @capture_err
@@ -86,7 +81,7 @@ async def flood_control_func(_, message: Message):
     if user_id not in DB[chat_id]:
     if user_id not in DB[chat_id]:
         DB[chat_id][user_id] = 0
         DB[chat_id][user_id] = 0
 
 
-    # Reset floodb of current chat if some other user sends a message
+    # Reset flood db of current chat if some other user sends a message
     reset_flood(chat_id, user_id)
     reset_flood(chat_id, user_id)
 
 
     # Ignore devs and admins
     # Ignore devs and admins
@@ -109,7 +104,7 @@ async def flood_control_func(_, message: Message):
             [
             [
                 [
                 [
                     InlineKeyboardButton(
                     InlineKeyboardButton(
-                        text="🚨   Unmute   🚨",
+                        text="🚨  Unmute  🚨",
                         callback_data=f"unmute_{user_id}",
                         callback_data=f"unmute_{user_id}",
                     )
                     )
                 ]
                 ]
@@ -151,7 +146,7 @@ async def flood_callback_func(_, cq: CallbackQuery):
     await cq.message.edit(text)
     await cq.message.edit(text)
 
 
 
 
-@app.on_message(filters.command("flood") & ~filters.private & ~filters.edited)
+@app.on_message(filters.command("flood") & ~filters.private)
 @adminsOnly("can_change_info")
 @adminsOnly("can_change_info")
 async def flood_toggle(_, message: Message):
 async def flood_toggle(_, message: Message):
     if len(message.command) != 2:
     if len(message.command) != 2:

+ 9 - 8
wbb/modules/global_stats.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -24,6 +24,7 @@ SOFTWARE.
 import asyncio
 import asyncio
 
 
 from pyrogram import filters
 from pyrogram import filters
+from pyrogram.enums import ChatType
 from pyrogram.errors import FloodWait
 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
@@ -45,7 +46,7 @@ from wbb.utils.http import get
 from wbb.utils.inlinefuncs import keywords_list
 from wbb.utils.inlinefuncs import keywords_list
 
 
 
 
-@app.on_message(filters.command("clean_db") & ~filters.edited & SUDOERS)
+@app.on_message(filters.command("clean_db") & SUDOERS)
 @capture_err
 @capture_err
 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())]
@@ -64,7 +65,7 @@ async def clean_db(_, message):
     await m.edit("**Database Cleaned.**")
     await m.edit("**Database Cleaned.**")
 
 
 
 
-@app.on_message(filters.command("gstats") & ~filters.edited & SUDOERS)
+@app.on_message(filters.command("gstats") & SUDOERS)
 @capture_err
 @capture_err
 async def global_stats(_, message):
 async def global_stats(_, message):
     m = await app.send_message(
     m = await app.send_message(
@@ -118,17 +119,17 @@ async def global_stats(_, message):
 
 
     # Userbot info
     # Userbot info
     groups_ub = channels_ub = bots_ub = privates_ub = total_ub = 0
     groups_ub = channels_ub = bots_ub = privates_ub = total_ub = 0
-    async for i in app2.iter_dialogs():
+    async for i in app2.get_dialogs():
         t = i.chat.type
         t = i.chat.type
         total_ub += 1
         total_ub += 1
 
 
-        if t in ["supergroup", "group"]:
+        if t in [ChatType.SUPERGROUP, ChatType.GROUP]:
             groups_ub += 1
             groups_ub += 1
-        elif t == "channel":
+        elif t == ChatType.CHANNEL:
             channels_ub += 1
             channels_ub += 1
-        elif t == "bot":
+        elif t == ChatType.BOT:
             bots_ub += 1
             bots_ub += 1
-        elif t == "private":
+        elif t == ChatType.PRIVATE:
             privates_ub += 1
             privates_ub += 1
 
 
     msg = f"""
     msg = f"""

+ 17 - 32
wbb/modules/greetings.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -120,7 +120,6 @@ async def welcome(_, message: Message):
 
 
     for member in message.new_chat_members:
     for member in message.new_chat_members:
         try:
         try:
-
             if member.id in SUDOERS:
             if member.id in SUDOERS:
                 continue  # ignore sudo users
                 continue  # ignore sudo users
 
 
@@ -209,9 +208,7 @@ async def welcome(_, message: Message):
         await update_captcha_cache(answers_dicc)
         await update_captcha_cache(answers_dicc)
 
 
         asyncio.create_task(
         asyncio.create_task(
-            kick_restricted_after_delay(
-                WELCOME_DELAY_KICK_SEC, button_message, member
-            )
+            kick_restricted_after_delay(WELCOME_DELAY_KICK_SEC, button_message, member)
         )
         )
         await asyncio.sleep(0.5)
         await asyncio.sleep(0.5)
 
 
@@ -261,16 +258,14 @@ async def callback_query_welcome_button(_, callback_query):
     if len(answers_dicc) != 0:
     if len(answers_dicc) != 0:
         for i in answers_dicc:
         for i in answers_dicc:
             if (
             if (
-                    i["user_id"] == pending_user_id
-                    and i["chat_id"] == button_message.chat.id
+                i["user_id"] == pending_user_id
+                and i["chat_id"] == button_message.chat.id
             ):
             ):
                 correct_answer = i["answer"]
                 correct_answer = i["answer"]
                 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")
@@ -279,8 +274,8 @@ async def callback_query_welcome_button(_, callback_query):
         await callback_query.answer("Yeah, It's Wrong.")
         await callback_query.answer("Yeah, It's Wrong.")
         for iii in answers_dicc:
         for iii in answers_dicc:
             if (
             if (
-                    iii["user_id"] == pending_user_id
-                    and iii["chat_id"] == button_message.chat.id
+                iii["user_id"] == pending_user_id
+                and iii["chat_id"] == button_message.chat.id
             ):
             ):
                 attempts = iii["attempts"]
                 attempts = iii["attempts"]
                 if attempts >= 3:
                 if attempts >= 3:
@@ -312,8 +307,8 @@ async def callback_query_welcome_button(_, callback_query):
     if len(answers_dicc) != 0:
     if len(answers_dicc) != 0:
         for ii in answers_dicc:
         for ii in answers_dicc:
             if (
             if (
-                    ii["user_id"] == pending_user_id
-                    and ii["chat_id"] == button_message.chat.id
+                ii["user_id"] == pending_user_id
+                and ii["chat_id"] == button_message.chat.id
             ):
             ):
                 answers_dicc.remove(ii)
                 answers_dicc.remove(ii)
                 await update_captcha_cache(answers_dicc)
                 await update_captcha_cache(answers_dicc)
@@ -327,9 +322,7 @@ async def callback_query_welcome_button(_, callback_query):
     return await send_welcome_message(chat, pending_user_id, True)
     return await send_welcome_message(chat, pending_user_id, True)
 
 
 
 
-async def kick_restricted_after_delay(
-        delay, button_message: Message, user: User
-):
+async def kick_restricted_after_delay(delay, button_message: Message, user: User):
     """If the new member is still restricted after the delay, delete
     """If the new member is still restricted after the delay, delete
     button message and join message and then kick him
     button message and join message and then kick him
     """
     """
@@ -348,20 +341,17 @@ async def kick_restricted_after_delay(
     await _ban_restricted_user_until_date(group_chat, user_id, duration=delay)
     await _ban_restricted_user_until_date(group_chat, user_id, duration=delay)
 
 
 
 
-async def _ban_restricted_user_until_date(
-        group_chat, user_id: int, duration: int
-):
+async def _ban_restricted_user_until_date(group_chat, user_id: int, duration: int):
     try:
     try:
         member = await group_chat.get_member(user_id)
         member = await group_chat.get_member(user_id)
-        if member.status == "restricted":
+        if member.status == ChatMemberStatus.RESTRICTED:
             until_date = int(datetime.utcnow().timestamp() + duration)
             until_date = int(datetime.utcnow().timestamp() + duration)
             await group_chat.ban_member(user_id, until_date=until_date)
             await group_chat.ban_member(user_id, until_date=until_date)
     except UserNotParticipant:
     except UserNotParticipant:
         pass
         pass
 
 
 
 
-@app.on_message(
-    filters.command("captcha") & ~filters.private & ~filters.edited)
+@app.on_message(filters.command("captcha") & ~filters.private)
 @adminsOnly("can_restrict_members")
 @adminsOnly("can_restrict_members")
 async def captcha_state(_, message):
 async def captcha_state(_, message):
     usage = "**Usage:**\n/captcha [ENABLE|DISABLE]"
     usage = "**Usage:**\n/captcha [ENABLE|DISABLE]"
@@ -384,8 +374,7 @@ async def captcha_state(_, message):
 # WELCOME MESSAGE
 # WELCOME MESSAGE
 
 
 
 
-@app.on_message(
-    filters.command("set_welcome") & ~filters.private & ~filters.edited)
+@app.on_message(filters.command("set_welcome") & ~filters.private)
 @adminsOnly("can_change_info")
 @adminsOnly("can_change_info")
 async def set_welcome_func(_, message):
 async def set_welcome_func(_, message):
     usage = "You need to reply to a text, check the Greetings module in /help"
     usage = "You need to reply to a text, check the Greetings module in /help"
@@ -403,8 +392,7 @@ async def set_welcome_func(_, message):
     await message.reply_text("Welcome message has been successfully set.")
     await message.reply_text("Welcome message has been successfully set.")
 
 
 
 
-@app.on_message(
-    filters.command("del_welcome") & ~filters.private & ~filters.edited)
+@app.on_message(filters.command("del_welcome") & ~filters.private)
 @adminsOnly("can_change_info")
 @adminsOnly("can_change_info")
 async def del_welcome_func(_, message):
 async def del_welcome_func(_, message):
     chat_id = message.chat.id
     chat_id = message.chat.id
@@ -412,8 +400,7 @@ async def del_welcome_func(_, message):
     await message.reply_text("Welcome message has been deleted.")
     await message.reply_text("Welcome message has been deleted.")
 
 
 
 
-@app.on_message(
-    filters.command("get_welcome") & ~filters.private & ~filters.edited)
+@app.on_message(filters.command("get_welcome") & ~filters.private)
 @adminsOnly("can_change_info")
 @adminsOnly("can_change_info")
 async def get_welcome_func(_, message):
 async def get_welcome_func(_, message):
     chat = message.chat
     chat = message.chat
@@ -421,9 +408,7 @@ async def get_welcome_func(_, message):
     if not welcome:
     if not welcome:
         return await message.reply_text("No welcome message set.")
         return await message.reply_text("No welcome message set.")
     if not message.from_user:
     if not message.from_user:
-        return await message.reply_text(
-            "You're anon, can't send welcome message."
-        )
+        return await message.reply_text("You're anon, can't send welcome message.")
 
 
     await send_welcome_message(chat, message.from_user.id)
     await send_welcome_message(chat, message.from_user.id)
 
 

+ 7 - 7
wbb/modules/img_pdf.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -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
 
 
@@ -92,7 +92,7 @@ async def convert(
             remove(file)
             remove(file)
 
 
 
 
-@app.on_message(filters.command("pdf") & ~filters.edited)
+@app.on_message(filters.command("pdf"))
 @capture_err
 @capture_err
 async def img_to_pdf(_, message: Message):
 async def img_to_pdf(_, message: Message):
     reply = message.reply_to_message
     reply = message.reply_to_message
@@ -107,7 +107,7 @@ async def img_to_pdf(_, message: Message):
     if reply.media_group_id:
     if reply.media_group_id:
         messages = await app.get_media_group(
         messages = await app.get_media_group(
             message.chat.id,
             message.chat.id,
-            reply.message_id,
+            reply.id,
         )
         )
         return await convert(message, messages, m, start_time)
         return await convert(message, messages, m, start_time)
 
 

+ 4 - 6
wbb/modules/info.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -95,7 +95,7 @@ async def get_chat_info(chat, already=False):
     return [caption, photo_id]
     return [caption, photo_id]
 
 
 
 
-@app.on_message(filters.command("info") & ~filters.edited)
+@app.on_message(filters.command("info"))
 async def info_func(_, message: Message):
 async def info_func(_, message: Message):
     if message.reply_to_message:
     if message.reply_to_message:
         user = message.reply_to_message.from_user.id
         user = message.reply_to_message.from_user.id
@@ -120,13 +120,11 @@ async def info_func(_, message: Message):
     os.remove(photo)
     os.remove(photo)
 
 
 
 
-@app.on_message(filters.command("chat_info") & ~filters.edited)
+@app.on_message(filters.command("chat_info"))
 async def chat_info_func(_, message: Message):
 async def chat_info_func(_, message: Message):
     try:
     try:
         if len(message.command) > 2:
         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]")
 
 
         if len(message.command) == 1:
         if len(message.command) == 1:
             chat = message.chat.id
             chat = message.chat.id

+ 13 - 37
wbb/modules/inline.py

@@ -2,7 +2,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -39,14 +39,10 @@ async def inline_query_handler(client, query):
         answers = []
         answers = []
         if text.strip() == "":
         if text.strip() == "":
             answerss = await inline_help_func(__HELP__)
             answerss = await inline_help_func(__HELP__)
-            await client.answer_inline_query(
-                query.id, results=answerss, cache_time=10
-            )
+            await client.answer_inline_query(query.id, results=answerss, cache_time=10)
         elif text.split()[0] == "alive":
         elif text.split()[0] == "alive":
             answerss = await alive_function(answers)
             answerss = await alive_function(answers)
-            await client.answer_inline_query(
-                query.id, results=answerss, cache_time=10
-            )
+            await client.answer_inline_query(query.id, results=answerss, cache_time=10)
         elif text.split()[0] == "tr":
         elif text.split()[0] == "tr":
             if len(text.split()) < 3:
             if len(text.split()) < 3:
                 return await client.answer_inline_query(
                 return await client.answer_inline_query(
@@ -102,9 +98,7 @@ async def inline_query_handler(client, query):
                 )
                 )
             tex = text.split(None, 1)[1].strip()
             tex = text.split(None, 1)[1].strip()
             answerss = await wall_func(answers, tex)
             answerss = await wall_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] == "torrent":
         elif text.split()[0] == "torrent":
             if len(text.split()) < 2:
             if len(text.split()) < 2:
@@ -156,9 +150,7 @@ async def inline_query_handler(client, query):
             user_id = query.from_user.id
             user_id = query.from_user.id
             tex = text.split(None, 1)[1].strip()
             tex = text.split(None, 1)[1].strip()
             answerss = await tg_search_func(answers, tex, user_id)
             answerss = await tg_search_func(answers, tex, user_id)
-            await client.answer_inline_query(
-                query.id, results=answerss, cache_time=2
-            )
+            await client.answer_inline_query(query.id, results=answerss, cache_time=2)
 
 
         elif text.split()[0] == "music":
         elif text.split()[0] == "music":
             if len(text.split()) < 2:
             if len(text.split()) < 2:
@@ -170,9 +162,7 @@ async def inline_query_handler(client, query):
                 )
                 )
             tex = text.split(None, 1)[1].strip()
             tex = text.split(None, 1)[1].strip()
             answerss = await music_inline_func(answers, tex)
             answerss = await music_inline_func(answers, tex)
-            await client.answer_inline_query(
-                query.id, results=answerss, cache_time=2
-            )
+            await client.answer_inline_query(query.id, results=answerss, cache_time=2)
 
 
         elif text.split()[0] == "wiki":
         elif text.split()[0] == "wiki":
             if len(text.split()) < 2:
             if len(text.split()) < 2:
@@ -184,9 +174,7 @@ async def inline_query_handler(client, query):
                 )
                 )
             tex = text.split(None, 1)[1].strip()
             tex = text.split(None, 1)[1].strip()
             answerss = await wiki_func(answers, tex)
             answerss = await wiki_func(answers, tex)
-            await client.answer_inline_query(
-                query.id, results=answerss, cache_time=2
-            )
+            await client.answer_inline_query(query.id, results=answerss, cache_time=2)
 
 
         elif text.split()[0] == "speedtest":
         elif text.split()[0] == "speedtest":
             answerss = await speedtest_init(query)
             answerss = await speedtest_init(query)
@@ -198,15 +186,11 @@ async def inline_query_handler(client, query):
             user_id = query.from_user.id
             user_id = query.from_user.id
             victim = text.split()[1]
             victim = text.split()[1]
             answerss = await pmpermit_func(answers, user_id, victim)
             answerss = await pmpermit_func(answers, user_id, victim)
-            await client.answer_inline_query(
-                query.id, results=answerss, cache_time=2
-            )
+            await client.answer_inline_query(query.id, results=answerss, cache_time=2)
 
 
         elif text.split()[0] == "ping":
         elif text.split()[0] == "ping":
             answerss = await ping_func(answers)
             answerss = await ping_func(answers)
-            await client.answer_inline_query(
-                query.id, results=answerss, cache_time=2
-            )
+            await client.answer_inline_query(query.id, results=answerss, cache_time=2)
 
 
         elif text.split()[0] == "ytmusic":
         elif text.split()[0] == "ytmusic":
             if len(text.split()) < 2:
             if len(text.split()) < 2:
@@ -218,9 +202,7 @@ async def inline_query_handler(client, query):
                 )
                 )
             tex = query.query.split(None, 1)[1].strip()
             tex = query.query.split(None, 1)[1].strip()
             answerss = await yt_music_func(answers, tex)
             answerss = await yt_music_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] == "info":
         elif text.split()[0] == "info":
             if len(text.split()) < 2:
             if len(text.split()) < 2:
@@ -232,9 +214,7 @@ async def inline_query_handler(client, query):
                 )
                 )
             tex = text.split()[1].strip()
             tex = text.split()[1].strip()
             answerss = await info_inline_func(answers, tex)
             answerss = await info_inline_func(answers, tex)
-            await client.answer_inline_query(
-                query.id, results=answerss, cache_time=2
-            )
+            await client.answer_inline_query(query.id, results=answerss, cache_time=2)
 
 
         elif text.split()[0] == "tmdb":
         elif text.split()[0] == "tmdb":
             if len(text.split()) < 2:
             if len(text.split()) < 2:
@@ -247,9 +227,7 @@ async def inline_query_handler(client, query):
                 )
                 )
             tex = text.split()[1].strip()
             tex = text.split()[1].strip()
             answerss = await tmdb_func(answers, tex)
             answerss = await tmdb_func(answers, tex)
-            await client.answer_inline_query(
-                query.id, results=answerss, cache_time=2
-            )
+            await client.answer_inline_query(query.id, results=answerss, cache_time=2)
 
 
         elif text.split()[0] == "image":
         elif text.split()[0] == "image":
             if len(text.split()) < 2:
             if len(text.split()) < 2:
@@ -272,9 +250,7 @@ async def inline_query_handler(client, query):
         elif text.strip() == "tasks":
         elif text.strip() == "tasks":
             user_id = query.from_user.id
             user_id = query.from_user.id
             answerss = await task_inline_func(user_id)
             answerss = await task_inline_func(user_id)
-            await client.answer_inline_query(
-                query.id, results=answerss, cache_time=1
-            )
+            await client.answer_inline_query(query.id, results=answerss, cache_time=1)
 
 
     except Exception as e:
     except Exception as e:
         e = traceback.format_exc()
         e = traceback.format_exc()

+ 16 - 12
wbb/modules/iplookup.py

@@ -1,9 +1,10 @@
 import asyncio
 import asyncio
-from wbb import app
+
 from pyrogram import filters
 from pyrogram import filters
 from pyrogram.types import Message
 from pyrogram.types import Message
-from wbb.utils import http
 
 
+from wbb import app
+from wbb.utils import http
 
 
 # For /help menu
 # For /help menu
 __MODULE__ = "iplookup"
 __MODULE__ = "iplookup"
@@ -12,7 +13,7 @@ __HELP__ = """
 """
 """
 
 
 
 
-@app.on_message(~filters.edited & filters.command("iplookup"))
+@app.on_message(filters.command("iplookup"))
 async def ip_lookup(_, message: Message):
 async def ip_lookup(_, message: Message):
     if len(message.command) < 2:
     if len(message.command) < 2:
         return await message.reply_text("ip address is missing")
         return await message.reply_text("ip address is missing")
@@ -30,12 +31,15 @@ async def ip_lookup(_, message: Message):
     country = res.get("country", "N/A")
     country = res.get("country", "N/A")
     location = res.get("loc", "N/A")
     location = res.get("loc", "N/A")
     org = res.get("org", "N/A")
     org = res.get("org", "N/A")
-    await msg.edit((
-        f"**Details of `{ip_address}`**\n\n"
-        f"HostName: `{hostname}`\n"
-        f"City: `{city}`\n"
-        f"Region: `{region}`\n"
-        f"Country: `{country}`\n"
-        f"Org: `{org}`\n"
-        f"Map: https://www.google.fr/maps?q={location}\n"
-    ), disable_web_page_preview=True)
+    await msg.edit(
+        (
+            f"**Details of `{ip_address}`**\n\n"
+            f"HostName: `{hostname}`\n"
+            f"City: `{city}`\n"
+            f"Region: `{region}`\n"
+            f"Country: `{country}`\n"
+            f"Org: `{org}`\n"
+            f"Map: https://www.google.fr/maps?q={location}\n"
+        ),
+        disable_web_page_preview=True,
+    )

+ 5 - 8
wbb/modules/karma.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -60,8 +60,7 @@ regex_downvote = r"^(-|--|-1|not cool|disagree|worst|bad|👎|-- .+)$"
     & filters.reply
     & filters.reply
     & filters.regex(regex_upvote, re.IGNORECASE)
     & filters.regex(regex_upvote, re.IGNORECASE)
     & ~filters.via_bot
     & ~filters.via_bot
-    & ~filters.bot
-    & ~filters.edited,
+    & ~filters.bot,
     group=karma_positive_group,
     group=karma_positive_group,
 )
 )
 @capture_err
 @capture_err
@@ -99,8 +98,7 @@ async def upvote(_, message):
     & filters.reply
     & filters.reply
     & filters.regex(regex_downvote, re.IGNORECASE)
     & filters.regex(regex_downvote, re.IGNORECASE)
     & ~filters.via_bot
     & ~filters.via_bot
-    & ~filters.bot
-    & ~filters.edited,
+    & ~filters.bot,
     group=karma_negative_group,
     group=karma_negative_group,
 )
 )
 @capture_err
 @capture_err
@@ -144,7 +142,7 @@ async def downvote(_, message):
     )
     )
 
 
 
 
-@app.on_message(filters.command("karma") & filters.group & ~filters.edited)
+@app.on_message(filters.command("karma") & filters.group)
 @capture_err
 @capture_err
 async def command_karma(_, message):
 async def command_karma(_, message):
     chat_id = message.chat.id
     chat_id = message.chat.id
@@ -194,8 +192,7 @@ async def command_karma(_, message):
             await message.reply_text(f"**Total Points**: __{karma}__")
             await message.reply_text(f"**Total Points**: __{karma}__")
 
 
 
 
-@app.on_message(
-    filters.command("karma_toggle") & ~filters.private & ~filters.edited)
+@app.on_message(filters.command("karma_toggle") & ~filters.private)
 @adminsOnly("can_change_info")
 @adminsOnly("can_change_info")
 async def captcha_state(_, message):
 async def captcha_state(_, message):
     usage = "**Usage:**\n/karma_toggle [ENABLE|DISABLE]"
     usage = "**Usage:**\n/karma_toggle [ENABLE|DISABLE]"

+ 4 - 8
wbb/modules/locks.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -101,9 +101,7 @@ async def tg_lock(message, permissions: list, perm: str, lock: bool):
     permissions = {perm: True for perm in list(set(permissions))}
     permissions = {perm: True for perm in list(set(permissions))}
 
 
     try:
     try:
-        await app.set_chat_permissions(
-            message.chat.id, ChatPermissions(**permissions)
-        )
+        await app.set_chat_permissions(message.chat.id, ChatPermissions(**permissions))
     except ChatNotModified:
     except ChatNotModified:
         return await message.reply_text(
         return await message.reply_text(
             "To unlock this, you have to unlock 'messages' first."
             "To unlock this, you have to unlock 'messages' first."
@@ -112,8 +110,7 @@ async def tg_lock(message, permissions: list, perm: str, lock: bool):
     await message.reply_text(("Locked." if lock else "Unlocked."))
     await message.reply_text(("Locked." if lock else "Unlocked."))
 
 
 
 
-@app.on_message(
-    filters.command(["lock", "unlock"]) & ~filters.private & ~filters.edited)
+@app.on_message(filters.command(["lock", "unlock"]) & ~filters.private)
 @adminsOnly("can_restrict_members")
 @adminsOnly("can_restrict_members")
 async def locks_func(_, message):
 async def locks_func(_, message):
     if len(message.command) != 2:
     if len(message.command) != 2:
@@ -156,8 +153,7 @@ async def locks_func(_, message):
         await message.reply(f"Unlocked Everything in {message.chat.title}")
         await message.reply(f"Unlocked Everything in {message.chat.title}")
 
 
 
 
-@app.on_message(
-    filters.command("locks") & ~filters.private & ~filters.edited)
+@app.on_message(filters.command("locks") & ~filters.private)
 @capture_err
 @capture_err
 async def locktypes(_, message):
 async def locktypes(_, message):
     permissions = await current_chat_permissions(message.chat.id)
     permissions = await current_chat_permissions(message.chat.id)

+ 19 - 30
wbb/modules/misc.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -28,7 +28,7 @@ import subprocess
 from asyncio import Lock
 from asyncio import Lock
 from re import findall
 from re import findall
 
 
-from pyrogram import filters
+from pyrogram import enums, filters
 
 
 from wbb import SUDOERS, USERBOT_PREFIX, app, app2, arq, eor
 from wbb import SUDOERS, USERBOT_PREFIX, app, app2, arq, eor
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.errors import capture_err
@@ -101,12 +101,8 @@ ASQ_LOCK = Lock()
 PING_LOCK = Lock()
 PING_LOCK = Lock()
 
 
 
 
-@app2.on_message(
-    SUDOERS
-    & filters.command("ping", prefixes=USERBOT_PREFIX)
-    & ~filters.edited
-)
-@app.on_message(filters.command("ping") & ~filters.edited)
+@app2.on_message(SUDOERS & filters.command("ping", prefixes=USERBOT_PREFIX))
+@app.on_message(filters.command("ping"))
 async def ping_handler(_, message):
 async def ping_handler(_, message):
     m = await eor(message, text="Pinging datacenters...")
     m = await eor(message, text="Pinging datacenters...")
     async with PING_LOCK:
     async with PING_LOCK:
@@ -125,12 +121,11 @@ async def ping_handler(_, message):
                     ["ping", "-c", "1", "-W", "2", ip],
                     ["ping", "-c", "1", "-W", "2", ip],
                     text=True,
                     text=True,
                     check=True,
                     check=True,
-                    capture_output=True
+                    capture_output=True,
                 )
                 )
                 resp_time = findall(r"time=.+m?s", shell.stdout, re.MULTILINE)[
                 resp_time = findall(r"time=.+m?s", shell.stdout, re.MULTILINE)[
-                    0].replace(
-                    "time=", ""
-                )
+                    0
+                ].replace("time=", "")
 
 
                 text += f"    **{dc.upper()}:** {resp_time} ✅\n"
                 text += f"    **{dc.upper()}:** {resp_time} ✅\n"
             except Exception:
             except Exception:
@@ -139,7 +134,7 @@ async def ping_handler(_, message):
         await m.edit(text)
         await m.edit(text)
 
 
 
 
-@app.on_message(filters.command("asq") & ~filters.edited)
+@app.on_message(filters.command("asq"))
 async def asq(_, message):
 async def asq(_, message):
     err = "Reply to text message or pass the question as argument"
     err = "Reply to text message or pass the question as argument"
     if message.reply_to_message:
     if message.reply_to_message:
@@ -156,22 +151,20 @@ async def asq(_, message):
         await m.edit(resp.result)
         await m.edit(resp.result)
 
 
 
 
-@app.on_message(filters.command("commit") & ~filters.edited)
+@app.on_message(filters.command("commit"))
 async def commit(_, message):
 async def commit(_, message):
     await message.reply_text(await get("http://whatthecommit.com/index.txt"))
     await message.reply_text(await get("http://whatthecommit.com/index.txt"))
 
 
 
 
-@app.on_message(filters.command("RTFM", "#") & ~filters.edited)
+@app.on_message(filters.command("RTFM", "#"))
 async def rtfm(_, message):
 async def rtfm(_, message):
     await message.delete()
     await message.delete()
     if not message.reply_to_message:
     if not message.reply_to_message:
         return await message.reply_text("Reply To A Message lol")
         return await message.reply_text("Reply To A Message lol")
-    await message.reply_to_message.reply_text(
-        "Are You Lost? READ THE FUCKING DOCS!"
-    )
+    await message.reply_to_message.reply_text("Are You Lost? READ THE FUCKING DOCS!")
 
 
 
 
-@app.on_message(filters.command("runs") & ~filters.edited)
+@app.on_message(filters.command("runs"))
 async def runs(_, message):
 async def runs(_, message):
     await message.reply_text((await random_line("wbb/utils/runs.txt")))
     await message.reply_text((await random_line("wbb/utils/runs.txt")))
 
 
@@ -181,7 +174,7 @@ async def runs(_, message):
 async def getid(client, message):
 async def getid(client, message):
     chat = message.chat
     chat = message.chat
     your_id = message.from_user.id
     your_id = message.from_user.id
-    message_id = message.message_id
+    message_id = message.id
     reply = message.reply_to_message
     reply = message.reply_to_message
 
 
     text = f"**[Message ID:]({message.link})** `{message_id}`\n"
     text = f"**[Message ID:]({message.link})** `{message_id}`\n"
@@ -201,21 +194,19 @@ async def getid(client, message):
     text += f"**[Chat ID:](https://t.me/{chat.username})** `{chat.id}`\n\n"
     text += f"**[Chat ID:](https://t.me/{chat.username})** `{chat.id}`\n\n"
     if not getattr(reply, "empty", True):
     if not getattr(reply, "empty", True):
         id_ = reply.from_user.id if reply.from_user else reply.sender_chat.id
         id_ = reply.from_user.id if reply.from_user else reply.sender_chat.id
-        text += (
-            f"**[Replied Message ID:]({reply.link})** `{reply.message_id}`\n"
-        )
+        text += f"**[Replied Message ID:]({reply.link})** `{reply.message_id}`\n"
         text += f"**[Replied User ID:](tg://user?id={id_})** `{id_}`"
         text += f"**[Replied User ID:](tg://user?id={id_})** `{id_}`"
 
 
     await eor(
     await eor(
         message,
         message,
         text=text,
         text=text,
         disable_web_page_preview=True,
         disable_web_page_preview=True,
-        parse_mode="md",
+        parse_mode=enums.ParseMode.MARKDOWN,
     )
     )
 
 
 
 
 # Random
 # Random
-@app.on_message(filters.command("random") & ~filters.edited)
+@app.on_message(filters.command("random"))
 @capture_err
 @capture_err
 async def random(_, message):
 async def random(_, message):
     if len(message.command) != 2:
     if len(message.command) != 2:
@@ -226,9 +217,7 @@ async def random(_, message):
     try:
     try:
         if 1 < int(length) < 1000:
         if 1 < int(length) < 1000:
             alphabet = string.ascii_letters + string.digits
             alphabet = string.ascii_letters + string.digits
-            password = "".join(
-                secrets.choice(alphabet) for i in range(int(length))
-            )
+            password = "".join(secrets.choice(alphabet) for i in range(int(length)))
             await message.reply_text(f"`{password}`")
             await message.reply_text(f"`{password}`")
         else:
         else:
             await message.reply_text("Specify A Length Between 1-1000")
             await message.reply_text("Specify A Length Between 1-1000")
@@ -239,7 +228,7 @@ async def random(_, message):
 
 
 
 
 # Translate
 # Translate
-@app.on_message(filters.command("tr") & ~filters.edited)
+@app.on_message(filters.command("tr"))
 @capture_err
 @capture_err
 async def tr(_, message):
 async def tr(_, message):
     if len(message.command) != 2:
     if len(message.command) != 2:
@@ -262,7 +251,7 @@ async def tr(_, message):
     await message.reply_text(result.result.translatedText)
     await message.reply_text(result.result.translatedText)
 
 
 
 
-@app.on_message(filters.command("json") & ~filters.edited)
+@app.on_message(filters.command("json"))
 @capture_err
 @capture_err
 async def json_fetch(_, message):
 async def json_fetch(_, message):
     if len(message.command) != 2:
     if len(message.command) != 2:

+ 4 - 4
wbb/modules/mongo_backup.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -24,15 +24,15 @@ SOFTWARE.
 from os import remove
 from os import remove
 from os import system as execute
 from os import system as execute
 
 
-from pyrogram import filters
+from pyrogram import enums, filters
 from pyrogram.types import Message
 from pyrogram.types import Message
 
 
 from wbb import MONGO_URL, SUDOERS, app
 from wbb import MONGO_URL, SUDOERS, app
 
 
 
 
-@app.on_message(filters.command("backup") & SUDOERS & ~filters.edited)
+@app.on_message(filters.command("backup") & SUDOERS)
 async def backup(_, message: Message):
 async def backup(_, message: Message):
-    if message.chat.type != "private":
+    if message.chat.type != enums.ChatType.PRIVATE:
         return await message.reply("This command can only be used in private")
         return await message.reply("This command can only be used in private")
 
 
     m = await message.reply("Backing up data...")
     m = await message.reply("Backing up data...")

+ 10 - 14
wbb/modules/music.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -54,9 +54,7 @@ def download_youtube_audio(arq_resp):
     performer = r.channel
     performer = r.channel
 
 
     m, s = r.duration.split(":")
     m, s = r.duration.split(":")
-    duration = int(
-        datetime.timedelta(minutes=int(m), seconds=int(s)).total_seconds()
-    )
+    duration = int(datetime.timedelta(minutes=int(m), seconds=int(s)).total_seconds())
 
 
     if duration > 1800:
     if duration > 1800:
         return
         return
@@ -78,7 +76,7 @@ def download_youtube_audio(arq_resp):
     return [title, performer, duration, audio_file, thumbnail_file]
     return [title, performer, duration, audio_file, thumbnail_file]
 
 
 
 
-@app.on_message(filters.command("ytmusic") & ~filters.edited)
+@app.on_message(filters.command("ytmusic"))
 @capture_err
 @capture_err
 async def music(_, message):
 async def music(_, message):
     global is_downloading
     global is_downloading
@@ -91,9 +89,7 @@ async def music(_, message):
             "Another download is in progress, try again after sometime."
             "Another download is in progress, try again after sometime."
         )
         )
     is_downloading = True
     is_downloading = True
-    m = await message.reply_text(
-        f"Downloading {url}", disable_web_page_preview=True
-    )
+    m = await message.reply_text(f"Downloading {url}", disable_web_page_preview=True)
     try:
     try:
         loop = get_running_loop()
         loop = get_running_loop()
         arq_resp = await arq.youtube(url)
         arq_resp = await arq.youtube(url)
@@ -138,7 +134,7 @@ async def download_song(url):
 # Jiosaavn Music
 # Jiosaavn Music
 
 
 
 
-@app.on_message(filters.command("saavn") & ~filters.edited)
+@app.on_message(filters.command("saavn"))
 @capture_err
 @capture_err
 async def jssong(_, message):
 async def jssong(_, message):
     global is_downloading
     global is_downloading
@@ -181,7 +177,7 @@ async def jssong(_, message):
 # Lyrics
 # Lyrics
 
 
 
 
-@app.on_message(filters.command("lyrics") & ~filters.edited)
+@app.on_message(filters.command("lyrics"))
 async def lyrics_func(_, message):
 async def lyrics_func(_, message):
     if len(message.command) < 2:
     if len(message.command) < 2:
         return await message.reply_text("**Usage:**\n/lyrics [QUERY]")
         return await message.reply_text("**Usage:**\n/lyrics [QUERY]")
@@ -194,11 +190,11 @@ async def lyrics_func(_, message):
         return await m.edit("No lyrics found.")
         return await m.edit("No lyrics found.")
 
 
     song = resp.result[0]
     song = resp.result[0]
-    song_name = song['song']
-    artist = song['artist']
-    lyrics = song['lyrics']
+    song_name = song["song"]
+    artist = song["artist"]
+    lyrics = song["lyrics"]
     msg = f"**{song_name}** | **{artist}**\n\n__{lyrics}__"
     msg = f"**{song_name}** | **{artist}**\n\n__{lyrics}__"
-          
+
     if len(msg) > 4095:
     if len(msg) > 4095:
         msg = await paste(msg)
         msg = await paste(msg)
         msg = f"**LYRICS_TOO_LONG:** [URL]({msg})"
         msg = f"**LYRICS_TOO_LONG:** [URL]({msg})"

+ 7 - 17
wbb/modules/notes.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -29,12 +29,7 @@ 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"
@@ -51,7 +46,7 @@ Checkout /markdownhelp to know more about formattings and other syntax.
 
 
 
 
 @app2.on_message(filters.command("save", prefixes=USERBOT_PREFIX) & SUDOERS)
 @app2.on_message(filters.command("save", prefixes=USERBOT_PREFIX) & SUDOERS)
-@app.on_message(filters.command("save") & ~filters.edited & ~filters.private)
+@app.on_message(filters.command("save") & ~filters.private)
 @adminsOnly("can_change_info")
 @adminsOnly("can_change_info")
 async def save_notee(_, message):
 async def save_notee(_, message):
     if len(message.command) < 2 or not message.reply_to_message:
     if len(message.command) < 2 or not message.reply_to_message:
@@ -60,10 +55,7 @@ async def save_notee(_, message):
             text="**Usage:**\nReply to a text or sticker with /save [NOTE_NAME] to save it.",
             text="**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
-    ):
+    elif not message.reply_to_message.text and not message.reply_to_message.sticker:
         await eor(
         await eor(
             message,
             message,
             text="__**You can only save text or stickers in notes.**__",
             text="__**You can only save text or stickers in notes.**__",
@@ -86,7 +78,7 @@ async def save_notee(_, message):
 
 
 
 
 @app2.on_message(filters.command("notes", prefixes=USERBOT_PREFIX) & SUDOERS)
 @app2.on_message(filters.command("notes", prefixes=USERBOT_PREFIX) & SUDOERS)
-@app.on_message(filters.command("notes") & ~filters.edited & ~filters.private)
+@app.on_message(filters.command("notes") & ~filters.private)
 @capture_err
 @capture_err
 async def get_notes(_, message):
 async def get_notes(_, message):
     prefix = message.text.split()[0][0]
     prefix = message.text.split()[0][0]
@@ -126,9 +118,7 @@ async def get_one_note_userbot(_, message):
         await message.reply_sticker(_note["data"])
         await message.reply_sticker(_note["data"])
 
 
 
 
-@app.on_message(
-    filters.regex(r"^#.+") & filters.text & ~filters.edited & ~filters.private
-)
+@app.on_message(filters.regex(r"^#.+") & filters.text & ~filters.private)
 @capture_err
 @capture_err
 async def get_one_note(_, message):
 async def get_one_note(_, message):
     name = message.text.replace("#", "", 1)
     name = message.text.replace("#", "", 1)
@@ -154,7 +144,7 @@ async def get_one_note(_, message):
 
 
 
 
 @app2.on_message(filters.command("delete", prefixes=USERBOT_PREFIX) & SUDOERS)
 @app2.on_message(filters.command("delete", prefixes=USERBOT_PREFIX) & SUDOERS)
-@app.on_message(filters.command("delete") & ~filters.edited & ~filters.private)
+@app.on_message(filters.command("delete") & ~filters.private)
 @adminsOnly("can_change_info")
 @adminsOnly("can_change_info")
 async def del_note(_, message):
 async def del_note(_, message):
     if len(message.command) < 2:
     if len(message.command) < 2:

+ 2 - 6
wbb/modules/parse_preview.py

@@ -7,9 +7,7 @@ from wbb import SUDOERS, USERBOT_PREFIX, app2, eor
 from wbb.core.sections import section
 from wbb.core.sections import section
 
 
 
 
-@app2.on_message(
-    filters.command("parse_preview", prefixes=USERBOT_PREFIX) & SUDOERS
-)
+@app2.on_message(filters.command("parse_preview", prefixes=USERBOT_PREFIX) & SUDOERS)
 async def parse(_, message: Message):
 async def parse(_, message: Message):
     r = message.reply_to_message
     r = message.reply_to_message
     has_wpp = False
     has_wpp = False
@@ -39,9 +37,7 @@ async def parse(_, message: Message):
 
 
     body = {
     body = {
         "Title": [wpp.title or "Null"],
         "Title": [wpp.title or "Null"],
-        "Description": [
-            (wpp.description[:50] + "...") if wpp.description else "Null"
-        ],
+        "Description": [(wpp.description[:50] + "...") if wpp.description else "Null"],
         "URL": [wpp.display_url or "Null"],
         "URL": [wpp.display_url or "Null"],
         "Author": [wpp.author or "Null"],
         "Author": [wpp.author or "Null"],
         "Site Name": [wpp.site_name or "Null"],
         "Site Name": [wpp.site_name or "Null"],

+ 3 - 5
wbb/modules/paste.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -39,7 +39,7 @@ pattern = re.compile(r"^text/|json$|yaml$|xml$|toml$|x-sh$|x-shellscript$")
 
 
 
 
 @app2.on_message(filters.command("paste", prefixes=USERBOT_PREFIX) & SUDOERS)
 @app2.on_message(filters.command("paste", prefixes=USERBOT_PREFIX) & SUDOERS)
-@app.on_message(filters.command("paste") & ~filters.edited)
+@app.on_message(filters.command("paste"))
 @capture_err
 @capture_err
 async def paste_func(_, message: Message):
 async def paste_func(_, message: Message):
     if not message.reply_to_message:
     if not message.reply_to_message:
@@ -47,9 +47,7 @@ async def paste_func(_, message: Message):
     r = message.reply_to_message
     r = message.reply_to_message
 
 
     if not r.text and not r.document:
     if not r.text and not r.document:
-        return await eor(
-            message, text="Only text and documents are supported."
-        )
+        return await eor(message, text="Only text and documents are supported.")
 
 
     m = await eor(message, text="Pasting...")
     m = await eor(message, text="Pasting...")
 
 

+ 7 - 10
wbb/modules/pipes.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -78,15 +78,13 @@ async def pipes_worker_userbot(_, message: Message):
         to_chat_id = pipes_list_bot[chat_id]
         to_chat_id = pipes_list_bot[chat_id]
 
 
         if not message.text:
         if not message.text:
-            m, temp = await asyncio.gather(
-                app.listen(USERBOT_ID), message.copy(BOT_ID)
-            )
+            m, temp = await asyncio.gather(app.listen(USERBOT_ID), message.copy(BOT_ID))
             caption = f"{temp.caption}{caption}" if temp.caption else caption
             caption = f"{temp.caption}{caption}" if temp.caption else caption
 
 
             await app.copy_message(
             await app.copy_message(
                 to_chat_id,
                 to_chat_id,
                 USERBOT_ID,
                 USERBOT_ID,
-                m.message_id,
+                m.id,
                 caption=caption,
                 caption=caption,
             )
             )
             await asyncio.sleep(2)
             await asyncio.sleep(2)
@@ -95,7 +93,7 @@ async def pipes_worker_userbot(_, message: Message):
         await app.send_message(to_chat_id, text=message.text + caption)
         await app.send_message(to_chat_id, text=message.text + caption)
 
 
 
 
-@app.on_message(filters.command("activate_pipe") & SUDOERS & ~filters.edited)
+@app.on_message(filters.command("activate_pipe") & SUDOERS)
 @capture_err
 @capture_err
 async def activate_pipe_func(_, message: Message):
 async def activate_pipe_func(_, message: Message):
     global pipes_list_bot, pipes_list_userbot
     global pipes_list_bot, pipes_list_userbot
@@ -125,7 +123,7 @@ async def activate_pipe_func(_, message: Message):
     await message.reply_text("Activated pipe.")
     await message.reply_text("Activated pipe.")
 
 
 
 
-@app.on_message(filters.command("deactivate_pipe") & SUDOERS & ~filters.edited)
+@app.on_message(filters.command("deactivate_pipe") & SUDOERS)
 @capture_err
 @capture_err
 async def deactivate_pipe_func(_, message: Message):
 async def deactivate_pipe_func(_, message: Message):
     global pipes_list_bot, pipes_list_userbot
     global pipes_list_bot, pipes_list_userbot
@@ -147,7 +145,7 @@ async def deactivate_pipe_func(_, message: Message):
     await message.reply_text("Deactivated pipe.")
     await message.reply_text("Deactivated pipe.")
 
 
 
 
-@app.on_message(filters.command("pipes") & SUDOERS & ~filters.edited)
+@app.on_message(filters.command("pipes") & SUDOERS)
 @capture_err
 @capture_err
 async def show_pipes_func(_, message: Message):
 async def show_pipes_func(_, message: Message):
     pipes_list_bot.update(pipes_list_userbot)
     pipes_list_bot.update(pipes_list_userbot)
@@ -157,7 +155,6 @@ 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)

+ 9 - 20
wbb/modules/pmpermit.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -40,7 +40,6 @@ flood = {}
     filters.private
     filters.private
     & filters.incoming
     & filters.incoming
     & ~filters.service
     & ~filters.service
-    & ~filters.edited
     & ~filters.me
     & ~filters.me
     & ~filters.bot
     & ~filters.bot
     & ~filters.via_bot
     & ~filters.via_bot
@@ -51,7 +50,7 @@ async def pmpermit_func(_, message):
     user_id = message.from_user.id
     user_id = message.from_user.id
     if not PM_PERMIT or await is_pmpermit_approved(user_id):
     if not PM_PERMIT or await is_pmpermit_approved(user_id):
         return
         return
-    async for m in app2.iter_history(user_id, limit=6):
+    async for m in app2.get_chat_history(user_id, limit=6):
         if m.reply_markup:
         if m.reply_markup:
             await m.delete()
             await m.delete()
     if str(user_id) in flood:
     if str(user_id) in flood:
@@ -70,9 +69,7 @@ async def pmpermit_func(_, message):
 
 
 
 
 @app2.on_message(
 @app2.on_message(
-    filters.command("approve", prefixes=USERBOT_PREFIX)
-    & SUDOERS
-    & ~filters.via_bot
+    filters.command("approve", prefixes=USERBOT_PREFIX) & SUDOERS & ~filters.via_bot
 )
 )
 @capture_err
 @capture_err
 async def pm_approve(_, message):
 async def pm_approve(_, message):
@@ -86,19 +83,15 @@ async def pm_approve(_, message):
 
 
 
 
 @app2.on_message(
 @app2.on_message(
-    filters.command("disapprove", prefixes=USERBOT_PREFIX)
-    & SUDOERS
-    & ~filters.via_bot
+    filters.command("disapprove", prefixes=USERBOT_PREFIX) & SUDOERS & ~filters.via_bot
 )
 )
 async def pm_disapprove(_, message):
 async def pm_disapprove(_, message):
     if not message.reply_to_message:
     if not message.reply_to_message:
-        return await eor(
-            message, text="Reply to a user's message to disapprove."
-        )
+        return await eor(message, text="Reply to a user's message to disapprove.")
     user_id = message.reply_to_message.from_user.id
     user_id = message.reply_to_message.from_user.id
     if not await is_pmpermit_approved(user_id):
     if not await is_pmpermit_approved(user_id):
         await eor(message, text="User is already disapproved to pm")
         await eor(message, text="User is already disapproved to pm")
-        async for m in app2.iter_history(user_id, limit=6):
+        async for m in app2.get_chat_history(user_id, limit=6):
             if m.reply_markup:
             if m.reply_markup:
                 try:
                 try:
                     await m.delete()
                     await m.delete()
@@ -110,9 +103,7 @@ async def pm_disapprove(_, message):
 
 
 
 
 @app2.on_message(
 @app2.on_message(
-    filters.command("block", prefixes=USERBOT_PREFIX)
-    & SUDOERS
-    & ~filters.via_bot
+    filters.command("block", prefixes=USERBOT_PREFIX) & SUDOERS & ~filters.via_bot
 )
 )
 @capture_err
 @capture_err
 async def block_user_func(_, message):
 async def block_user_func(_, message):
@@ -125,9 +116,7 @@ async def block_user_func(_, message):
 
 
 
 
 @app2.on_message(
 @app2.on_message(
-    filters.command("unblock", prefixes=USERBOT_PREFIX)
-    & SUDOERS
-    & ~filters.via_bot
+    filters.command("unblock", prefixes=USERBOT_PREFIX) & SUDOERS & ~filters.via_bot
 )
 )
 async def unblock_user_func(_, message):
 async def unblock_user_func(_, message):
     if not message.reply_to_message:
     if not message.reply_to_message:
@@ -177,7 +166,7 @@ async def pmpermit_cq(_, cq):
         return await cq.answer("It's For The Other Person.")
         return await cq.answer("It's For The Other Person.")
 
 
     if data == "to_scam_you":
     if data == "to_scam_you":
-        async for m in app2.iter_history(user_id, limit=6):
+        async for m in app2.get_chat_history(user_id, limit=6):
             if m.reply_markup:
             if m.reply_markup:
                 await m.delete()
                 await m.delete()
         await app2.send_message(user_id, "Blocked, Go scam someone else.")
         await app2.send_message(user_id, "Blocked, Go scam someone else.")

+ 3 - 5
wbb/modules/purge_me.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -120,7 +120,7 @@ async def purge_me_func(_, message: Message):
     chat_id = message.chat.id
     chat_id = message.chat.id
 
 
     message_ids = [
     message_ids = [
-        m.message_id
+        m.id
         async for m in app2.search_messages(
         async for m in app2.search_messages(
             chat_id,
             chat_id,
             from_user=int(USERBOT_ID),
             from_user=int(USERBOT_ID),
@@ -135,9 +135,7 @@ async def purge_me_func(_, message: Message):
     # because we can't delete more than 100 messages at once,
     # because we can't delete more than 100 messages at once,
     # 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 = [
-        message_ids[i: i + 99] for i in range(0, len(message_ids), 99)
-    ]
+    to_delete = [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:
         await app2.delete_messages(
         await app2.delete_messages(

+ 8 - 12
wbb/modules/quotly.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -65,15 +65,13 @@ def isArgInt(message: Message) -> list:
 
 
 
 
 @app2.on_message(filters.command("q", prefixes=USERBOT_PREFIX) & SUDOERS)
 @app2.on_message(filters.command("q", prefixes=USERBOT_PREFIX) & SUDOERS)
-@app.on_message(filters.command("q") & ~filters.private & ~filters.edited)
+@app.on_message(filters.command("q") & ~filters.private)
 @capture_err
 @capture_err
 async def quotly_func(client, message: Message):
 async def quotly_func(client, message: Message):
     if not message.reply_to_message:
     if not message.reply_to_message:
         return await message.reply_text("Reply to a message to quote it.")
         return await message.reply_text("Reply to a message to quote it.")
     if not message.reply_to_message.text:
     if not message.reply_to_message.text:
-        return await message.reply_text(
-            "Replied message has no text, can't quote it."
-        )
+        return await message.reply_text("Replied message has no text, can't quote it.")
     m = await message.reply_text("Quoting Messages")
     m = await message.reply_text("Quoting Messages")
     if len(message.command) < 2:
     if len(message.command) < 2:
         messages = [message.reply_to_message]
         messages = [message.reply_to_message]
@@ -86,15 +84,15 @@ async def quotly_func(client, message: Message):
 
 
             count = arg[1]
             count = arg[1]
 
 
-            # Fetching 5 extra messages so tha twe can ignore media
+            # Fetching 5 extra messages so that we can ignore media
             # messages and still end up with correct offset
             # messages and still end up with correct offset
             messages = [
             messages = [
                 i
                 i
                 for i in await client.get_messages(
                 for i in await client.get_messages(
                     message.chat.id,
                     message.chat.id,
                     range(
                     range(
-                        message.reply_to_message.message_id,
-                        message.reply_to_message.message_id + (count + 5),
+                        message.reply_to_message.id,
+                        message.reply_to_message.id + (count + 5),
                     ),
                     ),
                     replies=0,
                     replies=0,
                 )
                 )
@@ -108,14 +106,12 @@ async def quotly_func(client, message: Message):
                 )
                 )
             reply_message = await client.get_messages(
             reply_message = await client.get_messages(
                 message.chat.id,
                 message.chat.id,
-                message.reply_to_message.message_id,
+                message.reply_to_message.id,
                 replies=1,
                 replies=1,
             )
             )
             messages = [reply_message]
             messages = [reply_message]
     else:
     else:
-        return await m.edit(
-            "Incorrect argument, check quotly module in help section."
-        )
+        return await m.edit("Incorrect argument, check quotly module in help section.")
     try:
     try:
         if not message:
         if not message:
             return await m.edit("Something went wrong.")
             return await m.edit("Something went wrong.")

+ 2 - 2
wbb/modules/reddit.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -30,7 +30,7 @@ __MODULE__ = "Reddit"
 __HELP__ = "/reddit [query] - results something from reddit"
 __HELP__ = "/reddit [query] - results something from reddit"
 
 
 
 
-@app.on_message(filters.command("reddit") & ~filters.edited)
+@app.on_message(filters.command("reddit"))
 @capture_err
 @capture_err
 async def reddit(_, message):
 async def reddit(_, message):
     if len(message.command) != 2:
     if len(message.command) != 2:

+ 8 - 11
wbb/modules/regex.py

@@ -39,16 +39,13 @@ async def sed(_, message):
             )
             )
 
 
         try:
         try:
-
             if infinite_checker(repl):
             if infinite_checker(repl):
                 return await message.reply_text("Nice try -_-")
                 return await message.reply_text("Nice try -_-")
 
 
             if "i" in flags and "g" in flags:
             if "i" in flags and "g" in flags:
                 text = re.sub(repl, repl_with, to_fix, flags=re.I).strip()
                 text = re.sub(repl, repl_with, to_fix, flags=re.I).strip()
             elif "i" in flags:
             elif "i" in flags:
-                text = re.sub(
-                    repl, repl_with, to_fix, count=1, flags=re.I
-                ).strip()
+                text = re.sub(repl, repl_with, to_fix, count=1, flags=re.I).strip()
             elif "g" in flags:
             elif "g" in flags:
                 text = re.sub(repl, repl_with, to_fix).strip()
                 text = re.sub(repl, repl_with, to_fix).strip()
             else:
             else:
@@ -79,9 +76,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
@@ -101,11 +98,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]

+ 4 - 8
wbb/modules/repo.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -31,7 +31,7 @@ __MODULE__ = "Repo"
 __HELP__ = "/repo - To Get My Github Repository Link " "And Support Group Link"
 __HELP__ = "/repo - To Get My Github Repository Link " "And Support Group Link"
 
 
 
 
-@app.on_message(filters.command("repo") & ~filters.edited)
+@app.on_message(filters.command("repo"))
 @capture_err
 @capture_err
 async def repo(_, message):
 async def repo(_, message):
     users = await get(
     users = await get(
@@ -40,9 +40,7 @@ async def repo(_, message):
     list_of_users = ""
     list_of_users = ""
     count = 1
     count = 1
     for user in users:
     for user in users:
-        list_of_users += (
-            f"**{count}.** [{user['login']}]({user['html_url']})\n"
-        )
+        list_of_users += f"**{count}.** [{user['login']}]({user['html_url']})\n"
         count += 1
         count += 1
 
 
     text = f"""[Github](https://github.com/thehamkercat/WilliamButcherBot) | [Group](t.me/PatheticProgrammers)
     text = f"""[Github](https://github.com/thehamkercat/WilliamButcherBot) | [Group](t.me/PatheticProgrammers)
@@ -50,6 +48,4 @@ async def repo(_, message):
 | Contributors |
 | Contributors |
 ----------------```
 ----------------```
 {list_of_users}"""
 {list_of_users}"""
-    await app.send_message(
-        message.chat.id, text=text, disable_web_page_preview=True
-    )
+    await app.send_message(message.chat.id, text=text, disable_web_page_preview=True)

+ 12 - 16
wbb/modules/reverse.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -45,20 +45,18 @@ async def get_soup(url: str, headers):
 
 
 
 
 @app2.on_message(filters.command("reverse", prefixes=USERBOT_PREFIX) & SUDOERS)
 @app2.on_message(filters.command("reverse", prefixes=USERBOT_PREFIX) & SUDOERS)
-@app.on_message(filters.command("reverse") & ~filters.edited)
+@app.on_message(filters.command("reverse"))
 @capture_err
 @capture_err
 async def reverse_image_search(client, message: Message):
 async def reverse_image_search(client, message: Message):
     if not message.reply_to_message:
     if not message.reply_to_message:
-        return await eor(
-            message, text="Reply to a message to reverse search it."
-        )
+        return await eor(message, text="Reply to a message to reverse search it.")
     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,
@@ -78,9 +76,7 @@ async def reverse_image_search(client, message: Message):
             }
             }
 
 
             def post_non_blocking():
             def post_non_blocking():
-                return requests.post(
-                    search_url, files=multipart, allow_redirects=False
-                )
+                return requests.post(search_url, files=multipart, allow_redirects=False)
 
 
             loop = get_running_loop()
             loop = get_running_loop()
             response = await loop.run_in_executor(None, post_non_blocking)
             response = await loop.run_in_executor(None, post_non_blocking)
@@ -105,9 +101,9 @@ async def reverse_image_search(client, message: Message):
 
 
     # Pass if no images detected
     # Pass if no images detected
     try:
     try:
-        url = "https://google.com" + soup.find_all(
-            "a", {"class": "ekf0x hSQtef"}
-        )[0].get("href")
+        url = "https://google.com" + soup.find_all("a", {"class": "ekf0x hSQtef"})[
+            0
+        ].get("href")
 
 
         soup = await get_soup(url, headers=headers)
         soup = await get_soup(url, headers=headers)
 
 

+ 9 - 15
wbb/modules/rice.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -24,6 +24,7 @@ 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.enums import ChatMemberStatus, ParseMode
 from pyrogram.types import (
 from pyrogram.types import (
     InlineKeyboardButton,
     InlineKeyboardButton,
     InlineKeyboardMarkup,
     InlineKeyboardMarkup,
@@ -46,7 +47,6 @@ RICE_CHANNEL = "RiceGallery"
     & (filters.photo | filters.video | filters.document)
     & (filters.photo | filters.video | filters.document)
     & filters.regex(r"^\[RICE\]", RE_MULTILINE)
     & filters.regex(r"^\[RICE\]", RE_MULTILINE)
     & ~filters.forwarded
     & ~filters.forwarded
-    & ~filters.edited
 )
 )
 @capture_err
 @capture_err
 async def rice(_, message: Message):
 async def rice(_, message: Message):
@@ -59,15 +59,13 @@ async def rice(_, message: Message):
         reply_markup=InlineKeyboardMarkup(
         reply_markup=InlineKeyboardMarkup(
             [
             [
                 [
                 [
-                    InlineKeyboardButton(
-                        "Approve (Forward)", callback_data="forward"
-                    ),
+                    InlineKeyboardButton("Approve (Forward)", callback_data="forward"),
                     InlineKeyboardButton("Ignore", callback_data="ignore"),
                     InlineKeyboardButton("Ignore", callback_data="ignore"),
                 ]
                 ]
             ]
             ]
         ),
         ),
         quote=True,
         quote=True,
-        parse_mode="markdown",
+        parse_mode=ParseMode.MARKDOWN,
     )
     )
 
 
 
 
@@ -77,7 +75,7 @@ async def callback_query_forward_rice(_, callback_query):
     u_approver = callback_query.from_user
     u_approver = callback_query.from_user
     c_group = callback_query.message.chat
     c_group = callback_query.message.chat
     approver_status = (await c_group.get_member(u_approver.id)).status
     approver_status = (await c_group.get_member(u_approver.id)).status
-    if not (approver_status in ("creator", "administrator")):
+    if not approver_status in (ChatMemberStatus.ADMINISTRATOR, ChatMemberStatus.OWNER):
         await callback_query.answer("Only admin can approve this!")
         await callback_query.answer("Only admin can approve this!")
         return
         return
     await callback_query.answer("Successfully approved")
     await callback_query.answer("Successfully approved")
@@ -85,20 +83,16 @@ async def callback_query_forward_rice(_, callback_query):
     u_op = m_op.from_user
     u_op = m_op.from_user
     arg_caption = f"{m_op.caption}\nOP: [{u_op.first_name}]({m_op.link})"
     arg_caption = f"{m_op.caption}\nOP: [{u_op.first_name}]({m_op.link})"
     if m_op.media_group_id:
     if m_op.media_group_id:
-        message_id = m_op.message_id
+        message_id = m_op.id
         media_group = await app.get_media_group(RICE_GROUP, message_id)
         media_group = await app.get_media_group(RICE_GROUP, message_id)
         arg_media = []
         arg_media = []
         for m in media_group:
         for m in media_group:
             if m.photo and m.caption:
             if m.photo and m.caption:
-                arg_media.append(
-                    InputMediaPhoto(m.photo.file_id, caption=arg_caption)
-                )
+                arg_media.append(InputMediaPhoto(m.photo.file_id, caption=arg_caption))
             elif m.photo:
             elif m.photo:
                 arg_media.append(InputMediaPhoto(m.photo.file_id))
                 arg_media.append(InputMediaPhoto(m.photo.file_id))
             elif m.video and m.caption:
             elif m.video and m.caption:
-                arg_media.append(
-                    InputMediaVideo(m.video.file_id, caption=arg_caption)
-                )
+                arg_media.append(InputMediaVideo(m.video.file_id, caption=arg_caption))
             elif m.video:
             elif m.video:
                 arg_media.append(InputMediaVideo(m.video.file_id))
                 arg_media.append(InputMediaVideo(m.video.file_id))
         m_cp = await app.send_media_group(RICE_CHANNEL, arg_media)
         m_cp = await app.send_media_group(RICE_CHANNEL, arg_media)
@@ -124,7 +118,7 @@ async def callback_query_ignore_rice(_, callback_query):
     u_op = m_op.from_user
     u_op = m_op.from_user
     if u_disprover.id == u_op.id:
     if u_disprover.id == u_op.id:
         await callback_query.answer("Ok, this rice won't be forwarded")
         await callback_query.answer("Ok, this rice won't be forwarded")
-    elif disprover_status in ("creator", "administrator"):
+    elif disprover_status in [ChatMemberStatus.ADMINISTRATOR, ChatMemberStatus.OWNER]:
         await m_op.reply_text(f"{u_disprover.mention} ignored this rice")
         await m_op.reply_text(f"{u_disprover.mention} ignored this rice")
     else:
     else:
         return await callback_query.answer("Only admin or OP could ignore it")
         return await callback_query.answer("Only admin or OP could ignore it")

+ 11 - 6
wbb/modules/rss.py

@@ -3,8 +3,10 @@ from asyncio import get_event_loop, sleep
 from feedparser import parse
 from feedparser import parse
 from pyrogram import filters
 from pyrogram import filters
 from pyrogram.errors import (
 from pyrogram.errors import (
-    ChannelInvalid, ChannelPrivate, InputUserDeactivated,
-    UserIsBlocked
+    ChannelInvalid,
+    ChannelPrivate,
+    InputUserDeactivated,
+    UserIsBlocked,
 )
 )
 from pyrogram.types import Message
 from pyrogram.types import Message
 
 
@@ -59,8 +61,11 @@ async def rss_worker():
                 )
                 )
                 await update_rss_feed(chat, feed.title)
                 await update_rss_feed(chat, feed.title)
             except (
             except (
-                    ChannelInvalid, ChannelPrivate, InputUserDeactivated,
-                    UserIsBlocked):
+                ChannelInvalid,
+                ChannelPrivate,
+                InputUserDeactivated,
+                UserIsBlocked,
+            ):
                 await remove_rss_feed(chat)
                 await remove_rss_feed(chat)
                 log.info(f"Removed RSS Feed from {chat} (Invalid Chat)")
                 log.info(f"Removed RSS Feed from {chat} (Invalid Chat)")
             except Exception as e:
             except Exception as e:
@@ -72,7 +77,7 @@ loop = get_event_loop()
 loop.create_task(rss_worker())
 loop.create_task(rss_worker())
 
 
 
 
-@app.on_message(filters.command("add_feed") & ~filters.edited)
+@app.on_message(filters.command("add_feed"))
 @capture_err
 @capture_err
 async def add_feed_func(_, m: Message):
 async def add_feed_func(_, m: Message):
     if len(m.command) != 2:
     if len(m.command) != 2:
@@ -111,7 +116,7 @@ async def add_feed_func(_, m: Message):
     await add_rss_feed(chat_id, parsed.url, feed.title)
     await add_rss_feed(chat_id, parsed.url, feed.title)
 
 
 
 
-@app.on_message(filters.command("rm_feed") & ~filters.edited)
+@app.on_message(filters.command("rm_feed"))
 async def rm_feed_func(_, m: Message):
 async def rm_feed_func(_, m: Message):
     if await is_rss_active(m.chat.id):
     if await is_rss_active(m.chat.id):
         await remove_rss_feed(m.chat.id)
         await remove_rss_feed(m.chat.id)

+ 14 - 23
wbb/modules/stickers.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -66,7 +66,7 @@ MAX_STICKERS = (
 SUPPORTED_TYPES = ["jpeg", "png", "webp"]
 SUPPORTED_TYPES = ["jpeg", "png", "webp"]
 
 
 
 
-@app.on_message(filters.command("sticker_id") & ~filters.edited)
+@app.on_message(filters.command("sticker_id"))
 @capture_err
 @capture_err
 async def sticker_id(_, message: Message):
 async def sticker_id(_, message: Message):
     reply = message.reply_to_message
     reply = message.reply_to_message
@@ -80,7 +80,7 @@ async def sticker_id(_, message: Message):
     await message.reply_text(f"`{reply.sticker.file_id}`")
     await message.reply_text(f"`{reply.sticker.file_id}`")
 
 
 
 
-@app.on_message(filters.command("get_sticker") & ~filters.edited)
+@app.on_message(filters.command("get_sticker"))
 @capture_err
 @capture_err
 async def sticker_image(_, message: Message):
 async def sticker_image(_, message: Message):
     r = message.reply_to_message
     r = message.reply_to_message
@@ -137,25 +137,20 @@ async def userbot_kang(_, message: Message):
         await m.delete()
         await m.delete()
 
 
 
 
-@app.on_message(filters.command("kang") & ~filters.edited)
+@app.on_message(filters.command("kang"))
 @capture_err
 @capture_err
 async def kang(client, message: Message):
 async def kang(client, message: Message):
     if not message.reply_to_message:
     if not message.reply_to_message:
         return await message.reply_text("Reply to a sticker/image to kang it.")
         return await message.reply_text("Reply to a sticker/image to kang it.")
     if not message.from_user:
     if not message.from_user:
-        return await message.reply_text(
-            "You are anon admin, kang stickers in my pm."
-        )
+        return await message.reply_text("You are anon admin, kang stickers in my pm.")
     msg = await message.reply_text("Kanging Sticker..")
     msg = await message.reply_text("Kanging Sticker..")
 
 
     # Find the proper emoji
     # Find the proper emoji
     args = message.text.split()
     args = message.text.split()
     if len(args) > 1:
     if len(args) > 1:
         sticker_emoji = str(args[1])
         sticker_emoji = str(args[1])
-    elif (
-            message.reply_to_message.sticker
-            and message.reply_to_message.sticker.emoji
-    ):
+    elif message.reply_to_message.sticker and message.reply_to_message.sticker.emoji:
         sticker_emoji = message.reply_to_message.sticker.emoji
         sticker_emoji = message.reply_to_message.sticker.emoji
     else:
     else:
         sticker_emoji = "🤔"
         sticker_emoji = "🤔"
@@ -177,13 +172,9 @@ async def kang(client, message: Message):
             temp_file_path = await app.download_media(doc)
             temp_file_path = await app.download_media(doc)
             image_type = imghdr.what(temp_file_path)
             image_type = imghdr.what(temp_file_path)
             if image_type not in SUPPORTED_TYPES:
             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:
             try:
-                temp_file_path = await resize_file_to_sticker_size(
-                    temp_file_path
-                )
+                temp_file_path = await resize_file_to_sticker_size(temp_file_path)
             except OSError as e:
             except OSError as e:
                 await msg.edit_text("Something wrong happened.")
                 await msg.edit_text("Something wrong happened.")
                 raise Exception(
                 raise Exception(
@@ -229,12 +220,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

+ 2 - 5
wbb/modules/sudo.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -27,7 +27,6 @@ from pyrogram.types import Message
 from wbb import BOT_ID, SUDOERS, USERBOT_PREFIX, app2, eor
 from wbb import BOT_ID, SUDOERS, USERBOT_PREFIX, app2, eor
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.errors import capture_err
 from wbb.utils.dbfunctions import add_sudo, get_sudoers, remove_sudo
 from wbb.utils.dbfunctions import add_sudo, get_sudoers, remove_sudo
-from wbb.utils.functions import restart
 
 
 __MODULE__ = "Sudo"
 __MODULE__ = "Sudo"
 __HELP__ = """
 __HELP__ = """
@@ -60,9 +59,7 @@ async def useradd(_, message: Message):
     if user_id in sudoers:
     if user_id in sudoers:
         return await eor(message, text=f"{umention} is already in sudoers.")
         return await eor(message, text=f"{umention} is already in sudoers.")
     if user_id == BOT_ID:
     if user_id == BOT_ID:
-        return await eor(
-            message, text="You can't add assistant bot in sudoers."
-        )
+        return await eor(message, text="You can't add assistant bot in sudoers.")
 
 
     await add_sudo(user_id)
     await add_sudo(user_id)
 
 

+ 9 - 11
wbb/modules/sudoers.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -92,7 +92,7 @@ DISK: {disk}%
 # Gban
 # Gban
 
 
 
 
-@app.on_message(filters.command("gban") & SUDOERS & ~filters.edited)
+@app.on_message(filters.command("gban") & SUDOERS)
 @capture_err
 @capture_err
 async def ban_globally(_, message):
 async def ban_globally(_, message):
     user_id, reason = await extract_user_and_reason(message)
     user_id, reason = await extract_user_and_reason(message)
@@ -120,7 +120,7 @@ async def ban_globally(_, message):
             number_of_chats += 1
             number_of_chats += 1
             await asyncio.sleep(1)
             await asyncio.sleep(1)
         except FloodWait as e:
         except FloodWait as e:
-            await asyncio.sleep(int(e.x))
+            await asyncio.sleep(int(e.value))
         except Exception:
         except Exception:
             pass
             pass
     try:
     try:
@@ -152,14 +152,14 @@ __**New Global Ban**__
         )
         )
     except Exception:
     except Exception:
         await message.reply_text(
         await message.reply_text(
-            "User Gbanned, But This Gban Action Wasn't Logged, Add Me Bot In GBAN_LOG_GROUP"
+            "User Gbanned, But This Gban Action Wasn't Logged, Add Me In GBAN_LOG_GROUP"
         )
         )
 
 
 
 
 # Ungban
 # Ungban
 
 
 
 
-@app.on_message(filters.command("ungban") & SUDOERS & ~filters.edited)
+@app.on_message(filters.command("ungban") & SUDOERS)
 @capture_err
 @capture_err
 async def unban_globally(_, message):
 async def unban_globally(_, message):
     user_id = await extract_user(message)
     user_id = await extract_user(message)
@@ -178,7 +178,7 @@ async def unban_globally(_, message):
 # Broadcast
 # Broadcast
 
 
 
 
-@app.on_message(filters.command("broadcast") & SUDOERS & ~filters.edited)
+@app.on_message(filters.command("broadcast") & SUDOERS)
 @capture_err
 @capture_err
 async def broadcast_message(_, message):
 async def broadcast_message(_, message):
     if len(message.command) < 2:
     if len(message.command) < 2:
@@ -197,7 +197,7 @@ async def broadcast_message(_, message):
             await asyncio.sleep(sleep_time)
             await asyncio.sleep(sleep_time)
             sent += 1
             sent += 1
         except FloodWait as e:
         except FloodWait as e:
-            await asyncio.sleep(int(e.x))
+            await asyncio.sleep(int(e.value))
         except Exception:
         except Exception:
             pass
             pass
     await m.edit(f"**Broadcasted Message In {sent} Chats.**")
     await m.edit(f"**Broadcasted Message In {sent} Chats.**")
@@ -206,7 +206,7 @@ async def broadcast_message(_, message):
 # Update
 # Update
 
 
 
 
-@app.on_message(filters.command("update") & SUDOERS & ~filters.edited)
+@app.on_message(filters.command("update") & SUDOERS)
 async def update_restart(_, message):
 async def update_restart(_, message):
     try:
     try:
         out = subprocess.check_output(["git", "pull"]).decode("UTF-8")
         out = subprocess.check_output(["git", "pull"]).decode("UTF-8")
@@ -215,7 +215,5 @@ async def update_restart(_, message):
         await message.reply_text(f"```{out}```")
         await message.reply_text(f"```{out}```")
     except Exception as e:
     except Exception as e:
         return await message.reply_text(str(e))
         return await message.reply_text(str(e))
-    m = await message.reply_text(
-        "**Updated with default branch, restarting now.**"
-    )
+    m = await message.reply_text("**Updated with default branch, restarting now.**")
     await restart(m)
     await restart(m)

+ 4 - 13
wbb/modules/taglogger.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -70,10 +70,7 @@ async def sendLog(message: Message):
 
 
 
 
 @app2.on_message(
 @app2.on_message(
-    ~filters.me
-    & ~filters.chat([LOG_GROUP_ID, BOT_ID])
-    & ~filters.private
-    & ~filters.edited,
+    ~filters.me & ~filters.chat([LOG_GROUP_ID, BOT_ID]) & ~filters.private,
     group=taglog_group,
     group=taglog_group,
 )
 )
 @capture_err
 @capture_err
@@ -84,9 +81,7 @@ async def tagLoggerFunc(_, message: Message):
         return
         return
     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 (
-                reply_message.from_user.id == USERBOT_ID
-        ):
+        if reply_message.from_user and (reply_message.from_user.id == USERBOT_ID):
             return await sendLog(message)
             return await sendLog(message)
 
 
     if message.text:
     if message.text:
@@ -95,9 +90,5 @@ async def tagLoggerFunc(_, message: Message):
         text = message.caption
         text = message.caption
     else:
     else:
         return
         return
-    if (
-            str(USERBOT_ID) in text
-            or str(USERBOT_USERNAME) in text
-            or USERBOT_NAME in text
-    ):
+    if str(USERBOT_ID) in text or str(USERBOT_USERNAME) in text or USERBOT_NAME in text:
         await sendLog(message)
         await sendLog(message)

+ 1 - 1
wbb/modules/telegraph.py

@@ -8,7 +8,7 @@ __MODULE__ = "Telegraph"
 __HELP__ = "/telegraph [Page name]: Paste styled text on telegraph."
 __HELP__ = "/telegraph [Page name]: Paste styled text on telegraph."
 
 
 
 
-@app.on_message(filters.command("telegraph") & ~filters.edited)
+@app.on_message(filters.command("telegraph"))
 @capture_err
 @capture_err
 async def paste(_, message: Message):
 async def paste(_, message: Message):
     reply = message.reply_to_message
     reply = message.reply_to_message

+ 2 - 2
wbb/modules/tts.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -43,7 +43,7 @@ def convert(text):
     return audio
     return audio
 
 
 
 
-@app.on_message(filters.command("tts") & ~filters.edited)
+@app.on_message(filters.command("tts"))
 async def text_to_speech(_, message: Message):
 async def text_to_speech(_, message: Message):
     if not message.reply_to_message:
     if not message.reply_to_message:
         return await message.reply_text("Reply to some text ffs.")
         return await message.reply_text("Reply to some text ffs.")

+ 13 - 24
wbb/modules/userbot.py

@@ -10,18 +10,15 @@ import re
 import subprocess
 import subprocess
 import sys
 import sys
 import traceback
 import traceback
-from asyncio import sleep
 from html import escape
 from html import escape
 from io import StringIO
 from io import StringIO
-from time import time
 
 
 from pyrogram import filters
 from pyrogram import filters
 from pyrogram.errors import MessageNotModified
 from pyrogram.errors import MessageNotModified
 from pyrogram.types import Message, ReplyKeyboardMarkup
 from pyrogram.types import Message, ReplyKeyboardMarkup
 
 
 from wbb import app2  # don't remove
 from wbb import app2  # don't remove
-from wbb import SUDOERS, USERBOT_PREFIX, app, arq, eor
-from wbb.core.keyboard import ikb
+from wbb import SUDOERS, USERBOT_PREFIX, eor
 from wbb.core.tasks import add_task, rm_task
 from wbb.core.tasks import add_task, rm_task
 
 
 # Eval and Sh module from nana-remix
 # Eval and Sh module from nana-remix
@@ -41,19 +38,18 @@ async def aexec(code, client, message):
 
 
 
 
 async def iter_edit(message: Message, text: str):
 async def iter_edit(message: Message, text: str):
-    async for m in app2.iter_history(message.chat.id):
-
+    async for m in app2.get_chat_history(message.chat.id):
         # If no replies found, reply
         # If no replies found, reply
-        if m.message_id == message.message_id:
+        if m.id == message.id:
             return 0
             return 0
 
 
         if not m.from_user or not m.text or not m.reply_to_message:
         if not m.from_user or not m.text or not m.reply_to_message:
             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.id == 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)
@@ -74,7 +70,7 @@ async def executor(client, message: Message):
     except IndexError:
     except IndexError:
         return await message.delete()
         return await message.delete()
 
 
-    if message.chat.type == "channel":
+    if message.chat.type == ChatType.CHANNEL:
         return
         return
 
 
     m = message
     m = message
@@ -149,7 +145,7 @@ async def executor(client, message: Message):
             return await message.reply(final_output, quote=True)
             return await message.reply(final_output, quote=True)
         return
         return
     if not status.from_user:
     if not status.from_user:
-        status = await app2.get_messages(status.chat.id, status.message_id)
+        status = await app2.get_messages(status.chat.id, status.id)
     await eor(status, text=final_output, quote=True)
     await eor(status, text=final_output, quote=True)
 
 
 
 
@@ -157,7 +153,6 @@ async def executor(client, message: Message):
     SUDOERS
     SUDOERS
     & ~filters.forwarded
     & ~filters.forwarded
     & ~filters.via_bot
     & ~filters.via_bot
-    & ~filters.edited
     & filters.command("sh", prefixes=USERBOT_PREFIX),
     & filters.command("sh", prefixes=USERBOT_PREFIX),
 )
 )
 async def shellrunner(_, message: Message):
 async def shellrunner(_, message: Message):
@@ -167,8 +162,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!")
 
 
@@ -220,7 +215,7 @@ async def shellrunner(_, message: Message):
             await app2.send_document(
             await app2.send_document(
                 message.chat.id,
                 message.chat.id,
                 "output.txt",
                 "output.txt",
-                reply_to_message_id=message.message_id,
+                reply_to_message_id=message.id,
                 caption=escape(text),
                 caption=escape(text),
             )
             )
             return os.remove("output.txt")
             return os.remove("output.txt")
@@ -235,11 +230,7 @@ async def shellrunner(_, message: Message):
         )
         )
 
 
 
 
-@app2.on_message(
-    SUDOERS
-    & filters.command("reserve", prefixes=USERBOT_PREFIX)
-    & ~filters.edited
-)
+@app2.on_message(SUDOERS & filters.command("reserve", prefixes=USERBOT_PREFIX))
 async def reserve_channel_handler(_, message: Message):
 async def reserve_channel_handler(_, message: Message):
     if len(message.text.split()) != 2:
     if len(message.text.split()) != 2:
         return await eor(message, text="Pass a username as argument!!")
         return await eor(message, text="Pass a username as argument!!")
@@ -248,9 +239,7 @@ async def reserve_channel_handler(_, message: Message):
 
 
     m = await eor(message, text="Reserving...")
     m = await eor(message, text="Reserving...")
 
 
-    chat = await app2.create_channel(
-        username, "Created by .reserve command"
-    )
+    chat = await app2.create_channel(username, "Created by .reserve command")
     try:
     try:
         await app2.update_chat_username(chat.id, username)
         await app2.update_chat_username(chat.id, username)
     except Exception as e:
     except Exception as e:

+ 3 - 5
wbb/modules/webss.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -57,7 +57,7 @@ async def take_screenshot(url: str, full: bool = False):
 
 
 
 
 @app2.on_message(filters.command("webss", USERBOT_PREFIX) & SUDOERS)
 @app2.on_message(filters.command("webss", USERBOT_PREFIX) & SUDOERS)
-@app.on_message(filters.command("webss") & ~filters.edited)
+@app.on_message(filters.command("webss"))
 @capture_err
 @capture_err
 async def take_ss(_, message: Message):
 async def take_ss(_, message: Message):
     if len(message.command) < 2:
     if len(message.command) < 2:
@@ -89,9 +89,7 @@ async def take_ss(_, message: Message):
         if not full:
         if not full:
             # Full size images have problem with reply_photo, that's why
             # 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
             # we need to only use reply_photo if we're not using full size
-            await gather(
-                *[message.reply_document(photo), message.reply_photo(photo)]
-            )
+            await gather(*[message.reply_document(photo), message.reply_photo(photo)])
         else:
         else:
             await message.reply_document(photo)
             await message.reply_document(photo)
         await m.delete()
         await m.delete()

+ 1 - 1
wbb/utils/__init__.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal

+ 5 - 4
wbb/utils/constants.py

@@ -1,6 +1,7 @@
 # New file
 # New file
 
 
-from pyrogram.filters import command, edited
+from pyrogram.enums import ChatType, ParseMode
+from pyrogram.filters import command
 from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
 from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
 
 
 from wbb import BOT_USERNAME, app
 from wbb import BOT_USERNAME, app
@@ -39,7 +40,7 @@ NOTE: Fillings only works in greetings module.
 """
 """
 
 
 
 
-@app.on_message(command("markdownhelp") & ~edited)
+@app.on_message(command("markdownhelp"))
 async def mkdwnhelp(_, m: Message):
 async def mkdwnhelp(_, m: Message):
     keyb = InlineKeyboardMarkup(
     keyb = InlineKeyboardMarkup(
         [
         [
@@ -51,13 +52,13 @@ async def mkdwnhelp(_, m: Message):
             ]
             ]
         ]
         ]
     )
     )
-    if m.chat.type != "private":
+    if m.chat.type != ChatType.PRIVATE:
         await m.reply(
         await m.reply(
             "Click on the below button to get markdown usage syntax in pm!",
             "Click on the below button to get markdown usage syntax in pm!",
             reply_markup=keyb,
             reply_markup=keyb,
         )
         )
     else:
     else:
         await m.reply(
         await m.reply(
-            MARKDOWN, parse_mode="html", disable_web_page_preview=True
+            MARKDOWN, parse_mode=ParseMode.HTML, disable_web_page_preview=True
         )
         )
     return
     return

+ 8 - 13
wbb/utils/dbfunctions.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -24,7 +24,6 @@ SOFTWARE.
 import codecs
 import codecs
 import pickle
 import pickle
 from string import ascii_lowercase
 from string import ascii_lowercase
-
 from typing import Dict, List, Union
 from typing import Dict, List, Union
 
 
 from wbb import db
 from wbb import db
@@ -594,10 +593,7 @@ async def deactivate_pipe(from_chat_id: int, to_chat_id: int):
     if not pipes:
     if not pipes:
         return
         return
     for pipe in pipes:
     for pipe in pipes:
-        if (
-                pipe["from_chat_id"] == from_chat_id
-                and pipe["to_chat_id"] == to_chat_id
-        ):
+        if pipe["from_chat_id"] == from_chat_id and pipe["to_chat_id"] == to_chat_id:
             pipes.remove(pipe)
             pipes.remove(pipe)
     return await pipesdb.update_one(
     return await pipesdb.update_one(
         {"pipe": "pipe"}, {"$set": {"pipes": pipes}}, upsert=True
         {"pipe": "pipe"}, {"$set": {"pipes": pipes}}, upsert=True
@@ -606,10 +602,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:
 async def is_pipe_active(from_chat_id: int, to_chat_id: int) -> bool:
     for pipe in await show_pipes():
     for pipe in await show_pipes():
-        if (
-                pipe["from_chat_id"] == from_chat_id
-                and pipe["to_chat_id"] == to_chat_id
-        ):
+        if pipe["from_chat_id"] == from_chat_id and pipe["to_chat_id"] == to_chat_id:
             return True
             return True
 
 
 
 
@@ -753,9 +746,11 @@ async def get_rss_feeds_count() -> int:
 
 
 
 
 async def check_chatbot():
 async def check_chatbot():
-    return (
-        await chatbotdb.find_one({"chatbot": "chatbot"}) or {"bot": [], "userbot": []}
-    )
+    return await chatbotdb.find_one({"chatbot": "chatbot"}) or {
+        "bot": [],
+        "userbot": [],
+    }
+
 
 
 async def add_chatbot(chat_id: int, is_userbot: bool = False):
 async def add_chatbot(chat_id: int, is_userbot: bool = False):
     list_id = await check_chatbot()
     list_id = await check_chatbot()

+ 7 - 7
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]
 
 
@@ -31,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

+ 4 - 5
wbb/utils/files.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -59,14 +59,13 @@ 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)
-                          or "application/zip",
+                mime_type=client.guess_mime_type(file_path) or "application/zip",
                 file=await client.save_file(file_path),
                 file=await client.save_file(file_path),
                 attributes=[
                 attributes=[
                     raw.types.DocumentAttributeFilename(
                     raw.types.DocumentAttributeFilename(
@@ -84,7 +83,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(

+ 1 - 1
wbb/utils/filter_groups.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
wbb/utils/formatter.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal

+ 12 - 11
wbb/utils/functions.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -34,6 +34,7 @@ from sys import executable
 import aiofiles
 import aiofiles
 import speedtest
 import speedtest
 from PIL import Image, ImageDraw, ImageFilter, ImageFont
 from PIL import Image, ImageDraw, ImageFilter, ImageFont
+from pyrogram.enums import MessageEntityType
 from pyrogram.types import Message
 from pyrogram.types import Message
 
 
 from wbb import aiohttpsession as aiosession
 from wbb import aiohttpsession as aiosession
@@ -43,7 +44,7 @@ from wbb.utils.http import get, post
 
 
 async def restart(m: Message):
 async def restart(m: Message):
     if m:
     if m:
-        await start_restart_stage(m.chat.id, m.message_id)
+        await start_restart_stage(m.chat.id, m.id)
     execvp(executable, [executable, "-m", "wbb"])
     execvp(executable, [executable, "-m", "wbb"])
 
 
 
 
@@ -94,7 +95,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:
@@ -199,9 +200,9 @@ async def extract_userid(message, text: str):
     if len(entities) < 2:
     if len(entities) < 2:
         return (await app.get_users(text)).id
         return (await app.get_users(text)).id
     entity = entities[1]
     entity = entities[1]
-    if entity.type == "mention":
+    if entity.type == MessageEntityType.MENTION:
         return (await app.get_users(text)).id
         return (await app.get_users(text)).id
-    if entity.type == "text_mention":
+    if entity.type == MessageEntityType.TEXT_MENTION:
         return entity.user.id
         return entity.user.id
     return None
     return None
 
 
@@ -216,9 +217,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 +251,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:

+ 1 - 1
wbb/utils/http.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal

+ 34 - 52
wbb/utils/inlinefuncs.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -34,7 +34,7 @@ from fuzzysearch import find_near_matches
 from motor import version as mongover
 from motor import version as mongover
 from pykeyboard import InlineKeyboard
 from pykeyboard import InlineKeyboard
 from pyrogram import __version__ as pyrover
 from pyrogram import __version__ as pyrover
-from pyrogram import filters
+from pyrogram import enums, filters
 from pyrogram.raw.functions import Ping
 from pyrogram.raw.functions import Ping
 from pyrogram.types import (
 from pyrogram.types import (
     CallbackQuery,
     CallbackQuery,
@@ -122,9 +122,7 @@ async def alive_function(answers):
     ubot_state = "Dead" if not await app2.get_me() else "Alive"
     ubot_state = "Dead" if not await app2.get_me() else "Alive"
     buttons.add(
     buttons.add(
         InlineKeyboardButton("Stats", callback_data="stats_callback"),
         InlineKeyboardButton("Stats", callback_data="stats_callback"),
-        InlineKeyboardButton(
-            "Go Inline!", switch_inline_query_current_chat=""
-        ),
+        InlineKeyboardButton("Go Inline!", switch_inline_query_current_chat=""),
     )
     )
 
 
     msg = f"""
     msg = f"""
@@ -180,9 +178,7 @@ __**Translated from {result.src} to {result.dest}**__
             ),
             ),
             InlineQueryResultArticle(
             InlineQueryResultArticle(
                 title=result.translatedText,
                 title=result.translatedText,
-                input_message_content=InputTextMessageContent(
-                    result.translatedText
-                ),
+                input_message_content=InputTextMessageContent(result.translatedText),
             ),
             ),
         ]
         ]
     )
     )
@@ -331,9 +327,7 @@ async def youtube_func(answers, text):
 **Duration:** {i.duration}
 **Duration:** {i.duration}
 **Uploaded:** {i.publish_time}
 **Uploaded:** {i.publish_time}
 **Description:** {i.long_desc}"""
 **Description:** {i.long_desc}"""
-        description = (
-            f"{i.views} | {i.channel} | {i.duration} | {i.publish_time}"
-        )
+        description = f"{i.views} | {i.channel} | {i.duration} | {i.publish_time}"
         answers.append(
         answers.append(
             InlineQueryResultArticle(
             InlineQueryResultArticle(
                 title=i.title,
                 title=i.title,
@@ -349,27 +343,27 @@ async def youtube_func(answers, text):
 
 
 
 
 async def lyrics_func(answers, text):
 async def lyrics_func(answers, text):
-    resp = await arq.lyrics(text)                                    
-    if not resp.ok:                                     
+    resp = await arq.lyrics(text)
+    if not resp.ok:
         answers.append(
         answers.append(
-            InlineQueryResultArticle(                                         
-                title="Error",                 
+            InlineQueryResultArticle(
+                title="Error",
                 description=resp.result,
                 description=resp.result,
                 input_message_content=InputTextMessageContent(resp.result),
                 input_message_content=InputTextMessageContent(resp.result),
-            )                                                           
-        )                                                                  
-        return answers                                                
-    songs = resp.result                                                      
-    for song in songs:                                                       
-        song_name = song['song']
-        artist = song['artist']
-        lyrics = song['lyrics']
+            )
+        )
+        return answers
+    songs = resp.result
+    for song in songs:
+        song_name = song["song"]
+        artist = song["artist"]
+        lyrics = song["lyrics"]
         msg = f"**{song_name}** | **{artist}**\n\n__{lyrics}__"
         msg = f"**{song_name}** | **{artist}**\n\n__{lyrics}__"
-          
+
         if len(msg) > 4095:
         if len(msg) > 4095:
             msg = await paste(msg)
             msg = await paste(msg)
             msg = f"**LYRICS_TOO_LONG:** [URL]({msg})"
             msg = f"**LYRICS_TOO_LONG:** [URL]({msg})"
-                            
+
         answers.append(
         answers.append(
             InlineQueryResultArticle(
             InlineQueryResultArticle(
                 title=song_name,
                 title=song_name,
@@ -416,9 +410,7 @@ async def tg_search_func(answers, text, user_id):
             ),
             ),
         )
         )
         name = (
         name = (
-            message.from_user.first_name
-            if message.from_user.first_name
-            else "NO NAME"
+            message.from_user.first_name if message.from_user.first_name else "NO NAME"
         )
         )
         caption = f"""
         caption = f"""
 **Query:** {text}
 **Query:** {text}
@@ -448,7 +440,7 @@ async def music_inline_func(answers, query):
         messages = [
         messages = [
             m
             m
             async for m in app2.search_messages(
             async for m in app2.search_messages(
-                chat_id, query, filter="audio", limit=100
+                chat_id, query, filter=enums.MessagesFilter.AUDIO, limit=100
             )
             )
         ]
         ]
     except Exception as e:
     except Exception as e:
@@ -468,14 +460,12 @@ async def music_inline_func(answers, query):
     for f_ in messages:
     for f_ in messages:
         messages_ids_and_duration.append(
         messages_ids_and_duration.append(
             {
             {
-                "message_id": f_.message_id,
+                "message_id": f_.id,
                 "duration": f_.audio.duration if f_.audio.duration else 0,
                 "duration": f_.audio.duration if f_.audio.duration else 0,
             }
             }
         )
         )
-    messages = list(
-        {v["duration"]: v for v in messages_ids_and_duration}.values()
-    )
-    messages_ids = [ff_["message_id"] for ff_ in messages]
+    messages = list({v["duration"]: v for v in messages_ids_and_duration}.values())
+    messages_ids = [ff_.id for ff_ in messages]
     messages = await app.get_messages(chat_id, messages_ids[0:48])
     messages = await app.get_messages(chat_id, messages_ids[0:48])
     return [
     return [
         InlineQueryResultCachedDocument(
         InlineQueryResultCachedDocument(
@@ -529,9 +519,7 @@ async def speedtest_init(query):
         return answers
         return answers
     msg = "**Click The Button Below To Perform A Speedtest**"
     msg = "**Click The Button Below To Perform A Speedtest**"
     button = InlineKeyboard(row_width=1)
     button = InlineKeyboard(row_width=1)
-    button.add(
-        InlineKeyboardButton(text="Test", callback_data="test_speedtest")
-    )
+    button.add(InlineKeyboardButton(text="Test", callback_data="test_speedtest"))
     answers.append(
     answers.append(
         InlineQueryResultArticle(
         InlineQueryResultArticle(
             title="Click Here",
             title="Click Here",
@@ -577,9 +565,7 @@ async def pmpermit_func(answers, user_id, victim):
             text="For promotion",
             text="For promotion",
             callback_data="pmpermit to_scam_you a",
             callback_data="pmpermit to_scam_you a",
         ),
         ),
-        InlineKeyboardButton(
-            text="Approve me", callback_data="pmpermit approve_me a"
-        ),
+        InlineKeyboardButton(text="Approve me", callback_data="pmpermit approve_me a"),
         InlineKeyboardButton(
         InlineKeyboardButton(
             text="Approve", callback_data=f"pmpermit approve {victim}"
             text="Approve", callback_data=f"pmpermit approve {victim}"
         ),
         ),
@@ -715,9 +701,7 @@ async def tmdb_func(answers, query):
         )
         )
         answers.append(
         answers.append(
             InlineQueryResultPhoto(
             InlineQueryResultPhoto(
-                photo_url=result.backdrop
-                if result.backdrop
-                else result.poster,
+                photo_url=result.backdrop if result.backdrop else result.poster,
                 caption=caption,
                 caption=caption,
                 title=result.title,
                 title=result.title,
                 description=f"{genre} • {result.releaseDate} • {result.rating} • {description}",
                 description=f"{genre} • {result.releaseDate} • {result.rating} • {description}",
@@ -765,12 +749,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,
@@ -801,9 +785,7 @@ async def execute_code(query):
             answers.append(
             answers.append(
                 InlineQueryResultArticle(
                 InlineQueryResultArticle(
                     title="Error",
                     title="Error",
-                    input_message_content=InputTextMessageContent(
-                        response.result
-                    ),
+                    input_message_content=InputTextMessageContent(response.result),
                 )
                 )
             )
             )
         else:
         else:

+ 1 - 1
wbb/utils/json_prettify.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal

+ 17 - 22
wbb/utils/misc.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -87,27 +87,22 @@ 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[
-                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),
-                        ),
-                    )
-                ]
+        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),
+                ),
+            )
+        ]
 
 
     return pairs
     return pairs
 
 

+ 1 - 1
wbb/utils/pastebin.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
wbb/utils/read_lines.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal

+ 3 - 1
wbb/utils/rss.py

@@ -16,7 +16,9 @@ class Feed:
         self.summary = entry.get("summary") or ""
         self.summary = entry.get("summary") or ""
 
 
     def parsed(self):
     def parsed(self):
-        text = f"**Title:** [{self.title.strip()}]({self.link or 'https://google.com'})\n"
+        text = (
+            f"**Title:** [{self.title.strip()}]({self.link or 'https://google.com'})\n"
+        )
         if self.author:
         if self.author:
             text += f"**Author:** {self.author}\n"
             text += f"**Author:** {self.author}\n"
         if self.published:
         if self.published:

+ 14 - 14
wbb/utils/stickerset.py

@@ -1,7 +1,7 @@
 """
 """
 MIT License
 MIT License
 
 
-Copyright (c) 2021 TheHamkerCat
+Copyright (c) 2023 TheHamkerCat
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal
@@ -27,10 +27,10 @@ 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.invoke(
             raw.functions.messages.GetStickerSet(
             raw.functions.messages.GetStickerSet(
                 stickerset=raw.types.InputStickerSetShortName(short_name=name),
                 stickerset=raw.types.InputStickerSetShortName(short_name=name),
                 hash=0,
                 hash=0,
@@ -46,13 +46,13 @@ 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.invoke(
         raw.functions.stickers.CreateStickerSet(
         raw.functions.stickers.CreateStickerSet(
             user_id=await client.resolve_peer(owner),
             user_id=await client.resolve_peer(owner),
             title=title,
             title=title,
@@ -63,11 +63,11 @@ 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.invoke(
         raw.functions.stickers.AddStickerToSet(
         raw.functions.stickers.AddStickerToSet(
             stickerset=raw.types.InputStickerSetShortName(
             stickerset=raw.types.InputStickerSetShortName(
                 short_name=stickerset.set.short_name
                 short_name=stickerset.set.short_name
@@ -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)