Skip to content

Commit

Permalink
/donate: Add default message and swear filter (#1256)
Browse files Browse the repository at this point in the history
* Set `dmessage` default as " for their hard work"

* Override `/donate` command to use swear filter (hopefully done right)
  • Loading branch information
src4026 authored Jan 9, 2024
1 parent f72829e commit e3802cc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions mods/ctf/ctf_chat/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion mods/ctf/ctf_modebase/ranking_commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ minetest.register_chatcommand("donate", {
pname, score = score, pname
end

dmessage = (dmessage and dmessage ~= "") and (":" .. dmessage) or ""
dmessage = (dmessage and dmessage ~= "") and (":" .. dmessage) or " for their hard work"

if not pname then
return false, "You should provide the player name!"
Expand Down

0 comments on commit e3802cc

Please sign in to comment.