Class: MTProto::TL::SetTyping

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

Overview

messages.setTyping — show a chat action (“typing…”, “sending photo…”, …) in the target peer. action is a SendMessageAction; top_msg_id targets a forum topic / thread. Returns Bool.

Constant Summary collapse

CONSTRUCTOR =
0x58943ee2

Instance Method Summary collapse

Methods included from Binary

#b_u32, #b_u64, #u32_b, #u64_b

Constructor Details

#initialize(peer:, action:, top_msg_id: nil) ⇒ SetTyping

Returns a new instance of SetTyping.



13
14
15
16
17
# File 'lib/mtproto/tl/objects/set_typing.rb', line 13

def initialize(peer:, action:, top_msg_id: nil)
  @peer = peer
  @action = action
  @top_msg_id = top_msg_id
end

Instance Method Details

#serializeObject



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/mtproto/tl/objects/set_typing.rb', line 19

def serialize
  flags = 0
  flags |= (1 << 0) if @top_msg_id

  result = u32_b(CONSTRUCTOR)
  result += u32_b(flags)
  result += serialize_input_peer
  result += u32_b(@top_msg_id) if @top_msg_id
  result += @action.serialize
  result
end