Skip to content

Role

Implementation of a Discord Guild Role as a Luau builder.

https://discord.com/developers/docs/resources/guild#create-guild-role-json-params

Role.name  :: string?

The name of the role.

Role.permissionFlags  :: Permissions }

The permissions assigned to the role.

Role.color  :: number?

The color of the role represented as a hexadecimal number.

Role.isHoisted  :: boolean?

Whether the role is displayed separately in the member list.

Role.icon  :: string?

The icon of the role.

Role.unicodeEmoji  :: string?

The unicode emoji of the role.

Role.isMentionable  :: boolean?

Whether the role can be mentioned by users.

Role : setName ( roleName )  -> Role

Sets the name of the role, optionally this could be defined when creating the Role Builder as well.

Parameters

roleName: string

Returns

Role
Role : setPermissions ( ... )  -> Role

Sets the permissions of the role, optionally this could be defined when creating the Role Builder as well.

Parameters

...: Permissions

Returns

Role
Role : setColor ( color )  -> Role

Sets the color of the role. Colors are presennted as a hexadecimal number.

Parameters

color: number

Returns

Role
Role : setHoisted ( isHoisted )  -> Role

Sets the role to be hoisted. A hoisted role is displayed in the user listing, vs’s an unhoisted role which is not displayed at all.

Parameters

isHoisted: boolean

Returns

Role
Role : setMentionable ( isMentionable )  -> Role

Sets the role to be mentionable through the @ mention.

Parameters

isMentionable: boolean

Returns

Role
Role : build ( )  -> JSON

Responsible for buillding the role object that the Discord API can understand.

Returns

JSON
Role . new ( resource )  -> Role

Constructs a new Role Builder.

local role = Role.new("Role Name", { permissions.Permission.SendMessages })
:setColor(0xFFFFFF)
:setHoisted(true)
:setMentionable(true)
:build()

Parameters

resource: {
roleName: string?,
rolePermissions: { apiTypes.Permissions,
}

Returns

Role