1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Display a plus if the overwatch rank change is positive

This commit is contained in:
Steffo 2017-01-09 08:39:13 +01:00
parent fcdd2a9685
commit 94f0972c5b
2 changed files with 8 additions and 2 deletions

View file

@ -72,7 +72,7 @@ async def overwatch_status_change(timeout):
if rank != oldrank:
# Send the message
loop.create_task(send_event(eventmsg=s.overwatch_rank_change,
player=player, change=rank-oldrank,
player=player, change=overwatch.format_rankchange(rank-oldrank),
rank=rank, medal=overwatch.url_to_medal(r["data"]["competitive"]["rank_img"])))
# Update database
db[player]["overwatch"]["rank"] = rank

View file

@ -71,4 +71,10 @@ def url_to_medal(rank: str):
elif rank == "https://blzgdapipro-a.akamaihd.net/game/rank-icons/season-2/rank-7.png":
return s.overwatch_medal_list[6]
else:
raise NotFoundException("The medal does not exist.")
raise NotFoundException("The medal does not exist.")
def format_rankchange(rankchange: int):
if rankchange < 0:
return "+" + str(rankchange)
else:
return str(rankchange)