removed a debug print, added startgame with 2 saved teams

This commit is contained in:
Sakimori 2020-12-24 05:18:29 -05:00
parent ab8151206b
commit 1197bbbccc
2 changed files with 15 additions and 4 deletions

View File

@ -214,7 +214,6 @@ def get_team(name):
team = c.fetchone()
conn.close()
print(team[2])
return team[2] #returns a json string
conn.close()

View File

@ -114,8 +114,20 @@ async def on_message(msg):
elif command == "startgame" and msg.author.id in config()["owners"]:
game_task = asyncio.create_task(watch_game(msg.channel))
elif command.startswith("startgame\n") and msg.author.id in config()["owners"]:
try:
team1 = games.get_team(command.split("\n")[1])
team2 = games.get_team(command.split("\n")[2])
innings = int(command.split("\n")[3])
except IndexError:
await msg.channel.send("We need four lines: startgame, away team, home team, and the number of innings.")
return
except:
await msg.channel.send("Something about that command tripped us up. Probably the number of innings at the end?")
if team1 is not None and team2 is not None:
game = games.game(msg.author.name, team1, team2, length=innings)
game_task = asyncio.create_task(watch_game(msg.channel, game))
await game_task
elif command.startswith("setupgame") and msg.author.id in config()["owners"]: