Sessions & Privacy Commands
Active-session, privacy-setting, and block-list commands.
Handler group source
- Handler module:
backend/tg_client/dialogs/commands/handlers/settings.py
- Registered commands:
10
- Registry integration:
backend/tg_client/dialogs/commands/registry.py
Command index
| Command |
Handler |
Service / callable |
Success event(s) |
Notes |
| `get_active_sessions` |
handle_settings_commands |
settings_service.get_active_sessions |
get_active_sessions |
single logical response |
| `terminate_session` |
handle_settings_commands |
settings_service.terminate_session |
terminate_session |
single logical response |
| `set_session_settings` |
handle_settings_commands |
settings_service.set_session_settings |
set_session_settings |
single logical response |
| `terminate_all_other_sessions` |
handle_settings_commands |
settings_service.terminate_all_other_sessions |
terminate_all_other_sessions |
single logical response |
| `block_user` |
handle_settings_commands |
settings_service.set_user_blocked |
block_user |
single logical response |
| `unblock_user` |
handle_settings_commands |
settings_service.unblock_user |
unblock_user |
single logical response |
| `get_blocked_users` |
handle_settings_commands |
settings_service.get_blocked_users |
get_blocked_users |
single logical response |
| `get_privacy_setting` |
handle_settings_commands |
settings_service.get_privacy_setting |
get_privacy_setting |
single logical response |
| `get_privacy_settings` |
handle_settings_commands |
settings_service.get_privacy_settings |
get_privacy_settings |
single logical response |
| `set_privacy_setting` |
handle_settings_commands |
settings_service.set_privacy_setting |
set_privacy_setting |
single logical response |
Group conventions
- Incoming client requests use the WebSocket
action field and are routed into the owner runtime via publish_command().
- Outbound success/error payloads are wrapped into
chat_update live events.
ctx.send_response() means one logical success event plus a conventional <command>_error event on failure.
- Manual
ctx.send() branches indicate streaming or custom event emission; these commands are documented explicitly below.
- Request field types and required flags are inferred from handler/service code because there is no formal request schema object for every command.
Command: get_active_sessions
Summary
Get active sessions.
Location in code
- Handler:
backend/tg_client/dialogs/commands/handlers/settings.py::handle_settings_commands (branch starts near line 20).
- Service:
backend/tg_client/dialogs/tdlib/services/settings_service.py::get_active_sessions.
- Raw API modules:
backend/tg_client/dialogs/tdlib/api/settings.py, backend/tg_client/dialogs/tdlib/api/chats.py.
- Normalizer / typed builder:
backend/tg_client/dialogs/tdlib/normalizers/settings_normalizer.py.
Request
Structure
{
"action": "get_active_sessions",
"userbot_id": 1
}
Parameters
| Field |
Type |
Required |
Default |
Description |
| — |
— |
— |
— |
This command does not require extra payload fields beyond action and userbot_id. |
Response variants
- Success event(s):
get_active_sessions.
- Error event(s):
get_active_sessions_error.
- Result shaping:
backend/tg_client/dialogs/tdlib/normalizers/settings_normalizer.py.
Errors
| Error |
Type/Code |
When happens |
Notes |
| TDLib / service error |
string |
Raw API call fails or the service returns a transport-shaped error |
Forwarded from TdlibBaseClient.tg_call() or the service layer. |
Flow
TDLibListChatsConsumer.receive_json() forwards the WebSocket action into publish_command().
AccountOwnerWorker receives the command envelope and invokes dispatch_command_payload().
- Registry handler
handle_settings_commands processes get_active_sessions.
- Service layer executes
backend/tg_client/dialogs/tdlib/services/settings_service.py::get_active_sessions.
- Raw TDLib wrapper(s):
backend/tg_client/dialogs/tdlib/api/settings.py, backend/tg_client/dialogs/tdlib/api/chats.py.
- Result normalization / shaping:
backend/tg_client/dialogs/tdlib/normalizers/settings_normalizer.py.
- Final payload is emitted through
ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
- Sibling commands in this handler group:
terminate_session, set_session_settings, terminate_all_other_sessions, block_user, unblock_user, get_blocked_users, get_privacy_setting, get_privacy_settings, set_privacy_setting.
Command: terminate_session
Summary
Terminate session.
Location in code
- Handler:
backend/tg_client/dialogs/commands/handlers/settings.py::handle_settings_commands (branch starts near line 25).
- Service:
backend/tg_client/dialogs/tdlib/services/settings_service.py::terminate_session.
- Raw API modules:
backend/tg_client/dialogs/tdlib/api/settings.py, backend/tg_client/dialogs/tdlib/api/chats.py.
- Normalizer / typed builder:
backend/tg_client/dialogs/tdlib/normalizers/settings_normalizer.py.
Request
Structure
{
"action": "terminate_session",
"userbot_id": 1,
"session_id": 987654321
}
Parameters
| Field |
Type |
Required |
Default |
Description |
session_id |
integer |
required |
— |
Derived from handler payload access in current code. |
Response variants
- Success event(s):
terminate_session.
- Error event(s):
terminate_session_error.
- Result shaping:
backend/tg_client/dialogs/tdlib/normalizers/settings_normalizer.py.
Errors
| Error |
Type/Code |
When happens |
Notes |
session_id is required |
string |
Service-side validation or branch guard |
Returned as the error field of the error event. |
current session can't be terminated via terminate_session |
string |
Service-side validation or branch guard |
Returned as the error field of the error event. |
| TDLib / transport error |
string |
Raw API call fails or TDLib raises in the transport wrapper |
Forwarded from TdlibBaseClient.tg_call() or returned by the service. |
Flow
TDLibListChatsConsumer.receive_json() forwards the WebSocket action into publish_command().
AccountOwnerWorker receives the command envelope and invokes dispatch_command_payload().
- Registry handler
handle_settings_commands processes terminate_session.
- Service layer executes
backend/tg_client/dialogs/tdlib/services/settings_service.py::terminate_session.
- Raw TDLib wrapper(s):
backend/tg_client/dialogs/tdlib/api/settings.py, backend/tg_client/dialogs/tdlib/api/chats.py.
- Result normalization / shaping:
backend/tg_client/dialogs/tdlib/normalizers/settings_normalizer.py.
- Final payload is emitted through
ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
- Sibling commands in this handler group:
get_active_sessions, set_session_settings, terminate_all_other_sessions, block_user, unblock_user, get_blocked_users, get_privacy_setting, get_privacy_settings, set_privacy_setting.
Command: set_session_settings
Summary
Update flags on an existing session. At least one mutable flag must be present in the request.
Location in code
- Handler:
backend/tg_client/dialogs/commands/handlers/settings.py::handle_settings_commands (branch starts near line 32).
- Service:
backend/tg_client/dialogs/tdlib/services/settings_service.py::set_session_settings.
- Raw API modules:
backend/tg_client/dialogs/tdlib/api/settings.py, backend/tg_client/dialogs/tdlib/api/chats.py.
- Normalizer / typed builder:
backend/tg_client/dialogs/tdlib/normalizers/settings_normalizer.py.
Request
Structure
{
"action": "set_session_settings",
"userbot_id": 1,
"session_id": 987654321,
"can_accept_calls": true
}
Request variants
- Provide
session_id and at least one of can_accept_calls or can_accept_secret_chats.
Parameters
| Field |
Type |
Required |
Default |
Description |
session_id |
integer |
required |
— |
Derived from handler payload access in current code. |
can_accept_calls |
boolean |
optional |
— |
Presence is checked explicitly by the handler before calling the service. |
can_accept_secret_chats |
boolean |
optional |
— |
Presence is checked explicitly by the handler before calling the service. |
Response variants
- Success event(s):
set_session_settings.
- Error event(s):
set_session_settings_error.
- Result shaping:
backend/tg_client/dialogs/tdlib/normalizers/settings_normalizer.py.
Errors
| Error |
Type/Code |
When happens |
Notes |
session_id is required |
string |
Service-side validation or branch guard |
Returned as the error field of the error event. |
at least one of can_accept_calls or can_accept_secret_chats is required |
string |
Service-side validation or branch guard |
Returned as the error field of the error event. |
| TDLib / transport error |
string |
Raw API call fails or TDLib raises in the transport wrapper |
Forwarded from TdlibBaseClient.tg_call() or returned by the service. |
Flow
TDLibListChatsConsumer.receive_json() forwards the WebSocket action into publish_command().
AccountOwnerWorker receives the command envelope and invokes dispatch_command_payload().
- Registry handler
handle_settings_commands processes set_session_settings.
- Service layer executes
backend/tg_client/dialogs/tdlib/services/settings_service.py::set_session_settings.
- Raw TDLib wrapper(s):
backend/tg_client/dialogs/tdlib/api/settings.py, backend/tg_client/dialogs/tdlib/api/chats.py.
- Result normalization / shaping:
backend/tg_client/dialogs/tdlib/normalizers/settings_normalizer.py.
- Final payload is emitted through
ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
- Sibling commands in this handler group:
get_active_sessions, terminate_session, terminate_all_other_sessions, block_user, unblock_user, get_blocked_users, get_privacy_setting, get_privacy_settings, set_privacy_setting.
Command: terminate_all_other_sessions
Summary
Terminate all other sessions.
Location in code
- Handler:
backend/tg_client/dialogs/commands/handlers/settings.py::handle_settings_commands (branch starts near line 49).
- Service:
backend/tg_client/dialogs/tdlib/services/settings_service.py::terminate_all_other_sessions.
- Raw API modules:
backend/tg_client/dialogs/tdlib/api/settings.py, backend/tg_client/dialogs/tdlib/api/chats.py.
- Normalizer / typed builder:
backend/tg_client/dialogs/tdlib/normalizers/settings_normalizer.py.
Request
Structure
{
"action": "terminate_all_other_sessions",
"userbot_id": 1
}
Parameters
| Field |
Type |
Required |
Default |
Description |
| — |
— |
— |
— |
This command does not require extra payload fields beyond action and userbot_id. |
Response variants
- Success event(s):
terminate_all_other_sessions.
- Error event(s):
terminate_all_other_sessions_error.
- Result shaping:
backend/tg_client/dialogs/tdlib/normalizers/settings_normalizer.py.
Errors
| Error |
Type/Code |
When happens |
Notes |
| TDLib / service error |
string |
Raw API call fails or the service returns a transport-shaped error |
Forwarded from TdlibBaseClient.tg_call() or the service layer. |
Flow
TDLibListChatsConsumer.receive_json() forwards the WebSocket action into publish_command().
AccountOwnerWorker receives the command envelope and invokes dispatch_command_payload().
- Registry handler
handle_settings_commands processes terminate_all_other_sessions.
- Service layer executes
backend/tg_client/dialogs/tdlib/services/settings_service.py::terminate_all_other_sessions.
- Raw TDLib wrapper(s):
backend/tg_client/dialogs/tdlib/api/settings.py, backend/tg_client/dialogs/tdlib/api/chats.py.
- Result normalization / shaping:
backend/tg_client/dialogs/tdlib/normalizers/settings_normalizer.py.
- Final payload is emitted through
ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
- Sibling commands in this handler group:
get_active_sessions, terminate_session, set_session_settings, block_user, unblock_user, get_blocked_users, get_privacy_setting, get_privacy_settings, set_privacy_setting.
Command: block_user
Summary
Block user.
Location in code
- Handler:
backend/tg_client/dialogs/commands/handlers/settings.py::handle_settings_commands (branch starts near line 54).
- Service:
backend/tg_client/dialogs/tdlib/services/settings_service.py::set_user_blocked.
- Raw API modules:
backend/tg_client/dialogs/tdlib/api/settings.py, backend/tg_client/dialogs/tdlib/api/chats.py.
- Normalizer / typed builder:
backend/tg_client/dialogs/tdlib/normalizers/settings_normalizer.py.
Request
Structure
{
"action": "block_user",
"userbot_id": 1,
"user_id": 123456789,
"block_list": "blockListMain"
}
Parameters
| Field |
Type |
Required |
Default |
Description |
user_id |
integer |
required |
— |
Derived from handler payload access in current code. |
is_blocked |
boolean |
optional |
true |
Derived from handler payload access in current code. |
block_list |
`string |
object` |
optional |
— |
TDLib block-list discriminator or object; current runtime still accepts the raw value forwarded by the client. |
Response variants
- Success event(s):
block_user.
- Error event(s):
block_user_error.
- Result shaping:
backend/tg_client/dialogs/tdlib/normalizers/settings_normalizer.py.
Errors
| Error |
Type/Code |
When happens |
Notes |
user_id is required |
string |
Service-side validation or branch guard |
Returned as the error field of the error event. |
block_list must be a TDLib block list type |
string |
Validation of TDLib-style input payload |
Returned as the error field of the error event. |
| TDLib / transport error |
string |
Raw API call fails or TDLib raises in the transport wrapper |
Forwarded from TdlibBaseClient.tg_call() or returned by the service. |
Flow
TDLibListChatsConsumer.receive_json() forwards the WebSocket action into publish_command().
AccountOwnerWorker receives the command envelope and invokes dispatch_command_payload().
- Registry handler
handle_settings_commands processes block_user.
- Service layer executes
backend/tg_client/dialogs/tdlib/services/settings_service.py::set_user_blocked.
- Raw TDLib wrapper(s):
backend/tg_client/dialogs/tdlib/api/settings.py, backend/tg_client/dialogs/tdlib/api/chats.py.
- Result normalization / shaping:
backend/tg_client/dialogs/tdlib/normalizers/settings_normalizer.py.
- Final payload is emitted through
ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
- Sibling commands in this handler group:
get_active_sessions, terminate_session, set_session_settings, terminate_all_other_sessions, unblock_user, get_blocked_users, get_privacy_setting, get_privacy_settings, set_privacy_setting.
Command: unblock_user
Summary
Unblock user.
Location in code
- Handler:
backend/tg_client/dialogs/commands/handlers/settings.py::handle_settings_commands (branch starts near line 63).
- Service:
backend/tg_client/dialogs/tdlib/services/settings_service.py::unblock_user.
- Raw API modules:
backend/tg_client/dialogs/tdlib/api/settings.py, backend/tg_client/dialogs/tdlib/api/chats.py.
- Normalizer / typed builder:
backend/tg_client/dialogs/tdlib/normalizers/settings_normalizer.py.
Request
Structure
{
"action": "unblock_user",
"userbot_id": 1,
"user_id": 123456789
}
Parameters
| Field |
Type |
Required |
Default |
Description |
user_id |
integer |
required |
— |
Derived from handler payload access in current code. |
Response variants
- Success event(s):
unblock_user.
- Error event(s):
unblock_user_error.
- Result shaping:
backend/tg_client/dialogs/tdlib/normalizers/settings_normalizer.py.
Errors
| Error |
Type/Code |
When happens |
Notes |
| TDLib / service error |
string |
Raw API call fails or the service returns a transport-shaped error |
Forwarded from TdlibBaseClient.tg_call() or the service layer. |
Flow
TDLibListChatsConsumer.receive_json() forwards the WebSocket action into publish_command().
AccountOwnerWorker receives the command envelope and invokes dispatch_command_payload().
- Registry handler
handle_settings_commands processes unblock_user.
- Service layer executes
backend/tg_client/dialogs/tdlib/services/settings_service.py::unblock_user.
- Raw TDLib wrapper(s):
backend/tg_client/dialogs/tdlib/api/settings.py, backend/tg_client/dialogs/tdlib/api/chats.py.
- Result normalization / shaping:
backend/tg_client/dialogs/tdlib/normalizers/settings_normalizer.py.
- Final payload is emitted through
ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
- Sibling commands in this handler group:
get_active_sessions, terminate_session, set_session_settings, terminate_all_other_sessions, block_user, get_blocked_users, get_privacy_setting, get_privacy_settings, set_privacy_setting.
Command: get_blocked_users
Summary
Get blocked users.
Location in code
- Handler:
backend/tg_client/dialogs/commands/handlers/settings.py::handle_settings_commands (branch starts near line 70).
- Service:
backend/tg_client/dialogs/tdlib/services/settings_service.py::get_blocked_users.
- Raw API modules:
backend/tg_client/dialogs/tdlib/api/settings.py, backend/tg_client/dialogs/tdlib/api/chats.py.
- Normalizer / typed builder:
backend/tg_client/dialogs/tdlib/normalizers/settings_normalizer.py.
Request
Structure
{
"action": "get_blocked_users",
"userbot_id": 1,
"block_list": "blockListMain"
}
Parameters
| Field |
Type |
Required |
Default |
Description |
block_list |
`string |
object` |
optional |
— |
TDLib block-list discriminator or object; current runtime still accepts the raw value forwarded by the client. |
offset |
integer |
optional |
0 |
Derived from handler payload access in current code. |
limit |
integer |
optional |
50 |
Derived from handler payload access in current code. |
Response variants
- Success event(s):
get_blocked_users.
- Error event(s):
get_blocked_users_error.
- Result shaping:
backend/tg_client/dialogs/tdlib/normalizers/settings_normalizer.py.
Errors
| Error |
Type/Code |
When happens |
Notes |
block_list must be a TDLib block list type |
string |
Validation of TDLib-style input payload |
Returned as the error field of the error event. |
| TDLib / transport error |
string |
Raw API call fails or TDLib raises in the transport wrapper |
Forwarded from TdlibBaseClient.tg_call() or returned by the service. |
Flow
TDLibListChatsConsumer.receive_json() forwards the WebSocket action into publish_command().
AccountOwnerWorker receives the command envelope and invokes dispatch_command_payload().
- Registry handler
handle_settings_commands processes get_blocked_users.
- Service layer executes
backend/tg_client/dialogs/tdlib/services/settings_service.py::get_blocked_users.
- Raw TDLib wrapper(s):
backend/tg_client/dialogs/tdlib/api/settings.py, backend/tg_client/dialogs/tdlib/api/chats.py.
- Result normalization / shaping:
backend/tg_client/dialogs/tdlib/normalizers/settings_normalizer.py.
- Final payload is emitted through
ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
- Sibling commands in this handler group:
get_active_sessions, terminate_session, set_session_settings, terminate_all_other_sessions, block_user, unblock_user, get_privacy_setting, get_privacy_settings, set_privacy_setting.
Command: get_privacy_setting
Summary
Get privacy setting.
Location in code
- Handler:
backend/tg_client/dialogs/commands/handlers/settings.py::handle_settings_commands (branch starts near line 79).
- Service:
backend/tg_client/dialogs/tdlib/services/settings_service.py::get_privacy_setting.
- Raw API modules:
backend/tg_client/dialogs/tdlib/api/settings.py, backend/tg_client/dialogs/tdlib/api/chats.py.
- Normalizer / typed builder:
backend/tg_client/dialogs/tdlib/normalizers/settings_normalizer.py.
Request
Structure
{
"action": "get_privacy_setting",
"userbot_id": 1,
"setting": "userPrivacySettingShowStatus"
}
Parameters
| Field |
Type |
Required |
Default |
Description |
setting |
`string |
object` |
required |
— |
Either a raw privacy-setting type string or an object with @type. |
Response variants
- Success event(s):
get_privacy_setting.
- Error event(s):
get_privacy_setting_error.
- Result shaping:
backend/tg_client/dialogs/tdlib/normalizers/settings_normalizer.py.
Errors
| Error |
Type/Code |
When happens |
Notes |
unsupported privacy setting |
string |
Validation of TDLib-style input payload |
Returned as the error field of the error event. |
| TDLib / transport error |
string |
Raw API call fails or TDLib raises in the transport wrapper |
Forwarded from TdlibBaseClient.tg_call() or returned by the service. |
Flow
TDLibListChatsConsumer.receive_json() forwards the WebSocket action into publish_command().
AccountOwnerWorker receives the command envelope and invokes dispatch_command_payload().
- Registry handler
handle_settings_commands processes get_privacy_setting.
- Service layer executes
backend/tg_client/dialogs/tdlib/services/settings_service.py::get_privacy_setting.
- Raw TDLib wrapper(s):
backend/tg_client/dialogs/tdlib/api/settings.py, backend/tg_client/dialogs/tdlib/api/chats.py.
- Result normalization / shaping:
backend/tg_client/dialogs/tdlib/normalizers/settings_normalizer.py.
- Final payload is emitted through
ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
- Sibling commands in this handler group:
get_active_sessions, terminate_session, set_session_settings, terminate_all_other_sessions, block_user, unblock_user, get_blocked_users, get_privacy_settings, set_privacy_setting.
Command: get_privacy_settings
Summary
Get privacy settings.
Location in code
- Handler:
backend/tg_client/dialogs/commands/handlers/settings.py::handle_settings_commands (branch starts near line 86).
- Service:
backend/tg_client/dialogs/tdlib/services/settings_service.py::get_privacy_settings.
- Raw API modules:
backend/tg_client/dialogs/tdlib/api/settings.py, backend/tg_client/dialogs/tdlib/api/chats.py.
- Normalizer / typed builder:
backend/tg_client/dialogs/tdlib/normalizers/settings_normalizer.py.
Request
Structure
{
"action": "get_privacy_settings",
"userbot_id": 1,
"settings": [
"userPrivacySettingShowStatus",
"newChatPrivacySettings"
]
}
Parameters
| Field |
Type |
Required |
Default |
Description |
settings |
`array<string |
object>` |
optional |
— |
Array of privacy setting keys or TDLib-style setting objects. |
Response variants
- Success event(s):
get_privacy_settings.
- Error event(s):
get_privacy_settings_error.
- Result shaping:
backend/tg_client/dialogs/tdlib/normalizers/settings_normalizer.py.
Errors
| Error |
Type/Code |
When happens |
Notes |
failed to get privacy settings |
string |
Service-side validation or branch guard |
Returned as the error field of the error event. |
settings must be a list or string |
string |
Validation of TDLib-style input payload |
Returned as the error field of the error event. |
| TDLib / transport error |
string |
Raw API call fails or TDLib raises in the transport wrapper |
Forwarded from TdlibBaseClient.tg_call() or returned by the service. |
Flow
TDLibListChatsConsumer.receive_json() forwards the WebSocket action into publish_command().
AccountOwnerWorker receives the command envelope and invokes dispatch_command_payload().
- Registry handler
handle_settings_commands processes get_privacy_settings.
- Service layer executes
backend/tg_client/dialogs/tdlib/services/settings_service.py::get_privacy_settings.
- Raw TDLib wrapper(s):
backend/tg_client/dialogs/tdlib/api/settings.py, backend/tg_client/dialogs/tdlib/api/chats.py.
- Result normalization / shaping:
backend/tg_client/dialogs/tdlib/normalizers/settings_normalizer.py.
- Final payload is emitted through
ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
- Sibling commands in this handler group:
get_active_sessions, terminate_session, set_session_settings, terminate_all_other_sessions, block_user, unblock_user, get_blocked_users, get_privacy_setting, set_privacy_setting.
Command: set_privacy_setting
Summary
Set one privacy setting either as TDLib user-privacy rules or as newChatPrivacySettings.
Location in code
- Handler:
backend/tg_client/dialogs/commands/handlers/settings.py::handle_settings_commands (branch starts near line 93).
- Service:
backend/tg_client/dialogs/tdlib/services/settings_service.py::set_privacy_setting.
- Raw API modules:
backend/tg_client/dialogs/tdlib/api/settings.py, backend/tg_client/dialogs/tdlib/api/chats.py.
- Normalizer / typed builder:
backend/tg_client/dialogs/tdlib/normalizers/settings_normalizer.py.
Request
Structure
{
"action": "set_privacy_setting",
"userbot_id": 1,
"setting": "userPrivacySettingShowStatus",
"mode": "contacts",
"allow_user_ids": [
123456789
]
}
Request variants
- User privacy rules mode: provide
setting, mode, and optional allow/restrict user/chat ids.
- Raw rules mode: provide
setting and rules as a userPrivacySettingRules object or list of rule items.
- New chat privacy mode: provide
setting equal to newChatPrivacySettings and allow_new_chats_from_unknown_users.
Parameters
| Field |
Type |
Required |
Default |
Description |
setting |
`string |
object` |
required |
— |
Either a raw privacy-setting type string or an object with @type. |
mode |
unknown |
optional |
— |
Derived from handler payload access in current code. |
allow_user_ids |
array<integer> |
optional |
— |
Derived from handler payload access in current code. |
restrict_user_ids |
array<integer> |
optional |
— |
Derived from handler payload access in current code. |
allow_chat_ids |
array<integer> |
optional |
— |
Derived from handler payload access in current code. |
restrict_chat_ids |
array<integer> |
optional |
— |
Derived from handler payload access in current code. |
allow_premium_users |
boolean |
optional |
false |
Derived from handler payload access in current code. |
rules |
`object |
array<object>` |
optional |
— |
Either a userPrivacySettingRules object or a list of raw rule items. |
allow_new_chats_from_unknown_users |
unknown |
optional |
— |
Derived from handler payload access in current code. |
Response variants
- Success event(s):
set_privacy_setting.
- Error event(s):
set_privacy_setting_error.
- Result shaping:
backend/tg_client/dialogs/tdlib/normalizers/settings_normalizer.py.
Errors
| Error |
Type/Code |
When happens |
Notes |
unsupported privacy setting |
string |
Validation of TDLib-style input payload |
Returned as the error field of the error event. |
mode must be one of: all, contacts, nobody |
string |
Validation of TDLib-style input payload |
Returned as the error field of the error event. |
| TDLib / transport error |
string |
Raw API call fails or TDLib raises in the transport wrapper |
Forwarded from TdlibBaseClient.tg_call() or returned by the service. |
Flow
TDLibListChatsConsumer.receive_json() forwards the WebSocket action into publish_command().
AccountOwnerWorker receives the command envelope and invokes dispatch_command_payload().
- Registry handler
handle_settings_commands processes set_privacy_setting.
- Service layer executes
backend/tg_client/dialogs/tdlib/services/settings_service.py::set_privacy_setting.
- Raw TDLib wrapper(s):
backend/tg_client/dialogs/tdlib/api/settings.py, backend/tg_client/dialogs/tdlib/api/chats.py.
- Result normalization / shaping:
backend/tg_client/dialogs/tdlib/normalizers/settings_normalizer.py.
- Final payload is emitted through
ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
- Sibling commands in this handler group:
get_active_sessions, terminate_session, set_session_settings, terminate_all_other_sessions, block_user, unblock_user, get_blocked_users, get_privacy_setting, get_privacy_settings.