mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-24 03:54:20 +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:
|
if rank != oldrank:
|
||||||
# Send the message
|
# Send the message
|
||||||
loop.create_task(send_event(eventmsg=s.overwatch_rank_change,
|
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"])))
|
rank=rank, medal=overwatch.url_to_medal(r["data"]["competitive"]["rank_img"])))
|
||||||
# Update database
|
# Update database
|
||||||
db[player]["overwatch"]["rank"] = rank
|
db[player]["overwatch"]["rank"] = rank
|
||||||
|
|
|
@ -72,3 +72,9 @@ def url_to_medal(rank: str):
|
||||||
return s.overwatch_medal_list[6]
|
return s.overwatch_medal_list[6]
|
||||||
else:
|
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)
|
Loading…
Reference in a new issue