thehamkercat 5 rokov pred
rodič
commit
530237af89

+ 0 - 1
wbb/__init__.py

@@ -72,7 +72,6 @@ async def load_sudoers():
     print("[INFO]: LOADED SUDOERS")
     print("[INFO]: LOADED SUDOERS")
 
 
 
 
-
 loop = asyncio.get_event_loop()
 loop = asyncio.get_event_loop()
 loop.run_until_complete(load_sudoers())
 loop.run_until_complete(load_sudoers())
 
 

+ 1 - 0
wbb/modules/__init__.py

@@ -61,6 +61,7 @@ def __list_all_modules():
 
 
     return all_modules
     return all_modules
 
 
+
 print("[INFO]: IMPORTING MODULES")
 print("[INFO]: IMPORTING MODULES")
 importlib.import_module("wbb.modules.__main__")
 importlib.import_module("wbb.modules.__main__")
 ALL_MODULES = sorted(__list_all_modules())
 ALL_MODULES = sorted(__list_all_modules())

+ 3 - 3
wbb/modules/chat_watcher.py

@@ -24,10 +24,10 @@ SOFTWARE.
 from pyrogram import filters
 from pyrogram import filters
 
 
 from wbb import app
 from wbb import app
+from wbb.utils.dbfunctions import (add_served_chat, add_served_user,
+                                   blacklisted_chats, is_served_chat,
+                                   is_served_user)
 from wbb.utils.filter_groups import chat_watcher_group
 from wbb.utils.filter_groups import chat_watcher_group
-from wbb.utils.dbfunctions import (blacklisted_chats, is_served_chat,
-        add_served_chat, is_served_user,
-        add_served_user)
 
 
 
 
 @app.on_message(group=chat_watcher_group)
 @app.on_message(group=chat_watcher_group)

+ 1 - 2
wbb/modules/filters.py

@@ -29,8 +29,7 @@ from wbb import app
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.permissions import adminsOnly
 from wbb.core.decorators.permissions import adminsOnly
 from wbb.utils.dbfunctions import (delete_filter, get_filter,
 from wbb.utils.dbfunctions import (delete_filter, get_filter,
-                                   get_filters_names,
-                                   save_filter)
+                                   get_filters_names, save_filter)
 from wbb.utils.filter_groups import chat_filters_group
 from wbb.utils.filter_groups import chat_filters_group
 
 
 __MODULE__ = "Filters"
 __MODULE__ = "Filters"

+ 2 - 2
wbb/modules/global_stats.py

@@ -31,8 +31,8 @@ from wbb.modules import ALL_MODULES
 from wbb.utils.dbfunctions import (get_blacklist_filters_count,
 from wbb.utils.dbfunctions import (get_blacklist_filters_count,
                                    get_filters_count, get_gbans_count,
                                    get_filters_count, get_gbans_count,
                                    get_karmas_count, get_notes_count,
                                    get_karmas_count, get_notes_count,
-                                   get_served_chats, get_warns_count,
-                                   remove_served_chat, get_served_users)
+                                   get_served_chats, get_served_users,
+                                   get_warns_count, remove_served_chat)
 from wbb.utils.fetch import fetch
 from wbb.utils.fetch import fetch
 from wbb.utils.inlinefuncs import keywords_list
 from wbb.utils.inlinefuncs import keywords_list
 
 

+ 1 - 1
wbb/modules/music.py

@@ -37,8 +37,8 @@ from pyrogram import filters
 
 
 from wbb import app, arq
 from wbb import app, arq
 from wbb.core.decorators.errors import capture_err
 from wbb.core.decorators.errors import capture_err
-from wbb.utils.pastebin import paste
 from wbb.utils.fetch import fetch
 from wbb.utils.fetch import fetch
+from wbb.utils.pastebin import paste
 
 
 __MODULE__ = "Music"
 __MODULE__ = "Music"
 __HELP__ = """/ytmusic [link] To Download Music From Various Websites Including Youtube. [SUDOERS]
 __HELP__ = """/ytmusic [link] To Download Music From Various Websites Including Youtube. [SUDOERS]

+ 3 - 1
wbb/modules/stickers.py

