Skip to content

Commit 05b4b5c

Browse files
committed
fix(fact.py): make fact type mapping case-insensitive
1 parent 152005e commit 05b4b5c

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

tux/cogs/fun/fact.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,14 @@ async def fact(self, ctx: commands.Context[Tux], *, fact_type: str = FactType.RA
141141
The category of fact to retrieve. {0}
142142
"""
143143

144-
# Map selected name back to enum
145-
mapping = {ft.value: ft for ft in FactType}
146-
if fact_type not in mapping:
147-
opts = ", ".join(mapping.keys())
144+
# Map selected name back to enum (case-insensitive)
145+
mapping = {ft.value.lower(): ft for ft in FactType}
146+
key = fact_type.lower()
147+
if key not in mapping:
148+
opts = ", ".join(ft.value for ft in FactType)
148149
await ctx.send(f"Invalid category '{fact_type}'. Available: {opts}.")
149150
return
150-
sel = mapping[fact_type]
151+
sel = mapping[key]
151152
# Pick a random fact
152153
facts = fact_type_map.get(sel, [])
153154
description = random.choice(facts) if facts else "No facts available for this category."

0 commit comments

Comments
 (0)