new Role()
Server role users can have on a Server
Properties:
Name | Type | Description |
---|---|---|
ID |
number | Identifier of the role, the owner usually has the role 0. |
server |
Server | |
client |
Client | |
name |
string | Name of this role. |
rank |
number | Rank of this role, the most powerful rank (the owner), is the lowest, and the less important the bigger the rank is. |
isDefault |
boolean | If true, this is the role of all new users on the server. |
Methods
everyMember(callback)
Iterate through all the members of this server role.
Parameters:
Name | Type | Description |
---|---|---|
callback |
function | callback: (errors, user, done) => {}.
|
Example
myRole.everyMember(function(errors, user, done){
if(errors == null && !done){
//Work with the user object
//This will stop the iteration if the user with curse ID 1 is found
if(user.ID === 1){
return false;
}
}
});
isMember(user, callback)
Callback with a boolean to know if a user is member of this group or not, answer is transmitted through callback
Parameters:
Name | Type | Description |
---|---|---|
user |
User | User to check |
callback |
function | callback: (errors, isRole) => {}.
|