TheHamkerCat 5 роки тому
батько
коміт
823c03fd82

+ 4 - 6
wbb/core/sections.py

@@ -1,9 +1,7 @@
-def section(title: str, body: dict, indent: int = 2, underline: bool = True) -> str:
-    text = (
-        f"**--{title}**--:\n"
-        if underline
-        else f"**{title}**:\n"
-    )
+def section(
+    title: str, body: dict, indent: int = 2, underline: bool = True
+) -> str:
+    text = f"**--{title}**--:\n" if underline else f"**{title}**:\n"
     for key, value in body.items():
         if not isinstance(value, list):
             text += f"{' ' * indent}**{key}:** `{value}`\n"

+ 11 - 10
wbb/modules/arq.py

@@ -23,9 +23,10 @@ SOFTWARE.
 """
 from pyrogram import filters
 
-from wbb import ARQ_API_URL, app, arq
+from wbb import app, arq
 from wbb.core.sections import section
 
+
 @app.on_message(filters.command("arq"))
 async def arq_stats(_, message):
     data = await arq.stats()
@@ -33,14 +34,14 @@ async def arq_stats(_, message):
         return await message.reply_text(data.result)
     server = data.result
     body = {
-            "Uptime": server.uptime,
-            "Requests Since Uptime": server.requests,
-            "CPU": server.cpu,
-            "Memory": server.memory.server,
-            "Platform": server.platform,
-            "Python": server.python,
-            "Users": server.users,
-            "Bot": [server.bot],
-            }
+        "Uptime": server.uptime,
+        "Requests Since Uptime": server.requests,
+        "CPU": server.cpu,
+        "Memory": server.memory.server,
+        "Platform": server.platform,
+        "Python": server.python,
+        "Users": server.users,
+        "Bot": [server.bot],
+    }
     text = section("A.R.Q", body)
     await message.reply_text(text)

+ 20 - 20
wbb/modules/info.py

@@ -52,15 +52,15 @@ async def get_user_info(user):
     is_sudo = user_id in SUDOERS
     karma = await user_global_karma(user_id)
     body = {
-            "ID": user_id,
-            "DC": dc_id,
-            "Name": [first_name],
-            "Username": [("@" + username) if username else None],
-            "Mention": [mention],
-            "Sudo": is_sudo,
-            "Karma": karma,
-            "Gbanned": is_gbanned
-            }
+        "ID": user_id,
+        "DC": dc_id,
+        "Name": [first_name],
+        "Username": [("@" + username) if username else None],
+        "Mention": [mention],
+        "Sudo": is_sudo,
+        "Karma": karma,
+        "Gbanned": is_gbanned,
+    }
     caption = section("User info", body)
     return [caption, photo_id]
 
@@ -79,17 +79,17 @@ async def get_chat_info(chat):
     dc_id = chat.dc_id
     photo_id = chat.photo.big_file_id if chat.photo else None
     body = {
-            "ID": chat_id,
-            "DC": dc_id,
-            "Type": type,
-            "Name": [title],
-            "Username": [("@" + username) if username else None],
-            "Mention": [link],
-            "Members": members,
-            "Scam": is_scam,
-            "Restricted": is_restricted,
-            "Description": [description],
-            }
+        "ID": chat_id,
+        "DC": dc_id,
+        "Type": type,
+        "Name": [title],
+        "Username": [("@" + username) if username else None],
+        "Mention": [link],
+        "Members": members,
+        "Scam": is_scam,
+        "Restricted": is_restricted,
+        "Description": [description],
+    }
     caption = section("Chat info", body)
     return [caption, photo_id]
 

+ 1 - 3
wbb/modules/music.py

@@ -223,9 +223,7 @@ async def deezsong(_, message):
         await m.edit("Downloading")
         proxy = "https://quotly-api.herokuapp.com"
         try:
-            song = await download_song(
-                f"{proxy}?url={url}"
-            )
+            song = await download_song(f"{proxy}?url={url}")
         except Exception:
             song = await download_song(url)
         if not song:

+ 3 - 3
wbb/modules/proxy.py

@@ -37,7 +37,7 @@ def url_from_proxy(proxy: str) -> str:
 @app.on_message(filters.command("proxy") & ~filters.edited)
 async def proxy_func(_, message: Message):
     if len(proxies) == 0:
-        await asyncio.sleep(0.5)
+        await sleep(0.5)
     location = proxies[0].location
     proxy = proxies[0].proxy
     url = url_from_proxy(proxy)
@@ -45,8 +45,8 @@ async def proxy_func(_, message: Message):
         [
             [("Connect", url)],
             [
-                ("←", f"proxy_arq_-1"),
-                ("→", f"proxy_arq_1"),
+                ("←", "proxy_arq_-1"),
+                ("→", "proxy_arq_1"),
             ],
         ]
     )

+ 2 - 4
wbb/modules/rice.py

@@ -21,10 +21,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
 """
-
-""" THIS MODULE IS SPECIFICALLY FOR @DE_WM GROUP, YOU CAN REMOVE IT IN YOUR FORK IF YOU WANT TO """
-
-
 from pyrogram import filters
 from pyrogram.types import (InlineKeyboardButton,
                             InlineKeyboardMarkup, InputMediaPhoto,
@@ -33,6 +29,8 @@ from pyrogram.types import (InlineKeyboardButton,
 from wbb import app
 from wbb.core.decorators.errors import capture_err
 
+""" THIS MODULE IS SPECIFICALLY FOR @DE_WM GROUP, YOU CAN REMOVE IT IN YOUR FORK IF YOU WANT TO """
+
 RICE_GROUP = "DE_WM"
 RICE_CHANNEL = "RiceGallery"
 

+ 8 - 4
wbb/modules/stickers.py

@@ -27,8 +27,8 @@ from traceback import format_exc
 
 from pyrogram import filters
 from pyrogram.errors.exceptions.bad_request_400 import (
-    PeerIdInvalid, ShortnameOccupyFailed, StickerPngDimensions,
-    StickerPngNopng, UserIsBlocked, StickerEmojiInvalid)
+    PeerIdInvalid, ShortnameOccupyFailed, StickerEmojiInvalid,
+    StickerPngDimensions, StickerPngNopng, UserIsBlocked)
 from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
 
 from wbb import BOT_USERNAME, app
@@ -163,9 +163,13 @@ async def kang(client, message):
                 continue
             else:
                 try:
-                    await add_sticker_to_set(client, stickerset, sticker)
+                    await add_sticker_to_set(
+                        client, stickerset, sticker
+                    )
                 except StickerEmojiInvalid:
-                    return await msg.edit("[ERROR]: INVALID_EMOJI_IN_ARGUMENT")
+                    return await msg.edit(
+                        "[ERROR]: INVALID_EMOJI_IN_ARGUMENT"
+                    )
             break
 
         await msg.edit(

+ 1 - 2
wbb/utils/inlinefuncs.py

@@ -25,7 +25,6 @@ import asyncio
 import json
 import os
 import sys
-from random import randint
 from re import sub as re_sub
 from sys import version as pyver
 from time import ctime, time
@@ -722,8 +721,8 @@ async def pmpermit_func(answers, user_id, victim):
 
 
 async def ping_func(answers):
+    ping = Ping(ping_id=app.rnd_id())
     t1 = time()
-    ping = Ping(ping_id=randint(696969, 6969696))
     await app.send(ping)
     t2 = time()
     ping = f"{str(round((t2 - t1) * 1000, 2))} ms"