Przeglądaj źródła

Added Bool For Neofetch [Default Is True]

thehamkercat 5 lat temu
rodzic
commit
3631090d99
4 zmienionych plików z 24 dodań i 13 usunięć
  1. 1 0
      README.md
  2. 1 0
      sample_config.ini
  3. 1 0
      wbb/__init__.py
  4. 21 13
      wbb/modules/bot_owner.py

+ 1 - 0
README.md

@@ -24,6 +24,7 @@ Just Another Telegram Bot Written In Python Using Pyrogram.
    
    [admin]
    owner_id = 1243703097
+   neofetch = True
 
    [prefix]
    prefixes = /

+ 1 - 0
sample_config.ini

@@ -5,6 +5,7 @@ api_hash = r7s8c3b22d4869bd6ca7cc756cb9
 
 [admin]
 owner_id = 1243703097
+neofetch = True
 
 [prefix]
 prefixes = /

+ 1 - 0
wbb/__init__.py

@@ -32,6 +32,7 @@ log = logging.getLogger()
 config = ConfigParser()
 config.read("config.ini")
 OWNER_ID = int(config.get("admin", "owner_id"))
+NEOFETCH = (config.get("admin", "neofetch"))
 Command = config.get("prefix", "prefixes").split()
 MOD_LOAD = config.get("mods", "load_modules").split()
 MOD_NOLOAD = config.get("mods", "noload_modules").split()

+ 21 - 13
wbb/modules/bot_owner.py

@@ -1,5 +1,5 @@
 from wbb.utils import cust_filter, nekobin, formater
-from wbb import app, Command, OWNER_ID, bot_start_time
+from wbb import app, Command, OWNER_ID, bot_start_time, NEOFETCH
 from pyrogram import filters, types
 import re, speedtest, psutil, time, os
 
@@ -85,23 +85,31 @@ Latency  - {round((x["latency"]))} ms
 
 @app.on_message(filters.user(OWNER_ID) & cust_filter.command(commands=(["stats"])))
 async def stats(client, message):
-    os.system("neofetch --stdout > neofetch.txt")
-    f = open("neofetch.txt", "r")
-    neofetch = f.read()
-    f.close()
     cpu = psutil.cpu_percent(interval=0.5)
     mem = psutil.virtual_memory().percent
     disk = psutil.disk_usage("/").percent
+    if NEOFETCH == "True":
+        os.system("neofetch --stdout > neofetch.txt")
+        f = open("neofetch.txt", "r")
+        read_file = f.read()
+        neofetch = (f'''
+----------[Neofetch]----------
+
+{read_file}
+''')
+        f.close()
+    else:
+        neofetch = "NeoFetch Is Disabled!"
     stats = (f'''
-```#####- [Stats] -#####
-
-Uptime: {formater.get_readable_time((time.time() - bot_start_time))} 
-CPU: {cpu}% 
-RAM: {mem}% 
-Disk: {disk}%
-
+```_________________________
+|________|Stats|________|
+|                       |
+|      Uptime: {formater.get_readable_time((time.time() - bot_start_time))}|
+|      CPU: {cpu}%       |
+|      RAM: {mem}%       |
+|      Disk: {disk}%       |
+|_______________________|
 
-####- [Neofetch] -####
 
 {neofetch}
 ```''')