1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 13:34:28 +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

@ -72,3 +72,9 @@ def url_to_medal(rank: str):
return s.overwatch_medal_list[6]
else:
raise NotFoundException("The medal does not exist.")
def format_rankchange(rankchange: int):
if rankchange < 0:
return "+" + str(rankchange)
else:
return str(rankchange)