Added location class
parent
2b7a9cc036
commit
0a26e22dbe
25
MCInfoBot.py
25
MCInfoBot.py
|
@ -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 :
|
||||||
|
|
Loading…
Reference in New Issue