fixed syntax error handling for nether tunnels in addbase

doc_update
Joey Hines 2018-05-26 09:53:36 -05:00
parent 7b1df1922b
commit bb665be4a3
1 changed files with 7 additions and 3 deletions

View File

@ -125,7 +125,7 @@ async def on_ready():
async def on_command_error(error, ctx): async def on_command_error(error, ctx):
if isinstance(error, commands.CommandNotFound): if isinstance(error, commands.CommandNotFound):
error_str = 'Command not found, please use ?help to see all the commands this bot can do.' error_str = 'Command not found, please use ?help to see all the commands this bot can do.'
elif isinstance(error, commands.UserInputError) : elif isinstance(error, commands.UserInputError):
error_str = 'Invalid syntax for {}, please read ?help {}.'.format(ctx.invoked_with, ctx.invoked_with) error_str = 'Invalid syntax for {}, please read ?help {}.'.format(ctx.invoked_with, ctx.invoked_with)
else: else:
error_str = bad_error_message.format(ctx.invoked_with) error_str = bad_error_message.format(ctx.invoked_with)
@ -151,7 +151,11 @@ async def addbase(ctx, name: str, x_pos: int, y_pos: int, z_pos: int, * args):
''' '''
owner = Player(str(ctx.message.author.nick)) owner = Player(str(ctx.message.author.nick))
try:
base = Location(name, x_pos, y_pos, z_pos, owner.in_game_name, args) base = Location(name, x_pos, y_pos, z_pos, owner.in_game_name, args)
except LocationInitError:
raise commands.UserInputError
session.add(owner) session.add(owner)
session.add(base) session.add(base)
@ -213,7 +217,7 @@ async def findbasearound(ctx, x_pos: int, z_pos: int, * args):
radius = 200 radius = 200
if len(args) > 0: if len(args) > 0:
try : try:
radius = int(args[0]) radius = int(args[0])
except ValueError: except ValueError:
raise commands.UserInputError raise commands.UserInputError