mirror of
https://github.com/rubenwardy/report.git
synced 2025-07-07 10:41:06 +02:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
dfe4d8e321 | |||
b1518dbd1c |
39
init.lua
39
init.lua
@ -1,14 +1,33 @@
|
|||||||
|
local function save_modo(name)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
local function get_modo_list()
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_on_joinplayer(function(player)
|
||||||
|
-- 1. Obtenir la liste des modérateur connus
|
||||||
|
-- local modo_saved = get_modo_list()
|
||||||
|
-- 2. Obtenir les privs du player
|
||||||
|
-- 3. Si player n'est pas dans la liste modos connus et a privs modos alors
|
||||||
|
-- 4. Ajouter nom du player dans liste modos connus
|
||||||
|
-- 5. Sinon si player est dans liste modos connus et n'a pas privs modos alors
|
||||||
|
-- 6. Supprimer nom du player de la liste modos connus.
|
||||||
|
-- 7. Fin
|
||||||
|
end)
|
||||||
|
|
||||||
minetest.register_chatcommand("report", {
|
minetest.register_chatcommand("report", {
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
param = param:trim()
|
param = param:trim()
|
||||||
if param == "" then
|
if param == "" then
|
||||||
return false, "Please add a message to your report. " ..
|
return false, "Veuillez écrire un message pour le rapport. " ..
|
||||||
"If it's about (a) particular player(s), please also include their name(s)."
|
"Si il s'agit d'un (de) joueur(s) en particulier, veuillez aussi indiquer son (leur) nom(s)."
|
||||||
end
|
end
|
||||||
local _, count = string.gsub(param, " ", "")
|
local _, count = string.gsub(param, " ", "")
|
||||||
if count == 0 then
|
if count == 0 then
|
||||||
minetest.chat_send_player(name, "If you're reporting a player, " ..
|
minetest.chat_send_player(name, "Si vous rapportez l'attitude d'un joueur, " ..
|
||||||
"you should also include a reason why. (Eg: swearing, sabotage)")
|
"vous devriez aussi dire quelle en est la raison. (Ex: insulte, sabotage)")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Send to online moderators / admins
|
-- Send to online moderators / admins
|
||||||
@ -18,19 +37,21 @@ minetest.register_chatcommand("report", {
|
|||||||
local toname = player:get_player_name()
|
local toname = player:get_player_name()
|
||||||
if minetest.check_player_privs(toname, {kick = true, ban = true}) then
|
if minetest.check_player_privs(toname, {kick = true, ban = true}) then
|
||||||
table.insert(mods, toname)
|
table.insert(mods, toname)
|
||||||
minetest.chat_send_player(toname, "-!- " .. name .. " reported: " .. param)
|
minetest.chat_send_player(toname, "-!- " .. name .. " a rapporté : " .. param)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if #mods > 0 then
|
if #mods > 0 then
|
||||||
mod_list = table.concat(mods, ", ")
|
mod_list = table.concat(mods, ", ")
|
||||||
email.send_mail(name, minetest.setting_get("name"),
|
email.send_mail(name, minetest.setting_get("name"),
|
||||||
"Report: " .. param .. " (mods online: " .. mod_list .. ")")
|
"Rapport: " .. param .. " (modos connecté(s) : " .. mod_list .. ")")
|
||||||
return true, "Reported. Moderators currently online: " .. mod_list
|
return true, "Rapporté. Moderateur(s) connecté(s) : " .. mod_list
|
||||||
else
|
else
|
||||||
email.send_mail(name, minetest.setting_get("name"),
|
email.send_mail(name, minetest.setting_get("name"),
|
||||||
"Report: " .. param .. " (no mods online)")
|
"Rapport: " .. param .. " (pas de modo connecté)")
|
||||||
return true, "Reported. We'll get back to you."
|
return true, "Rapporté. On reviendra vers vous."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.log("action", "[report] loaded.")
|
||||||
|
Reference in New Issue
Block a user