From 3911daa4302efa10b948ddcb996d426edccb0d29 Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Tue, 14 May 2019 08:02:14 -0500 Subject: [PATCH] Fixed missing parameters not being handled on on_command_error --- GeoffreyBot/geoffrey.py | 8 ++++++++ GeoffreyBot/geoffrey_api.py | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/GeoffreyBot/geoffrey.py b/GeoffreyBot/geoffrey.py index ba86c6c..2f91c57 100644 --- a/GeoffreyBot/geoffrey.py +++ b/GeoffreyBot/geoffrey.py @@ -88,6 +88,14 @@ class GeoffreyBot(commands.Bot): elif hasattr(error, "original") and isinstance(error.original, request_exception.ConnectionError): error_str = "Unable to connect to the database. Hopefully someone is working on this..." await self.send_error_message("Can't connect to the GeoffreyAPI, is it offline?") + elif hasattr(error, "original"): + e = error.original.args[0] + + if e == "TypeError": + error_str = "Well bud, you got this far. Good job! But you still h*cked up the syntax:" + + for line in self.help_dict[ctx.command.name]: + error_str += line if error_str is '': await self.send_error_message( diff --git a/GeoffreyBot/geoffrey_api.py b/GeoffreyBot/geoffrey_api.py index eac53c7..17b112d 100644 --- a/GeoffreyBot/geoffrey_api.py +++ b/GeoffreyBot/geoffrey_api.py @@ -353,7 +353,7 @@ class GeoffreyCommands(commands.Cog): "ItemNotFound": "your farm does not produce **{}**. Try again buddy boy.".format(resource_name) } - farm = await run_command(ctx, self.base_url, self.api_token, "POST", "delete_item", errors=errors, + farm = await run_command(ctx, self.base_url, self.api_token, "POST", "delete_resource", errors=errors, resource=resource_name, farm_name=farm_name, discord_uuid=ctx.message.author.id) @@ -413,7 +413,7 @@ class GeoffreyCommands(commands.Cog): "InvalidLookUpError": "{} is not a valid tunnel direction ya gub".format(new_tunnel_direction) } - location = run_command(ctx, self.base_url, self.api_token, "POST", "edit_tunnel", errors=errors, + location = await run_command(ctx, self.base_url, self.api_token, "POST", "edit_tunnel", errors=errors, tunnel_direction=new_tunnel_direction, tunnel_number=new_tunnel_number, loc_name=loc_name, discord_uuid=ctx.message.author.id) @@ -537,7 +537,7 @@ class GeoffreyCommands(commands.Cog): {}register """ errors = { - "PlayerinDBError": "you are already registered with Geoffrey you ding dong." + "PlayerInDBError": "you are already registered with Geoffrey you ding dong." } await run_command(ctx, self.base_url, self.api_token, "POST", "register", errors=errors,