Checking if a user is in the devforum

Is it possible to use Roblox services such as HTTP requests to check if a player is a part of the devforum?

Devforum as in:
https://devforum.roblox.com

8 Likes

Based off of memory, I do not believe there is a way to accomplish this. If there is, I don’t believe there is a public API for the website.

It is 100% possible with small proxy and HttpService knowledge here is an example.

Script

wait(1 + math.random())

local Module = require(game:GetService("ServerScriptService").ModuleScript)
local Url = "https://cors-anywhere.herokuapp.com/https://devforum.roblox.com/u/"
local Searching = "DevOfLua"

Module:Start(Url,Searching)

Module

local Module = {}

local HttpService = game:GetService("HttpService")


function Module:Start(Url,Searching)
	local Success,Res = pcall(HttpService.RequestAsync,HttpService,{
		Url = Url..Searching,
		Method = "GET",
		Headers = {
			["X-Requested-With"] = "XMLHttpRequest"
		}
	})
	
	if not (Success) then
		print(Res)
		return
	end
	
	if (Success) then
		if (string.find(Res.Body,Searching)) then
			print(true)
		else
			print(false)
		end
	end
end


return Module

Final result

User that does not exists
image
And user that exists
image

13 Likes

This only checks if they have an account and not if they are a member.

@OneRubySky would have to use string.match() for that.

2 Likes

How would I do that? I have never messed with HTTP requests.

If you want to get someone’s trust level, you can make a request to the api url like this one:
https://devforum.roblox.com/u/DevOfLua.json
And then read name of each value in user.groups
If there’s one called trust_level_1, it means the user is at least a New Member.
If there’s one called trust_level_2, it means the user is at least a full Member.

You can also use that to check if the specific username exists on the devforum at all.


Edit:

Example code
local HS = game:GetService"HttpService"
local Url = "https://devforum.roblox.com/u/%s.json"
local Proxy = "https://cors-anywhere.herokuapp.com/"

local TrustLevels = {"None", "User", "New Member", "Member"}

local function GetTrustLevel(name)
	local res = HS:RequestAsync({
		Url = Proxy .. Url:format(name),
		Method = "GET",
		Headers = {
			["X-Requested-With"] = "XMLHttpRequest"
		}
	})
	if not res.Success then
		return "None" --no account or error
	end
	
	local json = HS:JSONDecode(res.Body)
	
	local highest = 0
	for i,v in pairs(json.user.groups) do
		local rank = tonumber(v.name:match("trust_level_(%d)"))
		if rank and rank > highest then
			highest = rank
		end
	end
	return TrustLevels[highest + 2]
end

print(GetTrustLevel("DevOfLua"))
15 Likes