Skip to content

Commit

Permalink
Merge pull request #1226 from newton-miku/main
Browse files Browse the repository at this point in the history
修复epic报错,优化简介
  • Loading branch information
HibiKier committed Dec 31, 2022
2 parents cb7527a + a3d1038 commit def53aa
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions plugins/epic/data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,15 @@ async def get_epic_free(bot: Bot, type_event: str):
if pair["key"] == "publisherName":
game_pub = pair["value"]
if game.get("productSlug"):
gamesDesp = await get_epic_game_desp(game["productSlug"])
#game_desp = game["description"]
game_desp = gamesDesp["description"]
gamesDesp = await get_epic_game_desp(game["productSlug"])
try:
#是否存在简短的介绍
if "shortDescription" in gamesDesp:
game_desp = gamesDesp["shortDescription"]
except KeyError:
game_desp = gamesDesp["description"]
else:
game_desp = game["description"]
try:
end_date_iso = game["promotions"]["promotionalOffers"][0][
"promotionalOffers"
Expand Down Expand Up @@ -187,4 +193,4 @@ async def get_epic_free(bot: Bot, type_event: str):
except TypeError as e:
# logger.info(str(e))
pass
return msg_list, 200
return msg_list, 200

0 comments on commit def53aa

Please sign in to comment.