added delete_item command
parent
f8c4009f19
commit
14191e87fe
30
Commands.py
30
Commands.py
|
@ -56,25 +56,25 @@ class Commands:
|
||||||
|
|
||||||
return base_str
|
return base_str
|
||||||
|
|
||||||
def add_shop(self, x_pos, z_pos, shop_str=None, discord_uuid=None, mc_uuid=None):
|
def add_shop(self, x_pos, z_pos, shop_name=None, discord_uuid=None, mc_uuid=None):
|
||||||
session = self.interface.database.Session()
|
session = self.interface.database.Session()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
player = self.get_player(session, discord_uuid, mc_uuid)
|
player = self.get_player(session, discord_uuid, mc_uuid)
|
||||||
|
|
||||||
if len(self.interface.find_shop_by_owner(session, player)) == 0:
|
if len(self.interface.find_shop_by_owner(session, player)) == 0:
|
||||||
if shop_str is None:
|
if shop_name is None:
|
||||||
shop_str = "{}'s Shop".format(player.name)
|
shop_name = "{}'s Shop".format(player.name)
|
||||||
elif shop_str is None:
|
elif shop_name is None:
|
||||||
raise EntryNameNotUniqueError
|
raise EntryNameNotUniqueError
|
||||||
|
|
||||||
shop = self.interface.add_shop(session, player, shop_str, x_pos, z_pos)
|
shop = self.interface.add_shop(session, player, shop_name, x_pos, z_pos)
|
||||||
|
|
||||||
shop_str = shop.__str__()
|
shop_name = shop.__str__()
|
||||||
finally:
|
finally:
|
||||||
session.close()
|
session.close()
|
||||||
|
|
||||||
return shop_str
|
return shop_name
|
||||||
|
|
||||||
def add_tunnel(self, tunnel_color, tunnel_number, location_name, discord_uuid=None, mc_uuid=None):
|
def add_tunnel(self, tunnel_color, tunnel_number, location_name, discord_uuid=None, mc_uuid=None):
|
||||||
|
|
||||||
|
@ -258,4 +258,20 @@ class Commands:
|
||||||
|
|
||||||
return loc_str
|
return loc_str
|
||||||
|
|
||||||
|
def delete_item(self, item, shop_name, discord_uuid=None, mc_uuid=None):
|
||||||
|
session = self.interface.database.Session()
|
||||||
|
|
||||||
|
try:
|
||||||
|
player = self.get_player(session, discord_uuid=discord_uuid, mc_uuid=mc_uuid)
|
||||||
|
shop = self.interface.find_shop_by_name_and_owner(session, player, shop_name)[0]
|
||||||
|
|
||||||
|
expr = (ItemListing.name == item) & (ItemListing.shop == shop)
|
||||||
|
self.interface.database.delete_entry(session, ItemListing, expr)
|
||||||
|
|
||||||
|
shop_str = shop.full_str()
|
||||||
|
finally:
|
||||||
|
session.close()
|
||||||
|
|
||||||
|
return shop_str
|
||||||
|
|
||||||
|
|
||||||
|
|
60
Geoffrey.py
60
Geoffrey.py
|
@ -86,11 +86,11 @@ async def register(ctx):
|
||||||
|
|
||||||
@commands.cooldown(5, 60, commands.BucketType.user)
|
@commands.cooldown(5, 60, commands.BucketType.user)
|
||||||
@bot.command(pass_context=True)
|
@bot.command(pass_context=True)
|
||||||
async def addbase(ctx, x_pos: int, z_pos: int, * args):
|
async def add_base(ctx, x_pos: int, z_pos: int, * args):
|
||||||
'''
|
'''
|
||||||
Adds your base to the database.
|
Adds your base to the database.
|
||||||
The name is optional.
|
The name is optional.
|
||||||
?addbase [X Coordinate] [Z Coordinate] [Base Name]
|
?add_base [X Coordinate] [Z Coordinate] [Base Name]
|
||||||
'''
|
'''
|
||||||
|
|
||||||
name = get_name(args)
|
name = get_name(args)
|
||||||
|
@ -111,17 +111,17 @@ async def addbase(ctx, x_pos: int, z_pos: int, * args):
|
||||||
|
|
||||||
@commands.cooldown(5, 60, commands.BucketType.user)
|
@commands.cooldown(5, 60, commands.BucketType.user)
|
||||||
@bot.command(pass_context=True)
|
@bot.command(pass_context=True)
|
||||||
async def addshop(ctx, x_pos: int, z_pos: int, *args):
|
async def add_shop(ctx, x_pos: int, z_pos: int, *args):
|
||||||
'''
|
'''
|
||||||
Adds your shop to the database.
|
Adds your shop to the database.
|
||||||
The name is optional.
|
The name is optional.
|
||||||
?addshop [X Coordinate] [Z Coordinate] [Shop Name]
|
?add_shop [X Coordinate] [Z Coordinate] [Shop Name]
|
||||||
'''
|
'''
|
||||||
|
|
||||||
name = get_name(args)
|
name = get_name(args)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
shop = bot_commands.add_shop(x_pos, z_pos, shop_str=name, discord_uuid=ctx.message.author.id)
|
shop = bot_commands.add_shop(x_pos, z_pos, shop_name=name, discord_uuid=ctx.message.author.id)
|
||||||
await bot.say('{}, your shop has been added to the database: \n\n{}'.format(ctx.message.author.mention, shop))
|
await bot.say('{}, your shop has been added to the database: \n\n{}'.format(ctx.message.author.mention, shop))
|
||||||
except LocationInitError:
|
except LocationInitError:
|
||||||
raise commands.UserInputError
|
raise commands.UserInputError
|
||||||
|
@ -136,15 +136,15 @@ async def addshop(ctx, x_pos: int, z_pos: int, *args):
|
||||||
|
|
||||||
@commands.cooldown(5, 60, commands.BucketType.user)
|
@commands.cooldown(5, 60, commands.BucketType.user)
|
||||||
@bot.command(pass_context=True)
|
@bot.command(pass_context=True)
|
||||||
async def addtunnel(ctx, tunnel_color: str, tunnel_number: int, *args):
|
async def add_tunnel(ctx, tunnel_color: str, tunnel_number: int, *args):
|
||||||
'''
|
'''
|
||||||
Adds your tunnel to the database.
|
Adds your tunnel to the database.
|
||||||
The location name is optional.
|
The location name is optional.
|
||||||
?tunnel [Tunnel Color] [Tunnel Number] [Location Name]
|
?tunnel [Tunnel Color] [Tunnel Number] [Location Name]
|
||||||
'''
|
'''
|
||||||
try:
|
|
||||||
loc_name = get_name(args)
|
|
||||||
|
|
||||||
|
loc_name = get_name(args)
|
||||||
|
try:
|
||||||
bot_commands.add_tunnel(tunnel_color, tunnel_number, discord_uuid=ctx.message.author.id, location_name=loc_name)
|
bot_commands.add_tunnel(tunnel_color, tunnel_number, discord_uuid=ctx.message.author.id, location_name=loc_name)
|
||||||
await bot.say('{}, your tunnel has been added to the database'.format(ctx.message.author.mention))
|
await bot.say('{}, your tunnel has been added to the database'.format(ctx.message.author.mention))
|
||||||
except EntryNameNotUniqueError:
|
except EntryNameNotUniqueError:
|
||||||
|
@ -159,7 +159,7 @@ async def addtunnel(ctx, tunnel_color: str, tunnel_number: int, *args):
|
||||||
except TunnelInitError:
|
except TunnelInitError:
|
||||||
await bot.say('{}, invalid tunnel color.'.format(ctx.message.author.mention))
|
await bot.say('{}, invalid tunnel color.'.format(ctx.message.author.mention))
|
||||||
except InvalidTunnelError:
|
except InvalidTunnelError:
|
||||||
await bot.say('{}, {} is an invalid tunnel color.'.format(ctx.message.author.mention, tunnel_color))
|
await bot.say('{}, **{}** is an invalid tunnel color.'.format(ctx.message.author.mention, tunnel_color))
|
||||||
|
|
||||||
|
|
||||||
@commands.cooldown(5, 60, commands.BucketType.user)
|
@commands.cooldown(5, 60, commands.BucketType.user)
|
||||||
|
@ -169,8 +169,8 @@ async def find(ctx, * args):
|
||||||
Finds all the locations and tunnels matching the search term
|
Finds all the locations and tunnels matching the search term
|
||||||
?find [Search]
|
?find [Search]
|
||||||
'''
|
'''
|
||||||
|
search = get_name(args)
|
||||||
try:
|
try:
|
||||||
search = get_name(args)
|
|
||||||
|
|
||||||
if search is None:
|
if search is None:
|
||||||
raise commands.UserInputError
|
raise commands.UserInputError
|
||||||
|
@ -205,9 +205,8 @@ async def delete(ctx, * args):
|
||||||
Deletes a location from the database.
|
Deletes a location from the database.
|
||||||
?delete [Location name]
|
?delete [Location name]
|
||||||
'''
|
'''
|
||||||
|
loc = get_name(args)
|
||||||
try:
|
try:
|
||||||
loc = get_name(args)
|
|
||||||
|
|
||||||
if loc is None:
|
if loc is None:
|
||||||
raise commands.UserInputError
|
raise commands.UserInputError
|
||||||
|
|
||||||
|
@ -219,13 +218,13 @@ async def delete(ctx, * args):
|
||||||
|
|
||||||
@bot.command(pass_context=True)
|
@bot.command(pass_context=True)
|
||||||
@commands.cooldown(5, 60, commands.BucketType.user)
|
@commands.cooldown(5, 60, commands.BucketType.user)
|
||||||
async def findaround(ctx, x_pos: int, z_pos: int, * args):
|
async def find_around(ctx, x_pos: int, z_pos: int, * args):
|
||||||
'''
|
'''
|
||||||
Finds all the locations around a certain point.
|
Finds all the locations around a certain point.
|
||||||
The radius defaults to 200 blocks if no value is given.
|
The radius defaults to 200 blocks if no value is given.
|
||||||
Default dimension is overworld.
|
Default dimension is overworld.
|
||||||
|
|
||||||
?findaround [X Coordinate] [Z Coordinate] [Radius] [Optional Flags]
|
?find_around [X Coordinate] [Z Coordinate] [Radius] [Optional Flags]
|
||||||
|
|
||||||
Optional Flags:
|
Optional Flags:
|
||||||
-d [dimension]
|
-d [dimension]
|
||||||
|
@ -259,16 +258,15 @@ async def findaround(ctx, x_pos: int, z_pos: int, * args):
|
||||||
|
|
||||||
@bot.command(pass_context=True)
|
@bot.command(pass_context=True)
|
||||||
@commands.cooldown(5, 60, commands.BucketType.user)
|
@commands.cooldown(5, 60, commands.BucketType.user)
|
||||||
async def additem(ctx, item_name: str, quantity: int, diamond_price: int, * args):
|
async def add_item(ctx, item_name: str, quantity: int, diamond_price: int, * args):
|
||||||
'''
|
'''
|
||||||
Adds an item to a shop's inventory.
|
Adds an item to a shop's inventory.
|
||||||
Quantity for Diamond Price.
|
Quantity for Diamond Price.
|
||||||
|
|
||||||
?additem [Item Name] [Quantity] [Price] [Shop name]
|
?additem [Item Name] [Quantity] [Price] [Shop name]
|
||||||
'''
|
'''
|
||||||
|
shop_name = get_name(args)
|
||||||
try:
|
try:
|
||||||
shop_name = get_name(args)
|
|
||||||
|
|
||||||
bot_commands.add_item(item_name, quantity, diamond_price, shop_name=shop_name,
|
bot_commands.add_item(item_name, quantity, diamond_price, shop_name=shop_name,
|
||||||
discord_uuid=ctx.message.author.id)
|
discord_uuid=ctx.message.author.id)
|
||||||
await bot.say('{}, **{}** has been added to the inventory of your shop.'.format(ctx.message.author.mention,
|
await bot.say('{}, **{}** has been added to the inventory of your shop.'.format(ctx.message.author.mention,
|
||||||
|
@ -308,8 +306,8 @@ async def info(ctx, * args):
|
||||||
|
|
||||||
?info [Location Name]
|
?info [Location Name]
|
||||||
'''
|
'''
|
||||||
|
loc = get_name(args)
|
||||||
try:
|
try:
|
||||||
loc = get_name(args)
|
|
||||||
|
|
||||||
if loc is None:
|
if loc is None:
|
||||||
raise commands.UserInputError
|
raise commands.UserInputError
|
||||||
|
@ -329,8 +327,8 @@ async def edit_pos(ctx, x_pos: int, y_pos: int, * args):
|
||||||
|
|
||||||
?edit_pos [X Coordinate] [Z Coordinate] [Location Name]
|
?edit_pos [X Coordinate] [Z Coordinate] [Location Name]
|
||||||
'''
|
'''
|
||||||
|
loc = get_name(args)
|
||||||
try:
|
try:
|
||||||
loc = get_name(args)
|
|
||||||
loc_str = bot_commands.edit_pos(x_pos, y_pos, loc, discord_uuid=ctx.message.author.id)
|
loc_str = bot_commands.edit_pos(x_pos, y_pos, loc, discord_uuid=ctx.message.author.id)
|
||||||
|
|
||||||
await bot.say('{}, the following location has been updated: \n\n{}'.format(ctx.message.author.mention, loc_str))
|
await bot.say('{}, the following location has been updated: \n\n{}'.format(ctx.message.author.mention, loc_str))
|
||||||
|
@ -347,8 +345,8 @@ async def edit_tunnel(ctx, tunnel_color: str, tunnel_number: int, * args):
|
||||||
|
|
||||||
?edit_tunnel [Tunnel Color] [Tunnel Number] [Location Name]
|
?edit_tunnel [Tunnel Color] [Tunnel Number] [Location Name]
|
||||||
'''
|
'''
|
||||||
|
loc = get_name(args)
|
||||||
try:
|
try:
|
||||||
loc = get_name(args)
|
|
||||||
loc_str = bot_commands.edit_tunnel(tunnel_color, tunnel_number, loc, discord_uuid=ctx.message.author.id)
|
loc_str = bot_commands.edit_tunnel(tunnel_color, tunnel_number, loc, discord_uuid=ctx.message.author.id)
|
||||||
|
|
||||||
await bot.say('{}, the following location has been updated: \n\n{}'.format(ctx.message.author.mention, loc_str))
|
await bot.say('{}, the following location has been updated: \n\n{}'.format(ctx.message.author.mention, loc_str))
|
||||||
|
@ -356,7 +354,8 @@ async def edit_tunnel(ctx, tunnel_color: str, tunnel_number: int, * args):
|
||||||
await bot.say('{}, you do not have a location called **{}**.'.format(
|
await bot.say('{}, you do not have a location called **{}**.'.format(
|
||||||
ctx.message.author.mention, loc))
|
ctx.message.author.mention, loc))
|
||||||
except InvalidTunnelError:
|
except InvalidTunnelError:
|
||||||
await bot.say('{}, {} is an invalid tunnel color.'.format(ctx.message.author.mention, tunnel_color))
|
await bot.say('{}, **{}** is an invalid tunnel color.'.format(ctx.message.author.mention, tunnel_color))
|
||||||
|
|
||||||
|
|
||||||
@commands.cooldown(5, 60, commands.BucketType.user)
|
@commands.cooldown(5, 60, commands.BucketType.user)
|
||||||
@bot.command(pass_context=True)
|
@bot.command(pass_context=True)
|
||||||
|
@ -376,6 +375,25 @@ async def edit_name(ctx, new_name: str, current_name: str):
|
||||||
ctx.message.author.mention, current_name))
|
ctx.message.author.mention, current_name))
|
||||||
|
|
||||||
|
|
||||||
|
@commands.cooldown(5, 60, commands.BucketType.user)
|
||||||
|
@bot.command(pass_context=True)
|
||||||
|
async def delete_item(ctx, item: str, * args):
|
||||||
|
'''
|
||||||
|
Deletes an item listing from a shop inventory
|
||||||
|
|
||||||
|
?delete_name [Item] [Shop Name]
|
||||||
|
'''
|
||||||
|
|
||||||
|
shop = get_name(args)
|
||||||
|
try:
|
||||||
|
bot_commands.delete_item(item, shop, discord_uuid=ctx.message.author.id)
|
||||||
|
|
||||||
|
await bot.say('{}, **{}** has been removed from the inventory of **{}**.', item, shop)
|
||||||
|
except LocationLookUpError:
|
||||||
|
await bot.say('{}, you do not have a shop called **{}**.'.format(ctx.message.author.mention, shop))
|
||||||
|
except DeleteEntryError:
|
||||||
|
await bot.say('{}, **{}** does not sell **{}**.', shop, item)
|
||||||
|
|
||||||
# Helper Functions ************************************************************
|
# Helper Functions ************************************************************
|
||||||
|
|
||||||
def get_name(args):
|
def get_name(args):
|
||||||
|
|
|
@ -51,7 +51,7 @@ class TestCommands(TestCase):
|
||||||
|
|
||||||
def test_addtunnel(self):
|
def test_addtunnel(self):
|
||||||
self.commands.register('ZeroHD', '143072699567177728')
|
self.commands.register('ZeroHD', '143072699567177728')
|
||||||
self.commands.add_shop(0, 0, shop_str='test shop', discord_uuid='143072699567177728')
|
self.commands.add_shop(0, 0, shop_name='test shop', discord_uuid='143072699567177728')
|
||||||
|
|
||||||
tunnel1 = self.commands.add_tunnel('green', 50, None, discord_uuid='143072699567177728')
|
tunnel1 = self.commands.add_tunnel('green', 50, None, discord_uuid='143072699567177728')
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ class TestCommands(TestCase):
|
||||||
|
|
||||||
def test_find(self):
|
def test_find(self):
|
||||||
self.commands.register('ZeroHD', '143072699567177728')
|
self.commands.register('ZeroHD', '143072699567177728')
|
||||||
self.commands.add_shop(0, 0, shop_str='frick', discord_uuid='143072699567177728')
|
self.commands.add_shop(0, 0, shop_name='frick', discord_uuid='143072699567177728')
|
||||||
self.commands.add_base(0, 0, 'heck', discord_uuid='143072699567177728')
|
self.commands.add_base(0, 0, 'heck', discord_uuid='143072699567177728')
|
||||||
|
|
||||||
result = self.commands.find('zerohd')
|
result = self.commands.find('zerohd')
|
||||||
|
@ -79,7 +79,7 @@ class TestCommands(TestCase):
|
||||||
|
|
||||||
def test_delete(self):
|
def test_delete(self):
|
||||||
self.commands.register('ZeroHD', '143072699567177728')
|
self.commands.register('ZeroHD', '143072699567177728')
|
||||||
self.commands.add_shop(0, 0, shop_str='frick', discord_uuid='143072699567177728')
|
self.commands.add_shop(0, 0, shop_name='frick', discord_uuid='143072699567177728')
|
||||||
|
|
||||||
self.commands.delete('frick', discord_uuid='143072699567177728')
|
self.commands.delete('frick', discord_uuid='143072699567177728')
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ class TestCommands(TestCase):
|
||||||
|
|
||||||
def test_findaround(self):
|
def test_findaround(self):
|
||||||
self.commands.register('ZeroHD', '143072699567177728')
|
self.commands.register('ZeroHD', '143072699567177728')
|
||||||
self.commands.add_shop(0, 0, shop_str='frick', discord_uuid='143072699567177728')
|
self.commands.add_shop(0, 0, shop_name='frick', discord_uuid='143072699567177728')
|
||||||
|
|
||||||
result = self.commands.find_around(0, 0)
|
result = self.commands.find_around(0, 0)
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ class TestCommands(TestCase):
|
||||||
else:
|
else:
|
||||||
self.fail()
|
self.fail()
|
||||||
|
|
||||||
self.commands.add_shop(0, 0, shop_str='frick', discord_uuid='143072699567177728')
|
self.commands.add_shop(0, 0, shop_name='frick', discord_uuid='143072699567177728')
|
||||||
|
|
||||||
result = self.commands.add_item('cool', 5, 5, shop_name='frick', discord_uuid='143072699567177728')
|
result = self.commands.add_item('cool', 5, 5, shop_name='frick', discord_uuid='143072699567177728')
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ class TestCommands(TestCase):
|
||||||
|
|
||||||
def test_selling(self):
|
def test_selling(self):
|
||||||
self.commands.register('ZeroHD', '143072699567177728')
|
self.commands.register('ZeroHD', '143072699567177728')
|
||||||
self.commands.add_shop(0, 0, shop_str='frick', discord_uuid='143072699567177728')
|
self.commands.add_shop(0, 0, shop_name='frick', discord_uuid='143072699567177728')
|
||||||
|
|
||||||
self.commands.add_item('cool', 5, 5, shop_name='frick', discord_uuid='143072699567177728')
|
self.commands.add_item('cool', 5, 5, shop_name='frick', discord_uuid='143072699567177728')
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ class TestCommands(TestCase):
|
||||||
|
|
||||||
def test_info(self):
|
def test_info(self):
|
||||||
self.commands.register('ZeroHD', '143072699567177728')
|
self.commands.register('ZeroHD', '143072699567177728')
|
||||||
self.commands.add_shop(0, 0, shop_str='frick', discord_uuid='143072699567177728')
|
self.commands.add_shop(0, 0, shop_name='frick', discord_uuid='143072699567177728')
|
||||||
|
|
||||||
self.commands.add_tunnel('Green', 50, location_name='frick', discord_uuid='143072699567177728')
|
self.commands.add_tunnel('Green', 50, location_name='frick', discord_uuid='143072699567177728')
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ class TestCommands(TestCase):
|
||||||
|
|
||||||
def test_tunnel(self):
|
def test_tunnel(self):
|
||||||
self.commands.register('ZeroHD', '143072699567177728')
|
self.commands.register('ZeroHD', '143072699567177728')
|
||||||
self.commands.add_shop(0, 0, shop_str='test shop', discord_uuid='143072699567177728')
|
self.commands.add_shop(0, 0, shop_name='test shop', discord_uuid='143072699567177728')
|
||||||
|
|
||||||
tunnel = self.commands.add_tunnel('green', 50, None, discord_uuid='143072699567177728')
|
tunnel = self.commands.add_tunnel('green', 50, None, discord_uuid='143072699567177728')
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ class TestCommands(TestCase):
|
||||||
|
|
||||||
def test_edit_name(self):
|
def test_edit_name(self):
|
||||||
self.commands.register('ZeroHD', '143072699567177728')
|
self.commands.register('ZeroHD', '143072699567177728')
|
||||||
self.commands.add_shop(0, 0, shop_str='test shop', discord_uuid='143072699567177728')
|
self.commands.add_shop(0, 0, shop_name='test shop', discord_uuid='143072699567177728')
|
||||||
|
|
||||||
self.commands.edit_name('cool shop', 'test shop', discord_uuid='143072699567177728')
|
self.commands.edit_name('cool shop', 'test shop', discord_uuid='143072699567177728')
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ class TestCommands(TestCase):
|
||||||
|
|
||||||
def test_edit_pos(self):
|
def test_edit_pos(self):
|
||||||
self.commands.register('ZeroHD', '143072699567177728')
|
self.commands.register('ZeroHD', '143072699567177728')
|
||||||
self.commands.add_shop(0, 0, shop_str='test shop', discord_uuid='143072699567177728')
|
self.commands.add_shop(0, 0, shop_name='test shop', discord_uuid='143072699567177728')
|
||||||
|
|
||||||
self.commands.edit_pos(500, 500, 'test shop', discord_uuid='143072699567177728')
|
self.commands.edit_pos(500, 500, 'test shop', discord_uuid='143072699567177728')
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ class TestCommands(TestCase):
|
||||||
|
|
||||||
def test_edit_tunnel(self):
|
def test_edit_tunnel(self):
|
||||||
self.commands.register('ZeroHD', '143072699567177728')
|
self.commands.register('ZeroHD', '143072699567177728')
|
||||||
self.commands.add_shop(0, 0, shop_str='test shop', discord_uuid='143072699567177728')
|
self.commands.add_shop(0, 0, shop_name='test shop', discord_uuid='143072699567177728')
|
||||||
|
|
||||||
self.commands.edit_tunnel('green', 500, 'test shop', discord_uuid='143072699567177728')
|
self.commands.edit_tunnel('green', 500, 'test shop', discord_uuid='143072699567177728')
|
||||||
|
|
||||||
|
@ -194,4 +194,18 @@ class TestCommands(TestCase):
|
||||||
else:
|
else:
|
||||||
self.fail()
|
self.fail()
|
||||||
|
|
||||||
|
def test_delete_item(self):
|
||||||
|
self.commands.register('ZeroHD', '143072699567177728')
|
||||||
|
self.commands.add_shop(0, 0, shop_name='test shop', discord_uuid='143072699567177728')
|
||||||
|
|
||||||
|
self.commands.add_item('dirt', 5, 5, shop_name='test shop', discord_uuid='143072699567177728')
|
||||||
|
self.commands.add_item('wood', 5, 5, shop_name='test shop', discord_uuid='143072699567177728')
|
||||||
|
|
||||||
|
result = self.commands.delete_item('dirt', 'test_shop', discord_uuid='143072699567177728')
|
||||||
|
|
||||||
|
if ('dirt' not in result) & ('wood' in result):
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
self.fail()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue