Просмотр исходного кода

Merge pull request #18 from thehamkercat/fixes-and-admin

Fixes and admin
Akshay Rajput 5 лет назад
Родитель
Сommit
0684ddfb48

+ 3 - 1
.gitignore

@@ -2,7 +2,7 @@
 __pycache__/
 __pycache__/
 *.py[cod]
 *.py[cod]
 *$py.class
 *$py.class
-
+.
 # C extensions
 # C extensions
 *.so
 *.so
 
 
@@ -134,3 +134,5 @@ dmypy.json
 #others
 #others
 neofetch.txt
 neofetch.txt
 error.log
 error.log
+permissions.json
+.vscode

+ 3 - 4
wbb/__init__.py

@@ -1,7 +1,7 @@
-from pyrogram import Client
-from configparser import ConfigParser
 import logging
 import logging
 import time
 import time
+from configparser import ConfigParser
+from pyrogram import Client
 
 
 
 
 f = open("error.log", "w")
 f = open("error.log", "w")
@@ -10,8 +10,7 @@ f.write("PEAK OF LOG FILE")
 LOG_FORMAT = (
 LOG_FORMAT = (
     '''
     '''
     [%(asctime)s.%(msecs)03d] %(filename)s:%(lineno)s
     [%(asctime)s.%(msecs)03d] %(filename)s:%(lineno)s
-    %(levelname)s: %(message)s'''
-    )
+    %(levelname)s: %(message)s''')
 
 
 logging.basicConfig(
 logging.basicConfig(
     level=logging.INFO,
     level=logging.INFO,

+ 9 - 10
wbb/__main__.py

@@ -5,10 +5,11 @@ import importlib
 from pyrogram import filters, idle
 from pyrogram import filters, idle
 from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
 from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
 from wbb import app, MOD_NOLOAD
 from wbb import app, MOD_NOLOAD
-from wbb.utils import random_line, get_info, paginate_modules, cust_filter
-from wbb.utils import botinfo
+from wbb.utils import get_info, paginate_modules, cust_filter
+from wbb.utils import botinfo, formatter
 from wbb.modules import ALL_MODULES
 from wbb.modules import ALL_MODULES
-
+import time
+from wbb import bot_start_time
 
 
 loop = asyncio.get_event_loop()
 loop = asyncio.get_event_loop()
 
 
@@ -19,7 +20,6 @@ HELPABLE = {}
 async def start_bot():
 async def start_bot():
     await app.start()
     await app.start()
     await get_info(app)
     await get_info(app)
-    from wbb.utils import botinfo
 
 
     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)
@@ -58,10 +58,10 @@ async def start_bot():
 
 
 @app.on_message(cust_filter.command("start"))
 @app.on_message(cust_filter.command("start"))
 async def start(client, message):
 async def start(client, message):
-    if message.chat.type != "private":
-        await message.reply_text((await random_line("wbb/utils/start.txt")))
-        return
-    await message.reply("Hi, try /help")
+    bot_uptime = int(time.time() - bot_start_time)
+    await message.reply_text(
+        f"Already Online Since {formatter.get_readable_time((bot_uptime))},"
+        " Maybe Try /help")
 
 
 
 
 @app.on_message(cust_filter.command("help"))
 @app.on_message(cust_filter.command("help"))
@@ -89,8 +89,7 @@ async def help_command(_, message):
     await message.reply(
     await message.reply(
         text,
         text,
         reply_markup=keyboard,
         reply_markup=keyboard,
-        disable_web_page_preview=True
-        )
+        disable_web_page_preview=True)
 
 
 
 
 async def help_parser(message, keyboard=None):
 async def help_parser(message, keyboard=None):

+ 205 - 38
wbb/modules/admin.py

@@ -1,50 +1,217 @@
-import asyncio
+from wbb import OWNER_ID, SUDO_USER_ID, app
 from wbb.utils import cust_filter
 from wbb.utils import cust_filter
-from wbb import app
-from wbb.utils.is_admin import is_admin
-
+from pyrogram.types import Message
 
 
 __MODULE__ = "Admin"
 __MODULE__ = "Admin"
-__HELP__ = '''
-/purge - Purge Messages [Limit = 100]
+__HELP__ = "/purge - Purge Messages\n" \
+           "/kick - Kick A User\n" \
+           "/ban - Ban A User\n" \
+           "/unban - Unban A User"
+
+SUDO = [OWNER_ID, SUDO_USER_ID]
+
+# Get List Of Admins In A Chat
+
+
+async def list_admins(group_id):
+    list_of_admins = []
+    async for member in app.iter_chat_members(
+            group_id, filter="administrators"):
+        list_of_admins.append(member.user.id)
+    return list_of_admins
 
 
-'''
+# Get List Of Members In A Chat
+
+
+async def list_members(group_id):
+    list_of_members = []
+    async for member in app.iter_chat_members(group_id):
+        list_of_members.append(member.user.id)
+    return list_of_members
+
+# Purge Messages
 
 
 
 
 @app.on_message(cust_filter.command(commands=("purge")))
 @app.on_message(cust_filter.command(commands=("purge")))
-async def purge(client, message):
-    app.set_parse_mode("markdown")
+async def purge(client, message: Message):
+    message_ids = []
     if message.chat.type not in (("supergroup", "channel")):
     if message.chat.type not in (("supergroup", "channel")):
         return
         return
-    admin = await is_admin(message)
 
 
-    if not admin:
-        return
+    admins = await list_admins(message.chat.id)
+
+    if message.from_user.id in admins \
+            or message.from_user.id in SUDO:
+
+        chat_id = message.chat.id
+        from_user_id = message.from_user.id
+        if (await app.get_chat_member(chat_id,
+                                      from_user_id)).can_delete_messages \
+                or (await app.get_chat_member(chat_id, from_user_id)).status \
+                == 'creator' \
+                or message.from_user.id in SUDO:
+
+            if message.reply_to_message:
+                for a_s_message_id in range(
+                    message.reply_to_message.message_id,
+                    message.message_id
+                ):
+                    message_ids.append(a_s_message_id)
+                    if len(message_ids) == 100:
+                        await client.delete_messages(
+                            chat_id=message.chat.id,
+                            message_ids=message_ids,
+                            revoke=True
+                        )
+                        message_ids = []
+                if len(message_ids) > 0:
+                    await client.delete_messages(
+                        chat_id=message.chat.id,
+                        message_ids=message_ids,
+                        revoke=True
+                    )
+
+            else:
+                await message.reply_text(
+                    "Reply To A Message To Delete It,"
+                    " Don't Make Fun Of Yourself!")
+
+
+# Kick members
+
+
+@app.on_message(cust_filter.command(commands=("kick")))
+async def kick(client, message: Message):
+    try:
+        username = (message.text.split(None, 2)[1])
+    except IndexError:
+        username = ""
+    if (await app.get_chat_member(
+        message.chat.id, message.from_user.id)).status == 'creator' \
+        or (await app.get_chat_member(
+            message.chat.id, message.from_user.id)).can_restrict_members \
+            is True or message.from_user.id in SUDO:
+
+        if username != "":
+            if username in SUDO or (await app.get_users(username)).id in SUDO:
+                await message.reply_text("You Wanna Kick The Elevated One?")
+            else:
+                if (await app.get_users(username)).id in \
+                        await list_members(message.chat.id):
+                    await message.chat.kick_member(username)
+                    await message.chat.unban_member(username)
+                    await message.reply_text(f"Kicked {username}")
+                else:
+                    await message.reply_text("This user isn't here,"
+                                             " don't bully me!")
+
+        else:
+            if username in SUDO or message.reply_to_message.from_user.id \
+                    in SUDO:
+                await message.reply_text("You Wanna Kick The Elevated One?")
+            else:
+                if message.reply_to_message.from_user.id in \
+                        await list_members(message.chat.id):
+                    id = message.reply_to_message.from_user.id
+                    await message.reply_to_message.chat.kick_member(id)
+                    await message.reply_to_message.chat.unban_member(id)
+                    await message.reply_text(f"Kicked {username}")
+                else:
+                    await message.reply_text("This user isn't here,"
+                                             " don't bully me!")
+
+# Ban members
+
+
+@app.on_message(cust_filter.command(commands=("ban")))
+async def ban(client, message: Message):
+    try:
+        username = (message.text.split(None, 2)[1])
+    except IndexError:
+        username = ""
+    if (await app.get_chat_member(
+        message.chat.id, message.from_user.id)).status == 'creator' \
+        or (await app.get_chat_member(
+            message.chat.id, message.from_user.id)).can_restrict_members \
+            is True or message.from_user.id in SUDO:
+
+        if username != "":
+            if username in SUDO or (await app.get_users(username)).id in SUDO:
+                await message.reply_text("You Wanna Ban The Elevated One?")
+            else:
+                if (await app.get_users(username)).id in \
+                        await list_members(message.chat.id):
+                    await message.chat.kick_member(username)
+                    await message.reply_text(f"Banned {username}")
+                else:
+                    await message.reply_text("This user isn't here,"
+                                             " don't bully me!")
+        else:
+            if username in SUDO or message.reply_to_message.from_user.id \
+                    in SUDO:
+                await message.reply_text("You Wanna Ban The Elevated One?")
+            else:
+                if (await app.get_users(username)).id in \
+                        await list_members(message.chat.id):
+                    id = message.reply_to_message.from_user.id
+                    await message.reply_to_message.chat.kick_member(id)
+                    await message.reply_text(f"Banned {username}")
+                else:
+                    await message.reply_text("This user isn't here,"
+                                             " don't bully me!")
+
+# Unban members
+
+
+@app.on_message(cust_filter.command(commands=("unban")))
+async def unban(client, message: Message):
+    try:
+        username = (message.text.split(None, 2)[1])
+    except IndexError:
+        username = ""
+    if (await app.get_chat_member(
+        message.chat.id, message.from_user.id)).status == 'creator' \
+        or (await app.get_chat_member(
+            message.chat.id, message.from_user.id)).can_restrict_members \
+            is True or message.from_user.id in SUDO:
+
+        if username != "":
+            if (await app.get_users(username)).id not in \
+                    await list_members(message.chat.id):
+                await message.chat.kick_member(username)
+                await message.reply_text(f"Unbanned {username}")
+            else:
+                await message.reply_text("This user is already here,"
+                                         " don't bully me!")
+        else:
+            if (await app.get_users(username)).id not in \
+                    await list_members(message.chat.id):
+                id = message.reply_to_message.from_user.id
+                await message.reply_to_message.chat.kick_member(id)
+                await message.reply_text(f"Unbanned {username}")
+            else:
+                await message.reply_text("This user is already here,"
+                                         " don't bully me!")
+
+# Kick members on their own call
+
+
+@app.on_message(cust_filter.command(commands=("kickme")))
+async def kickme(client, message: Message):
+    if message.from_user.id not in SUDO:
+        await message.chat.kick_member(message.from_user.id)
+        await message.chat.unban_member(message.from_user.id)
+        await message.reply_text("Kicked!, Joke's on you, i'm into that shit")
+    else:
+        await message.reply_text("It doesn't works that way mate.")
+
+# Ban members on their own call
 
 
-    message_ids = []
 
 
-    if message.reply_to_message:
-        for a_s_message_id in range(
-            message.reply_to_message.message_id,
-            message.message_id
-        ):
-            message_ids.append(a_s_message_id)
-            if len(message_ids) == 100:
-                await client.delete_messages(
-                    chat_id=message.chat.id,
-                    message_ids=message_ids,
-                    revoke=True
-                )
-                message_ids = []
-        if len(message_ids) > 0:
-            await client.delete_messages(
-                chat_id=message.chat.id,
-                message_ids=message_ids,
-                revoke=True
-            )
-
-    m = await message.reply_text(
-        "```Purged!```"
-    )
-    await asyncio.sleep(2)
-    await m.delete()
+@app.on_message(cust_filter.command(commands=("banme")))
+async def banme(client, message: Message):
+    if message.from_user.id not in SUDO:
+        await message.chat.kick_member(message.from_user.id)
+        await message.reply_text("Banned!, Joke's on you, I'm into that shit")
+    else:
+        await message.reply_text("It doesn't works that way mate.")

+ 0 - 10
wbb/modules/commit.py

@@ -1,10 +0,0 @@
-from wbb import app
-from wbb.utils import cust_filter, random_line
-
-__MODULE__ = "Commit"
-__HELP__ = "/commit - Generate Funny Commit Messages"
-
-
-@app.on_message(cust_filter.command(commands=("commit")))
-async def commit(client, message):
-    await message.reply_text((await random_line('wbb/utils/commit.txt')))

+ 3 - 6
wbb/modules/greetings.py

@@ -1,15 +1,12 @@
 from wbb import app
 from wbb import app
 from pyrogram import filters, emoji
 from pyrogram import filters, emoji
-import asyncio
-
+from pyrogram.types import Message
 
 
 MESSAGE = "{} Welcome {}!"
 MESSAGE = "{} Welcome {}!"
 
 
 
 
 @app.on_message(filters.new_chat_members)
 @app.on_message(filters.new_chat_members)
-async def welcome(client, message):
+async def welcome(client, message: Message):
     new_members = [i.mention for i in message.new_chat_members]
     new_members = [i.mention for i in message.new_chat_members]
     text = MESSAGE.format(emoji.CROWN, ",  ".join(new_members))
     text = MESSAGE.format(emoji.CROWN, ",  ".join(new_members))
-    m = await message.reply_text(text, disable_web_page_preview=True)
-    await asyncio.sleep(20)
-    await m.delete()
+    await message.reply_text(text, disable_web_page_preview=True)

+ 19 - 14
wbb/modules/images.py

@@ -4,14 +4,22 @@ import urllib.request
 import json
 import json
 from random import randint
 from random import randint
 import requests as r
 import requests as r
+import asyncio
+from pyrogram.types import Message
 
 
 __MODULE__ = "Images"
 __MODULE__ = "Images"
 __HELP__ = "/cat - Get Cute Cats Images\n" + \
 __HELP__ = "/cat - Get Cute Cats Images\n" + \
-           "/dog - Get Cute Dogs Images"
+           "/dog - Get Cute Dogs Images\n" + \
+           "/wall [something] - Get Wallpapers"
+
+
+async def delete_message_with_delay(delay, message: Message):
+    await asyncio.sleep(delay)
+    (message).delete()
 
 
 
 
 @app.on_message(cust_filter.command(commands=("cat")))
 @app.on_message(cust_filter.command(commands=("cat")))
-async def cat(client, message):
+async def cat(client, message: Message):
     with urllib.request.urlopen(
     with urllib.request.urlopen(
         "https://api.thecatapi.com/v1/images/search"
         "https://api.thecatapi.com/v1/images/search"
     ) as url:
     ) as url:
@@ -21,7 +29,7 @@ async def cat(client, message):
 
 
 
 
 @app.on_message(cust_filter.command(commands=("dog")))
 @app.on_message(cust_filter.command(commands=("dog")))
-async def dog(client, message):
+async def dog(client, message: Message):
     with urllib.request.urlopen(
     with urllib.request.urlopen(
         "https://api.thedogapi.com/v1/images/search"
         "https://api.thedogapi.com/v1/images/search"
     ) as url:
     ) as url:
@@ -31,26 +39,23 @@ async def dog(client, message):
 
 
 
 
 @app.on_message(cust_filter.command(commands=("wall")))
 @app.on_message(cust_filter.command(commands=("wall")))
-async def wall(client, message):
+async def wall(client, message: Message):
     app.set_parse_mode("markdown")
     app.set_parse_mode("markdown")
     m = await message.reply_text("Searching!")
     m = await message.reply_text("Searching!")
-    try:
-        term = (message.text.split(None, 1)[1])
-    except IndexError:
-        await m.edit("`\"/wall\" needs a keyword argument`")
-
+    initial_term = (message.text.replace('/wall', ''))
+    term = initial_term.replace(' ', '%20')
     api = "https://wall.alphacoders.com/api2.0/get.php?auth=" + \
     api = "https://wall.alphacoders.com/api2.0/get.php?auth=" + \
         "{}&method=search&term={}".format(WALL_API_KEY, term)
         "{}&method=search&term={}".format(WALL_API_KEY, term)
 
 
     json_rep = r.get(api).json()
     json_rep = r.get(api).json()
     if not json_rep.get("success"):
     if not json_rep.get("success"):
-        await m.edit("FTS! something unusual happened, " +
-                     "report to support @Thepirategang")
+        await m.edit("FTS! something unusual happened, "
+                     + "report to support @Thepirategang")
     else:
     else:
         wallpapers = json_rep.get("wallpapers")
         wallpapers = json_rep.get("wallpapers")
         if not wallpapers:
         if not wallpapers:
-            await m.edit(
-                "Found literally nothing!,You should work on your English.")
+            await m.edit("Found literally nothing!,"
+                         + "You should work on your English.")
             return
             return
         else:
         else:
             index = randint(0, len(wallpapers) - 1)
             index = randint(0, len(wallpapers) - 1)
@@ -58,4 +63,4 @@ async def wall(client, message):
             wallpaper = wallpaper.get("url_image")
             wallpaper = wallpaper.get("url_image")
             wallpaper = wallpaper.replace("\\", "")
             wallpaper = wallpaper.replace("\\", "")
             await message.reply_document(wallpaper)
             await message.reply_document(wallpaper)
-    await m.delete()
+    await delete_message_with_delay(10, m)

+ 57 - 0
wbb/modules/misc.py

@@ -0,0 +1,57 @@
+from wbb import app
+from wbb.utils import cust_filter, random_line
+from pyrogram.types import Message
+
+__MODULE__ = "Misc"
+__HELP__ = "/commit - Generate Funny Commit Messages\n" \
+           "/runs - Idk Test Yourself\n" \
+           "/quote - Get Random Linux Quotes\n" \
+           "/id - Get Chat_ID or User_ID\n" \
+           "/dev - Forward Anything To Developers [SPAM = GBAN]"
+
+
+@app.on_message(cust_filter.command(commands=("commit")))
+async def commit(client, message: Message):
+    await message.reply_text((await random_line('wbb/utils/commit.txt')))
+
+
+@app.on_message(cust_filter.command(commands=("runs")))
+async def runs(client, message: Message):
+    await message.reply_text((await random_line('wbb/utils/runs.txt')))
+
+
+@app.on_message(cust_filter.command(commands=("quote")))
+async def quote(client, message: Message):
+    await message.reply_text((await random_line('wbb/utils/quotes.txt')))
+
+
+@app.on_message(cust_filter.command(commands=("id")))
+async def id(client, message: Message):
+    app.set_parse_mode("markdown")
+    if message.text != '/id':
+        username = message.text.replace('/id', '')
+        id = (await app.get_users(username)).id
+        msg = f"{username}'s ID is `{id}`"
+        await message.reply_text(msg)
+
+    elif message.text == '/id' and not bool(message.reply_to_message):
+        id = message.chat.id
+        msg = f"{message.chat.title}'s ID is `{id}`"
+        await message.reply_text(msg)
+
+    elif message.text == '/id' and bool(message.reply_to_message):
+        id = message.reply_to_message.from_user.id
+        msg = f"{message.reply_to_message.from_user.mention}'s ID is `{id}`"
+        await message.reply_text(msg)
+
+
+@app.on_message(cust_filter.command(commands=("dev")))
+async def dev(client, message: Message):
+    app.set_parse_mode("markdown")
+    await message.reply_to_message.forward('WBBSupport')
+    await app.send_message("WBBSupport",
+                           f"Forwarded By ID: `{message.from_user.id}`")
+    await message.reply_text("Your Message Has Been Forward To Devs,"
+                             + " Any Missuse Of This Feature Will Not"
+                             + " Be Tolerated And You Will Be"
+                             + " Gbanned instantaneously!")

+ 3 - 3
wbb/modules/music.py

@@ -4,6 +4,7 @@ import youtube_dl
 from wbb.utils import cust_filter
 from wbb.utils import cust_filter
 from wbb import app
 from wbb import app
 import os
 import os
+from pyrogram.types import Message
 
 
 __MODULE__ = "Music"
 __MODULE__ = "Music"
 __HELP__ = "/music [link] To Download Music From Various Websites"
 __HELP__ = "/music [link] To Download Music From Various Websites"
@@ -15,15 +16,14 @@ ydl_opts = {
 
 
 
 
 @app.on_message(cust_filter.command(commands=("music")))
 @app.on_message(cust_filter.command(commands=("music")))
-async def music(client, message):
+async def music(client, message: Message):
     await message.reply_chat_action("typing")
     await message.reply_chat_action("typing")
     app.set_parse_mode("html")
     app.set_parse_mode("html")
     try:
     try:
         link = (message.text.split(None, 1)[1])
         link = (message.text.split(None, 1)[1])
     except IndexError:
     except IndexError:
         await message.reply_text(
         await message.reply_text(
-            "<code>\"/music\" needs a keyword argument</code>"
-            )
+            "<code>\"/music\" needs a keyword argument</code>")
 
 
     with youtube_dl.YoutubeDL(ydl_opts) as ydl:
     with youtube_dl.YoutubeDL(ydl_opts) as ydl:
         info_dict = ydl.extract_info(link, download=False)
         info_dict = ydl.extract_info(link, download=False)

+ 5 - 5
wbb/modules/paste.py

@@ -1,6 +1,7 @@
 from wbb.utils import cust_filter, nekobin
 from wbb.utils import cust_filter, nekobin
 from wbb import app
 from wbb import app
 import os
 import os
+from pyrogram.types import Message
 
 
 
 
 __MODULE__ = "Paste"
 __MODULE__ = "Paste"
@@ -8,7 +9,7 @@ __HELP__ = "/paste - To Paste Replied Text Or Document To Neokobin"
 
 
 
 
 @app.on_message(cust_filter.command(commands=("paste")))
 @app.on_message(cust_filter.command(commands=("paste")))
-async def paste(client, message):
+async def paste(client, message: Message):
     if bool(message.reply_to_message) is True:
     if bool(message.reply_to_message) is True:
         app.set_parse_mode("markdown")
         app.set_parse_mode("markdown")
         if bool(message.reply_to_message.text) is True:
         if bool(message.reply_to_message.text) is True:
@@ -29,7 +30,6 @@ async def paste(client, message):
             await m.edit(final_link, disable_web_page_preview=True)
             await m.edit(final_link, disable_web_page_preview=True)
     elif bool(message.reply_to_message) is False:
     elif bool(message.reply_to_message) is False:
         await message.reply_text(
         await message.reply_text(
-            "```Reply To A Message With /paste, Just Hitting /paste " +
-            "Won't Do Anything Other Than Proving Everyone That " +
-            "You Are Obsessed To 'BlueTextMustClickofobia'```"
-            )
+            "Reply To A Message With /paste, Just Hitting /paste "
+            + "Won't Do Anything Other Than Proving Everyone That "
+            + "You Are A Spammer Who Is Obsessed To 'BlueTextMustClickofobia")

+ 2 - 1
wbb/modules/ping.py

@@ -1,13 +1,14 @@
 from wbb import app
 from wbb import app
 from wbb.utils import cust_filter
 from wbb.utils import cust_filter
 import requests
 import requests
+from pyrogram.types import Message
 
 
 __MODULE__ = "Ping"
 __MODULE__ = "Ping"
 __HELP__ = " /ping - To Get Response Time From All TG Datacenters"
 __HELP__ = " /ping - To Get Response Time From All TG Datacenters"
 
 
 
 
 @app.on_message(cust_filter.command(commands=("ping")))
 @app.on_message(cust_filter.command(commands=("ping")))
-async def ping(client, message):
+async def ping(client, message: Message):
     app.set_parse_mode("markdown")
     app.set_parse_mode("markdown")
     m = await message.reply_text("```Wait, Pinging all Datacenters```")
     m = await message.reply_text("```Wait, Pinging all Datacenters```")
     result = ""
     result = ""

+ 0 - 10
wbb/modules/quotes.py

@@ -1,10 +0,0 @@
-from wbb import app
-from wbb.utils import cust_filter, random_line
-
-__MODULE__ = "Quotes"
-__HELP__ = "/quote - Generate Funny Linux Quotes"
-
-
-@app.on_message(cust_filter.command(commands=("quote")))
-async def quotes(client, message):
-    await message.reply_text((await random_line('wbb/utils/quotes.txt')))

+ 7 - 5
wbb/modules/repo.py

@@ -1,14 +1,16 @@
 from wbb import app
 from wbb import app
 from wbb.utils import cust_filter
 from wbb.utils import cust_filter
+from pyrogram.types import Message
 
 
 
 
 __MODULE__ = "Repo"
 __MODULE__ = "Repo"
-__HELP__ = "/repo - To Get My Github Repository Link"
+__HELP__ = "/repo - To Get My Github Repository Link" + \
+           "And Support Group Link"
 
 
 
 
 @app.on_message(cust_filter.command(commands=("repo")))
 @app.on_message(cust_filter.command(commands=("repo")))
-async def repo(client, message):
+async def repo(client, message: Message):
     app.set_parse_mode("markdown")
     app.set_parse_mode("markdown")
-    await message.reply_text('''
-[Github](https://github.com/thehamkercat/WilliamButcherBot)
-''', disable_web_page_preview=True)
+    await message.reply_text(
+        "[Github](https://github.com/thehamkercat/WilliamButcherBot)"
+        + " | [Group](t.me/Thepirategang)", disable_web_page_preview=True)

+ 17 - 11
wbb/modules/rice.py

@@ -1,21 +1,27 @@
 from wbb import app
 from wbb import app
 from wbb.utils import cust_filter
 from wbb.utils import cust_filter
 from pyrogram import filters
 from pyrogram import filters
+from pyrogram.types import Message
 
 
 
 
 __MODULE__ = "Rice"
 __MODULE__ = "Rice"
 __HELP__ = "/rice - To Forward Your Linux Rice To DE_WM's" \
 __HELP__ = "/rice - To Forward Your Linux Rice To DE_WM's" \
-            "Rice Gallery only works in [DE_WM](t.me/de_wm)"
+           "Rice Gallery only works in [DE_WM](t.me/de_wm)"
 
 
 
 
 @app.on_message(filters.chat('DE_WM') & cust_filter.command(commands=("rice")))
 @app.on_message(filters.chat('DE_WM') & cust_filter.command(commands=("rice")))
-async def rice(client, message):
-    app.set_parse_mode("markdown")
-    m = await message.reply_text("```Forwarding!```")
-    id = message.reply_to_message.from_user.id
-    await message.reply_to_message.forward('RiceGallery')
-    await m.edit(
-        f"[Your](tg://user?id={id}) Rice Forwared"
-        " To [Rice Gallery](https://t.me/RiceGallery)",
-        disable_web_page_preview=True
-    )
+async def rice(client, message: Message):
+    if bool(message.reply_to_message) is True:
+        app.set_parse_mode("markdown")
+        id = message.reply_to_message.from_user.id
+        await message.reply_to_message.forward('RiceGallery')
+        await message.reply_text(
+            f"[Your](tg://user?id={id}) Rice Forwared"
+            " To [Rice Gallery](https://t.me/RiceGallery)",
+            disable_web_page_preview=True)
+
+    elif bool(message.reply_to_message) is False:
+        await message.reply_text(
+            "Reply To A Message With /rice, Just Hitting /rice "
+            + "Won't Do Anything Other Than Proving Everyone That "
+            + "You Are A Spammer Who Is Obsessed To 'BlueTextMustClickofobia")

+ 6 - 7
wbb/modules/sudoers.py

@@ -1,6 +1,7 @@
 from wbb.utils import cust_filter, nekobin, formatter
 from wbb.utils import cust_filter, nekobin, formatter
 from wbb import app, OWNER_ID, SUDO_USER_ID, bot_start_time, NEOFETCH
 from wbb import app, OWNER_ID, SUDO_USER_ID, bot_start_time, NEOFETCH
 from pyrogram import filters, types
 from pyrogram import filters, types
+from pyrogram.types import Message
 import re
 import re
 import speedtest
 import speedtest
 import psutil
 import psutil
@@ -21,7 +22,7 @@ SUDOERS = [OWNER_ID, SUDO_USER_ID]
 
 
 
 
 @app.on_message(filters.user(SUDOERS) & cust_filter.command("log"))
 @app.on_message(filters.user(SUDOERS) & cust_filter.command("log"))
-async def logs_chat(client, message):
+async def logs_chat(client, message: Message):
     keyb = types.InlineKeyboardMarkup(
     keyb = types.InlineKeyboardMarkup(
         [
         [
             [
             [
@@ -52,10 +53,8 @@ async def paste_log_neko(client, query):
         keyb = types.InlineKeyboardMarkup(
         keyb = types.InlineKeyboardMarkup(
             [[types.InlineKeyboardButton("Pasted!", url=f"{data}")]]
             [[types.InlineKeyboardButton("Pasted!", url=f"{data}")]]
         )
         )
-        await query.message.edit_caption(
-                                            "Successfully Nekofied",
-                                            reply_markup=keyb
-                                        )
+        await query.message.edit_caption("Successfully Nekofied",
+                                         reply_markup=keyb)
     else:
     else:
         await client.answer_callback_query(
         await client.answer_callback_query(
             query.id, "'Blue Button Must Press', huh?", show_alert=True
             query.id, "'Blue Button Must Press', huh?", show_alert=True
@@ -78,7 +77,7 @@ def speed_convert(size):
 @app.on_message(
 @app.on_message(
     filters.user(SUDOERS) & cust_filter.command(commands=("speedtest"))
     filters.user(SUDOERS) & cust_filter.command(commands=("speedtest"))
 )
 )
-async def speeeed(client, message):
+async def speeeed(client, message: Message):
     app.set_parse_mode("markdown")
     app.set_parse_mode("markdown")
     m = await message.reply_text("```Performing A Speedtest!```")
     m = await message.reply_text("```Performing A Speedtest!```")
     speed = speedtest.Speedtest()
     speed = speedtest.Speedtest()
@@ -97,7 +96,7 @@ Latency  - {round((x["latency"]))} ms
 @ app.on_message(
 @ app.on_message(
     filters.user(SUDOERS) & cust_filter.command(commands=("stats"))
     filters.user(SUDOERS) & cust_filter.command(commands=("stats"))
 )
 )
-async def stats(client, message):
+async def stats(client, message: Message):
     bot_uptime = int(time.time() - bot_start_time)
     bot_uptime = int(time.time() - bot_start_time)
     cpu = psutil.cpu_percent(interval=0.5)
     cpu = psutil.cpu_percent(interval=0.5)
     mem = psutil.virtual_memory().percent
     mem = psutil.virtual_memory().percent

+ 0 - 32
wbb/utils/is_admin.py

@@ -1,32 +0,0 @@
-from pyrogram.types import Message
-
-
-async def is_admin(message: Message) -> bool:
-    if not message.from_user:
-        return False
-
-    if message.chat.type not in ["supergroup", "channel"]:
-        return False
-
-    if message.from_user.id in [
-        777000,  # Telegram Service Notifications
-        1087968824  # GroupAnonymousBot
-    ]:
-        return True
-
-    client = message._client
-    chat_id = message.chat.id
-    user_id = message.from_user.id
-
-    check_status = await client.get_chat_member(
-        chat_id=chat_id,
-        user_id=user_id
-    )
-    admin_strings = [
-        "creator",
-        "administrator"
-    ]
-    if check_status.status not in admin_strings:
-        return False
-    else:
-        return True

+ 1 - 2
wbb/utils/misc.py

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

+ 4 - 1
wbb/utils/start.txt → wbb/utils/runs.txt

@@ -6,7 +6,10 @@ You see, when they’re apart, they’re absolute fuckin’ rubbish … but you
 Sounds good, does it taste like lies? I’ve got your phone linked to my Find Your Shithead Friends app. Now where the fuck are you?
 Sounds good, does it taste like lies? I’ve got your phone linked to my Find Your Shithead Friends app. Now where the fuck are you?
 Shake Shack, huh? Nice try Cunt!
 Shake Shack, huh? Nice try Cunt!
 Well Well Well if it ain't the invisible cunt.
 Well Well Well if it ain't the invisible cunt.
-Why i'm dying to live if i'm living to die?
 Mama ain't raised no bitch, ima speak up when i need to.
 Mama ain't raised no bitch, ima speak up when i need to.
 Not to brag but i don't even need errors to make bad decisions.
 Not to brag but i don't even need errors to make bad decisions.
 What Am I? Friend or Foe? Bot or Hoe?, No one knows!
 What Am I? Friend or Foe? Bot or Hoe?, No one knows!
+Yeah! I was born to run.
+Ok....But, does your code runs?
+Yeah they always say that, but their code never runs!
+Yeah, I'm currently running on debian!