Class: MTProto::TL::ChannelsCreateChannel

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

Overview

channels.createChannel — create a broadcast channel or, with the megagroup flag, a supergroup. Returns Updates carrying the new channel.

Constant Summary collapse

CONSTRUCTOR =
0x91006707

Instance Method Summary collapse

Methods included from Binary

#b_u32, #b_u64, #u32_b, #u64_b

Constructor Details

#initialize(title:, about: '', megagroup: true, broadcast: false) ⇒ ChannelsCreateChannel

Returns a new instance of ChannelsCreateChannel.



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

def initialize(title:, about: '', megagroup: true, broadcast: false)
  @title = title
  @about = about
  @megagroup = megagroup
  @broadcast = broadcast
end

Instance Method Details

#serializeObject



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

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

  result = u32_b(CONSTRUCTOR)
  result += u32_b(flags)
  result += serialize_tl_string(@title)
  result += serialize_tl_string(@about)
  result
end