diff options
Diffstat (limited to 'builtin/game/chatcommands.lua')
-rw-r--r-- | builtin/game/chatcommands.lua | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/builtin/game/chatcommands.lua b/builtin/game/chatcommands.lua index d7ef712ae..c215a75c3 100644 --- a/builtin/game/chatcommands.lua +++ b/builtin/game/chatcommands.lua @@ -723,3 +723,20 @@ core.register_chatcommand("msg", { end, }) +core.register_chatcommand("last-login", { + params = "[name]", + description = "Get the last login time of a player", + func = function(name, param) + if param == "" then + param = name + end + local pauth = core.get_auth_handler().get_auth(param) + if pauth and pauth.last_login then + -- Time in UTC, ISO 8601 format + return true, "Last login time was " .. + os.date("!%Y-%m-%dT%H:%M:%SZ", pauth.last_login) + end + return false, "Last login time is unknown" + end, +}) + |