Update gameplay.py
Update name reference for new get_player function
This commit is contained in:
parent
e77172d1c3
commit
296b9ec486
@ -67,8 +67,8 @@ class Gameplay(commands.Cog):
|
||||
valid_scores = True
|
||||
channel = guild.get_channel(gs["channel_id"])
|
||||
g_message = gs['scorebug']
|
||||
g_message += f'Pitcher: {gs["pitcher"]["name"]}\n' \
|
||||
f'Batter: {gs["batter"]["name"]}\n' \
|
||||
g_message += f'Pitcher: {gs["pitcher"]["p_name"]}\n' \
|
||||
f'Batter: {gs["batter"]["p_name"]}\n' \
|
||||
f'Location: {channel.mention if channel is not None else "Your Butt"}\n' \
|
||||
f'-------------------------'
|
||||
gt_string = 'Unlimited'
|
||||
@ -582,7 +582,7 @@ class Gameplay(commands.Cog):
|
||||
runner = await get_player(this_game, this_play.on_third)
|
||||
view = Confirm(responders=[interaction.user], timeout=60, label_type='yes')
|
||||
question = await interaction.channel.send(
|
||||
f'Is {runner["name"]} out on the home-to-first double play?', view=view
|
||||
f'Is {runner["p_name"]} out on the home-to-first double play?', view=view
|
||||
)
|
||||
await view.wait()
|
||||
|
||||
@ -603,7 +603,7 @@ class Gameplay(commands.Cog):
|
||||
runner = await get_player(this_game, x)
|
||||
view = Confirm(responders=[interaction.user], timeout=60, label_type='yes')
|
||||
question = await interaction.channel.send(
|
||||
f'Was {runner["name"]} sent from {bases[count]} on the play?', view=view
|
||||
f'Was {runner["p_name"]} sent from {bases[count]} on the play?', view=view
|
||||
)
|
||||
await view.wait()
|
||||
|
||||
@ -612,7 +612,7 @@ class Gameplay(commands.Cog):
|
||||
await question.delete()
|
||||
view = Confirm(responders=[interaction.user], timeout=60, label_type='yes')
|
||||
question = await interaction.channel.send(
|
||||
f'Was {runner["name"]} thrown out?', view=view
|
||||
f'Was {runner["p_name"]} thrown out?', view=view
|
||||
)
|
||||
await view.wait()
|
||||
|
||||
@ -646,7 +646,7 @@ class Gameplay(commands.Cog):
|
||||
batter = await get_player(this_game, this_play.batter)
|
||||
view = Confirm(responders=[interaction.user], timeout=60, label_type='yes')
|
||||
question = await interaction.channel.send(
|
||||
f'Is {batter["name"]} out at first?', view=view
|
||||
f'Is {batter["p_name"]} out at first?', view=view
|
||||
)
|
||||
await view.wait()
|
||||
|
||||
@ -672,7 +672,7 @@ class Gameplay(commands.Cog):
|
||||
|
||||
view = Confirm(responders=[interaction.user], timeout=60, label_type='yes')
|
||||
question = await interaction.channel.send(
|
||||
f'Was {runner["name"]} sent from {from_base} on the play?', view=view
|
||||
f'Was {runner["p_name"]} sent from {from_base} on the play?', view=view
|
||||
)
|
||||
await view.wait()
|
||||
|
||||
@ -682,7 +682,7 @@ class Gameplay(commands.Cog):
|
||||
await question.delete()
|
||||
view = Confirm(responders=[interaction.user], timeout=60, label_type='yes')
|
||||
question = await interaction.channel.send(
|
||||
f'Was {runner["name"]} thrown out?', view=view
|
||||
f'Was {runner["p_name"]} thrown out?', view=view
|
||||
)
|
||||
await view.wait()
|
||||
|
||||
@ -714,7 +714,7 @@ class Gameplay(commands.Cog):
|
||||
runner = await get_player(this_game, x)
|
||||
view = Confirm(responders=[interaction.user], timeout=60, label_type='yes')
|
||||
question = await interaction.channel.send(
|
||||
f'Was {runner["name"]} sent from {bases[count]} on the play?', view=view
|
||||
f'Was {runner["p_name"]} sent from {bases[count]} on the play?', view=view
|
||||
)
|
||||
await view.wait()
|
||||
|
||||
@ -724,7 +724,7 @@ class Gameplay(commands.Cog):
|
||||
|
||||
view = Confirm(responders=[interaction.user], timeout=60, label_type='yes')
|
||||
question = await interaction.channel.send(
|
||||
f'Was {runner["name"]} thrown out?', view=view
|
||||
f'Was {runner["p_name"]} thrown out?', view=view
|
||||
)
|
||||
await view.wait()
|
||||
|
||||
@ -753,7 +753,7 @@ class Gameplay(commands.Cog):
|
||||
batter = await get_player(this_game, this_play.batter)
|
||||
view = Confirm(responders=[interaction.user], timeout=60, label_type='yes')
|
||||
question = await interaction.channel.send(
|
||||
f'Is {batter["name"]} out at first?', view=view
|
||||
f'Is {batter["p_name"]} out at first?', view=view
|
||||
)
|
||||
|
||||
await view.wait()
|
||||
@ -778,7 +778,7 @@ class Gameplay(commands.Cog):
|
||||
runner = await get_player(this_game, this_play.on_third)
|
||||
view = Confirm(responders=[interaction.user], timeout=60, label_type='yes')
|
||||
question = await interaction.channel.send(
|
||||
f'Is {runner["name"]} forced out at home?', view=view
|
||||
f'Is {runner["p_name"]} forced out at home?', view=view
|
||||
)
|
||||
await view.wait()
|
||||
|
||||
@ -799,7 +799,7 @@ class Gameplay(commands.Cog):
|
||||
runner = await get_player(this_game, x)
|
||||
view = Confirm(responders=[interaction.user], timeout=60, label_type='yes')
|
||||
question = await interaction.channel.send(
|
||||
f'Was {runner["name"]} sent from {bases[count]} on the play?', view=view
|
||||
f'Was {runner["p_name"]} sent from {bases[count]} on the play?', view=view
|
||||
)
|
||||
await view.wait()
|
||||
|
||||
@ -807,7 +807,7 @@ class Gameplay(commands.Cog):
|
||||
await question.delete()
|
||||
view = Confirm(responders=[interaction.user], timeout=60, label_type='yes')
|
||||
question = await interaction.channel.send(
|
||||
f'Was {runner["name"]} thrown out?', view=view
|
||||
f'Was {runner["p_name"]} thrown out?', view=view
|
||||
)
|
||||
await view.wait()
|
||||
|
||||
@ -875,7 +875,7 @@ class Gameplay(commands.Cog):
|
||||
runner = await get_player(this_game, this_play.on_second)
|
||||
view = Confirm(responders=[interaction.user], timeout=60, label_type='yes')
|
||||
question = await interaction.channel.send(
|
||||
f'Was {runner["name"]} sent from second on the play?\n\n{ai_hint}', view=view
|
||||
f'Was {runner["p_name"]} sent from second on the play?\n\n{ai_hint}', view=view
|
||||
)
|
||||
await view.wait()
|
||||
|
||||
@ -887,7 +887,7 @@ class Gameplay(commands.Cog):
|
||||
labels=['Tagged Up', 'Hold at 2nd', 'Out at 3rd', None, None]
|
||||
)
|
||||
question = await interaction.channel.send(
|
||||
f'What was the result of {runner["name"]} tagging from second?', view=view
|
||||
f'What was the result of {runner["p_name"]} tagging from second?', view=view
|
||||
)
|
||||
await view.wait()
|
||||
|
||||
@ -913,7 +913,7 @@ class Gameplay(commands.Cog):
|
||||
runner = await get_player(this_game, this_play.on_third)
|
||||
view = Confirm(responders=[interaction.user], timeout=60, label_type='yes')
|
||||
question = await interaction.channel.send(
|
||||
f'Was {runner["name"]} sent from third on the play?\n\n{ai_hint}', view=view
|
||||
f'Was {runner["p_name"]} sent from third on the play?\n\n{ai_hint}', view=view
|
||||
)
|
||||
await view.wait()
|
||||
|
||||
@ -922,7 +922,7 @@ class Gameplay(commands.Cog):
|
||||
|
||||
view = Confirm(responders=[interaction.user], timeout=60, label_type='yes')
|
||||
question = await interaction.channel.send(
|
||||
f'Was {runner["name"]} thrown out?', view=view
|
||||
f'Was {runner["p_name"]} thrown out?', view=view
|
||||
)
|
||||
await view.wait()
|
||||
|
||||
@ -2803,7 +2803,7 @@ class Gameplay(commands.Cog):
|
||||
pitcher = await get_player(this_game, curr_pitcher)
|
||||
view = Confirm(responders=[interaction.user], timeout=60, label_type='yes')
|
||||
question = await interaction.channel.send(
|
||||
f'It doesn\'t look like {pitcher["name"]} is fatigued - are you sure they should be subbed out?',
|
||||
f'It doesn\'t look like {pitcher["p_name"]} is fatigued - are you sure they should be subbed out?',
|
||||
view=view
|
||||
)
|
||||
await view.wait()
|
||||
@ -2921,7 +2921,7 @@ class Gameplay(commands.Cog):
|
||||
|
||||
view = Confirm(responders=[interaction.user], timeout=60, label_type='yes')
|
||||
question = await interaction.channel.send(
|
||||
f'Is {lead_runner["name"]} being sent {to_bases[lead_base]}?\n\n{ai_hint}', view=view
|
||||
f'Is {lead_runner["p_name"]} being sent {to_bases[lead_base]}?\n\n{ai_hint}', view=view
|
||||
)
|
||||
await view.wait()
|
||||
|
||||
@ -2947,7 +2947,7 @@ class Gameplay(commands.Cog):
|
||||
|
||||
view = Confirm(responders=[interaction.user], timeout=60, label_type='yes')
|
||||
question = await interaction.channel.send(
|
||||
f'Is {trail_runner["name"]} being sent {to_bases[trail_base]}?\n\n{ai_hint}', view=view
|
||||
f'Is {trail_runner["p_name"]} being sent {to_bases[trail_base]}?\n\n{ai_hint}', view=view
|
||||
)
|
||||
await view.wait()
|
||||
|
||||
@ -2972,7 +2972,7 @@ class Gameplay(commands.Cog):
|
||||
await question.delete()
|
||||
view = Confirm(responders=[interaction.user], timeout=60, label_type='yes')
|
||||
question = await interaction.channel.send(
|
||||
content=f'Was {lead_runner["name"]} thrown out {at_bases[lead_base]}?', view=view
|
||||
content=f'Was {lead_runner["p_name"]} thrown out {at_bases[lead_base]}?', view=view
|
||||
)
|
||||
await view.wait()
|
||||
|
||||
@ -2995,7 +2995,7 @@ class Gameplay(commands.Cog):
|
||||
await question.delete()
|
||||
view = Confirm(responders=[interaction.user], timeout=60, label_type='yes')
|
||||
question = await interaction.channel.send(
|
||||
content=f'Was {trail_runner["name"]} thrown out {at_bases[trail_base]}?', view=view
|
||||
content=f'Was {trail_runner["p_name"]} thrown out {at_bases[trail_base]}?', view=view
|
||||
)
|
||||
await view.wait()
|
||||
|
||||
@ -3018,7 +3018,7 @@ class Gameplay(commands.Cog):
|
||||
await question.delete()
|
||||
view = Confirm(responders=[interaction.user], timeout=60, label_type='yes')
|
||||
question = await interaction.channel.send(
|
||||
content=f'Was {lead_runner["name"]} thrown out {at_bases[lead_base]}?', view=view
|
||||
content=f'Was {lead_runner["p_name"]} thrown out {at_bases[lead_base]}?', view=view
|
||||
)
|
||||
await view.wait()
|
||||
|
||||
@ -3109,7 +3109,7 @@ class Gameplay(commands.Cog):
|
||||
runner_to_home = await get_player(this_game, this_play.on_first)
|
||||
view = Confirm(responders=[interaction.user], timeout=60, label_type='yes')
|
||||
question = await interaction.channel.send(
|
||||
f'Is {runner_to_home["name"]} being sent home?\n\n{ai_hint}', view=view
|
||||
f'Is {runner_to_home["p_name"]} being sent home?\n\n{ai_hint}', view=view
|
||||
)
|
||||
await view.wait()
|
||||
|
||||
@ -3137,7 +3137,7 @@ class Gameplay(commands.Cog):
|
||||
batter_runner = await get_player(this_game, this_play.batter)
|
||||
view = Confirm(responders=[interaction.user], timeout=60, label_type='yes')
|
||||
question = await interaction.channel.send(
|
||||
f'Is {batter_runner["name"]} being sent to third?\n\n{ai_hint}', view=view
|
||||
f'Is {batter_runner["p_name"]} being sent to third?\n\n{ai_hint}', view=view
|
||||
)
|
||||
await view.wait()
|
||||
|
||||
@ -3164,7 +3164,7 @@ class Gameplay(commands.Cog):
|
||||
await question.delete()
|
||||
view = Confirm(responders=[interaction.user], timeout=60, label_type='yes')
|
||||
question = await interaction.channel.send(
|
||||
content=f'Was {runner_to_home["name"]} thrown out at the plate?', view=view
|
||||
content=f'Was {runner_to_home["p_name"]} thrown out at the plate?', view=view
|
||||
)
|
||||
await view.wait()
|
||||
|
||||
@ -3185,7 +3185,7 @@ class Gameplay(commands.Cog):
|
||||
|
||||
view = Confirm(responders=[interaction.user], timeout=60, label_type='yes')
|
||||
question = await interaction.channel.send(
|
||||
content=f'Was {batter_runner["name"]} thrown out at third?', view=view
|
||||
content=f'Was {batter_runner["p_name"]} thrown out at third?', view=view
|
||||
)
|
||||
await view.wait()
|
||||
|
||||
@ -3206,7 +3206,7 @@ class Gameplay(commands.Cog):
|
||||
await question.delete()
|
||||
view = Confirm(responders=[interaction.user], timeout=60, label_type='yes')
|
||||
question = await interaction.channel.send(
|
||||
content=f'Was {runner_to_home["name"]} thrown out at the plate?', view=view
|
||||
content=f'Was {runner_to_home["p_name"]} thrown out at the plate?', view=view
|
||||
)
|
||||
await view.wait()
|
||||
|
||||
@ -3327,7 +3327,7 @@ class Gameplay(commands.Cog):
|
||||
if this_play.on_first:
|
||||
this_runner = await get_player(this_game, this_play.on_first)
|
||||
view = Confirm(responders=[interaction.user], timeout=60, label_type='yes')
|
||||
question = await interaction.channel.send(f'Was {this_runner["name"]} picked off?', view=view)
|
||||
question = await interaction.channel.send(f'Was {this_runner["p_name"]} picked off?', view=view)
|
||||
await view.wait()
|
||||
|
||||
if view.value:
|
||||
@ -3339,7 +3339,7 @@ class Gameplay(commands.Cog):
|
||||
if this_play.on_second and not runner_flag:
|
||||
this_runner = await get_player(this_game, this_play.on_second)
|
||||
view = Confirm(responders=[interaction.user], timeout=60, label_type='yes')
|
||||
question = await interaction.channel.send(f'Was {this_runner["name"]} picked off?', view=view)
|
||||
question = await interaction.channel.send(f'Was {this_runner["p_name"]} picked off?', view=view)
|
||||
await view.wait()
|
||||
|
||||
if view.value:
|
||||
@ -3351,7 +3351,7 @@ class Gameplay(commands.Cog):
|
||||
if this_play.on_third and not runner_flag:
|
||||
this_runner = await get_player(this_game, this_play.on_third)
|
||||
view = Confirm(responders=[interaction.user], timeout=60, label_type='yes')
|
||||
question = await interaction.channel.send(f'Was {this_runner["name"]} picked off?', view=view)
|
||||
question = await interaction.channel.send(f'Was {this_runner["p_name"]} picked off?', view=view)
|
||||
await view.wait()
|
||||
|
||||
if view.value:
|
||||
@ -3405,7 +3405,7 @@ class Gameplay(commands.Cog):
|
||||
else:
|
||||
this_runner = await get_player(this_game, this_play.on_second)
|
||||
await interaction.edit_original_response(
|
||||
content=f'Ope. Looks like {this_runner["name"]} is blocked by the runner at third.'
|
||||
content=f'Ope. Looks like {this_runner["p_name"]} is blocked by the runner at third.'
|
||||
)
|
||||
patch_play(this_play.id, locked=False)
|
||||
return
|
||||
@ -3421,7 +3421,7 @@ class Gameplay(commands.Cog):
|
||||
else:
|
||||
this_runner = await get_player(this_game, this_play.on_first)
|
||||
await interaction.edit_original_response(
|
||||
content=f'Ope. Looks like {this_runner["name"]} is blocked by the runner at second.'
|
||||
content=f'Ope. Looks like {this_runner["p_name"]} is blocked by the runner at second.'
|
||||
)
|
||||
patch_play(this_play.id, locked=False)
|
||||
return
|
||||
@ -3450,7 +3450,7 @@ class Gameplay(commands.Cog):
|
||||
else:
|
||||
this_runner = await get_player(this_game, this_play.on_second)
|
||||
await interaction.edit_original_response(
|
||||
content=f'Ope. Looks like {this_runner["name"]} is blocked by the runner at third.'
|
||||
content=f'Ope. Looks like {this_runner["p_name"]} is blocked by the runner at third.'
|
||||
)
|
||||
patch_play(this_play.id, locked=False)
|
||||
return
|
||||
@ -3463,7 +3463,7 @@ class Gameplay(commands.Cog):
|
||||
else:
|
||||
this_runner = await get_player(this_game, this_play.on_first)
|
||||
await interaction.edit_original_response(
|
||||
content=f'Ope. Looks like {this_runner["name"]} is blocked by the runner at second.'
|
||||
content=f'Ope. Looks like {this_runner["p_name"]} is blocked by the runner at second.'
|
||||
)
|
||||
patch_play(this_play.id, locked=False)
|
||||
return
|
||||
@ -3496,7 +3496,7 @@ class Gameplay(commands.Cog):
|
||||
else:
|
||||
this_runner = await get_player(this_game, this_play.on_second)
|
||||
await interaction.edit_original_response(
|
||||
content=f'Ope. Looks like {this_runner["name"]} is blocked by the runner at third.'
|
||||
content=f'Ope. Looks like {this_runner["p_name"]} is blocked by the runner at third.'
|
||||
)
|
||||
patch_play(this_play.id, locked=False)
|
||||
return
|
||||
@ -3509,7 +3509,7 @@ class Gameplay(commands.Cog):
|
||||
else:
|
||||
this_runner = await get_player(this_game, this_play.on_first)
|
||||
await interaction.edit_original_response(
|
||||
content=f'Ope. Looks like {this_runner["name"]} is blocked by the runner at second.'
|
||||
content=f'Ope. Looks like {this_runner["p_name"]} is blocked by the runner at second.'
|
||||
)
|
||||
patch_play(this_play.id, locked=False)
|
||||
return
|
||||
@ -3582,7 +3582,7 @@ class Gameplay(commands.Cog):
|
||||
runner = await get_player(this_game, x)
|
||||
view = Confirm(responders=[interaction.user], timeout=60, label_type='yes')
|
||||
question = await interaction.channel.send(
|
||||
f'Is {runner["name"]} out at {bases[count]} on the play?', view=view
|
||||
f'Is {runner["p_name"]} out at {bases[count]} on the play?', view=view
|
||||
)
|
||||
await view.wait()
|
||||
|
||||
@ -3699,7 +3699,7 @@ class Gameplay(commands.Cog):
|
||||
patch_play(this_play.id, defender_id=d_lineup.id, check_pos=position.value)
|
||||
|
||||
defender_embed = get_team_embed(f'{def_team["sname"]} {position.value}', def_team)
|
||||
defender_embed.description = f'{defender["name"]}'
|
||||
defender_embed.description = f'{defender["p_name"]}'
|
||||
defender_embed.set_image(url=defender['image'])
|
||||
embeds = [defender_embed]
|
||||
|
||||
@ -3715,7 +3715,7 @@ class Gameplay(commands.Cog):
|
||||
hit_allowed, error_allowed, chaos_allowed = None, None, None
|
||||
|
||||
view = Confirm([interaction.user], label_type='yes')
|
||||
question = await interaction.channel.send(f'Did {defender["name"]} give up a hit?', view=view)
|
||||
question = await interaction.channel.send(f'Did {defender["p_name"]} give up a hit?', view=view)
|
||||
await view.wait()
|
||||
|
||||
if view.value:
|
||||
@ -3724,7 +3724,7 @@ class Gameplay(commands.Cog):
|
||||
responders=[interaction.user],
|
||||
labels=['single*', 'single**', 'double**', 'double***', 'triple']
|
||||
)
|
||||
question = await interaction.channel.send(f'Which hit did {defender["name"]} allow?', view=view)
|
||||
question = await interaction.channel.send(f'Which hit did {defender["p_name"]} allow?', view=view)
|
||||
|
||||
await view.wait()
|
||||
|
||||
@ -3740,7 +3740,7 @@ class Gameplay(commands.Cog):
|
||||
hit_allowed = 'out'
|
||||
|
||||
view = Confirm([interaction.user], label_type='yes')
|
||||
question = await interaction.channel.send(f'Did {defender["name"]} give up an error?', view=view)
|
||||
question = await interaction.channel.send(f'Did {defender["p_name"]} give up an error?', view=view)
|
||||
await view.wait()
|
||||
|
||||
if view.value:
|
||||
@ -3749,7 +3749,7 @@ class Gameplay(commands.Cog):
|
||||
responders=[interaction.user],
|
||||
labels=['1 base', '2 bases', '3 bases', None, None]
|
||||
)
|
||||
question = await interaction.channel.send(f'How many bases did {defender["name"]} allow?', view=view)
|
||||
question = await interaction.channel.send(f'How many bases did {defender["p_name"]} allow?', view=view)
|
||||
await view.wait()
|
||||
|
||||
if not view.value:
|
||||
@ -4023,8 +4023,10 @@ class Gameplay(commands.Cog):
|
||||
)
|
||||
)
|
||||
|
||||
embed = get_team_embed(f'{defender["team"]["sname"]} {position}', defender['team'])
|
||||
embed.description = f'{defender["name"]}'
|
||||
def_team_id = this_game.away_team_id if this_play.inning_half == 'Bot' else this_game.home_team_id
|
||||
def_team = await db_get('teams', object_id=def_team_id)
|
||||
embed = get_team_embed(f'{def_team["sname"]} {position}', def_team)
|
||||
embed.description = f'{defender["p_name"]}'
|
||||
embed.set_image(url=defender['image'])
|
||||
if this_game.is_pd:
|
||||
embed.set_footer(text=f'PD Season {PD_SEASON}', icon_url=IMAGES['logo'])
|
||||
|
||||
Loading…
Reference in New Issue
Block a user