monk-afk / filterplus

Chat filter and censor for Minetest. Includes mute command, player tags, and mention highlight.
MIT License
1 stars 0 forks source link

add ability to ignore public chat or individual players #6

Closed monk-afk closed 1 month ago

monk-afk commented 8 months ago

/ignore_all to ignore the public chats, but still can receive direct message

/ignore <playername> to ignore specific player

if these functions are enabled, the player shouldn't be able to send to public chat/ignored player

monk-afk commented 1 month ago

the basic outline for ignoring players

local function send_message(msg_block) -- this whole function will need restructuring
  if msg_block[3] then -- conditional for player mentions, if false send to all (no player mentioned)

    for name, player in pairs(players_online) do

      if not ignored_by(msg_block[1], name) then -- add the ignore check inside the loop

        local msg_color = white
        local namelower = name:lower()

        if msg_block[3][name] then
          msg_color = green
        end

        send_player(players_online[namelower].name, player_tags(msg_block[1])..colorize(msg_color, msg_block[2]))
      end

    end
    return
  end
  return send_all(player_tags(msg_block[1])..msg_block[2])
end
local ignore_list = {
  speakers = {losing_patience = true, ignored_by_another = true},
  ["monk"] = {["player1"] = true, ["player2"] = true},
}

local function ignored_by(verbal_diareah, losing_patience)
  if ignore_list[verbal_diareah] then
    if ignore_list[verbal_diareah][losing_patience] then
    end
  end
end

local function ignore_chats_from(verbal_diareah, losing_patience)
  if not ignore_list[verbal_diareah] then
    ignore_list[verbal_diareah] = {}
  end
  ignore_list[verbal_diareah][losing_patience] = true
end

local function stop_ignoring(losing_patience, verbal_diareah)
  if ignore_list[verbal_diareah] and ignore_list[verbal_diareah][losing_patience] then
    ignore_list[verbal_diareah][losing_patience] = nil
  else
  end
end
monk-afk commented 1 month ago

finally added