Added add_owner command and made help messages more consistent
parent
0593318df5
commit
cb4a173508
|
@ -44,8 +44,9 @@ class GeoffreyCommands:
|
||||||
@commands.command(pass_context=True)
|
@commands.command(pass_context=True)
|
||||||
async def add_base(self, ctx, x_pos: int, z_pos: int, *args):
|
async def add_base(self, ctx, x_pos: int, z_pos: int, *args):
|
||||||
'''
|
'''
|
||||||
{}add_base <x_pos> <z_pos> <Name>
|
{}add_base <X Coordinate> <Z Coordinate> <Name>
|
||||||
The name parameter is optional.
|
The Name parameter is optional if this is your first base
|
||||||
|
|
||||||
'''
|
'''
|
||||||
name = get_name(args)
|
name = get_name(args)
|
||||||
|
|
||||||
|
@ -70,16 +71,20 @@ class GeoffreyCommands:
|
||||||
@commands.command(pass_context=True)
|
@commands.command(pass_context=True)
|
||||||
async def add_item(self, ctx, item_name, quantity: int, diamond_price: int, *args):
|
async def add_item(self, ctx, item_name, quantity: int, diamond_price: int, *args):
|
||||||
'''
|
'''
|
||||||
{}add_item <item name> <quantity> <diamond price> <Shop Name>
|
{}add_item <Item Name> <Quantity> <Diamond Price> <Shop Name>
|
||||||
The name parameter is optional.
|
If item name contains spaces, it must be wrapped in quotes. eg "Diamond Pickaxe"
|
||||||
|
The Shop Name parameter is optional if this is your first shop
|
||||||
|
|
||||||
'''
|
'''
|
||||||
shop_name = get_name(args)
|
shop_name = get_name(args)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
item = run_command(self.base_url, self.api_token, "POST", "add_item", item_name=item_name, quantity=quantity,
|
item = run_command(self.base_url, self.api_token, "POST", "add_item", item_name=item_name,
|
||||||
|
quantity=quantity,
|
||||||
diamond_price=diamond_price, shop_name=shop_name, discord_uuid=ctx.message.author.id)
|
diamond_price=diamond_price, shop_name=shop_name, discord_uuid=ctx.message.author.id)
|
||||||
await ctx.send('{}, {} has been added to the inventory of {}'.format(ctx.message.author.mention,
|
await ctx.send('{}, {} has been added to the inventory of {}'.format(ctx.message.author.mention,
|
||||||
item["item_name"], item["shop"]["name"]))
|
item["item_name"],
|
||||||
|
item["shop"]["name"]))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
error_list = [
|
error_list = [
|
||||||
{"error": "LocationLookUpError",
|
{"error": "LocationLookUpError",
|
||||||
|
@ -93,11 +98,45 @@ class GeoffreyCommands:
|
||||||
msg = check_error(e, error_list)
|
msg = check_error(e, error_list)
|
||||||
await ctx.send(msg)
|
await ctx.send(msg)
|
||||||
|
|
||||||
|
@commands.command(pass_context=True)
|
||||||
|
async def add_owner(self, ctx, new_owner_name, location_name):
|
||||||
|
'''
|
||||||
|
{}add_owner <New Owner's Name> <Location Name>
|
||||||
|
WARNING: The new owner had just as much power as you to edit or delete this location.
|
||||||
|
'''
|
||||||
|
|
||||||
|
try:
|
||||||
|
location = run_command(self.base_url, self.api_token, "POST", "add_owner", new_owner_name=new_owner_name,
|
||||||
|
location_name=location_name, discord_uuid=ctx.message.author.id)
|
||||||
|
|
||||||
|
await ctx.send('{}, **{}** has been added as an owner to **{}**'.format(
|
||||||
|
ctx.message.author.mention, new_owner_name, location["name"]))
|
||||||
|
except Exception as e:
|
||||||
|
error_list = [
|
||||||
|
{"error": "PlayerNotFound",
|
||||||
|
"message": "{}, ain't no one in this darn database named {} you goob".format(
|
||||||
|
ctx.message.author.mention, new_owner_name)
|
||||||
|
},
|
||||||
|
{"error": "PlayerInDBError",
|
||||||
|
"message": "{}, **{}** is already an owner, stop having amosia.".format(
|
||||||
|
ctx.message.author.mention, new_owner_name)
|
||||||
|
},
|
||||||
|
{"error": "LocationLookUpError",
|
||||||
|
"message": "{}, you do not have a location by the name you ding dong goober.".format(
|
||||||
|
ctx.message.author)
|
||||||
|
}
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
|
msg = check_error(e, error_list)
|
||||||
|
|
||||||
|
await ctx.send(msg)
|
||||||
|
|
||||||
@commands.command(pass_context=True)
|
@commands.command(pass_context=True)
|
||||||
async def add_shop(self, ctx, x_pos: int, z_pos: int, *args):
|
async def add_shop(self, ctx, x_pos: int, z_pos: int, *args):
|
||||||
'''
|
'''
|
||||||
{}add_shop <x_pos> <z_pos> <Name>
|
{}add_shop <X Coordinate> <Z Coordinate> <Shop Name>
|
||||||
The name parameter is optional.
|
The Shop Name parameter is optional if this is your first shop
|
||||||
'''
|
'''
|
||||||
|
|
||||||
name = get_name(args)
|
name = get_name(args)
|
||||||
|
@ -123,8 +162,8 @@ class GeoffreyCommands:
|
||||||
@commands.command(pass_context=True)
|
@commands.command(pass_context=True)
|
||||||
async def add_tunnel(self, ctx, tunnel_direction, tunnel_number: int, *args):
|
async def add_tunnel(self, ctx, tunnel_direction, tunnel_number: int, *args):
|
||||||
'''
|
'''
|
||||||
{}add_tunnel <tunnel_direction> <tunnel_number> <Location Name>
|
{}add_tunnel <Tunnel Direction> <Tunnel Number> <Location Name>
|
||||||
The name parameter is optional.
|
The Name parameter is optional if you only have one location
|
||||||
'''
|
'''
|
||||||
|
|
||||||
name = get_name(args)
|
name = get_name(args)
|
||||||
|
@ -176,8 +215,8 @@ class GeoffreyCommands:
|
||||||
@commands.command(pass_context=True)
|
@commands.command(pass_context=True)
|
||||||
async def delete_item(self, ctx, item_name: str, *args):
|
async def delete_item(self, ctx, item_name: str, *args):
|
||||||
'''
|
'''
|
||||||
{}delete_item <Item Name> <Location Name>
|
{}delete_item <Item Name> <Shop Name>
|
||||||
The name parameter is optional.
|
The Shop Name parameter is optional if you only have one location.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
shop_name = get_name(args)
|
shop_name = get_name(args)
|
||||||
|
@ -232,7 +271,7 @@ class GeoffreyCommands:
|
||||||
@commands.command(pass_conext=True)
|
@commands.command(pass_conext=True)
|
||||||
async def edit_pos(self, ctx, new_x: int, new_z: int, *args):
|
async def edit_pos(self, ctx, new_x: int, new_z: int, *args):
|
||||||
'''
|
'''
|
||||||
{}edit_post <New X Coord> <New Z Coord> <Location Name>
|
{}edit_post <New X Coordinate> <New Z Coordinate> <Location Name>
|
||||||
'''
|
'''
|
||||||
|
|
||||||
loc_name = get_name(args)
|
loc_name = get_name(args)
|
||||||
|
@ -284,7 +323,8 @@ class GeoffreyCommands:
|
||||||
@commands.command(pass_context=True)
|
@commands.command(pass_context=True)
|
||||||
async def find_around(self, ctx, x_pos, z_pos, *args):
|
async def find_around(self, ctx, x_pos, z_pos, *args):
|
||||||
'''
|
'''
|
||||||
{}find_around <X Position> <Z Position> <radius>
|
{}find_around <X Coordinate> <Z Coordinate> <Radius>
|
||||||
|
The Radius parameter is optional and defaults to 200 blocks
|
||||||
'''
|
'''
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -424,7 +464,8 @@ class GeoffreyCommands:
|
||||||
@commands.command(pass_context=True)
|
@commands.command(pass_context=True)
|
||||||
async def selling(self, ctx, *args):
|
async def selling(self, ctx, *args):
|
||||||
'''
|
'''
|
||||||
{}selling <item name>
|
{}selling <Item Name>
|
||||||
|
Sorts by most recently added
|
||||||
'''
|
'''
|
||||||
item = get_name(args)
|
item = get_name(args)
|
||||||
|
|
||||||
|
@ -452,7 +493,7 @@ class GeoffreyCommands:
|
||||||
async def restock(self, ctx, item_name, *args):
|
async def restock(self, ctx, item_name, *args):
|
||||||
'''
|
'''
|
||||||
{}restock <Item name> <Shop Name>
|
{}restock <Item name> <Shop Name>
|
||||||
The shop name is optional
|
The Shop Name is optional if you only have one shop.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
shop_name = get_name(args)
|
shop_name = get_name(args)
|
||||||
|
@ -505,5 +546,6 @@ class GeoffreyCommands:
|
||||||
msg = check_error(e, error_list)
|
msg = check_error(e, error_list)
|
||||||
await ctx.send(msg)
|
await ctx.send(msg)
|
||||||
|
|
||||||
|
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
bot.add_cog(GeoffreyCommands(bot))
|
bot.add_cog(GeoffreyCommands(bot))
|
||||||
|
|
Loading…
Reference in New Issue