Skip to content
This repository was archived by the owner on Jan 17, 2023. It is now read-only.

Commit 405dd77

Browse files
author
Benjamin O'Brien
committed
πŸŽ† Prism 1.4 Preparation πŸŽ†
1 parent 79bfc48 commit 405dd77

File tree

5 files changed

+75
-76
lines changed

5 files changed

+75
-76
lines changed

β€Žcommands/entertainment/avatar.pyβ€Ž

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Modules
22
import discord
3-
from assets.prism import Tools
3+
from random import choice
44

5+
from assets.prism import Tools
56
from discord.ext import commands
67

78
# Main Command Class
@@ -21,7 +22,7 @@ def __init__(self, bot):
2122
@commands.command(aliases = ["pfp", "picture"])
2223
async def avatar(self, ctx, *, user: str = None):
2324

24-
user = Tools.getClosestUser(ctx, user if user else ctx.author)
25+
user = await Tools.getClosestUser(ctx, user if user else ctx.author)
2526

2627
embed = discord.Embed(title = choice(self.options).format(user.name), color = 0x126bf1)
2728

β€Žcommands/entertainment/dictionary.pyβ€Ž

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,16 @@ async def dictionary(self, ctx, *, word = None):
4242

4343
return await ctx.send(embed = Tools.error("That word/phrase is too long."))
4444

45+
elif word.lower() == "commuter":
46+
47+
embed = discord.Embed(title = word, description = f"[Commuter] is a person that likes to play [beamng.drive]. His catchphrase is [idiot] although he has multiple other [phrases] that he says often. He likes playing around with [Prism] and talking about corn. He plays Roblox games and stuff, he is [super duper insanely] smart when it comes to learning Python.", color = 0x126bf1)
48+
49+
embed.set_author(name = " | Dictionary", icon_url = self.bot.user.avatar_url)
50+
51+
embed.set_footer(text = f" | Requested by {ctx.author}.", icon_url = ctx.author.avatar_url)
52+
53+
return await ctx.send(embed = embed)
54+
4555
request = get(f"https://api.urbandictionary.com/v0/define?term={word.lower()}", headers = {"content-type": "application/json"}).text
4656

4757
if not request:

β€Žcommands/entertainment/gay.pyβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ async def gay(self, ctx, user: str = None):
3030

3131
return await ctx.send(embed = Tools.error("NSFW is not enabled in this channel."))
3232

33-
user = Tools.getClosestUser(ctx, user if user else ctx.author)
33+
user = await Tools.getClosestUser(ctx, user if user else ctx.author)
3434

3535
rating = randint(0, 100)
3636

β€Žcommands/entertainment/lesbian.pyβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ async def lesbian(self, ctx, user: str = None):
3030

3131
return await ctx.send(embed = Tools.error("NSFW is not enabled in this channel."))
3232

33-
user = Tools.getClosestUser(ctx, user if user else ctx.author)
33+
user = await Tools.getClosestUser(ctx, user if user else ctx.author)
3434

3535
rating = randint(0, 100)
3636

β€Žcommands/misc/stats.pyβ€Ž

Lines changed: 60 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -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}\tCore #{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

Comments
Β (0)