Merge pull request #54 from vlad-lukyanov/message-entity

Add MessageEntity support
pull/55/head
Ian Byrd 8 years ago committed by GitHub
commit a663d42cbc

@ -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.

@ -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`
}

Loading…
Cancel
Save