Skip to content

Commit

Permalink
fixed epic module bug
Browse files Browse the repository at this point in the history
If the key 'promotions' didn't exist in the JSON data of a game, the module would stop checking the rest of data
  • Loading branch information
Axyss committed Feb 11, 2021
1 parent d34d444 commit 549f56c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion AutomatiK files/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def reload_modules():

class Client(commands.Bot, LangManager, ConfigManager):

VERSION = "v1.3"
VERSION = "v1.3.1"

def __init__(self, command_prefix, self_bot):
commands.Bot.__init__(self, command_prefix=command_prefix, self_bot=self_bot)
Expand Down
11 changes: 6 additions & 5 deletions AutomatiK files/modules/epic.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,14 @@ def process_request(self, raw_data):
try:
for i in raw_data:
# (i["price"]["totalPrice"]["discountPrice"] == i["price"]["totalPrice"]["originalPrice"]) != 0
if i["promotions"]["promotionalOffers"]:
game = Game(i["title"], str(self.URL + i["productSlug"]))
processed_data.append(game)
try:
if i["promotions"]["promotionalOffers"]:
game = Game(i["title"], str(self.URL + i["productSlug"]))
processed_data.append(game)
except TypeError: # This gets executed when ["promotionalOffers"] is empty or does not exist
pass
except KeyError:
logger.exception(f"Data from module \'{self.MODULE_ID}\' couldn't be processed")
except TypeError: # This gets executed when ["promotionalOffers"] is empty or does not exist
pass

return processed_data

Expand Down

0 comments on commit 549f56c

Please sign in to comment.