15 enum class Type : std::uint8_t {
79 static std::optional<Type>
StringToType(
const std::string& str)
noexcept {
147 nl::json json = nl::json::object();
#define OBJECT_SERIALIZE_FIELD_PTR(json, json_field, field)
#define OBJECT_DESERIALIZE_FIELD_PTR(json, json_field, field, optional)
#define OBJECT_SERIALIZE_FIELD(json, json_field, field)
Available objects: https://core.telegram.org/bots/api#available-types.
#define OBJECT_DESERIALIZE_FIELD_ENUM(json, enum_name, json_field, field, default_value, optional)
#define OBJECT_DESERIALIZE_FIELD(json, json_field, field, default_value, optional)
Deserialize.
#define OBJECT_SERIALIZE_FIELD_ENUM(json, enum_name, json_field, field)
This object represents one special entity in a text message. For example, hashtags,...
static std::optional< std::string > TypeToString(const Type type) noexcept
Converts enum Type to a string.
std::int32_t length
Length of the entity in UTF-16 code units.
nl::json toJson() const
Serializes this object to JSON.
std::string url
Optional. For “text_link” only, URL that will be opened after user taps on the text.
void fromJson(const nl::json &json)
Deserializes this object from JSON.
Type
Enum of possible types of MessageEntity.
@ Url
“url” (https://telegram.org),
@ Bold
“bold” (bold text),
@ Blockquote
“blockquote” (block quotation),
@ Italic
“italic” (italic text),
@ ExpandableBlockquote
“expandable_blockquote” (collapsed-by-default block quotation),
@ TextMention
“text_mention” (for users without usernames),
@ Mention
“mention” (@username),
@ BotCommand
“bot_command” (/start@jobs_bot),
@ PhoneNumber
“phone_number” (+1-212-555-0123),
@ Hashtag
“hashtag” (#hashtag or #hashtag@chatusername),
@ TextLink
“text_link” (for clickable text URLs),
@ Underline
“underline” (underlined text),
@ Cashtag
“cashtag” ($USD or $USD@chatusername),
@ Strikethrough
“strikethrough” (strikethrough text),
@ Code
“code” (monowidth string),
@ Email
“email” (do-not-reply@telegram.org),
@ CustomEmoji
“custom_emoji” (for inline custom emoji stickers)
@ Spoiler
“spoiler” (spoiler message),
@ Pre
“pre” (monowidth block),
Type type
Type of the entity. Type of the entity. Currently, can be: “mention” (@username), “hashtag” (#hashtag...
static std::optional< Type > StringToType(const std::string &str) noexcept
Converts string to an enum Type.
MessageEntity(const nl::json &json)
std::string language
Optional. For “pre” only, the programming language of the entity text.
std::int32_t offset
Offset in UTF-16 code units to the start of the entity.
std::string customEmojiId
Optional. For “custom_emoji” only, unique identifier of the custom emoji. Use Api::getCustomEmojiStic...
Ptr< User > user
Optional. For “text_mention” only, the mentioned user.