From 88f81208cc3eca169e3e5b10e920550efc5f5557 Mon Sep 17 00:00:00 2001 From: dowoge Date: Mon, 7 Aug 2023 11:49:08 -0400 Subject: [PATCH] add username history to user embed --- src/modules/commands/user.lua | 8 ++++++++ src/modules/strafes_net.lua | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/src/modules/commands/user.lua b/src/modules/commands/user.lua index 3247c9f..6ced83e 100644 --- a/src/modules/commands/user.lua +++ b/src/modules/commands/user.lua @@ -99,6 +99,13 @@ commands:Add('user',{},'user ', function(t) local name = user_info.name local displayName = user_info.displayName + local usernameHistory = API:GetUserUsernameHistory(id).data + local usernameHistoryTable = {} + for index,usernameObj in next,usernameHistory do + table.insert(usernameHistoryTable,usernameObj.name) + end + local usernameHistoryString = table.concat(usernameHistoryTable,', ') + local onlineStatus_info = API:GetUserOnlineStatus(id) table.foreach(onlineStatus_info,print) @@ -146,6 +153,7 @@ commands:Add('user',{},'user ', function(t) {name='Last Location',value=LastLocation,inline=true}, {name='Banned',value=isBanned,inline=true}, {name='Description',value=description,inline=false}, + {name='Username History',value=usernameHistoryString,inline=false}, } } if firstBadge and firstBadgeDate~=math.huge then diff --git a/src/modules/strafes_net.lua b/src/modules/strafes_net.lua index e30dbf7..638a962 100644 --- a/src/modules/strafes_net.lua +++ b/src/modules/strafes_net.lua @@ -286,6 +286,14 @@ function API:GetUserOnlineStatus(USER_ID) return response1 end +function API:GetUserUsernameHistory(USER_ID) + if not USER_ID then return 'empty id' end + local err, res = parseToURLArgs({limit=100}) + if err then return err end + local response1 = http_request('GET', ROBLOX_API_URL..'users/'..USER_ID..'/username-history'..res,API_HEADER) + return response1 +end + function API:GetBadgesAwardedDates(USER_ID,BADGE_LIST) if not USER_ID then return 'empty id' end local err,res = parseToURLArgs({badgeIds=table.concat(BADGE_LIST,',')})