diff options
Diffstat (limited to 'bot/seasons')
| -rw-r--r-- | bot/seasons/evergreen/recommend_game.py | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/bot/seasons/evergreen/recommend_game.py b/bot/seasons/evergreen/recommend_game.py index 1c81ea39..30a538a5 100644 --- a/bot/seasons/evergreen/recommend_game.py +++ b/bot/seasons/evergreen/recommend_game.py @@ -7,12 +7,11 @@ import discord from discord.ext import commands log = logging.getLogger(__name__) -DIR = Path("bot/resources/evergreen/game_recs") game_recs = [] # Populate the list `game_recs` with resource files -for file_url in DIR.glob("*.json"): - with Path(file_url).open(encoding='utf-8') as file: +for rec_path in Path("bot/resources/evergreen/game_recs").glob("*.json"): + with rec_path.open(encoding='utf-8') as file: data = json.load(file) game_recs.append(data) shuffle(game_recs) @@ -25,17 +24,14 @@ class RecommendGame(commands.Cog): self.bot = bot self.index = 0 - @commands.command(name="recommend_game", aliases=['gameRec', 'recommendGame']) + @commands.command(name="recommendgame", aliases=['gamerec']) async def recommend_game(self, ctx): """Sends an Embed of a random game recommendation.""" - if self.index < len(game_recs): - game = game_recs[self.index] - self.index += 1 - else: + if self.index >= len(game_recs): self.index = 0 shuffle(game_recs) - game = game_recs[self.index] - self.index += 1 + game = game_recs[self.index] + self.index += 1 author = self.bot.get_user(int(game['author'])) @@ -43,7 +39,7 @@ class RecommendGame(commands.Cog): embed = discord.Embed(color=discord.Colour.blue()) embed.set_author(name=author.name, icon_url=author.avatar_url) embed.set_image(url=game['image']) - embed.add_field(name='Recommendation: ' + game['title'] + '\n' + game['wikiLink'], value=game['recText']) + embed.add_field(name='Recommendation: ' + game['title'] + '\n' + game['link'], value=game['description']) await ctx.send(embed=embed) |