Class: MTProto::TL::MessagesCreateChat

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

Overview

messages.createChat — create a basic group chat seeded with an initial set of users (a basic chat cannot be created empty). Returns messages.InvitedUsers wrapping the creation Updates.

Constant Summary collapse

CONSTRUCTOR =
0x92ceddd4
INPUT_USER =
0xf21158c6

Instance Method Summary collapse

Methods included from Binary

#b_u32, #b_u64, #u32_b, #u64_b

Constructor Details

#initialize(users:, title:) ⇒ MessagesCreateChat

Returns a new instance of MessagesCreateChat.



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

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

Instance Method Details

#serializeObject



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

def serialize
  result = u32_b(CONSTRUCTOR)
  result += u32_b(0) # flags: no ttl_period
  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 += serialize_tl_string(@title)
  result
end