Browse Source

Fixed some more flake8 warns

TheHamkerCat 5 năm trước cách đây
mục cha
commit
405c597e38
6 tập tin đã thay đổi với 50 bổ sung và 25 xóa
  1. 14 4
      wbb/__main__.py
  2. 2 1
      wbb/modules/__init__.py
  3. 4 5
      wbb/modules/admin.py
  4. 21 11
      wbb/modules/bot_owner.py
  5. 0 1
      wbb/modules/commit.py
  6. 9 3
      wbb/utils/misc.py

+ 14 - 4
wbb/__main__.py

@@ -23,12 +23,21 @@ async def start_bot():
 
     for module in ALL_MODULES:
         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__
+        ):
             if imported_module.__MODULE__.lower() in MOD_NOLOAD:
                 continue
             imported_module.__MODULE__ = imported_module.__MODULE__
-            if hasattr(imported_module, "__HELP__") and imported_module.__HELP__:
-                HELPABLE[imported_module.__MODULE__.lower()] = imported_module
+            if (
+                hasattr(imported_module, "__HELP__")
+                and imported_module.__HELP__
+            ):
+                HELPABLE[
+                    imported_module.__MODULE__.lower()
+                ] = imported_module
+
     bot_modules = ""
     j = 1
     for i in ALL_MODULES:
@@ -45,7 +54,7 @@ async def start_bot():
     print("+===============+===============+===============+===============+")
     print("Bot Started Successfully as {}!".format(botinfo.BOT_NAME))
     await idle()
-    
+
 
 @app.on_message(cust_filter.command("start"))
 async def start(client, message):
@@ -54,6 +63,7 @@ async def start(client, message):
         return
     await message.reply("Hi, try /help")
 
+
 @app.on_message(cust_filter.command("help"))
 async def help_command(_, message):
     if message.chat.type != "private":

+ 2 - 1
wbb/modules/__init__.py

@@ -6,7 +6,8 @@ def __list_all_modules():
     from os.path import dirname, basename, isfile
     import glob
 
-    # This generates a list of modules in this folder for the * in __main__ to work.
+# This generates a list of modules in this
+# folder for the * in __main__ to work.
     mod_paths = glob.glob(dirname(__file__) + "/*.py")
     all_modules = [
         basename(f)[:-3]

+ 4 - 5
wbb/modules/admin.py

@@ -1,22 +1,21 @@
 import asyncio
-from pyrogram import Client, filters
 from wbb.utils import cust_filter
-from wbb import app, Command
+from wbb import app
 from wbb.utils.is_admin import is_admin
 
 
 __MODULE__ = "Admin"
 __HELP__ = '''
-/purge - Purge Messages From The Replied Message To The Last Message [Limit = 100]
+/purge - Purge Messages [Limit = 100]
 
 '''
 
+
 @app.on_message(cust_filter.command(commands=("purge")))
 async def purge(client, message):
     app.set_parse_mode("markdown")
     if message.chat.type not in (("supergroup", "channel")):
         return
-    
     admin = await is_admin(message)
 
     if not admin:
@@ -45,7 +44,7 @@ async def purge(client, message):
             )
 
     m = await message.reply_text(
-        f"```Purged!```"
+        "```Purged!```"
     )
     await asyncio.sleep(2)
     await m.delete()

+ 21 - 11
wbb/modules/bot_owner.py

@@ -1,7 +1,11 @@
 from wbb.utils import cust_filter, nekobin, formatter
-from wbb import app, Command, OWNER_ID, bot_start_time, NEOFETCH
+from wbb import app, OWNER_ID, bot_start_time, NEOFETCH
 from pyrogram import filters, types
-import re, speedtest, psutil, time, os
+import re
+import speedtest
+import psutil
+import time
+import os
 
 
 __MODULE__ = "BotOwner"
@@ -12,7 +16,8 @@ __HELP__ = '''
 
 '''
 
-#Logs Module
+# Logs Module
+
 
 @app.on_message(filters.user(OWNER_ID) & cust_filter.command("log"))
 async def logs_chat(client, message):
@@ -44,18 +49,20 @@ async def paste_log_neko(client, query):
         f = open("error.log", "r")
         data = await nekobin.neko(f.read())
         keyb = types.InlineKeyboardMarkup(
-            [[types.InlineKeyboardButton("pasted on nekobin", 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:
         await client.answer_callback_query(
             query.id, "'Blue Button Must Press', huh?", show_alert=True
         )
 
+# SpeedTest Module
 
 
-#SpeedTest Module
-
 def speed_convert(size):
     power = 2 ** 10
     zero = 0
@@ -66,7 +73,9 @@ def speed_convert(size):
     return f"{round(size, 2)} {units[zero]}"
 
 
-@app.on_message(filters.user(OWNER_ID) & cust_filter.command(commands=("speedtest")))
+@app.on_message(
+    filters.user(OWNER_ID) & cust_filter.command(commands=("speedtest"))
+)
 async def speeeed(client, message):
     app.set_parse_mode("markdown")
     m = await message.reply_text("```Performing A Speedtest!```")
@@ -80,10 +89,12 @@ Upload   - {speed_convert(z)}
 Latency  - {round((x["latency"]))} ms
 ```''')
 
+# Stats Module
 
-#Stats Module
 
-@app.on_message(filters.user(OWNER_ID) & cust_filter.command(commands=("stats")))
+@ app.on_message(
+    filters.user(OWNER_ID) & cust_filter.command(commands=("stats"))
+)
 async def stats(client, message):
     bot_uptime = int(time.time() - bot_start_time)
     cpu = psutil.cpu_percent(interval=0.5)
@@ -115,4 +126,3 @@ async def stats(client, message):
 {neofetch}
 ```''')
     await message.reply_text(stats)
-

+ 0 - 1
wbb/modules/commit.py

@@ -1,5 +1,4 @@
 from wbb import app
-from pyrogram import filters
 from wbb.utils import cust_filter, random_line
 
 __MODULE__ = "Commit"

+ 9 - 3
wbb/utils/misc.py

@@ -60,13 +60,19 @@ def paginate_modules(page_n, module_dict, prefix, chat=None):
 
     # can only have a certain amount of buttons side by side
     if len(pairs) > 7:
-        pairs = pairs[modulo_page * 7 : 7 * (modulo_page + 1)] + [
+        pairs = pairs[modulo_page * 7: 7 * (modulo_page + 1)] + [
             (
                 EqInlineKeyboardButton(
-                    "<", callback_data="{}_prev({})".format(prefix, modulo_page)
+                    "<",
+                    callback_data="{}_prev({})".format(
+                        prefix, modulo_page
+                    ),
                 ),
                 EqInlineKeyboardButton(
-                    ">", callback_data="{}_next({})".format(prefix, modulo_page)
+                    ">",
+                    callback_data="{}_next({})".format(
+                        prefix, modulo_page
+                    ),
                 ),
             )
         ]