From 93fba48b150f395ff46f6bb8359b76bf0584a2c2 Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Mon, 13 May 2019 09:49:47 -0500 Subject: [PATCH] Added add_attraction command --- GeoffreyBot/geoffrey_api.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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): """