fixed an error message

This commit is contained in:
Sakimori 2021-04-01 01:53:01 -04:00
parent 38ef0fea36
commit 55f6906b29

View file

@ -890,26 +890,29 @@ class LeagueDisplayCommand(Command):
description = "Displays the current standings for the given league. Use `--season X` or `-s X` to get standings from season X of that league." description = "Displays the current standings for the given league. Use `--season X` or `-s X` to get standings from season X of that league."
async def execute(self, msg, command, flags): async def execute(self, msg, command, flags):
if league_exists(command.split("\n")[1].strip()): try:
try: if league_exists(command.split("\n")[1].strip()):
league = leagues.load_league_file(command.split("\n")[1].strip()) try:
except IndexError: league = leagues.load_league_file(command.split("\n")[1].strip())
raise CommandError("League name goes on the second line now, boss.") except IndexError:
raise CommandError("League name goes on the second line now, boss.")
for flag in flags: for flag in flags:
if flag[0] == "s": if flag[0] == "s":
try: try:
season_num = int(flag[1]) season_num = int(flag[1])
await msg.channel.send(embed=league.past_standings(season_num)) await msg.channel.send(embed=league.past_standings(season_num))
return return
except ValueError: except ValueError:
raise CommandError("Give us a proper number, boss.") raise CommandError("Give us a proper number, boss.")
except TypeError: except TypeError:
raise CommandError("That season hasn't been played yet, chief.") raise CommandError("That season hasn't been played yet, chief.")
await msg.channel.send(embed=league.standings_embed()) await msg.channel.send(embed=league.standings_embed())
else: else:
raise CommandError("Can't find that league, boss.") raise CommandError("Can't find that league, boss.")
except IndexError:
raise CommandError("League name goes on the second line now, boss.")
class LeagueLeadersCommand(Command): class LeagueLeadersCommand(Command):
name = "leagueleaders" name = "leagueleaders"