user_roles_get
Fetch the roles a member has, in order, along with the color and gradient their name should use.
Request
Section titled “Request”{ "cmd": "user_roles_get", "user": "alice"}| Field | Type | Required | Description |
|---|---|---|---|
user |
string | Yes | Username or user ID. Matching ignores letter case and a leading @. |
Response
Section titled “Response”{ "cmd": "user_roles_get", "user": "alice", "roles": ["photography", "user"], "color": "#a78bfa", "gradient": ["#a78bfa", "#f472b6"]}roleslists role names in the member’s own order. That order decides the name color, not role rank.colorcomes from the first role inroleswhosecolorisn’tnull. Roles made withrole_createstore""when they have no color, socolorcan be"". It isnullif no role qualifies.gradientcomes from the first role that has agradientarray or a non-nullcolor. It is that role’s gradient array, or its color string when it has no gradient array. It isnullif no role qualifies.
The server also sends this frame on its own whenever a member’s roles change, through user_roles_set, self_role_add, self_role_remove, or self_roles_reorder. Update the member’s roles whenever it arrives.
Permissions
Section titled “Permissions”Any member can call it.
Errors
Section titled “Errors”val |
When |
|---|---|
User not found |
No account matches user. |
| Validation message | user is missing, not a string, or blank. |
