aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/fun/game.py
diff options
context:
space:
mode:
authorGravatar ChrisJL <[email protected]>2023-11-08 11:50:10 +0000
committerGravatar GitHub <[email protected]>2023-11-08 11:50:10 +0000
commit9a1b5f49e500d01e879a017b055a5fceff746df8 (patch)
tree5986c80aca7158e13b19a59f75cc3a6ca6d0f53e /bot/exts/fun/game.py
parentBump rapidfuzz from 3.4.0 to 3.5.2 (#1394) (diff)
parentFormat code with new ruff rules (diff)
Merge pull request #1389 from python-discord/dependabot/pip/ruff-0.1.3
Bump ruff from 0.0.292 to 0.1.3
Diffstat (limited to 'bot/exts/fun/game.py')
-rw-r--r--bot/exts/fun/game.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/bot/exts/fun/game.py b/bot/exts/fun/game.py
index b2b18f04..c9824f22 100644
--- a/bot/exts/fun/game.py
+++ b/bot/exts/fun/game.py
@@ -421,13 +421,13 @@ class Games(Cog):
"url": data["url"],
"description": f"{data['summary']}\n\n" if "summary" in data else "\n",
"release_date": release_date,
- "rating": round(data["total_rating"] if "total_rating" in data else 0, 2),
- "rating_count": data["total_rating_count"] if "total_rating_count" in data else "?",
+ "rating": round(data.get("total_rating", 0), 2),
+ "rating_count": data.get("total_rating_count", "?"),
"platforms": ", ".join(platform["name"] for platform in data["platforms"]) if "platforms" in data else "?",
"status": GameStatus(data["status"]).name if "status" in data else "?",
"age_ratings": rating,
"made_by": ", ".join(companies),
- "storyline": data["storyline"] if "storyline" in data else ""
+ "storyline": data.get("storyline", "")
}
page = GAME_PAGE.format(**formatting)
@@ -448,7 +448,7 @@ class Games(Cog):
formatting = {
"name": game["name"],
"url": game["url"],
- "rating": round(game["total_rating"] if "total_rating" in game else 0, 2),
+ "rating": round(game.get("total_rating", 0), 2),
"rating_count": game["total_rating_count"] if "total_rating" in game else "?"
}
line = GAME_SEARCH_LINE.format(**formatting)