1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 13:34:28 +00:00

Tieni anche i nomi utente di LoL nel database

This commit is contained in:
Steffo 2017-02-20 11:12:46 +01:00
parent da96eb1bbf
commit 1dc5731ead

View file

@ -143,7 +143,7 @@ async def league_rank_change(timeout):
async def league_level_up(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: while True:
if discord_is_ready: if discord_is_ready:
print("[League] Starting check for level changes...") 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 # If some other error occours, skip the player
print("[League] Request returned an unhandled exception.") print("[League] Request returned an unhandled exception.")
else: else:
# Update summoner name
name = r["name"]
db[player]["league"]["name"] = name
# Check for level changes # Check for level changes
level = r["summonerLevel"] level = r["summonerLevel"]
try: 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)) loop.create_task(send_event(eventmsg=s.league_level_up, player=player, level=level))
# Update database # Update database
db[player]["league"]["level"] = level db[player]["league"]["level"] = level
save_db() save_db()
finally: finally:
# Prevent getting ratelimited by Riot # Prevent getting ratelimited by Riot
await asyncio.sleep(2) await asyncio.sleep(2)