diff --git a/GeoffreyBot/geoffrey_api.py b/GeoffreyBot/geoffrey_api.py index 17b112d..92cd948 100644 --- a/GeoffreyBot/geoffrey_api.py +++ b/GeoffreyBot/geoffrey_api.py @@ -179,13 +179,11 @@ class GeoffreyCommands(commands.Cog): async def add_owner(self, ctx, new_owner_name, *args): """ {}add_owner - WARNING: The new owner had just as much power as you to edit or delete this location. + WARNING: The new owner has just as much power as you to edit or delete this location. """ errors = { - "OwnerNotFoundError": "ain't no one in this darn database named **{}** you goob".format( - ctx.message.author.mention, new_owner_name), - "IsOwnerError": "**{}** is already an owner, stop having amosia.".format( - ctx.message.author.mention, new_owner_name), + "OwnerNotFoundError": "ain't no one in this darn database named **{}** you goob".format(new_owner_name), + "IsOwnerError": "**{}** is already an owner, stop having amosia.".format(new_owner_name), "LocationLookUpError": "you do not have a location by that name you ding dong goober." } @@ -207,7 +205,7 @@ class GeoffreyCommands(commands.Cog): "ResidentNotFoundError": "ain't no one in this darn database named **{}** you goob".format( new_resident_name), "IsResidentError": "**{}** is already a resident, stop having amosia.".format(new_resident_name), - "LocationLookupError": "you do not have a town by that name you ding dong goober." + "LocationLookUpError": "you do not have a town by that name you ding dong goober." } town_name = get_name(args) @@ -263,7 +261,7 @@ class GeoffreyCommands(commands.Cog): @commands.command(pass_context=True) async def add_town(self, ctx, x_pos: int, z_pos: int, *args): """ - {}add_town + {}add_town The Town Name parameter is optional if this is your first town """ errors = { @@ -283,15 +281,15 @@ class GeoffreyCommands(commands.Cog): @commands.command(pass_context=True) async def add_tunnel(self, ctx, tunnel_direction, tunnel_number: int, *args): """ - {}add_tunnel + {}add_tunnel The Name parameter is optional if you only have one location """ - errors = { - "InvalidTunnelError": "{} is not a valid tunnel direction ya gub".format(tunnel_direction), - "LocationLookUpError": "you do not have a location by the name you ding dong goober." - } name = get_name(args) + errors = { + "InvalidTunnelError": "{} is not a valid tunnel direction ya gub".format(tunnel_direction), + "LocationLookUpError": "you do not have a location by the name **{}** you ding dong goober.".format(name) + } tunnel = await run_command(ctx, self.base_url, self.api_token, "POST", "add_tunnel", errors=errors, tunnel_direction=tunnel_direction, @@ -369,7 +367,7 @@ class GeoffreyCommands(commands.Cog): errors = { "EntryNameNotUniqueError": "a location is already called **{}** you ding dong goober".format(old_name), - "LocationLookupError": "you do not have a location by the name **{}** you ding dong goober.".format( + "LocationLookUpError": "you do not have a location by the name **{}** you ding dong goober.".format( old_name) } @@ -383,7 +381,7 @@ class GeoffreyCommands(commands.Cog): @commands.command(pass_conext=True) async def edit_pos(self, ctx, new_x: int, new_z: int, *args): """ - {}edit_post + {}edit_pos """ loc_name = get_name(args) @@ -409,8 +407,8 @@ class GeoffreyCommands(commands.Cog): errors = { "LocationLookUpError": "you do not have a location by the name **{}** you ding dong goober.".format( - "loc_name"), - "InvalidLookUpError": "{} is not a valid tunnel direction ya gub".format(new_tunnel_direction) + loc_name), + "InvalidTunnelError": "{} is not a valid tunnel direction ya gub".format(new_tunnel_direction) } location = await run_command(ctx, self.base_url, self.api_token, "POST", "edit_tunnel", errors=errors, @@ -438,7 +436,7 @@ class GeoffreyCommands(commands.Cog): radius = 200 locations = await run_command(ctx, self.base_url, self.api_token, "GET", "find_around", errors=errors, - x_pos=x_pos, z_pos=z_pos) + x_pos=x_pos, z_pos=z_pos, radius=radius) message = ["{}, the following locations are within **{}** blocks of (x={}, z={}):".format( ctx.message.author.mention, radius, x_pos, z_pos)] @@ -448,6 +446,27 @@ class GeoffreyCommands(commands.Cog): await self.bot.send_list(ctx, message) + @commands.command(pass_context=True) + async def find_farm(self, ctx, *args): + """ + {}find_farm + """ + + search = get_name(args) + + errors = { + "ResourceNotFoundError": "there are no farms that match **{}**.".format(search) + } + locations = await run_command(ctx, self.base_url, self.api_token, "GET", "find_farm", errors=errors, + resource_name=search) + + message = ["{}, the following farms produce **{}**:".format(ctx.message.author.mention, search)] + + for location in locations: + message.append(formatted_location(location)) + + await self.bot.send_list(ctx, message) + @commands.command(pass_context=True, aliases=["find"]) async def find_location(self, ctx, *args): """ @@ -557,7 +576,7 @@ class GeoffreyCommands(commands.Cog): town_name = get_name(args) errors = { - "ResidentNotFoundError": "ain't no one your town named {} you goob".format(resident_name), + "ResidentNotFoundError": "ain't no one in your town named {} you goob".format(resident_name), "LocationLookUpError": "you do not have a town called **{}** you ding dong goober.".format(town_name) } @@ -595,7 +614,7 @@ class GeoffreyCommands(commands.Cog): @commands.command(pass_context=True) async def selling_price(self, ctx, *args): """ - {}selling_rpice + {}selling_price Sorts by best price """ item = get_name(args)