diff --git a/GeoffreyBot/geoffrey_api.py b/GeoffreyBot/geoffrey_api.py index a89d4e2..b4a38b9 100644 --- a/GeoffreyBot/geoffrey_api.py +++ b/GeoffreyBot/geoffrey_api.py @@ -60,6 +60,27 @@ class GeoffreyCommands(commands.Cog): self.base_url = bot.base_url self.api_token = bot.api_token + @commands.command(pass_context=True) + async def add_attraction(self, ctx, x_pos: int, z_pos: int, *args): + """ + {}add_attraction + The Name parameter is optional if this is your first attraction + + """ + + errors = { + "LocationLookUpError": "you have more than one location. Please specify a name." + } + + name = get_name(args) + + attraction = await run_command(ctx, self.base_url, self.api_token, "POST", "add_attraction", x_pos=x_pos, + z_pos=z_pos, name=name, discord_uuid=ctx.message.author.id, errors=errors) + + await ctx.send( + '{}, your attraction has been added to the database: \n{}'.format(ctx.message.author.mention, + formatted_location(attraction))) + @commands.command(pass_context=True) async def add_base(self, ctx, x_pos: int, z_pos: int, *args): """