-- This file is licensed under the terms of the BSD 2-clause license. -- See LICENSE.txt for details. local dict = { ["dogapult"] = "catapult" , ["ass hole"] = "flagpole" , ["asshole"] = "flagpole" , ["bitch"] = "beach" , ["bitches"] = "beaches" , ["boobs"] = "shoes" , ["bullshit"] = "hamburger" , ["cunt"] = "country" , ["dickhead"] = "richard head" , ["dick head"] = "richard head" , ["faggot"] = "sandwich" , ["faggots"] = "sandwiches" , ["fricken"] = "chicken" , ["fck off"] = "bless you" , ["fck me"] = "bless me" , ["fck u"] = "bless you" , ["fck you"] = "bless you" , ["fckin"] = "barking" , ["fcking"] = "barking" , ["fuck"] = "bless" , ["fuck off"] = "bless you" , ["fuck u"] = "bless you" , ["fuck you"] = "bless you" , ["fuck you all"] = "bless you all" , ["fucker"] = "gardener" , ["fuckers"] = "gardeners" , ["fuckin"] = "barking" , ["fuckin bitch"] = "nice person" , ["fuckin hate"] = "somewhat dislike" , ["fucking"] = "barking" , ["fucking bitch"] = "nice person" , ["fucking hate"] = "somewhat dislike" , ["go fuck yourself"] = "go meditate" , ["what the fuck"] = "merciful heavens" , ["wtf"] = "merciful heavens" , ["mother fucker"] = "mother respecter" , ["mother fucking"] = "mother respecting" , ["motherfucker"] = "mother respecter" , ["motherfucking"] = "mother respecting" , ["piece of shit"] = "scoop of ice cream" , ["kike"] = "kite" , ["shit"] = "ice cream" , ["shitty"] = "glamorous" , ["suck my dick"] = "I am a silly troll" , ["i hate u"] = "I respect you" , ["i hate you"] = "I respect you" , ["nigga"] = "sandcastle" , ["nigger"] = "sandcastle" , ["niggr"] = "sandcastle" , ["ugly ass"] = "friendly" , ["apple2"] = "orange" , ["abc for bf"] = "I like turtles" , ["abc for gf"] = "I like turtles" , ["abc for a bf"] = "I like turtles" , ["abc for a gf"] = "I like turtles" , ["abc to be my bf"] = "abc for a turtle" , ["abc to be my gf"] = "abc for a turtle" , ["wanna be my bf"] = "wanna be my turtle" , ["wanna be my gf"] = "wanna be my turtle" , ["hot boyfriend"] = "koala" , ["hot girlfriend"] = "kangaroo" , ["shut the fuck up"] = "I'll shut up now" , ["shut up"] = "chill" , ["shutup"] = "chill" , ["hav sex"] = "knit socks" , ["have sex"] = "knit socks" , ["sexing"] = "meowing" , ["sexy"] = "earnest" , } -- =================================================================== local tkeys = {} for k in pairs (dict) do table.insert (tkeys, k) end table.sort (tkeys, function (a, b) return a:len() > b:len() end) -- =================================================================== minetest.register_on_joinplayer (function (player) local name = player:get_player_name() if irc.connected and irc.config.send_join_part then irc.say ("*** "..name.." joined the game") end end) -- =================================================================== minetest.register_on_leaveplayer (function (player, timed_out) local name = player:get_player_name() if irc.connected and irc.config.send_join_part then irc.say ("*** " .. name .. " left the game" .. (timed_out and " (Timed out)" or "")) end end) -- =================================================================== local rmcounter = {} minetest.register_on_chat_message (function (name, message) if not irc.connected or message:sub (1, 1) == "/" or message:sub (1, 5) == "[off]" or not irc.joined_players [name] then return end local nl = message:find ("\n", 1, true) if nl then message = message:sub (1, nl - 1) end if not minetest.check_player_privs (name, { shout=true }) then str = irc.playerMessage (name, core.strip_colors (message)) minetest.log ("action", "CHAT muted: " .. str) if rmcounter [name] == nil then rmcounter [name] = 0 end rmcounter [name] = rmcounter [name] + 1 if rmcounter [name] > 3 then minetest.chat_send_player (name, "That's enough. For now, you can't chat here.") return true end message = "My shout priv was revoked and so I can't speak" str = irc.playerMessage (name, core.strip_colors (message)) minetest.chat_send_all (str) irc.say (str) return true end local match_start, match_end w1 = 'f%*ck' w2 = 'fuck' match_start, match_end = message:lower():find (w1:lower()) if match_start then message = message:sub (1, match_start - 1) .. w2 .. message:sub (match_end + 1) end w1 = 'f%*%*%* you' w2 = 'fuck you' match_start, match_end = message:lower():find (w1:lower()) if match_start then message = message:sub (1, match_start - 1) .. w2 .. message:sub (match_end + 1) end w1 = 'bi%*%*h' w2 = 'bitch' match_start, match_end = message:lower():find (w1:lower()) if match_start then message = message:sub (1, match_start - 1) .. w2 .. message:sub (match_end + 1) end w1 = 'motherf%*%*%*er' w2 = 'mother respecter' match_start, match_end = message:lower():find (w1:lower()) if match_start then message = message:sub (1, match_start - 1) .. w2 .. message:sub (match_end + 1) end w1 = 'tr%*ck' w2 = 'truck' match_start, match_end = message:lower():find (w1:lower()) if match_start then message = message:sub (1, match_start - 1) .. w2 .. message:sub (match_end + 1) end for _, w1 in ipairs (tkeys) do w2 = dict [w1] match_start, match_end = message:lower():find (w1:lower()) if match_start then str = irc.playerMessage (name, core.strip_colors (message)) minetest.log ("action", "CHAT original: " .. str) message = message:sub (1, match_start - 1) .. w2 .. message:sub (match_end + 1) str = irc.playerMessage (name, core.strip_colors (message)) minetest.log ("action", "CHAT filtered: " .. str) chat_history.add_chat (name, message) if not ranks.chat_send (name, message) then minetest.chat_send_all (str) end irc.say (str) return true end end irc.say (irc.playerMessage (name, core.strip_colors (message))) chat_history.add_chat (name, message) return ranks.chat_send (name, message) end) -- =================================================================== minetest.register_on_shutdown (function() irc.disconnect ("Game shutting down.") end) -- =================================================================== ocutil.log ("irc/callback.lua loaded")