2018-08-05 22:20:37 +00:00
|
|
|
from discord.ext import commands
|
2018-08-12 19:00:04 +00:00
|
|
|
|
2018-08-21 20:36:51 +00:00
|
|
|
from geoffrey.BotErrors import *
|
|
|
|
from geoffrey.DiscordHelperFunctions import *
|
2018-08-05 22:20:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Edit_Commands:
|
2018-08-18 17:01:59 +00:00
|
|
|
"""
|
|
|
|
Commands for editing your stuff in Geoffrey.
|
|
|
|
"""
|
2018-09-13 16:25:40 +00:00
|
|
|
|
2018-08-05 22:20:37 +00:00
|
|
|
def __init__(self, bot):
|
|
|
|
self.bot = bot
|
|
|
|
|
|
|
|
@commands.command(pass_context=True)
|
2018-08-11 16:20:40 +00:00
|
|
|
@commands.cooldown(5, 60, commands.BucketType.user)
|
2018-09-19 13:28:42 +00:00
|
|
|
async def edit_pos(self, ctx, x_pos: int, z_pos: int, *args):
|
2018-08-11 23:02:50 +00:00
|
|
|
"""
|
2018-08-18 17:01:59 +00:00
|
|
|
Edits the position of a location
|
2018-09-13 17:06:37 +00:00
|
|
|
|
2018-08-05 22:20:37 +00:00
|
|
|
?edit_pos [X Coordinate] [Z Coordinate] [Location Name]
|
2018-08-11 23:02:50 +00:00
|
|
|
"""
|
2018-08-05 22:20:37 +00:00
|
|
|
loc = get_name(args)
|
|
|
|
try:
|
2018-09-19 13:28:42 +00:00
|
|
|
loc_str = self.bot.bot_commands.edit_pos(x_pos, z_pos, loc, discord_uuid=ctx.message.author.id)
|
2018-08-05 22:20:37 +00:00
|
|
|
|
2018-09-12 21:11:56 +00:00
|
|
|
await ctx.send(
|
2018-08-05 22:20:37 +00:00
|
|
|
'{}, the following location has been updated: \n\n{}'.format(ctx.message.author.mention, loc_str))
|
|
|
|
except LocationLookUpError:
|
2018-09-12 21:11:56 +00:00
|
|
|
await ctx.send('{}, you do not have a location called **{}**.'.format(
|
2018-08-05 22:20:37 +00:00
|
|
|
ctx.message.author.mention, loc))
|
|
|
|
|
|
|
|
@commands.command(pass_context=True)
|
2018-08-11 16:20:40 +00:00
|
|
|
@commands.cooldown(5, 60, commands.BucketType.user)
|
2018-09-13 17:06:37 +00:00
|
|
|
async def edit_tunnel(self, ctx, tunnel_direction: str, tunnel_number: int, *args):
|
2018-08-11 23:02:50 +00:00
|
|
|
"""
|
2018-08-18 17:01:59 +00:00
|
|
|
Edits the tunnel of a location
|
2018-09-13 17:06:37 +00:00
|
|
|
|
|
|
|
Directions: North South East West
|
|
|
|
?edit_tunnel [Tunnel Direction] [Tunnel Number] [Location Name]
|
2018-08-11 23:02:50 +00:00
|
|
|
"""
|
2018-08-05 22:20:37 +00:00
|
|
|
loc = get_name(args)
|
|
|
|
try:
|
2018-09-13 17:06:37 +00:00
|
|
|
loc_str = self.bot.bot_commands.edit_tunnel(tunnel_direction, tunnel_number, loc,
|
2018-08-30 16:46:20 +00:00
|
|
|
discord_uuid=ctx.message.author.id)
|
2018-08-05 22:20:37 +00:00
|
|
|
|
2018-09-12 21:11:56 +00:00
|
|
|
await ctx.send(
|
2018-08-05 22:20:37 +00:00
|
|
|
'{}, the following location has been updated: \n\n{}'.format(ctx.message.author.mention, loc_str))
|
|
|
|
except LocationLookUpError:
|
2018-09-12 21:11:56 +00:00
|
|
|
await ctx.send('{}, you do not have a location called **{}**.'.format(
|
2018-08-05 22:20:37 +00:00
|
|
|
ctx.message.author.mention, loc))
|
|
|
|
except InvalidTunnelError:
|
2018-09-12 21:11:56 +00:00
|
|
|
await ctx.send(
|
2018-09-13 17:06:37 +00:00
|
|
|
'{}, **{}** is an invalid tunnel direction.'.format(ctx.message.author.mention, tunnel_direction))
|
2018-08-05 22:20:37 +00:00
|
|
|
|
|
|
|
@commands.command(pass_context=True)
|
2018-08-11 16:20:40 +00:00
|
|
|
@commands.cooldown(5, 60, commands.BucketType.user)
|
2018-08-05 22:20:37 +00:00
|
|
|
async def edit_name(self, ctx, new_name: str, current_name: str):
|
2018-08-11 23:02:50 +00:00
|
|
|
"""
|
2018-08-18 17:01:59 +00:00
|
|
|
Edits the name of a location
|
2018-09-13 17:06:37 +00:00
|
|
|
|
2018-09-13 16:25:40 +00:00
|
|
|
IF A NAME HAS SPACES IN IT YOU NEED TO WRAP IT IN QUOTATION MARKS. eg. "Cool Shop 123"
|
2018-08-05 22:20:37 +00:00
|
|
|
?edit_name [New Name] [Current Name]
|
2018-08-11 23:02:50 +00:00
|
|
|
"""
|
2018-08-05 22:20:37 +00:00
|
|
|
try:
|
2018-08-30 16:34:19 +00:00
|
|
|
loc_str = self.bot.bot_commands.edit_name(new_name, current_name, discord_uuid=ctx.message.author.id)
|
2018-08-05 22:20:37 +00:00
|
|
|
|
2018-09-12 21:11:56 +00:00
|
|
|
await ctx.send(
|
2018-08-05 22:20:37 +00:00
|
|
|
'{}, the following location has been updated: \n\n{}'.format(ctx.message.author.mention, loc_str))
|
|
|
|
except LocationLookUpError:
|
2018-09-12 21:11:56 +00:00
|
|
|
await ctx.send('{}, you do not have a location called **{}**.'.format(
|
2018-08-05 22:20:37 +00:00
|
|
|
ctx.message.author.mention, current_name))
|
|
|
|
|
|
|
|
|
|
|
|
def setup(bot):
|
|
|
|
bot.add_cog(Edit_Commands(bot))
|