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:
parent
fcdd2a9685
commit
94f0972c5b
2 changed files with 8 additions and 2 deletions
2
main.py
2
main.py
|
@ -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
|
||||
|
|
|
@ -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)
|
Loading…
Reference in a new issue