Class: MTProto::TL::MessageEntity

Inherits:
Struct
  • Object
show all
Defined in:
lib/mtproto/tl/message_entity.rb

Overview

A single MessageEntity — one formatting span over a message's text. offset and length are in UTF-16 code units (Telegram's unit, what the wire carries), NOT bytes or codepoints. type is a symbol; any type-specific payload rides in the matching field:

:text_url     -> url
:pre          -> language
:mention_name -> user_id (+ access_hash, needed to SEND a text-mention)
:custom_emoji -> document_id
:blockquote   -> collapsed (expandable quote)

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#access_hashObject

Returns the value of attribute access_hash

Returns:

  • (Object)

    the current value of access_hash



16
17
18
# File 'lib/mtproto/tl/message_entity.rb', line 16

def access_hash
  @access_hash
end

#collapsedObject

Returns the value of attribute collapsed

Returns:

  • (Object)

    the current value of collapsed



16
17
18
# File 'lib/mtproto/tl/message_entity.rb', line 16

def collapsed
  @collapsed
end

#document_idObject

Returns the value of attribute document_id

Returns:

  • (Object)

    the current value of document_id



16
17
18
# File 'lib/mtproto/tl/message_entity.rb', line 16

def document_id
  @document_id
end

#languageObject

Returns the value of attribute language

Returns:

  • (Object)

    the current value of language



16
17
18
# File 'lib/mtproto/tl/message_entity.rb', line 16

def language
  @language
end

#lengthObject

Returns the value of attribute length

Returns:

  • (Object)

    the current value of length



16
17
18
# File 'lib/mtproto/tl/message_entity.rb', line 16

def length
  @length
end

#offsetObject

Returns the value of attribute offset

Returns:

  • (Object)

    the current value of offset



16
17
18
# File 'lib/mtproto/tl/message_entity.rb', line 16

def offset
  @offset
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



16
17
18
# File 'lib/mtproto/tl/message_entity.rb', line 16

def type
  @type
end

#urlObject

Returns the value of attribute url

Returns:

  • (Object)

    the current value of url



16
17
18
# File 'lib/mtproto/tl/message_entity.rb', line 16

def url
  @url
end

#user_idObject

Returns the value of attribute user_id

Returns:

  • (Object)

    the current value of user_id



16
17
18
# File 'lib/mtproto/tl/message_entity.rb', line 16

def user_id
  @user_id
end

Instance Method Details

#to_hObject



21
22
23
# File 'lib/mtproto/tl/message_entity.rb', line 21

def to_h
  super.compact
end