|
tgbotxx 1.1.9.2
Telegram Bot C++ Library
|
This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc. https://core.telegram.org/bots/api#messageentity. More...
#include <MessageEntity.hpp>
Public Types | |
| enum class | Type : std::uint8_t { Mention = 0 , Hashtag , Cashtag , BotCommand , Url , Email , PhoneNumber , Bold , Italic , Underline , Strikethrough , Spoiler , Blockquote , ExpandableBlockquote , Code , Pre , TextLink , TextMention , CustomEmoji } |
| Enum of possible types of MessageEntity. More... | |
Public Member Functions | |
| MessageEntity ()=default | |
| MessageEntity (const nl::json &json) | |
| nl::json | toJson () const |
| Serializes this object to JSON. | |
| void | fromJson (const nl::json &json) |
| Deserializes this object from JSON. | |
Static Public Member Functions | |
| static std::optional< std::string > | TypeToString (const Type type) noexcept |
| Converts enum Type to a string. | |
| static std::optional< Type > | StringToType (const std::string &str) noexcept |
| Converts string to an enum Type. | |
Public Attributes | |
| Type | type {} |
| Type of the entity. Type of the entity. Currently, can be: “mention” (@username), “hashtag” (#hashtag or #hashtag@chatusername), “cashtag” ($USD or $USD@chatusername), “bot_command” (/start@jobs_bot), “url” (https://telegram.org), “email” (do-no.nosp@m.t-re.nosp@m.ply@t.nosp@m.eleg.nosp@m.ram.o.nosp@m.rg), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “blockquote” (block quotation), “expandable_blockquote” (collapsed-by-default block quotation), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames), “custom_emoji” (for inline custom emoji stickers) | |
| std::int32_t | offset {} |
| Offset in UTF-16 code units to the start of the entity. | |
| std::int32_t | length {} |
| Length of the entity in UTF-16 code units. | |
| std::string | url |
| Optional. For “text_link” only, URL that will be opened after user taps on the text. | |
| Ptr< User > | user |
| Optional. For “text_mention” only, the mentioned user. | |
| std::string | language |
| Optional. For “pre” only, the programming language of the entity text. | |
| std::string | customEmojiId |
| Optional. For “custom_emoji” only, unique identifier of the custom emoji. Use Api::getCustomEmojiStickers to get full information about the sticker. | |
This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc. https://core.telegram.org/bots/api#messageentity.
Definition at line 8 of file MessageEntity.hpp.
|
strong |
Enum of possible types of MessageEntity.
| Enumerator | |
|---|---|
| Mention | “mention” (@username), |
| Hashtag | “hashtag” (#hashtag or #hashtag@chatusername), |
| Cashtag | “cashtag” ($USD or $USD@chatusername), |
| BotCommand | “bot_command” (/start@jobs_bot), |
| Url | “url” (https://telegram.org), |
“email” (do-no.nosp@m.t-re.nosp@m.ply@t.nosp@m.eleg.nosp@m.ram.o.nosp@m.rg), | |
| PhoneNumber | “phone_number” (+1-212-555-0123), |
| Bold | “bold” (bold text), |
| Italic | “italic” (italic text), |
| Underline | “underline” (underlined text), |
| Strikethrough | “strikethrough” (strikethrough text), |
| Spoiler | “spoiler” (spoiler message), |
| Blockquote | “blockquote” (block quotation), |
| ExpandableBlockquote | “expandable_blockquote” (collapsed-by-default block quotation), |
| Code | “code” (monowidth string), |
| Pre | “pre” (monowidth block), |
| TextLink | “text_link” (for clickable text URLs), |
| TextMention | “text_mention” (for users without usernames), |
| CustomEmoji | “custom_emoji” (for inline custom emoji stickers) |
Definition at line 15 of file MessageEntity.hpp.
|
default |
|
inlineexplicit |
Definition at line 10 of file MessageEntity.hpp.
|
inline |
Deserializes this object from JSON.
Definition at line 159 of file MessageEntity.hpp.
|
inlinestaticnoexcept |
Converts string to an enum Type.
Definition at line 79 of file MessageEntity.hpp.
|
inline |
Serializes this object to JSON.
Definition at line 146 of file MessageEntity.hpp.
|
inlinestaticnoexcept |
Converts enum Type to a string.
Definition at line 56 of file MessageEntity.hpp.
| std::string tgbotxx::MessageEntity::customEmojiId |
Optional. For “custom_emoji” only, unique identifier of the custom emoji. Use Api::getCustomEmojiStickers to get full information about the sticker.
Definition at line 142 of file MessageEntity.hpp.
| std::string tgbotxx::MessageEntity::language |
Optional. For “pre” only, the programming language of the entity text.
Definition at line 138 of file MessageEntity.hpp.
| std::int32_t tgbotxx::MessageEntity::length {} |
Length of the entity in UTF-16 code units.
Definition at line 129 of file MessageEntity.hpp.
| std::int32_t tgbotxx::MessageEntity::offset {} |
Offset in UTF-16 code units to the start of the entity.
Definition at line 126 of file MessageEntity.hpp.
| Type tgbotxx::MessageEntity::type {} |
Type of the entity. Type of the entity. Currently, can be: “mention” (@username), “hashtag” (#hashtag or #hashtag@chatusername), “cashtag” ($USD or $USD@chatusername), “bot_command” (/start@jobs_bot), “url” (https://telegram.org), “email” (do-no.nosp@m.t-re.nosp@m.ply@t.nosp@m.eleg.nosp@m.ram.o.nosp@m.rg), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “blockquote” (block quotation), “expandable_blockquote” (collapsed-by-default block quotation), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames), “custom_emoji” (for inline custom emoji stickers)
Definition at line 123 of file MessageEntity.hpp.
| std::string tgbotxx::MessageEntity::url |
Optional. For “text_link” only, URL that will be opened after user taps on the text.
Definition at line 132 of file MessageEntity.hpp.
Optional. For “text_mention” only, the mentioned user.
Definition at line 135 of file MessageEntity.hpp.