Messages

Message send/edit/delete/reaction and auto-delete configuration commands.

Message Commands

Message send/edit/delete/reaction and auto-delete configuration commands.

Handler group source

  • Handler module: backend/tg_client/dialogs/commands/handlers/messages.py
  • Registered commands: 11
  • Registry integration: backend/tg_client/dialogs/commands/registry.py

Command index

Command Handler Service / callable Success event(s) Notes
`send_message` handle_message_commands message_command_service.send_message send_message single logical response
`delete_messages` handle_message_commands message_command_service.delete_messages delete_messages single logical response
`forward_message` handle_message_commands message_command_service.forward_message forward_message single logical response
`reply_message` handle_message_commands message_command_service.reply_message reply_message single logical response
`edit_message` handle_message_commands message_command_service.edit_message edit_message single logical response
`pin_message` handle_message_commands message_command_service.pin_message pin_message single logical response
`unpin_message` handle_message_commands message_command_service.unpin_message unpin_message single logical response
`set_reaction` handle_message_commands message_command_service.set_message_reaction set_reaction single logical response
`get_default_message_auto_delete_time` handle_message_commands message_command_service.get_default_message_auto_delete_time get_default_message_auto_delete_time single logical response
`set_default_message_auto_delete_time` handle_message_commands message_command_service.set_default_message_auto_delete_time set_default_message_auto_delete_time Success does not return the raw TDLib result. The handler emits only the requested message_auto_delete_time value.
`set_chat_message_auto_delete_time` handle_message_commands message_command_service.set_chat_message_auto_delete_time set_chat_message_auto_delete_time Success does not return the raw TDLib result. The handler emits {chat_id, message_auto_delete_time}.

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: send_message

Summary

Send a text or media message using raw TDLib send options, reply targets, and markup when provided.

Location in code

  • Handler: backend/tg_client/dialogs/commands/handlers/messages.py::handle_message_commands (branch starts near line 20).
  • Service: backend/tg_client/dialogs/tdlib/services/message_command_service.py::send_message.
  • Raw API modules: backend/tg_client/dialogs/tdlib/api/messages.py, backend/tg_client/dialogs/tdlib/api/files.py.
  • Normalizer / typed builder: not formally centralized for this command; result is service-assembled or raw TDLib-like.

Request

Structure

{
  "action": "send_message",
  "userbot_id": 1,
  "chat_id": -1001234567890,
  "text": "Hello from docs",
  "options": {
    "disable_notification": false
  }
}

Request variants

  • Text message: provide chat_id, text, and optionally entities, reply_to, options, reply_markup.
  • Media message: provide chat_id and media plus optional media_type.

Parameters

Field Type Required Default Description
chat_id integer required Derived from handler payload access in current code.
text string optional Derived from handler payload access in current code.
entities array<object> optional Derived from handler payload access in current code.
message_thread_id integer optional Derived from handler payload access in current code.
reply_to object optional Raw TDLib reply target object.
reply_to_message_id integer optional Derived from handler payload access in current code.
options object optional Raw TDLib send options object.
reply_markup object optional Raw TDLib reply-markup object.
media `object array<object>` optional Media upload/download target object or array of target objects.
media_type unknown optional Derived from handler payload access in current code.

Response variants

  • Success event(s): send_message.
  • Error event(s): send_message_error.
  • Result shaping: service-assembled payload or raw TDLib-like result. Not formally schema-bound.
  • Common outbound envelope:
{
  "type": "chat_update",
  "userbot_id": 1,
  "payload": {
    "userbot_id": 1,
    "type": "send_message",
    "result": "<typed payload or TDLib-like result>"
  }
}

Errors

Error Type/Code When happens Notes
chat_id is required string Service-side validation or branch guard Returned as the error field of the error event.
media must be an object 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_message_commands processes send_message.
  • Service layer executes backend/tg_client/dialogs/tdlib/services/message_command_service.py::send_message.
  • Raw TDLib wrapper(s): backend/tg_client/dialogs/tdlib/api/messages.py, backend/tg_client/dialogs/tdlib/api/files.py.
  • Final payload is emitted through ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
  • Sibling commands in this handler group: delete_messages, forward_message, reply_message, edit_message, pin_message, unpin_message, set_reaction, get_default_message_auto_delete_time, set_default_message_auto_delete_time, set_chat_message_auto_delete_time.

Command: delete_messages

Summary

Delete messages.

Location in code

  • Handler: backend/tg_client/dialogs/commands/handlers/messages.py::handle_message_commands (branch starts near line 36).
  • Service: backend/tg_client/dialogs/tdlib/services/message_command_service.py::delete_messages.
  • Raw API modules: backend/tg_client/dialogs/tdlib/api/messages.py, backend/tg_client/dialogs/tdlib/api/files.py.
  • Normalizer / typed builder: not formally centralized for this command; result is service-assembled or raw TDLib-like.

Request

Structure

{
  "action": "delete_messages",
  "userbot_id": 1,
  "chat_id": -1001234567890,
  "message_ids": [
    1,
    2
  ],
  "revoke": true
}

Parameters

Field Type Required Default Description
chat_id integer required Derived from handler payload access in current code.
message_ids array<integer> required Derived from handler payload access in current code.
revoke boolean optional Derived from handler payload access in current code.

Response variants

  • Success event(s): delete_messages.
  • Error event(s): delete_messages_error.
  • Result shaping: service-assembled payload or raw TDLib-like result. Not formally schema-bound.
  • Common outbound envelope:
{
  "type": "chat_update",
  "userbot_id": 1,
  "payload": {
    "userbot_id": 1,
    "type": "delete_messages",
    "result": "<typed payload or TDLib-like result>"
  }
}

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_message_commands processes delete_messages.
  • Service layer executes backend/tg_client/dialogs/tdlib/services/message_command_service.py::delete_messages.
  • Raw TDLib wrapper(s): backend/tg_client/dialogs/tdlib/api/messages.py, backend/tg_client/dialogs/tdlib/api/files.py.
  • Final payload is emitted through ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
  • Sibling commands in this handler group: send_message, forward_message, reply_message, edit_message, pin_message, unpin_message, set_reaction, get_default_message_auto_delete_time, set_default_message_auto_delete_time, set_chat_message_auto_delete_time.

Command: forward_message

Summary

Forward existing messages to one or more target chats with optional copy/caption controls.

Location in code

  • Handler: backend/tg_client/dialogs/commands/handlers/messages.py::handle_message_commands (branch starts near line 45).
  • Service: backend/tg_client/dialogs/tdlib/services/message_command_service.py::forward_message.
  • Raw API modules: backend/tg_client/dialogs/tdlib/api/messages.py, backend/tg_client/dialogs/tdlib/api/files.py.
  • Normalizer / typed builder: not formally centralized for this command; result is service-assembled or raw TDLib-like.

Request

Structure

{
  "action": "forward_message",
  "userbot_id": 1,
  "to_chat_ids": [
    1,
    2
  ],
  "from_chat_id": -1001234567890,
  "message_ids": [
    1,
    2
  ],
  "send_copy": true,
  "remove_caption": true
}

Parameters

Field Type Required Default Description
to_chat_ids array<integer> required Derived from handler payload access in current code.
from_chat_id integer required Derived from handler payload access in current code.
message_ids array<integer> required Derived from handler payload access in current code.
send_copy boolean optional Derived from handler payload access in current code.
remove_caption boolean optional Derived from handler payload access in current code.
new_caption unknown optional Derived from handler payload access in current code.
show_caption_above_media boolean optional Derived from handler payload access in current code.

Response variants

  • Success event(s): forward_message.
  • Error event(s): forward_message_error.
  • Result shaping: service-assembled payload or raw TDLib-like result. Not formally schema-bound.
  • Common outbound envelope:
{
  "type": "chat_update",
  "userbot_id": 1,
  "payload": {
    "userbot_id": 1,
    "type": "forward_message",
    "result": "<typed payload or TDLib-like result>"
  }
}

Errors

Error Type/Code When happens Notes
to_chat_ids is required string Service-side validation or branch guard Returned as the error field of the error event.
message_ids is required string Service-side validation or branch guard Returned as the error field of the error event.
to_chat_ids must contain at least one chat id string Service-side validation or branch guard Returned as the error field of the error event.
message_ids must contain at least one message id string Service-side validation or branch guard Returned as the error field of the error event.
from_chat_id 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_message_commands processes forward_message.
  • Service layer executes backend/tg_client/dialogs/tdlib/services/message_command_service.py::forward_message.
  • Raw TDLib wrapper(s): backend/tg_client/dialogs/tdlib/api/messages.py, backend/tg_client/dialogs/tdlib/api/files.py.
  • Final payload is emitted through ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
  • Sibling commands in this handler group: send_message, delete_messages, reply_message, edit_message, pin_message, unpin_message, set_reaction, get_default_message_auto_delete_time, set_default_message_auto_delete_time, set_chat_message_auto_delete_time.

Command: reply_message

Summary

Reply message.

Location in code

  • Handler: backend/tg_client/dialogs/commands/handlers/messages.py::handle_message_commands (branch starts near line 58).
  • Service: backend/tg_client/dialogs/tdlib/services/message_command_service.py::reply_message.
  • Raw API modules: backend/tg_client/dialogs/tdlib/api/messages.py, backend/tg_client/dialogs/tdlib/api/files.py.
  • Normalizer / typed builder: not formally centralized for this command; result is service-assembled or raw TDLib-like.

Request

Structure

{
  "action": "reply_message",
  "userbot_id": 1,
  "chat_id": -1001234567890,
  "reply_to_message_id": 99112200,
  "text": "Hello from docs"
}

Parameters

Field Type Required Default Description
chat_id integer required Derived from handler payload access in current code.
reply_to_message_id integer optional Derived from handler payload access in current code.
text string optional Derived from handler payload access in current code.

Response variants

  • Success event(s): reply_message.
  • Error event(s): reply_message_error.
  • Result shaping: service-assembled payload or raw TDLib-like result. Not formally schema-bound.
  • Common outbound envelope:
{
  "type": "chat_update",
  "userbot_id": 1,
  "payload": {
    "userbot_id": 1,
    "type": "reply_message",
    "result": "<typed payload or TDLib-like result>"
  }
}

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_message_commands processes reply_message.
  • Service layer executes backend/tg_client/dialogs/tdlib/services/message_command_service.py::reply_message.
  • Raw TDLib wrapper(s): backend/tg_client/dialogs/tdlib/api/messages.py, backend/tg_client/dialogs/tdlib/api/files.py.
  • Final payload is emitted through ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
  • Sibling commands in this handler group: send_message, delete_messages, forward_message, edit_message, pin_message, unpin_message, set_reaction, get_default_message_auto_delete_time, set_default_message_auto_delete_time, set_chat_message_auto_delete_time.

Command: edit_message

Summary

Edit message.

Location in code

  • Handler: backend/tg_client/dialogs/commands/handlers/messages.py::handle_message_commands (branch starts near line 67).
  • Service: backend/tg_client/dialogs/tdlib/services/message_command_service.py::edit_message.
  • Raw API modules: backend/tg_client/dialogs/tdlib/api/messages.py, backend/tg_client/dialogs/tdlib/api/files.py.
  • Normalizer / typed builder: not formally centralized for this command; result is service-assembled or raw TDLib-like.

Request

Structure

{
  "action": "edit_message",
  "userbot_id": 1,
  "chat_id": -1001234567890,
  "message_id": 99112233,
  "text": "Hello from docs"
}

Parameters

Field Type Required Default Description
chat_id integer required Derived from handler payload access in current code.
message_id integer required Derived from handler payload access in current code.
text string optional Derived from handler payload access in current code.

Response variants

  • Success event(s): edit_message.
  • Error event(s): edit_message_error.
  • Result shaping: service-assembled payload or raw TDLib-like result. Not formally schema-bound.
  • Common outbound envelope:
{
  "type": "chat_update",
  "userbot_id": 1,
  "payload": {
    "userbot_id": 1,
    "type": "edit_message",
    "result": "<typed payload or TDLib-like result>"
  }
}

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_message_commands processes edit_message.
  • Service layer executes backend/tg_client/dialogs/tdlib/services/message_command_service.py::edit_message.
  • Raw TDLib wrapper(s): backend/tg_client/dialogs/tdlib/api/messages.py, backend/tg_client/dialogs/tdlib/api/files.py.
  • Final payload is emitted through ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
  • Sibling commands in this handler group: send_message, delete_messages, forward_message, reply_message, pin_message, unpin_message, set_reaction, get_default_message_auto_delete_time, set_default_message_auto_delete_time, set_chat_message_auto_delete_time.

