Implemented move command. Can currently only move to sibling channels

pull/18/head
Matthieu Grieger 2014-09-15 12:35:18 -07:00
parent 4a84a956a7
commit 56643da3d4
2 changed files with 17 additions and 3 deletions

View File

@ -48,7 +48,7 @@ config.ENABLE_ADMINS = true
-- commands.
-- EXAMPLE:
-- config.ADMINS = {"Matt", "Matthieu"}
config.ADMINS = {"Blah"}
config.ADMINS = {"Matt"}
-- Make play an admin command?
-- DEFAULT VALUE: false
@ -115,5 +115,9 @@ config.SHOW_THUMBNAILS = true
-- DEFAULT VALUE: "You do not have permission to execute that command."
config.NO_PERMISSION_MSG = "You do not have permission to execute that command."
-- Message shown to users when they try to move the bot to a non-existant channel.
-- DEFAULT VALUE: "The channel you specified does not exist."
config.CHANNEL_DOES_NOT_EXIST_MSG = "The channel you specified does not exist."
return config

View File

@ -99,6 +99,9 @@ function parseCommand(message)
if has_permission then
if config.OUTPUT then
print(message.user.name .. " has told the bot to move to the following channel: " .. argument .. ".")
if not move(argument) then
message.user:send(config.CHANNEL_DOES_NOT_EXIST_MSG)
end
end
else
message.user:send(config.NO_PERMISSION_MSG)
@ -142,8 +145,15 @@ function volumedown()
return
end
function move()
return
function move(chan)
local user = piepan.users["MumbleDJ"]
local channel = user.channel("../" .. chan)
if channel == nil then
return false
else
piepan.me:moveTo(channel)
return true
end
end
function kill()