remove debug prints + fix usernamehistory + onlinestatus erroring for terminated user

This commit is contained in:
dowoge 2023-10-09 14:39:53 -04:00
parent bfc591b84b
commit 86b7d5837e
No known key found for this signature in database
GPG Key ID: 222075D091339B7A

View File

@ -90,7 +90,7 @@ commands:Add('user',{},'user <username|mention|"me">', function(t)
if type(user_info)=='string' then return message:reply('```'..user_info..'```') end if type(user_info)=='string' then return message:reply('```'..user_info..'```') end
local description = user_info.description=='' and 'This user has no description' or user_info.description local description = user_info.description=='' and 'This user has no description' or user_info.description
table.foreach(user_info,print) -- table.foreach(user_info,print)
local created = tostring(date.fromISO(user_info.created):toSeconds()) local created = tostring(date.fromISO(user_info.created):toSeconds())
local current = date():toSeconds() local current = date():toSeconds()
local accountAge = round((current-created)/86400) local accountAge = round((current-created)/86400)
@ -99,15 +99,15 @@ commands:Add('user',{},'user <username|mention|"me">', function(t)
local name = user_info.name local name = user_info.name
local displayName = user_info.displayName local displayName = user_info.displayName
local usernameHistory = API:GetUserUsernameHistory(id).data local usernameHistory = API:GetUserUsernameHistory(id).data or {}
local usernameHistoryTable = {} local usernameHistoryTable = {}
for index,usernameObj in next,usernameHistory do for index,usernameObj in next,usernameHistory do
table.insert(usernameHistoryTable,usernameObj.name) table.insert(usernameHistoryTable,usernameObj.name)
end end
local usernameHistoryString = table.concat(usernameHistoryTable,', ') local usernameHistoryString = table.concat(usernameHistoryTable,', ')
local onlineStatus_info = API:GetUserOnlineStatus(id) local onlineStatus_info = API:GetUserOnlineStatus(id) or {lastLocation="Unknown", lastOnline=0, userPresenceType=-1}
table.foreach(onlineStatus_info,print) -- table.foreach(onlineStatus_info,print)
local LastLocation = onlineStatus_info.lastLocation local LastLocation = onlineStatus_info.lastLocation
if onlineStatus_info.userPresenceType==2 then LastLocation="Ingame" end if onlineStatus_info.userPresenceType==2 then LastLocation="Ingame" end