Pull real stats if present

This commit is contained in:
joe 2020-12-29 13:10:57 -08:00
parent 760b39ec3b
commit ce87683957
2 changed files with 3 additions and 2 deletions

View File

@ -5,7 +5,7 @@ import database as db
onomancer_url = "https://onomancer.sibr.dev/api/" onomancer_url = "https://onomancer.sibr.dev/api/"
name_stats_hook = "generateStats2?name=" name_stats_hook = "getOrGenerateStats?name="
collection_hook = "getCollection?token=" collection_hook = "getCollection?token="
def get_stats(name): def get_stats(name):
@ -35,4 +35,4 @@ def get_collection(collection_url):
for player in response.json()['lineup'] + response.json()['rotation']: for player in response.json()['lineup'] + response.json()['rotation']:
db.cache_stats(player['name'], json.dumps(player)) db.cache_stats(player['name'], json.dumps(player))
return json.dumps(response.json()) return json.dumps(response.json())

View File

@ -189,6 +189,7 @@ if you did it correctly, you'll get a team embed with a prompt to confirm. hit t
async def execute(self, msg, command): async def execute(self, msg, command):
if db.get_team(command.split('\n',1)[1].split("\n")[0]) == None: if db.get_team(command.split('\n',1)[1].split("\n")[0]) == None:
await msg.channel.send(f"Fetching players...")
team = team_from_message(command) team = team_from_message(command)
save_task = asyncio.create_task(save_team_confirm(msg, team)) save_task = asyncio.create_task(save_team_confirm(msg, team))
await save_task await save_task