Season 9 prep
This commit is contained in:
parent
27a45bd2c5
commit
6192d87840
253
cogs/admins.py
253
cogs/admins.py
@ -292,7 +292,7 @@ class Admins(commands.Cog):
|
||||
keeper_string = ''
|
||||
keeper_swar = 0.0
|
||||
p_query = await db_get('draftpicks', params=[
|
||||
('season', current['season']), ('owner_team_id', this_team['id']), ('pick_round_start', 2),
|
||||
('season', current['season']), ('owner_team_id', this_team['id']), ('pick_round_start', 1),
|
||||
('pick_round_end', 8), ('sort', 'order-asc'), ('short_output', False)
|
||||
])
|
||||
picks = p_query['picks']
|
||||
@ -343,6 +343,257 @@ class Admins(commands.Cog):
|
||||
|
||||
output_string += f'\nJust sent keeper message to sba-network-news'
|
||||
await interaction.edit_original_response(content=output_string)
|
||||
|
||||
@commands.command(name='migrate-players', help='Migrate players between "same-set" seasons')
|
||||
@commands.has_any_role('Da Commish')
|
||||
async def migrate_players(self, ctx, from_season: int, to_season: int):
|
||||
if to_season - 1 != from_season:
|
||||
await ctx.send(f'The "to_season" ({to_season}) has to be right after the "from_season" ({from_season}).')
|
||||
return
|
||||
|
||||
p_query = await db_get('players', params=[('season', from_season)])
|
||||
await ctx.send(f'Pulling players now...')
|
||||
all_players = p_query['players']
|
||||
|
||||
t_query = await db_get('teams', params=[('season', to_season), ('active_only', True)])
|
||||
await ctx.send(f'Pulling teams now...')
|
||||
all_teams = dict([(x["abbrev"], x["id"]) for x in t_query['teams']])
|
||||
|
||||
new_players = []
|
||||
socialism = {
|
||||
"Aaron Bummer": 0.76,
|
||||
"Aaron Hicks": 0.74,
|
||||
"Adam Frazier": 0.31,
|
||||
"Adrian Sampson": 1.09,
|
||||
"Akil Baddoo": 0.28,
|
||||
"Albert Abreu": 0.41,
|
||||
"Albert Almora Jr": 0.44,
|
||||
"Alek Thomas": 0.71,
|
||||
"Alex Young": 1.19,
|
||||
"Alfonso Rivas": 0.37,
|
||||
"Andre Pallante": 0.7,
|
||||
"Andrew McCutchen": 0.4,
|
||||
"Andrew Velazquez": 0.84,
|
||||
"Anthony Bass": 1.29,
|
||||
"Anthony Bender": 0.7,
|
||||
"Anthony Misiewicz": 0.11,
|
||||
"Anthony Rendon": 1.09,
|
||||
"Antonio Senzatela": 0.29,
|
||||
"Aristides Aquino": 1.07,
|
||||
"Austin Gomber": 0.13,
|
||||
"Austin Voth": 0.53,
|
||||
"Bailey Falter": 0.83,
|
||||
"Beau Brieske": 0.46,
|
||||
"Brad Keller": 0.09,
|
||||
"Bradley Zimmer": 0.18,
|
||||
"Brandon Belt": 0.21,
|
||||
"Brandon Lowe": 0.79,
|
||||
"Braxton Garrett": 0.8,
|
||||
"Brayan Bello": 0.38,
|
||||
"Brock Burke": 1.34,
|
||||
"Caleb Smith": 0.08,
|
||||
"Carlos Carrasco": 0.43,
|
||||
"Carson Kelly": 0.53,
|
||||
"Cavan Biggio": 0.62,
|
||||
"Cionel Perez": 1.63,
|
||||
"Cody Morris": 0.91,
|
||||
"Connor Joe": 0.4,
|
||||
"Curt Casali": 1.67,
|
||||
"Dakota Hudson": 0.02,
|
||||
"Dane Dunning": 0.35,
|
||||
"Daniel Castano": 0.15,
|
||||
"Daniel Lynch": 0.25,
|
||||
"Darren ODay": 0.16,
|
||||
"David Fletcher": 1.01,
|
||||
"David Peralta": 0.3,
|
||||
"David Price": 0.58,
|
||||
"David Villar": 1.51,
|
||||
"Dermis Garcia": 0.67,
|
||||
"Devin Smeltzer": 0.69,
|
||||
"Dillon Peters": 0.28,
|
||||
"Domingo German": 0.52,
|
||||
"Dominic Leone": 0.34,
|
||||
"Drew Smith": 0.51,
|
||||
"Edmundo Sosa": 1.55,
|
||||
"Eduardo Rodriguez": 0.06,
|
||||
"Elehuris Montero": 0.11,
|
||||
"Elias Diaz": 0.22,
|
||||
"Emmanuel Rivera": 0.94,
|
||||
"Eric Hosmer": 0.55,
|
||||
"Gabriel Arias": 0.74,
|
||||
"Gabriel Moreno": 2.02,
|
||||
"Garrett Hill": 0.36,
|
||||
"Gary Sanchez": 0.4,
|
||||
"Geraldo Perdomo": 0.29,
|
||||
"German Marquez": 0.53,
|
||||
"Gilberto Celestino": 0.18,
|
||||
"Glenn Otto": 0.2,
|
||||
"Graham Ashcraft": 0.56,
|
||||
"Harrison Bader": 0.74,
|
||||
"Huascar Brazoban": 0.99,
|
||||
"Hunter Brown": 2.39,
|
||||
"Hunter Harvey": 0.85,
|
||||
"Hunter Strickland": 0.05,
|
||||
"Ian Gibaut": 0.28,
|
||||
"Ildemaro Vargas": 1.42,
|
||||
"Jaime Barria": 1.36,
|
||||
"Jake Bird": 0.33,
|
||||
"Jake Cave": 0.71,
|
||||
"Jake Junis": 0.77,
|
||||
"Jake Meyers": 0.65,
|
||||
"Jalen Beeks": 0.61,
|
||||
"James Kaprielian": 0.49,
|
||||
"Jandel Gustave": 0.12,
|
||||
"Jarlin Garcia": 0.32,
|
||||
"Jason Foley": 0.17,
|
||||
"Javier Baez": 0.89,
|
||||
"Jeff Hoffman": 0.83,
|
||||
"Jeimer Candelario": 0.27,
|
||||
"Jesse Chavez": 0.31,
|
||||
"Jharel Cotton": 0.37,
|
||||
"Jimmy Herget": 1.76,
|
||||
"Joel Payamps": 1.04,
|
||||
"Joey Bart": 0.58,
|
||||
"Joey Krehbiel": 0.17,
|
||||
"Joey Wendle": 1.36,
|
||||
"Johan Camargo": 0.25,
|
||||
"John Brebbia": 0.79,
|
||||
"Jonah Bride": 0.11,
|
||||
"Jonathan Hernandez": 0.44,
|
||||
"Jordan Lyles": 0.3,
|
||||
"Jorge Alfaro": 0.61,
|
||||
"Jorge Mateo": 1.34,
|
||||
"Jorge Soler": 0.28,
|
||||
"Jose Cuas": 0.35,
|
||||
"Jose Ruiz": 0.17,
|
||||
"Jose Urena": 0.17,
|
||||
"Jose Urquidy": 0.47,
|
||||
"Josh Donaldson": 0.92,
|
||||
"Josh Rogers": 0.2,
|
||||
"Josh Smith": 0.25,
|
||||
"Josiah Gray": 0.18,
|
||||
"JP Sears": 0.62,
|
||||
"JT Chargois": 0.75,
|
||||
"Jurickson Profar": 0.99,
|
||||
"Justin Bruihl": 0.14,
|
||||
"KeBryan Hayes": 1.61,
|
||||
"Ken Waldichuk": 0.31,
|
||||
"Kendall Graveman": 0.52,
|
||||
"Ketel Marte": 0.56,
|
||||
"Kevin Smith": 0.42,
|
||||
"Kutter Crawford": 0.14,
|
||||
"Kyle Bradish": 0.19,
|
||||
"Kyle Freeland": 0.89,
|
||||
"Kyle Hendricks": 0.32,
|
||||
"Kyle Isbel": 0.15,
|
||||
"Lance McCullers Jr": 1.9,
|
||||
"Louie Varland": 0.83,
|
||||
"Lucas Gilbreath": 0.47,
|
||||
"Lucas Giolito": 0.17,
|
||||
"Lucas Luetge": 0.64,
|
||||
"Luis Barrera": 0.49,
|
||||
"Luis Torrens": 0.13,
|
||||
"Luke Maile": 0.71,
|
||||
"Luke Raley": 0.88,
|
||||
"Luke Voit": 0.29,
|
||||
"MacKenzie Gore": 0.16,
|
||||
"Manuel Rodriguez": 0.49,
|
||||
"Marwin Gonzalez": 0.71,
|
||||
"Matt Foster": 0.15,
|
||||
"Matt Moore": 1.71,
|
||||
"Matt Reynolds": 0.46,
|
||||
"Mauricio Dubon": 0.08,
|
||||
"Max Kepler": 0.99,
|
||||
"Meibrys Viloria": 0.84,
|
||||
"Michael Massey": 0.76,
|
||||
"Michael Rucker": 0.48,
|
||||
"Michael A Taylor": 1.48,
|
||||
"Miguel Andujar": 0.15,
|
||||
"Mike Baumann": 0.16,
|
||||
"Mike Brosseau": 0.65,
|
||||
"Mike Clevinger": 0.28,
|
||||
"Mychal Givens": 0.44,
|
||||
"Nathan Eovaldi": 0.74,
|
||||
"Nelson Cruz": 0.04,
|
||||
"Nick Madrigal": 0.64,
|
||||
"Nick Nelson": 0.1,
|
||||
"Nick Pivetta": 0.78,
|
||||
"Nick Vespi": 0.38,
|
||||
"Nolan Jones": 0.22,
|
||||
"Nomar Mazara": 0.25,
|
||||
"Odubel Herrera": 0.22,
|
||||
"Oswaldo Cabrera": 2.33,
|
||||
"Owen Miller": 0.13,
|
||||
"Paolo Espino": 0.24,
|
||||
"Paul Blackburn": 0.68,
|
||||
"Paul DeJong": 0.26,
|
||||
"Pavin Smith": 0.31,
|
||||
"Rafael Ortega": 0.17,
|
||||
"Raimel Tapia": 0.14,
|
||||
"Ralph Garza": 0.46,
|
||||
"Rich Hill": 0.39,
|
||||
"Richard Bleier": 0.4,
|
||||
"Roberto Perez": 1.82,
|
||||
"Robinson Chirinos": 0.1,
|
||||
"Rodolfo Castro": 1.06,
|
||||
"Ross Detwiler": 0.51,
|
||||
"Ryan Feltner": 0.05,
|
||||
"Ryan Jeffers": 0.8,
|
||||
"Ryan Kreidler": 1,
|
||||
"Ryan Mountcastle": 0.45,
|
||||
"Sam Hilliard": 0.42,
|
||||
"Sam Long": 0.08,
|
||||
"Seth Lugo": 0.36,
|
||||
"Shane Baz": 0.2,
|
||||
"Shawn Armstrong": 0.11,
|
||||
"Spenser Watkins": 0.05,
|
||||
"Stuart Fairchild": 1.15,
|
||||
"Tanner Rainey": 0.22,
|
||||
"Taylor Clarke": 0.41,
|
||||
"Taylor Walls": 1.13,
|
||||
"Tim Mayza": 0.41,
|
||||
"Tomas Nido": 0.2,
|
||||
"Tommy Edman": 2.14,
|
||||
"Tommy Nance": 0.23,
|
||||
"Tommy Pham": 0.14,
|
||||
"Tony Kemp": 0.41,
|
||||
"Trent Grisham": 1.04,
|
||||
"Trevor Larnach": 1.52,
|
||||
"Trevor Williams": 0.85,
|
||||
"Trey Mancini": 0.5,
|
||||
"Tucker Barnhart": 0.07,
|
||||
"Tyler Heineman": 0.24,
|
||||
"Tyler Kinley": 1.54,
|
||||
"Tyler ONeill": 0.71,
|
||||
"Victor Caratini": 0.4,
|
||||
"Victor Reyes": 0.06,
|
||||
"Will Vest": 0.05,
|
||||
"Willi Castro": 0.64,
|
||||
"Yadiel Hernandez": 0.26,
|
||||
"Yu Chang": 0.33,
|
||||
"Zach Davies": 0.28,
|
||||
"Zach McKinstry": 0.68,
|
||||
"Zack Greinke": 1.03,
|
||||
"Zack Littell": 0.12
|
||||
}
|
||||
for x in all_players:
|
||||
this_new = copy.deepcopy(x)
|
||||
this_new['season'] = to_season
|
||||
del this_new['il_return'], this_new['demotion_week']
|
||||
if x['name'] in socialism:
|
||||
this_new['wara'] = socialism[x["name"]]
|
||||
|
||||
new_team_abbrev = x['team']['abbrev']
|
||||
if new_team_abbrev[-3:] == 'MiL':
|
||||
new_team_abbrev = new_team_abbrev[:-3]
|
||||
elif new_team_abbrev[-2:] == 'IL':
|
||||
new_team_abbrev = new_team_abbrev[:-2]
|
||||
|
||||
this_new['team_id'] = all_teams[new_team_abbrev]
|
||||
new_players.append(this_new)
|
||||
|
||||
await db_post('players', payload={'players': new_players}, timeout=20)
|
||||
await ctx.send(random_gif('all done boss'))
|
||||
|
||||
|
||||
async def setup(bot):
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import copy
|
||||
import math
|
||||
|
||||
import discord
|
||||
@ -1645,7 +1646,7 @@ class Players(commands.Cog):
|
||||
team['color'] = color_hex
|
||||
await db_patch('teams', object_id=team['id'], params=[('color', color_hex)])
|
||||
if team_image_url is not None:
|
||||
if requests.get(team_image_url, timeout=0.5).status_code != 200:
|
||||
if requests.get(team_image_url, timeout=3).status_code != 200:
|
||||
errors.append(f'- I wasn\'t able to pull that image. Was it a public URL?\n\n')
|
||||
else:
|
||||
team['thumbnail'] = team_image_url
|
||||
@ -1658,7 +1659,7 @@ class Players(commands.Cog):
|
||||
logging.info(f'Error setting {team["sname"]} color to {mil_color_hex}')
|
||||
errors.append(f'- Error setting {team["sname"]} color to {mil_color_hex}:\n{e}\n\n')
|
||||
if mil_team_image_url is not None:
|
||||
if requests.get(mil_team_image_url, timeout=0.5).status_code != 200:
|
||||
if requests.get(mil_team_image_url, timeout=3).status_code != 200:
|
||||
errors.append(f'- I wasn\'t able to pull that image. Was it a public URL?\n\n')
|
||||
else:
|
||||
await db_patch('teams', object_id=mil_team['id'], params=[('thumbnail', mil_team_image_url)])
|
||||
|
||||
@ -754,7 +754,8 @@ class Transactions(commands.Cog):
|
||||
async def post_weekly_info_command(self, ctx):
|
||||
await self.post_weekly_info(await db_get('current'))
|
||||
|
||||
@commands.command(name='trade', help='Trade players')
|
||||
@commands.command(
|
||||
name='trade', aliases=['tradeplz', 'pleasetrade', 'tradeplease', 'plztrade'], help='Trade players')
|
||||
@commands.has_any_role(SBA_PLAYERS_ROLE_NAME)
|
||||
async def trade_command(self, ctx):
|
||||
current = await db_get('current')
|
||||
|
||||
@ -19,8 +19,8 @@ from discord.ext import commands
|
||||
from difflib import get_close_matches
|
||||
|
||||
|
||||
SBA_SEASON = 8
|
||||
PD_SEASON = 4
|
||||
SBA_SEASON = 9
|
||||
PD_SEASON = 6
|
||||
SBA_COLOR = 'a6ce39'
|
||||
|
||||
SBA_ROSTER_KEY = '1bt7LLJe6h7axkhDVlxJ4f319l8QmFB0zQH-pjM0c8a8'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user