Skip to content

Commit

Permalink
Improve epic games free, dont delete "Could not find games" message"
Browse files Browse the repository at this point in the history
  • Loading branch information
jackra1n committed Feb 16, 2024
1 parent c7056c1 commit 1735f78
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions bot/cogs/free_games.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ def __init__(self, game_info_json: str) -> None:
self.epic_store_link: str = self._create_store_link(game_info_json)

def _create_store_link(self, game_info_json: str) -> str:
page_slug = game_info_json["offerMappings"][0]["pageSlug"]
offer_mappings = game_info_json["offerMappings"]
page_slug = None
if offer_mappings:
page_slug = game_info_json["offerMappings"][0]["pageSlug"]
if page_slug is None:
page_slug = game_info_json["catalogNs"]["mappings"][0]["pageSlug"]
return f'https://www.epicgames.com/store/en-US/p/{page_slug}'
Expand Down Expand Up @@ -59,7 +62,7 @@ def __init__(self, bot: Substiify):

@commands.cooldown(3, 30)
@commands.command()
async def epic(self, ctx):
async def epic(self, ctx: commands.Context):
"""
Show all free games from Epic Games that are currently available.
"""
Expand Down Expand Up @@ -91,7 +94,7 @@ async def epic(self, ctx):
if not current_free_games:
embed = discord.Embed(color=0x000000)
embed.description = 'Could not find any currently free games'
await ctx.send(embed=embed, delete_after=60)
await ctx.send(embed=embed)

for game in current_free_games:
try:
Expand Down

0 comments on commit 1735f78

Please sign in to comment.