Przeglądaj źródła

Added Stats And Ping

thehamkercat 5 lat temu
rodzic
commit
cbf219b9ba
2 zmienionych plików z 27 dodań i 2 usunięć
  1. 25 0
      main.py
  2. 2 2
      start.txt

+ 25 - 0
main.py

@@ -1,5 +1,8 @@
 from pyrogram import Client, filters
 from pyrogram import Client, filters
 import random
 import random
+import time
+import shutil, psutil
+
 app = Client("WilliamButcher")
 app = Client("WilliamButcher")
 
 
 
 
@@ -15,4 +18,26 @@ async def start(client, message):
 async def commit(client, message):
 async def commit(client, message):
     await message.reply_text(random_line('commit.txt'))
     await message.reply_text(random_line('commit.txt'))
 
 
+
+@app.on_message(filters.command(commands = (["ping"])))
+def ping(client, message):
+    start_time = int(round(time.time() * 1000))
+    message.reply_text("Starting Ping")
+    end_time = int(round(time.time() * 1000))
+    message.reply_text(f'{end_time - start_time} ms')     #Need to edit the above message instead of sending another
+
+
+@app.on_message(filters.command(commands =(["stats"])))
+def stats(client, message):
+    cpu = psutil.cpu_percent(interval=0.5)
+    mem = psutil.virtual_memory().percent
+    disk = psutil.disk_usage('/').percent
+    stats = f'<b>CPU:</b> {cpu}% ' \
+            f'<b>RAM:</b> {mem}% ' \
+            f'<b>Disk:</b> {disk}%'
+    message.reply_text(stats)
+
+
+
+
 app.run()
 app.run()

+ 2 - 2
start.txt

@@ -4,8 +4,8 @@ Fuckin’ diabolical.
 I just had to pop down to the shop …  I was running a bit low on mind your own fucking business.
 I just had to pop down to the shop …  I was running a bit low on mind your own fucking business.
 You see, when they’re apart, they’re absolute fuckin’ rubbish … but you put them together, they’re the goddamn fucking Spice Girls.
 You see, when they’re apart, they’re absolute fuckin’ rubbish … but you put them together, they’re the goddamn fucking Spice Girls.
 Sounds good, does it taste like lies? I’ve got your phone linked to my Find Your Shithead Friends app. Now where the fuck are you?
 Sounds good, does it taste like lies? I’ve got your phone linked to my Find Your Shithead Friends app. Now where the fuck are you?
-Shake Shack, huh? Nice try Nigger.
+Shake Shack, huh? Nice try Cunt!.
 Well Well Well if it ain't the invisible cunt.
 Well Well Well if it ain't the invisible cunt.
 Why i'm dying to live if i'm living to die?
 Why i'm dying to live if i'm living to die?
 Mama ain't raised no bitch, ima speak up when i need to.
 Mama ain't raised no bitch, ima speak up when i need to.
-Not to brag but i don't even need errors to make bad decisions.
+Not to brag but i don't even need errors to make bad decisions.