Compare commits

..

10 Commits

Author SHA1 Message Date
Astra 7389f276de Merge remote-tracking branch 'upstream/master' 2024-06-16 19:57:46 +01:00
OvyFlash 90edbbc66a
Merge pull request #25 from OvyFlash/bot-api-7.4
Bot API 7.4 implementation
2024-06-09 14:12:23 +03:00
stdkhai bece330506 Bot API 7.4 implementation 2024-05-31 19:21:42 +03:00
OvyFlash 9b9c5c57d2
Merge pull request #24 from bobra/patch-1
Fix missing ParseMode in InlineQueryResultVideo
2024-05-15 23:34:45 +03:00
bobra d0fa8e929e
Fix missing ParseMode in InlineQueryResultVideo
ParseMode for this type actually exists, but was missed in the original repo.
https://core.telegram.org/bots/api#inlinequeryresultvideo
2024-05-15 02:57:25 +02:00
OvyFlash f8ef3a5696
Merge pull request #23 from OvyFlash/bot-api-7.3
Bot API 7.3 implementation
2024-05-11 13:26:18 +03:00
stdkhai 3dfc49d5c1 add missed omitempty tag & update comments 2024-05-10 17:19:52 +03:00
stdkhai 1ad852c765 Bot API 7.3 implementation 2024-05-07 17:32:47 +03:00
OvyFlash 29fd5ed941
Merge pull request #22 from OvyFlash/bot-api-7.2
BOT API 7.2 implementation
2024-05-04 17:38:12 +03:00
OvyFlash 6a83e6e519 BOT API 7.2 implementation 2024-05-02 22:49:19 +03:00
7 changed files with 582 additions and 52 deletions

6
bot.go
View File

