From 1197bbbccc198bf9b1012d6e3f0d0e8ad2b738f0 Mon Sep 17 00:00:00 2001 From: Sakimori Date: Thu, 24 Dec 2020 05:18:29 -0500 Subject: [PATCH] removed a debug print, added startgame with 2 saved teams --- database.py | 1 - the_prestige.py | 18 +++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/database.py b/database.py index 82dd7dd..0bf7e36 100644 --- a/database.py +++ b/database.py @@ -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() diff --git a/the_prestige.py b/the_prestige.py index 0bcedbd..b520728 100644 --- a/the_prestige.py +++ b/the_prestige.py @@ -114,9 +114,21 @@ async def on_message(msg): - elif command == "startgame" and msg.author.id in config()["owners"]: - game_task = asyncio.create_task(watch_game(msg.channel)) - await game_task + 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"]: for game in gamesarray: