FILE / ScuroNeko/Laniakea
tgapi/attachments_types.go
Исходный файл и его история в репозитории.
754 lines
36 KiB
Go
754 lines
36 KiB
Go
package tgapi
|
|
|
|
// Animation represents an animation file (GIF or H.264/MPEG-4 AVC without sound).
|
|
// Since: Bot API 4.0
|
|
type Animation struct {
|
|
// FileID Identifier for this file, which can be used to download or reuse the file
|
|
FileID string `json:"file_id"`
|
|
// FileUniqueID Unique identifier for this file, which is supposed to be the same over time and for
|
|
// different bots. Can't be used to download or reuse the file.
|
|
FileUniqueID string `json:"file_unique_id"`
|
|
// Width Video width as defined by the sender
|
|
Width int `json:"width"`
|
|
// Height Video height as defined by the sender
|
|
Height int `json:"height"`
|
|
// Duration Duration of the video in seconds as defined by the sender
|
|
Duration int `json:"duration"`
|
|
|
|
// Thumbnail Optional. Animation thumbnail as defined by the sender
|
|
Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
|
|
// FileName Optional. Original animation filename as defined by the sender
|
|
FileName string `json:"file_name"`
|
|
// MimeType Optional. MIME type of the file as defined by the sender
|
|
MimeType string `json:"mime_type"`
|
|
// FileSize Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have
|
|
// difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit
|
|
// integer or double-precision float type are safe for storing this value.
|
|
FileSize int `json:"file_size"`
|
|
}
|
|
|
|
// Audio represents an audio file to be treated as music by the Telegram clients.
|
|
// Since: Bot API 1.2
|
|
// See https://core.telegram.org/bots/api#audio
|
|
type Audio struct {
|
|
// FileID Identifier for this file, which can be used to download or reuse the file
|
|
FileID string `json:"file_id"`
|
|
// FileUniqueID Unique identifier for this file, which is supposed to be the same over time and for
|
|
// different bots. Can't be used to download or reuse the file.
|
|
FileUniqueID string `json:"file_unique_id"`
|
|
// Duration Duration of the audio in seconds as defined by the sender
|
|
Duration int `json:"duration"`
|
|
|
|
// Performer Optional. Performer of the audio as defined by the sender or by audio tags
|
|
Performer string `json:"performer,omitempty"`
|
|
// Title Optional. Title of the audio as defined by the sender or by audio tags
|
|
Title string `json:"title,omitempty"`
|
|
// FileName Optional. Original filename as defined by the sender
|
|
FileName string `json:"file_name,omitempty"` // Since: Bot API 5.0
|
|
// MimeType Optional. MIME type of the file as defined by the sender
|
|
MimeType string `json:"mime_type,omitempty"`
|
|
// FileSize Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have
|
|
// difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit
|
|
// integer or double-precision float type are safe for storing this value.
|
|
FileSize int64 `json:"file_size,omitempty"`
|
|
// Thumbnail Optional. Thumbnail of the album cover to which the music file belongs
|
|
Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
|
|
}
|
|
|
|
// Document represents a general file (as opposed to photos, voice messages and audio files).
|
|
// Since: Bot API 1.0
|
|
type Document struct {
|
|
// FileID Identifier for this file, which can be used to download or reuse the file
|
|
FileID string `json:"file_id"`
|
|
// FileUniqueID Unique identifier for this file, which is supposed to be the same over time and for
|
|
// different bots. Can't be used to download or reuse the file.
|
|
FileUniqueID string `json:"file_unique_id"`
|
|
// Thumbnail Optional. Document thumbnail as defined by the sender
|
|
Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
|
|
// FileName Optional. Original filename as defined by the sender
|
|
FileName string `json:"file_name"`
|
|
// MimeType Optional. MIME type of the file as defined by the sender
|
|
MimeType string `json:"mime_type"`
|
|
// FileSize Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have
|
|
// difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit
|
|
// integer or double-precision float type are safe for storing this value.
|
|
FileSize int `json:"file_size,omitempty"`
|
|
}
|
|
|
|
// Story represents a story.
|
|
// Since: Bot API 6.8
|
|
type Story struct {
|
|
// Chat Chat that posted the story
|
|
Chat Chat `json:"chat"`
|
|
// ID Unique identifier for the story in the chat
|
|
ID int `json:"id"`
|
|
}
|
|
|
|
// Video represents a video file.
|
|
// Since: Bot API 1.0
|
|
type Video struct {
|
|
// FileID Identifier for this file, which can be used to download or reuse the file
|
|
FileID string `json:"file_id"`
|
|
// FileUniqueID Unique identifier for this file, which is supposed to be the same over time and for
|
|
// different bots. Can't be used to download or reuse the file.
|
|
FileUniqueID string `json:"file_unique_id"`
|
|
// Width Video width as defined by the sender
|
|
Width int `json:"width"`
|
|
// Height Video height as defined by the sender
|
|
Height int `json:"height"`
|
|
// Duration Duration of the video in seconds as defined by the sender
|
|
Duration int `json:"duration"`
|
|
|
|
// Thumbnail Optional. Video thumbnail
|
|
Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
|
|
// Cover Optional. Available sizes of the cover of the video in the message
|
|
Cover []PhotoSize `json:"cover,omitempty"` // Since: Bot API 8.3
|
|
// StartTimestamp Optional. Timestamp in seconds from which the video will play in the message
|
|
StartTimestamp int64 `json:"start_timestamp"` // Since: Bot API 8.3
|
|
// Qualities Optional. List of available qualities of the video
|
|
Qualities []VideoQuality `json:"qualities,omitempty"` // Since: Bot API 9.4
|
|
// FileName Optional. Original filename as defined by the sender
|
|
FileName string `json:"file_name,omitempty"`
|
|
// MimeType Optional. MIME type of the file as defined by the sender
|
|
MimeType string `json:"mime_type,omitempty"`
|
|
// FileSize Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have
|
|
// difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit
|
|
// integer or double-precision float type are safe for storing this value.
|
|
FileSize int64 `json:"file_size,omitempty"`
|
|
}
|
|
|
|
// VideoQuality describes an alternative quality for a video.
|
|
// Since: Bot API 9.4
|
|
// See https://core.telegram.org/bots/api#videoquality
|
|
type VideoQuality struct {
|
|
// FileID Identifier for this file, which can be used to download or reuse the file
|
|
FileID string `json:"file_id"`
|
|
// FileUniqueID Unique identifier for this file, which is supposed to be the same over time and for
|
|
// different bots. Can't be used to download or reuse the file.
|
|
FileUniqueID string `json:"file_unique_id"`
|
|
// Width Video width
|
|
Width int `json:"width"`
|
|
// Height Video height
|
|
Height int `json:"height"`
|
|
// Codec Codec that was used to encode the video, for example, “h264”, “h265”, or “av01”
|
|
Codec string `json:"codec"`
|
|
// FileSize Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have
|
|
// difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit
|
|
// integer or double-precision float type are safe for storing this value.
|
|
FileSize int64 `json:"file_size,omitempty"`
|
|
}
|
|
|
|
// VideoNote represents a video message.
|
|
// Since: Bot API 3.0
|
|
type VideoNote struct {
|
|
// FileID Identifier for this file, which can be used to download or reuse the file
|
|
FileID string `json:"file_id"`
|
|
// FileUniqueID Unique identifier for this file, which is supposed to be the same over time and for
|
|
// different bots. Can't be used to download or reuse the file.
|
|
FileUniqueID string `json:"file_unique_id"`
|
|
// Length Video width and height (diameter of the video message) as defined by the sender
|
|
Length int `json:"length"`
|
|
// Duration Duration of the video in seconds as defined by the sender
|
|
Duration int `json:"duration"`
|
|
// Thumbnail Optional. Video thumbnail
|
|
Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
|
|
// FileSize Optional. File size in bytes
|
|
FileSize int64 `json:"file_size,omitempty"`
|
|
}
|
|
|
|
// Voice represents a voice note.
|
|
// Since: Bot API 1.2
|
|
type Voice struct {
|
|
// FileID Identifier for this file, which can be used to download or reuse the file
|
|
FileID string `json:"file_id"`
|
|
// FileUniqueID Unique identifier for this file, which is supposed to be the same over time and for
|
|
// different bots. Can't be used to download or reuse the file.
|
|
FileUniqueID string `json:"file_unique_id"`
|
|
// Duration Duration of the audio in seconds as defined by the sender
|
|
Duration int `json:"duration"`
|
|
// MimeType Optional. MIME type of the file as defined by the sender
|
|
MimeType string `json:"mime_type,omitempty"`
|
|
// FileSize Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have
|
|
// difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit
|
|
// integer or double-precision float type are safe for storing this value.
|
|
FileSize int `json:"file_size,omitempty"`
|
|
}
|
|
|
|
// PaidMediaInfo describes paid media.
|
|
// Since: Bot API 7.6
|
|
type PaidMediaInfo struct {
|
|
// StarCount The number of Telegram Stars that must be paid to buy access to the media
|
|
StarCount int `json:"star_count"`
|
|
// PaidMedia Information about the paid media
|
|
PaidMedia []PaidMedia `json:"paid_media"`
|
|
}
|
|
|
|
// PaidMediaType represents the type of paid media.
|
|
// Since: Bot API 7.6
|
|
type PaidMediaType string
|
|
|
|
const (
|
|
// PaidMediaPreviewType identifies a paid-media preview.
|
|
PaidMediaPreviewType PaidMediaType = "preview"
|
|
// PaidMediaPhotoType identifies a paid photo.
|
|
PaidMediaPhotoType PaidMediaType = "photo"
|
|
// PaidMediaVideoType identifies a paid video.
|
|
PaidMediaVideoType PaidMediaType = "video"
|
|
// PaidMediaLivePhotoType identifies a paid live photo.
|
|
PaidMediaLivePhotoType PaidMediaType = "live_photo" // Since: Bot API 10.0
|
|
)
|
|
|
|
// PaidMedia describes paid media content.
|
|
// Since: Bot API 7.6
|
|
type PaidMedia struct {
|
|
// Type identifies the preview, photo, video, or live-photo variant.
|
|
Type PaidMediaType `json:"type,omitempty"`
|
|
|
|
// Width Optional. Media width as defined by the sender
|
|
Width int `json:"width,omitempty"`
|
|
// Height Optional. Media height as defined by the sender
|
|
Height int `json:"height,omitempty"`
|
|
// Duration Optional. Duration of the media in seconds as defined by the sender
|
|
Duration int `json:"duration,omitempty"`
|
|
|
|
// Photo The photo
|
|
Photo []PhotoSize `json:"photo,omitempty"`
|
|
|
|
// Video The video
|
|
Video *Video `json:"video,omitempty"`
|
|
// LivePhoto The photo
|
|
LivePhoto *LivePhoto `json:"live_photo,omitempty"` // Since: Bot API 10.0
|
|
}
|
|
|
|
// Contact represents a phone contact.
|
|
// Since: Bot API 1.0
|
|
type Contact struct {
|
|
// PhoneNumber Contact's phone number
|
|
PhoneNumber string `json:"phone_number"`
|
|
// FirstName Contact's first name
|
|
FirstName string `json:"first_name"`
|
|
// LastName Optional. Contact's last name
|
|
LastName string `json:"last_name,omitempty"`
|
|
// UserID Optional. Contact's user identifier in Telegram. This number may have more than 32 significant
|
|
// bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at
|
|
// most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this
|
|
// identifier.
|
|
UserID int64 `json:"user_id,omitempty"`
|
|
// Vcard Optional. Additional data about the contact in the form of a vCard
|
|
Vcard string `json:"vcard,omitempty"`
|
|
}
|
|
|
|
// Dice represents an animated emoji with a random value.
|
|
// Since: Bot API 4.7
|
|
type Dice struct {
|
|
// Emoji Emoji on which the dice throw animation is based
|
|
Emoji string `json:"emoji"`
|
|
// Value Value of the dice, 1-6 for “”, “” and “” base emoji, 1-5 for “” and “” base
|
|
// emoji, 1-64 for “” base emoji
|
|
Value int `json:"value"`
|
|
}
|
|
|
|
// PollOption contains information about one answer option in a poll.
|
|
// Since: Bot API 4.2
|
|
// See https://core.telegram.org/bots/api#polloption
|
|
type PollOption struct {
|
|
// PersistentID Unique identifier of the option, persistent on option addition and deletion
|
|
PersistentID string `json:"persistent_id"` // Since: Bot API 9.6
|
|
// Text Option text, 1-100 characters
|
|
Text string `json:"text"`
|
|
// TextEntities Optional. Special entities that appear in the option text. Currently, only custom emoji
|
|
// entities are allowed in poll option texts
|
|
TextEntities []MessageEntity `json:"text_entities"`
|
|
// Media Optional. Media added to the poll option
|
|
Media *PollMedia `json:"media,omitempty"` // Since: Bot API 10.0
|
|
// VoterCount Number of users who voted for this option; may be 0 if unknown
|
|
VoterCount int `json:"voter_count"`
|
|
|
|
// AddedByUser Optional. User who added the option; omitted if the option wasn't added by a user after poll
|
|
// creation
|
|
AddedByUser *User `json:"added_by_user,omitempty"` // Since: Bot API 9.6
|
|
// AddedByChat Optional. Chat that added the option; omitted if the option wasn't added by a chat after poll
|
|
// creation
|
|
AddedByChat *Chat `json:"added_by_chat,omitempty"` // Since: Bot API 9.6
|
|
// AdditionDate Optional. Point in time (Unix timestamp) when the option was added; omitted if the option
|
|
// existed in the original poll
|
|
AdditionDate int `json:"addition_date,omitempty"` // Since: Bot API 9.6
|
|
}
|
|
|
|
// InputPollOptionMedia describes the media to attach to a poll option.
|
|
// For type "link" set URL instead of Media.
|
|
// Since: Bot API 10.0
|
|
// See https://core.telegram.org/bots/api#inputpolloptionmedia
|
|
type InputPollOptionMedia struct {
|
|
// Type identifies the poll-option media variant.
|
|
Type string `json:"type"`
|
|
// Media is the file_id or URL of the option media for non-link variants.
|
|
Media string `json:"media,omitempty"`
|
|
// URL contains the HTTP URL.
|
|
URL string `json:"url,omitempty"` // Since: Bot API 10.1; for type "link"
|
|
}
|
|
|
|
// InputPollOption contains information about one answer option in a poll to be sent.
|
|
// Since: Bot API 7.3
|
|
// See https://core.telegram.org/bots/api#inputpolloption
|
|
type InputPollOption struct {
|
|
// Text Option text, 1-100 characters
|
|
Text string `json:"text"`
|
|
// TextParseMode Optional. Mode for parsing entities in the text. See formatting options for more details.
|
|
// Currently, only custom emoji entities are allowed.
|
|
TextParseMode ParseMode `json:"text_parse_mode,omitempty"`
|
|
// TextEntities Optional. A JSON-serialized list of special entities that appear in the poll option text. It
|
|
// can be specified instead of text_parse_mode.
|
|
TextEntities []MessageEntity `json:"text_entities,omitempty"`
|
|
// Media Optional. Media added to the poll option
|
|
Media *InputPollOptionMedia `json:"media,omitempty"` // Since: Bot API 10.0
|
|
}
|
|
|
|
// InputPollMedia describes the media to attach to a poll or its explanation.
|
|
// Since: Bot API 10.0
|
|
// See https://core.telegram.org/bots/api#inputpollmedia
|
|
type InputPollMedia struct {
|
|
// Type identifies the poll-media variant.
|
|
Type string `json:"type"`
|
|
// Media is the file_id or URL of the poll media.
|
|
Media string `json:"media"`
|
|
}
|
|
|
|
// PollOptionAdded describes a service message about a poll option being added.
|
|
// Since: Bot API 9.6
|
|
type PollOptionAdded struct {
|
|
// PollMessage Optional. Message containing the poll to which the option was added, if known. Note that the
|
|
// Message object in this field will not contain the reply_to_message field even if it itself is a reply.
|
|
PollMessage *InaccessibleMessage `json:"poll_message,omitempty"`
|
|
// OptionPersistentID Unique identifier of the added option
|
|
OptionPersistentID string `json:"option_persistent_id"`
|
|
// OptionText Option text
|
|
OptionText string `json:"option_text"`
|
|
// OptionTextEntities Optional. Special entities that appear in the option_text
|
|
OptionTextEntities []MessageEntity `json:"option_text_entities,omitempty"`
|
|
}
|
|
|
|
// PollOptionDeleted describes a service message about a poll option being deleted.
|
|
// Since: Bot API 9.6
|
|
type PollOptionDeleted struct {
|
|
// PollMessage Optional. Message containing the poll from which the option was deleted, if known. Note that
|
|
// the Message object in this field will not contain the reply_to_message field even if it itself is a
|
|
// reply.
|
|
PollMessage *InaccessibleMessage `json:"poll_message,omitempty"`
|
|
// OptionPersistentID Unique identifier of the deleted option
|
|
OptionPersistentID string `json:"option_persistent_id"`
|
|
// OptionText Option text
|
|
OptionText string `json:"option_text"`
|
|
// OptionTextEntities Optional. Special entities that appear in the option_text
|
|
OptionTextEntities []MessageEntity `json:"option_text_entities,omitempty"`
|
|
}
|
|
|
|
// PollType represents the type of a poll.
|
|
type PollType string
|
|
|
|
const (
|
|
// PollTypeRegular identifies a regular poll.
|
|
PollTypeRegular PollType = "regular"
|
|
// PollTypeQuiz identifies a quiz poll.
|
|
PollTypeQuiz PollType = "quiz"
|
|
)
|
|
|
|
// PollAnswer represents an answer submitted by a poll voter.
|
|
//
|
|
// User and VoterChat remain value fields for v1 compatibility. Their pointer
|
|
// representation is subject to change in v2; use VoterUser and VoterChatInfo
|
|
// when presence matters.
|
|
// Since: Bot API 4.6
|
|
// See https://core.telegram.org/bots/api#pollanswer
|
|
type PollAnswer struct {
|
|
// PollID identifies the poll.
|
|
PollID string `json:"poll_id"`
|
|
// VoterChat is the chat that changed the answer, when the voter is anonymous.
|
|
VoterChat Chat `json:"voter_chat,omitempty"` // Since: Bot API 6.8
|
|
// User is the user that changed the answer, when the voter is not anonymous.
|
|
User User `json:"user,omitempty"`
|
|
// OptionIDs contains the chosen option indices and is empty for a retracted vote.
|
|
OptionIDs []int `json:"option_ids"`
|
|
// OptionPersistentIDs contains the persistent identifiers of the chosen options.
|
|
OptionPersistentIDs []string `json:"option_persistent_ids"` // Since: Bot API 9.6
|
|
}
|
|
|
|
// VoterUser returns the non-anonymous voter when it is present.
|
|
//
|
|
// Since: Bot API 4.6
|
|
func (a PollAnswer) VoterUser() (*User, bool) {
|
|
if a.User.ID == 0 {
|
|
return nil, false
|
|
}
|
|
return &a.User, true
|
|
}
|
|
|
|
// VoterChatInfo returns the anonymous voter chat when it is present.
|
|
//
|
|
// Since: Bot API 6.8
|
|
func (a PollAnswer) VoterChatInfo() (*Chat, bool) {
|
|
if a.VoterChat.ID == 0 {
|
|
return nil, false
|
|
}
|
|
return &a.VoterChat, true
|
|
}
|
|
|
|
// Poll contains information about a poll.
|
|
// Since: Bot API 4.2
|
|
// See https://core.telegram.org/bots/api#poll
|
|
type Poll struct {
|
|
// ID Unique poll identifier
|
|
ID string `json:"id"`
|
|
// Question Poll question, 1-300 characters
|
|
Question string `json:"question"`
|
|
// QuestionEntities Optional. Special entities that appear in the question. Currently, only custom emoji
|
|
// entities are allowed in poll questions
|
|
QuestionEntities []MessageEntity `json:"question_entities"` // Since: Bot API 7.3
|
|
// Options List of poll options
|
|
Options []PollOption `json:"options"`
|
|
// TotalVoterCount Total number of users that voted in the poll
|
|
TotalVoterCount int `json:"total_voter_count"`
|
|
// IsClosed True, if the poll is closed
|
|
IsClosed bool `json:"is_closed,omitempty"`
|
|
// IsAnonymous True, if the poll is anonymous
|
|
IsAnonymous bool `json:"is_anonymous,omitempty"`
|
|
// Type Poll type, currently can be “regular” or “quiz”
|
|
Type PollType `json:"type"`
|
|
|
|
// AllowsMultipleAnswers True, if the poll allows multiple answers
|
|
AllowsMultipleAnswers bool `json:"allows_multiple_answers,omitempty"` // Since: Bot API 4.6
|
|
// AllowsRevoting True, if the poll allows to change the chosen answer options
|
|
AllowsRevoting bool `json:"allows_revoting,omitempty"` // Since: Bot API 9.6
|
|
// MembersOnly True if voting is limited to users who have been members of the chat where the poll was
|
|
// originally sent for more than 24 hours
|
|
MembersOnly bool `json:"members_only,omitempty"` // Since: Bot API 10.0
|
|
// CountryCodes Optional. A list of two-letter ISO 3166-1 alpha-2 country codes indicating the countries
|
|
// from which users can vote in the poll. The country code “FT” is used for users with anonymous
|
|
// numbers. If omitted, then users from any country can participate in the poll.
|
|
CountryCodes []string `json:"country_codes,omitempty"` // Since: Bot API 10.0
|
|
// CorrectOptionIDs Optional. Array of 0-based identifiers of the correct answer options. Available only for
|
|
// polls in quiz mode which are closed or were sent (not forwarded) by the bot or to the private chat with
|
|
// the bot.
|
|
CorrectOptionIDs []int `json:"correct_option_ids,omitempty"` // Since: Bot API 9.6
|
|
// Explanation Optional. Text that is shown when a user chooses an incorrect answer or taps on the lamp icon
|
|
// in a quiz-style poll, 0-200 characters
|
|
Explanation string `json:"explanation,omitempty"` // Since: Bot API 4.8
|
|
// ExplanationEntities Optional. Special entities like usernames, URLs, bot commands, etc. that appear in
|
|
// the explanation
|
|
ExplanationEntities []MessageEntity `json:"explanation_entities,omitempty"` // Since: Bot API 4.8
|
|
// ExplanationMedia Optional. Media added to the quiz explanation
|
|
ExplanationMedia *PollMedia `json:"explanation_media,omitempty"` // Since: Bot API 10.0
|
|
// OpenPeriod Optional. Amount of time in seconds the poll will be active after creation
|
|
OpenPeriod int `json:"open_period,omitempty"` // Since: Bot API 4.8
|
|
// CloseDate Optional. Point in time (Unix timestamp) when the poll will be automatically closed
|
|
CloseDate int `json:"close_date,omitempty"` // Since: Bot API 4.8
|
|
// Description Optional. Description of the poll; for polls inside the Message object only
|
|
Description string `json:"description,omitempty"` // Since: Bot API 9.6
|
|
// DescriptionEntities Optional. Special entities like usernames, URLs, bot commands, etc. that appear in
|
|
// the description
|
|
DescriptionEntities []MessageEntity `json:"description_entities,omitempty"` // Since: Bot API 9.6
|
|
// Media Optional. Media added to the poll description; for polls inside the Message object only
|
|
Media *PollMedia `json:"media,omitempty"` // Since: Bot API 10.0
|
|
}
|
|
|
|
// Link represents an HTTP link.
|
|
// Since: Bot API 10.1
|
|
// See https://core.telegram.org/bots/api#link
|
|
type Link struct {
|
|
// URL contains the HTTP URL.
|
|
URL string `json:"url"`
|
|
}
|
|
|
|
// PollMedia represents media attached to a poll.
|
|
// Since: Bot API 10.0
|
|
type PollMedia struct {
|
|
// Animation Optional. Media is an animation, information about the animation
|
|
Animation *Animation `json:"animation,omitempty"`
|
|
// Audio Optional. Media is an audio file, information about the file; currently, can't be received in a
|
|
// poll option
|
|
Audio *Audio `json:"audio,omitempty"`
|
|
// Document Optional. Media is a general file, information about the file; currently, can't be received in a
|
|
// poll option
|
|
Document *Document `json:"document,omitempty"`
|
|
// Link contains link media attached to the poll.
|
|
Link *Link `json:"link,omitempty"` // Since: Bot API 10.1
|
|
// LivePhoto Optional. Media is a live photo, information about the live photo
|
|
LivePhoto *LivePhoto `json:"live_photo,omitempty"`
|
|
// Location Optional. Media is a shared location, information about the location
|
|
Location *Location `json:"location,omitempty"`
|
|
// Photo Optional. Media is a photo, available sizes of the photo
|
|
Photo []PhotoSize `json:"photo,omitempty"`
|
|
// Sticker Optional. Media is a sticker, information about the sticker; currently, for poll options only
|
|
Sticker *Sticker `json:"sticker,omitempty"`
|
|
// Venue Optional. Media is a venue, information about the venue
|
|
Venue *Venue `json:"venue,omitempty"`
|
|
// Video Optional. Media is a video, information about the video
|
|
Video *Video `json:"video,omitempty"`
|
|
}
|
|
|
|
// ChecklistTask represents a single task in a checklist.
|
|
// Since: Bot API 9.1
|
|
type ChecklistTask struct {
|
|
// ID Unique identifier of the task
|
|
ID int `json:"id"`
|
|
// Text Text of the task
|
|
Text string `json:"text"`
|
|
// TextEntities Optional. Special entities that appear in the task text
|
|
TextEntities []MessageEntity `json:"text_entities,omitempty"`
|
|
// CompletedByUser Optional. User that completed the task; omitted if the task wasn't completed by a user
|
|
CompletedByUser *User `json:"completed_by_user,omitempty"`
|
|
// CompletedByChat Optional. Chat that completed the task; omitted if the task wasn't completed by a chat
|
|
CompletedByChat *Chat `json:"completed_by_chat,omitempty"`
|
|
// CompletionDate Optional. Point in time (Unix timestamp) when the task was completed; 0 if the task wasn't
|
|
// completed
|
|
CompletionDate int `json:"completion_date,omitempty"`
|
|
}
|
|
|
|
// Checklist represents a checklist.
|
|
// Since: Bot API 9.1
|
|
type Checklist struct {
|
|
// Title Title of the checklist
|
|
Title string `json:"title"`
|
|
// TitleEntities Optional. Special entities that appear in the checklist title
|
|
TitleEntities []MessageEntity `json:"title_entities,omitempty"`
|
|
// Tasks List of tasks in the checklist
|
|
Tasks []ChecklistTask `json:"tasks"`
|
|
// OthersCanAddTasks Optional. True, if users other than the creator of the list can add tasks to the list
|
|
OthersCanAddTasks bool `json:"others_can_add_tasks,omitempty"`
|
|
// OthersCanMarkTasksAsDone Optional. True, if users other than the creator of the list can mark tasks as
|
|
// done or not done
|
|
OthersCanMarkTasksAsDone bool `json:"others_can_mark_tasks_as_done,omitempty"`
|
|
}
|
|
|
|
// InputChecklistTask describes a task in a checklist.
|
|
// Since: Bot API 9.1
|
|
type InputChecklistTask struct {
|
|
// ID Unique identifier of the task; must be positive and unique among all task identifiers currently
|
|
// present in the checklist
|
|
ID int `json:"id"`
|
|
// Text Text of the task; 1-100 characters after entities parsing
|
|
Text string `json:"text"`
|
|
// ParseMode Optional. Mode for parsing entities in the text. See formatting options for more details.
|
|
ParseMode ParseMode `json:"parse_mode,omitempty"`
|
|
// TextEntities Optional. List of special entities that appear in the text, which can be specified instead
|
|
// of parse_mode. Currently, only bold, italic, underline, strikethrough, spoiler, custom_emoji, and
|
|
// date_time entities are allowed.
|
|
TextEntities []MessageEntity `json:"text_entities,omitempty"`
|
|
}
|
|
|
|
// InputChecklist represents a checklist to be sent.
|
|
// Since: Bot API 9.1
|
|
type InputChecklist struct {
|
|
// Title Title of the checklist; 1-255 characters after entities parsing
|
|
Title string `json:"title"`
|
|
// ParseMode Optional. Mode for parsing entities in the title. See formatting options for more details.
|
|
ParseMode ParseMode `json:"parse_mode,omitempty"`
|
|
// TitleEntities Optional. List of special entities that appear in the title, which can be specified instead
|
|
// of parse_mode. Currently, only bold, italic, underline, strikethrough, spoiler, custom_emoji, and
|
|
// date_time entities are allowed.
|
|
TitleEntities []MessageEntity `json:"title_entities,omitempty"`
|
|
// Tasks List of 1-30 tasks in the checklist
|
|
Tasks []InputChecklistTask `json:"tasks"`
|
|
// OtherCanAddTasks Optional. Pass True if other users can add tasks to the checklist
|
|
// Subject to change in v2: the Go field name may be corrected to OthersCanAddTasks.
|
|
OtherCanAddTasks bool `json:"others_can_add_tasks,omitempty"`
|
|
// OtherCanMarkTasksAsDone Optional. Pass True if other users can mark tasks as done or not done in the
|
|
// checklist
|
|
// Subject to change in v2: the Go field name may be corrected to OthersCanMarkTasksAsDone.
|
|
OtherCanMarkTasksAsDone bool `json:"others_can_mark_tasks_as_done,omitempty"`
|
|
}
|
|
|
|
// ChecklistTaskDone describes a service message about checklist tasks being marked as done.
|
|
// Since: Bot API 9.1
|
|
type ChecklistTaskDone struct {
|
|
// ChecklistMessage is the checklist message when it is available.
|
|
ChecklistMessage *Message `json:"checklist_message,omitempty"`
|
|
// MarkedAsDoneTaskIDs Optional. Identifiers of the tasks that were marked as done
|
|
MarkedAsDoneTaskIDs []int `json:"marked_as_done_task_ids,omitempty"`
|
|
// MarkedAsNotDoneTaskIDs Optional. Identifiers of the tasks that were marked as not done
|
|
MarkedAsNotDoneTaskIDs []int `json:"marked_as_not_done_task_ids,omitempty"`
|
|
}
|
|
|
|
// ChecklistTasksAdded describes a service message about new checklist tasks being added.
|
|
// Since: Bot API 9.1
|
|
type ChecklistTasksAdded struct {
|
|
// ChecklistMessage Optional. Message containing the checklist to which the tasks were added. Note that the
|
|
// Message object in this field will not contain the reply_to_message field even if it itself is a reply.
|
|
ChecklistMessage *Message `json:"checklist_message,omitempty"`
|
|
// Tasks List of tasks added to the checklist
|
|
Tasks []ChecklistTask `json:"tasks"`
|
|
}
|
|
|
|
// InputMediaType represents the type of input media.
|
|
type InputMediaType string
|
|
|
|
const (
|
|
// InputMediaTypeAnimation is a GIF or H.264/MPEG-4 AVC video without sound.
|
|
InputMediaTypeAnimation InputMediaType = "animation"
|
|
// InputMediaTypeDocument is a general file.
|
|
InputMediaTypeDocument InputMediaType = "document"
|
|
// InputMediaTypePhoto is a photo.
|
|
InputMediaTypePhoto InputMediaType = "photo"
|
|
// InputMediaTypeVideo is a video.
|
|
InputMediaTypeVideo InputMediaType = "video"
|
|
// InputMediaTypeAudio is an audio file.
|
|
InputMediaTypeAudio InputMediaType = "audio"
|
|
// InputMediaTypeVoiceNote is a voice message.
|
|
//
|
|
// Since: Bot API 10.2
|
|
InputMediaTypeVoiceNote InputMediaType = "voice_note"
|
|
|
|
// InputMediaTypeSticker is a sticker.
|
|
InputMediaTypeSticker InputMediaType = "sticker"
|
|
// InputMediaTypeLocation is a location.
|
|
InputMediaTypeLocation InputMediaType = "location"
|
|
// InputMediaTypeVenue is a venue.
|
|
InputMediaTypeVenue InputMediaType = "venue"
|
|
// InputMediaTypeLivePhoto is a live photo.
|
|
InputMediaTypeLivePhoto InputMediaType = "live_photo" // Since: Bot API 10.0
|
|
)
|
|
|
|
// InputMedia represents the content of a media message to be sent.
|
|
// Since: Bot API 4.0
|
|
// See https://core.telegram.org/bots/api#inputmedia
|
|
type InputMedia struct {
|
|
// Type identifies the concrete input-media variant.
|
|
Type InputMediaType `json:"type"`
|
|
// Media is a file_id, HTTP URL, or attach:// reference for the media.
|
|
Media string `json:"media"`
|
|
|
|
// Caption is the optional media caption.
|
|
Caption *string `json:"caption,omitempty"`
|
|
// ParseMode selects how entities in Caption are parsed.
|
|
ParseMode *ParseMode `json:"parse_mode,omitempty"`
|
|
// CaptionEntities Optional. List of special entities that appear in the caption, which can be specified
|
|
// instead of parse_mode
|
|
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
|
|
// ShowCaptionAboveMedia Optional. Pass True if the caption must be shown above the message media
|
|
ShowCaptionAboveMedia *bool `json:"show_caption_above_media,omitempty"` // Since: Bot API 7.4
|
|
// HasSpoiler requests that supported media be covered by a spoiler animation.
|
|
HasSpoiler *bool `json:"has_spoiler,omitempty"` // Since: Bot API 6.4
|
|
|
|
// Cover Optional. Cover for the video in the message. Pass a file_id to send a file that exists on the
|
|
// Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass
|
|
// “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name>
|
|
// name. More information on Sending Files »
|
|
Cover *string `json:"cover"` // Since: Bot API 8.3
|
|
// StartTimestamp Optional. Start timestamp for the video in the message
|
|
StartTimestamp *int `json:"start_timestamp"` // Since: Bot API 8.3
|
|
// Width is the optional media width in pixels.
|
|
Width *int `json:"width,omitempty"`
|
|
// Height is the optional media height in pixels.
|
|
Height *int `json:"height,omitempty"`
|
|
// Duration is the optional duration of the media in seconds.
|
|
Duration *int `json:"duration,omitempty"`
|
|
// SupportsStreaming Optional. Pass True if the uploaded video is suitable for streaming
|
|
SupportsStreaming *bool `json:"supports_streaming,omitempty"`
|
|
|
|
// Performer Optional. Performer of the audio
|
|
Performer *string `json:"performer,omitempty"`
|
|
// Title is the optional title of audio or venue media.
|
|
Title *string `json:"title,omitempty"`
|
|
|
|
// Emoji Optional. Emoji associated with the sticker; only for just uploaded stickers
|
|
Emoji *string `json:"emoji,omitempty"`
|
|
|
|
// Latitude Latitude of the location
|
|
Latitude *float64 `json:"latitude,omitempty"`
|
|
// Longitude Longitude of the location
|
|
Longitude *float64 `json:"longitude,omitempty"`
|
|
// Address Address of the venue
|
|
Address *string `json:"address,omitempty"`
|
|
// FoursquareID Optional. Foursquare identifier of the venue
|
|
FoursquareID *string `json:"foursquare_id,omitempty"`
|
|
// FoursquareType Optional. Foursquare type of the venue, if known. (For example,
|
|
// “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)
|
|
FoursquareType *string `json:"foursquare_type,omitempty"`
|
|
// GooglePlaceID Optional. Google Places identifier of the venue
|
|
GooglePlaceID *string `json:"google_place_id,omitempty"`
|
|
// GooglePlaceType Optional. Google Places type of the venue. (See supported types.)
|
|
GooglePlaceType *string `json:"google_place_type,omitempty"`
|
|
|
|
// HorizontalAccuracy Optional. The radius of uncertainty for the location, measured in meters; 0-1500
|
|
HorizontalAccuracy *float64 `json:"horizontal_accuracy,omitempty"`
|
|
}
|
|
|
|
// InputPaidMediaType represents the type of paid media.
|
|
type InputPaidMediaType string
|
|
|
|
const (
|
|
// InputPaidMediaTypeVideo represents a paid video.
|
|
InputPaidMediaTypeVideo InputPaidMediaType = "video"
|
|
// InputPaidMediaTypePhoto represents a paid photo.
|
|
InputPaidMediaTypePhoto InputPaidMediaType = "photo"
|
|
// InputPaidMediaTypeLivePhoto represents a paid live photo.
|
|
InputPaidMediaTypeLivePhoto InputPaidMediaType = "live_photo" // Since: Bot API 10.0
|
|
)
|
|
|
|
// InputPaidMedia describes the paid media to be sent.
|
|
// Since: Bot API 7.6
|
|
// See https://core.telegram.org/bots/api#inputpaidmedia
|
|
type InputPaidMedia struct {
|
|
// Type identifies the concrete paid-media variant.
|
|
Type InputPaidMediaType `json:"type"`
|
|
// Media is a file_id, HTTP URL, or attach:// reference for the paid media.
|
|
Media string `json:"media"`
|
|
|
|
// Cover Optional. Cover for the video in the message. Pass a file_id to send a file that exists on the
|
|
// Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass
|
|
// “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name>
|
|
// name. More information on Sending Files »
|
|
Cover *string `json:"cover,omitempty"` // Since: Bot API 8.3
|
|
// StartTimestamp Optional. Start timestamp for the video in the message
|
|
StartTimestamp *int64 `json:"start_timestamp,omitempty"` // Since: Bot API 8.3
|
|
// Width Optional. Video width
|
|
Width *int `json:"width,omitempty"`
|
|
// Height Optional. Video height
|
|
Height *int `json:"height,omitempty"`
|
|
// Duration Optional. Video duration in seconds
|
|
Duration *int `json:"duration,omitempty"`
|
|
// SupportsStreaming Optional. Pass True if the uploaded video is suitable for streaming
|
|
SupportsStreaming *bool `json:"supports_streaming,omitempty"`
|
|
}
|
|
|
|
// PhotoSize represents one size of a photo or a file/sticker thumbnail.
|
|
// Since: Bot API 1.0
|
|
// See https://core.telegram.org/bots/api#photosize
|
|
type PhotoSize struct {
|
|
// FileID Identifier for this file, which can be used to download or reuse the file
|
|
FileID string `json:"file_id"`
|
|
// FileUniqueID Unique identifier for this file, which is supposed to be the same over time and for
|
|
// different bots. Can't be used to download or reuse the file.
|
|
FileUniqueID string `json:"file_unique_id"`
|
|
// Width Photo width
|
|
Width int `json:"width"`
|
|
// Height Photo height
|
|
Height int `json:"height"`
|
|
// FileSize Optional. File size in bytes
|
|
FileSize int64 `json:"file_size,omitempty"`
|
|
}
|
|
|
|
// LivePhoto represents a live photo (a photo with a short video attached).
|
|
// Since: Bot API 10.0
|
|
type LivePhoto struct {
|
|
// Photo Optional. Available sizes of the corresponding static photo
|
|
Photo []PhotoSize `json:"photo,omitempty"`
|
|
// FileID Identifier for the video file which can be used to download or reuse the file
|
|
FileID string `json:"file_id"`
|
|
// FileUniqueID Unique identifier for the video file which is supposed to be the same over time and for
|
|
// different bots. Can't be used to download or reuse the file.
|
|
FileUniqueID string `json:"file_unique_id"`
|
|
// Width Video width as defined by the sender
|
|
Width int `json:"width"`
|
|
// Height Video height as defined by the sender
|
|
Height int `json:"height"`
|
|
// Duration Duration of the video in seconds as defined by the sender
|
|
Duration int `json:"duration"`
|
|
// MIMEType Optional. MIME type of the file as defined by the sender
|
|
MIMEType string `json:"mime_type,omitempty"`
|
|
// FileSize Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have
|
|
// difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit
|
|
// integer or double-precision float type are safe for storing this value.
|
|
FileSize int64 `json:"file_size,omitempty"`
|
|
}
|