Update chatplus, email and report

This commit is contained in:
rubenwardy 2016-03-17 15:39:49 +00:00
parent 2b18dc58ea
commit c812241314
18 changed files with 604 additions and 223 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.

View file

@ -1 +1 @@
chatplus
email

View file

@ -0,0 +1 @@
Allows players to report misconduct or bugs using /report.

View file

@ -1,7 +1,3 @@
if not chatplus.send_mail then
error("You need to update chatplus!")
end
minetest.register_chatcommand("report", {
func = function(name, param)
param = param:trim()
@ -19,20 +15,20 @@ minetest.register_chatcommand("report", {
-- Get comma separated list of online moderators and admins
local mods = {}
for _, player in pairs(minetest.get_connected_players()) do
local pname = player:get_player_name()
if minetest.check_player_privs(pname, {kick = true, ban = true}) then
table.insert(mods, pname)
minetest.chat_send_player(pname, "-!- " .. name .. " reported: " .. param)
local toname = player:get_player_name()
if minetest.check_player_privs(toname, {kick = true, ban = true}) then
table.insert(mods, toname)
minetest.chat_send_player(toname, "-!- " .. name .. " reported: " .. param)
end
end
if #mods > 0 then
mod_list = table.concat(mods, ", ")
chatplus.send_mail(name, minetest.setting_get("name"),
email.send_mail(name, minetest.setting_get("name"),
"Report: " .. param .. " (mods online: " .. mod_list .. ")")
return true, "Reported. Moderators currently online: " .. mod_list
else
chatplus.send_mail(name, minetest.setting_get("name"),
email.send_mail(name, minetest.setting_get("name"),
"Report: " .. param .. " (no mods online)")
return true, "Reported. We'll get back to you."
end