Add some inbound types documentation

bot-api-6.1
Ilya Kaznacheev 2020-10-24 13:43:23 +03:00
parent b4d9865c2b
commit 26a3c95421
No known key found for this signature in database
GPG Key ID: 7E2C1D8A4AB37D50
1 changed files with 35 additions and 6 deletions

View File

@ -98,7 +98,13 @@ type GroupChat struct {
// ChatPhoto represents a chat photo. // ChatPhoto represents a chat photo.
type ChatPhoto struct { type ChatPhoto struct {
// SmallFileID is a file identifier of small (160x160) chat photo.
// This file_id can be used only for photo download and
// only for as long as the photo is not changed.
SmallFileID string `json:"small_file_id"` SmallFileID string `json:"small_file_id"`
// BigFileID is a file identifier of big (640x640) chat photo.
// This file_id can be used only for photo download and
// only for as long as the photo is not changed.
BigFileID string `json:"big_file_id"` BigFileID string `json:"big_file_id"`
} }
@ -392,11 +398,34 @@ func (m *Message) CommandArguments() string {
// MessageEntity contains information about data in a Message. // MessageEntity contains information about data in a Message.
type MessageEntity struct { type MessageEntity struct {
// Type of the entity.
// Can be:
// “mention” (@username),
// “hashtag” (#hashtag),
// “cashtag” ($USD),
// “bot_command” (/start@jobs_bot),
// “url” (https://telegram.org),
// “email” (do-not-reply@telegram.org),
// “phone_number” (+1-212-555-0123),
// “bold” (bold text),
// “italic” (italic text),
// “underline” (underlined text),
// “strikethrough” (strikethrough text),
// “code” (monowidth string),
// “pre” (monowidth block),
// “text_link” (for clickable text URLs),
// “text_mention” (for users without usernames)
Type string `json:"type"` Type string `json:"type"`
// Offset in UTF-16 code units to the start of the entity
Offset int `json:"offset"` Offset int `json:"offset"`
// Length
Length int `json:"length"` Length int `json:"length"`
URL string `json:"url"` // optional // URL for “text_link” only, url that will be opened after user taps on the text
User *User `json:"user"` // optional // optional
URL string `json:"url"`
// User for “text_mention” only, the mentioned user
// optional
User *User `json:"user"`
} }
// ParseURL attempts to parse a URL contained within a MessageEntity. // ParseURL attempts to parse a URL contained within a MessageEntity.