Command: pin_message

Summary

Pin message.

Location in code

  • Handler: backend/tg_client/dialogs/commands/handlers/messages.py::handle_message_commands (branch starts near line 76).
  • Service: backend/tg_client/dialogs/tdlib/services/message_command_service.py::pin_message.
  • Raw API modules: backend/tg_client/dialogs/tdlib/api/messages.py, backend/tg_client/dialogs/tdlib/api/files.py.
  • Normalizer / typed builder: not formally centralized for this command; result is service-assembled or raw TDLib-like.

Request

Structure

{
  "action": "pin_message",
  "userbot_id": 1,
  "chat_id": -1001234567890,
  "message_id": 99112233
}

Parameters

Field Type Required Default Description
chat_id integer required Derived from handler payload access in current code.
message_id integer required Derived from handler payload access in current code.
disable_notification boolean optional false Derived from handler payload access in current code.
only_for_self boolean optional false Derived from handler payload access in current code.

Response variants

  • Success event(s): pin_message.
  • Error event(s): pin_message_error.
  • Result shaping: service-assembled payload or raw TDLib-like result. Not formally schema-bound.
  • Common outbound envelope:
{
  "type": "chat_update",
  "userbot_id": 1,
  "payload": {
    "userbot_id": 1,
    "type": "pin_message",
    "result": "<typed payload or TDLib-like result>"
  }
}

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_message_commands processes pin_message.
  • Service layer executes backend/tg_client/dialogs/tdlib/services/message_command_service.py::pin_message.
  • Raw TDLib wrapper(s): backend/tg_client/dialogs/tdlib/api/messages.py, backend/tg_client/dialogs/tdlib/api/files.py.
  • Final payload is emitted through ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
  • Sibling commands in this handler group: send_message, delete_messages, forward_message, reply_message, edit_message, unpin_message, set_reaction, get_default_message_auto_delete_time, set_default_message_auto_delete_time, set_chat_message_auto_delete_time.

Command: unpin_message

Summary

Unpin message.

Location in code

  • Handler: backend/tg_client/dialogs/commands/handlers/messages.py::handle_message_commands (branch starts near line 86).
  • Service: backend/tg_client/dialogs/tdlib/services/message_command_service.py::unpin_message.
  • Raw API modules: backend/tg_client/dialogs/tdlib/api/messages.py, backend/tg_client/dialogs/tdlib/api/files.py.
  • Normalizer / typed builder: not formally centralized for this command; result is service-assembled or raw TDLib-like.

Request

Structure

{
  "action": "unpin_message",
  "userbot_id": 1,
  "chat_id": -1001234567890,
  "message_id": 99112233
}

Parameters

Field Type Required Default Description
chat_id integer required Derived from handler payload access in current code.
message_id integer required Derived from handler payload access in current code.

Response variants

  • Success event(s): unpin_message.
  • Error event(s): unpin_message_error.
  • Result shaping: service-assembled payload or raw TDLib-like result. Not formally schema-bound.
  • Common outbound envelope:
{
  "type": "chat_update",
  "userbot_id": 1,
  "payload": {
    "userbot_id": 1,
    "type": "unpin_message",
    "result": "<typed payload or TDLib-like result>"
  }
}

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_message_commands processes unpin_message.
  • Service layer executes backend/tg_client/dialogs/tdlib/services/message_command_service.py::unpin_message.
  • Raw TDLib wrapper(s): backend/tg_client/dialogs/tdlib/api/messages.py, backend/tg_client/dialogs/tdlib/api/files.py.
  • Final payload is emitted through ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
  • Sibling commands in this handler group: send_message, delete_messages, forward_message, reply_message, edit_message, pin_message, set_reaction, get_default_message_auto_delete_time, set_default_message_auto_delete_time, set_chat_message_auto_delete_time.

Command: set_reaction

Summary

Set reaction.

