diff options
| -rw-r--r-- | bot/resources/evergreen/game_recs/chrono_trigger.json | 4 | ||||
| -rw-r--r-- | bot/resources/evergreen/game_recs/digimon_world.json | 4 | ||||
| -rw-r--r-- | bot/resources/evergreen/game_recs/doom_2.json | 4 | ||||
| -rw-r--r-- | bot/resources/evergreen/game_recs/skyrim.json | 4 | ||||
| -rw-r--r-- | bot/seasons/evergreen/recommend_game.py | 18 |
5 files changed, 15 insertions, 19 deletions
diff --git a/bot/resources/evergreen/game_recs/chrono_trigger.json b/bot/resources/evergreen/game_recs/chrono_trigger.json index 963da43c..219c1e78 100644 --- a/bot/resources/evergreen/game_recs/chrono_trigger.json +++ b/bot/resources/evergreen/game_recs/chrono_trigger.json @@ -1,7 +1,7 @@ { "title": "Chrono Trigger", - "recText": "One of the best games of all time. A brilliant story involving time-travel with loveable characters. It has a brilliant score by Yasonuri Mitsuda and artwork by Akira Toriyama. With over 20 endings and New Game+, there is a huge amount of replay value here.", - "wikiLink": "https://rawg.io/games/chrono-trigger-1995", + "description": "One of the best games of all time. A brilliant story involving time-travel with loveable characters. It has a brilliant score by Yasonuri Mitsuda and artwork by Akira Toriyama. With over 20 endings and New Game+, there is a huge amount of replay value here.", + "link": "https://rawg.io/games/chrono-trigger-1995", "image": "https://vignette.wikia.nocookie.net/chrono/images/2/24/Chrono_Trigger_cover.jpg", "author": "352635617709916161" }
\ No newline at end of file diff --git a/bot/resources/evergreen/game_recs/digimon_world.json b/bot/resources/evergreen/game_recs/digimon_world.json index c5d93560..a2820f8e 100644 --- a/bot/resources/evergreen/game_recs/digimon_world.json +++ b/bot/resources/evergreen/game_recs/digimon_world.json @@ -1,7 +1,7 @@ { "title": "Digimon World", - "recText": "A great mix of town-building and pet-raising set in the Digimon universe. With plenty of Digimon to raise and recruit to the village, this charming game will keep you occupied for a long time.", + "description": "A great mix of town-building and pet-raising set in the Digimon universe. With plenty of Digimon to raise and recruit to the village, this charming game will keep you occupied for a long time.", "image": "https://www.mobygames.com/images/covers/l/437308-digimon-world-playstation-front-cover.jpg", - "wikiLink": "https://rawg.io/games/digimon-world", + "link": "https://rawg.io/games/digimon-world", "author": "352635617709916161" }
\ No newline at end of file diff --git a/bot/resources/evergreen/game_recs/doom_2.json b/bot/resources/evergreen/game_recs/doom_2.json index 3d4ec8fa..e228e2b1 100644 --- a/bot/resources/evergreen/game_recs/doom_2.json +++ b/bot/resources/evergreen/game_recs/doom_2.json @@ -1,7 +1,7 @@ { "title": "Doom II", - "recText": "Doom 2 was one of the first FPS games that I truly enjoyed. It offered awesome weapons, terrifying demons to kill, and a great atmosphere to do it in.", + "description": "Doom 2 was one of the first FPS games that I truly enjoyed. It offered awesome weapons, terrifying demons to kill, and a great atmosphere to do it in.", "image": "https://upload.wikimedia.org/wikipedia/en/thumb/2/29/Doom_II_-_Hell_on_Earth_Coverart.png/220px-Doom_II_-_Hell_on_Earth_Coverart.png", - "wikiLink": "https://rawg.io/games/doom-ii", + "link": "https://rawg.io/games/doom-ii", "author": "352635617709916161" }
\ No newline at end of file diff --git a/bot/resources/evergreen/game_recs/skyrim.json b/bot/resources/evergreen/game_recs/skyrim.json index aaf8ebf9..09f93563 100644 --- a/bot/resources/evergreen/game_recs/skyrim.json +++ b/bot/resources/evergreen/game_recs/skyrim.json @@ -1,7 +1,7 @@ { "title": "Elder Scrolls V: Skyrim", - "recText": "The latest mainline Elder Scrolls game offered a fantastic role-playing experience with untethered freedom and a great story. Offering vast mod support, the game has endless customization and replay value.", + "description": "The latest mainline Elder Scrolls game offered a fantastic role-playing experience with untethered freedom and a great story. Offering vast mod support, the game has endless customization and replay value.", "image": "https://upload.wikimedia.org/wikipedia/en/1/15/The_Elder_Scrolls_V_Skyrim_cover.png", - "wikiLink": "https://rawg.io/games/the-elder-scrolls-v-skyrim", + "link": "https://rawg.io/games/the-elder-scrolls-v-skyrim", "author": "352635617709916161" }
\ No newline at end of file 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) |