Class: MTProto::TL::UpdateShortMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/mtproto/tl/objects/update_short_message.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(flags:, id:, user_id:, text:, pts:, pts_count:, date:) ⇒ UpdateShortMessage

Returns a new instance of UpdateShortMessage.



8
9
10
11
12
13
14
15
16
# File 'lib/mtproto/tl/objects/update_short_message.rb', line 8

def initialize(flags:, id:, user_id:, text:, pts:, pts_count:, date:)
  @flags = flags
  @id = id
  @user_id = user_id
  @text = text
  @pts = pts
  @pts_count = pts_count
  @date = date
end

Instance Attribute Details

#dateObject (readonly)

Returns the value of attribute date.



6
7
8
# File 'lib/mtproto/tl/objects/update_short_message.rb', line 6

def date
  @date
end

#flagsObject (readonly)

Returns the value of attribute flags.



6
7
8
# File 'lib/mtproto/tl/objects/update_short_message.rb', line 6

def flags
  @flags
end

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/mtproto/tl/objects/update_short_message.rb', line 6

def id
  @id
end

#ptsObject (readonly)

Returns the value of attribute pts.



6
7
8
# File 'lib/mtproto/tl/objects/update_short_message.rb', line 6

def pts
  @pts
end

#pts_countObject (readonly)

Returns the value of attribute pts_count.



6
7
8
# File 'lib/mtproto/tl/objects/update_short_message.rb', line 6

def pts_count
  @pts_count
end

#textObject (readonly)

Returns the value of attribute text.



6
7
8
# File 'lib/mtproto/tl/objects/update_short_message.rb', line 6

def text
  @text
end

#user_idObject (readonly)

Returns the value of attribute user_id.



6
7
8
# File 'lib/mtproto/tl/objects/update_short_message.rb', line 6

def user_id
  @user_id
end

Class Method Details

.deserialize(bytes) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/mtproto/tl/objects/update_short_message.rb', line 26

def self.deserialize(bytes)
  offset = 4 # skip constructor
  flags = bytes[offset, 4].unpack1('L<')
  offset += 4
  id = bytes[offset, 4].unpack1('l<')
  offset += 4
  user_id = bytes[offset, 8].unpack1('q<')
  offset += 8
  text, offset = read_tl_string(bytes, offset)
  pts = bytes[offset, 4].unpack1('l<')
  offset += 4
  pts_count = bytes[offset, 4].unpack1('l<')
  offset += 4
  date = bytes[offset, 4].unpack1('l<')

  new(flags: flags, id: id, user_id: user_id, text: text,
    pts: pts, pts_count: pts_count, date: date)
end

Instance Method Details

#mentioned?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/mtproto/tl/objects/update_short_message.rb', line 22

def mentioned?
  flags & (1 << 4) != 0
end

#out?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/mtproto/tl/objects/update_short_message.rb', line 18

def out?
  flags & (1 << 1) != 0
end