Fixed error message in the delete command and added multiple owner formatting
parent
a9fb0b1ce9
commit
0593318df5
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
def formatted_item_listing(item):
|
def formatted_item_listing(item):
|
||||||
return "{} {} for {}D".format(item["amount"], item["item_name"], item["price"])
|
return "{} {} for {}D".format(item["amount"], item["item_name"], item["price"])
|
||||||
|
|
||||||
|
@ -9,8 +8,8 @@ def formatted_location(location):
|
||||||
else:
|
else:
|
||||||
tunnel = ""
|
tunnel = ""
|
||||||
|
|
||||||
return '**{}** @ **{}** {}Owner(s): **{}**'.format(location["name"], formatted_position(location), tunnel,
|
return '**{}** @ **{}** {}{}'.format(location["name"], formatted_position(location), tunnel,
|
||||||
formatted_owners(location))
|
formatted_owners(location))
|
||||||
|
|
||||||
|
|
||||||
def formatted_tunnel(tunnel):
|
def formatted_tunnel(tunnel):
|
||||||
|
@ -34,10 +33,15 @@ def formatted_owners(location):
|
||||||
if "owner" in location:
|
if "owner" in location:
|
||||||
|
|
||||||
if len(location["owner"]) == 0:
|
if len(location["owner"]) == 0:
|
||||||
owner_list = location["owner"][0]["name"]
|
owner_list = 'Owner: **{}**'
|
||||||
|
owner_list = owner_list.format(location["owner"][0]["name"])
|
||||||
else:
|
else:
|
||||||
owner_list = location["owner"][0]["name"]
|
owner_list = 'Owners: **{}**'
|
||||||
for owner in location["owner"][1:]:
|
|
||||||
owner_list += ", " + owner["name"]
|
owners = location["owner"][0]["name"]
|
||||||
|
for owner in location["owner"][1:3]:
|
||||||
|
owners += ", " + owner["name"]
|
||||||
|
|
||||||
|
owner_list = owner_list.format(owners)
|
||||||
|
|
||||||
return owner_list
|
return owner_list
|
||||||
|
|
|
@ -161,12 +161,13 @@ class GeoffreyCommands:
|
||||||
location = run_command(self.base_url, self.api_token, "POST", "delete", name=name,
|
location = run_command(self.base_url, self.api_token, "POST", "delete", name=name,
|
||||||
discord_uuid=ctx.message.author.id)
|
discord_uuid=ctx.message.author.id)
|
||||||
|
|
||||||
await ctx.send("{}, **{}** has been deleted from Geoffrey, good riddance.".format(ctx.message.author.mention,
|
await ctx.send("{}, **{}** has been deleted from Geoffrey, good riddance.".format(ctx.message.author.mention
|
||||||
location))
|
, location))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
error_list = [
|
error_list = [
|
||||||
{"error": "LocationLookUpError",
|
{"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)
|
msg = check_error(e, error_list)
|
||||||
|
|
Loading…
Reference in New Issue