2018-08-05 22:20:37 +00:00
|
|
|
from discord.ext import commands
|
2018-08-12 19:00:04 +00:00
|
|
|
|
2018-08-05 22:20:37 +00:00
|
|
|
from BotErrors import *
|
|
|
|
from DiscordHelperFunctions import *
|
2018-08-11 21:07:33 +00:00
|
|
|
from bot import bot_commands
|
2018-08-05 22:20:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Edit_Commands:
|
|
|
|
|
|
|
|
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-08-05 22:20:37 +00:00
|
|
|
async def edit_pos(self, ctx, x_pos: int, y_pos: int, *args):
|
2018-08-11 23:02:50 +00:00
|
|
|
"""
|
2018-08-05 22:20:37 +00:00
|
|
|
Edits the position of a location
|
|
|
|
|
|
|
|
?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:
|
|
|
|
loc_str = bot_commands.edit_pos(x_pos, y_pos, loc, discord_uuid=ctx.message.author.id)
|
|
|
|
|
|
|
|
await self.bot.say(
|
|
|
|
'{}, the following location has been updated: \n\n{}'.format(ctx.message.author.mention, loc_str))
|
|
|
|
except LocationLookUpError:
|
|
|
|
await self.bot.say('{}, you do not have a location called **{}**.'.format(
|
|
|
|
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-08-05 22:20:37 +00:00
|
|
|
async def edit_tunnel(self, ctx, tunnel_color: str, tunnel_number: int, *args):
|
2018-08-11 23:02:50 +00:00
|
|
|
"""
|
2018-08-05 22:20:37 +00:00
|
|
|
Edits the tunnel of a location
|
|
|
|
|
|
|
|
?edit_tunnel [Tunnel Color] [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:
|
|
|
|
loc_str = bot_commands.edit_tunnel(tunnel_color, tunnel_number, loc, discord_uuid=ctx.message.author.id)
|
|
|
|
|
|
|
|
await self.bot.say(
|
|
|
|
'{}, the following location has been updated: \n\n{}'.format(ctx.message.author.mention, loc_str))
|
|
|
|
except LocationLookUpError:
|
|
|
|
await self.bot.say('{}, you do not have a location called **{}**.'.format(
|
|
|
|
ctx.message.author.mention, loc))
|
|
|
|
except InvalidTunnelError:
|
2018-08-11 23:02:50 +00:00
|
|
|
await self.bot.say(
|
|
|
|
'{}, **{}** is an invalid tunnel color.'.format(ctx.message.author.mention, tunnel_color))
|
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-05 22:20:37 +00:00
|
|
|
Edits the name of a location
|
|
|
|
|
|
|
|
IF A NAME HAS SPACES IN IT YOU NEED TO WRAP IT IN QUOTATION MARKS. ie "Cool Shop 123"
|
|
|
|
?edit_name [New Name] [Current Name]
|
2018-08-11 23:02:50 +00:00
|
|
|
"""
|
2018-08-05 22:20:37 +00:00
|
|
|
try:
|
|
|
|
loc_str = bot_commands.edit_name(new_name, current_name, discord_uuid=ctx.message.author.id)
|
|
|
|
|
|
|
|
await self.bot.say(
|
|
|
|
'{}, the following location has been updated: \n\n{}'.format(ctx.message.author.mention, loc_str))
|
|
|
|
except LocationLookUpError:
|
|
|
|
await self.bot.say('{}, you do not have a location called **{}**.'.format(
|
|
|
|
ctx.message.author.mention, current_name))
|
|
|
|
|
|
|
|
|
|
|
|
def setup(bot):
|
|
|
|
bot.add_cog(Edit_Commands(bot))
|