diff --git a/geoffrey/Commands.py b/geoffrey/Commands.py index fdc3eb1..e2ffb70 100644 --- a/geoffrey/Commands.py +++ b/geoffrey/Commands.py @@ -74,7 +74,7 @@ class Commands: return shop_name - def add_tunnel(self, tunnel_color, tunnel_number, location_name=None, discord_uuid=None, mc_uuid=None): + def add_tunnel(self, tunnel_direction, tunnel_number, location_name=None, discord_uuid=None, mc_uuid=None): session = self.interface.database.Session() try: @@ -88,7 +88,7 @@ class Commands: location_name = location_list[0].name - tunnel = self.interface.add_tunnel(session, player, tunnel_color, tunnel_number, location_name) + tunnel = self.interface.add_tunnel(session, player, tunnel_direction, tunnel_number, location_name) tunnel_info = tunnel.__str__() finally: @@ -223,7 +223,7 @@ class Commands: return loc_str - def edit_tunnel(self, tunnel_color, tunnel_number, loc_name, discord_uuid=None, mc_uuid=None): + def edit_tunnel(self, tunnel_direction, tunnel_number, loc_name, discord_uuid=None, mc_uuid=None): session = self.interface.database.Session() try: @@ -231,10 +231,10 @@ class Commands: location = self.interface.find_location_by_name_and_owner(session, player, loc_name)[0] if location.tunnel is not None: - location.tunnel.tunnel_direction = TunnelDirection.str_to_tunnel_dir(tunnel_color) + location.tunnel.tunnel_direction = TunnelDirection.str_to_tunnel_dir(tunnel_direction) location.tunnel.tunnel_number = tunnel_number else: - self.interface.add_tunnel(session, player, tunnel_color, tunnel_number, loc_name) + self.interface.add_tunnel(session, player, tunnel_direction, tunnel_number, loc_name) loc_str = location.__str__() diff --git a/geoffrey/DatabaseInterface.py b/geoffrey/DatabaseInterface.py index 1edd9d2..5c578f3 100644 --- a/geoffrey/DatabaseInterface.py +++ b/geoffrey/DatabaseInterface.py @@ -17,7 +17,7 @@ class DatabaseInterface: self.database.add_object(session, loc) return loc - def add_tunnel(self, session, owner, color, number, location_name): + def add_tunnel(self, session, owner, direction, number, location_name): tunnels = self.find_tunnel_by_owner(session, owner) if location_name is None: if len(tunnels): @@ -34,7 +34,7 @@ class DatabaseInterface: except IndexError: raise LocationLookUpError - tunnel = Tunnel(owner, color, number, location) + tunnel = Tunnel(owner, direction, number, location) self.database.add_object(session, tunnel) return tunnel diff --git a/geoffrey/cogs/Add_Commands.py b/geoffrey/cogs/Add_Commands.py index 748dec2..1e0737a 100644 --- a/geoffrey/cogs/Add_Commands.py +++ b/geoffrey/cogs/Add_Commands.py @@ -84,17 +84,17 @@ class Add_Commands: @commands.command(pass_context=True) @commands.cooldown(5, 60, commands.BucketType.user) - async def add_tunnel(self, ctx, tunnel_color: str, tunnel_number: int, *args): + async def add_tunnel(self, ctx, tunnel_direction: str, tunnel_number: int, *args): """ Adds your tunnel to the database. If you only have one location, you do not need to specify a location name - Directions: North South East West + Directions: North South East West ?tunnel [Tunnel Direction] [Tunnel Number] [Location Name] """ loc_name = get_name(args) try: - self.bot.bot_commands.add_tunnel(tunnel_color, tunnel_number, discord_uuid=ctx.message.author.id, + self.bot.bot_commands.add_tunnel(tunnel_direction, tunnel_number, discord_uuid=ctx.message.author.id, location_name=loc_name) await ctx.send('{}, your tunnel has been added to the database'.format(ctx.message.author.mention)) except LocationLookUpError: @@ -103,13 +103,13 @@ class Add_Commands: except LocationHasTunnelError: await ctx.send('{}, **{}** already has a tunnel.'.format(ctx.message.author.mention, loc_name)) except TunnelInitError: - await ctx.send('{}, invalid tunnel name.'.format(ctx.message.author.mention)) + await ctx.send('{}, invalid tunnel direction.'.format(ctx.message.author.mention)) except EntryNameNotUniqueError: await ctx.send('{}, you have more than one location, you need to specify a location.' .format(ctx.message.author.mention)) except InvalidTunnelError: await ctx.send( - '{}, **{}** is an invalid tunnel color.'.format(ctx.message.author.mention, tunnel_color)) + '{}, **{}** is an invalid tunnel direction.'.format(ctx.message.author.mention, tunnel_direction)) @commands.command(pass_context=True) @commands.cooldown(5, 60, commands.BucketType.user) diff --git a/geoffrey/cogs/Delete_Commands.py b/geoffrey/cogs/Delete_Commands.py index 3174ea6..932bda3 100644 --- a/geoffrey/cogs/Delete_Commands.py +++ b/geoffrey/cogs/Delete_Commands.py @@ -18,6 +18,7 @@ class Delete_Commands: async def delete(self, ctx, *args): """ Deletes a location from the database + ?delete [Location name] """ loc = get_name(args) @@ -34,7 +35,7 @@ class Delete_Commands: @commands.command(pass_context=True) async def delete_item(self, ctx, item: str, *args): """ - Deletes an item listing from a shop inventory + Deletes an item listing from a shop inventory ?delete_name [Item] [Shop Name] """ diff --git a/geoffrey/cogs/Edit_Commands.py b/geoffrey/cogs/Edit_Commands.py index 1c3668f..9a0480c 100644 --- a/geoffrey/cogs/Edit_Commands.py +++ b/geoffrey/cogs/Edit_Commands.py @@ -17,6 +17,7 @@ class Edit_Commands: async def edit_pos(self, ctx, x_pos: int, y_pos: int, *args): """ Edits the position of a location + ?edit_pos [X Coordinate] [Z Coordinate] [Location Name] """ loc = get_name(args) @@ -31,14 +32,16 @@ class Edit_Commands: @commands.command(pass_context=True) @commands.cooldown(5, 60, commands.BucketType.user) - async def edit_tunnel(self, ctx, tunnel_color: str, tunnel_number: int, *args): + async def edit_tunnel(self, ctx, tunnel_direction: str, tunnel_number: int, *args): """ Edits the tunnel of a location - ?edit_tunnel [Tunnel Color] [Tunnel Number] [Location Name] + + Directions: North South East West + ?edit_tunnel [Tunnel Direction] [Tunnel Number] [Location Name] """ loc = get_name(args) try: - loc_str = self.bot.bot_commands.edit_tunnel(tunnel_color, tunnel_number, loc, + loc_str = self.bot.bot_commands.edit_tunnel(tunnel_direction, tunnel_number, loc, discord_uuid=ctx.message.author.id) await ctx.send( @@ -48,13 +51,14 @@ class Edit_Commands: ctx.message.author.mention, loc)) except InvalidTunnelError: await ctx.send( - '{}, **{}** is an invalid tunnel color.'.format(ctx.message.author.mention, tunnel_color)) + '{}, **{}** is an invalid tunnel direction.'.format(ctx.message.author.mention, tunnel_direction)) @commands.command(pass_context=True) @commands.cooldown(5, 60, commands.BucketType.user) async def edit_name(self, ctx, new_name: str, current_name: str): """ Edits the name of a location + IF A NAME HAS SPACES IN IT YOU NEED TO WRAP IT IN QUOTATION MARKS. eg. "Cool Shop 123" ?edit_name [New Name] [Current Name] """ diff --git a/geoffrey/cogs/Search_Commands.py b/geoffrey/cogs/Search_Commands.py index 8c57eb9..05484f1 100644 --- a/geoffrey/cogs/Search_Commands.py +++ b/geoffrey/cogs/Search_Commands.py @@ -98,6 +98,7 @@ class Search_Commands: async def selling(self, ctx, item_name: str): """ Lists all the shops selling an item + ?selling [item] """ try: @@ -112,6 +113,7 @@ class Search_Commands: async def info(self, ctx, *args): """ Displays info about a location. + If the location is a shop, it displays the shop's inventory ?info [Location Name] """ diff --git a/geoffrey/tests/test_commands.py b/geoffrey/tests/test_commands.py index d2af525..5a46575 100644 --- a/geoffrey/tests/test_commands.py +++ b/geoffrey/tests/test_commands.py @@ -238,7 +238,7 @@ class TestCommands(TestCase): def test_update_mc_uuid(self): self.commands.register('BirbHD', '143072699567177728') - self.commands.update_mc_uuid('0', '143072699567177728') + self.commands.update_mc_uuid('143072699567177728', '0') self.assertRaises(PlayerNotFound, self.commands.add_shop, 0, 0, shop_name='test shop', mc_uuid='fe7e84132570458892032b69ff188bc3')