DevForum Module: Retrieve DevForum User Data with ease
The DevForum Module is a very simple module: It allows you to retrieve a player’s DevForum Data (everything that is public to anyone that is). It also offers some very basic functions that don’t require you to write long functions, including :IsMember()
, :IsRegular()
and :GetGroups()
. A full list can be found below.
Module Functions
The module has 9 functions in total right now, :IsMember()
, :IsRegular()
, :IsLeader()
, :IsInForum()
, :GetGroups()
, :IsInGroup()
, :GetData()
, :GetTrustLevel()
and :PerformRequest()
.
All functions except :PerformRequest()
take the same type of argument, request
.
The request
argument can be one of the following types: username (string)
, userId (number)
or an Player
Instance. The :PerformRequest()
function only accepts the username (string)
as it’s parameter.
The module receives the information over HttpService
, so make sure you enabled HTTP Requests in the game you want to use it in.
Documentation
The documentation is the function name and what it returns, like shown in the example below. DiscourseUser
and DiscourseGroup
is always the JSON provided below. The :PerformRequest()
function will not be documented since :GetData()
should be used instead. If it can’t find the user you specified, then system
will be used as fallback. Please note that it will return nil if it can’t find any results at all or if an error happened.
All requests are cached, but you can bypass it by using the PerformRequest()
function. Example: PerformRequest(username, true)
. true
tells the module to bypass the cache and get the latest version.
Quick Navigation:
- :GetData()
- :GetTrustLevel()
- :IsMember()
- :IsRegular()
- :IsLeader()
- :IsInForum()
- :GetGroups()
- :IsInGroup()
Discourse Responses:
DiscourseUser
{
"user_badges": [
{}
],
"user": {
"id": 0,
"username": "string",
"avatar_template": "string",
"name": {},
"last_posted_at": "string",
"last_seen_at": "string",
"created_at": "string",
"website_name": {},
"can_edit": true,
"can_edit_username": true,
"can_edit_email": true,
"can_edit_name": true,
"can_send_private_messages": true,
"can_send_private_message_to_user": true,
"trust_level": 0,
"moderator": true,
"admin": true,
"title": {},
"uploaded_avatar_id": {},
"badge_count": 0,
"custom_fields": {},
"pending_count": 0,
"profile_view_count": 0,
"primary_group_name": {},
"primary_group_flair_url": {},
"primary_group_flair_bg_color": {},
"primary_group_flair_color": {},
"invited_by": {},
"groups": [
{
"id": 0,
"automatic": true,
"name": "string",
"user_count": 0,
"alias_level": 0,
"visible": true,
"automatic_membership_email_domains": {},
"automatic_membership_retroactive": true,
"primary_group": true,
"title": {},
"grant_trust_level": {},
"notification_level": {},
"has_messages": true,
"is_member": true,
"mentionable": true,
"flair_url": {},
"flair_bg_color": {},
"flair_color": {}
}
],
"featured_user_badge_ids": [
{}
],
"card_badge": {}
}
}
DiscourseGroup
{
"id": 0,
"automatic": true,
"name": "string",
"user_count": 0,
"mentionable_level": 0,
"messageable_level": 0,
"visibility_level": 0,
"primary_group": true,
"title": "string",
"grant_trust_level": null,
"has_messages": true,
"flair_url": "string",
"flair_bg_color": "string",
"flair_color": "string",
"bio_cooked": "string",
"bio_excerpt": "string",
"public_admission": true,
"public_exit": true,
"allow_membership_requests": true,
"full_name": "string",
"default_notification_level": 0,
"membership_request_template": "string",
"members_visibility_level": 0,
"can_see_members": true,
"publish_read_state": true
},
Documentation Example:
function DevForum:FunctionName(parameter)
return string or nil
end
:GetData()
function DevForum:GetData(request)
return DiscourseUser or nil
-- Returns their entire Data
end
:GetTrustLevel()
function DevForum:GetTrustLevel(request)
return number or nil
-- Returns the users current trust level
end
:IsMember()
function DevForum:IsMember(request)
return boolean or nil
-- Only returns true if they are a Member
end
:IsRegular()
function DevForum:IsRegular(request)
return boolean or nil
-- Only returns true if they are a Reglar
end
:IsLeader()
function DevForum:IsLeader(request)
return boolean or nil
-- Only returns true if they are a Leader
end
:IsInForum()
function DevForum:IsInForum(request)
return boolean or nil
-- Only returns true if they are a New Member or higher
end
:GetGroups()
function DevForum:GetGroups(request)
return DiscourseGroup[] or nil
-- Returns an Array of DiscourseGroups the user is in
end
:IsInGroup()
-- groupName accepts the group name or group id
function DevForum:IsInGroup(request, groupName)
return boolean, DiscourseGroup or nil
-- Warning: This returns both a boolean and a DiscourseGroup
-- Only returns true if they are in the group
-- Returns nil instead of DiscourseGroup if they are not in the group
end
Where can I get the module
- Module @ GitHub
-
Module @ Roblox (Can also be loaded with
require(4728831510)
for auto updates)
Update Checker
The module warns you when you are running an outdated version. Please note that using the require()
method is the only way to currently auto update the module.