Location in code

  • Handler: backend/tg_client/dialogs/commands/handlers/messages.py::handle_message_commands (branch starts near line 94).
  • Service: backend/tg_client/dialogs/tdlib/services/message_command_service.py::set_message_reaction.
  • Raw API modules: backend/tg_client/dialogs/tdlib/api/messages.py, backend/tg_client/dialogs/tdlib/api/files.py.
  • Normalizer / typed builder: not formally centralized for this command; result is service-assembled or raw TDLib-like.

Request

Structure

{
  "action": "set_reaction",
  "userbot_id": 1,
  "chat_id": -1001234567890,
  "message_id": 99112233,
  "reaction": {
    "@type": "reactionTypeEmoji",
    "emoji": "👍"
  }
}

Parameters

Field Type Required Default Description
chat_id integer required Derived from handler payload access in current code.
message_id integer required Derived from handler payload access in current code.
reaction `object array<object>` required Raw TDLib reaction object or array of reaction items.
is_big boolean optional false Derived from handler payload access in current code.
add_to_recent boolean optional true Derived from handler payload access in current code.

Response variants

  • Success event(s): set_reaction.
  • Error event(s): set_reaction_error.
  • Result shaping: service-assembled payload or raw TDLib-like result. Not formally schema-bound.
  • Common outbound envelope:
{
  "type": "chat_update",
  "userbot_id": 1,
  "payload": {
    "userbot_id": 1,
    "type": "set_reaction",
    "result": "<typed payload or TDLib-like result>"
  }
}

Errors

Error Type/Code When happens Notes
chat_id and message_id are required string Service-side validation or branch guard Returned as the error field of the error event.
reaction is required string Service-side validation or branch guard Returned as the error field of the error event.
reaction must contain at least one valid reaction item 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_message_commands processes set_reaction.
  • Service layer executes backend/tg_client/dialogs/tdlib/services/message_command_service.py::set_message_reaction.
  • Raw TDLib wrapper(s): backend/tg_client/dialogs/tdlib/api/messages.py, backend/tg_client/dialogs/tdlib/api/files.py.
  • Final payload is emitted through ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
  • Sibling commands in this handler group: send_message, delete_messages, forward_message, reply_message, edit_message, pin_message, unpin_message, get_default_message_auto_delete_time, set_default_message_auto_delete_time, set_chat_message_auto_delete_time.

Command: get_default_message_auto_delete_time

Summary

Get default message auto delete time.

Location in code

  • Handler: backend/tg_client/dialogs/commands/handlers/messages.py::handle_message_commands (branch starts near line 105).
  • Service: backend/tg_client/dialogs/tdlib/services/message_command_service.py::get_default_message_auto_delete_time.
  • Raw API modules: backend/tg_client/dialogs/tdlib/api/messages.py, backend/tg_client/dialogs/tdlib/api/files.py.
  • Normalizer / typed builder: not formally centralized for this command; result is service-assembled or raw TDLib-like.

Request

Structure

