From 4363423876d63c4697fb5f8ecc0f90a8b143d9a7 Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Sun, 6 Apr 2025 12:11:47 -0500 Subject: [PATCH] Added support for expanded MiL --- cogs/transactions.py | 25 ++++++++++++++++++++++--- helpers.py | 1 + 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/cogs/transactions.py b/cogs/transactions.py index 0f78b43..9782da3 100644 --- a/cogs/transactions.py +++ b/cogs/transactions.py @@ -1285,7 +1285,9 @@ class Transactions(commands.Cog): else: fa_team = await get_team_by_abbrev('FA', 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"]} ' f'so I can\'t let you do that.') elif await dropadd.not_available(player): @@ -1342,7 +1344,9 @@ class Transactions(commands.Cog): await dropadd.add_player(player, team) else: 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 .') + 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"]} ' f'so I can\'t let you do that.') 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' 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( 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.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]() and for [Sheets]().\n\n[Rule 34 Draft](<{dest_url}>)' + ) + @commands.command(name='ilmove', help='IL move') @commands.has_any_role(SBA_PLAYERS_ROLE_NAME) async def il_move_command(self, ctx): diff --git a/helpers.py b/helpers.py index dda44be..1e7e3a4 100644 --- a/helpers.py +++ b/helpers.py @@ -22,6 +22,7 @@ logger = logging.getLogger('discord_app') SBA_SEASON = 11 PD_SEASON = 7 +FA_LOCK_WEEK = 14 SBA_COLOR = 'a6ce39' SBA_ROSTER_KEY = '1bt7LLJe6h7axkhDVlxJ4f319l8QmFB0zQH-pjM0c8a8'