aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/seasons/evergreen/game.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/bot/seasons/evergreen/game.py b/bot/seasons/evergreen/game.py
index 79fe8ae9..688c7e35 100644
--- a/bot/seasons/evergreen/game.py
+++ b/bot/seasons/evergreen/game.py
@@ -197,9 +197,21 @@ class Games(Cog):
try:
games = await self.get_games_list(amount, self.genres[genre], offset=random.randint(0, 150))
except KeyError:
- possibilities = "`, `".join(difflib.get_close_matches(genre, self.genres))
- await ctx.send(f"Invalid genre `{genre}`. {f'Maybe you meant `{possibilities}`?' if possibilities else ''}")
- return
+ possibilities = await self.get_best_results(genre)
+ possibility = None
+ # Check is there any possibility that ratio is higher than 0.60
+ for p in possibilities:
+ if p[0] >= 0.60:
+ possibility = await self.get_games_list(amount, self.genres[p[1]], offset=random.randint(0, 150))
+ genre = p[1]
+ break
+ if possibility:
+ games = possibility
+ else:
+ await ctx.send(
+ f"Invalid genre `{genre}`. {f'Maybe you meant `{possibilities}`?' if possibilities else ''}"
+ )
+ return
# Create pages and paginate
pages = [await self.create_page(game) for game in games]