user_ban
Ban a member from the server. A banned user is disconnected at once and can’t sign in again until someone runs user_unban.
Request
Section titled “Request”{ "cmd": "user_ban", "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_ban", "user": "alice", "banned": true}banned is true only when this request changed something:
- If the user was already banned, you get their username and
banned: false. - If no account matches, you get
user: nullandbanned: false. This is not an error.
A ban adds the banned role to the front of the user’s role list and records an entry in the audit log. When a ban takes effect:
-
Every session of the banned user receives an
auth_errorframe, then closes.{"cmd": "auth_error","val": "You have been banned from this server","reason": "banned"} -
Every authenticated connection, including yours, receives
{ "cmd": "user_leave", "username": "alice" }.
Banned users drop out of users_list and show up in users_banned. Their messages stay.
Permissions
Section titled “Permissions”Requires manage_users. It is blocked while you are timed out.
Errors
Section titled “Errors”val |
When |
|---|---|
Cannot ban the server owner |
The target has the owner role. |
Unable to save users |
The server could not write the change to storage. |
| Validation message | user is missing, not a string, or blank. |
