diff --git a/CHANGELOG.md b/CHANGELOG.md index 33c2ee7..0d09bb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v1.3.2 (2024-05-29) + +- support API v7.4 + ## v1.3.1 (2024-05-22) - add Marshal functions for struct with many types diff --git a/README.md b/README.md index 39c23cb..3c8d061 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ > [Telegram Group](https://t.me/gotelegrambotui) -> Supports Bot API version: [7.3](https://core.telegram.org/bots/api#may-6-2024) from May 6, 2024 +> Supports Bot API version: [7.4](https://core.telegram.org/bots/api#may-28-2024) from May 28, 2024 It's a Go zero-dependencies telegram bot framework diff --git a/methods.go b/methods.go index dc72732..2f88280 100644 --- a/methods.go +++ b/methods.go @@ -811,6 +811,13 @@ func (b *Bot) AnswerPreCheckoutQuery(ctx context.Context, params *AnswerPreCheck return result, err } +// RefundStarPayment https://core.telegram.org/bots/api#refundstarpayment +func (b *Bot) RefundStarPayment(ctx context.Context, params *RefundStarPaymentParams) (bool, error) { + var result bool + err := b.rawRequest(ctx, "refundStarPayment", params, &result) + return result, err +} + // SetPassportDataErrors https://core.telegram.org/bots/api#setpassportdataerrors func (b *Bot) SetPassportDataErrors(ctx context.Context, params *SetPassportDataErrorsParams) (bool, error) { var result bool diff --git a/methods_params.go b/methods_params.go index 24c1893..d33acd6 100644 --- a/methods_params.go +++ b/methods_params.go @@ -29,6 +29,7 @@ type SendMessageParams struct { LinkPreviewOptions *models.LinkPreviewOptions `json:"link_preview_options,omitempty"` DisableNotification bool `json:"disable_notification,omitempty"` ProtectContent bool `json:"protect_content,omitempty"` + MessageEffectID string `json:"message_effect_id,omitempty"` ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` } @@ -55,17 +56,18 @@ type ForwardMessagesParams struct { // CopyMessageParams https://core.telegram.org/bots/api#copymessage type CopyMessageParams struct { - ChatID any `json:"chat_id"` - MessageThreadID int `json:"message_thread_id,omitempty"` - FromChatID string `json:"from_chat_id"` - MessageID int `json:"message_id"` - Caption string `json:"caption,omitempty"` - ParseMode models.ParseMode `json:"parse_mode,omitempty"` - CaptionEntities []models.MessageEntity `json:"caption_entities,omitempty"` - DisableNotification bool `json:"disable_notification,omitempty"` - ProtectContent bool `json:"protect_content,omitempty"` - ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` - ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` + ChatID any `json:"chat_id"` + MessageThreadID int `json:"message_thread_id,omitempty"` + FromChatID string `json:"from_chat_id"` + MessageID int `json:"message_id"` + Caption string `json:"caption,omitempty"` + ParseMode models.ParseMode `json:"parse_mode,omitempty"` + CaptionEntities []models.MessageEntity `json:"caption_entities,omitempty"` + ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"` + DisableNotification bool `json:"disable_notification,omitempty"` + ProtectContent bool `json:"protect_content,omitempty"` + ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` + ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` } // CopyMessagesParams https://core.telegram.org/bots/api#copymessages @@ -81,18 +83,20 @@ type CopyMessagesParams struct { // SendPhotoParams https://core.telegram.org/bots/api#sendphoto type SendPhotoParams struct { - BusinessConnectionID string `json:"business_connection_id,omitempty"` - ChatID any `json:"chat_id"` - MessageThreadID int `json:"message_thread_id,omitempty"` - Photo models.InputFile `json:"photo"` - Caption string `json:"caption,omitempty"` - ParseMode models.ParseMode `json:"parse_mode,omitempty"` - CaptionEntities []models.MessageEntity `json:"caption_entities,omitempty"` - HasSpoiler bool `json:"has_spoiler,omitempty"` - DisableNotification bool `json:"disable_notification,omitempty"` - ProtectContent bool `json:"protect_content,omitempty"` - ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` - ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` + BusinessConnectionID string `json:"business_connection_id,omitempty"` + ChatID any `json:"chat_id"` + MessageThreadID int `json:"message_thread_id,omitempty"` + Photo models.InputFile `json:"photo"` + Caption string `json:"caption,omitempty"` + ParseMode models.ParseMode `json:"parse_mode,omitempty"` + CaptionEntities []models.MessageEntity `json:"caption_entities,omitempty"` + ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"` + HasSpoiler bool `json:"has_spoiler,omitempty"` + DisableNotification bool `json:"disable_notification,omitempty"` + ProtectContent bool `json:"protect_content,omitempty"` + MessageEffectID string `json:"message_effect_id,omitempty"` + ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` + ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` } // SendAudioParams https://core.telegram.org/bots/api#sendaudio @@ -110,6 +114,7 @@ type SendAudioParams struct { Thumbnail models.InputFile `json:"thumbnail,omitempty"` DisableNotification bool `json:"disable_notification,omitempty"` ProtectContent bool `json:"protect_content,omitempty"` + MessageEffectID string `json:"message_effect_id,omitempty"` ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` } @@ -127,49 +132,54 @@ type SendDocumentParams struct { DisableContentTypeDetection bool `json:"disable_content_type_detection,omitempty"` DisableNotification bool `json:"disable_notification,omitempty"` ProtectContent bool `json:"protect_content,omitempty"` + MessageEffectID string `json:"message_effect_id,omitempty"` ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` } // SendVideoParams https://core.telegram.org/bots/api#sendvideo type SendVideoParams struct { - BusinessConnectionID string `json:"business_connection_id,omitempty"` - ChatID any `json:"chat_id"` - MessageThreadID int `json:"message_thread_id,omitempty"` - Video models.InputFile `json:"video"` - Duration int `json:"duration,omitempty"` - Width int `json:"width,omitempty"` - Height int `json:"height,omitempty"` - Thumbnail models.InputFile `json:"thumbnail,omitempty"` - Caption string `json:"caption,omitempty"` - ParseMode models.ParseMode `json:"parse_mode,omitempty"` - CaptionEntities []models.MessageEntity `json:"caption_entities,omitempty"` - HasSpoiler bool `json:"has_spoiler,omitempty"` - SupportsStreaming bool `json:"supports_streaming,omitempty"` - DisableNotification bool `json:"disable_notification,omitempty"` - ProtectContent bool `json:"protect_content,omitempty"` - ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` - ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` + BusinessConnectionID string `json:"business_connection_id,omitempty"` + ChatID any `json:"chat_id"` + MessageThreadID int `json:"message_thread_id,omitempty"` + Video models.InputFile `json:"video"` + Duration int `json:"duration,omitempty"` + Width int `json:"width,omitempty"` + Height int `json:"height,omitempty"` + Thumbnail models.InputFile `json:"thumbnail,omitempty"` + Caption string `json:"caption,omitempty"` + ParseMode models.ParseMode `json:"parse_mode,omitempty"` + CaptionEntities []models.MessageEntity `json:"caption_entities,omitempty"` + ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"` + HasSpoiler bool `json:"has_spoiler,omitempty"` + SupportsStreaming bool `json:"supports_streaming,omitempty"` + DisableNotification bool `json:"disable_notification,omitempty"` + ProtectContent bool `json:"protect_content,omitempty"` + MessageEffectID string `json:"message_effect_id,omitempty"` + ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` + ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` } // SendAnimationParams https://core.telegram.org/bots/api#sendanimation type SendAnimationParams struct { - BusinessConnectionID string `json:"business_connection_id,omitempty"` - ChatID any `json:"chat_id"` - MessageThreadID int `json:"message_thread_id,omitempty"` - Animation models.InputFile `json:"animation"` - Duration int `json:"duration,omitempty"` - Width int `json:"width,omitempty"` - Height int `json:"height,omitempty"` - Thumbnail models.InputFile `json:"thumbnail,omitempty"` - Caption string `json:"caption,omitempty"` - ParseMode models.ParseMode `json:"parse_mode,omitempty"` - CaptionEntities []models.MessageEntity `json:"caption_entities,omitempty"` - HasSpoiler bool `json:"has_spoiler,omitempty"` - DisableNotification bool `json:"disable_notification,omitempty"` - ProtectContent bool `json:"protect_content,omitempty"` - ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` - ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` + BusinessConnectionID string `json:"business_connection_id,omitempty"` + ChatID any `json:"chat_id"` + MessageThreadID int `json:"message_thread_id,omitempty"` + Animation models.InputFile `json:"animation"` + Duration int `json:"duration,omitempty"` + Width int `json:"width,omitempty"` + Height int `json:"height,omitempty"` + Thumbnail models.InputFile `json:"thumbnail,omitempty"` + Caption string `json:"caption,omitempty"` + ParseMode models.ParseMode `json:"parse_mode,omitempty"` + CaptionEntities []models.MessageEntity `json:"caption_entities,omitempty"` + ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"` + HasSpoiler bool `json:"has_spoiler,omitempty"` + DisableNotification bool `json:"disable_notification,omitempty"` + ProtectContent bool `json:"protect_content,omitempty"` + MessageEffectID string `json:"message_effect_id,omitempty"` + ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` + ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` } // SendVoiceParams https://core.telegram.org/bots/api#sendvoice @@ -184,6 +194,7 @@ type SendVoiceParams struct { Duration int `json:"duration,omitempty"` DisableNotification bool `json:"disable_notification,omitempty"` ProtectContent bool `json:"protect_content,omitempty"` + MessageEffectID string `json:"message_effect_id,omitempty"` ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` } @@ -199,6 +210,7 @@ type SendVideoNoteParams struct { Thumbnail models.InputFile `json:"thumbnail,omitempty"` DisableNotification bool `json:"disable_notification,omitempty"` ProtectContent bool `json:"protect_content,omitempty"` + MessageEffectID string `json:"message_effect_id,omitempty"` ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` } @@ -211,6 +223,7 @@ type SendMediaGroupParams struct { Media []models.InputMedia `json:"media"` DisableNotification bool `json:"disable_notification,omitempty"` ProtectContent bool `json:"protect_content,omitempty"` + MessageEffectID string `json:"message_effect_id,omitempty"` ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` } @@ -227,6 +240,7 @@ type SendLocationParams struct { ProximityAlertRadius int `json:"proximity_alert_radius,omitempty"` DisableNotification bool `json:"disable_notification,omitempty"` ProtectContent bool `json:"protect_content,omitempty"` + MessageEffectID string `json:"message_effect_id,omitempty"` ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` } @@ -266,6 +280,7 @@ type SendVenueParams struct { GooglePlaceType string `json:"google_place_type,omitempty"` DisableNotification bool `json:"disable_notification,omitempty"` ProtectContent bool `json:"protect_content,omitempty"` + MessageEffectID string `json:"message_effect_id,omitempty"` ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` } @@ -281,6 +296,7 @@ type SendContactParams struct { VCard string `json:"vcard,omitempty"` DisableNotification bool `json:"disable_notification,omitempty"` ProtectContent bool `json:"protect_content,omitempty"` + MessageEffectID string `json:"message_effect_id,omitempty"` ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` } @@ -306,6 +322,7 @@ type SendPollParams struct { IsClosed bool `json:"is_closed,omitempty"` DisableNotification bool `json:"disable_notification,omitempty"` ProtectContent bool `json:"protect_content,omitempty"` + MessageEffectID string `json:"message_effect_id,omitempty"` ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` } @@ -318,6 +335,7 @@ type SendDiceParams struct { Emoji string `json:"emoji,omitempty"` DisableNotification bool `json:"disable_notification,omitempty"` ProtectContent bool `json:"protect_content,omitempty"` + MessageEffectID string `json:"message_effect_id,omitempty"` ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` } @@ -664,6 +682,7 @@ type EditMessageCaptionParams struct { Caption string `json:"caption,omitempty"` ParseMode models.ParseMode `json:"parse_mode,omitempty"` CaptionEntities []models.MessageEntity `json:"caption_entities,omitempty"` + ShowCaptionAboveMedia bool `json:"k,omitempty"` DisableWebPagePreview bool `json:"disable_web_page_preview,omitempty"` ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` } @@ -710,6 +729,7 @@ type SendStickerParams struct { Emoji string `json:"emoji,omitempty"` DisableNotification bool `json:"disable_notification,omitempty"` ProtectContent bool `json:"protect_content,omitempty"` + MessageEffectID string `json:"message_effect_id,omitempty"` ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` } @@ -815,7 +835,7 @@ type SendInvoiceParams struct { Title string `json:"title"` Description string `json:"description"` Payload string `json:"payload"` - ProviderToken string `json:"provider_token"` + ProviderToken string `json:"provider_token,omitempty"` Currency string `json:"currency"` Prices []models.LabeledPrice `json:"prices"` MaxTipAmount int `json:"max_tip_amount,omitempty"` @@ -835,6 +855,7 @@ type SendInvoiceParams struct { IsFlexible bool `json:"is_flexible,omitempty"` DisableNotification bool `json:"disable_notification,omitempty"` ProtectContent bool `json:"protect_content,omitempty"` + MessageEffectID string `json:"message_effect_id,omitempty"` ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` } @@ -843,7 +864,7 @@ type CreateInvoiceLinkParams struct { Title string `json:"title"` Description string `json:"description"` Payload string `json:"payload"` - ProviderToken string `json:"provider_token"` + ProviderToken string `json:"provider_token,omitempty"` Currency string `json:"currency"` Prices []models.LabeledPrice `json:"prices"` MaxTipAmount int `json:"max_tip_amount,omitempty"` @@ -875,6 +896,11 @@ type AnswerPreCheckoutQueryParams struct { ErrorMessage string `json:"error_message,omitempty"` } +type RefundStarPaymentParams struct { + UserID int64 `json:"user_id"` + TelegramPaymentChargeID string `json:"telegram_payment_charge_id"` +} + type SetPassportDataErrorsParams struct { UserID int64 `json:"user_id"` Errors []models.PassportElementError `json:"errors"` @@ -888,6 +914,7 @@ type SendGameParams struct { GameShorName string `json:"game_short_name"` DisableNotification bool `json:"disable_notification,omitempty"` ProtectContent bool `json:"protect_content,omitempty"` + MessageEffectID string `json:"message_effect_id,omitempty"` ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` } diff --git a/models/chat_action.go b/models/chat_action.go index 1214925..e8d0001 100644 --- a/models/chat_action.go +++ b/models/chat_action.go @@ -4,14 +4,14 @@ type ChatAction string const ( ChatActionTyping ChatAction = "typing" - ChatActionUploadPhoto = "upload_photo" - ChatActionRecordVideo = "record_video" - ChatActionUploadVideo = "upload_video" - ChatActionRecordVoice = "record_voice" - ChatActionUploadVoice = "upload_voice" - ChatActionUploadDocument = "upload_document" - ChatActionChooseSticker = "choose_sticker" - ChatActionFindLocation = "find_location" - ChatActionRecordVideoNote = "record_video_note" - ChatActionUploadVideoNote = "upload_video_note" + ChatActionUploadPhoto ChatAction = "upload_photo" + ChatActionRecordVideo ChatAction = "record_video" + ChatActionUploadVideo ChatAction = "upload_video" + ChatActionRecordVoice ChatAction = "record_voice" + ChatActionUploadVoice ChatAction = "upload_voice" + ChatActionUploadDocument ChatAction = "upload_document" + ChatActionChooseSticker ChatAction = "choose_sticker" + ChatActionFindLocation ChatAction = "find_location" + ChatActionRecordVideoNote ChatAction = "record_video_note" + ChatActionUploadVideoNote ChatAction = "upload_video_note" ) diff --git a/models/inline_query.go b/models/inline_query.go index f1c2f7f..6fa256e 100644 --- a/models/inline_query.go +++ b/models/inline_query.go @@ -53,7 +53,7 @@ type InlineQueryResultArticle struct { ThumbnailHeight int `json:"thumbnail_height,omitempty"` } -func (InlineQueryResultArticle) inlineQueryResultTag() {} +func (*InlineQueryResultArticle) inlineQueryResultTag() {} func (m *InlineQueryResultArticle) MarshalCustom() ([]byte, error) { ret := struct { @@ -69,21 +69,22 @@ func (m *InlineQueryResultArticle) MarshalCustom() ([]byte, error) { // InlineQueryResultPhoto https://core.telegram.org/bots/api#inlinequeryresultphoto type InlineQueryResultPhoto struct { - ID string `json:"id"` - PhotoURL string `json:"photo_url"` - ThumbnailURL string `json:"thumbnail_url"` - PhotoWidth int `json:"photo_width,omitempty"` - PhotoHeight int `json:"photo_height,omitempty"` - Title string `json:"title,omitempty"` - Description string `json:"description,omitempty"` - Caption string `json:"caption,omitempty"` - ParseMode ParseMode `json:"parse_mode,omitempty"` - CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` - ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"` - InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` -} - -func (InlineQueryResultPhoto) inlineQueryResultTag() {} + ID string `json:"id"` + PhotoURL string `json:"photo_url"` + ThumbnailURL string `json:"thumbnail_url"` + PhotoWidth int `json:"photo_width,omitempty"` + PhotoHeight int `json:"photo_height,omitempty"` + Title string `json:"title,omitempty"` + Description string `json:"description,omitempty"` + Caption string `json:"caption,omitempty"` + ParseMode ParseMode `json:"parse_mode,omitempty"` + CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` + ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"` + ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"` + InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` +} + +func (*InlineQueryResultPhoto) inlineQueryResultTag() {} func (m *InlineQueryResultPhoto) MarshalCustom() ([]byte, error) { ret := struct { @@ -99,22 +100,23 @@ func (m *InlineQueryResultPhoto) MarshalCustom() ([]byte, error) { // InlineQueryResultGif https://core.telegram.org/bots/api#inlinequeryresultgif type InlineQueryResultGif struct { - ID string `json:"id"` - GifURL string `json:"gif_url"` - GifWidth int `json:"gif_width,omitempty"` - GifHeight int `json:"gif_height,omitempty"` - GifDuration int `json:"gif_duration,omitempty"` - ThumbnailURL string `json:"thumbnail_url"` - ThumbnailMimeType string `json:"thumbnail_mime_type,omitempty"` - Title string `json:"title,omitempty"` - Caption string `json:"caption,omitempty"` - ParseMode ParseMode `json:"parse_mode,omitempty"` - CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` - ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"` - InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` -} - -func (InlineQueryResultGif) inlineQueryResultTag() {} + ID string `json:"id"` + GifURL string `json:"gif_url"` + GifWidth int `json:"gif_width,omitempty"` + GifHeight int `json:"gif_height,omitempty"` + GifDuration int `json:"gif_duration,omitempty"` + ThumbnailURL string `json:"thumbnail_url"` + ThumbnailMimeType string `json:"thumbnail_mime_type,omitempty"` + Title string `json:"title,omitempty"` + Caption string `json:"caption,omitempty"` + ParseMode ParseMode `json:"parse_mode,omitempty"` + CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` + ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"` + ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"` + InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` +} + +func (*InlineQueryResultGif) inlineQueryResultTag() {} func (m *InlineQueryResultGif) MarshalCustom() ([]byte, error) { ret := struct { @@ -130,22 +132,23 @@ func (m *InlineQueryResultGif) MarshalCustom() ([]byte, error) { // InlineQueryResultMpeg4Gif https://core.telegram.org/bots/api#inlinequeryresultmpeg4gif type InlineQueryResultMpeg4Gif struct { - ID string `json:"id"` - Mpeg4URL string `json:"mpeg4_url"` - Mpeg4Width int `json:"mpeg4_width,omitempty"` - Mpeg4Height int `json:"mpeg4_height,omitempty"` - Mpeg4Duration int `json:"mpeg4_duration,omitempty"` - ThumbnailURL string `json:"thumbnail_url"` - ThumbnailMimeType string `json:"thumbnail_mime_type,omitempty"` - Title string `json:"title,omitempty"` - Caption string `json:"caption,omitempty"` - ParseMode ParseMode `json:"parse_mode,omitempty"` - CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` - ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"` - InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` -} - -func (InlineQueryResultMpeg4Gif) inlineQueryResultTag() {} + ID string `json:"id"` + Mpeg4URL string `json:"mpeg4_url"` + Mpeg4Width int `json:"mpeg4_width,omitempty"` + Mpeg4Height int `json:"mpeg4_height,omitempty"` + Mpeg4Duration int `json:"mpeg4_duration,omitempty"` + ThumbnailURL string `json:"thumbnail_url"` + ThumbnailMimeType string `json:"thumbnail_mime_type,omitempty"` + Title string `json:"title,omitempty"` + Caption string `json:"caption,omitempty"` + ParseMode ParseMode `json:"parse_mode,omitempty"` + CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` + ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"` + ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"` + InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` +} + +func (*InlineQueryResultMpeg4Gif) inlineQueryResultTag() {} func (m *InlineQueryResultMpeg4Gif) MarshalCustom() ([]byte, error) { ret := struct { @@ -161,23 +164,24 @@ func (m *InlineQueryResultMpeg4Gif) MarshalCustom() ([]byte, error) { // InlineQueryResultVideo https://core.telegram.org/bots/api#inlinequeryresultvideo type InlineQueryResultVideo struct { - ID string `json:"id"` - VideoURL string `json:"video_url"` - MimeType string `json:"mime_type,omitempty"` - ThumbnailURL string `json:"thumbnail_url"` - Title string `json:"title,omitempty"` - Caption string `json:"caption,omitempty"` - ParseMode ParseMode `json:"parse_mode,omitempty"` - CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` - VideoWidth int `json:"video_width,omitempty"` - VideoHeight int `json:"video_height,omitempty"` - VideoDuration int `json:"video_duration,omitempty"` - Description string `json:"description,omitempty"` - ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"` - InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` -} - -func (InlineQueryResultVideo) inlineQueryResultTag() {} + ID string `json:"id"` + VideoURL string `json:"video_url"` + MimeType string `json:"mime_type,omitempty"` + ThumbnailURL string `json:"thumbnail_url"` + Title string `json:"title,omitempty"` + Caption string `json:"caption,omitempty"` + ParseMode ParseMode `json:"parse_mode,omitempty"` + CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` + ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"` + VideoWidth int `json:"video_width,omitempty"` + VideoHeight int `json:"video_height,omitempty"` + VideoDuration int `json:"video_duration,omitempty"` + Description string `json:"description,omitempty"` + ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"` + InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` +} + +func (*InlineQueryResultVideo) inlineQueryResultTag() {} func (m *InlineQueryResultVideo) MarshalCustom() ([]byte, error) { ret := struct { @@ -205,7 +209,7 @@ type InlineQueryResultAudio struct { InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` } -func (InlineQueryResultAudio) inlineQueryResultTag() {} +func (*InlineQueryResultAudio) inlineQueryResultTag() {} func (m *InlineQueryResultAudio) MarshalCustom() ([]byte, error) { ret := struct { @@ -232,7 +236,7 @@ type InlineQueryResultVoice struct { InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` } -func (InlineQueryResultVoice) inlineQueryResultTag() {} +func (*InlineQueryResultVoice) inlineQueryResultTag() {} func (m *InlineQueryResultVoice) MarshalCustom() ([]byte, error) { ret := struct { @@ -263,7 +267,7 @@ type InlineQueryResultDocument struct { ThumbnailHeight int `json:"thumbnail_height,omitempty"` } -func (InlineQueryResultDocument) inlineQueryResultTag() {} +func (*InlineQueryResultDocument) inlineQueryResultTag() {} func (m *InlineQueryResultDocument) MarshalCustom() ([]byte, error) { ret := struct { @@ -294,7 +298,7 @@ type InlineQueryResultLocation struct { ThumbnailHeight int `json:"thumbnail_height,omitempty"` } -func (InlineQueryResultLocation) inlineQueryResultTag() {} +func (*InlineQueryResultLocation) inlineQueryResultTag() {} func (m *InlineQueryResultLocation) MarshalCustom() ([]byte, error) { ret := struct { @@ -326,7 +330,7 @@ type InlineQueryResultVenue struct { ThumbnailHeight int `json:"thumbnail_height,omitempty"` } -func (InlineQueryResultVenue) inlineQueryResultTag() {} +func (*InlineQueryResultVenue) inlineQueryResultTag() {} func (m *InlineQueryResultVenue) MarshalCustom() ([]byte, error) { ret := struct { @@ -354,7 +358,7 @@ type InlineQueryResultContact struct { ThumbnailHeight int `json:"thumbnail_height,omitempty"` } -func (InlineQueryResultContact) inlineQueryResultTag() {} +func (*InlineQueryResultContact) inlineQueryResultTag() {} func (m *InlineQueryResultContact) MarshalCustom() ([]byte, error) { ret := struct { @@ -375,7 +379,7 @@ type InlineQueryResultGame struct { ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"` } -func (InlineQueryResultGame) inlineQueryResultTag() {} +func (*InlineQueryResultGame) inlineQueryResultTag() {} func (m *InlineQueryResultGame) MarshalCustom() ([]byte, error) { ret := struct { @@ -391,18 +395,19 @@ func (m *InlineQueryResultGame) MarshalCustom() ([]byte, error) { // InlineQueryResultCachedPhoto https://core.telegram.org/bots/api#inlinequeryresultcachedphoto type InlineQueryResultCachedPhoto struct { - ID string `json:"id"` - PhotoFileID string `json:"photo_file_id"` - Title string `json:"title,omitempty"` - Description string `json:"description,omitempty"` - Caption string `json:"caption,omitempty"` - ParseMode ParseMode `json:"parse_mode,omitempty"` - CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` - ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"` - InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` + ID string `json:"id"` + PhotoFileID string `json:"photo_file_id"` + Title string `json:"title,omitempty"` + Description string `json:"description,omitempty"` + Caption string `json:"caption,omitempty"` + ParseMode ParseMode `json:"parse_mode,omitempty"` + CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` + ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"` + ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"` + InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` } -func (InlineQueryResultCachedPhoto) inlineQueryResultTag() {} +func (*InlineQueryResultCachedPhoto) inlineQueryResultTag() {} func (m *InlineQueryResultCachedPhoto) MarshalCustom() ([]byte, error) { ret := struct { @@ -418,17 +423,18 @@ func (m *InlineQueryResultCachedPhoto) MarshalCustom() ([]byte, error) { // InlineQueryResultCachedGif https://core.telegram.org/bots/api#inlinequeryresultcachedgif type InlineQueryResultCachedGif struct { - ID string `json:"id"` - GifFileID string `json:"gif_file_id"` - Title string `json:"title,omitempty"` - Caption string `json:"caption,omitempty"` - ParseMode ParseMode `json:"parse_mode,omitempty"` - CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` - ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"` - InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` + ID string `json:"id"` + GifFileID string `json:"gif_file_id"` + Title string `json:"title,omitempty"` + Caption string `json:"caption,omitempty"` + ParseMode ParseMode `json:"parse_mode,omitempty"` + CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` + ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"` + ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"` + InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` } -func (InlineQueryResultCachedGif) inlineQueryResultTag() {} +func (*InlineQueryResultCachedGif) inlineQueryResultTag() {} func (m *InlineQueryResultCachedGif) MarshalCustom() ([]byte, error) { ret := struct { @@ -444,17 +450,18 @@ func (m *InlineQueryResultCachedGif) MarshalCustom() ([]byte, error) { // InlineQueryResultCachedMpeg4Gif https://core.telegram.org/bots/api#inlinequeryresultcachedmpeg4gif type InlineQueryResultCachedMpeg4Gif struct { - ID string `json:"id"` - Mpeg4FileID string `json:"mpeg4_file_id"` - Title string `json:"title,omitempty"` - Caption string `json:"caption,omitempty"` - ParseMode ParseMode `json:"parse_mode,omitempty"` - CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` - ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"` - InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` + ID string `json:"id"` + Mpeg4FileID string `json:"mpeg4_file_id"` + Title string `json:"title,omitempty"` + Caption string `json:"caption,omitempty"` + ParseMode ParseMode `json:"parse_mode,omitempty"` + CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` + ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"` + ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"` + InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` } -func (InlineQueryResultCachedMpeg4Gif) inlineQueryResultTag() {} +func (*InlineQueryResultCachedMpeg4Gif) inlineQueryResultTag() {} func (m *InlineQueryResultCachedMpeg4Gif) MarshalCustom() ([]byte, error) { ret := struct { @@ -476,7 +483,7 @@ type InlineQueryResultCachedSticker struct { InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` } -func (InlineQueryResultCachedSticker) inlineQueryResultTag() {} +func (*InlineQueryResultCachedSticker) inlineQueryResultTag() {} func (m *InlineQueryResultCachedSticker) MarshalCustom() ([]byte, error) { ret := struct { @@ -503,7 +510,7 @@ type InlineQueryResultCachedDocument struct { InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` } -func (InlineQueryResultCachedDocument) inlineQueryResultTag() {} +func (*InlineQueryResultCachedDocument) inlineQueryResultTag() {} func (m *InlineQueryResultCachedDocument) MarshalCustom() ([]byte, error) { ret := struct { @@ -519,18 +526,19 @@ func (m *InlineQueryResultCachedDocument) MarshalCustom() ([]byte, error) { // InlineQueryResultCachedVideo https://core.telegram.org/bots/api#inlinequeryresultcachedvideo type InlineQueryResultCachedVideo struct { - ID string `json:"id"` - VideoFileID string `json:"video_file_id"` - Title string `json:"title,omitempty"` - Description string `json:"description,omitempty"` - Caption string `json:"caption,omitempty"` - ParseMode ParseMode `json:"parse_mode,omitempty"` - CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` - ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"` - InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` + ID string `json:"id"` + VideoFileID string `json:"video_file_id"` + Title string `json:"title,omitempty"` + Description string `json:"description,omitempty"` + Caption string `json:"caption,omitempty"` + ParseMode ParseMode `json:"parse_mode,omitempty"` + CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` + ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"` + ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"` + InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` } -func (InlineQueryResultCachedVideo) inlineQueryResultTag() {} +func (*InlineQueryResultCachedVideo) inlineQueryResultTag() {} func (m *InlineQueryResultCachedVideo) MarshalCustom() ([]byte, error) { ret := struct { @@ -556,7 +564,7 @@ type InlineQueryResultCachedVoice struct { InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` } -func (InlineQueryResultCachedVoice) inlineQueryResultTag() {} +func (*InlineQueryResultCachedVoice) inlineQueryResultTag() {} func (m *InlineQueryResultCachedVoice) MarshalCustom() ([]byte, error) { ret := struct { @@ -581,7 +589,7 @@ type InlineQueryResultCachedAudio struct { InputMessageContent InputMessageContent `json:"input_message_content,omitempty"` } -func (InlineQueryResultCachedAudio) inlineQueryResultTag() {} +func (*InlineQueryResultCachedAudio) inlineQueryResultTag() {} func (m *InlineQueryResultCachedAudio) MarshalCustom() ([]byte, error) { ret := struct { @@ -657,7 +665,7 @@ type InputInvoiceMessageContent struct { Title string `json:"title"` Description string `json:"description"` Payload string `json:"payload"` - ProviderToken string `json:"provider_token"` + ProviderToken string `json:"provider_token,omitempty"` Currency string `json:"currency"` Prices []LabeledPrice `json:"prices"` MaxTipAmount int `json:"max_tip_amount,omitempty"` diff --git a/models/input_media.go b/models/input_media.go index 391dcdf..a1479e2 100644 --- a/models/input_media.go +++ b/models/input_media.go @@ -16,11 +16,12 @@ type InputMedia interface { // InputMediaPhoto https://core.telegram.org/bots/api#inputmediaphoto type InputMediaPhoto struct { - Media string `json:"media"` - Caption string `json:"caption,omitempty"` - ParseMode ParseMode `json:"parse_mode,omitempty"` - CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` - HasSpoiler bool `json:"has_spoiler,omitempty"` + Media string `json:"media"` + Caption string `json:"caption,omitempty"` + ParseMode ParseMode `json:"parse_mode,omitempty"` + CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` + ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"` + HasSpoiler bool `json:"has_spoiler,omitempty"` MediaAttachment io.Reader `json:"-"` } @@ -49,16 +50,17 @@ func (InputMediaPhoto) inputMediaTag() {} // InputMediaVideo https://core.telegram.org/bots/api#inputmediavideo type InputMediaVideo struct { - Media string `json:"media"` - Thumbnail InputFile `json:"thumbnail,omitempty"` - Caption string `json:"caption,omitempty"` - ParseMode ParseMode `json:"parse_mode,omitempty"` - CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` - Width int `json:"width,omitempty"` - Height int `json:"height,omitempty"` - Duration int `json:"duration,omitempty"` - SupportsStreaming bool `json:"supports_streaming,omitempty"` - HasSpoiler bool `json:"has_spoiler,omitempty"` + Media string `json:"media"` + Thumbnail InputFile `json:"thumbnail,omitempty"` + Caption string `json:"caption,omitempty"` + ParseMode ParseMode `json:"parse_mode,omitempty"` + CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` + ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"` + Width int `json:"width,omitempty"` + Height int `json:"height,omitempty"` + Duration int `json:"duration,omitempty"` + SupportsStreaming bool `json:"supports_streaming,omitempty"` + HasSpoiler bool `json:"has_spoiler,omitempty"` MediaAttachment io.Reader `json:"-"` } @@ -85,15 +87,16 @@ func (InputMediaVideo) inputMediaTag() {} // InputMediaAnimation https://core.telegram.org/bots/api#inputmediaanimation type InputMediaAnimation struct { - Media string `json:"media"` - Thumbnail InputFile `json:"thumbnail,omitempty"` - Caption string `json:"caption,omitempty"` - ParseMode ParseMode `json:"parse_mode,omitempty"` - CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` - Width int `json:"width,omitempty"` - Height int `json:"height,omitempty"` - Duration int `json:"duration,omitempty"` - HasSpoiler bool `json:"has_spoiler,omitempty"` + Media string `json:"media"` + Thumbnail InputFile `json:"thumbnail,omitempty"` + Caption string `json:"caption,omitempty"` + ParseMode ParseMode `json:"parse_mode,omitempty"` + CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` + ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"` + Width int `json:"width,omitempty"` + Height int `json:"height,omitempty"` + Duration int `json:"duration,omitempty"` + HasSpoiler bool `json:"has_spoiler,omitempty"` MediaAttachment io.Reader `json:"-"` } diff --git a/models/message.go b/models/message.go index 317d146..f6fffb5 100644 --- a/models/message.go +++ b/models/message.go @@ -95,6 +95,7 @@ type Message struct { Text string `json:"text,omitempty"` Entities []MessageEntity `json:"entities,omitempty"` LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options,omitempty"` + EffectID string `json:"effect_id,omitempty"` Animation *Animation `json:"animation,omitempty"` Audio *Audio `json:"audio,omitempty"` Document *Document `json:"document,omitempty"` @@ -106,6 +107,7 @@ type Message struct { Voice *Voice `json:"voice,omitempty"` Caption string `json:"caption,omitempty"` CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` + ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"` HasMediaSpoiler bool `json:"has_media_spoiler,omitempty"` Contact *Contact `json:"contact,omitempty"` Dice *Dice `json:"dice,omitempty"`