From e704b64bafedc85a059ab9911b098af2c78acb09 Mon Sep 17 00:00:00 2001 From: s20 <129506166+src4026@users.noreply.github.com> Date: Sat, 23 Dec 2023 16:26:30 +0530 Subject: [PATCH] Override `/donate` command to use swear filter (hopefully done right) --- mods/ctf/ctf_chat/init.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mods/ctf/ctf_chat/init.lua b/mods/ctf/ctf_chat/init.lua index f30082f7c3..13dc56f0a6 100644 --- a/mods/ctf/ctf_chat/init.lua +++ b/mods/ctf/ctf_chat/init.lua @@ -64,6 +64,18 @@ minetest.override_chatcommand("me", { end }) +minetest.override_chatcommand("donate", { + func = function(name, param) + local old_func = minetest.registered_chatcommands["donate"].func + if filter and not filter.check_message(name, param) then + filter.on_violation(name, param) + return false, "No swearing" + end + + return old_func(name, param) + end +}) + minetest.register_chatcommand("t", { params = "msg", description = "Send a message on the team channel",