Update players.py

Added timeout to standings recalc
Exclude Final games from live scores update
This commit is contained in:
Cal Corum 2023-10-17 21:18:38 -05:00
parent 3c4f47f005
commit fe1a514358

View File

@ -165,7 +165,9 @@ class Players(commands.Cog):
game_strings = []
for x in self.scorecards.values():
await asyncio.sleep(1)
game_strings.append(x.get_value('A1'))
this_string = x.get_value('A1')
if ' F' not in this_string:
game_strings.append(this_string)
if len(game_strings) > 0:
# Clear old messages
@ -177,10 +179,10 @@ 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 = {}
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}')
@ -1570,7 +1572,7 @@ class Players(commands.Cog):
)
update = await interaction.channel.send('I\'m tallying standings now...')
if await db_post(f'standings/s{current["season"]}/recalculate'):
if await db_post(f'standings/s{current["season"]}/recalculate', timeout=8):
await update.delete()
await interaction.edit_original_response(content='You are all set!')