Skip to content

Instantly share code, notes, and snippets.

@foxt
Created February 15, 2020 12:26
Show Gist options
  • Select an option

  • Save foxt/c1b826cbd728848f3b7dfcef235346bf to your computer and use it in GitHub Desktop.

Select an option

Save foxt/c1b826cbd728848f3b7dfcef235346bf to your computer and use it in GitHub Desktop.
Detect if a user is on the Roblox devforum or not.
function getDevForumTrustLevel(username)
local succ,retval = pcall(function()
local apiResponse = game.HttpService:GetAsync("https://cors-anywhere.herokuapp.com/https://devforum.roblox.com/users/"..username..".json",false, {
["x-requested-with"] = "Roblox"
})
local j = game.HttpService:JSONDecode(apiResponse)
if (j["user"]) then
return j["user"]["trust_level"]
else
return -1
end
end)
if succ then
return retval
else
return -2
end
end
function printTrustLevel(username)
local trustLevel = getDevForumTrustLevel(username)
if trustLevel < 0 then
print(username.." is not registered on the devforum, or there was an error.")
elseif trustLevel == 0 then
print(username.." is registered on the devforum, but they do not have a trust level.")
elseif trustLevel == 1 then
print(username.." is a new member.")
elseif trustLevel > 1 then
print(username.." is a full member or higher.")
end
end
printTrustLevel("ngmleht")
printTrustLevel("leolwo1")
printTrustLevel("theLMGN")
printTrustLevel("bAdCc")
--[[
ngmleht is not registered on the devforum, or there was an error.
leolwo1 is registered on the devforum, but they do not have a trust level.
theLMGN is a new member.
bAdCc is a full member or higher.
--]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment