Skip to content

Commit c8c9909

Browse files
committed
Add GPU naming improvements
1 parent df6583b commit c8c9909

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

bot/exts/smart_eval/_cog.py

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,21 @@ async def get_gpu_capabilities(self) -> tuple[int, int]:
4444

4545
return response_time, intelligence_level
4646

47+
async def improve_gpu_name(self, hardware_name: str) -> str:
48+
"""Quackify and pythonify the given GPU name."""
49+
hardware_name = hardware_name.replace("NVIDIA", "NQUACKIA")
50+
hardware_name = hardware_name.replace("Radeon", "Quackeon")
51+
hardware_name = hardware_name.replace("GeForce", "PyForce")
52+
hardware_name = hardware_name.replace("RTX", "PyTX")
53+
hardware_name = hardware_name.replace("RX", "PyX")
54+
hardware_name = hardware_name.replace("Iris", "Pyris")
55+
56+
# Some adjustments to prevent low hanging markdown escape
57+
hardware_name = hardware_name.replace("*", "")
58+
hardware_name = hardware_name.replace("_", " ")
59+
60+
return hardware_name
61+
4762
@commands.command()
4863
async def donations(self, ctx: commands.Context) -> None:
4964
"""Display the number of donations recieved so far."""
@@ -85,7 +100,7 @@ async def donate(self, ctx: commands.Context, *, hardware: str | None = None) ->
85100
stored_hardware = await self.smarte_donation_cache.get(ctx.author.id)
86101
await ctx.reply(
87102
"I can only take one donation per person. "
88-
f"Thank you for donating your {stored_hardware} to our Smart Eval command."
103+
f"Thank you for donating your *{stored_hardware}* to our Smart Eval command."
89104
)
90105
return
91106

@@ -99,14 +114,14 @@ async def donate(self, ctx: commands.Context, *, hardware: str | None = None) ->
99114
)
100115
return
101116

102-
fake_hardware = ... # Do some regex to pull out a semi-matching type of GPU and insert something else
103-
await self.smarte_donation_cache.set(ctx.author.id, hardware)
117+
fake_hardware = await self.improve_gpu_name(hardware)
118+
await self.smarte_donation_cache.set(ctx.author.id, fake_hardware)
104119

105120
await ctx.reply(
106-
"Thank you for donating your GPU to our Smart Eval command!"
107-
f" I did decide that instead of {hardware}, it would be better if you donated {fake_hardware}."
121+
"Thank you for donating your GPU to our Smart Eval command."
122+
f" I did decide that instead of *{hardware}*, it would be better if you donated *{fake_hardware}*."
108123
" So I've recorded that GPU donation instead."
109-
" It will be used wisely and definitely not for shenanigans."
124+
" \n\nIt will be used wisely and definitely not for shenanigans!"
110125
)
111126

112127
@commands.command(aliases=["smarte"])

0 commit comments

Comments
 (0)