Tunnel color changed to tunnel direction.
parent
8a8374b77d
commit
407566a488
|
@ -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__()
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -84,7 +84,7 @@ 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
|
||||
|
||||
|
@ -94,7 +94,7 @@ class Add_Commands:
|
|||
|
||||
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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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]
|
||||
"""
|
||||
|
|
|
@ -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]
|
||||
"""
|
||||
|
|
|
@ -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')
|
||||
|
|
Loading…
Reference in New Issue