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

Improved league of legends level up code

This commit is contained in:
Steffo 2016-11-08 15:06:01 +01:00
parent 355bdeacf0
commit 74e25c81a5

13
main.py
View file

@ -151,17 +151,16 @@ async def league_level_up(timeout):
print("[League] Request returned an unhandled exception.")
else:
# Check for level changes
level = r["summonerLevel"]
try:
level = db[player]["league"]["level"]
old_level = db[player]["league"]["level"]
except KeyError:
if "level" not in db[player]["league"] or r["summonerLevel"] > :
old_level = 0
if level > old_level:
# Send the message
loop.create_task(send_event(eventmsg=s.league_level_up,
player=player,
level=r["summonerLevel"]))
loop.create_task(send_event(eventmsg=s.league_level_up, player=player, level=level))
# Update database
db[player]["league"]["level"] = r["summonerLevel"]
db[player]["league"]["level"] = level
f = open("db.json", "w")
json.dump(db, f)
f.close()