diff --git a/brawlhalla.py b/brawlhalla.py index 2bb1fb6c..6283d16c 100644 --- a/brawlhalla.py +++ b/brawlhalla.py @@ -1,11 +1,10 @@ import asyncio import requests -import bs4 loop = asyncio.get_event_loop() # Get ladder page for a player async def get_leaderboard_for(name: str): - print("[Brawlhalla] Getting leaderboards page for {name}".format(name=name)) + print("[Brawlhalla] Getting leaderboards page for: {name}".format(name=name)) # Get leaderboards page for that name r = await loop.run_in_executor(None, requests.get, "http://www.brawlhalla.com/rankings/1v1/eu/?p={name}".format(name=name)) diff --git a/main.py b/main.py index 5a4d2980..8050a37a 100644 --- a/main.py +++ b/main.py @@ -94,7 +94,9 @@ async def league_rank_change(timeout): loop.create_task(send_event(eventmsg=s.league_rank_up, player=player, tier=s.league_tier_list[tier_number], - division=r["entries"][0]["division"])) + division=r["entries"][0]["division"], + oldtier=db[player]["league"]["tier"], + olddivision=db[player]["league"]["division"])) # Update database db[player]["league"]["tier"] = tier_number db[player]["league"]["division"] = roman_number @@ -185,7 +187,8 @@ async def brawlhalla_update_mmr(timeout): # Compare the mmr with the value saved in the database if mmr != db[player]["brawlhalla"]["mmr"]: # Send a message - loop.create_task(send_event(s.brawlhalla_new_mmr, player, mmr=mmr)) + loop.create_task(send_event(s.brawlhalla_new_mmr, player, mmr=mmr, + oldmmr=db[player]["brawlhalla"]["mmr"])) # Update database db[player]["brawlhalla"]["mmr"] = mmr f = open("db.json", "w") diff --git a/strings.py b/strings.py index 66959787..77ee31e6 100644 --- a/strings.py +++ b/strings.py @@ -4,7 +4,7 @@ overwatch_level_up = "{player} è salito al livello **{level}** su _Overwatch_!" # League of Legends: Rank up! -league_rank_up = "{player} è salito alla divisione **{tier} {division}** su _League of Legends_!" +league_rank_up = "{player} è passato da {oldtier} {olddivision} a **{tier} {division}** su _League of Legends_!" # League of Legends: Tier list league_tier_list = ["Bronzo", @@ -19,4 +19,4 @@ league_tier_list = ["Bronzo", league_level_up = "{player} è salito al livello **{level}** su _League of Legends_!" # Brawlhalla: new MMR -brawlhalla_new_mmr = "{player} ora ha **{mmr}** MMR su _Brawlhalla_!" +brawlhalla_new_mmr = "{player} è passato da {oldmmr} MMR a **{mmr}** MMR su _Brawlhalla_!" diff --git a/telegram.py b/telegram.py index fd2ecb33..f6d41603 100644 --- a/telegram.py +++ b/telegram.py @@ -22,4 +22,4 @@ async def send_message(msg: str, to: int): if r.status_code == 200: return else: - raise Exception("Qualcosa è andato storto su Telegram. Ops.") + raise Exception("Something went wrong in the Telegram request.")