mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-26 18:21:04 +00:00
Add last_login field to auth.txt
Also shortens some related code and adds more parameters to string.split.
This commit is contained in:
parent
c40e993ce4
commit
90b6de173e
3 changed files with 79 additions and 30 deletions
|
@ -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,
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue