Added support for expanded MiL

This commit is contained in:
Cal Corum 2025-04-06 12:11:47 -05:00
parent 32a2e1e8aa
commit 4363423876
2 changed files with 23 additions and 3 deletions

View File

@ -1285,7 +1285,9 @@ class Transactions(commands.Cog):
else: else:
fa_team = await get_team_by_abbrev('FA', current['season']) fa_team = await get_team_by_abbrev('FA', current['season'])
dest_team = await get_team_by_abbrev(f'{team["abbrev"]}MiL', current['season']) dest_team = await get_team_by_abbrev(f'{team["abbrev"]}MiL', current['season'])
if not dropadd.included_team(player['team']) and player['team'] != fa_team: if current['week'] >= FA_LOCK_WEEK and player['team'] == fa_team:
await dropadd.send(f'FA transactions are locked starting in Week {FA_LOCK_WEEK} so I gotta say no. For more information, search for Rule 34 Draft.')
elif not dropadd.included_team(player['team']) and player['team'] != fa_team:
await t_channel.send(f'It looks like {player["name"]} is on {player["team"]["abbrev"]} ' await t_channel.send(f'It looks like {player["name"]} is on {player["team"]["abbrev"]} '
f'so I can\'t let you do that.') f'so I can\'t let you do that.')
elif await dropadd.not_available(player): elif await dropadd.not_available(player):
@ -1342,7 +1344,9 @@ class Transactions(commands.Cog):
await dropadd.add_player(player, team) await dropadd.add_player(player, team)
else: else:
fa_team = await get_team_by_abbrev('FA', current['season']) fa_team = await get_team_by_abbrev('FA', current['season'])
if player['team'] != fa_team and not self.on_team_il(team, player): if current['week'] >= FA_LOCK_WEEK and player['team'] == fa_team:
await dropadd.send(f'FA transactions are locked starting in Week {FA_LOCK_WEEK} so I gotta say no. For more information, run !rule34 <player name>.')
elif player['team'] != fa_team and not self.on_team_il(team, player):
await t_channel.send(f'It looks like {player["name"]} is on {player["team"]["abbrev"]} ' await t_channel.send(f'It looks like {player["name"]} is on {player["team"]["abbrev"]} '
f'so I can\'t let you do that.') f'so I can\'t let you do that.')
elif await dropadd.not_available(player): elif await dropadd.not_available(player):
@ -1434,7 +1438,8 @@ class Transactions(commands.Cog):
errors.append(f'- This is the roster I have for {dropadd.teams[team]["team"]["abbrev"]}:\n' errors.append(f'- This is the roster I have for {dropadd.teams[team]["team"]["abbrev"]}:\n'
f'```\n{roster_string}```') f'```\n{roster_string}```')
if len(data['mil_roster']) > 9: mil_cap = 6 if current['week'] <= FA_LOCK_WEEK else 14
if len(data['mil_roster']) > mil_cap:
errors.append( errors.append(
f'- {dropadd.teams[team]["team"]["abbrev"]}MiL would have {len(data["mil_roster"])} players' f'- {dropadd.teams[team]["team"]["abbrev"]}MiL would have {len(data["mil_roster"])} players'
) )
@ -1470,6 +1475,20 @@ class Transactions(commands.Cog):
await dropadd.send(f'All done! Your transaction id is: {trans_id}') await dropadd.send(f'All done! Your transaction id is: {trans_id}')
await dropadd.timed_delete() await dropadd.timed_delete()
@commands.command(name='rule34', help='Take a 50/50')
@commands.has_any_role(SBA_PLAYERS_ROLE_NAME)
async def rule_34_command(self, ctx, *, player_name: str):
dest_url = ''
if random.randint(1, 2) == 1:
q_string = player_name.replace(' ', '%20')
dest_url = f'https://www.bing.com/images/search?q=rule%2034%20{q_string}&safesearch=off'
else:
dest_url = 'https://docs.google.com/spreadsheets/d/1kGNSQbwocG5NuXKw5NXFPJ1F2V7zM0_qsMv_1o7QjLs/edit?gid=0#gid=0'
await ctx.send(
content=f'To play the 50/50, click the \'Trust Links\' button that pops up for [Bing](<https://www.bing.com/>) and for [Sheets](<https://docs.google.com/spreadsheets/u/0/>).\n\n[Rule 34 Draft](<{dest_url}>)'
)
@commands.command(name='ilmove', help='IL move') @commands.command(name='ilmove', help='IL move')
@commands.has_any_role(SBA_PLAYERS_ROLE_NAME) @commands.has_any_role(SBA_PLAYERS_ROLE_NAME)
async def il_move_command(self, ctx): async def il_move_command(self, ctx):

View File

@ -22,6 +22,7 @@ logger = logging.getLogger('discord_app')
SBA_SEASON = 11 SBA_SEASON = 11
PD_SEASON = 7 PD_SEASON = 7
FA_LOCK_WEEK = 14
SBA_COLOR = 'a6ce39' SBA_COLOR = 'a6ce39'
SBA_ROSTER_KEY = '1bt7LLJe6h7axkhDVlxJ4f319l8QmFB0zQH-pjM0c8a8' SBA_ROSTER_KEY = '1bt7LLJe6h7axkhDVlxJ4f319l8QmFB0zQH-pjM0c8a8'