From 53f789844f175b1e3f65a573bbfc2e687c634c17 Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Thu, 27 Jun 2024 00:31:25 -0500 Subject: [PATCH] Update admins.py --- cogs/admins.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/cogs/admins.py b/cogs/admins.py index 8cfd206..57eeea3 100644 --- a/cogs/admins.py +++ b/cogs/admins.py @@ -2,6 +2,7 @@ import csv import json import db_calls +import db_calls_gameplay from helpers import * from db_calls import * from discord import Member @@ -9,6 +10,7 @@ from discord.ext import commands, tasks from discord import app_commands import in_game + # date = f'{datetime.datetime.now().year}-{datetime.datetime.now().month}-{datetime.datetime.now().day}' # logging.basicConfig( # filename=f'logs/{date}.log', @@ -473,7 +475,7 @@ class Admins(commands.Cog): if pitching_cache: in_game.data_cache.PITCHINGCARD_CACHE = {} await interaction.edit_original_response( - content=random_gif(random_from_list(['all done', 'yes sir', 'complete'])) + content=random_gif(random.choice(['all done', 'yes sir', 'complete'])) ) @commands.command(name='tc', help='Mod: Test command') @@ -494,13 +496,21 @@ class Admins(commands.Cog): @commands.command(name='get-pc', help='Mod: Test pitching card cache') @commands.is_owner() - async def get_battingcard_command(self, ctx, player_id: int): + async def get_pitchngcard_command(self, ctx, player_id: int): await ctx.channel.send(f'Pulling the pitching card for player ID: {player_id}') this_data = None async with ctx.channel.typing(): this_data = await in_game.data_cache.get_pd_pitchingcard(player_id) await ctx.channel.send(f'Dumping data here:\n\n{this_data}') + @commands.command(name='test-fatigue', help='Mod: Test the fatigue AI') + @commands.is_owner() + async def test_fatigue_command(self, ctx, play_id: int): + this_play = db_calls_gameplay.convert_stratplay(db_calls_gameplay.Play.get_by_id(play_id)) + is_fatigued = in_game.ai_manager.is_pitcher_fatigued(this_play) + await ctx.channel.send(f'Checking fatigue for Play #{play_id} / ' + f'Pitcher {"IS" if is_fatigued else "IS NOT"} fatigued') + async def setup(bot): await bot.add_cog(Admins(bot))