Skip to content

Commit b901b69

Browse files
committed
fix(fact): correct spelling and switch to enums
1 parent 77c98ab commit b901b69

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

tux/cogs/fun/fact.py

+9-13
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"Approximately 24 cat skins can make a coat.",
4545
"While it is commonly thought that the ancient Egyptians were the first to domesticate cats, the oldest known pet cat was recently found in a 9,500-year-old grave on the Mediterranean island of Cyprus. This grave predates early Egyptian art depicting cats by 4,000 years or more.",
4646
"During the time of the Spanish Inquisition, Pope Innocent VIII condemned cats as evil and thousands of cats were burned. Unfortunately, the widespread killing of cats led to an explosion of the rat population, which exacerbated the effects of the Black Death.",
47-
"During the Middle Ages, cats were associated with withcraft, and on St. John's Day, people all over Europe would stuff them into sacks and toss the cats into bonfires. On holy days, people celebrated by tossing cats from church towers.",
47+
"During the Middle Ages, cats were associated with witchcraft, and on St. John's Day, people all over Europe would stuff them into sacks and toss the cats into bonfires. On holy days, people celebrated by tossing cats from church towers.",
4848
"The first cat in space was a French cat named Felicette (a.k.a. “Astrocat”) In 1963, France blasted the cat into outer space. Electrodes implanted in her brains sent neurological signals back to Earth. She survived the trip.",
4949
"The group of words associated with cat (catt, cath, chat, katze) stem from the Latin catus, meaning domestic cat, as opposed to feles, or wild cat.",
5050
"The term “puss” is the root of the principal word for “cat” in the Romanian term pisica and the root of secondary words in Lithuanian (puz) and Low German puus. Some scholars suggest that “puss” could be imitative of the hissing sound used to get a cat's attention. As a slang word for the female pudenda, it could be associated with the connotation of a cat being soft, warm, and fuzzy.",
@@ -116,17 +116,14 @@ async def fact(self, ctx: commands.Context[Tux], fact_type: str = FactType.RANDO
116116
The category of fact to retrieve. {0}
117117
"""
118118

119-
# Validate selected category
120-
category_map = {ft.value: ft for ft in FactType}
121-
if fact_type not in category_map:
122-
options = ", ".join(category_map.keys())
123-
# Inform user of invalid selection
124-
await ctx.send(f"Invalid category '{fact_type}'. Choose one of: {options}.")
125-
return # explicit None return
126-
127-
sel = category_map[fact_type]
128-
129-
# Pick a random fact or show error
119+
# Map selected name back to enum
120+
mapping = {ft.value: ft for ft in FactType}
121+
if fact_type not in mapping:
122+
opts = ", ".join(mapping.keys())
123+
await ctx.send(f"Invalid category '{fact_type}'. Available: {opts}.")
124+
return
125+
sel = mapping[fact_type]
126+
# Pick a random fact
130127
facts = fact_type_map.get(sel, [])
131128
description = random.choice(facts) if facts else "No facts available for this category."
132129

@@ -144,7 +141,6 @@ async def fact(self, ctx: commands.Context[Tux], fact_type: str = FactType.RANDO
144141

145142
# Send the fact embed
146143
await ctx.send(embed=embed)
147-
return # explicit None return at end of function
148144

149145

150146
async def setup(bot: Tux) -> None:

0 commit comments

Comments
 (0)