From 708646ba4509d2a316a028ea47cf9d60b1cbc46d Mon Sep 17 00:00:00 2001 From: Apolisk Date: Fri, 5 Jul 2024 12:40:28 +0300 Subject: [PATCH] Bot API 7.6 --- chat.go | 1 + context.go | 7 +++++++ media.go | 24 ++++++++++++++++++++++++ message.go | 6 ++++++ 4 files changed, 38 insertions(+) diff --git a/chat.go b/chat.go index 0426739d..d0eb5edb 100644 --- a/chat.go +++ b/chat.go @@ -73,6 +73,7 @@ type Chat struct { ProfileBackgroundEmojiID string `json:"profile_background_custom_emoji_id"` HasVisibleHistory bool `json:"has_visible_history"` UnrestrictBoosts int `json:"unrestrict_boost_count"` + CanSendPaidMedia bool `json:"can_send_paid_media"` } // Recipient returns chat ID (see Recipient interface). diff --git a/context.go b/context.go index f5c49656..2d433733 100644 --- a/context.go +++ b/context.go @@ -169,6 +169,9 @@ type Context interface { // Set saves data in the context. Set(key string, val interface{}) + + // Payment returns payment instance. + Payment() *Payment } // nativeContext is a native implementation of the Context interface. @@ -538,3 +541,7 @@ func (c *nativeContext) Get(key string) interface{} { defer c.lock.RUnlock() return c.store[key] } + +func (c *nativeContext) Payment() *Payment { + return c.u.Message.Payment +} diff --git a/media.go b/media.go index bdce5557..4dbbf1e3 100644 --- a/media.go +++ b/media.go @@ -32,6 +32,30 @@ type InputMedia struct { HasSpoiler bool `json:"is_spoiler,omitempty"` } +type InputPaidMedia struct { + Type string `json:"type"` + Media string `json:"media"` + Thumbnail string `json:"thumbnail,omitempty"` + Width int `json:"width,omitempty"` + Height int `json:"height,omitempty"` + Duration int `json:"duration,omitempty"` + SupportsStreaming bool `json:"supports_streaming"` +} + +type PaidMediaInfo struct { + StarCount int `json:"star_count"` + PaidMedia []PaidMedia `json:"paid_media"` +} + +type PaidMedia struct { + Type string `json:"type"` + Photo []photoSize `json:"photo,omitempty"` + Video Video `json:"video,omitempty"` + Width int `json:"width,omitempty"` + Height int `json:"height,omitempty"` + Duration int `json:"duration,omitempty"` +} + // Inputtable is a generic type for all kinds of media you // can put into an album. type Inputtable interface { diff --git a/message.go b/message.go index d7d239bc..3943a112 100644 --- a/message.go +++ b/message.go @@ -121,6 +121,9 @@ type Message struct { // For a general file, information about it. Document *Document `json:"document"` + // Message contains paid media; information about the paid media + PaidMedia PaidMediaInfo `json:"paid_media"` + // For a photo, all available sizes (thumbnails). Photo *Photo `json:"photo"` @@ -639,6 +642,9 @@ type ExternalReplyInfo struct { // (Optional) Message is a general file, information about the file. Document *Document `json:"document"` + // Message contains paid media; information about the paid media + PaidMedia PaidMediaInfo `json:"paid_media"` + // (Optional) Message is a photo, available sizes of the photo. Photo []Photo `json:"photo"`