deletebase and findbase now tell the user if their lookup did not find anything

doc_update
Joey Hines 2018-05-25 16:51:15 -05:00
parent 08b50943bf
commit 3b898bc8d9
1 changed files with 5 additions and 4 deletions

View File

@ -166,7 +166,7 @@ async def findbase(ctx, name: str):
base_list = session.query(Location).filter_by(owner=name).all()
if base_list is not None:
if len(base_list) != 0:
base_string = ''
for base in base_list:
@ -174,7 +174,8 @@ async def findbase(ctx, name: str):
await bot.say('{}, {} has {} base(s): \n {}'.format(ctx.message.author.mention, name, len(base_list), base_string))
else:
await bot.say('{}, {} is not in the database'.format(ctx.message.author.mention, name))
await bot.say('{}, the player {} is not in the database'.format(ctx.message.author.mention, name))
@bot.command(pass_context=True)
async def deletebase(ctx, name: str):
@ -182,11 +183,11 @@ async def deletebase(ctx, name: str):
Deletes a base from the database.
?deletebase [Base name]
'''
user = str(ctx.message.author.nick)
base = session.query(Location).filter_by(owner=user, name=name)
if base is not None:
if base.first() is not None:
base.delete()
await bot.say('{}, your base named "{}" has been deleted.'.format(ctx.message.author.mention, name))
else: