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:
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.")
|
||||
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()
|
||||
|
|
Loading…
Reference in a new issue