Repository navigation
Group
This page will document all methods and properties of the Group class
-
- acceptJoinRequest
- changeRank
- declineJoinRequest
- deleteWallPost
- deleteWallPostsByUser
- demote
- exileUser
- getAuditLogs
- getGroupFunds
- getJoinRequests
- getMyPermissions
- getRankNameInGroup
- getRole
- getRoles
- getUsers
- getUsersWithRole
- getWall
- isInGroup
- joinGroup
- onGroupChange
- onJoinRequest
- onWallPost
- payout
- postOnWall
- postShout
- promote
- setAsPrimaryGroup
- setRank
-
Accepts a join request by its request id
Parameters
- requestId (Number) - The id of the join request
Returns
- Promise (Boolean)
Example
.acceptJoinRequest(123).then( () => {
console.log("Accepted")
})Changes a group member's rank to the next rank above or below their current rank. (-1 for below, 1 for above)
Parameters
- userId (Number) - The id of the group member
- amount (Number) - The amount to change the rank with
Returns
- Promise (Boolean)
Example
.changeRank(18442032, 1).then( () => {
console.log("Changed user's rank")
})Declines a join request by its request id
Parameters
- requestId (Number) - The id of the join request
Returns
- Promise (Boolean)
Example
.declineJoinRequest(123).then( () => {
console.log("Declined join request");
})Deletes a wall post from the group wall
Parameters
- postId (Number) - The id of the post
Returns
- Promise (Boolean)
Example
.deleteWallPost(123).then( () => {
console.log("Deleted wall post");
})Deletes all posts by a user from the group
Parameters
- userId (Number) - The id of the user to remove the posts from
Returns
- Promise (Boolean)
Example
.deleteWallPostsByUser(18442032).then( () => {
console.log("Deleted user's posts");
})Demotes a user in the group (same as changeRank(userId, -1))
Parameters
- userId - The id of the user to demote
Returns
- Promise (Boolean)
Example
.demote(18442032).then( () => {
console.log("Demoted user");
})Kicks/exiles a user from the group
Parameters
- userId (Number) - The id of the user to kick/exile
Returns
- Promise (Boolean)
Example
.exileUser(18442032).then( () => {
console.log("Kicked user");
})Gets audit logs in a group, can be filtered by providing options
Parameters
- options (Object) - The optional settings to provide
- options.action (Number) - The id of the action (you can find this by manually going to the audit logs page for your group and filtering by action and getting the id from the URL)
- options.page (Number) - The page to retrieve
- options.username (String) - If you want to get all actions made by a user
Returns
- Promise(Array[Class-AuditLog])
- Class-AuditLog.action (String)
- Class-AuditLog.date (Date)
- Class-AuditLog.user (Class-PartialUser)
Example
.getAuditLogs({
page:1,
username: 'CodeTheIdiot'
}).then(actions=>{
console.log(actions);
})Gets the group's current funds
Parameters
- None
Returns
- Promise (Number)
Example
.getGroupFunds().then(funds=>{
console.log(`Group has ${funds} robux`);
})Gets the group's join requests ( group must be set to manual approval)
Parameters
- options (Object) - The optional options to provide
- options.page (Number) - The page to retrieve
- options.username (String) - Gets join requests from the user with this name (still returns an array)
- options.userId (Number) - Gets join requests from the user with this id (still returns an array)
Returns
- Promise (Array[Class-JoinRequest])
Example
.getJoinRequests({
userId: 18442032
}).then(reqs=>{
console.log(`Got ${reqs.length} join requests`);
})Gets the authenticated roblox user's permissions in the group
Parameters
- None
Returns
- Class-MyGroupPermissions
Example response
MyGroupPermissions {
groupId: 3544434,
isPrimary: false,
isPendingJoin: false,
userRole:
{ user:
PartialUser {
_self: [BloxyClient],
userId: 18442032,
username: 'CodeTheIdiot',
buildersClub: null },
role: { id: 24349662, name: 'Martin (Owner) ', rank: 255 } },
maxGroups: 5,
permissions:
{ groupPostsPermissions:
{ viewWall: true,
postToWall: true,
deleteFromWall: true,
viewStatus: true,
postToStatus: true },
groupMembershipPermissions:
{ changeRank: true, inviteMembers: true, removeMembers: true },
groupManagementPermissions:
{ manageRelationships: true,
manageClan: true,
viewAuditLogs: true },
groupEconomyPermissions:
{ spendGroupFunds: true,
advertiseGroup: true,
createItems: true,
manageItems: true,
addGroupPlaces: true,
manageGroupGames: false } } }
Example
.getMyPermissions().then(p=>{
console.log(p);
})Gets a user's rank name in the group
Parameters
- username (Number) - The id of the user to get the rank of in the group
Returns
- Promise (String)
Example
.getRankNameInGroup(18442032).then(rank=>{
console.log(rank);
})Gets a role in the group by the filter object
(You can provide one, but the more the better ) Parameters
- filter (Object)
- filter.name (String) - The name of the role (must be exactly the same)
- filter.id (Number) - The id of the role
- filter.rank - The rank of the role (0-255)
Returns
- Promise (Class-GroupRole)
Example
.getRole({
name: "role1",
id: 3123112,
rank: 150
}).then(role=>{
if (role) console.log(`Got role ${role.name}`)
})Gets all the roles in a group
Parameters
- None
Returns
- Promise (Array[Class-GroupRole])
Example
.getRoles().then(roles=>{
console.log(`Group has ${roles.length} roles in total`);
})Gets the users in a group
Parameters
- options (Object) - The optional objects to provide
- options.page (Number) - The page to retrieve of users
Returns
- Promise (Array[Class-PartialUser])
Example
.getUsers({
page: 2
}).then(users=>{
console.log(`${users.length} users found!`);
})Gets the users in the group with the provided role
Parameters
- roleId (Number)
Returns
- Promise (Results)
- Results.users
- Results.nextPageCursor
- Results.previousPageCursor
Example
.getUsersWithRole(2312321321).then(res=>{
console.log(res);
})Gets the group's wall
Parameters
- options (Object) - The optional options to provide
- options.page (Number) - The page to retrieve
Returns
- Promise (Results)
- Results.posts
- Results.nextPageCursor
- Results.previousPageCursor
Example
.getWall({
page:2
}).then(result=>{
console.log(result);
})Parameters
- userId (Number) - The id of the user to check if they are in the group or not
Returns
- Promise (Boolean)
Example
.isInGroup(18442032).then(isIn=>{
console.log(`Is user in group: ${isIn}`);
})Parameters
- None
Returns
- Promise (Boolean)
Example
.joinGroup().then( () => {
console.log("Joined group");
})Returns a class that will emit 'shout' when a new shout has been made
Parameters
- options.interval (Number) - The amount of ms to check for new shout
Returns
- Promise (GroupChangeEvent)
Emits
- 'shout': {new: GroupShout, old: GroupShout} - Fired when a new shout has been made
- 'ready': nothing - Fired when it's ready to detect new changes
Example
let onChange = group.onGroupChange();
onChange.on('ready', function () {
console.log("Waiting for new shout");
})
onChange.on('shout', function (data) {
console.log(data);
})Returns a class that will emit 'requests' when there are new join requests
Parameters
- options.interval (Number) - The amount of ms to check for new join requests
Returns
- Promise (Class-JoinRequestEvent)
Emits
- 'requests': [Class-JoinRequest] - Fired whenever there are new requests
- 'ready' nothing - Fired when it's ready to detect new join requests
Example
let onJoin = group.onJoinRequest();
onJoin.on('ready', function() {
console.log("Waiting for new join requests");
})
onJoin.on('requests', function (requests) {
console.log(`Got ${requests.length} new requests`);
})Pays members in the group
Parameters
- options (Object) - The options
- options.members (Array) - Array containing info about members to pay
- options.members.userId (Number) - Id of the user to pay
- options.members.amount (Number) - Amount to pay the user (either % or amt)
- options.recurring (Boolean) - Whether or not the payment to be recurring
- options.usePercentage (Boolean) - Whether or not the payment should use percentage
Returns
- Promise (Boolean)
Examples
// Paying a user once
.payout({
members: [
{
userId: 18442032,
amount: 123
}
],
recurring: false,
usePercentage: false
}).then( () => {
console.log("Paid 123 robux");
})
// Paying several users with percentage
.payout({
members: [
{
userId: 18442032,
amount:25
},
{
userId: 12345678,
amount: 75
}
],
recurring: false,
usePercentage: true
}).then( () => {
console.log("paid them 100%");
})
// Paying a user recurringly
.payout({
members: [
{
userId: 18442032,
amount: 25
}
],
recurring: true,
usePercentage: true
}).then( () => {
console.log("Started payment process for the user(s)");
})Posts a message on the group wall
Parameters
- wallMessage (String) - The message to send
Returns
- Promise (Clas-WallPost)
Example
.postOnWall("Hi folks").then( () => {
console.log("sent new msg");
})Posts a new shout on the group
Parameters
- newShout (String) - The new shout to post
Returns
- Promise (Class-GroupShout)
Example
.postShout("Welcome to my group :D").then( () => {
console.log("New shout has been posted");
})Promotes a user (same as using changeRank(userId, 1))
Parameters
- userId (Number) - The id of the user to promote
Returns
- Promise (Boolean)
Example
.promote(userId).then( () => {
console.log("Promoted user");
})Sets the group as the authenticated roblox user's primary
Parameters
- None
Returns
- Promise (Boolean)
Example
.setAsPrimaryGroup().then( () => {
console.log("Set group as primary");
})Sets the user's rank to the role's id
Parameters
- userId (Number) - The id of the user to set the rank to the role
- roleId (Number) - The id of the role to promote the user to
Returns
- Promise (Boolean)
Example
.setRank(18442032, 1231231).then( () => {
console.log("Set user's rank");
})The description of the group
The id of the group
The current member count of the group
(Class-PartialUser) The owner of the group
The current shout on the group
If you have any questions about this module, or you'd like to try out some other modules made for interacting with the Roblox API, join this server: https://discord.gg/EDXNdAT