Skip to content

Commit 26a3c95

Browse files
Add some inbound types documentation
1 parent b4d9865 commit 26a3c95

File tree

1 file changed

+35
-6
lines changed

1 file changed

+35
-6
lines changed

types.go

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,14 @@ type GroupChat struct {
9898

9999
// ChatPhoto represents a chat photo.
100100
type ChatPhoto struct {
101+
// SmallFileID is a file identifier of small (160x160) chat photo.
102+
// This file_id can be used only for photo download and
103+
// only for as long as the photo is not changed.
101104
SmallFileID string `json:"small_file_id"`
102-
BigFileID string `json:"big_file_id"`
105+
// BigFileID is a file identifier of big (640x640) chat photo.
106+
// This file_id can be used only for photo download and
107+
// only for as long as the photo is not changed.
108+
BigFileID string `json:"big_file_id"`
103109
}
104110

105111
// Chat contains information about the place a message was sent.
@@ -392,11 +398,34 @@ func (m *Message) CommandArguments() string {
392398

393399
// MessageEntity contains information about data in a Message.
394400
type MessageEntity struct {
395-
Type string `json:"type"`
396-
Offset int `json:"offset"`
397-
Length int `json:"length"`
398-
URL string `json:"url"` // optional
399-
User *User `json:"user"` // optional
401+
// Type of the entity.
402+
// Can be:
403+
// “mention” (@username),
404+
// “hashtag” (#hashtag),
405+
// “cashtag” ($USD),
406+
// “bot_command” (/start@jobs_bot),
407+
// “url” (https://telegram.org),
408+
// “email” ([email protected]),
409+
// “phone_number” (+1-212-555-0123),
410+
// “bold” (bold text),
411+
// “italic” (italic text),
412+
// “underline” (underlined text),
413+
// “strikethrough” (strikethrough text),
414+
// “code” (monowidth string),
415+
// “pre” (monowidth block),
416+
// “text_link” (for clickable text URLs),
417+
// “text_mention” (for users without usernames)
418+
Type string `json:"type"`
419+
// Offset in UTF-16 code units to the start of the entity
420+
Offset int `json:"offset"`
421+
// Length
422+
Length int `json:"length"`
423+
// URL for “text_link” only, url that will be opened after user taps on the text
424+
// optional
425+
URL string `json:"url"`
426+
// User for “text_mention” only, the mentioned user
427+
// optional
428+
User *User `json:"user"`
400429
}
401430

402431
// ParseURL attempts to parse a URL contained within a MessageEntity.

0 commit comments

Comments
 (0)