1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-24 03:54:20 +00:00

fixed the most annoying bug ever

This commit is contained in:
Steffo 2018-12-18 19:45:08 +01:00
parent 3bbd2ed88f
commit 18843bb265

8
db.py
View file

@ -593,19 +593,19 @@ class Overwatch(Base):
try: try:
j = r.json()["eu"]["stats"].get("competitive") j = r.json()["eu"]["stats"].get("competitive")
if j is None: if j is None:
logging.debug(f"No stats for {repr(self)}, skipping...") logger.debug(f"No stats for {repr(self)}, skipping...")
return return
if not j["game_stats"]: if not j["game_stats"]:
logging.debug(f"No stats for {repr(self)}, skipping...") logger.debug(f"No stats for {repr(self)}, skipping...")
return return
j = j["overall_stats"] j = j["overall_stats"]
except TypeError: except TypeError:
logging.debug(f"No stats for {repr(self)}, skipping...") logger.debug(f"No stats for {repr(self)}, skipping...")
return return
try: try:
self.icon = re.search(r"https://.+\.cloudfront\.net/game/unlocks/(0x[0-9A-F]+)\.png", j["avatar"]).group(1) self.icon = re.search(r"https://.+\.cloudfront\.net/game/unlocks/(0x[0-9A-F]+)\.png", j["avatar"]).group(1)
except AttributeError: except AttributeError:
logging.debug(f"No icon available for {repr(self)}.") logger.debug(f"No icon available for {repr(self)}.")
self.level = j["prestige"] * 100 + j["level"] self.level = j["prestige"] * 100 + j["level"]
self.rank = j["comprank"] self.rank = j["comprank"]