Skip to content

user_roles_get

Fetch the roles a member has, in order, along with the color and gradient their name should use.

{
"cmd": "user_roles_get",
"user": "alice"
}
Field Type Required Description
user string Yes Username or user ID. Matching ignores letter case and a leading @.
{
"cmd": "user_roles_get",
"user": "alice",
"roles": ["photography", "user"],
"color": "#a78bfa",
"gradient": ["#a78bfa", "#f472b6"]
}
  • roles lists role names in the member’s own order. That order decides the name color, not role rank.
  • color comes from the first role in roles whose color isn’t null. Roles made with role_create store "" when they have no color, so color can be "". It is null if no role qualifies.
  • gradient comes from the first role that has a gradient array or a non-null color. It is that role’s gradient array, or its color string when it has no gradient array. It is null if 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.

Any member can call it.

val When
User not found No account matches user.
Validation message user is missing, not a string, or blank.