aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShadowNinja <noreply@gmail.com>2013-03-27 21:37:09 -0400
committerPilzAdam <pilzadam@minetest.net>2013-04-05 15:25:59 +0200
commit1bae82e6c4ee6242dee0f87aa2f2575331861770 (patch)
tree15c77c00c15351e3c8fcd0d92fd68fb4e5de9291
parent2fb0e547a01a6e61b821737e61315bad3312e41e (diff)
downloadminetest-1bae82e6c4ee6242dee0f87aa2f2575331861770.tar.gz
minetest-1bae82e6c4ee6242dee0f87aa2f2575331861770.tar.bz2
minetest-1bae82e6c4ee6242dee0f87aa2f2575331861770.zip
Add private messaging with /msg
-rw-r--r--builtin/chatcommands.lua20
1 files changed, 20 insertions, 0 deletions
diff --git a/builtin/chatcommands.lua b/builtin/chatcommands.lua
index 4b09f7b2b..9f14749f4 100644
--- a/builtin/chatcommands.lua
+++ b/builtin/chatcommands.lua
@@ -665,3 +665,23 @@ minetest.register_chatcommand("clearobjects", {
minetest.chat_send_all("*** Cleared all objects.")
end,
})
+
+minetest.register_chatcommand("msg", {
+ params = "<name> <message>",
+ description = "Send a private message",
+ privs = {shout=true},
+ func = function(name, param)
+ local found, _, sendto, message = param:find("^([^%s]+)%s(.+)$")
+ if found then
+ if minetest.env:get_player_by_name(sendto) then
+ minetest.log("action", "PM from "..name.." to "..sendto..": "..message)
+ minetest.chat_send_player(sendto, "PM from "..name..": "..message)
+ minetest.chat_send_player(name, "Message sent")
+ else
+ minetest.chat_send_player(name, "The player "..sendto.." is not online")
+ end
+ else
+ minetest.chat_send_player(name, "Invalid usage, see /help msg")
+ end
+ end,
+})