From 2100a574e7a8e91c7b87974f48fed754b85b0bbc Mon Sep 17 00:00:00 2001 From: mckaygerhard Date: Wed, 21 Jun 2023 18:01:36 -0400 Subject: [PATCH] geoip command, better formating info --- commands.lua | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/commands.lua b/commands.lua index ea09c93..09fc976 100644 --- a/commands.lua +++ b/commands.lua @@ -47,17 +47,16 @@ if not governing.modgeoip then func = function(name, param) if not param then return true, "usage: /geoip " 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