added error messages to not enough lines on new commands

This commit is contained in:
Sakimori 2021-01-03 03:55:03 -05:00
parent 28dca13f53
commit f16cee6f84

View File

@ -302,6 +302,7 @@ class SwapPlayerCommand(Command):
description = "Swaps a player from lineup to rotation, or from rotation to lineup. Requires team ownership." description = "Swaps a player from lineup to rotation, or from rotation to lineup. Requires team ownership."
async def execute(self, msg, command): async def execute(self, msg, command):
try:
team_name = command.split("\n")[1].strip() team_name = command.split("\n")[1].strip()
player_name = command.split("\n")[2].strip() player_name = command.split("\n")[2].strip()
team, owner_id = games.get_team_and_owner(team_name) team, owner_id = games.get_team_and_owner(team_name)
@ -318,6 +319,8 @@ class SwapPlayerCommand(Command):
await msg.channel.send(embed=build_team_embed(team)) await msg.channel.send(embed=build_team_embed(team))
games.update_team(team) games.update_team(team)
await msg.channel.send("Paperwork signed, stamped, copied, and faxed up to the goddess. Xie's pretty quick with this stuff.") await msg.channel.send("Paperwork signed, stamped, copied, and faxed up to the goddess. Xie's pretty quick with this stuff.")
except IndexError:
await msg.channel.send("Three lines, remember? Command, then team, then name.")
class MovePlayerCommand(Command): class MovePlayerCommand(Command):
name = "move" name = "move"
@ -328,6 +331,7 @@ class MovePlayerCommand(Command):
description = "Moves a player in your lineup or rotation. Requires team ownership." description = "Moves a player in your lineup or rotation. Requires team ownership."
async def execute(self, msg, command): async def execute(self, msg, command):
try:
team_name = command.split("\n")[1].strip() team_name = command.split("\n")[1].strip()
player_name = command.split("\n")[2].strip() player_name = command.split("\n")[2].strip()
team, owner_id = games.get_team_and_owner(team_name) team, owner_id = games.get_team_and_owner(team_name)
@ -346,6 +350,8 @@ class MovePlayerCommand(Command):
await msg.channel.send(embed=build_team_embed(team)) await msg.channel.send(embed=build_team_embed(team))
games.update_team(team) games.update_team(team)
await msg.channel.send("Paperwork signed, stamped, copied, and faxed up to the goddess. Xie's pretty quick with this stuff.") await msg.channel.send("Paperwork signed, stamped, copied, and faxed up to the goddess. Xie's pretty quick with this stuff.")
except IndexError:
await msg.channel.send("Four lines, remember? Command, then team, then name, and finally, new spot on the lineup or rotation.")
class AddPlayerCommand(Command): class AddPlayerCommand(Command):
name = "addplayer" name = "addplayer"
@ -355,6 +361,7 @@ class AddPlayerCommand(Command):
description = "Recruits a new player to your team, as either a pitcher or a batter. Requires team ownership." description = "Recruits a new player to your team, as either a pitcher or a batter. Requires team ownership."
async def execute(self, msg, command): async def execute(self, msg, command):
try:
team_name = command.split("\n")[1].strip() team_name = command.split("\n")[1].strip()
player_name = command.split("\n")[2].strip() player_name = command.split("\n")[2].strip()
team, owner_id = games.get_team_and_owner(team_name) team, owner_id = games.get_team_and_owner(team_name)
@ -376,6 +383,8 @@ class AddPlayerCommand(Command):
await msg.channel.send(embed=build_team_embed(team)) await msg.channel.send(embed=build_team_embed(team))
games.update_team(team) games.update_team(team)
await msg.channel.send("Paperwork signed, stamped, copied, and faxed up to the goddess. Xie's pretty quick with this stuff.") await msg.channel.send("Paperwork signed, stamped, copied, and faxed up to the goddess. Xie's pretty quick with this stuff.")
except IndexError:
await msg.channel.send("Three lines, remember? Command, then team, then name.")
class DeletePlayerCommand(Command): class DeletePlayerCommand(Command):
name = "removeplayer" name = "removeplayer"
@ -384,6 +393,7 @@ class DeletePlayerCommand(Command):
[player name]""" [player name]"""
async def execute(self, msg, command): async def execute(self, msg, command):
try:
team_name = command.split("\n")[1].strip() team_name = command.split("\n")[1].strip()
player_name = command.split("\n")[2].strip() player_name = command.split("\n")[2].strip()
team, owner_id = games.get_team_and_owner(team_name) team, owner_id = games.get_team_and_owner(team_name)
@ -399,6 +409,8 @@ class DeletePlayerCommand(Command):
await msg.channel.send(embed=build_team_embed(team)) await msg.channel.send(embed=build_team_embed(team))
games.update_team(team) games.update_team(team)
await msg.channel.send("Paperwork signed, stamped, copied, and faxed up to the goddess. Xie's pretty quick with this stuff.") await msg.channel.send("Paperwork signed, stamped, copied, and faxed up to the goddess. Xie's pretty quick with this stuff.")
except IndexError:
await msg.channel.send("Three lines, remember? Command, then team, then name.")
class HelpCommand(Command): class HelpCommand(Command):