diff --git a/main.py b/main.py index 223ea886..f92933fa 100644 --- a/main.py +++ b/main.py @@ -61,6 +61,8 @@ async def overwatch_status_change(timeout): if r["data"]["competitive"]["rank"] is not None: if "rank" not in db[player]["overwatch"] \ or int(r["data"]["competitive"]["rank"]) != db[player]["overwatch"]["rank"]: + if "rank" not in db[player]["overwatch"]: + db[player]["overwatch"]["rank"] = 0 # Send the message loop.create_task(send_event(eventmsg=s.overwatch_rank_change, player=player, diff --git a/overwatch.py b/overwatch.py index 41133f0b..4de8e41d 100644 --- a/overwatch.py +++ b/overwatch.py @@ -35,15 +35,17 @@ async def get_player_data(platform: str, region: str, battletag: str, **kwargs): # Convert rank to a medal def rank_to_medal(rank): - if int(rank) < 1500: + if int(rank) == 0: return s.overwatch_medal_list[0] - elif int(rank) < 2000: + if int(rank) < 1500: return s.overwatch_medal_list[1] - elif int(rank) < 2500: + elif int(rank) < 2000: return s.overwatch_medal_list[2] - elif int(rank) < 3000: + elif int(rank) < 2500: return s.overwatch_medal_list[3] - elif int(rank) < 3500: + elif int(rank) < 3000: return s.overwatch_medal_list[4] - elif int(rank) < 4000: + elif int(rank) < 3500: return s.overwatch_medal_list[5] + elif int(rank) < 4000: + return s.overwatch_medal_list[6] diff --git a/strings.py b/strings.py index 15375cba..ac576575 100644 --- a/strings.py +++ b/strings.py @@ -7,7 +7,8 @@ overwatch_level_up = "{player} è salito al livello **{level}** su _Overwatch_!" overwatch_rank_change = "{player} è passato da {oldmedal} {oldrank} a **{medal} {division}** su _Overwatch_!" # Overwatch: Medal list -overwatch_medal_list = ["Bronzo", +overwatch_medal_list = ["Nulla", + "Bronzo", "Argento", "Oro", "Platino",