Help of the command /report simplified.

- Command "/report modos" renamed to "/report modos_list"
- Add template.txt file in locale folder
- Rewrite comments in english
This commit is contained in:
bri cassa 2022-07-02 16:27:32 +02:00
parent 75ddb31b5b
commit 1ae980fc43
3 changed files with 18 additions and 11 deletions

View File

@ -8,7 +8,6 @@ local function get_modo_list()
if store then
return minetest.deserialize(store) or {}
end
return nil
end
@ -22,21 +21,19 @@ local function is_known_modo(name)
end
minetest.register_on_joinplayer(function(player)
-- Obtenir les privs du player
-- Get player privs
local player_name = player:get_player_name()
local is_modo = minetest.check_player_privs(player_name, {kick = true, ban = true})
-- Le joueur est-il un modérateur connu ?
-- Is player a known moderator?
local known = is_known_modo(player_name)
-- Ajouter ou supprimer le joueur de la liste des modérateurs
-- Add or remove the player to/from moderators list
if not known and is_modo then
-- Ajouter nom du player dans liste modos
local modos = get_modo_list()
table.insert(modos, player_name)
storage:set_string("report", minetest.serialize(modos))
elseif known and not is_modo then
-- Supprimer nom du player de la liste modos
local modos = get_modo_list()
for i, modo in ipairs(modos) do
if modo == player_name then
@ -49,14 +46,14 @@ minetest.register_on_joinplayer(function(player)
end)
minetest.register_chatcommand("report", {
description = S("Report: @1 to see moderators list. @2 is the message to report to moderators.", "'modos'", "'msg'"),
params = "modos|msg",
description = S("Send a report to moderators. '/report modos_list' to get the list of moderators."),
params = "<msg>",
func = function(name, param)
param = param:trim()
if param == "" then
return false, S("Please write a message for the report. If it's about one or several players in particular, please give their name.")
end
if param == "modos" then
if param == "modos_list" then
return true, S("Moderators list: @1", table.concat(get_modo_list(), ", "))
end
local _, count = string.gsub(param, " ", "")

View File

@ -1,5 +1,5 @@
# textdomain:report
Report: @1 to see moderators list. @2 is the message to report to moderators.=Report: @1 pour voir la liste des modérateurs. @2 est le message à rapporter aux modérateurs.
Send a report to moderators. '/report modos_list' to get the list of moderators.=Envoie un rapport aux modérateurs. '/report modos_list' pour obtenir la liste des modérateurs.
Please write a message for the report. If it's about one or several players in particular, please give their name.=Veuillez écrire un message pour le rapport. Si il s'agit d'un ou plusieurs joueurs en particulier, veuillez aussi indiquer leur nom.
Moderators list: @1=Liste de modérateurs : @1
If you are reporting a player's attitude, you should also say why. (Ex: insult, sabotage)=Si vous rapportez l'attitude d'un joueur, vous devriez aussi dire quelle en est la raison. (Ex: insulte, sabotage)
@ -7,4 +7,4 @@ If you are reporting a player's attitude, you should also say why. (Ex: insult,
Report: @1 (online moderator(s): @2)=Rapport : @1 (moderateur(s) connecté(s) : @2)
Reported. Online moderator(s): @1=Rapporté. Moderateur(s) connecté(s) : @1
Report: @1 (no online moderator)=Rapport : @1 (pas de modérateur connecté)
Reported. We will get back to you.=Rapporté. On reviendra vers vous.
Reported. We will get back to you.=Rapporté. On reviendra vers vous.

10
locale/template.txt Normal file
View File

@ -0,0 +1,10 @@
# textdomain:report
Send a report to moderators. '/report modos_list' to get the list of moderators.=
Please write a message for the report. If it's about one or several players in particular, please give their name.=
Moderators list: @1=
If you are reporting a player's attitude, you should also say why. (Ex: insult, sabotage)=
-!- @1 has reported: @2=
Report: @1 (online moderator(s): @2)=
Reported. Online moderator(s): @1=
Report: @1 (no online moderator)=
Reported. We will get back to you.=