Fixed patch current bug

This commit is contained in:
Cal Corum 2023-06-09 12:36:30 -05:00
parent ffae4e4018
commit 3eaf0bac70
2 changed files with 16 additions and 10 deletions

View File

@ -74,15 +74,17 @@ class Admins(commands.Cog):
@commands.command(name='test', hidden=True)
@commands.is_owner()
async def test_command(self, ctx):
current = await get_current()
week_num = f'Week {current["week"]}'
stars = f'{"":*<32}'
freeze_message = f'```\n' \
f'{stars}\n'\
f'{week_num: >9} Freeze Period Begins\n' \
f'{stars}\n```'
# week_num = f'Week {current["week"]}'
# stars = f'{"":*<32}'
# freeze_message = f'```\n' \
# f'{stars}\n'\
# f'{week_num: >9} Freeze Period Begins\n' \
# f'{stars}\n```'
#
# await send_to_channel(self.bot, 'general', freeze_message)
await send_to_channel(self.bot, 'general', freeze_message)
current = await patch_current(freeze=False)
await ctx.send(f'Current: {current}')
@commands.command(name='sendmoves', help='Send moves to sheets')
@commands.is_owner()

View File

@ -178,7 +178,6 @@ async def get_current(season=None):
async def patch_current(
week=None, freeze=None, season=None, transcount=None, bstatcount=None, pstatcount=None, bet_week=None,
trade_deadline=None, pick_trade_start=None, pick_trade_end=None, injury_count=None):
current = await db_get('current')
params = []
if week is not None:
params.append(('week', week))
@ -203,7 +202,12 @@ async def patch_current(
if injury_count is not None:
params.append(('injury_count', injury_count))
return await db_patch('current', object_id=current['id'], params=params)
resp = requests.patch(get_req_url('current', params=params), data=None, headers=AUTH_TOKEN, timeout=3)
if resp.status_code == 200:
return True
else:
logging.warning(resp.text)
raise ValueError(f'DB: {resp.text}')
async def get_one_team(id_or_abbrev, season=None, is_pd=False, timeout=3):