Class: MTProto::TL::InviteToChannel

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

Constant Summary collapse

CONSTRUCTOR =
0xc9e33d54
INPUT_USER =
0xf21158c6

Instance Method Summary collapse

Methods included from Binary

#b_u32, #b_u64, #u32_b, #u64_b

Constructor Details

#initialize(channel:, users:) ⇒ InviteToChannel

Returns a new instance of InviteToChannel.



11
12
13
14
# File 'lib/mtproto/tl/objects/invite_to_channel.rb', line 11

def initialize(channel:, users:)
  @channel = channel
  @users = users
end

Instance Method Details

#serializeObject



16
17
18
19
20
21
22
23
24
# File 'lib/mtproto/tl/objects/invite_to_channel.rb', line 16

def serialize
  result = u32_b(CONSTRUCTOR)
  result += serialize_input_channel
  result += u32_b(Constructors::VECTOR) + u32_b(@users.length)
  @users.each do |u|
    result += u32_b(INPUT_USER) + u64_b(u[:id]) + u64_b(u[:access_hash] || 0)
  end
  result
end