role_delete
Delete a role from the server. The built-in owner, admin, and user roles can’t be deleted.
Request
Section titled “Request”{ "cmd": "role_delete", "id": "b7e2d6a1-54c3-4f7a-8e0d-2c9f61a3e4b8"}| Field | Type | Required | Description |
|---|---|---|---|
id |
string | See below | ID or name of the role to delete. |
name |
string | See below | Name or ID of the role to delete. Used only when id is absent. |
Send id, name, or both. If you send both, id wins.
Response
Section titled “Response”{ "cmd": "role_delete", "val": { "id": "b7e2d6a1-54c3-4f7a-8e0d-2c9f61a3e4b8", "name": "photography", "description": "Share your shots", "color": "#a78bfa", "icon": "", "gradient": [], "hoisted": false, "permissions": [], "self_assignable": true, "category": "Hobbies", "price": 0, "position": 4 }}val is the role as it was before deletion. Every other authenticated connection receives the same role_delete frame. The deletion is recorded in the audit log.
- Members who had the role keep its name in their
rolesarray. Clients should skip role names that aren’t inroles_list. - Other roles keep their
positionvalues, so the order may have a gap.
Permissions
Section titled “Permissions”Requires manage_roles. It is blocked while you are timed out. The server owner can delete any custom role. Everyone else must also pass these checks:
- The role ranks below your highest role. A lower
positionis a higher rank. - You hold every permission the role grants, unless you have
administrator. Withoutadministrator, you can’t delete a role that grantsowneroradministrator.
Errors
Section titled “Errors”val |
When |
|---|---|
Role not found |
No role matches the id or name you sent. |
Cannot delete system roles |
The role is owner, admin, or user. |
Cannot manage roles at or above your position |
The role ranks at or above your highest role. |
Cannot assign '<permission>' — you don't have this permission yourself |
The role grants a permission you don’t hold. |
Failed to delete role |
The server could not save the change. |
| Validation message | Neither id nor name was sent, or one is not a string. |
