From dbef439f762f03ae8f73312b85568c8f50e35dd9 Mon Sep 17 00:00:00 2001 From: Sakimori Date: Sat, 26 Dec 2020 21:15:19 -0500 Subject: [PATCH 1/3] cleanup after setupgame timeout properly --- the_prestige.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/the_prestige.py b/the_prestige.py index 9e9113a..64ec1b9 100644 --- a/the_prestige.py +++ b/the_prestige.py @@ -326,6 +326,8 @@ Creator, type `{newgame.name} done` to finalize lineups.""") msg = await client.wait_for('message', timeout=120.0, check=messagecheck) except asyncio.TimeoutError: await channel.send("Game timed out. 120 seconds between players is a bit much, see?") + del setupmessages[team_join_message] + del newgame return new_player = None From 7f5df5b47b55ab17fd56f7026943f9cbec2af1fa Mon Sep 17 00:00:00 2001 From: Sakimori Date: Sat, 26 Dec 2020 21:21:43 -0500 Subject: [PATCH 2/3] fixed the math for extra innings --- the_prestige.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/the_prestige.py b/the_prestige.py index 64ec1b9..8fcc175 100644 --- a/the_prestige.py +++ b/the_prestige.py @@ -483,8 +483,8 @@ async def watch_game(channel, game): await asyncio.sleep(6) title_string = f"{newgame.teams['away'].name} at {newgame.teams['home'].name} ended after {newgame.inning} innings" - if newgame.inning > (newgame.max_innings - 1): #if extra innings - title_string += f" with {newgame.inning - (newgame.max_innings-1)} extra innings." + if (newgame.inning - 1) > newgame.max_innings: #if extra innings + title_string += f" with {newgame.inning - (newgame.max_innings+1)} extra innings." else: title_string += "." From 663fc6c3f60fd4b89536945481539f9111d0a35c Mon Sep 17 00:00:00 2001 From: Sakimori Date: Sat, 26 Dec 2020 21:36:39 -0500 Subject: [PATCH 3/3] added countactivegames admin command --- the_prestige.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/the_prestige.py b/the_prestige.py index 8fcc175..b9427aa 100644 --- a/the_prestige.py +++ b/the_prestige.py @@ -156,7 +156,7 @@ async def on_message(msg): return for game in gamesarray: - if game[0].name == msg.author.name: + if game.name == msg.author.name: await msg.channel.send("You've already got a game in progress! Wait a tick, boss.") return try: @@ -231,6 +231,9 @@ if you did it correctly, you'll get a team embed with a prompt to confirm. Hit t text = "Can't find that command, boss; try checking the list with `m;help`." await msg.channel.send(text) + elif command == "countactivegames" and msg.author.id in config()["owners"]: + await msg.channel.send(f"There's {len(gamesarray)} active games right now, boss.") + @@ -395,11 +398,7 @@ async def watch_game(channel, game): await asyncio.sleep(1) await embed.pin() await asyncio.sleep(1) - use_emoji_names = True - for game in gamesarray: - if game[1]: - use_emoji_names = False - gamesarray.append((newgame,use_emoji_names)) + gamesarray.append(newgame) pause = 0 top_of_inning = True victory_lap = False @@ -506,7 +505,7 @@ async def watch_game(channel, game): await embed.edit(content=None, embed=final_embed) await embed.unpin() - gamesarray.pop(gamesarray.index((newgame,use_emoji_names))) #cleanup is important! + gamesarray.pop(gamesarray.index(newgame)) #cleanup is important! newgame.add_stats() del newgame