Update players.py

Wipe old games when voice channels are closed
This commit is contained in:
Cal Corum 2023-09-11 15:14:25 -05:00
parent 74e4926558
commit c29838104a

View File

@ -164,6 +164,7 @@ class Players(commands.Cog):
if len(self.voice_channels) > 0:
game_strings = []
for x in self.scorecards.values():
await asyncio.sleep(1)
game_strings.append(x.get_value('A1'))
if len(game_strings) > 0:
@ -176,13 +177,14 @@ class Players(commands.Cog):
await score_channel.set_permissions(player_role, read_messages=True)
await score_channel.send(content=None, embed=embed)
return
else:
self.scorecards = {}
await score_channel.set_permissions(player_role, read_messages=False)
except Exception as e:
await send_to_channel(self.bot, 'commissioners-office', f'Could not update live scorecard:\n\n{e}')
logging.error(f'Could not update live scorecard: {e}')
@staticmethod
async def update_injuries(ctx):
current = await db_get('current')