diff --git a/message.go b/message.go index 1d2f5d3..88c836b 100644 --- a/message.go +++ b/message.go @@ -128,6 +128,8 @@ type Message struct { // // Sender would lead to creator of the migration. MigrateFrom int64 `json:"migrate_from_chat_id"` + + Entities []MessageEntity `json:"entities",omitempty` } // Origin returns an origin of message: group chat / personal. diff --git a/types.go b/types.go index 8571837..de677fe 100644 --- a/types.go +++ b/types.go @@ -184,3 +184,27 @@ type Venue struct { Address string `json:"address"` Foursquare_id string `json:"foursquare_id",omitempty` } + +// MessageEntity +// This object represents one special entity in a text message. +// For example, hashtags, usernames, URLs, etc +type MessageEntity struct { + + // type Type of the entity. Can be mention (@username), hashtag, + // bot_command, url, email, bold (bold text), italic (italic text), + // code (monowidth string), pre (monowidth block), text_link (for clickable text URLs), + // text_mention (for users without usernames) + Type string `json:"type"` + + // offset Offset in UTF-16 code units to the start of the entity + Offset int `json:"offset"` + + //length Length of the entity in UTF-16 code units + Length int `json:"length"` + + //url Optional. For “text_link” only, url that will be opened after user taps on the text + Url string `json:"url",omitempty` + + //user Optional. For “text_mention” only, the mentioned user + User User `json:"user",omitempty` +}