S10 Updates
This commit is contained in:
parent
abeb2ecb0f
commit
c24a71a4ee
@ -4,7 +4,7 @@ import copy
|
||||
from helpers import *
|
||||
from db_calls import db_get, db_patch, get_team_by_owner, get_team_by_abbrev, get_player_by_name, patch_player, db_post
|
||||
from discord.ext import commands, tasks
|
||||
OFFSEASON_FLAG = False
|
||||
OFFSEASON_FLAG = True
|
||||
|
||||
|
||||
class SBaTransaction:
|
||||
@ -328,7 +328,7 @@ class Transactions(commands.Cog):
|
||||
self.bot = bot
|
||||
self.trade_season = False
|
||||
|
||||
self.weekly_loop.start()
|
||||
# self.weekly_loop.start()
|
||||
|
||||
@tasks.loop(minutes=1)
|
||||
async def weekly_loop(self):
|
||||
@ -1039,9 +1039,9 @@ class Transactions(commands.Cog):
|
||||
roster_errors = []
|
||||
for team in trade.teams:
|
||||
data = await trade.check_major_league_errors(team)
|
||||
logging.warning(f'Done checking data - checking WARa now ({data["wara"]}')
|
||||
logging.warning(f'Done checking data - checking sWAR now ({data["wara"]}')
|
||||
|
||||
if data['wara'] > 38.001 and not OFFSEASON_FLAG:
|
||||
if data['wara'] > 32.001 and not OFFSEASON_FLAG:
|
||||
errors.append(f'- {trade.teams[team]["team"]["abbrev"]} would have {data["wara"]:.2f} WARa')
|
||||
|
||||
logging.warning(f'Now checking roster {len(data["roster"])}')
|
||||
@ -1049,7 +1049,7 @@ class Transactions(commands.Cog):
|
||||
errors.append(f'- {trade.teams[team]["team"]["abbrev"]} would have {len(data["roster"])} players')
|
||||
|
||||
logging.warning(f'Any errors? {errors}')
|
||||
if (data['wara'] > 38.001 or len(data['roster']) > 26) and not OFFSEASON_FLAG:
|
||||
if (data['wara'] > 32.001 or len(data['roster']) > 26) and not OFFSEASON_FLAG:
|
||||
roster_string = ''
|
||||
for x in data['roster']:
|
||||
roster_string += f'{x["wara"]: >5} - {x["name"]}\n'
|
||||
@ -1258,7 +1258,7 @@ class Transactions(commands.Cog):
|
||||
# data = await trade.check_major_league_errors(team)
|
||||
# logging.warning(f'Done checking data - checking WARa now ({data["wara"]}')
|
||||
#
|
||||
# if data['wara'] > 38.001:
|
||||
# if data['wara'] > 32.001:
|
||||
# errors.append(f'- {trade.teams[team]["team"]["abbrev"]} would have {data["wara"]:.2f} WARa')
|
||||
#
|
||||
# logging.warning(f'Now checking roster {len(data["roster"])}')
|
||||
@ -1266,7 +1266,7 @@ class Transactions(commands.Cog):
|
||||
# errors.append(f'- {trade.teams[team]["team"]["abbrev"]} would have {len(data["roster"])} players')
|
||||
#
|
||||
# logging.warning(f'Any errors? {errors}')
|
||||
# if data['wara'] > 38.001 or len(data['roster']) > 26:
|
||||
# if data['wara'] > 32.001 or len(data['roster']) > 26:
|
||||
# roster_string = ''
|
||||
# for x in data['roster']:
|
||||
# roster_string += f'{data["roster"][x]["wara"]: >5} - {data["roster"][x]["name"]}\n'
|
||||
@ -1531,7 +1531,7 @@ class Transactions(commands.Cog):
|
||||
data = await dropadd.check_major_league_errors(team)
|
||||
logging.warning(f'Done checking data - checking WARa now ({data["wara"]})')
|
||||
|
||||
if data['wara'] > 38.001 and not OFFSEASON_FLAG:
|
||||
if data['wara'] > 32.001 and not OFFSEASON_FLAG:
|
||||
errors.append(f'- {dropadd.teams[team]["team"]["abbrev"]} would have {data["wara"]:.2f} sWAR')
|
||||
|
||||
logging.warning(f'Now checking roster {len(data["roster"])}')
|
||||
@ -1539,7 +1539,7 @@ class Transactions(commands.Cog):
|
||||
errors.append(f'- {dropadd.teams[team]["team"]["abbrev"]} would have {len(data["roster"])} players')
|
||||
|
||||
logging.warning(f'Any errors? {errors}')
|
||||
if (data['wara'] > 38.001 or len(data['roster']) > 26) and not OFFSEASON_FLAG:
|
||||
if (data['wara'] > 32.001 or len(data['roster']) > 26) and not OFFSEASON_FLAG:
|
||||
roster_string = ''
|
||||
for x in data['roster']:
|
||||
roster_string += f'{x["wara"]: >5} - {x["name"]}\n'
|
||||
@ -1829,13 +1829,13 @@ class Transactions(commands.Cog):
|
||||
for team in dropadd.teams:
|
||||
data = await dropadd.check_major_league_errors(team)
|
||||
|
||||
if data['wara'] > 38.001 and not OFFSEASON_FLAG:
|
||||
if data['wara'] > 32.001 and not OFFSEASON_FLAG:
|
||||
errors.append(f'- {dropadd.teams[team]["team"]["abbrev"]} would have {data["wara"]:.2f} WARa')
|
||||
|
||||
if len(data['roster']) > 26 and not OFFSEASON_FLAG:
|
||||
errors.append(f'- {dropadd.teams[team]["team"]["abbrev"]} would have {len(data["roster"])} players')
|
||||
|
||||
if (data['wara'] > 38.001 or len(data['roster']) > 26) and not OFFSEASON_FLAG:
|
||||
if (data['wara'] > 32.001 or len(data['roster']) > 26) and not OFFSEASON_FLAG:
|
||||
roster_string = ''
|
||||
for x in data['roster']:
|
||||
roster_string += f'{x["wara"]: >5} - {x["name"]}\n'
|
||||
@ -1977,9 +1977,9 @@ class Transactions(commands.Cog):
|
||||
if sil_wara > 0:
|
||||
wara_string += f' ({sil_wara:.2f} IL)'
|
||||
|
||||
embed.add_field(name='WARa', value=wara_string)
|
||||
if total_wara > 38.001:
|
||||
errors.append(f'- WARa currently {total_wara:.2f} (cap 38.0)')
|
||||
embed.add_field(name='sWAR', value=wara_string)
|
||||
if total_wara > 32.001:
|
||||
errors.append(f'- sWAR currently {total_wara:.2f} (cap 32.0)')
|
||||
|
||||
player_count = len(roster["active"]["players"])
|
||||
embed.add_field(name='Player Count', value=f'{player_count}')
|
||||
|
||||
10
helpers.py
10
helpers.py
@ -19,8 +19,8 @@ from discord.ext import commands
|
||||
from difflib import get_close_matches
|
||||
|
||||
|
||||
SBA_SEASON = 9
|
||||
PD_SEASON = 6
|
||||
SBA_SEASON = 10
|
||||
PD_SEASON = 7
|
||||
SBA_COLOR = 'a6ce39'
|
||||
|
||||
SBA_ROSTER_KEY = '1bt7LLJe6h7axkhDVlxJ4f319l8QmFB0zQH-pjM0c8a8'
|
||||
@ -33,7 +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_SEASON9_DRAFT_KEY = '1eyHqaVU9rtmhG1p0ZktOrz7FMDp3c_unCcFyMMYceLc'
|
||||
SBA_STANDINGS_URL = f'{SBA_BASE_URL}/standings'
|
||||
SBA_SCHEDULE_URL = f'{SBA_BASE_URL}/schedule'
|
||||
SBA_IMAGE_URL = f'{SBA_BASE_URL}/images'
|
||||
@ -1154,3 +1154,7 @@ def random_from_list(data_list: list):
|
||||
item = data_list[random.randint(0, len(data_list) - 1)]
|
||||
logging.info(f'random_from_list: {item}')
|
||||
return item
|
||||
|
||||
|
||||
def get_team_url(this_team):
|
||||
return f'https://sba.manticorum.com/teams/{this_team["season"]}/{this_team["abbrev"]}'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user