geoip command, better formating info
This commit is contained in:
parent
d731f8dbd9
commit
2100a574e7
11
commands.lua
11
commands.lua
@ -47,17 +47,16 @@ if not governing.modgeoip then
|
||||
func = function(name, param)
|
||||
|
||||
if not param then return true, "usage: /geoip <playername>" end
|
||||
minetest.log("warning", "[governing/geoip] Player " .. name .. " queries : " .. param)
|
||||
if not minetest.get_player_ip then return true, "minetest.get_player_ip no available! engine its too older or client does not provide such info." end
|
||||
if not minetest.get_player_ip then return true, "[geoip]: engine its too older, canot get ip of player." end
|
||||
|
||||
local ip = minetest.get_player_ip(param)
|
||||
if not ip then return true, "no ip available! seems ".. name .." does not provide such info!" end
|
||||
if not ip then return true, "[geoip] no ip available! seems "..param.." does not provide such info!" end
|
||||
|
||||
governing.lookup(ip, function(result)
|
||||
local txt = format_result(result)
|
||||
if not txt then return true, "Geoip error: "..name..":"..ip": " .. (result.description or "unknown error") end
|
||||
minetest.log("action", "[geoip] result for player " .. param .. ": " .. txt)
|
||||
minetest.chat_send_player(name, txt)
|
||||
if not txt then return true, "[geoip]: "..param..":"..ip" error: "..(result.description or "unknown error") end
|
||||
minetest.log("action", "[geoip] "..param..": "..txt)
|
||||
minetest.chat_send_player(name, param..": "..txt)
|
||||
end)
|
||||
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user