From 0593318df5ef58716e26bc30ef192114d9ffea1f Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Sat, 2 Feb 2019 09:37:45 -0600 Subject: [PATCH] Fixed error message in the delete command and added multiple owner formatting --- GeoffreyBot/GeoffreyApiHelper.py | 18 +++++++++++------- GeoffreyBot/geoffrey_api.py | 7 ++++--- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/GeoffreyBot/GeoffreyApiHelper.py b/GeoffreyBot/GeoffreyApiHelper.py index fa0ea52..b17fcfd 100644 --- a/GeoffreyBot/GeoffreyApiHelper.py +++ b/GeoffreyBot/GeoffreyApiHelper.py @@ -1,4 +1,3 @@ - def formatted_item_listing(item): return "{} {} for {}D".format(item["amount"], item["item_name"], item["price"]) @@ -9,8 +8,8 @@ def formatted_location(location): else: tunnel = "" - return '**{}** @ **{}** {}Owner(s): **{}**'.format(location["name"], formatted_position(location), tunnel, - formatted_owners(location)) + return '**{}** @ **{}** {}{}'.format(location["name"], formatted_position(location), tunnel, + formatted_owners(location)) def formatted_tunnel(tunnel): @@ -34,10 +33,15 @@ def formatted_owners(location): if "owner" in location: if len(location["owner"]) == 0: - owner_list = location["owner"][0]["name"] + owner_list = 'Owner: **{}**' + owner_list = owner_list.format(location["owner"][0]["name"]) else: - owner_list = location["owner"][0]["name"] - for owner in location["owner"][1:]: - owner_list += ", " + owner["name"] + owner_list = 'Owners: **{}**' + + owners = location["owner"][0]["name"] + for owner in location["owner"][1:3]: + owners += ", " + owner["name"] + + owner_list = owner_list.format(owners) return owner_list diff --git a/GeoffreyBot/geoffrey_api.py b/GeoffreyBot/geoffrey_api.py index c81bf1f..c8114dc 100644 --- a/GeoffreyBot/geoffrey_api.py +++ b/GeoffreyBot/geoffrey_api.py @@ -161,12 +161,13 @@ class GeoffreyCommands: location = run_command(self.base_url, self.api_token, "POST", "delete", name=name, discord_uuid=ctx.message.author.id) - await ctx.send("{}, **{}** has been deleted from Geoffrey, good riddance.".format(ctx.message.author.mention, - location)) + await ctx.send("{}, **{}** has been deleted from Geoffrey, good riddance.".format(ctx.message.author.mention + , location)) except Exception as e: error_list = [ {"error": "LocationLookUpError", - "message": "{}, you do not have a location by the name you ding dong goober."} + "message": "{}, you do not have a location by the name you ding dong goober.".format( + ctx.message.author)} ] msg = check_error(e, error_list)