From 1dc5731eadd9a88af658358b5588f33e422ac887 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Mon, 20 Feb 2017 11:12:46 +0100 Subject: [PATCH] Tieni anche i nomi utente di LoL nel database --- main.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 29aaa78a..031bd340 100644 --- a/main.py +++ b/main.py @@ -143,7 +143,7 @@ async def league_rank_change(timeout): async def league_level_up(timeout): - """Check for League of Legends profile level ups.""" + """Check for League of Legends profile level ups and name changes.""" while True: if discord_is_ready: print("[League] Starting check for level changes...") @@ -159,6 +159,9 @@ async def league_level_up(timeout): # If some other error occours, skip the player print("[League] Request returned an unhandled exception.") else: + # Update summoner name + name = r["name"] + db[player]["league"]["name"] = name # Check for level changes level = r["summonerLevel"] try: @@ -170,7 +173,7 @@ async def league_level_up(timeout): loop.create_task(send_event(eventmsg=s.league_level_up, player=player, level=level)) # Update database db[player]["league"]["level"] = level - save_db() + save_db() finally: # Prevent getting ratelimited by Riot await asyncio.sleep(2)