Class: MTProto::TL::SendMessageTextDraftAction

Inherits:
Object
  • Object
show all
Includes:
Binary
Defined in:
lib/mtproto/tl/objects/send_message_text_draft_action.rb

Overview

A SendMessageAction carrying a live draft: the partially generated answer the recipient's client shows at the bottom of the chat while it is still being written. Unlike the other actions it is not a bare constructor id, so it does not fit TL::SendMessageAction's id-plus-progress table.

random_id identifies the draft: the same value updates the draft already on screen, a different one puts a second draft beside it.

Constant Summary collapse

CONSTRUCTOR =
0x376d975c
TEXT_WITH_ENTITIES =
0x751f3146

Instance Method Summary collapse

Methods included from Binary

#b_u32, #b_u64, #u32_b, #u64_b

Constructor Details

#initialize(random_id:, text:, entities: []) ⇒ SendMessageTextDraftAction

Returns a new instance of SendMessageTextDraftAction.



20
21
22
23
24
# File 'lib/mtproto/tl/objects/send_message_text_draft_action.rb', line 20

def initialize(random_id:, text:, entities: [])
  @random_id = random_id
  @text = text
  @entities = entities
end

Instance Method Details

#serializeObject

textWithEntities#751f3146 text:string entities:Vector — the entity vector is not optional, so an empty list still goes on the wire.



28
29
30
31
32
# File 'lib/mtproto/tl/objects/send_message_text_draft_action.rb', line 28

def serialize
  u32_b(CONSTRUCTOR) + u64_b(@random_id) +
    u32_b(TEXT_WITH_ENTITIES) + serialize_tl_string(@text) +
    MessageEntities.serialize(@entities)
end