mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 11:34:18 +00:00
Now it works
This commit is contained in:
parent
d796c69242
commit
ac62ac1897
3 changed files with 13 additions and 20 deletions
21
main.py
21
main.py
|
@ -5,7 +5,6 @@ import json
|
|||
import opendota
|
||||
import overwatch
|
||||
import league
|
||||
import steam
|
||||
import strings as s
|
||||
import telegram
|
||||
import bs4
|
||||
|
@ -241,7 +240,7 @@ async def opendota_last_match(timeout):
|
|||
for player in db:
|
||||
try:
|
||||
# TODO: Se uno non ha mai giocato a dota, cosa succede? Aggiungere handling
|
||||
r = await opendota.get_latest_match(steam.convert_sid_1_3(db[player]["steam"]["steamid"]))
|
||||
r = await opendota.get_latest_match(db[player]["steam"]["steamid"])
|
||||
except KeyError:
|
||||
continue
|
||||
else:
|
||||
|
@ -288,18 +287,20 @@ async def send_event(eventmsg: str, player: str, **kwargs):
|
|||
# Send the message
|
||||
loop.create_task(telegram.send_message(msg, -2141322))
|
||||
|
||||
loop.create_task(overwatch_status_change(600))
|
||||
print("[Overwatch] Added level up check to the queue.")
|
||||
#loop.create_task(overwatch_status_change(600))
|
||||
#print("[Overwatch] Added level up check to the queue.")
|
||||
|
||||
loop.create_task(league_rank_change(900))
|
||||
print("[League] Added rank change check to the queue.")
|
||||
#loop.create_task(league_rank_change(900))
|
||||
#print("[League] Added rank change check to the queue.")
|
||||
|
||||
loop.create_task(league_level_up(900))
|
||||
print("[League] Added level change check to the queue.")
|
||||
#loop.create_task(league_level_up(900))
|
||||
#print("[League] Added level change check to the queue.")
|
||||
|
||||
loop.create_task(brawlhalla_update_mmr(7200))
|
||||
print("[Brawlhalla] Added mmr change check to the queue.")
|
||||
#loop.create_task(brawlhalla_update_mmr(7200))
|
||||
#print("[Brawlhalla] Added mmr change check to the queue.")
|
||||
|
||||
loop.create_task(opendota_last_match(600))
|
||||
print("[OpenDota] Added last match check to the queue.")
|
||||
|
||||
try:
|
||||
loop.run_until_complete(d_client.start(token))
|
||||
|
|
|
@ -2,7 +2,8 @@ import asyncio
|
|||
import requests
|
||||
loop = asyncio.get_event_loop()
|
||||
|
||||
async def get_latest_match(steamidtre: int):
|
||||
async def get_latest_match(steamidtre: str):
|
||||
steamidtre = steamidtre[1:-1].split(":")[2]
|
||||
print("[OpenDota] Getting latest match for: {steamid}".format(steamid=steamidtre))
|
||||
r = await loop.run_in_executor(None, requests.get, 'https://api.opendota.com/api/players/{steamidtre}/matches?limit=1'.format(steamidtre=steamidtre))
|
||||
if r.status_code == 200:
|
||||
|
|
9
steam.py
9
steam.py
|
@ -1,9 +0,0 @@
|
|||
def convert_sid_1_3(steamid: int, group=False):
|
||||
"""Convert SteamID1 to SteamID3"""
|
||||
accuniverse = steamid % 2
|
||||
if group:
|
||||
acctype = 0x0170000000000000
|
||||
else:
|
||||
acctype = 0x0110000100000000
|
||||
accid = (steamid - acctype - accuniverse) / 2
|
||||
return accid
|
Loading…
Reference in a new issue