(new): support Bot API 10.3
Golang lint / lint (push) Failing after 1m37s

(fix): finalize v2 contracts
(tests): cover v2 migration
(doc): prepare release guidance
This commit is contained in:
2026-09-08 23:21:38 +03:00
parent 24040fe164
commit d78526242b
88 changed files with 2321 additions and 918 deletions
+27
View File
@@ -68,6 +68,10 @@ const (
//
// Since: Bot API 10.2
UpdateTypeSubscription UpdateType = "subscription"
// UpdateTypeMessageGenerationStopped identifies a request to stop message generation.
//
// Since: Bot API 10.3
UpdateTypeMessageGenerationStopped UpdateType = "stopped_message_generation"
)
// Update represents an incoming update from Telegram.
@@ -162,6 +166,9 @@ type Update struct {
ManagedBot *ManagedBotUpdated `json:"managed_bot,omitempty"` // Since: Bot API 9.6
// Subscription contains a bot subscription update.
Subscription *BotSubscriptionUpdated `json:"subscription,omitempty"` // Since: Bot API 10.2
// StoppedMessageGeneration describes a request to stop a message draft.
StoppedMessageGeneration *MessageGenerationStopped `json:"stopped_message_generation,omitempty"` // Since: Bot API 10.3
}
// UnmarshalJSON decodes an update and derives its Type from the populated payload field.
@@ -231,6 +238,8 @@ func (u *Update) UnmarshalJSON(data []byte) error {
u.Type = UpdateTypeManagedBot
case u.Subscription != nil:
u.Type = UpdateTypeSubscription
case u.StoppedMessageGeneration != nil:
u.Type = UpdateTypeMessageGenerationStopped
default:
u.Type = UpdateTypeUnknown
}
@@ -677,6 +686,12 @@ type UniqueGiftInfo struct {
// other users, “gifted_upgrade” for upgrades purchased after the gift was sent, or “offer” for
// gifts bought or sold through gift purchase offers.
Origin string `json:"origin"`
// Text contains the text shown with the gift.
Text string `json:"text,omitempty"` // Since: Bot API 10.3
// Entities contains special entities appearing in Text.
Entities []MessageEntity `json:"entities,omitempty"` // Since: Bot API 10.3
// IsPrivate reports whether the sender and gift text are visible only to the gift receiver.
IsPrivate bool `json:"is_private,omitempty"` // Since: Bot API 10.3
// LastResaleCurrency Optional. For gifts bought from other users, the currency in which the payment for the
// gift was done. Currently, one of “XTR” for Telegram Stars or “TON” for TON grams.
LastResaleCurrency string `json:"last_resale_currency,omitempty"`
@@ -974,3 +989,15 @@ type BotSubscriptionUpdated struct {
// State is the new subscription state.
State BotSubscriptionState `json:"state"`
}
// MessageGenerationStopped describes an update about a user stopping message generation.
//
// Since: Bot API 10.3
type MessageGenerationStopped struct {
// Chat is the chat in which the message was being generated.
Chat Chat `json:"chat"`
// MessageThreadID optionally identifies the message thread.
MessageThreadID int `json:"message_thread_id,omitempty"`
// DraftID identifies the stopped draft.
DraftID int `json:"draft_id"`
}