Class: MTProto::TL::SendMessage
- Inherits:
-
Object
- Object
- MTProto::TL::SendMessage
- Includes:
- Binary
- Defined in:
- lib/mtproto/tl/objects/send_message.rb
Constant Summary collapse
- INPUT_REPLY_TO_MESSAGE =
0x869fbe10
Instance Method Summary collapse
-
#initialize(peer:, message:, random_id: nil, reply_to: nil) ⇒ SendMessage
constructor
A new instance of SendMessage.
- #serialize ⇒ Object
Methods included from Binary
#b_u32, #b_u64, #u32_b, #u64_b
Constructor Details
#initialize(peer:, message:, random_id: nil, reply_to: nil) ⇒ SendMessage
Returns a new instance of SendMessage.
12 13 14 15 16 17 |
# File 'lib/mtproto/tl/objects/send_message.rb', line 12 def initialize(peer:, message:, random_id: nil, reply_to: nil) @peer = peer @message = @random_id = random_id || SecureRandom.random_number(2**63) @reply_to = reply_to end |
Instance Method Details
#serialize ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/mtproto/tl/objects/send_message.rb', line 19 def serialize flags = 0 flags |= (1 << 0) if @reply_to result = u32_b(Constructors::MESSAGES_SEND_MESSAGE) result += u32_b(flags) result += serialize_input_peer result += serialize_reply_to if @reply_to result += serialize_tl_string(@message) result += u64_b(@random_id) result end |