Ver Fonte

Added Stats And Ping

thehamkercat há 5 anos atrás
pai
commit
cbf219b9ba
2 ficheiros alterados com 27 adições e 2 exclusões
  1. 25 0
      main.py
  2. 2 2
      start.txt

+ 25 - 0
main.py

@@ -1,5 +1,8 @@
 from pyrogram import Client, filters
 import random
+import time
+import shutil, psutil
+
 app = Client("WilliamButcher")
 
 
@@ -15,4 +18,26 @@ async def start(client, message):
 async def commit(client, message):
     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()

+ 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.
 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?
-Shake Shack, huh? Nice try Nigger.
+Shake Shack, huh? Nice try Cunt!.
 Well Well Well if it ain't the invisible cunt.
 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.
-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.