From e6a2a4d9bce750a334ce38efb152ecbd73286f8e Mon Sep 17 00:00:00 2001 From: 9382 Date: Fri, 14 Apr 2023 22:23:02 +0100 Subject: [PATCH] Implement guessing of email verified date --- src/modules/commands/user.lua | 48 +++++++++++++++++++++++++++++++++++ src/modules/strafes_net.lua | 8 +++++- 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/src/modules/commands/user.lua b/src/modules/commands/user.lua index 37cf2a1..0f36de5 100644 --- a/src/modules/commands/user.lua +++ b/src/modules/commands/user.lua @@ -40,6 +40,47 @@ BadgesToName = { local function round(x,n) return string.format('%.'..(n or 0)..'f',x) end + +local function FromYMD(ymd) + return date.fromISO(ymd.."T00:00:00")[1] +end +local function leftpad(s,n,p) + return string.rep(p,n-#tostring(s))..s +end +local function ToYMD(seconds) + return "" +end +local IDToDate = { --Terrible ranges but it's all we have + -- {1000000000, FromYMD("2006-01-01")}, --I guess? + -- {1864564055, FromYMD("2008-08-04")}, + {3800920136, FromYMD("2016-04-16")}, + {9855616205, FromYMD("2017-04-02")}, + {30361018662, FromYMD("2018-11-14")}, + {32665806459, FromYMD("2019-01-07")}, + {34758058773, FromYMD("2019-02-24")}, + {65918261258, FromYMD("2020-06-05")}, + {171994717435, FromYMD("2023-03-24")}, + {173210319088, FromYMD("2023-04-14")} +} +--We assume linear interpolation since anything more complex I can't process + +local function linterp(i1, i2, m) + return math.floor(i1 + (i2-i1)*m) +end +local function GuessDateFromAssetID(AssetID) + for i = #IDToDate, 1, -1 do --Newest to oldest + local ID,Time = unpack(IDToDate[i]) + if ID < AssetID then + if not IDToDate[i+1] then + return "After "..ToYMD(Time) + end + local ParentID, ParentTime = unpack(IDToDate[i+1]) + return "Around "..ToYMD(linterp(Time, ParentTime, (AssetID-ID)/(ParentID-ID))) + end + end + return "Before "..ToYMD(IDToDate[1][2]) +end + discordia.extensions() commands:Add('user',{},'user ', function(t) local args=t.args @@ -65,6 +106,12 @@ commands:Add('user',{},'user ', function(t) if onlineStatus_info.userPresenceType==2 then LastLocation="Ingame" end local LastOnline = date.fromISO(onlineStatus_info.lastOnline):toSeconds()+(3600*5) + local verificationAssetId = API:GetVerificationItemID(id) + local verificationDate = "Not verified" + if verificationAssetId.data[1] then + verificationDate = GuessDateFromAssetID(verificationAssetId.data[1].instanceId) + end + local badgeRequest = API:GetBadgesAwardedDates(id,Badges) local badgeData = badgeRequest.data @@ -92,6 +139,7 @@ commands:Add('user',{},'user ', function(t) {name='ID',value=id,inline=true}, {name='Account Age',value=accountAge..' days',inline=true}, {name='Created',value='',inline=true}, + {name='Verified Email',value=verificationDate,inline=true}, {name='Last Online',value='',inline=true}, {name='Last Location',value=LastLocation,inline=true}, {name='Banned',value=isBanned,inline=true}, diff --git a/src/modules/strafes_net.lua b/src/modules/strafes_net.lua index a7fb4a5..3afd584 100644 --- a/src/modules/strafes_net.lua +++ b/src/modules/strafes_net.lua @@ -9,8 +9,8 @@ local ROBLOX_API_URL2 = 'https://api.roblox.com/' local ROBLOX_BADGES_API = 'https://badges.roblox.com/v1/' local ROBLOX_PRESENCE_URL = 'https://presence.roblox.com/v1/' local ROBLOX_THUMBNAIL_URL = 'https://thumbnails.roblox.com/v1/' +local ROBLOX_INVENTORY_API = 'https://inventory.roblox.com/v1/' local ROBLOX_GROUPS_ROLES_URL = 'https://groups.roblox.com/v2/users/%s/groups/roles' -local ROBLOX_SENS_DB = 'http://oef.ddns.net:9017/rbhop/sens/' local RANK_CONSTANT_A, RANK_CONSTANT_B, RANK_CONSTANT_C, RANK_CONSTANT_D, RANK_CONSTANT_E = 0.215, 0.595, 0.215, 0.215, 0.71 @@ -294,6 +294,12 @@ function API:GetBadgesAwardedDates(USER_ID,BADGE_LIST) return response,headers end +function API:GetVerificationItemID(USER_ID) + if not USER_ID then return 'empty id' end + local response,headers = http_request('GET', ROBLOX_INVENTORY_API..'users/'..USER_ID.."/items/Asset/102611803", API_HEADER) + return response,headers +end + function API:GetUserThumbnail(USER_ID,TYPE,SIZE) -- https://thumbnails.roblox.com/v1/users/avatar?userIds=1455906620&size=180x180&format=Png&isCircular=false if not USER_ID then return 'empty id' end local _TYPE = self.ROBLOX_THUMBNAIL_TYPES[TYPE] or 'avatar' -- 2.45.2