ソースを参照

removed logging shit

TheHamkerCat 5 年 前
親
コミット
20c4018ff3
4 ファイル変更、3 行追加、77 行削除
  1. 0 25
      wbb/__init__.py
  2. 1 2
      wbb/__main__.py
  3. 1 4
      wbb/modules/__init__.py
  4. 1 46
      wbb/modules/sudoers.py

+ 0 - 25
wbb/__init__.py

@@ -8,31 +8,6 @@ from pyrogram import Client
 from motor.motor_asyncio import AsyncIOMotorClient as MongoClient
 from Python_ARQ import ARQ
 import time
-import logging
-
-f = open("error.log", "w")
-f.write("PEAK OF LOG FILE")
-
-LOG_FORMAT = (
-    '''
-    [%(asctime)s.%(msecs)03d] %(filename)s:%(lineno)s
-    %(levelname)s: %(message)s''')
-
-logging.basicConfig(
-    level=logging.INFO,
-    format=LOG_FORMAT,
-    datefmt="%m-%d %H:%M",
-    filename="error.log",
-    filemode="w",
-)
-
-console = logging.StreamHandler()
-console.setLevel(logging.ERROR)
-formatter = logging.Formatter(LOG_FORMAT)
-console.setFormatter(formatter)
-logging.getLogger("").addHandler(console)
-
-log = logging.getLogger()
 
 SUDOERS = SUDO_USERS_ID
 

+ 1 - 2
wbb/__main__.py

@@ -1,4 +1,5 @@
 import asyncio
+from pyppeteer import launch
 import re
 import importlib
 import uvloop
@@ -11,13 +12,11 @@ from wbb.modules import ALL_MODULES
 
 loop = asyncio.get_event_loop()
 
-
 HELPABLE = {}
 
 
 async def start_bot():
     global COMMANDS_COUNT
-
     for module in ALL_MODULES:
         imported_module = importlib.import_module("wbb.modules." + module)
         if (

+ 1 - 4
wbb/modules/__init__.py

@@ -3,7 +3,7 @@ import importlib
 import sys
 
 from os.path import dirname, basename, isfile
-from wbb import MOD_LOAD, MOD_NOLOAD, log
+from wbb import MOD_LOAD, MOD_NOLOAD
 
 
 def __list_all_modules():
@@ -26,14 +26,12 @@ def __list_all_modules():
                 any(mod == module_name for module_name in all_modules)
                 for mod in to_load
             ):
-                log.error("Invalid Module name!")
                 sys.exit()
 
         else:
             to_load = all_modules
 
         if MOD_NOLOAD:
-            log.info("No load: %s", MOD_NOLOAD)
             return [item for item in to_load if item not in MOD_NOLOAD]
 
         return to_load
@@ -43,5 +41,4 @@ def __list_all_modules():
 
 importlib.import_module("wbb.modules.__main__")
 ALL_MODULES = sorted(__list_all_modules())
-log.info("Modules loaded: %s", str(ALL_MODULES))
 __all__ = ALL_MODULES + ["ALL_MODULES"]

+ 1 - 46
wbb/modules/sudoers.py

@@ -19,8 +19,7 @@ from wbb.utils.dbfunctions import (
 
 
 __MODULE__ = "Sudoers"
-__HELP__ = '''/log - To Get Logs From Last Run.
-/speedtest - To Perform A Speedtest.
+__HELP__ = '''/speedtest - To Perform A Speedtest.
 /stats - To Check System Status.
 /gstats - To Check Bot's Global Stats.
 /gban - To Ban A User Globally.
@@ -28,50 +27,6 @@ __HELP__ = '''/log - To Get Logs From Last Run.
 /update - To Update And Restart The Bot'''
 
 
-# Logs Module
-
-
-@app.on_message(filters.user(SUDOERS) & filters.command("log"))
-@capture_err
-async def logs_chat(_, message):
-    keyb = types.InlineKeyboardMarkup(
-        [
-            [
-                types.InlineKeyboardButton(
-                    "Paste on Nekobin", callback_data="paste_log_nekobin"
-                )
-            ]
-        ]
-    )
-    await message.reply_document(
-        "error.log", reply_markup=keyb
-    )
-
-
-def logs_callback(_, __, query):
-    if re.match("paste_log_nekobin", query.data):
-        return True
-
-
-logs_create = filters.create(logs_callback)
-
-
-@app.on_callback_query(logs_create)
-async def paste_log_neko(client, query):
-    if query.from_user.id in SUDOERS:
-        j = open("error.log", "r")
-        data = await nekobin.neko(j.read())
-        keyb = types.InlineKeyboardMarkup(
-            [[types.InlineKeyboardButton("Pasted!", url=f"{data}")]]
-        )
-        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