Season 9 Draft Updates
This commit is contained in:
parent
fc72bc941e
commit
f60c1deea7
@ -260,15 +260,46 @@ class Admins(commands.Cog):
|
||||
|
||||
@app_commands.command(name='set-keepers', description='Post final keepers')
|
||||
@app_commands.guilds(discord.Object(id=os.environ.get('GUILD_ID')))
|
||||
@app_commands.checks.has_any_role('Da Commish')
|
||||
# @app_commands.checks.has_any_role('Da Commish')
|
||||
async def keeper_slash(
|
||||
self, interaction: discord.Interaction, team_abbrev: str, keeper_1_name: str,
|
||||
self, interaction: discord.Interaction, keeper_1_name: str,
|
||||
keeper_2_name: Optional[str] = None, keeper_3_name: Optional[str] = None,
|
||||
keeper_4_name: Optional[str] = None, keeper_5_name: Optional[str] = None,
|
||||
keeper_6_name: Optional[str] = None, keeper_7_name: Optional[str] = None):
|
||||
keeper_6_name: Optional[str] = None, keeper_7_name: Optional[str] = None,
|
||||
team_abbrev: Optional[str] = None):
|
||||
if interaction.channel.name == 'season-9-chat':
|
||||
await interaction.response.send_message(f'everybody laugh at {interaction.user.display_name} for trying '
|
||||
f'to run keepers here')
|
||||
return
|
||||
|
||||
await interaction.response.defer()
|
||||
current = await db_get('current')
|
||||
|
||||
if current['week'] != -1:
|
||||
logging.info('entering the thot check')
|
||||
await interaction.edit_original_response(content='https://c.tenor.com/FCAj8xDvEHwAAAAC/be-gone-thot.gif')
|
||||
player_role = get_role(interaction, SBA_PLAYERS_ROLE_NAME)
|
||||
logging.info('beginning sleep')
|
||||
await asyncio.sleep(random.randint(3, 7))
|
||||
|
||||
try:
|
||||
await interaction.user.remove_roles(player_role)
|
||||
except Exception as e:
|
||||
logging.error(f'unable to remove {player_role} role from {interaction.user}: {e}')
|
||||
|
||||
return
|
||||
|
||||
owner_team = await get_team_by_owner(current['season'], interaction.user.id)
|
||||
|
||||
if team_abbrev is not None and interaction.user.id != 258104532423147520 and \
|
||||
team_abbrev != owner_team['abbrev']:
|
||||
await interaction.edit_original_response(
|
||||
content='Omg you are so quirky and random trying to set another team\'s keepers.')
|
||||
return
|
||||
else:
|
||||
team_abbrev = owner_team['abbrev']
|
||||
this_team = await get_team_by_abbrev(team_abbrev, current['season'])
|
||||
|
||||
if this_team is None:
|
||||
await interaction.edit_original_response(content=f'Team {team_abbrev} not found')
|
||||
return
|
||||
@ -287,6 +318,12 @@ class Admins(commands.Cog):
|
||||
else:
|
||||
return 'DH'
|
||||
|
||||
k_query = await db_get('keepers', params=[('team_id', this_team['id'])])
|
||||
if k_query['count'] > 0:
|
||||
await interaction.edit_original_response(content=random_gif('please go away'))
|
||||
await interaction.channel.send('You\'ve already posted your keepers. I can\'t help you.')
|
||||
return
|
||||
|
||||
k_list = []
|
||||
k_ids = []
|
||||
keeper_string = ''
|
||||
@ -302,18 +339,32 @@ class Admins(commands.Cog):
|
||||
keeper_7_name]:
|
||||
if x is not None:
|
||||
this_player = await get_player_by_name(current['season'], x)
|
||||
if this_player is None:
|
||||
await interaction.edit_original_response(
|
||||
content='No fuzzy search here can help you. Ya gotta get it right.')
|
||||
return
|
||||
# logging.info(f'keeper_slash - this_player: {this_player}')
|
||||
if this_player['team']['id'] != this_team['id']:
|
||||
await interaction.edit_original_response(
|
||||
content=f'Lol {this_player["name"]}. Oh my god be more I hate you.')
|
||||
return
|
||||
|
||||
k_ids.append(this_player['id'])
|
||||
k_list.append({
|
||||
'season': current['season'],
|
||||
'team_id': this_team['id'],
|
||||
'player_id': this_player['id']
|
||||
})
|
||||
# logging.info(f'keeper_slash - updated k_list')
|
||||
|
||||
keeper_string += f'{get_pos_nickname(this_player["pos_1"])} - ' \
|
||||
f'{this_player["name"]} ({this_player["wara"]:.2f})\n'
|
||||
keeper_swar += this_player['wara']
|
||||
# logging.info(f'keeper_slash - updated keeper_swar')
|
||||
|
||||
this_pick = picks[count]
|
||||
this_pick['player'] = this_player
|
||||
# logging.info(f'keeper_slash - patching draftpick')
|
||||
await patch_draftpick(this_pick)
|
||||
count += 1
|
||||
|
||||
|
||||
@ -13,6 +13,7 @@ class Draft(commands.Cog):
|
||||
self.bot = bot
|
||||
self.warnings = 0
|
||||
self.pick_lock = False
|
||||
# self.sheets = pygsheets.authorize(service_file='storage/major-domo-service-creds.json')
|
||||
|
||||
self.draft_loop.start()
|
||||
|
||||
@ -334,7 +335,7 @@ class Draft(commands.Cog):
|
||||
player['wara']
|
||||
]]
|
||||
|
||||
sheets.open_by_key(SBA_SEASON8_DRAFT_KEY).worksheet_by_title('Ordered List').update_values(
|
||||
sheets.open_by_key(SBA_SEASON9_DRAFT_KEY).worksheet_by_title('Ordered List').update_values(
|
||||
crange=f'D{draft_pick["overall"] + 1}',
|
||||
values=this_pick
|
||||
)
|
||||
@ -495,9 +496,6 @@ class Draft(commands.Cog):
|
||||
async def draft_command(self, ctx, *, name):
|
||||
cal_can_pick_for_all = True
|
||||
|
||||
if 'strider' in name.lower():
|
||||
await ctx.send(f'Ope. Strider has been reserved for Cal.')
|
||||
|
||||
if self.pick_lock:
|
||||
await react_and_reply(ctx, '❌', 'Another pick is already in the works.')
|
||||
return
|
||||
|
||||
@ -33,6 +33,7 @@ SBA_SEASON5_DRAFT_KEY = '1euuKeWqQEUmE9OiF9wihO5LMERWP3Zwg_KsG2w-Kx54'
|
||||
SBA_SEASON6_DRAFT_KEY = '13_xWG1wQy7G4UJvohD8JIUBE-7yuWT9lVta1rkAlHQE'
|
||||
SBA_SEASON7_DRAFT_KEY = '1BgySsUlQf9K21_uOjQOY7O0GrRfF6zt1BBaEFlvBokY'
|
||||
SBA_SEASON8_DRAFT_KEY = '1FG4cAs8OeTdrreRqu8D-APxibjB3RiEzn34KTTBLLDk'
|
||||
SBA_SEASON9_DRAFT_KEY = '1GkrsEOHvnJosQ2HOYdHb7pYXPHlMU5X7ySSJDIWiRos'
|
||||
SBA_STANDINGS_URL = f'{SBA_BASE_URL}/standings'
|
||||
SBA_SCHEDULE_URL = f'{SBA_BASE_URL}/schedule'
|
||||
SBA_IMAGE_URL = f'{SBA_BASE_URL}/images'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user