2015-12-11 18:45:32 +01:00
|
|
|
minetest.register_chatcommand("report", {
|
|
|
|
func = function(name, param)
|
2015-12-18 05:11:11 +01:00
|
|
|
param = param:trim()
|
|
|
|
if param == "" then
|
2019-01-05 23:07:31 +01:00
|
|
|
return false, "Veuillez écrire un message pour le rapport. " ..
|
|
|
|
"Si il s'agit d'un (de) joueur(s) en particulier, veuillez aussi indiquer son (leur) nom(s)."
|
2015-12-18 05:11:11 +01:00
|
|
|
end
|
|
|
|
local _, count = string.gsub(param, " ", "")
|
|
|
|
if count == 0 then
|
2019-01-05 23:07:31 +01:00
|
|
|
minetest.chat_send_player(name, "Si vous rapportez l'attitude d'un joueur, " ..
|
|
|
|
"vous devriez aussi dire quelle en est la raison. (Ex: insulte, sabotage)")
|
2015-12-18 05:11:11 +01:00
|
|
|
end
|
|
|
|
|
2015-12-11 18:45:32 +01:00
|
|
|
-- Send to online moderators / admins
|
|
|
|
-- Get comma separated list of online moderators and admins
|
2015-12-18 05:11:11 +01:00
|
|
|
local mods = {}
|
2015-12-11 18:45:32 +01:00
|
|
|
for _, player in pairs(minetest.get_connected_players()) do
|
2015-12-24 20:20:10 +01:00
|
|
|
local toname = player:get_player_name()
|
|
|
|
if minetest.check_player_privs(toname, {kick = true, ban = true}) then
|
|
|
|
table.insert(mods, toname)
|
2019-01-05 23:07:31 +01:00
|
|
|
minetest.chat_send_player(toname, "-!- " .. name .. " a rapporté : " .. param)
|
2015-12-11 18:45:32 +01:00
|
|
|
end
|
|
|
|
end
|
2015-12-18 05:11:11 +01:00
|
|
|
|
|
|
|
if #mods > 0 then
|
|
|
|
mod_list = table.concat(mods, ", ")
|
2015-12-18 23:34:14 +01:00
|
|
|
email.send_mail(name, minetest.setting_get("name"),
|
2019-01-05 23:07:31 +01:00
|
|
|
"Rapport: " .. param .. " (modos connecté(s) : " .. mod_list .. ")")
|
|
|
|
return true, "Rapporté. Moderateur(s) connecté(s) : " .. mod_list
|
2015-12-18 05:11:11 +01:00
|
|
|
else
|
2015-12-18 23:34:14 +01:00
|
|
|
email.send_mail(name, minetest.setting_get("name"),
|
2019-01-05 23:07:31 +01:00
|
|
|
"Rapport: " .. param .. " (pas de modo connecté)")
|
|
|
|
return true, "Rapporté. On reviendra vers vous."
|
2015-12-11 18:45:32 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
})
|
2019-01-05 23:07:31 +01:00
|
|
|
|
|
|
|
minetest.log("action", "[report] loaded.")
|