class Telegram::API::MessageEntity

Overview

This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc.

Defined in:

telegram/api/generated/types.cr
telegram/api/overrides/message_entity.cr

Constant Summary

MENTION_TYPES = ["mention", "text_mention", "hashtag", "cashtag", "bot_command", "url", "email", "phone_number", "bold", "italic", "code", "pre", "text_link", "underline", "strikethrough", "spoiler"] of ::String

Constructors

Instance Method Summary

Instance methods inherited from class Telegram::API::Type

==(other) ==, client client

Constructor methods inherited from class Telegram::API::Type

new(pull : JSON::PullParser) new

Constructor Detail

def self.new(type : String, offset : Int32, length : Int32, url : String | Nil = nil, user : User | Nil = nil, language : String | Nil = nil) #

[View source]
def self.new(pull : JSON::PullParser) #

This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc.


[View source]

Instance Method Detail

def bold? #

[View source]
def bot_command? #

[View source]
def cashtag? #

[View source]
def code? #

[View source]
def email? #

[View source]
def hashtag? #

[View source]
def italic? #

[View source]
def language : String | Nil #

Optional. For "pre" only, the programming language of the entity text


[View source]
def language=(language : String | Nil) #

Optional. For "pre" only, the programming language of the entity text


[View source]
def length : Int32 #

Length of the entity in UTF-16 code units


[View source]
def length=(length : Int32) #

Length of the entity in UTF-16 code units


[View source]
def mention? #

[View source]
def offset : Int32 #

Offset in UTF-16 code units to the start of the entity


[View source]
def offset=(offset : Int32) #

Offset in UTF-16 code units to the start of the entity


[View source]
def phone_number? #

[View source]
def pre? #

[View source]
def spoiler? #

[View source]
def strikethrough? #

[View source]
def text_link? #

[View source]
def text_mention? #

[View source]
def type : String #

Type of the entity. Currently, can be "mention" (@username), "hashtag" (#hashtag), "cashtag" ($USD), "bot_command" (/start@jobs_bot), "url" (https://telegram.org), "email" ([email protected]), "phone_number" (+1-212-555-0123), "bold" (bold text), "italic" (italic text), "underline" (underlined text), "strikethrough" (strikethrough text), "spoiler" (spoiler message), "code" (monowidth string), "pre" (monowidth block), "text_link" (for clickable text URLs), "text_mention" (for users without usernames)


[View source]
def type=(type : String) #

Type of the entity. Currently, can be "mention" (@username), "hashtag" (#hashtag), "cashtag" ($USD), "bot_command" (/start@jobs_bot), "url" (https://telegram.org), "email" ([email protected]), "phone_number" (+1-212-555-0123), "bold" (bold text), "italic" (italic text), "underline" (underlined text), "strikethrough" (strikethrough text), "spoiler" (spoiler message), "code" (monowidth string), "pre" (monowidth block), "text_link" (for clickable text URLs), "text_mention" (for users without usernames)


[View source]
def underline? #

[View source]
def url : String | Nil #

Optional. For "text_link" only, url that will be opened after user taps on the text


[View source]
def url=(url : String | Nil) #

Optional. For "text_link" only, url that will be opened after user taps on the text


[View source]
def url? #

[View source]
def user : User | Nil #

Optional. For "text_mention" only, the mentioned user


[View source]
def user=(user : User | Nil) #

Optional. For "text_mention" only, the mentioned user


[View source]