mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
Improved timeouts
This commit is contained in:
parent
1f16ecf0c8
commit
3de55d688b
1 changed files with 8 additions and 4 deletions
12
main.py
12
main.py
|
@ -22,8 +22,8 @@ file.close()
|
||||||
# Every timeout seconds, update player status and check for levelups
|
# Every timeout seconds, update player status and check for levelups
|
||||||
async def overwatch_level_up(timeout):
|
async def overwatch_level_up(timeout):
|
||||||
while True:
|
while True:
|
||||||
# Wait for the timeout
|
# Wait for the Discord client to be ready
|
||||||
await asyncio.sleep(timeout)
|
await d_client.wait_until_ready()
|
||||||
print("Checking for Overwatch updates.")
|
print("Checking for Overwatch updates.")
|
||||||
# Update data for every player in list
|
# Update data for every player in list
|
||||||
for player in db:
|
for player in db:
|
||||||
|
@ -44,12 +44,14 @@ async def overwatch_level_up(timeout):
|
||||||
json.dump(db, f)
|
json.dump(db, f)
|
||||||
f.close()
|
f.close()
|
||||||
print("Check for Overwatch completed.")
|
print("Check for Overwatch completed.")
|
||||||
|
# Wait for the timeout
|
||||||
|
await asyncio.sleep(timeout)
|
||||||
|
|
||||||
# Every timeout seconds, update player league and check for rank changes
|
# Every timeout seconds, update player league and check for rank changes
|
||||||
async def league_rank_change(timeout):
|
async def league_rank_change(timeout):
|
||||||
while True:
|
while True:
|
||||||
# Wait for the timeout
|
# Wait for the Discord client to be ready
|
||||||
await asyncio.sleep(timeout)
|
await d_client.wait_until_ready()
|
||||||
print("Checking for League of Legends updates.")
|
print("Checking for League of Legends updates.")
|
||||||
# Update data for every player in list
|
# Update data for every player in list
|
||||||
for player in db:
|
for player in db:
|
||||||
|
@ -82,6 +84,8 @@ async def league_rank_change(timeout):
|
||||||
json.dump(db, f)
|
json.dump(db, f)
|
||||||
f.close()
|
f.close()
|
||||||
print("Check for League of Legends completed.")
|
print("Check for League of Legends completed.")
|
||||||
|
# Wait for the timeout
|
||||||
|
await asyncio.sleep(timeout)
|
||||||
|
|
||||||
print("Added Overwatch to the queue.")
|
print("Added Overwatch to the queue.")
|
||||||
loop.create_task(overwatch_level_up(900))
|
loop.create_task(overwatch_level_up(900))
|
||||||
|
|
Loading…
Reference in a new issue