Skip to content

Commit 4350cc4

Browse files
committed
fix: unwraps PaidMediaConfig to allow paid media in MediaGroupConfig
1 parent 3f2ca0c commit 4350cc4

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

configs.go

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ func (config DocumentConfig) files() []RequestFile {
597597

598598
// StickerConfig contains information about a SendSticker request.
599599
type StickerConfig struct {
600-
//Emoji associated with the sticker; only for just uploaded stickers
600+
// Emoji associated with the sticker; only for just uploaded stickers
601601
Emoji string
602602
BaseFile
603603
}
@@ -904,7 +904,7 @@ type EditMessageLiveLocationConfig struct {
904904
BaseEdit
905905
Latitude float64 // required
906906
Longitude float64 // required
907-
LivePeriod int //optional
907+
LivePeriod int // optional
908908
HorizontalAccuracy float64 // optional
909909
Heading int // optional
910910
ProximityAlertRadius int // optional
@@ -1406,7 +1406,7 @@ func (config DeleteWebhookConfig) params() (Params, error) {
14061406

14071407
// InlineQueryResultsButton represents a button to be shown above inline query results. You must use exactly one of the optional fields.
14081408
type InlineQueryResultsButton struct {
1409-
//Label text on the button
1409+
// Label text on the button
14101410
Text string `json:"text"`
14111411
//Description of the Web App that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method switchInlineQuery inside the Web App.
14121412
//
@@ -2056,12 +2056,12 @@ func (config InvoiceConfig) method() string {
20562056

20572057
// InvoiceLinkConfig contains information for createInvoiceLink method
20582058
type InvoiceLinkConfig struct {
2059-
Title string //Required
2060-
Description string //Required
2061-
Payload string //Required
2062-
ProviderToken string //Required
2063-
Currency string //Required
2064-
Prices []LabeledPrice //Required
2059+
Title string // Required
2060+
Description string // Required
2061+
Payload string // Required
2062+
ProviderToken string // Required
2063+
Currency string // Required
2064+
Prices []LabeledPrice // Required
20652065
MaxTipAmount int
20662066
SuggestedTipAmounts []int
20672067
ProviderData string
@@ -2180,8 +2180,8 @@ func (config GetStarTransactionsConfig) params() (Params, error) {
21802180
// RefundStarPaymentConfig refunds a successful payment in Telegram Stars.
21812181
// Returns True on success.
21822182
type RefundStarPaymentConfig struct {
2183-
UserID int64 //required
2184-
TelegramPaymentChargeID string //required
2183+
UserID int64 // required
2184+
TelegramPaymentChargeID string // required
21852185
}
21862186

21872187
func (config RefundStarPaymentConfig) method() string {
@@ -2410,7 +2410,7 @@ type NewStickerSetConfig struct {
24102410
Title string
24112411
Stickers []InputSticker
24122412
StickerType string
2413-
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
2413+
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
24142414
}
24152415

24162416
func (config NewStickerSetConfig) method() string {
@@ -3099,7 +3099,7 @@ func (config GetMyDescriptionConfig) params() (Params, error) {
30993099
type SetMyDescriptionConfig struct {
31003100
// Pass an empty string to remove the dedicated description for the given language.
31013101
Description string
3102-
//If empty, the description will be applied to all users for whose language there is no dedicated description.
3102+
// If empty, the description will be applied to all users for whose language there is no dedicated description.
31033103
LanguageCode string
31043104
}
31053105

@@ -3301,6 +3301,11 @@ func prepareInputMediaParam(inputMedia interface{}, idx int) interface{} {
33013301
func prepareInputMediaFile(inputMedia interface{}, idx int) []RequestFile {
33023302
files := []RequestFile{}
33033303

3304+
// Unwrap the PaidMediaConfig to get the media
3305+
if paidMedia, ok := inputMedia.(PaidMediaConfig); ok {
3306+
inputMedia = paidMedia.Media
3307+
}
3308+
33043309
switch m := inputMedia.(type) {
33053310
case InputMediaPhoto:
33063311
if m.Media.NeedsUpload() {

0 commit comments

Comments
 (0)