Update !private command for new API

This commit is contained in:
Cal Corum 2023-09-07 13:29:11 -05:00
parent 0ff70c8f77
commit 6eac0d50f3

View File

@ -1704,22 +1704,21 @@ class Players(commands.Cog):
await ctx.send('Hmm...I can\'t find your team. Are you from around here?')
return
s_query = await db_get('schedules', params=[
('season', current['season']), ('team_abbrev', this_team['abbrev']), ('week_start', current['week']),
('week_end', current['week']), ('short_output', False)
g_query = await db_get('games', params=[
('season', current['season']), ('week', current['week']), ('team1_id', this_team['id'])
])
if s_query['count'] == 0:
if g_query['count'] == 0:
other_team = await get_other_team()
if not other_team:
await ctx.send(f'Idk who you are playing this week.')
channel_name = f'{this_team["abbrev"]} vs {other_team["abbrev"]} Muted'
else:
this_matchup = s_query['schedules'][0]
if this_team == this_matchup['awayteam']:
other_team = this_matchup['hometeam']
this_game = g_query['games'][0]
if this_team == this_game['away_team']:
other_team = this_game['home_team']
else:
other_team = this_matchup['awayteam']
channel_name = f'{this_matchup["awayteam"]["sname"]} @ {this_matchup["hometeam"]["sname"]} Muted'
other_team = this_game['away_team']
channel_name = f'{this_game["away_team"]["sname"]} @ {this_game["home_team"]["sname"]} Muted'
prompt = f'Would you like to get a private voice channel for {this_team["abbrev"]} and {other_team["abbrev"]}?'
this_q = Question(self.bot, ctx.channel, prompt, qtype='yesno', timeout=15)