mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
Improved league of legends level up code
This commit is contained in:
parent
355bdeacf0
commit
74e25c81a5
1 changed files with 6 additions and 7 deletions
13
main.py
13
main.py
|
@ -151,17 +151,16 @@ async def league_level_up(timeout):
|
||||||
print("[League] Request returned an unhandled exception.")
|
print("[League] Request returned an unhandled exception.")
|
||||||
else:
|
else:
|
||||||
# Check for level changes
|
# Check for level changes
|
||||||
|
level = r["summonerLevel"]
|
||||||
try:
|
try:
|
||||||
level = db[player]["league"]["level"]
|
old_level = db[player]["league"]["level"]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
old_level = 0
|
||||||
if "level" not in db[player]["league"] or r["summonerLevel"] > :
|
if level > old_level:
|
||||||
# Send the message
|
# Send the message
|
||||||
loop.create_task(send_event(eventmsg=s.league_level_up,
|
loop.create_task(send_event(eventmsg=s.league_level_up, player=player, level=level))
|
||||||
player=player,
|
|
||||||
level=r["summonerLevel"]))
|
|
||||||
# Update database
|
# Update database
|
||||||
db[player]["league"]["level"] = r["summonerLevel"]
|
db[player]["league"]["level"] = level
|
||||||
f = open("db.json", "w")
|
f = open("db.json", "w")
|
||||||
json.dump(db, f)
|
json.dump(db, f)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
Loading…
Reference in a new issue