Skip to content

Commit 36756d9

Browse files
authored
Merge pull request #41 from OvyFlash/bot-api-7.10
BotAPI 7.10 implementation
2 parents 7af9c32 + 5fd4591 commit 36756d9

File tree

2 files changed

+52
-2
lines changed

2 files changed

+52
-2
lines changed

configs.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ const (
9696
// UpdateTypePreCheckoutQuery is new incoming pre-checkout query. Contains full information about checkout
9797
UpdateTypePreCheckoutQuery = "pre_checkout_query"
9898

99+
// UpdateTypePurchasedPaidMedia is a user purchased paid media with a non-empty payload
100+
// sent by the bot in a non-channel chat
101+
UpdateTypePurchasedPaidMedia = "purchased_paid_media"
102+
99103
// UpdateTypePoll is new poll state. Bots receive only updates about stopped polls and polls
100104
// which are sent by the bot
101105
UpdateTypePoll = "poll"
@@ -559,7 +563,7 @@ func (config DocumentConfig) params() (Params, error) {
559563
if err != nil {
560564
return params, err
561565
}
562-
566+
563567
params.AddNonEmpty("caption", config.Caption)
564568
params.AddNonEmpty("parse_mode", config.ParseMode)
565569
params.AddBool("disable_content_type_detection", config.DisableContentTypeDetection)
@@ -774,6 +778,7 @@ type PaidMediaConfig struct {
774778
BaseChat
775779
StarCount int64
776780
Media []InputPaidMedia
781+
Payload string // optional
777782
Caption string // optional
778783
ParseMode string // optional
779784
CaptionEntities []MessageEntity // optional
@@ -787,6 +792,7 @@ func (config PaidMediaConfig) params() (Params, error) {
787792
}
788793

789794
params.AddNonZero64("star_count", config.StarCount)
795+
params.AddNonEmpty("payload", config.Payload)
790796
params.AddNonEmpty("caption", config.Caption)
791797
params.AddNonEmpty("parse_mode", config.ParseMode)
792798
params.AddBool("show_caption_above_media", config.ShowCaptionAboveMedia)

types.go

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ type Update struct {
114114
//
115115
// optional
116116
PreCheckoutQuery *PreCheckoutQuery `json:"pre_checkout_query,omitempty"`
117+
// PurchasedPaidMedia is user purchased paid media with a non-empty
118+
// payload sent by the bot in a non-channel chat
119+
//
120+
// optional
121+
PurchasedPaidMedia *PaidMediaPurchased `json:"purchased_paid_media,omitempty"`
117122
// Pool new poll state. Bots receive only updates about stopped polls and
118123
// polls, which are sent by the bot
119124
//
@@ -2032,7 +2037,14 @@ type VideoChatParticipantsInvited struct {
20322037
}
20332038

20342039
// This object represents a service message about the creation of a scheduled giveaway. Currently holds no information.
2035-
type GiveawayCreated struct{}
2040+
type GiveawayCreated struct {
2041+
// PrizeStarCount is the number of Telegram Stars to be split
2042+
// between giveaway winners;
2043+
// for Telegram Star giveaways only
2044+
//
2045+
// optional
2046+
PrizeStarCount int `json:"prize_star_count,omitempty"`
2047+
}
20362048

20372049
// Giveaway represents a message about a scheduled giveaway.
20382050
type Giveaway struct {
@@ -2063,6 +2075,12 @@ type Giveaway struct {
20632075
//
20642076
// optional
20652077
CountryCodes []string `json:"country_codes,omitempty"`
2078+
// PrizeStarCount is the number of Telegram Stars to be split
2079+
// between giveaway winners;
2080+
// for Telegram Star giveaways only
2081+
//
2082+
// optional
2083+
PrizeStarCount int `json:"prize_star_count,omitempty"`
20662084
// PremiumSubscriptionMonthCount the number of months the Telegram Premium
20672085
// subscription won from the giveaway will be active for
20682086
//
@@ -2089,6 +2107,12 @@ type GiveawayWinners struct {
20892107
//
20902108
// optional
20912109
AdditionalChatCount int `json:"additional_chat_count,omitempty"`
2110+
// PrizeStarCount is the number of Telegram Stars to be split
2111+
// between giveaway winners;
2112+
// for Telegram Star giveaways only
2113+
//
2114+
// optional
2115+
PrizeStarCount int `json:"prize_star_count,omitempty"`
20922116
// PremiumSubscriptionMonthCount the number of months the Telegram Premium
20932117
// subscription won from the giveaway will be active for
20942118
//
@@ -2125,6 +2149,11 @@ type GiveawayCompleted struct {
21252149
//
21262150
// optional
21272151
GiveawayMessage *Message `json:"giveaway_message,omitempty"`
2152+
// IsStarGiveaway True, if the giveaway is a Telegram Star giveaway.
2153+
// Otherwise, currently, the giveaway is a Telegram Premium giveaway.
2154+
//
2155+
// optional
2156+
IsStarGiveaway bool `json:"is_star_giveaway,omitempty"`
21282157
}
21292158

21302159
// LinkPreviewOptions describes the options used for link preview generation.
@@ -3261,6 +3290,13 @@ type ChatBoostSource struct {
32613290
// Is an identifier of a message in the chat with the giveaway;
32623291
// the message could have been deleted already. May be 0 if the message isn't sent yet.
32633292
GiveawayMessageID int `json:"giveaway_message_id,omitempty"`
3293+
// PrizeStarCount "giveaway" only.
3294+
// The number of Telegram Stars to be split
3295+
// between giveaway winners;
3296+
// for Telegram Star giveaways only
3297+
//
3298+
// optional
3299+
PrizeStarCount int `json:"prize_star_count,omitempty"`
32643300
// IsUnclaimed "giveaway" only.
32653301
// True, if the giveaway was completed, but there was no user to win the prize
32663302
//
@@ -5045,6 +5081,14 @@ type PreCheckoutQuery struct {
50455081
OrderInfo *OrderInfo `json:"order_info,omitempty"`
50465082
}
50475083

5084+
// PaidMediaPurchased contains information about a paid media purchase.
5085+
type PaidMediaPurchased struct {
5086+
// From is the user who purchased the media
5087+
From User `json:"from"`
5088+
// PaidMediaPayload bot-specified paid media payload
5089+
PaidMediaPayload string `json:"paid_media_payload"`
5090+
}
5091+
50485092
// RevenueWithdrawalState describes the state of a revenue withdrawal operation.
50495093
// Currently, it can be one of
50505094
// - RevenueWithdrawalStatePending

0 commit comments

Comments
 (0)