This commit is contained in:
Sakimori 2021-03-28 13:14:34 -04:00
parent f7b9ac3195
commit e1c3f26585
2 changed files with 56 additions and 45 deletions

View file

@ -22,6 +22,7 @@ class league_structure(object):
self.weather_override = None #set to a weather for league-wide weather effects
self.last_weather_event_day = 0
self.weather_event_duration = 0
self.postseason = True
def setup(self, league_dic, division_games = 1, inter_division_games = 1, inter_league_games = 1, games_per_hour = 2):
self.league = league_dic # { subleague name : { division name : [team object] } }

View file

@ -769,6 +769,7 @@ Not every team will play every series, due to how the scheduling algorithm is co
async def execute(self, msg, command, flags):
autoplay = -1
autopost = False
nopost = False
if config()["game_freeze"]:
raise CommandError("Patch incoming. We're not allowing new games right now.")
@ -783,10 +784,15 @@ Not every team will play every series, due to how the scheduling algorithm is co
raise ValueError
except ValueError:
raise CommandError("Sorry boss, the queue flag needs a natural number. Any whole number over 0 will do just fine.")
elif flag[0] == "n":
elif flag[0] == "n": #noautopostseason
await msg.channel.send("Automatic postseason is now disabled by default! No need for this flag in the future. --autopostseason (or -a) will *enable* autopostseason, should you want it.")
elif flag[0] == "a":
elif flag[0] == "a": #autopostseason
await msg.channel.send("We'll automatically start postseason for you, when we get there.")
autopost = True
elif flag[0] == "s": #skippostseason
await msg.channel.send("We'll **skip postseason** for you! Make sure you wanted to do this.")
autopost = True
nopost = True
else:
raise CommandError("One or more of those flags wasn't right. Try and fix that for us and we'll see about sorting you out.")
@ -803,6 +809,8 @@ Not every team will play every series, due to how the scheduling algorithm is co
league = leagues.load_league_file(league_name)
if autoplay == -1 and not autopost:
autoplay = int(list(league.schedule.keys())[-1]) - league.day_to_series_num(league.day) + 1
if nopost:
league.postseason = False
if league.historic:
raise CommandError("That league is done and dusted, chief. Sorry.")
@ -2361,6 +2369,7 @@ async def league_postseason(channel, league):
embed.set_footer(text="Final Standings")
await channel.send(embed=embed)
if league.postseason:
tiebreakers = league.tiebreaker_required()
if tiebreakers != []:
@ -2427,6 +2436,7 @@ async def league_postseason(channel, league):
await asyncio.sleep(wait_seconds)
await start_tournament_round(channel, world_series)
league.champion = world_series.winner.name
leagues.save_league(league)
season_save(league)
league.season_reset()