Skip to content

Instantly share code, notes, and snippets.

@ttatanepvp123
Created January 13, 2019 12:46
Show Gist options
  • Save ttatanepvp123/b4feea638d6c7129fef01c35b92d8f50 to your computer and use it in GitHub Desktop.
Save ttatanepvp123/b4feea638d6c7129fef01c35b92d8f50 to your computer and use it in GitHub Desktop.
discord games status
import colorama
import pypresence
from pypresence import Presence, Activity
import time
import psutil
import platform
def WhatTimeIsIt(mode):
print("started!")
client_id = '533685478415925249'
RPC = Presence(client_id)
RPC.connect()
ac = Activity(RPC)
# ac.start = int(time.time())
ac.details = "What time is it ?"
while True:
if mode == 24:
ac.state = time.strftime("%H:%M:%S")
elif mode == 12:
ac.state = time.strftime("%I:%M:%S %p")
time.sleep(1)
def PcSpecs():
print("started!")
client_id = '533923188195721227'
RPC = Presence(client_id)
RPC.connect()
ac = Activity(RPC)
while True:
for tmp in range(20):
cpu_per = round(psutil.cpu_percent(),1)
mem_per = round(psutil.virtual_memory().percent,1)
ac.details = "RAM: {}%".format(mem_per)
ac.state = "CPU: {}%".format(cpu_per)
time.sleep(0.5)
for tmp in range(5):
ac.details = "OS: {}".format(platform.system())
ac.state = "release: {}".format(platform.release())
time.sleep(0.5)
def MyLastestSocket():
print("started!")
client_id = '533931503433023488'
RPC = Presence(client_id)
RPC.connect()
ac = Activity(RPC)
while True:
sockets = psutil.net_connections()
if len(sockets) != 0:
for tmp in sockets:
if tmp.raddr != () and tmp.status != "LISTEN":
ac.details = "ip : {}".format(tmp.raddr[0])
ac.state = "port : {}".format(tmp.raddr[1])
time.sleep(0.50)
print("""
_____ _ _ _____
| __ \\(_) | | / ____|
| | | |_ ___ ___ ___ _ __ __| | | | __ __ _ _ __ ___ ___ ___
| | | | / __|/ __/ _ \\| '__/ _` | | | |_ |/ _` | '_ ` _ \\ / _ \\/ __|
| |__| | \\__ \\ (_| (_) | | | (_| | | |__| | (_| | | | | | | __/\\__ \\
|_____/|_|___/\\___\\___/|_| \\__,_| \\_____|\\__,_|_| |_| |_|\\___||___/
""")
print("1. What time is it ? (24h)")
print("2. What time is it ? (12h)")
print("3. Computer Specs")
print("4. My Sockets List")
tmp = int(input("> "))
if tmp == 1:
WhatTimeIsIt(24)
elif tmp == 2:
WhatTimeIsIt(12)
elif tmp == 3:
PcSpecs()
elif tmp == 4:
MyLastestSocket()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment