Add /tell chatcommand

Formatted like /msg, allows registering a msg to be shown the the player specified when they become active.
This commit is contained in:
octacian 2017-04-04 08:01:27 -07:00
parent 0914819f5e
commit a28c39ee94

View File

@ -49,3 +49,23 @@ function tell.remove(name, id)
list[name][id] = nil
end
end
-- [register] Chatcommand
minetest.register_chatcommand("tell", {
description = "Send a message to an offline or AFK player",
params = "<name> <message>",
func = function(name, param)
local sendto, msg = param:match("^(%S+)%s(.+)$")
if not sendto or not msg then
return false, "Invalid usage, see /help tell."
end
minetest.log("action", "Tell from " .. name .. " to " .. sendto
.. ": " .. msg)
if tell.add(sendto, name, msg) then
return true, "I'll pass that on when "..sendto.." is around."
else
return false, "Unknown error."
end
end,
})