{
  "action": "get_default_message_auto_delete_time",
  "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_default_message_auto_delete_time.
  • Error event(s): get_default_message_auto_delete_time_error.
  • Result shaping: service-assembled payload or raw TDLib-like result. Not formally schema-bound.
  • Common outbound envelope:
{
  "type": "chat_update",
  "userbot_id": 1,
  "payload": {
    "userbot_id": 1,
    "type": "get_default_message_auto_delete_time",
    "result": "<typed payload or TDLib-like result>"
  }
}

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_message_commands processes get_default_message_auto_delete_time.
  • Service layer executes backend/tg_client/dialogs/tdlib/services/message_command_service.py::get_default_message_auto_delete_time.
  • Raw TDLib wrapper(s): backend/tg_client/dialogs/tdlib/api/messages.py, backend/tg_client/dialogs/tdlib/api/files.py.
  • Final payload is emitted through ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
  • Sibling commands in this handler group: send_message, delete_messages, forward_message, reply_message, edit_message, pin_message, unpin_message, set_reaction, set_default_message_auto_delete_time, set_chat_message_auto_delete_time.

Command: set_default_message_auto_delete_time

Summary

Set the account-wide default message auto-delete time and echo the requested value on success.

Location in code

  • Handler: backend/tg_client/dialogs/commands/handlers/messages.py::handle_message_commands (branch starts near line 110).
  • Service: backend/tg_client/dialogs/tdlib/services/message_command_service.py::set_default_message_auto_delete_time.
  • Raw API modules: backend/tg_client/dialogs/tdlib/api/messages.py, backend/tg_client/dialogs/tdlib/api/files.py.
  • Normalizer / typed builder: not formally centralized for this command; result is service-assembled or raw TDLib-like.

Request

Structure

{
  "action": "set_default_message_auto_delete_time",
  "userbot_id": 1,
  "message_auto_delete_time": "value"
}

Parameters

Field Type Required Default Description
message_auto_delete_time integer optional Derived from handler payload access in current code.

Response variants

  • Success event(s): set_default_message_auto_delete_time.
  • Error event(s): set_default_message_auto_delete_time_error.
  • Result shaping: service-assembled payload or raw TDLib-like result. Not formally schema-bound.
  • Notes: Success does not return the raw TDLib result. The handler emits only the requested message_auto_delete_time value.
  • Common outbound envelope:
{
  "type": "chat_update",
  "userbot_id": 1,
  "payload": {
    "userbot_id": 1,
    "type": "set_default_message_auto_delete_time",
    "result": "<typed payload or TDLib-like result>"
  }
}

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_message_commands processes set_default_message_auto_delete_time.
  • Service layer executes backend/tg_client/dialogs/tdlib/services/message_command_service.py::set_default_message_auto_delete_time.
  • Raw TDLib wrapper(s): backend/tg_client/dialogs/tdlib/api/messages.py, backend/tg_client/dialogs/tdlib/api/files.py.
  • Final payload is emitted through ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
  • Sibling commands in this handler group: send_message, delete_messages, forward_message, reply_message, edit_message, pin_message, unpin_message, set_reaction, get_default_message_auto_delete_time, set_chat_message_auto_delete_time.

Command: set_chat_message_auto_delete_time

Summary

Set per-chat message auto-delete time and echo the requested value on success.

Location in code

  • Handler: backend/tg_client/dialogs/commands/handlers/messages.py::handle_message_commands (branch starts near line 122).
  • Service: backend/tg_client/dialogs/tdlib/services/message_command_service.py::set_chat_message_auto_delete_time.
  • Raw API modules: backend/tg_client/dialogs/tdlib/api/messages.py, backend/tg_client/dialogs/tdlib/api/files.py.
  • Normalizer / typed builder: not formally centralized for this command; result is service-assembled or raw TDLib-like.

Request

Structure

{
  "action": "set_chat_message_auto_delete_time",
  "userbot_id": 1,
  "chat_id": -1001234567890,
  "message_auto_delete_time": "value"
}

Parameters

Field Type Required Default Description
chat_id integer required Derived from handler payload access in current code.
message_auto_delete_time integer optional Derived from handler payload access in current code.

Response variants

  • Success event(s): set_chat_message_auto_delete_time.
  • Error event(s): set_chat_message_auto_delete_time_error.
  • Result shaping: service-assembled payload or raw TDLib-like result. Not formally schema-bound.
  • Notes: Success does not return the raw TDLib result. The handler emits {chat_id, message_auto_delete_time}.
  • Common outbound envelope:
{
  "type": "chat_update",
  "userbot_id": 1,
  "payload": {
    "userbot_id": 1,
    "type": "set_chat_message_auto_delete_time",
    "result": "<typed payload or TDLib-like result>"
  }
}

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_message_commands processes set_chat_message_auto_delete_time.
  • Service layer executes backend/tg_client/dialogs/tdlib/services/message_command_service.py::set_chat_message_auto_delete_time.
  • Raw TDLib wrapper(s): backend/tg_client/dialogs/tdlib/api/messages.py, backend/tg_client/dialogs/tdlib/api/files.py.
  • Final payload is emitted through ctx.send() / ctx.send_response() -> send_ws() -> live event publisher.
  • Sibling commands in this handler group: send_message, delete_messages, forward_message, reply_message, edit_message, pin_message, unpin_message, set_reaction, get_default_message_auto_delete_time, set_default_message_auto_delete_time.