@@ -67,7 +67,9 @@ async def kang(client, 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

+ 5 - 20
wbb/modules/userbot.py

@@ -186,11 +186,11 @@ async def sendFile(message: Message, text: str):
 
 
 
 
 @app2.on_message(
 @app2.on_message(
-    filters.command(["c", "cpp"], prefixes=USERBOT_PREFIX) & filters.user(SUDOERS)
+    filters.command(["c", "cpp"], prefixes=USERBOT_PREFIX)
+    & filters.user(SUDOERS)
 )
 )
 async def c_cpp_eval(_, message: Message):
 async def c_cpp_eval(_, message: Message):
-    code = message.text.strip()
-    code = code[3:] if message.command[0] == "c" else code[5:]
+    code = message.text.split(None, 1)[1]
     file = "exec.c"
     file = "exec.c"
     compiler = "g++"
     compiler = "g++"
     out = "exec"
     out = "exec"
@@ -198,36 +198,21 @@ async def c_cpp_eval(_, message: Message):
     cmdRun = [f"./{out}"]
     cmdRun = [f"./{out}"]
     async with aiofiles.open(file, mode="w+") as f:
     async with aiofiles.open(file, mode="w+") as f:
         await f.write(code)
         await f.write(code)
-    t1 = time()
     pCompile = subprocess.run(cmdCompile, capture_output=True)
     pCompile = subprocess.run(cmdCompile, capture_output=True)
     os.remove(file)
     os.remove(file)
     err = pCompile.stderr.decode()
     err = pCompile.stderr.decode()
     if err:
     if err:
-        text = f"""
-**INPUT:**
-```{escape(code)}```
-
-**COMPILE-TIME ERROR:**
-```{escape(err)}```
-"""
+        text = f"**INPUT:**\n```{escape(code)}```\n\n**COMPILE-TIME ERROR:**```{escape(err)}```"
         if len(text) > 4090:
         if len(text) > 4090:
             return await sendFile(message, text)
             return await sendFile(message, text)
         return await edit_or_reply(message, text=text)
         return await edit_or_reply(message, text=text)
     pRun = subprocess.run(cmdRun, capture_output=True)
     pRun = subprocess.run(cmdRun, capture_output=True)
-    t2 = time()
     os.remove(out)
     os.remove(out)
     err = pRun.stderr.decode()
     err = pRun.stderr.decode()
     out = pRun.stdout.decode()
     out = pRun.stdout.decode()
     err = f"**RUNTIME ERROR:**\n```{escape(err)}```" if err else None
     err = f"**RUNTIME ERROR:**\n```{escape(err)}```" if err else None
     out = f"**OUTPUT:**\n```{escape(out)}```" if out else None
     out = f"**OUTPUT:**\n```{escape(out)}```" if out else None
-    text = f"""
-**INPUT:**
-```{escape(code)}```
-
-{err if err else out}
-
-`Compiled and executed in {round(t2-t1, 5)} seconds`
-"""
+    text = f"**INPUT:**\n```{escape(code)}```\n\n{err if err else out}"
     if len(text) > 4090:
     if len(text) > 4090:
         return await sendFile(message, text)
         return await sendFile(message, text)
     await edit_or_reply(message, text=text)
     await edit_or_reply(message, text=text)

+ 3 - 0
wbb/utils/dbfunctions.py

@@ -349,12 +349,14 @@ async def remove_served_chat(chat_id: int):
 
 
 """ USER LOG FUNCTIONS """
 """ USER LOG FUNCTIONS """
 
 
+
 async def is_served_user(user_id: int) -> bool:
 async def is_served_user(user_id: int) -> bool:
     user = await usersdb.find_one({"user_id": user_id})
     user = await usersdb.find_one({"user_id": user_id})
     if not user:
     if not user:
         return False
         return False
     return True
     return True
 
 
+
 async def get_served_users() -> list:
 async def get_served_users() -> list:
     users = usersdb.find({"user_id": {"$gt": 0}})
     users = usersdb.find({"user_id": {"$gt": 0}})
     if not users:
     if not users:
@@ -364,6 +366,7 @@ async def get_served_users() -> list:
         users_list.append(user)
         users_list.append(user)
     return users_list
     return users_list
 
 
+
 async def add_served_user(user_id: int):
 async def add_served_user(user_id: int):
     is_served = await is_served_user(user_id)
     is_served = await is_served_user(user_id)
     if is_served:
     if is_served: