Where is the code for sending private messages found?

User avatar
JoshMars
Member
 
Posts: 103
Joined: Sat May 17, 2014 23:24
In-game: rubber UbuntuJosh

Where is the code for sending private messages found?

by JoshMars » Fri Mar 31, 2017 14:15

I need to tie the PM command (/msg <playername> message) into the ignore mod (mod that allows players to ignore each other so they don't get chat from a player). I can't seem to find it anywhere tho.
 

User avatar
JoshMars
Member
 
Posts: 103
Joined: Sat May 17, 2014 23:24
In-game: rubber UbuntuJosh

Re: Where is the code for sending private messages found?

by JoshMars » Fri Mar 31, 2017 14:31

Nevermind. Didn't look in builtin. In case anyone is wondering I put this in the [ignore] mod in callback.lua before the part that overrides /me
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
-- Override on /msg
local old_msg_callback = core.chatcommands["msg"].func
core.chatcommands["msg"].func = function(name, param)
   local sendto, message = param:match("^(%S+)%s(.+)$")
   if not sendto then
      return false, "Invalid usage, see /help msg."
   end
   if not core.get_player_by_name(sendto) then
      return false, "The player " .. sendto
            .. " is not online."
   end
   if ignore.get_ignore(name, sendto) then
      return false, "The player " .. sendto .. " is ignoring you."
   end
   core.log("action", "PM from " .. name .. " to " .. sendto
         .. ": " .. message)
   core.chat_send_player(sendto, "PM from " .. name .. ": "
         .. message)
   return true, "Message sent."
end
 


Return to Minetest Problems

Who is online

Users browsing this forum: No registered users and 5 guests

cron