@@ -35,93 +35,81 @@ def scale_size(self, bytes, suffix = "B"):
3535 bytes /= factor
3636
3737 @commands .command (aliases = ["statistics" , "bot" ])
38- async def stats (self , ctx , * , etc : str = None ):
38+ async def stats (self , ctx ):
3939
40- orig_time = time . time ()
40+ percore_usage = ""
4141
42- command_count = 0
42+ for i , percentage in enumerate ( psutil . cpu_percent ( percpu = True , interval = 1 )):
4343
44- for folder in os . listdir ( "commands" ):
44+ percore_usage = f" { percore_usage } \t Core # { i + 1 } : { percentage } % \n "
4545
46- for file in os . listdir ( f"commands/ { folder } " ):
46+ bt = datetime . fromtimestamp ( psutil . boot_time ()). strftime ( "%D %I:%M %p" )
4747
48- if file != "__pycache__" :
48+ uname = platform . uname ()
4949
50- command_count += 1
50+ svmem = psutil . virtual_memory ()
5151
52- bot = f"""
53- Server Count: { len (self .bot .guilds )}
54- User Count: { len (self .bot .users )}
55- Command Count: { command_count }
56- Bot Latency: { str (time .time () - orig_time ).split ("." )[1 ][:2 ]} ms
57- Staff Member(s):
58- - <@633185043774177280> (Developer)
59- - <@666839157502378014> (Management)
60- """
52+ cpufreq = psutil .cpu_freq ()
6153
62- other = f"""
63- Python Version: { str (sys .version ).split (" " )[0 ]}
64- Discord.py Version: { discord .__version__ }
65- API Latency: { round (self .bot .latency * 1000 )} ms
54+ embed = discord .Embed (title = "Prism Statistics" , color = 0x126bf1 )
6655
67- Last updated: { str (datetime .now ()).split (" " )[0 ]}
68- """
56+ embed .add_field (
57+ name = "Bot Information" ,
58+ value = f"""```
59+ Guild Count: { len (self .bot .guilds )}
60+ Member Count: { len (self .bot .users )}
61+ Command Count: { len (self .bot .commands )}
6962
70- embed = discord . Embed ( color = 0x126bf1 )
63+ Latency: { round ( self . bot . latency * 1000 ) } ms
7164
72- embed .add_field (name = "Bot Information" , value = bot , inline = False )
65+ Staff Member(s):
66+ - iiPython#0768 (Developer)
67+ - Commuter#4083 (Management)```
68+ """ .replace (" " , "" ),
69+ inline = False
70+ )
7371
74- if etc and etc .lower () == "all" :
72+ embed .add_field (
73+ name = "System Information" ,
74+ value = f"""```
75+ Running { uname .system } v{ uname .version } ({ uname .machine } )
76+ Lastest Boot: { bt } ```
77+ """ .replace (" " , "" ),
78+ inline = False
79+ )
7580
76- percore_usage = ""
81+ embed .add_field (
82+ name = "Processor Information" ,
83+ value = f"""```
84+ Physical: { psutil .cpu_count (logical = False )} | Total: { psutil .cpu_count (logical = True )}
85+ Frequency: { cpufreq .current :.2f} Mhz
7786
78- for i , percentage in enumerate (psutil .cpu_percent (percpu = True , interval = 1 )):
79-
80- percore_usage = f"{ percore_usage } Core { i + 1 } : { percentage } %\n "
81-
82- svmem = psutil .virtual_memory ()
83-
84- cpufreq = psutil .cpu_freq ()
85-
86- boot_time_timestamp = psutil .boot_time ()
87-
88- bt = datetime .fromtimestamp (boot_time_timestamp )
89-
90- uname = platform .uname ()
91-
92- system = f"""
93- System: { uname .system }
94- Node Name: { uname .node }
95- Release: { uname .release }
96- Version: { uname .version }
97- Machine: { uname .machine }
98- Boot Time: { bt .year } /{ bt .month } /{ bt .day } { bt .hour } :{ bt .minute } :{ bt .second }
99- """
100-
101- processor = f"""
102- Physical Cores: { psutil .cpu_count (logical = False )}
103- Total Cores: { psutil .cpu_count (logical = True )}
104- Current Frequency: { cpufreq .current :.2f} Mhz
105-
106- CPU Usage (per core):
87+ Core Usage:
10788 { percore_usage }
108- Total CPU Usage: { psutil .cpu_percent ()} %
109- """
110-
111- memory = f"""
112- Total: { self .scale_size (svmem .total )}
113- Available: { self .scale_size (svmem .available )}
114- Used: { self .scale_size (svmem .used )}
115- Percentage: { svmem .percent } %
116- """
117-
118- embed .add_field (name = "System Information" , value = system , inline = False )
119-
120- embed .add_field (name = "Processor Information" , value = processor , inline = False )
121-
122- embed .add_field (name = "Memory Information" , value = memory , inline = False )
123-
124- embed .add_field (name = "Other Information" , value = other , inline = False )
89+ CPU Usage: { psutil .cpu_percent ()} %```
90+ """ .replace (" " , "" ),
91+ inline = False
92+ )
93+
94+ embed .add_field (
95+ name = "RAM Information" ,
96+ value = f"""```
97+ Total: { self .scale_size (svmem .total )} | Free: { self .scale_size (svmem .available )}
98+ Used: { self .scale_size (svmem .used )} | Percentage: { svmem .percent } %```
99+ """ .replace (" " , "" ),
100+ inline = False
101+ )
102+
103+ embed .add_field (
104+ name = "Other Information" ,
105+ value = f"""```
106+ Python Version: { str (sys .version ).split (" " )[0 ]}
107+ Discord.py Version: { discord .__version__ }
108+
109+ Time requested: { datetime .now ().strftime ("%D %I:%M:%S %p" )} CST```
110+ """ .replace (" " , "" ),
111+ inline = False
112+ )
125113
126114 embed .set_author (name = " | Statistics" , icon_url = self .bot .user .avatar_url )
127115
0 commit comments