init.lua 480 B

12345678910111213141516171819202122
  1. motd = motd or {}
  2. motd.modpath = minetest.get_modpath("motd")
  3. minetest.register_chatcommand("motd", {
  4. params = "",
  5. description = "Write current Message of the Day.",
  6. privs = {},
  7. func = function(name, text)
  8. local motd = minetest.setting_get("motd")
  9. if motd == nil or motd == "" then
  10. minetest.chat_send_player(name, "# Server: Message of the day has not been set.")
  11. return false
  12. end
  13. minetest.chat_send_player(name, "# Server: " .. motd)
  14. return true
  15. end
  16. })