Added location class

doc_update
Joey Hines 2018-05-21 11:14:37 -05:00
parent 2b7a9cc036
commit 0a26e22dbe
1 changed files with 20 additions and 7 deletions

View File

@ -9,7 +9,23 @@ least he knows where your bases are.'''
bot = commands.Bot(command_prefix=command_prefix , description=description) bot = commands.Bot(command_prefix=command_prefix , description=description)
playing = 'Waiting for you to type ''?''' class Location:
name = ''
x = 0;
y = 0;
z = 0;
def __init__(self,str) :
try:
name = args[0]
x = int(args[1])
y = int(args[2])
z = int(args[3])
except ValueError:
raise parseError
@bot.event @bot.event
async def on_ready(): async def on_ready():
@ -26,11 +42,8 @@ async def test():
async def addBase(ctx, * args): async def addBase(ctx, * args):
if (len(args) > 0) : if (len(args) > 0) :
try: try:
name = args[0] base = location(args)
x = int(args[1]) except parseError:
z = int(args[2])
await bot.say('{}, your base named {} located at (x={},z={}) has been added to the database.'.format(ctx.message.author.mention, name, x, z))
except ValueError:
await bot.say('Invalid syntax, try again (?addbase [name] [x coord] [z coord])') await bot.say('Invalid syntax, try again (?addbase [name] [x coord] [z coord])')
else : else :