1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-09-27 23:10:33 +02:00

[report] Add the report mod

- For #340
This commit is contained in:
LeMagnesium 2015-12-21 17:44:12 +01:00
parent 9e4de68a26
commit 4594eaadab
4 changed files with 50 additions and 0 deletions

12
mods/report/README.md Normal file
View File

@ -0,0 +1,12 @@
# Report
Allows players to report things to admins and online moderators.
Suppose `player`, `griefer` and `moderator` are online players.
`player` runs this command: `/report griefer is griefing`
`moderator` sees: `-!- player reported: griefer is griefing`
The Admin (named in "name") is mailed via chatplus: `<player1> Report: player2 is griefing (mods online: player3)`
License: WTFPL
Depends: chatplus.

1
mods/report/depends.txt Normal file
View File

@ -0,0 +1 @@
email

36
mods/report/init.lua Normal file
View File

@ -0,0 +1,36 @@
minetest.register_chatcommand("report", {
func = function(name, param)
param = param:trim()
if param == "" then
return false, "Please add a message to your report. " ..
"If it's about (a) particular player(s), please also include their name(s)."
end
local _, count = string.gsub(param, " ", "")
if count == 0 then
minetest.chat_send_player(name, "If you're reporting a player, " ..
"you should also include a reason why. (Eg: swearing, sabotage)")
end
-- Send to online moderators / admins
-- Get comma separated list of online moderators and admins
local mods = {}
for _, player in pairs(minetest.get_connected_players()) do
local name = player:get_player_name()
if minetest.check_player_privs(name, {kick = true, ban = true}) then
table.insert(mods, name)
minetest.chat_send_player(name, "-!- " .. name .. " reported: " .. param)
end
end
if #mods > 0 then
mod_list = table.concat(mods, ", ")
email.send_mail(name, minetest.setting_get("name"),
"Report: " .. param .. " (mods online: " .. mod_list .. ")")
return true, "Reported. Moderators currently online: " .. mod_list
else
email.send_mail(name, minetest.setting_get("name"),
"Report: " .. param .. " (no mods online)")
return true, "Reported. We'll get back to you."
end
end
})

View File

@ -220,6 +220,7 @@ load_mod_beds = true
load_mod_builtin_item = true
load_mod_chatplus = true
load_mod_email = true
load_mod_report = true
load_mod_snowdrift = false
load_mod_snow = true