@ -553,13 +553,13 @@ func WriteToHTTPResponse(w http.ResponseWriter, c Chattable) error {
} }
// GetChat gets information about a chat. // GetChat gets information about a chat.
func (bot *BotAPI) GetChat(config ChatInfoConfig) (Chat, error) { func (bot *BotAPI) GetChat(config ChatInfoConfig) (ChatFullInfo, error) {
resp, err := bot.Request(config) resp, err := bot.Request(config)
if err != nil { if err != nil {
return Chat{}, err return ChatFullInfo{}, err
} }
var chat Chat var chat ChatFullInfo
err = json.Unmarshal(resp.Result, &chat) err = json.Unmarshal(resp.Result, &chat)
return chat, err return chat, err

View File

@ -933,7 +933,7 @@ func TestUnpinAllChatMessages(t *testing.T) {
func TestPolls(t *testing.T) { func TestPolls(t *testing.T) {
bot, _ := getBot(t) bot, _ := getBot(t)
poll := NewPoll(SupergroupChatID, "Are polls working?", "Yes", "No") poll := NewPoll(SupergroupChatID, "Are polls working?", NewPollOption("Yes"), NewPollOption("No"))
msg, err := bot.Send(poll) msg, err := bot.Send(poll)
if err != nil { if err != nil {

View File

@ -60,6 +60,19 @@ const (
// UpdateTypeEditedChannelPost is new version of a channel post that is known to the bot and was edited // UpdateTypeEditedChannelPost is new version of a channel post that is known to the bot and was edited
UpdateTypeEditedChannelPost = "edited_channel_post" UpdateTypeEditedChannelPost = "edited_channel_post"
// UpdateTypeBusinessConnection is the bot was connected to or disconnected from a business account,
// or a user edited an existing connection with the bot
UpdateTypeBusinessConnection = "business_connection"
// UpdateTypeBusinessMessage is a new non-service message from a connected business account
UpdateTypeBusinessMessage = "business_message"
// UpdateTypeEditedBusinessMessage is a new version of a message from a connected business account
UpdateTypeEditedBusinessMessage = "edited_business_message"
// UpdateTypeDeletedBusinessMessages are the messages were deleted from a connected business account
UpdateTypeDeletedBusinessMessages = "deleted_business_messages"
// UpdateTypeMessageReactionis is a reaction to a message was changed by a user // UpdateTypeMessageReactionis is a reaction to a message was changed by a user
UpdateTypeMessageReaction = "message_reaction" UpdateTypeMessageReaction = "message_reaction"
@ -371,6 +384,7 @@ type CopyMessageConfig struct {
Caption string Caption string
ParseMode string ParseMode string
CaptionEntities []MessageEntity CaptionEntities []MessageEntity
ShowCaptionAboveMedia bool
} }
func (config CopyMessageConfig) params() (Params, error) { func (config CopyMessageConfig) params() (Params, error) {
@ -387,6 +401,7 @@ func (config CopyMessageConfig) params() (Params, error) {
params.AddNonZero("message_id", config.MessageID) params.AddNonZero("message_id", config.MessageID)
params.AddNonEmpty("caption", config.Caption) params.AddNonEmpty("caption", config.Caption)
params.AddNonEmpty("parse_mode", config.ParseMode) params.AddNonEmpty("parse_mode", config.ParseMode)
params.AddBool("show_caption_above_media", config.ShowCaptionAboveMedia)
err = params.AddInterface("caption_entities", config.CaptionEntities) err = params.AddInterface("caption_entities", config.CaptionEntities)
return params, err return params, err
@ -433,6 +448,7 @@ type PhotoConfig struct {
Caption string Caption string
ParseMode string ParseMode string
CaptionEntities []MessageEntity CaptionEntities []MessageEntity
ShowCaptionAboveMedia bool
} }
func (config PhotoConfig) params() (Params, error) { func (config PhotoConfig) params() (Params, error) {
@ -443,6 +459,7 @@ func (config PhotoConfig) params() (Params, error) {
params.AddNonEmpty("caption", config.Caption) params.AddNonEmpty("caption", config.Caption)
params.AddNonEmpty("parse_mode", config.ParseMode) params.AddNonEmpty("parse_mode", config.ParseMode)
params.AddBool("show_caption_above_media", config.ShowCaptionAboveMedia)
err = params.AddInterface("caption_entities", config.CaptionEntities) err = params.AddInterface("caption_entities", config.CaptionEntities)
if err != nil { if err != nil {
return params, err return params, err
@ -601,6 +618,7 @@ type VideoConfig struct {
Caption string Caption string
ParseMode string ParseMode string
CaptionEntities []MessageEntity CaptionEntities []MessageEntity
ShowCaptionAboveMedia bool
SupportsStreaming bool SupportsStreaming bool
} }
@ -614,6 +632,7 @@ func (config VideoConfig) params() (Params, error) {
params.AddNonEmpty("caption", config.Caption) params.AddNonEmpty("caption", config.Caption)
params.AddNonEmpty("parse_mode", config.ParseMode) params.AddNonEmpty("parse_mode", config.ParseMode)
params.AddBool("supports_streaming", config.SupportsStreaming) params.AddBool("supports_streaming", config.SupportsStreaming)
params.AddBool("show_caption_above_media", config.ShowCaptionAboveMedia)
err = params.AddInterface("caption_entities", config.CaptionEntities) err = params.AddInterface("caption_entities", config.CaptionEntities)
if err != nil { if err != nil {
return params, err return params, err
@ -657,6 +676,7 @@ type AnimationConfig struct {
Caption string Caption string
ParseMode string ParseMode string
CaptionEntities []MessageEntity CaptionEntities []MessageEntity
ShowCaptionAboveMedia bool
} }
func (config AnimationConfig) params() (Params, error) { func (config AnimationConfig) params() (Params, error) {
@ -668,6 +688,7 @@ func (config AnimationConfig) params() (Params, error) {
params.AddNonZero("duration", config.Duration) params.AddNonZero("duration", config.Duration)
params.AddNonEmpty("caption", config.Caption) params.AddNonEmpty("caption", config.Caption)
params.AddNonEmpty("parse_mode", config.ParseMode) params.AddNonEmpty("parse_mode", config.ParseMode)
params.AddBool("show_caption_above_media", config.ShowCaptionAboveMedia)
err = params.AddInterface("caption_entities", config.CaptionEntities) err = params.AddInterface("caption_entities", config.CaptionEntities)
if err != nil { if err != nil {
return params, err return params, err
@ -816,6 +837,7 @@ type EditMessageLiveLocationConfig struct {
BaseEdit BaseEdit
Latitude float64 // required Latitude float64 // required
Longitude float64 // required Longitude float64 // required
LivePeriod int //optional
HorizontalAccuracy float64 // optional HorizontalAccuracy float64 // optional
Heading int // optional Heading int // optional
ProximityAlertRadius int // optional ProximityAlertRadius int // optional
@ -828,6 +850,7 @@ func (config EditMessageLiveLocationConfig) params() (Params, error) {
params.AddNonZeroFloat("longitude", config.Longitude) params.AddNonZeroFloat("longitude", config.Longitude)
params.AddNonZeroFloat("horizontal_accuracy", config.HorizontalAccuracy) params.AddNonZeroFloat("horizontal_accuracy", config.HorizontalAccuracy)
params.AddNonZero("heading", config.Heading) params.AddNonZero("heading", config.Heading)
params.AddNonZero("live_period", config.LivePeriod)
params.AddNonZero("proximity_alert_radius", config.ProximityAlertRadius) params.AddNonZero("proximity_alert_radius", config.ProximityAlertRadius)
return params, err return params, err
@ -911,7 +934,9 @@ func (config ContactConfig) method() string {
type SendPollConfig struct { type SendPollConfig struct {
BaseChat BaseChat
Question string Question string
Options []string QuestionParseMode string // optional
QuestionEntities []MessageEntity // optional
Options []InputPollOption
IsAnonymous bool IsAnonymous bool
Type string Type string
AllowsMultipleAnswers bool AllowsMultipleAnswers bool
@ -931,6 +956,10 @@ func (config SendPollConfig) params() (Params, error) {
} }
params["question"] = config.Question params["question"] = config.Question
params.AddNonEmpty("question_parse_mode", config.QuestionParseMode)
if err = params.AddInterface("question_entities", config.QuestionEntities); err != nil {
return params, err
}
if err = params.AddInterface("options", config.Options); err != nil { if err = params.AddInterface("options", config.Options); err != nil {
return params, err return params, err
} }
@ -1091,6 +1120,7 @@ type EditMessageCaptionConfig struct {
Caption string Caption string
ParseMode string ParseMode string
CaptionEntities []MessageEntity CaptionEntities []MessageEntity
ShowCaptionAboveMedia bool
} }
func (config EditMessageCaptionConfig) params() (Params, error) { func (config EditMessageCaptionConfig) params() (Params, error) {
@ -1101,6 +1131,7 @@ func (config EditMessageCaptionConfig) params() (Params, error) {
params["caption"] = config.Caption params["caption"] = config.Caption
params.AddNonEmpty("parse_mode", config.ParseMode) params.AddNonEmpty("parse_mode", config.ParseMode)
params.AddBool("show_caption_above_media", config.ShowCaptionAboveMedia)
err = params.AddInterface("caption_entities", config.CaptionEntities) err = params.AddInterface("caption_entities", config.CaptionEntities)
return params, err return params, err
@ -1873,12 +1904,12 @@ func (config InvoiceConfig) params() (Params, error) {
params["title"] = config.Title params["title"] = config.Title
params["description"] = config.Description params["description"] = config.Description
params["payload"] = config.Payload params["payload"] = config.Payload
params["provider_token"] = config.ProviderToken
params["currency"] = config.Currency params["currency"] = config.Currency
if err = params.AddInterface("prices", config.Prices); err != nil { if err = params.AddInterface("prices", config.Prices); err != nil {
return params, err return params, err
} }
params.AddNonEmpty("provider_token", config.ProviderToken)
params.AddNonZero("max_tip_amount", config.MaxTipAmount) params.AddNonZero("max_tip_amount", config.MaxTipAmount)
err = params.AddInterface("suggested_tip_amounts", config.SuggestedTipAmounts) err = params.AddInterface("suggested_tip_amounts", config.SuggestedTipAmounts)
params.AddNonEmpty("start_parameter", config.StartParameter) params.AddNonEmpty("start_parameter", config.StartParameter)
@ -1932,12 +1963,12 @@ func (config InvoiceLinkConfig) params() (Params, error) {
params["title"] = config.Title params["title"] = config.Title
params["description"] = config.Description params["description"] = config.Description
params["payload"] = config.Payload params["payload"] = config.Payload
params["provider_token"] = config.ProviderToken
params["currency"] = config.Currency params["currency"] = config.Currency
if err := params.AddInterface("prices", config.Prices); err != nil { if err := params.AddInterface("prices", config.Prices); err != nil {
return params, err return params, err
} }
params.AddNonEmpty("provider_token", config.ProviderToken)
params.AddNonZero("max_tip_amount", config.MaxTipAmount) params.AddNonZero("max_tip_amount", config.MaxTipAmount)
err := params.AddInterface("suggested_tip_amounts", config.SuggestedTipAmounts) err := params.AddInterface("suggested_tip_amounts", config.SuggestedTipAmounts)
params.AddNonEmpty("provider_data", config.ProviderData) params.AddNonEmpty("provider_data", config.ProviderData)
@ -2004,6 +2035,26 @@ func (config PreCheckoutConfig) params() (Params, error) {
return params, nil return params, nil
} }
// RefundStarPaymentConfig refunds a successful payment in Telegram Stars.
// Returns True on success.
type RefundStarPaymentConfig struct {
UserID int64 //required
TelegramPaymentChargeID string //required
}
func (config RefundStarPaymentConfig) method() string {
return "refundStarPayment"
}
func (config RefundStarPaymentConfig) params() (Params, error) {
params := make(Params)
params["telegram_payment_charge_id"] = config.TelegramPaymentChargeID
params.AddNonZero64("user_id", config.UserID)
return params, nil
}
// DeleteMessageConfig contains information of a message in a chat to delete. // DeleteMessageConfig contains information of a message in a chat to delete.
type DeleteMessageConfig struct { type DeleteMessageConfig struct {
BaseChatMessage BaseChatMessage
@ -2216,7 +2267,6 @@ type NewStickerSetConfig struct {
Name string Name string
Title string Title string
Stickers []InputSticker Stickers []InputSticker
StickerFormat string
StickerType string StickerType string
NeedsRepainting bool //optional; Pass True if stickers in the sticker set must be repainted to the color of text when used in messages, the accent color if used as emoji status, white on chat photos, or another appropriate color based on context; for custom emoji sticker sets only NeedsRepainting bool //optional; Pass True if stickers in the sticker set must be repainted to the color of text when used in messages, the accent color if used as emoji status, white on chat photos, or another appropriate color based on context; for custom emoji sticker sets only
} }
@ -2231,7 +2281,6 @@ func (config NewStickerSetConfig) params() (Params, error) {
params.AddNonZero64("user_id", config.UserID) params.AddNonZero64("user_id", config.UserID)
params["name"] = config.Name params["name"] = config.Name
params["title"] = config.Title params["title"] = config.Title
params["sticker_format"] = config.StickerFormat
params.AddBool("needs_repainting", config.NeedsRepainting) params.AddBool("needs_repainting", config.NeedsRepainting)
params.AddNonEmpty("sticker_type", string(config.StickerType)) params.AddNonEmpty("sticker_type", string(config.StickerType))
@ -2363,6 +2412,33 @@ func (config DeleteStickerConfig) params() (Params, error) {
return params, nil return params, nil
} }
// ReplaceStickerInSetConfig allows you to replace an existing sticker in a sticker set
// with a new one. The method is equivalent to calling deleteStickerFromSet,
// then addStickerToSet, then setStickerPositionInSet.
// Returns True on success.
type ReplaceStickerInSetConfig struct {
UserID int64
Name string
OldSticker string
Sticker InputSticker
}
func (config ReplaceStickerInSetConfig) method() string {
return "replaceStickerInSet"
}
func (config ReplaceStickerInSetConfig) params() (Params, error) {
params := make(Params)
params.AddNonZero64("user_id", config.UserID)
params["name"] = config.Name
params["old_sticker"] = config.OldSticker
err := params.AddInterface("sticker", config.Sticker)
return params, err
}
// SetStickerEmojiListConfig allows you to change the list of emoji assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot // SetStickerEmojiListConfig allows you to change the list of emoji assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot
type SetStickerEmojiListConfig struct { type SetStickerEmojiListConfig struct {
Sticker string Sticker string
@ -2425,6 +2501,7 @@ type SetStickerSetThumbConfig struct {
Name string Name string
UserID int64 UserID int64
Thumb RequestFileData Thumb RequestFileData
Format string
} }
func (config SetStickerSetThumbConfig) method() string { func (config SetStickerSetThumbConfig) method() string {
@ -2435,6 +2512,8 @@ func (config SetStickerSetThumbConfig) params() (Params, error) {
params := make(Params) params := make(Params)
params["name"] = config.Name params["name"] = config.Name
params["format"] = config.Format
params.AddNonZero64("user_id", config.UserID) params.AddNonZero64("user_id", config.UserID)
return params, nil return params, nil
@ -2739,6 +2818,29 @@ func (config GetUserChatBoostsConfig) params() (Params, error) {
return params, err return params, err
} }
type (
GetBusinessConnectionConfig struct {
BusinessConnectionID BusinessConnectionID
}
BusinessConnectionID string
)
func (GetBusinessConnectionConfig) method() string {
return "getBusinessConnection"
}
func (config GetBusinessConnectionConfig) params() (Params, error) {
return config.BusinessConnectionID.params()
}
func (config BusinessConnectionID) params() (Params, error) {
params := make(Params)
params["business_connection_id"] = string(config)
return params, nil
}
// GetMyCommandsConfig gets a list of the currently registered commands. // GetMyCommandsConfig gets a list of the currently registered commands.
type GetMyCommandsConfig struct { type GetMyCommandsConfig struct {
Scope *BotCommandScope Scope *BotCommandScope

View File

@ -933,7 +933,7 @@ func NewDeleteChatPhoto(chatID int64) DeleteChatPhotoConfig {
} }
// NewPoll allows you to create a new poll. // NewPoll allows you to create a new poll.
func NewPoll(chatID int64, question string, options ...string) SendPollConfig { func NewPoll(chatID int64, question string, options ...InputPollOption) SendPollConfig {
return SendPollConfig{ return SendPollConfig{
BaseChat: BaseChat{ BaseChat: BaseChat{
ChatConfig: ChatConfig{ChatID: chatID}, ChatConfig: ChatConfig{ChatID: chatID},
@ -944,6 +944,13 @@ func NewPoll(chatID int64, question string, options ...string) SendPollConfig {
} }
} }
// NewPollOption allows you to create poll option
func NewPollOption(text string) InputPollOption {
return InputPollOption{
Text: text,
}
}
// NewStopPoll allows you to stop a poll. // NewStopPoll allows you to stop a poll.
func NewStopPoll(chatID int64, messageID int) StopPollConfig { func NewStopPoll(chatID int64, messageID int) StopPollConfig {
return StopPollConfig{ return StopPollConfig{
@ -1075,6 +1082,13 @@ func NewSetMyName(languageCode, name string) SetMyNameConfig {
} }
} }
// NewGetBusinessConnection gets business connection request struct
func NewGetBusinessConnection(id string) GetBusinessConnectionConfig {
return GetBusinessConnectionConfig{
BusinessConnectionID: BusinessConnectionID(id),
}
}
// NewGetMyCommandsWithScope allows you to set the registered commands for a // NewGetMyCommandsWithScope allows you to set the registered commands for a
// given scope. // given scope.
func NewGetMyCommandsWithScope(scope BotCommandScope) GetMyCommandsConfig { func NewGetMyCommandsWithScope(scope BotCommandScope) GetMyCommandsConfig {

View File

@ -19,10 +19,12 @@ func (base ChatConfig) paramsWithKey(key string) (Params, error) {
// BaseChat is base type for all chat config types. // BaseChat is base type for all chat config types.
type BaseChat struct { type BaseChat struct {
ChatConfig ChatConfig
BusinessConnectionID BusinessConnectionID
MessageThreadID int MessageThreadID int
ProtectContent bool ProtectContent bool
ReplyMarkup interface{} ReplyMarkup interface{}
DisableNotification bool DisableNotification bool
MessageEffectID string // for private chats only
ReplyParameters ReplyParameters ReplyParameters ReplyParameters
} }
@ -31,10 +33,16 @@ func (chat *BaseChat) params() (Params, error) {
if err != nil { if err != nil {
return params, err return params, err
} }
p1, err := chat.BusinessConnectionID.params()
if err != nil {
return params, err
}
params.Merge(p1)
params.AddNonZero("message_thread_id", chat.MessageThreadID) params.AddNonZero("message_thread_id", chat.MessageThreadID)
params.AddBool("disable_notification", chat.DisableNotification) params.AddBool("disable_notification", chat.DisableNotification)
params.AddBool("protect_content", chat.ProtectContent) params.AddBool("protect_content", chat.ProtectContent)
params.AddNonEmpty("message_effect_id", chat.MessageEffectID)
err = params.AddInterface("reply_markup", chat.ReplyMarkup) err = params.AddInterface("reply_markup", chat.ReplyMarkup)
if err != nil { if err != nil {

427
types.go
View File

@ -61,6 +61,26 @@ type Update struct {
// //
// optional // optional
EditedChannelPost *Message `json:"edited_channel_post,omitempty"` EditedChannelPost *Message `json:"edited_channel_post,omitempty"`
// BusinessConnection the bot was connected to or disconnected from a
// business account, or a user edited an existing connection with the bot
//
// optional
BusinessConnection *BusinessConnection `json:"business_connection,omitempty"`
// BusinessMessage is a new non-service message from a
// connected business account
//
// optional
BusinessMessage *Message `json:"business_message,omitempty"`
// EditedBusinessMessage is a new version of a message from a
// connected business account
//
// optional
EditedBusinessMessage *Message `json:"edited_business_message,omitempty"`
// DeletedBusinessMessages are the messages were deleted from a
// connected business account
//
// optional
DeletedBusinessMessages *BusinessMessagesDeleted `json:"deleted_business_messages,omitempty"`
// MessageReaction is a reaction to a message was changed by a user. // MessageReaction is a reaction to a message was changed by a user.
// //
// optional // optional
@ -237,6 +257,12 @@ type User struct {
// //
// optional // optional
SupportsInlineQueries bool `json:"supports_inline_queries,omitempty"` SupportsInlineQueries bool `json:"supports_inline_queries,omitempty"`
// CanConnectToBusiness is true, if the bot can be connected to a
// Telegram Business account to receive its messages.
// Returned only in getMe.
//
// optional
CanConnectToBusiness bool `json:"can_connect_to_business,omitempty"`
} }
// String displays a simple text version of a user. // String displays a simple text version of a user.
@ -285,6 +311,11 @@ type Chat struct {
// //
// optional // optional
IsForum bool `json:"is_forum,omitempty"` IsForum bool `json:"is_forum,omitempty"`
}
// ChatFullInfo contains full information about a chat.
type ChatFullInfo struct {
Chat
// Photo is a chat photo // Photo is a chat photo
Photo *ChatPhoto `json:"photo"` Photo *ChatPhoto `json:"photo"`
// If non-empty, the list of all active chat usernames; // If non-empty, the list of all active chat usernames;
@ -292,6 +323,31 @@ type Chat struct {
// //
// optional // optional
ActiveUsernames []string `json:"active_usernames,omitempty"` ActiveUsernames []string `json:"active_usernames,omitempty"`
// Birthdate for private chats, the date of birth of the user.
// Returned only in getChat.
//
// optional
Birthdate *Birthdate `json:"birthdate,omitempty"`
// BusinessIntro is for private chats with business accounts, the intro of the business.
// Returned only in getChat.
//
// optional
BusinessIntro *BusinessIntro `json:"business_intro,omitempty"`
// BusinessLocation is for private chats with business accounts, the location
// of the business. Returned only in getChat.
//
// optional
BusinessLocation *BusinessLocation `json:"business_location,omitempty"`
// BusinessOpeningHours is for private chats with business accounts,
// the opening hours of the business. Returned only in getChat.
//
// optional
BusinessOpeningHours *BusinessOpeningHours `json:"business_opening_hours,omitempty"`
// PersonalChat is for private chats, the personal channel of the user.
// Returned only in getChat.
//
// optional
PersonalChat *Chat `json:"personal_chat,omitempty"`
// AvailableReactions is a list of available reactions allowed in the chat. // AvailableReactions is a list of available reactions allowed in the chat.
// If omitted, then all emoji reactions are allowed. Returned only in getChat. // If omitted, then all emoji reactions are allowed. Returned only in getChat.
// //
@ -304,6 +360,8 @@ type Chat struct {
// //
// optional // optional
AccentColorID int `json:"accent_color_id,omitempty"` AccentColorID int `json:"accent_color_id,omitempty"`
// The maximum number of reactions that can be set on a message in the chat
MaxReactionCount int `json:"max_reaction_count"`
// BackgroundCustomEmojiID is a custom emoji identifier of emoji chosen by // BackgroundCustomEmojiID is a custom emoji identifier of emoji chosen by
// the chat for the reply header and link preview background. // the chat for the reply header and link preview background.
// Returned only in getChat. // Returned only in getChat.
@ -505,8 +563,21 @@ type Message struct {
// //
// optional // optional
SenderBoostCount int `json:"sender_boost_count,omitempty"` SenderBoostCount int `json:"sender_boost_count,omitempty"`
// SenderBusinessBot is the bot that actually sent the message on behalf of
// the business account. Available only for outgoing messages sent on
// behalf of the connected business account.
//
// optional
SenderBusinessBot *User `json:"sender_business_bot,omitempty"`
// Date of the message was sent in Unix time // Date of the message was sent in Unix time
Date int `json:"date"` Date int `json:"date"`
// BusinessConnectionID is an unique identifier of the business connection
// from which the message was received. If non-empty, the message belongs to
// a chat of the corresponding business account that is independent from
// any potential bot chat which might share the same identifier.
//
// optional
BusinessConnectionID string `json:"business_connection_id,omitempty"`
// Chat is the conversation the message belongs to // Chat is the conversation the message belongs to
Chat Chat `json:"chat"` Chat Chat `json:"chat"`
// ForwardOrigin is information about the original message for forwarded messages // ForwardOrigin is information about the original message for forwarded messages
@ -553,6 +624,11 @@ type Message struct {
// //
// optional // optional
HasProtectedContent bool `json:"has_protected_content,omitempty"` HasProtectedContent bool `json:"has_protected_content,omitempty"`
// IsFromOffline is True, if the message was sent by an implicit action,
// for example, as an away or a greeting business message, or as a scheduled message
//
// optional
IsFromOffline bool `json:"is_from_offline,omitempty"`
// MediaGroupID is the unique identifier of a media message group this message belongs to; // MediaGroupID is the unique identifier of a media message group this message belongs to;
// //
// optional // optional
@ -575,6 +651,10 @@ type Message struct {
// //
// Optional // Optional
LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options,omitempty"` LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options,omitempty"`
// EffectID is the unique identifier of the message effect added to the message
//
// optional
EffectID string `json:"effect_id,omitempty"`
// Animation message is an animation, information about the animation. // Animation message is an animation, information about the animation.
// For backward compatibility, when this field is set, the document field will also be set; // For backward compatibility, when this field is set, the document field will also be set;
// //
@ -625,6 +705,10 @@ type Message struct {
// //
// optional // optional
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
// ShowCaptionAboveMedia is True, if the caption must be shown above the message media
//
// optional
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
// HasSpoiler True, if the message media is covered by a spoiler animation // HasSpoiler True, if the message media is covered by a spoiler animation
// //
// optional // optional
@ -764,6 +848,10 @@ type Message struct {
// //
// optional // optional
BoostAdded *ChatBoostAdded `json:"boost_added,omitempty"` BoostAdded *ChatBoostAdded `json:"boost_added,omitempty"`
// Service message: chat background set
//
// optional
ChatBackgroundSet *ChatBackground `json:"chat_background_set,omitempty"`
// ForumTopicCreated is a service message: forum topic created // ForumTopicCreated is a service message: forum topic created
// //
// optional // optional
@ -923,6 +1011,7 @@ type MessageEntity struct {
// “strikethrough” (strikethrough text), // “strikethrough” (strikethrough text),
// "spoiler" (spoiler message), // "spoiler" (spoiler message),
// “blockquote” (block quotation), // “blockquote” (block quotation),
// “expandable_blockquote” (collapsed-by-default block quotation),
// “code” (monowidth string), // “code” (monowidth string),
// “pre” (monowidth block), // “pre” (monowidth block),
// “text_link” (for clickable text URLs), // “text_link” (for clickable text URLs),
@ -1459,10 +1548,31 @@ type Dice struct {
type PollOption struct { type PollOption struct {
// Text is the option text, 1-100 characters // Text is the option text, 1-100 characters
Text string `json:"text"` Text string `json:"text"`
// Special entities that appear in the option text.
// Currently, only custom emoji entities are allowed in poll option texts
//
// optional
TextEntities []MessageEntity `json:"text_entities,omitempty"`
// VoterCount is the number of users that voted for this option // VoterCount is the number of users that voted for this option
VoterCount int `json:"voter_count"` VoterCount int `json:"voter_count"`
} }
// InputPollOption contains information about one answer option in a poll to send.
type InputPollOption struct {
// Option text, 1-100 characters
Text string `json:"text"`
// Mode for parsing entities in the text. See formatting options for more details.
// Currently, only custom emoji entities are allowed
//
// optional
TextParseMode string `json:"text_parse_mode,omitempty"`
// A JSON-serialized list of special entities that appear in the poll option text.
// It can be specified instead of text_parse_mode
//
// optional
TextEntities []MessageEntity `json:"text_entities,omitempty"`
}
// PollAnswer represents an answer of a user in a non-anonymous poll. // PollAnswer represents an answer of a user in a non-anonymous poll.
type PollAnswer struct { type PollAnswer struct {
// PollID is the unique poll identifier // PollID is the unique poll identifier
@ -1488,6 +1598,11 @@ type Poll struct {
ID string `json:"id"` ID string `json:"id"`
// Question is the poll question, 1-255 characters // Question is the poll question, 1-255 characters
Question string `json:"question"` Question string `json:"question"`
// Special entities that appear in the question.
// Currently, only custom emoji entities are allowed in poll questions
//
// optional
QuestionEntities []MessageEntity `json:"question_entities,omitempty"`
// Options is the list of poll options // Options is the list of poll options
Options []PollOption `json:"options"` Options []PollOption `json:"options"`
// TotalVoterCount is the total numbers of users who voted in the poll // TotalVoterCount is the total numbers of users who voted in the poll
@ -1541,6 +1656,7 @@ type Location struct {
HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"` HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"`
// LivePeriod is time relative to the message sending date, during which the // LivePeriod is time relative to the message sending date, during which the
// location can be updated, in seconds. For active live locations only. // location can be updated, in seconds. For active live locations only.
// Use 0x7FFFFFFF (2147483647 - max positive Int) to edit indefinitely
// //
// optional // optional
LivePeriod int `json:"live_period,omitempty"` LivePeriod int `json:"live_period,omitempty"`
@ -1615,6 +1731,86 @@ type ChatBoostAdded struct {
BoostCount int `json:"boost_count"` BoostCount int `json:"boost_count"`
} }
// BackgroundFill describes the way a background is filled based on the selected colors.
// Currently, it can be one of:
// - BackgroundFillSolid
// - BackgroundFillGradient
// - BackgroundFillFreeformGradient
type BackgroundFill struct {
// Type of the background fill, can be:
// - solid
// - gradient
// - freeform_gradient
Type string `json:"type"`
// BackgroundFillSolid only.
// The color of the background fill in the RGB24 format
Color int `json:"color"`
// BackgroundFillGradient only.
// Top color of the gradient in the RGB24 format
TopColor int `json:"top_color"`
// BackgroundFillGradient only.
// Bottom color of the gradient in the RGB24 format
BottomColor int `json:"bottom_color"`
// BackgroundFillGradient only.
// Clockwise rotation angle of the background fill in degrees; 0-359
RotationAngle int `json:"rotation_angle"`
// BackgroundFillFreeformGradient only.
// A list of the 3 or 4 base colors that are used to generate the freeform gradient in the RGB24 format
Colors []int `json:"colors"`
}
// BackgroundType describes the type of a background. Currently, it can be one of:
// - BackgroundTypeFill
// - BackgroundTypeWallpaper
// - BackgroundTypePattern
// - BackgroundTypeChatTheme
type BackgroundType struct {
// Type of the background.
// Currently, it can be one of:
// - fill
// - wallpaper
// - pattern
// - chat_theme
Type string `json:"type"`
// BackgroundTypeFill and BackgroundTypePattern only.
// The background fill or fill that is combined with the pattern
Fill BackgroundFill `json:"fill"`
// BackgroundTypeFill and BackgroundTypeWallpaper only.
// Dimming of the background in dark themes, as a percentage; 0-100
DarkThemeDimming int `json:"dark_theme_dimming"`
// BackgroundTypeWallpaper and BackgroundTypePattern only.
// Document with the wallpaper / pattern
Document Document `json:"document"`
// BackgroundTypeWallpaper only.
// True, if the wallpaper is downscaled to fit in a 450x450 square and then box-blurred with radius 12
//
// optional
IsBlurred bool `json:"is_blurred,omitempty"`
// BackgroundTypeWallpaper and BackgroundTypePattern only.
// True, if the background moves slightly when the device is tilted
//
// optional
IsMoving bool `json:"is_moving,omitempty"`
// BackgroundTypePattern only.
// Intensity of the pattern when it is shown above the filled background; 0-100
Intensity int `json:"intensity"`
// BackgroundTypePattern only.
// True, if the background fill must be applied only to the pattern itself.
// All other pixels are black in this case. For dark themes only
//
// optional
IsInverted bool `json:"is_inverted,omitempty"`
// BackgroundTypeChatTheme only.
// Name of the chat theme, which is usually an emoji
ThemeName string `json:"theme_name"`
}
// ChatBackground represents a chat background.
type ChatBackground struct {
// Type of the background
Type BackgroundType `json:"type"`
}
// ForumTopicCreated represents a service message about a new forum topic // ForumTopicCreated represents a service message about a new forum topic
// created in the chat. // created in the chat.
type ForumTopicCreated struct { type ForumTopicCreated struct {
@ -1663,13 +1859,37 @@ type GeneralForumTopicHidden struct {
type GeneralForumTopicUnhidden struct { type GeneralForumTopicUnhidden struct {
} }
// SharedUser contains information about a user that was
// shared with the bot using a KeyboardButtonRequestUsers button.
type SharedUser struct {
// UserID is the identifier of the shared user.
UserID int64 `json:"user_id"`
// FirstName of the user, if the name was requested by the bot.
//
// optional
FirstName *string `json:"first_name,omitempty"`
// LastName of the user, if the name was requested by the bot.
//
// optional
LastName *string `json:"last_name,omitempty"`
// Username of the user, if the username was requested by the bot.
//
// optional
UserName *string `json:"username,omitempty"`
// Photo is array of available sizes of the chat photo,
// if the photo was requested by the bot
//
// optional
Photo []PhotoSize `json:"photo,omitempty"`
}
// UsersShared object contains information about the user whose identifier // UsersShared object contains information about the user whose identifier
// was shared with the bot using a KeyboardButtonRequestUser button. // was shared with the bot using a KeyboardButtonRequestUser button.
type UsersShared struct { type UsersShared struct {
// RequestID is an indentifier of the request. // RequestID is an indentifier of the request.
RequestID int `json:"request_id"` RequestID int `json:"request_id"`
// UserIDs are identifiers of the shared user. // Users shared with the bot.
UserIDs []int64 `json:"user_ids"` Users []SharedUser `json:"users"`
} }
// ChatShared contains information about the chat whose identifier // ChatShared contains information about the chat whose identifier
@ -1679,6 +1899,20 @@ type ChatShared struct {
RequestID int `json:"request_id"` RequestID int `json:"request_id"`
// ChatID is an identifier of the shared chat. // ChatID is an identifier of the shared chat.
ChatID int64 `json:"chat_id"` ChatID int64 `json:"chat_id"`
// Title of the chat, if the title was requested by the bot.
//
// optional
Title *string `json:"title,omitempty"`
// UserName of the chat, if the username was requested by
// the bot and available.
//
// optional
UserName *string `json:"username,omitempty"`
// Photo is array of available sizes of the chat photo,
// if the photo was requested by the bot
//
// optional
Photo []PhotoSize `json:"photo,omitempty"`
} }
// WriteAccessAllowed represents a service message about a user allowing a bot // WriteAccessAllowed represents a service message about a user allowing a bot
@ -2016,6 +2250,18 @@ type KeyboardButtonRequestUsers struct {
// //
// optional // optional
MaxQuantity int `json:"max_quantity,omitempty"` MaxQuantity int `json:"max_quantity,omitempty"`
// RequestName pass True to request the users' first and last names
//
// optional
RequestName bool `json:"request_name,omitempty"`
// RequestUsername pass True to request the users' usernames
//
// optional
RequestUsername bool `json:"request_username,omitempty"`
// RequestPhoto pass True to request the users' photos
//
// optional
RequestPhoto bool `json:"request_photo,omitempty"`
} }
// KeyboardButtonRequestChat defines the criteria used to request // KeyboardButtonRequestChat defines the criteria used to request
@ -2062,6 +2308,18 @@ type KeyboardButtonRequestChat struct {
// //
// optional // optional
BotIsMember bool `json:"bot_is_member,omitempty"` BotIsMember bool `json:"bot_is_member,omitempty"`
// RequestTitle pass True to request the chat's title
//
// optional
RequestTitle bool `json:"request_title,omitempty"`
// RequestUsername pass True to request the chat's username
//
// optional
RequestUsername bool `json:"request_username,omitempty"`
// RequestPhoto pass True to request the chat's photo
//
// optional
RequestPhoto bool `json:"request_photo,omitempty"`
} }
// KeyboardButtonPollType represents type of poll, which is allowed to // KeyboardButtonPollType represents type of poll, which is allowed to
@ -2166,6 +2424,7 @@ type InlineKeyboardButton struct {
// optional // optional
CallbackGame *CallbackGame `json:"callback_game,omitempty"` CallbackGame *CallbackGame `json:"callback_game,omitempty"`
// Pay specify True, to send a Pay button. // Pay specify True, to send a Pay button.
// Substrings “⭐” and “XTR” in the buttons's text will be replaced with a Telegram Star icon.
// //
// NOTE: This type of button must always be the first button in the first row. // NOTE: This type of button must always be the first button in the first row.
// //
@ -2571,6 +2830,12 @@ type ChatMemberUpdated struct {
// //
// optional // optional
InviteLink *ChatInviteLink `json:"invite_link,omitempty"` InviteLink *ChatInviteLink `json:"invite_link,omitempty"`
// ViaJoinRequest is true, if the user joined the chat
// after sending a direct join request
// and being approved by an administrator
//
// optional
ViaJoinRequest bool `json:"via_join_request,omitempty"`
// ViaChatFolderInviteLink is True, if the user joined the chat // ViaChatFolderInviteLink is True, if the user joined the chat
// via a chat folder invite link // via a chat folder invite link
// //
@ -2688,6 +2953,64 @@ func (c *ChatPermissions) CanSendMediaMessages() bool {
c.CanSendVideoNotes && c.CanSendVoiceNotes c.CanSendVideoNotes && c.CanSendVoiceNotes
} }
// Birthdate represents a user's birthdate
type Birthdate struct {
// Day of the user's birth; 1-31
Day int `json:"day"`
// Month of the user's birth; 1-12
Month int `json:"month"`
// Year of the user's birth
//
// optional
Year *int `json:"year,omitempty"`
}
// BusinessIntro represents a basic information about your business
type BusinessIntro struct {
// Title text of the business intro
//
// optional
Title *string `json:"title,omitempty"`
// Message text of the business intro
//
// optional
Message *string `json:"message,omitempty"`
// Sticker of the business intro
//
// optional
Sticker *Sticker `json:"sticker,omitempty"`
}
// BusinessLocation represents a business geodata
type BusinessLocation struct {
// Address of the business
Address string `json:"address"`
// Location of the business
//
// optional
Location *Location `json:"location,omitempty"`
}
// BusinessOpeningHoursInterval represents a business working interval
type BusinessOpeningHoursInterval struct {
// OpeningMinute is the minute's sequence number in a week, starting on Monday,
// marking the start of the time interval during which the business is open; 0 - 7 * 24 * 60
OpeningMinute int `json:"opening_minute"`
// ClosingMinute is the minute's sequence number in a week, starting on Monday,
// marking the end of the time interval during which the business is open; 0 - 8 * 24 * 60
ClosingMinute int `json:"closing_minute"`
}
// BusinessOpeningHours represents a set of business working intervals
type BusinessOpeningHours struct {
// TimeZoneName is the unique name of the time zone
// for which the opening hours are defined
TimeZoneName string `json:"time_zone_name"`
// OpeningHours is the list of time intervals describing
// business opening hours
OpeningHours []BusinessOpeningHoursInterval `json:"opening_hours"`
}
// ChatLocation represents a location to which a chat is connected. // ChatLocation represents a location to which a chat is connected.
type ChatLocation struct { type ChatLocation struct {
// Location is the location to which the supergroup is connected. Can't be a // Location is the location to which the supergroup is connected. Can't be a
@ -2904,6 +3227,38 @@ type UserChatBoosts struct {
Boosts []ChatBoost `json:"boosts"` Boosts []ChatBoost `json:"boosts"`
} }
// BusinessConnection describes the connection of the bot with a business account.
type BusinessConnection struct {
// ID is an unique identifier of the business connection
ID string `json:"id"`
// User is a business account user that created the business connection
User User `json:"user"`
// UserChatID identifier of a private chat with the user who
// created the business connection.
UserChatID int64 `json:"user_chat_id"`
// Date the connection was established in Unix time
Date int64 `json:"date"`
// CanReply is True, if the bot can act on behalf of the
// business account in chats that were active in the last 24 hours
CanReply bool `json:"can_reply"`
// IsEnabled is True, if the connection is active
IsEnabled bool `json:"is_enabled"`
}
// BusinessMessagesDeleted is received when messages are deleted
// from a connected business account.
type BusinessMessagesDeleted struct {
// BusinessConnectionID is an unique identifier
// of the business connection
BusinessConnectionID string `json:"business_connection_id"`
// Chat is the information about a chat in the business account.
// The bot may not have access to the chat or the corresponding user.
Chat Chat `json:"chat"`
// MessageIDs is a JSON-serialized list of identifiers of deleted messages
// in the chat of the business account
MessageIDs []int `json:"message_ids"`
}
// ResponseParameters are various errors that can be returned in APIResponse. // ResponseParameters are various errors that can be returned in APIResponse.
type ResponseParameters struct { type ResponseParameters struct {
// The group has been migrated to a supergroup with the specified identifier. // The group has been migrated to a supergroup with the specified identifier.
@ -2944,6 +3299,10 @@ type BaseInputMedia struct {
// //
// optional // optional
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
// Pass True, if the caption must be shown above the message media
//
// optional
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
// HasSpoiler pass True, if the photo needs to be covered with a spoiler animation // HasSpoiler pass True, if the photo needs to be covered with a spoiler animation
// //
// optional // optional
@ -3139,10 +3498,6 @@ type StickerSet struct {
Title string `json:"title"` Title string `json:"title"`
// StickerType of stickers in the set, currently one of “regular”, “mask”, “custom_emoji” // StickerType of stickers in the set, currently one of “regular”, “mask”, “custom_emoji”
StickerType string `json:"sticker_type"` StickerType string `json:"sticker_type"`
// IsAnimated true, if the sticker set contains animated stickers
IsAnimated bool `json:"is_animated"`
// IsVideo true, if the sticker set contains video stickers
IsVideo bool `json:"is_video"`
// ContainsMasks true, if the sticker set contains masks // ContainsMasks true, if the sticker set contains masks
// //
// deprecated. Use sticker_type instead // deprecated. Use sticker_type instead
@ -3190,6 +3545,9 @@ type MaskPosition struct {
type InputSticker struct { type InputSticker struct {
// The added sticker. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, upload a new one using multipart/form-data, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. Animated and video stickers can't be uploaded via HTTP URL. // The added sticker. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, upload a new one using multipart/form-data, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. Animated and video stickers can't be uploaded via HTTP URL.
Sticker RequestFile `json:"sticker"` Sticker RequestFile `json:"sticker"`
// Format of the added sticker, must be one of “static” for a
// .WEBP or .PNG image, “animated” for a .TGS animation, “video” for a WEBM video
Format string `json:"format"`
// List of 1-20 emoji associated with the sticker // List of 1-20 emoji associated with the sticker
EmojiList []string `json:"emoji_list"` EmojiList []string `json:"emoji_list"`
// Position where the mask should be placed on faces. For “mask” stickers only. // Position where the mask should be placed on faces. For “mask” stickers only.
@ -3434,6 +3792,10 @@ type InlineQueryResultCachedGIF struct {
// //
// optional // optional
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
// Pass True, if the caption must be shown above the message media
//
// optional
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
// ReplyMarkup inline keyboard attached to the message. // ReplyMarkup inline keyboard attached to the message.
// //
// optional // optional
@ -3473,6 +3835,10 @@ type InlineQueryResultCachedMPEG4GIF struct {
// //
// optional // optional
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
// Pass True, if the caption must be shown above the message media
//
// optional
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
// ReplyMarkup inline keyboard attached to the message. // ReplyMarkup inline keyboard attached to the message.
// //
// optional // optional
@ -3514,6 +3880,10 @@ type InlineQueryResultCachedPhoto struct {
// //
// optional // optional
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
// Pass True, if the caption must be shown above the message media
//
// optional
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
// ReplyMarkup inline keyboard attached to the message. // ReplyMarkup inline keyboard attached to the message.
// //
// optional // optional
@ -3573,6 +3943,10 @@ type InlineQueryResultCachedVideo struct {
// //
// optional // optional
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
// Pass True, if the caption must be shown above the message media
//
// optional
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
// ReplyMarkup inline keyboard attached to the message // ReplyMarkup inline keyboard attached to the message
// //
// optional // optional
@ -3815,6 +4189,10 @@ type InlineQueryResultGIF struct {
// //
// optional // optional
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
// Pass True, if the caption must be shown above the message media
//
// optional
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
// ReplyMarkup inline keyboard attached to the message // ReplyMarkup inline keyboard attached to the message
// //
// optional // optional
@ -3923,6 +4301,10 @@ type InlineQueryResultMPEG4GIF struct {
// //
// optional // optional
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
// Pass True, if the caption must be shown above the message media
//
// optional
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
// ReplyMarkup inline keyboard attached to the message // ReplyMarkup inline keyboard attached to the message
// //
// optional // optional
@ -3983,6 +4365,10 @@ type InlineQueryResultPhoto struct {
// //
// optional // optional
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
// Pass True, if the caption must be shown above the message media
//
// optional
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
// InputMessageContent content of the message to be sent instead of the photo. // InputMessageContent content of the message to be sent instead of the photo.
// //
// optional // optional
@ -4062,6 +4448,21 @@ type InlineQueryResultVideo struct {
// //
// optional // optional
Caption string `json:"caption,omitempty"` Caption string `json:"caption,omitempty"`
// CaptionEntities is a list of special entities that appear in the caption,
// which can be specified instead of parse_mode
//
// optional
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
// Pass True, if the caption must be shown above the message media
//
// optional
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
// ParseMode mode for parsing entities in the video caption.
// See formatting options for more details
// (https://core.telegram.org/bots/api#formatting-options).
//
// optional
ParseMode string `json:"parse_mode,omitempty"`
// Width video width // Width video width
// //
// optional // optional
@ -4104,7 +4505,7 @@ type InlineQueryResultVoice struct {
// //
// optional // optional
Caption string `json:"caption,omitempty"` Caption string `json:"caption,omitempty"`
// ParseMode mode for parsing entities in the video caption. // ParseMode mode for parsing entities in the voice caption.
// See formatting options for more details // See formatting options for more details
// (https://core.telegram.org/bots/api#formatting-options). // (https://core.telegram.org/bots/api#formatting-options).
// //
@ -4267,9 +4668,11 @@ type InputInvoiceMessageContent struct {
// Bot-defined invoice payload, 1-128 bytes. This will not be displayed to // Bot-defined invoice payload, 1-128 bytes. This will not be displayed to
// the user, use for your internal processes. // the user, use for your internal processes.
Payload string `json:"payload"` Payload string `json:"payload"`
// Payment provider token, obtained via Botfather // Payment provider token, obtained via Botfather. Pass an empty string for payments in Telegram Stars.
//
// optional
ProviderToken string `json:"provider_token"` ProviderToken string `json:"provider_token"`
// Three-letter ISO 4217 currency code // Three-letter ISO 4217 currency code. Pass “XTR” for payments in Telegram Stars.
Currency string `json:"currency"` Currency string `json:"currency"`
// Price breakdown, a JSON-serialized list of components (e.g. product // Price breakdown, a JSON-serialized list of components (e.g. product
// price, tax, discount, delivery cost, delivery tax, bonus, etc.) // price, tax, discount, delivery cost, delivery tax, bonus, etc.)
@ -4361,7 +4764,7 @@ type Invoice struct {
Description string `json:"description"` Description string `json:"description"`
// StartParameter unique bot deep-linking parameter that can be used to generate this invoice // StartParameter unique bot deep-linking parameter that can be used to generate this invoice
StartParameter string `json:"start_parameter"` StartParameter string `json:"start_parameter"`
// Currency three-letter ISO 4217 currency code // Currency three-letter ISO 4217 currency code, or “XTR” for payments in Telegram Stars
// (see https://core.telegram.org/bots/payments#supported-currencies) // (see https://core.telegram.org/bots/payments#supported-currencies)
Currency string `json:"currency"` Currency string `json:"currency"`
// TotalAmount total price in the smallest units of the currency (integer, not float/double). // TotalAmount total price in the smallest units of the currency (integer, not float/double).
@ -4421,7 +4824,7 @@ type ShippingOption struct {
// SuccessfulPayment contains basic information about a successful payment. // SuccessfulPayment contains basic information about a successful payment.
type SuccessfulPayment struct { type SuccessfulPayment struct {
// Currency three-letter ISO 4217 currency code // Currency three-letter ISO 4217 currency code, or “XTR” for payments in Telegram Stars
// (see https://core.telegram.org/bots/payments#supported-currencies) // (see https://core.telegram.org/bots/payments#supported-currencies)
Currency string `json:"currency"` Currency string `json:"currency"`
// TotalAmount total price in the smallest units of the currency (integer, not float/double). // TotalAmount total price in the smallest units of the currency (integer, not float/double).
@ -4465,7 +4868,7 @@ type PreCheckoutQuery struct {
ID string `json:"id"` ID string `json:"id"`
// From user who sent the query // From user who sent the query
From *User `json:"from"` From *User `json:"from"`
// Currency three-letter ISO 4217 currency code // Currency three-letter ISO 4217 currency code, or “XTR” for payments in Telegram Stars
// // (see https://core.telegram.org/bots/payments#supported-currencies) // // (see https://core.telegram.org/bots/payments#supported-currencies)
Currency string `json:"currency"` Currency string `json:"currency"`
// TotalAmount total price in the smallest units of the currency (integer, not float/double). // TotalAmount total price in the smallest units of the currency (integer, not float/double).

View File

@ -308,6 +308,7 @@ var (
_ Chattable = FileConfig{} _ Chattable = FileConfig{}
_ Chattable = ForwardConfig{} _ Chattable = ForwardConfig{}
_ Chattable = GameConfig{} _ Chattable = GameConfig{}
_ Chattable = GetBusinessConnectionConfig{}
_ Chattable = GetChatMemberConfig{} _ Chattable = GetChatMemberConfig{}
_ Chattable = GetChatMenuButtonConfig{} _ Chattable = GetChatMenuButtonConfig{}
_ Chattable = GetGameHighScoresConfig{} _ Chattable = GetGameHighScoresConfig{}
@ -324,6 +325,7 @@ var (
_ Chattable = PinChatMessageConfig{} _ Chattable = PinChatMessageConfig{}
_ Chattable = PreCheckoutConfig{} _ Chattable = PreCheckoutConfig{}
_ Chattable = PromoteChatMemberConfig{} _ Chattable = PromoteChatMemberConfig{}
_ Chattable = ReplaceStickerInSetConfig{}
_ Chattable = RestrictChatMemberConfig{} _ Chattable = RestrictChatMemberConfig{}
_ Chattable = RevokeChatInviteLinkConfig{} _ Chattable = RevokeChatInviteLinkConfig{}
_ Chattable = SendPollConfig{} _ Chattable = SendPollConfig{}
@ -373,6 +375,7 @@ var (
_ Chattable = SetMyShortDescriptionConfig{} _ Chattable = SetMyShortDescriptionConfig{}
_ Chattable = GetMyNameConfig{} _ Chattable = GetMyNameConfig{}
_ Chattable = SetMyNameConfig{} _ Chattable = SetMyNameConfig{}
_ Chattable = RefundStarPaymentConfig{}
) )
// Ensure all Fileable types are correct. // Ensure all Fileable types are correct.