(new): rich message support
(fix): runtime reliability (tests): regression coverage (doc): v1.1 release notes
This commit is contained in:
+46
-4
@@ -63,6 +63,11 @@ const (
|
||||
|
||||
// UpdateTypeGuestMessage is a guest message update.
|
||||
UpdateTypeGuestMessage UpdateType = "guest_message"
|
||||
|
||||
// UpdateTypeSubscription is a bot subscription update.
|
||||
//
|
||||
// Since: Bot API 10.2
|
||||
UpdateTypeSubscription UpdateType = "subscription"
|
||||
)
|
||||
|
||||
// Update represents an incoming update from Telegram.
|
||||
@@ -101,6 +106,8 @@ type Update struct {
|
||||
RemovedChatBoost *ChatBoostRemoved `json:"removed_chat_boost,omitempty"` // Since: Bot API 7.0
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
// UnmarshalJSON decodes an update and derives its Type from the populated payload field.
|
||||
@@ -168,6 +175,8 @@ func (u *Update) UnmarshalJSON(data []byte) error {
|
||||
u.Type = UpdateTypeRemovedChatBoost
|
||||
case u.ManagedBot != nil:
|
||||
u.Type = UpdateTypeManagedBot
|
||||
case u.Subscription != nil:
|
||||
u.Type = UpdateTypeSubscription
|
||||
default:
|
||||
u.Type = UpdateTypeUnknown
|
||||
}
|
||||
@@ -557,8 +566,11 @@ type WriteAccessAllowed struct {
|
||||
type BackgroundFillType string
|
||||
|
||||
const (
|
||||
BackgroundFillSolidType BackgroundFillType = "solid"
|
||||
BackgroundFillGradientType BackgroundFillType = "gradient"
|
||||
// BackgroundFillSolidType identifies a solid fill.
|
||||
BackgroundFillSolidType BackgroundFillType = "solid"
|
||||
// BackgroundFillGradientType identifies a two-color gradient.
|
||||
BackgroundFillGradientType BackgroundFillType = "gradient"
|
||||
// BackgroundFillFreeformGradientType identifies a freeform gradient.
|
||||
BackgroundFillFreeformGradientType BackgroundFillType = "freeform_gradient"
|
||||
)
|
||||
|
||||
@@ -581,9 +593,13 @@ type BackgroundFill struct {
|
||||
type BackgroundTypeType string
|
||||
|
||||
const (
|
||||
BackgroundTypeFillType BackgroundTypeType = "fill"
|
||||
// BackgroundTypeFillType identifies a generated fill.
|
||||
BackgroundTypeFillType BackgroundTypeType = "fill"
|
||||
// BackgroundTypeWallpaperType identifies a wallpaper.
|
||||
BackgroundTypeWallpaperType BackgroundTypeType = "wallpaper"
|
||||
BackgroundTypePatternType BackgroundTypeType = "pattern"
|
||||
// BackgroundTypePatternType identifies a pattern.
|
||||
BackgroundTypePatternType BackgroundTypeType = "pattern"
|
||||
// BackgroundTypeChatThemeType identifies a chat theme.
|
||||
BackgroundTypeChatThemeType BackgroundTypeType = "chat_theme"
|
||||
)
|
||||
|
||||
@@ -604,3 +620,29 @@ type BackgroundType struct {
|
||||
|
||||
ThemeName string `json:"theme_name,omitempty"`
|
||||
}
|
||||
|
||||
// BotSubscriptionState identifies the state of a user's subscription to the bot.
|
||||
//
|
||||
// Since: Bot API 10.2
|
||||
type BotSubscriptionState string
|
||||
|
||||
const (
|
||||
// BotSubscriptionCanceledState indicates that the user canceled the subscription.
|
||||
BotSubscriptionCanceledState BotSubscriptionState = "canceled"
|
||||
// BotSubscriptionActiveState indicates that the user re-enabled the subscription.
|
||||
BotSubscriptionActiveState BotSubscriptionState = "active"
|
||||
// BotSubscriptionFailedState indicates that subscription payment failed.
|
||||
BotSubscriptionFailedState BotSubscriptionState = "failed"
|
||||
)
|
||||
|
||||
// BotSubscriptionUpdated describes a change to a user's payment subscription to the bot.
|
||||
//
|
||||
// Since: Bot API 10.2
|
||||
type BotSubscriptionUpdated struct {
|
||||
// User contains the user associated with the value.
|
||||
User User `json:"user"`
|
||||
// InvoicePayload contains the bot-defined subscription invoice payload.
|
||||
InvoicePayload string `json:"invoice_payload"`
|
||||
// State is the new subscription state.
|
||||
State BotSubscriptionState `json:"state"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user