From 5c057f6c34263d92a670c90b2105ac6db1efed4a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 19 Aug 2025 01:59:16 +0000 Subject: [PATCH] chore(deps): bump github.com/go-telegram/bot from 1.16.0 to 1.17.0 Bumps [github.com/go-telegram/bot](https://github.com/go-telegram/bot) from 1.16.0 to 1.17.0. - [Release notes](https://github.com/go-telegram/bot/releases) - [Changelog](https://github.com/go-telegram/bot/blob/main/CHANGELOG.md) - [Commits](https://github.com/go-telegram/bot/compare/v1.16.0...v1.17.0) --- updated-dependencies: - dependency-name: github.com/go-telegram/bot dependency-version: 1.17.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 +- .../github.com/go-telegram/bot/CHANGELOG.md | 8 + vendor/github.com/go-telegram/bot/README.md | 43 +- vendor/github.com/go-telegram/bot/bot.go | 4 +- .../go-telegram/bot/build_request_form.go | 31 + vendor/github.com/go-telegram/bot/methods.go | 14 + .../go-telegram/bot/methods_params.go | 643 ++++++++++-------- .../github.com/go-telegram/bot/models/chat.go | 48 +- .../go-telegram/bot/models/chat_member.go | 39 +- .../github.com/go-telegram/bot/models/gift.go | 14 +- .../go-telegram/bot/models/message.go | 15 + .../go-telegram/bot/models/reply.go | 1 + .../go-telegram/bot/models/sticker.go | 6 +- .../go-telegram/bot/models/suggested_post.go | 53 ++ .../github.com/go-telegram/bot/raw_request.go | 58 +- vendor/modules.txt | 2 +- 17 files changed, 609 insertions(+), 376 deletions(-) create mode 100644 vendor/github.com/go-telegram/bot/models/suggested_post.go diff --git a/go.mod b/go.mod index e18da91..f5ff598 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/YukariExpress/pgb go 1.24 require ( - github.com/go-telegram/bot v1.16.0 + github.com/go-telegram/bot v1.17.0 github.com/sethvargo/go-envconfig v1.3.0 github.com/stretchr/testify v1.10.0 ) diff --git a/go.sum b/go.sum index 183728e..d6d99f6 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-telegram/bot v1.16.0 h1:s6aDgM9whapccMD70gt27BPG3E7R8a6FaWw+8UsRYog= -github.com/go-telegram/bot v1.16.0/go.mod h1:i2TRs7fXWIeaceF3z7KzsMt/he0TwkVC680mvdTFYeM= +github.com/go-telegram/bot v1.17.0 h1:Hs0kGxSj97QFqOQP0zxduY/4tSx8QDzvNI9uVRS+zmY= +github.com/go-telegram/bot v1.17.0/go.mod h1:i2TRs7fXWIeaceF3z7KzsMt/he0TwkVC680mvdTFYeM= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/vendor/github.com/go-telegram/bot/CHANGELOG.md b/vendor/github.com/go-telegram/bot/CHANGELOG.md index 3b315ab..ee5278e 100644 --- a/vendor/github.com/go-telegram/bot/CHANGELOG.md +++ b/vendor/github.com/go-telegram/bot/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## v1.17.0 (2025-08-18) + +- api 9.2 (#207) +- fix: hide token from logs (#206) +- use io.Pipe for build request (#205) +- 🛠️ fix: models.InputSticker model handling/usage (#201) +- style: replace empty `interface{}` with `any` (#200) + ## v1.16.0 (2025-07-08) - support API 9.1 (#194) diff --git a/vendor/github.com/go-telegram/bot/README.md b/vendor/github.com/go-telegram/bot/README.md index d33856d..c957247 100644 --- a/vendor/github.com/go-telegram/bot/README.md +++ b/vendor/github.com/go-telegram/bot/README.md @@ -6,7 +6,7 @@ > [Telegram Group](https://t.me/gotelegrambotui) -> Supports Bot API version: [9.1](https://core.telegram.org/bots/api#july-3-2025) from July 3, 2025 +> Supports Bot API version: [9.2](https://core.telegram.org/bots/api#august-15-2025) from August 15, 2025 It's a Go zero-dependencies telegram bot framework @@ -321,6 +321,47 @@ bot.SendMediaGroup(ctx, params) [Demo in examples](examples/send_media_group/main.go) +## InputSticker + +For `CreateNewStickerSet` method you can send sticker by file path or file contents. + +[Official documentation InputSticker]((https://core.telegram.org/bots/api#inputsticker) + +> field `sticker`: The added sticker. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or pass “attach://” to upload a new file using multipart/form-data under name. Animated and video stickers can't be uploaded via HTTP URL. + +If you want to use `attach://` format, you should to define `StickerAttachment` field with file content reader. + +```go +fileContent, _ := os.ReadFile("/path/to/telegram.png") + +inputSticker1 := models.InputSticker{ + Sticker: "https://github.com/go-telegram/bot/blob/main/examples/create_new_sticker_set/images/telegram.png?raw=true", + Format: "static", + EmojiList: []string{"1️⃣"}, +} + +inputSticker2 := models.InputSticker{ + Sticker: "attach://telegram.png", + Format: "static", + EmojiList: []string{"2️⃣"}, + StickerAttachment: bytes.NewReader(fileContent), +} + +params := &bot.CreateNewStickerSetParams{ + UserID: update.Message.Chat.ID, + Name: fmt.Sprintf("Example%d_by_%s", time.Now().Unix(), botUsername), + Title: "Example sticker set", + Stickers: []models.InputSticker{ + inputSticker1, + inputSticker2, + }, +} + +b.CreateNewStickerSet(ctx, params) +``` + +[Demo in examples](examples/create_new_sticker_set/main.go) + ## Helpers ### `EscapeMarkdown(s string) string` diff --git a/vendor/github.com/go-telegram/bot/bot.go b/vendor/github.com/go-telegram/bot/bot.go index 5f6fa8a..c9ae9da 100644 --- a/vendor/github.com/go-telegram/bot/bot.go +++ b/vendor/github.com/go-telegram/bot/bot.go @@ -152,7 +152,7 @@ func defaultErrorsHandler(err error) { log.Printf("[TGBOT] [ERROR] %v", err) } -func defaultDebugHandler(format string, args ...interface{}) { +func defaultDebugHandler(format string, args ...any) { log.Printf("[TGBOT] [DEBUG] "+format, args...) } @@ -160,7 +160,7 @@ func defaultHandler(_ context.Context, _ *Bot, update *models.Update) { log.Printf("[TGBOT] [UPDATE] %+v", update) } -func (b *Bot) error(format string, args ...interface{}) { +func (b *Bot) error(format string, args ...any) { b.errorsHandler(fmt.Errorf(format, args...)) } diff --git a/vendor/github.com/go-telegram/bot/build_request_form.go b/vendor/github.com/go-telegram/bot/build_request_form.go index f078c37..ff23188 100644 --- a/vendor/github.com/go-telegram/bot/build_request_form.go +++ b/vendor/github.com/go-telegram/bot/build_request_form.go @@ -84,6 +84,8 @@ func buildRequestForm(form *multipart.Writer, params any) (int, error) { err = addFormFieldInputMediaSlice(form, fieldName, ss) case []models.InlineQueryResult: err = addFormFieldInlineQueryResultSlice(form, fieldName, vv) + case []models.InputSticker: + err = addFormFieldInputStickerSlice(form, fieldName, vv) default: err = addFormFieldDefault(form, fieldName, v.Field(i).Interface()) } @@ -187,6 +189,35 @@ func addFormFieldInlineQueryResultSlice(form *multipart.Writer, fieldName string return errCopy } +func addFormFieldInputStickerSlice(form *multipart.Writer, fieldName string, value []models.InputSticker) error { + var lines []string + for _, sticker := range value { + if strings.HasPrefix(sticker.Sticker, "attach://") { + filename := strings.TrimPrefix(sticker.Sticker, "attach://") + attachmentField, errCreateAttachmentField := form.CreateFormFile(filename, filename) + if errCreateAttachmentField != nil { + return errCreateAttachmentField + } + _, errCopy := io.Copy(attachmentField, sticker.StickerAttachment) + if errCopy != nil { + return errCopy + } + } + line, errEncode := json.Marshal(sticker) + if errEncode != nil { + return errEncode + } + lines = append(lines, string(line)) + } + + w, errCreateField := form.CreateFormField(fieldName) + if errCreateField != nil { + return errCreateField + } + _, errCopy := io.Copy(w, strings.NewReader("["+strings.Join(lines, ",")+"]")) + return errCopy +} + func addFormFieldDefault(form *multipart.Writer, fieldName string, value any) error { d, errMarshal := json.Marshal(value) if errMarshal != nil { diff --git a/vendor/github.com/go-telegram/bot/methods.go b/vendor/github.com/go-telegram/bot/methods.go index 03cc775..34f8274 100644 --- a/vendor/github.com/go-telegram/bot/methods.go +++ b/vendor/github.com/go-telegram/bot/methods.go @@ -692,6 +692,20 @@ func (b *Bot) StopPoll(ctx context.Context, params *StopPollParams) (*models.Pol return result, err } +// ApproveSuggestedPost https://core.telegram.org/bots/api#approvesuggestedpost +func (b *Bot) ApproveSuggestedPost(ctx context.Context, params *ApproveSuggestedPostParams) (bool, error) { + var result bool + err := b.rawRequest(ctx, "approveSuggestedPost", params, &result) + return result, err +} + +// DeclineSuggestedPost https://core.telegram.org/bots/api#declinesuggestedpost +func (b *Bot) DeclineSuggestedPost(ctx context.Context, params *DeclineSuggestedPostParams) (bool, error) { + var result bool + err := b.rawRequest(ctx, "declineSuggestedPost", params, &result) + return result, err +} + // DeleteMessage https://core.telegram.org/bots/api#deletemessage func (b *Bot) DeleteMessage(ctx context.Context, params *DeleteMessageParams) (bool, error) { var result bool diff --git a/vendor/github.com/go-telegram/bot/methods_params.go b/vendor/github.com/go-telegram/bot/methods_params.go index db30387..c87e091 100644 --- a/vendor/github.com/go-telegram/bot/methods_params.go +++ b/vendor/github.com/go-telegram/bot/methods_params.go @@ -20,262 +20,290 @@ type DeleteWebhookParams struct { // SendMessageParams https://core.telegram.org/bots/api#sendmessage type SendMessageParams struct { - BusinessConnectionID string `json:"business_connection_id,omitempty"` - ChatID any `json:"chat_id"` - MessageThreadID int `json:"message_thread_id,omitempty"` - Text string `json:"text"` - ParseMode models.ParseMode `json:"parse_mode,omitempty"` - Entities []models.MessageEntity `json:"entities,omitempty"` - LinkPreviewOptions *models.LinkPreviewOptions `json:"link_preview_options,omitempty"` - DisableNotification bool `json:"disable_notification,omitempty"` - ProtectContent bool `json:"protect_content,omitempty"` - AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"` - MessageEffectID string `json:"message_effect_id,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"` + DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"` + Text string `json:"text"` + ParseMode models.ParseMode `json:"parse_mode,omitempty"` + Entities []models.MessageEntity `json:"entities,omitempty"` + LinkPreviewOptions *models.LinkPreviewOptions `json:"link_preview_options,omitempty"` + DisableNotification bool `json:"disable_notification,omitempty"` + ProtectContent bool `json:"protect_content,omitempty"` + AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"` + MessageEffectID string `json:"message_effect_id,omitempty"` + SuggestedPostParameters *models.SuggestedPostParameters `json:"suggested_post_parameters,omitempty"` + ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` + ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` } // ForwardMessageParams https://core.telegram.org/bots/api#forwardmessage type ForwardMessageParams struct { - ChatID any `json:"chat_id"` - MessageThreadID int `json:"message_thread_id,omitempty"` - FromChatID any `json:"from_chat_id"` - VideoStartTimestamp int `json:"video_start_timestamp,omitempty"` - DisableNotification bool `json:"disable_notification,omitempty"` - ProtectContent bool `json:"protect_content,omitempty"` - MessageID int `json:"message_id"` + ChatID any `json:"chat_id"` + MessageThreadID int `json:"message_thread_id,omitempty"` + DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"` + FromChatID any `json:"from_chat_id"` + VideoStartTimestamp int `json:"video_start_timestamp,omitempty"` + DisableNotification bool `json:"disable_notification,omitempty"` + ProtectContent bool `json:"protect_content,omitempty"` + SuggestedPostParameters *models.SuggestedPostParameters `json:"suggested_post_parameters,omitempty"` + MessageID int `json:"message_id"` } // ForwardMessagesParams https://core.telegram.org/bots/api#forwardmessages type ForwardMessagesParams struct { - ChatID any `json:"chat_id"` - MessageThreadID int `json:"message_thread_id,omitempty"` - FromChatID any `json:"from_chat_id"` - MessageIDs []int `json:"message_ids"` - DisableNotification bool `json:"disable_notification,omitempty"` - ProtectContent bool `json:"protect_content,omitempty"` + ChatID any `json:"chat_id"` + MessageThreadID int `json:"message_thread_id,omitempty"` + DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"` + FromChatID any `json:"from_chat_id"` + MessageIDs []int `json:"message_ids"` + DisableNotification bool `json:"disable_notification,omitempty"` + ProtectContent bool `json:"protect_content,omitempty"` } // CopyMessageParams https://core.telegram.org/bots/api#copymessage type CopyMessageParams struct { - ChatID any `json:"chat_id"` - MessageThreadID int `json:"message_thread_id,omitempty"` - FromChatID any `json:"from_chat_id"` - MessageID int `json:"message_id"` - VideoStartTimestamp int `json:"video_start_timestamp,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"` - DisableNotification bool `json:"disable_notification,omitempty"` - ProtectContent bool `json:"protect_content,omitempty"` - AllowPaidBroadcast bool `json:"allow_paid_broadcast,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"` + DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"` + FromChatID any `json:"from_chat_id"` + MessageID int `json:"message_id"` + VideoStartTimestamp int `json:"video_start_timestamp,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"` + DisableNotification bool `json:"disable_notification,omitempty"` + ProtectContent bool `json:"protect_content,omitempty"` + AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"` + SuggestedPostParameters *models.SuggestedPostParameters `json:"suggested_post_parameters,omitempty"` + ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` + ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` } // CopyMessagesParams https://core.telegram.org/bots/api#copymessages type CopyMessagesParams struct { - ChatID any `json:"chat_id"` - MessageThreadID int `json:"message_thread_id,omitempty"` - FromChatID any `json:"from_chat_id"` - MessageIDs []int `json:"message_ids"` - DisableNotification bool `json:"disable_notification,omitempty"` - ProtectContent bool `json:"protect_content,omitempty"` - RemoveCaption bool `json:"remove_caption,omitempty"` + ChatID any `json:"chat_id"` + MessageThreadID int `json:"message_thread_id,omitempty"` + DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"` + FromChatID any `json:"from_chat_id"` + MessageIDs []int `json:"message_ids"` + DisableNotification bool `json:"disable_notification,omitempty"` + ProtectContent bool `json:"protect_content,omitempty"` + RemoveCaption bool `json:"remove_caption,omitempty"` } // 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"` - 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"` - AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"` - MessageEffectID string `json:"message_effect_id,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"` + DirectMessagesTopicID int `json:"direct_messages_topic_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"` + AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"` + MessageEffectID string `json:"message_effect_id,omitempty"` + SuggestedPostParameters *models.SuggestedPostParameters `json:"suggested_post_parameters,omitempty"` + ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` + ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` } // SendAudioParams https://core.telegram.org/bots/api#sendaudio type SendAudioParams struct { - BusinessConnectionID string `json:"business_connection_id,omitempty"` - ChatID any `json:"chat_id"` - MessageThreadID int `json:"message_thread_id,omitempty"` - Audio models.InputFile `json:"audio"` - Caption string `json:"caption,omitempty"` - ParseMode models.ParseMode `json:"parse_mode,omitempty"` - CaptionEntities []models.MessageEntity `json:"caption_entities,omitempty"` - Duration int `json:"duration,omitempty"` - Performer string `json:"performer,omitempty"` - Title string `json:"title,omitempty"` - Thumbnail models.InputFile `json:"thumbnail,omitempty"` - DisableNotification bool `json:"disable_notification,omitempty"` - ProtectContent bool `json:"protect_content,omitempty"` - AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"` - MessageEffectID string `json:"message_effect_id,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"` + DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"` + Audio models.InputFile `json:"audio"` + Caption string `json:"caption,omitempty"` + ParseMode models.ParseMode `json:"parse_mode,omitempty"` + CaptionEntities []models.MessageEntity `json:"caption_entities,omitempty"` + Duration int `json:"duration,omitempty"` + Performer string `json:"performer,omitempty"` + Title string `json:"title,omitempty"` + Thumbnail models.InputFile `json:"thumbnail,omitempty"` + DisableNotification bool `json:"disable_notification,omitempty"` + ProtectContent bool `json:"protect_content,omitempty"` + AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"` + MessageEffectID string `json:"message_effect_id,omitempty"` + SuggestedPostParameters *models.SuggestedPostParameters `json:"suggested_post_parameters,omitempty"` + ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` + ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` } // SendDocumentParams https://core.telegram.org/bots/api#senddocument type SendDocumentParams struct { - BusinessConnectionID string `json:"business_connection_id,omitempty"` - ChatID any `json:"chat_id"` - MessageThreadID int `json:"message_thread_id,omitempty"` - Document models.InputFile `json:"document"` - 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"` - DisableContentTypeDetection bool `json:"disable_content_type_detection,omitempty"` - DisableNotification bool `json:"disable_notification,omitempty"` - ProtectContent bool `json:"protect_content,omitempty"` - AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"` - MessageEffectID string `json:"message_effect_id,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"` + DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"` + Document models.InputFile `json:"document"` + 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"` + DisableContentTypeDetection bool `json:"disable_content_type_detection,omitempty"` + DisableNotification bool `json:"disable_notification,omitempty"` + ProtectContent bool `json:"protect_content,omitempty"` + AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"` + MessageEffectID string `json:"message_effect_id,omitempty"` + SuggestedPostParameters *models.SuggestedPostParameters `json:"suggested_post_parameters,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"` - Cover models.InputFile `json:"cover,omitempty"` - StartTimestamp int `json:"start_timestamp,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"` - AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"` - MessageEffectID string `json:"message_effect_id,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"` + DirectMessagesTopicID int `json:"direct_messages_topic_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"` + Cover models.InputFile `json:"cover,omitempty"` + StartTimestamp int `json:"start_timestamp,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"` + AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"` + MessageEffectID string `json:"message_effect_id,omitempty"` + SuggestedPostParameters *models.SuggestedPostParameters `json:"suggested_post_parameters,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"` - 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"` - AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"` - MessageEffectID string `json:"message_effect_id,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"` + DirectMessagesTopicID int `json:"direct_messages_topic_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"` + AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"` + MessageEffectID string `json:"message_effect_id,omitempty"` + SuggestedPostParameters *models.SuggestedPostParameters `json:"suggested_post_parameters,omitempty"` + ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` + ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` } // SendVoiceParams https://core.telegram.org/bots/api#sendvoice type SendVoiceParams struct { - BusinessConnectionID string `json:"business_connection_id,omitempty"` - ChatID any `json:"chat_id"` - MessageThreadID int `json:"message_thread_id,omitempty"` - Voice models.InputFile `json:"voice"` - Caption string `json:"caption,omitempty"` - ParseMode models.ParseMode `json:"parse_mode,omitempty"` - CaptionEntities []models.MessageEntity `json:"caption_entities,omitempty"` - Duration int `json:"duration,omitempty"` - DisableNotification bool `json:"disable_notification,omitempty"` - ProtectContent bool `json:"protect_content,omitempty"` - AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"` - MessageEffectID string `json:"message_effect_id,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"` + DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"` + Voice models.InputFile `json:"voice"` + Caption string `json:"caption,omitempty"` + ParseMode models.ParseMode `json:"parse_mode,omitempty"` + CaptionEntities []models.MessageEntity `json:"caption_entities,omitempty"` + Duration int `json:"duration,omitempty"` + DisableNotification bool `json:"disable_notification,omitempty"` + ProtectContent bool `json:"protect_content,omitempty"` + AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"` + MessageEffectID string `json:"message_effect_id,omitempty"` + SuggestedPostParameters *models.SuggestedPostParameters `json:"suggested_post_parameters,omitempty"` + ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` + ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` } // SendVideoNoteParams https://core.telegram.org/bots/api#sendvideonote type SendVideoNoteParams struct { - BusinessConnectionID string `json:"business_connection_id,omitempty"` - ChatID any `json:"chat_id"` - MessageThreadID int `json:"message_thread_id,omitempty"` - VideoNote models.InputFile `json:"video_note"` - Duration int `json:"duration,omitempty"` - Length int `json:"length,omitempty"` - Thumbnail models.InputFile `json:"thumbnail,omitempty"` - DisableNotification bool `json:"disable_notification,omitempty"` - ProtectContent bool `json:"protect_content,omitempty"` - AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"` - MessageEffectID string `json:"message_effect_id,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"` + DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"` + VideoNote models.InputFile `json:"video_note"` + Duration int `json:"duration,omitempty"` + Length int `json:"length,omitempty"` + Thumbnail models.InputFile `json:"thumbnail,omitempty"` + DisableNotification bool `json:"disable_notification,omitempty"` + ProtectContent bool `json:"protect_content,omitempty"` + AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"` + MessageEffectID string `json:"message_effect_id,omitempty"` + SuggestedPostParameters *models.SuggestedPostParameters `json:"suggested_post_parameters,omitempty"` + ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` + ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` } // SendPaidMediaParams https://core.telegram.org/bots/api#sendpaidmedia type SendPaidMediaParams struct { + BusinessConnectionID string `json:"business_connection_id,omitempty"` + ChatID any `json:"chat_id"` + StarCount int `json:"star_count"` + MessageThreadID int `json:"message_thread_id,omitempty"` + DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"` + Media []models.InputPaidMedia `json:"media"` + Payload string `json:"payload,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"` + DisableNotification bool `json:"disable_notification,omitempty"` + ProtectContent bool `json:"protect_content,omitempty"` + AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"` + SuggestedPostParameters *models.SuggestedPostParameters `json:"suggested_post_parameters,omitempty"` + ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` + ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` +} + +// SendMediaGroupParams https://core.telegram.org/bots/api#sendmediagroup +type SendMediaGroupParams struct { BusinessConnectionID string `json:"business_connection_id,omitempty"` ChatID any `json:"chat_id"` - StarCount int `json:"star_count"` - Media []models.InputPaidMedia `json:"media"` - Payload string `json:"payload,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"` + MessageThreadID int `json:"message_thread_id,omitempty"` + DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"` + Media []models.InputMedia `json:"media"` DisableNotification bool `json:"disable_notification,omitempty"` ProtectContent bool `json:"protect_content,omitempty"` AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"` + MessageEffectID string `json:"message_effect_id,omitempty"` ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` - ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` -} - -// SendMediaGroupParams https://core.telegram.org/bots/api#sendmediagroup -type SendMediaGroupParams struct { - BusinessConnectionID string `json:"business_connection_id,omitempty"` - ChatID any `json:"chat_id"` - MessageThreadID int `json:"message_thread_id,omitempty"` - Media []models.InputMedia `json:"media"` - DisableNotification bool `json:"disable_notification,omitempty"` - ProtectContent bool `json:"protect_content,omitempty"` - AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"` - MessageEffectID string `json:"message_effect_id,omitempty"` - ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` } // SendLocationParams https://core.telegram.org/bots/api#sendlocation type SendLocationParams struct { - BusinessConnectionID string `json:"business_connection_id,omitempty"` - ChatID any `json:"chat_id"` - MessageThreadID int `json:"message_thread_id,omitempty"` - Latitude float64 `json:"latitude"` - Longitude float64 `json:"longitude"` - HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"` - LivePeriod int `json:"live_period,omitempty"` - Heading int `json:"heading,omitempty"` - ProximityAlertRadius int `json:"proximity_alert_radius,omitempty"` - DisableNotification bool `json:"disable_notification,omitempty"` - ProtectContent bool `json:"protect_content,omitempty"` - AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"` - MessageEffectID string `json:"message_effect_id,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"` + DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"` + Latitude float64 `json:"latitude"` + Longitude float64 `json:"longitude"` + HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"` + LivePeriod int `json:"live_period,omitempty"` + Heading int `json:"heading,omitempty"` + ProximityAlertRadius int `json:"proximity_alert_radius,omitempty"` + DisableNotification bool `json:"disable_notification,omitempty"` + ProtectContent bool `json:"protect_content,omitempty"` + AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"` + MessageEffectID string `json:"message_effect_id,omitempty"` + SuggestedPostParameters *models.SuggestedPostParameters `json:"suggested_post_parameters,omitempty"` + ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` + ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` } type EditMessageLiveLocationParams struct { @@ -302,40 +330,44 @@ type StopMessageLiveLocationParams struct { // SendVenueParams https://core.telegram.org/bots/api#sendvenue type SendVenueParams struct { - BusinessConnectionID string `json:"business_connection_id,omitempty"` - ChatID any `json:"chat_id"` - MessageThreadID int `json:"message_thread_id,omitempty"` - Latitude float64 `json:"latitude"` - Longitude float64 `json:"longitude"` - Title string `json:"title"` - Address string `json:"address"` - FoursquareID string `json:"foursquare_id,omitempty"` - FoursquareType string `json:"foursquare_type,omitempty"` - GooglePlaceID string `json:"google_place_id,omitempty"` - GooglePlaceType string `json:"google_place_type,omitempty"` - DisableNotification bool `json:"disable_notification,omitempty"` - ProtectContent bool `json:"protect_content,omitempty"` - AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"` - MessageEffectID string `json:"message_effect_id,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"` + DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"` + Latitude float64 `json:"latitude"` + Longitude float64 `json:"longitude"` + Title string `json:"title"` + Address string `json:"address"` + FoursquareID string `json:"foursquare_id,omitempty"` + FoursquareType string `json:"foursquare_type,omitempty"` + GooglePlaceID string `json:"google_place_id,omitempty"` + GooglePlaceType string `json:"google_place_type,omitempty"` + DisableNotification bool `json:"disable_notification,omitempty"` + ProtectContent bool `json:"protect_content,omitempty"` + AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"` + MessageEffectID string `json:"message_effect_id,omitempty"` + SuggestedPostParameters *models.SuggestedPostParameters `json:"suggested_post_parameters,omitempty"` + ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` + ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` } // SendContactParams https://core.telegram.org/bots/api#sendcontact type SendContactParams struct { - BusinessConnectionID string `json:"business_connection_id,omitempty"` - ChatID any `json:"chat_id"` - MessageThreadID int `json:"message_thread_id,omitempty"` - PhoneNumber string `json:"phone_number"` - FirstName string `json:"first_name"` - LastName string `json:"last_name,omitempty"` - VCard string `json:"vcard,omitempty"` - DisableNotification bool `json:"disable_notification,omitempty"` - ProtectContent bool `json:"protect_content,omitempty"` - AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"` - MessageEffectID string `json:"message_effect_id,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"` + DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"` + PhoneNumber string `json:"phone_number"` + FirstName string `json:"first_name"` + LastName string `json:"last_name,omitempty"` + VCard string `json:"vcard,omitempty"` + DisableNotification bool `json:"disable_notification,omitempty"` + ProtectContent bool `json:"protect_content,omitempty"` + AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"` + MessageEffectID string `json:"message_effect_id,omitempty"` + SuggestedPostParameters *models.SuggestedPostParameters `json:"suggested_post_parameters,omitempty"` + ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` + ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` } // SendPollParams https://core.telegram.org/bots/api#sendpoll @@ -379,16 +411,18 @@ type SendChecklistParams struct { // SendDiceParams https://core.telegram.org/bots/api#senddice type SendDiceParams struct { - BusinessConnectionID string `json:"business_connection_id,omitempty"` - ChatID any `json:"chat_id"` - MessageThreadID int `json:"message_thread_id,omitempty"` - Emoji string `json:"emoji,omitempty"` - DisableNotification bool `json:"disable_notification,omitempty"` - ProtectContent bool `json:"protect_content,omitempty"` - AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"` - MessageEffectID string `json:"message_effect_id,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"` + DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"` + Emoji string `json:"emoji,omitempty"` + DisableNotification bool `json:"disable_notification,omitempty"` + ProtectContent bool `json:"protect_content,omitempty"` + AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"` + MessageEffectID string `json:"message_effect_id,omitempty"` + SuggestedPostParameters *models.SuggestedPostParameters `json:"suggested_post_parameters,omitempty"` + ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` + ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` } type SendChatActionParams struct { @@ -445,23 +479,24 @@ type RestrictChatMemberParams struct { } type PromoteChatMemberParams struct { - ChatID any `json:"chat_id" rules:"required,chat_id"` - UserID int64 `json:"user_id" rules:"required"` - IsAnonymous bool `json:"is_anonymous,omitempty"` - CanManageChat bool `json:"can_manage_chat,omitempty"` - CanDeleteMessages bool `json:"can_delete_messages,omitempty"` - CanManageVideoChats bool `json:"can_manage_video_chats,omitempty"` - CanRestrictMembers bool `json:"can_restrict_members,omitempty"` - CanPromoteMembers bool `json:"can_promote_members,omitempty"` - CanChangeInfo bool `json:"can_change_info,omitempty"` - CanInviteUsers bool `json:"can_invite_users,omitempty"` - CanPostMessages bool `json:"can_post_messages,omitempty"` - CanEditMessages bool `json:"can_edit_messages,omitempty"` - CanPinMessages bool `json:"can_pin_messages,omitempty"` - CanPostStories bool `json:"can_post_stories,omitempty"` - CanEditStories bool `json:"can_edit_stories,omitempty"` - CanDeleteStories bool `json:"can_delete_stories,omitempty"` - CanManageTopics bool `json:"can_manage_topics,omitempty"` + ChatID any `json:"chat_id" rules:"required,chat_id"` + UserID int64 `json:"user_id" rules:"required"` + IsAnonymous bool `json:"is_anonymous,omitempty"` + CanManageChat bool `json:"can_manage_chat,omitempty"` + CanDeleteMessages bool `json:"can_delete_messages,omitempty"` + CanManageVideoChats bool `json:"can_manage_video_chats,omitempty"` + CanRestrictMembers bool `json:"can_restrict_members,omitempty"` + CanPromoteMembers bool `json:"can_promote_members,omitempty"` + CanChangeInfo bool `json:"can_change_info,omitempty"` + CanInviteUsers bool `json:"can_invite_users,omitempty"` + CanPostMessages bool `json:"can_post_messages,omitempty"` + CanEditMessages bool `json:"can_edit_messages,omitempty"` + CanPinMessages bool `json:"can_pin_messages,omitempty"` + CanPostStories bool `json:"can_post_stories,omitempty"` + CanEditStories bool `json:"can_edit_stories,omitempty"` + CanDeleteStories bool `json:"can_delete_stories,omitempty"` + CanManageTopics bool `json:"can_manage_topics,omitempty"` + CanManageDirectMessages bool `json:"can_manage_direct_messages,omitempty"` } type SetChatAdministratorCustomTitleParams struct { @@ -798,6 +833,20 @@ type StopPollParams struct { ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` } +// ApproveSuggestedPostParams https://core.telegram.org/bots/api#approvesuggestedpost +type ApproveSuggestedPostParams struct { + ChatID int `json:"chat_id"` + MessageID int `json:"message_id"` + SendDate int `json:"send_date,omitempty"` +} + +// DeclineSuggestedPostParams https://core.telegram.org/bots/api#declinesuggestedpost +type DeclineSuggestedPostParams struct { + ChatID int `json:"chat_id"` + MessageID int `json:"message_id"` + Comment string `json:"comment,omitempty"` +} + // DeleteMessageParams https://core.telegram.org/bots/api#deletemessage type DeleteMessageParams struct { ChatID any `json:"chat_id"` @@ -812,17 +861,19 @@ type DeleteMessagesParams struct { // SendStickerParams https://core.telegram.org/bots/api#sendsticker type SendStickerParams struct { - BusinessConnectionID string `json:"business_connection_id,omitempty"` - ChatID any `json:"chat_id"` - MessageThreadID int `json:"message_thread_id,omitempty"` - Sticker models.InputFile `json:"sticker"` - Emoji string `json:"emoji,omitempty"` - DisableNotification bool `json:"disable_notification,omitempty"` - ProtectContent bool `json:"protect_content,omitempty"` - AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"` - MessageEffectID string `json:"message_effect_id,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"` + DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"` + Sticker models.InputFile `json:"sticker"` + Emoji string `json:"emoji,omitempty"` + DisableNotification bool `json:"disable_notification,omitempty"` + ProtectContent bool `json:"protect_content,omitempty"` + AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"` + MessageEffectID string `json:"message_effect_id,omitempty"` + SuggestedPostParameters *models.SuggestedPostParameters `json:"suggested_post_parameters,omitempty"` + ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` + ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` } type GetStickerSetParams struct { @@ -932,35 +983,37 @@ type SavePreparedInlineMessageParams struct { // SendInvoiceParams https://core.telegram.org/bots/api#sendinvoice type SendInvoiceParams struct { - ChatID any `json:"chat_id"` - MessageThreadID int `json:"message_thread_id,omitempty"` - Title string `json:"title"` - Description string `json:"description"` - Payload string `json:"payload"` - ProviderToken string `json:"provider_token,omitempty"` - Currency string `json:"currency"` - Prices []models.LabeledPrice `json:"prices"` - MaxTipAmount int `json:"max_tip_amount,omitempty"` - SuggestedTipAmounts []int `json:"suggested_tip_amounts,omitempty"` - StartParameter string `json:"start_parameter,omitempty"` - ProviderData string `json:"provider_data,omitempty"` - PhotoURL string `json:"photo_url,omitempty"` - PhotoSize int `json:"photo_size,omitempty"` - PhotoWidth int `json:"photo_width,omitempty"` - PhotoHeight int `json:"photo_height,omitempty"` - NeedName bool `json:"need_name,omitempty"` - NeedPhoneNumber bool `json:"need_phone_number,omitempty"` - NeedEmail bool `json:"need_email,omitempty"` - NeedShippingAddress bool `json:"need_shipping_address,omitempty"` - SendPhoneNumberToProvider bool `json:"send_phone_number_to_provider,omitempty"` - SendEmailToProvider bool `json:"send_email_to_provider,omitempty"` - IsFlexible bool `json:"is_flexible,omitempty"` - DisableNotification bool `json:"disable_notification,omitempty"` - ProtectContent bool `json:"protect_content,omitempty"` - AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"` - MessageEffectID string `json:"message_effect_id,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"` + DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"` + Title string `json:"title"` + Description string `json:"description"` + Payload string `json:"payload"` + ProviderToken string `json:"provider_token,omitempty"` + Currency string `json:"currency"` + Prices []models.LabeledPrice `json:"prices"` + MaxTipAmount int `json:"max_tip_amount,omitempty"` + SuggestedTipAmounts []int `json:"suggested_tip_amounts,omitempty"` + StartParameter string `json:"start_parameter,omitempty"` + ProviderData string `json:"provider_data,omitempty"` + PhotoURL string `json:"photo_url,omitempty"` + PhotoSize int `json:"photo_size,omitempty"` + PhotoWidth int `json:"photo_width,omitempty"` + PhotoHeight int `json:"photo_height,omitempty"` + NeedName bool `json:"need_name,omitempty"` + NeedPhoneNumber bool `json:"need_phone_number,omitempty"` + NeedEmail bool `json:"need_email,omitempty"` + NeedShippingAddress bool `json:"need_shipping_address,omitempty"` + SendPhoneNumberToProvider bool `json:"send_phone_number_to_provider,omitempty"` + SendEmailToProvider bool `json:"send_email_to_provider,omitempty"` + IsFlexible bool `json:"is_flexible,omitempty"` + DisableNotification bool `json:"disable_notification,omitempty"` + ProtectContent bool `json:"protect_content,omitempty"` + AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"` + MessageEffectID string `json:"message_effect_id,omitempty"` + SuggestedPostParameters *models.SuggestedPostParameters `json:"suggested_post_parameters,omitempty"` + ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"` + ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"` } type CreateInvoiceLinkParams struct { diff --git a/vendor/github.com/go-telegram/bot/models/chat.go b/vendor/github.com/go-telegram/bot/models/chat.go index f84569e..755241e 100644 --- a/vendor/github.com/go-telegram/bot/models/chat.go +++ b/vendor/github.com/go-telegram/bot/models/chat.go @@ -33,21 +33,22 @@ type ChatInviteLink struct { // ChatAdministratorRights https://core.telegram.org/bots/api#chatadministratorrights type ChatAdministratorRights struct { - IsAnonymous bool `json:"is_anonymous"` - CanManageChat bool `json:"can_manage_chat"` - CanDeleteMessages bool `json:"can_delete_messages"` - CanManageVideoChats bool `json:"can_manage_video_chats"` - CanRestrictMembers bool `json:"can_restrict_members"` - CanPromoteMembers bool `json:"can_promote_members"` - CanChangeInfo bool `json:"can_change_info"` - CanInviteUsers bool `json:"can_invite_users"` - CanPostMessages bool `json:"can_post_messages,omitempty"` - CanEditMessages bool `json:"can_edit_messages,omitempty"` - CanPinMessages bool `json:"can_pin_messages,omitempty"` - CanPostStories bool `json:"can_post_stories,omitempty"` - CanEditStories bool `json:"can_edit_stories,omitempty"` - CanDeleteStories bool `json:"can_delete_stories,omitempty"` - CanManageTopics bool `json:"can_manage_topics,omitempty"` + IsAnonymous bool `json:"is_anonymous"` + CanManageChat bool `json:"can_manage_chat"` + CanDeleteMessages bool `json:"can_delete_messages"` + CanManageVideoChats bool `json:"can_manage_video_chats"` + CanRestrictMembers bool `json:"can_restrict_members"` + CanPromoteMembers bool `json:"can_promote_members"` + CanChangeInfo bool `json:"can_change_info"` + CanInviteUsers bool `json:"can_invite_users"` + CanPostMessages bool `json:"can_post_messages,omitempty"` + CanEditMessages bool `json:"can_edit_messages,omitempty"` + CanPinMessages bool `json:"can_pin_messages,omitempty"` + CanPostStories bool `json:"can_post_stories,omitempty"` + CanEditStories bool `json:"can_edit_stories,omitempty"` + CanDeleteStories bool `json:"can_delete_stories,omitempty"` + CanManageTopics bool `json:"can_manage_topics,omitempty"` + CanManageDirectMessages bool `json:"can_manage_direct_messages,omitempty"` } // ChatPermissions https://core.telegram.org/bots/api#chatpermissions @@ -91,13 +92,14 @@ const ( // Chat https://core.telegram.org/bots/api#chat type Chat struct { - ID int64 `json:"id"` - Type ChatType `json:"type"` - Title string `json:"title,omitempty"` - Username string `json:"username,omitempty"` - FirstName string `json:"first_name,omitempty"` - LastName string `json:"last_name,omitempty"` - IsForum bool `json:"is_forum,omitempty"` + ID int64 `json:"id"` + Type ChatType `json:"type"` + Title string `json:"title,omitempty"` + Username string `json:"username,omitempty"` + FirstName string `json:"first_name,omitempty"` + LastName string `json:"last_name,omitempty"` + IsForum bool `json:"is_forum,omitempty"` + IsDirectMessages bool `json:"is_direct_messages,omitempty"` } // ChatFullInfo https://core.telegram.org/bots/api#chatfullinfo @@ -109,6 +111,7 @@ type ChatFullInfo struct { FirstName string `json:"first_name,omitempty"` LastName string `json:"last_name,omitempty"` IsForum bool `json:"is_forum,omitempty"` + IsDirectMessages bool `json:"is_direct_messages,omitempty"` Photo *ChatPhoto `json:"photo,omitempty"` ActiveUsernames []string `json:"active_usernames,omitempty"` Birthdate Birthdate `json:"birthdate,omitempty"` @@ -116,6 +119,7 @@ type ChatFullInfo struct { BusinessLocation *BusinessLocation `json:"business_location,omitempty"` BusinessOpeningHours *BusinessOpeningHours `json:"business_opening_hours,omitempty"` PersonalChat *Chat `json:"personal_chat,omitempty"` + ParentChat *Chat `json:"parent_chat,omitempty"` AvailableReactions []ReactionType `json:"available_reactions,omitempty"` AccentColorID int `json:"accent_color_id,omitempty"` MaxReactionCount int `json:"max_reaction_count"` diff --git a/vendor/github.com/go-telegram/bot/models/chat_member.go b/vendor/github.com/go-telegram/bot/models/chat_member.go index 1721ae0..264f5cf 100644 --- a/vendor/github.com/go-telegram/bot/models/chat_member.go +++ b/vendor/github.com/go-telegram/bot/models/chat_member.go @@ -113,25 +113,26 @@ type ChatMemberOwner struct { // ChatMemberAdministrator https://core.telegram.org/bots/api#chatmemberadministrator type ChatMemberAdministrator struct { - Status ChatMemberType `json:"status"` // The member's status in the chat, always “administrator” - User User `json:"user"` - CanBeEdited bool `json:"can_be_edited"` - IsAnonymous bool `json:"is_anonymous"` - CanManageChat bool `json:"can_manage_chat"` - CanDeleteMessages bool `json:"can_delete_messages"` - CanManageVideoChats bool `json:"can_manage_video_chats"` - CanRestrictMembers bool `json:"can_restrict_members"` - CanPromoteMembers bool `json:"can_promote_members"` - CanChangeInfo bool `json:"can_change_info"` - CanInviteUsers bool `json:"can_invite_users"` - CanPostMessages bool `json:"can_post_messages,omitempty"` - CanEditMessages bool `json:"can_edit_messages,omitempty"` - CanPinMessages bool `json:"can_pin_messages,omitempty"` - CanPostStories bool `json:"can_post_stories,omitempty"` - CanEditStories bool `json:"can_edit_stories,omitempty"` - CanDeleteStories bool `json:"can_delete_stories,omitempty"` - CanManageTopics bool `json:"can_manage_topics,omitempty"` - CustomTitle string `json:"custom_title,omitempty"` + Status ChatMemberType `json:"status"` // The member's status in the chat, always “administrator” + User User `json:"user"` + CanBeEdited bool `json:"can_be_edited"` + IsAnonymous bool `json:"is_anonymous"` + CanManageChat bool `json:"can_manage_chat"` + CanDeleteMessages bool `json:"can_delete_messages"` + CanManageVideoChats bool `json:"can_manage_video_chats"` + CanRestrictMembers bool `json:"can_restrict_members"` + CanPromoteMembers bool `json:"can_promote_members"` + CanChangeInfo bool `json:"can_change_info"` + CanInviteUsers bool `json:"can_invite_users"` + CanPostMessages bool `json:"can_post_messages,omitempty"` + CanEditMessages bool `json:"can_edit_messages,omitempty"` + CanPinMessages bool `json:"can_pin_messages,omitempty"` + CanPostStories bool `json:"can_post_stories,omitempty"` + CanEditStories bool `json:"can_edit_stories,omitempty"` + CanDeleteStories bool `json:"can_delete_stories,omitempty"` + CanManageTopics bool `json:"can_manage_topics,omitempty"` + CanManageDirectMessages bool `json:"can_manage_direct_messages,omitempty"` + CustomTitle string `json:"custom_title,omitempty"` } // ChatMemberMember https://core.telegram.org/bots/api#chatmembermember diff --git a/vendor/github.com/go-telegram/bot/models/gift.go b/vendor/github.com/go-telegram/bot/models/gift.go index 6894118..55f79eb 100644 --- a/vendor/github.com/go-telegram/bot/models/gift.go +++ b/vendor/github.com/go-telegram/bot/models/gift.go @@ -18,6 +18,7 @@ type Gift struct { UpgradeStarCount int `json:"upgrade_star_count,omitempty"` TotalCount int `json:"total_count,omitempty"` RemainingCount int `json:"remaining_count,omitempty"` + PublisherChat *Chat `json:"publisher_chat,omitempty"` } // AcceptedGiftTypes https://core.telegram.org/bots/api#acceptedgifttypes @@ -103,12 +104,13 @@ type OwnedGifts struct { // UniqueGift https://core.telegram.org/bots/api#uniquegift type UniqueGift struct { - BaseName string `json:"base_name"` - Name string `json:"name"` - Number int `json:"number"` - Model UniqueGiftModel `json:"model"` - Symbol UniqueGiftSymbol `json:"symbol"` - Backdrop UniqueGiftBackdrop `json:"backdrop"` + BaseName string `json:"base_name"` + Name string `json:"name"` + Number int `json:"number"` + Model UniqueGiftModel `json:"model"` + Symbol UniqueGiftSymbol `json:"symbol"` + Backdrop UniqueGiftBackdrop `json:"backdrop"` + PublisherChat *Chat `json:"publisher_chat,omitempty"` } // UniqueGiftModel https://core.telegram.org/bots/api#uniquegiftmodel diff --git a/vendor/github.com/go-telegram/bot/models/message.go b/vendor/github.com/go-telegram/bot/models/message.go index b5b45bf..3dd138c 100644 --- a/vendor/github.com/go-telegram/bot/models/message.go +++ b/vendor/github.com/go-telegram/bot/models/message.go @@ -72,6 +72,7 @@ type MessageAutoDeleteTimerChanged struct { type Message struct { ID int `json:"message_id"` MessageThreadID int `json:"message_thread_id,omitempty"` + DirectMessagesTopic *DirectMessagesTopic `json:"direct_messages_topic,omitempty"` From *User `json:"from,omitempty"` SenderChat *Chat `json:"sender_chat,omitempty"` SenderBoostCount int `json:"sender_boost_count,omitempty"` @@ -86,16 +87,19 @@ type Message struct { ExternalReply *ExternalReplyInfo `json:"external_reply,omitempty"` Quote *TextQuote `json:"quote,omitempty"` ReplyToStore *Story `json:"reply_to_store,omitempty"` + ReplyToChecklistTaskID int `json:"reply_to_checklist_task_id,omitempty"` ViaBot *User `json:"via_bot,omitempty"` EditDate int `json:"edit_date,omitempty"` HasProtectedContent bool `json:"has_protected_content,omitempty"` IsFromOffline bool `json:"is_from_offline,omitempty"` + IsPaidPost bool `json:"is_paid_post,omitempty"` MediaGroupID string `json:"media_group_id,omitempty"` AuthorSignature string `json:"author_signature,omitempty"` PaidStarCount int `json:"paid_star_count,omitempty"` Text string `json:"text,omitempty"` Entities []MessageEntity `json:"entities,omitempty"` LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options,omitempty"` + SuggestedPostInfo *SuggestedPostInfo `json:"suggested_post_info,omitempty"` EffectID string `json:"effect_id,omitempty"` Animation *Animation `json:"animation,omitempty"` Audio *Audio `json:"audio,omitempty"` @@ -157,6 +161,11 @@ type Message struct { GiveawayWinners *GiveawayWinners `json:"giveaway_winners,omitempty"` GiveawayCompleted *GiveawayCompleted `json:"giveaway_completed,omitempty"` PaidMessagePriceChanged *PaidMessagePriceChanged `json:"paid_message_price_changed,omitempty"` + SuggestedPostApproved *SuggestedPostApproved `json:"suggested_post_approved,omitempty"` + SuggestedPostApprovalFailed *SuggestedPostApprovalFailed `json:"suggested_post_approval_failed,omitempty"` + SuggestedPostDeclined *SuggestedPostDeclined `json:"suggested_post_declined,omitempty"` + SuggestedPostPaid *SuggestedPostPaid `json:"suggested_post_paid,omitempty"` + SuggestedPostRefunded *SuggestedPostRefunded `json:"suggested_post_refunded,omitempty"` VoiceChatScheduled *VoiceChatScheduled `json:"voice_chat_scheduled,omitempty"` VoiceChatStarted *VoiceChatStarted `json:"voice_chat_started,omitempty"` VoiceChatEnded *VoiceChatEnded `json:"voice_chat_ended,omitempty"` @@ -170,3 +179,9 @@ type PreparedInlineMessage struct { ID string `json:"id"` ExpirationDate int `json:"expiration_date"` } + +// DirectMessagesTopic https://core.telegram.org/bots/api#directmessagestopic +type DirectMessagesTopic struct { + TopicID int `json:"topic_id"` + User *User `json:"user,omitempty"` +} diff --git a/vendor/github.com/go-telegram/bot/models/reply.go b/vendor/github.com/go-telegram/bot/models/reply.go index b50e87e..5eb14bb 100644 --- a/vendor/github.com/go-telegram/bot/models/reply.go +++ b/vendor/github.com/go-telegram/bot/models/reply.go @@ -51,6 +51,7 @@ type ReplyParameters struct { QuoteParseMode ParseMode `json:"quote_parse_mode,omitempty"` QuoteEntities []MessageEntity `json:"quote_entities,omitempty"` QuotePosition int `json:"quote_position,omitempty"` + ChecklistTaskID int `json:"checklist_task_id,omitempty"` } // MessageOriginType https://core.telegram.org/bots/api#messageorigin diff --git a/vendor/github.com/go-telegram/bot/models/sticker.go b/vendor/github.com/go-telegram/bot/models/sticker.go index 763b361..b5eab26 100644 --- a/vendor/github.com/go-telegram/bot/models/sticker.go +++ b/vendor/github.com/go-telegram/bot/models/sticker.go @@ -1,5 +1,7 @@ package models +import "io" + // MaskPosition https://core.telegram.org/bots/api#maskposition type MaskPosition struct { Point string `json:"point"` @@ -29,9 +31,11 @@ type Sticker struct { // InputSticker https://core.telegram.org/bots/api#inputsticker type InputSticker struct { - Sticker InputFile `json:"sticker"` + Sticker string `json:"sticker"` Format string `json:"format"` EmojiList []string `json:"emoji_list"` MaskPosition *MaskPosition `json:"mask_position,omitempty"` Keywords []string `json:"keywords,omitempty"` + + StickerAttachment io.Reader `json:"-"` } diff --git a/vendor/github.com/go-telegram/bot/models/suggested_post.go b/vendor/github.com/go-telegram/bot/models/suggested_post.go new file mode 100644 index 0000000..58d6bbd --- /dev/null +++ b/vendor/github.com/go-telegram/bot/models/suggested_post.go @@ -0,0 +1,53 @@ +package models + +// SuggestedPostParameters https://core.telegram.org/bots/api#suggestedpostparameters +type SuggestedPostParameters struct { + Price *SuggestedPostPrice `json:"price,omitempty"` + SendDate int `json:"send_date,omitempty"` +} + +// SuggestedPostPrice https://core.telegram.org/bots/api#suggestedpostprice +type SuggestedPostPrice struct { + Currency string `json:"currency"` + Amount int `json:"amount"` +} + +// SuggestedPostInfo https://core.telegram.org/bots/api#suggestedpostinfo +type SuggestedPostInfo struct { + State string `json:"state"` + Price *SuggestedPostPrice `json:"price,omitempty"` + SendDate int `json:"send_date,omitempty"` +} + +// SuggestedPostApproved https://core.telegram.org/bots/api#suggestedpostapproved +type SuggestedPostApproved struct { + SuggestedPostMessage *Message `json:"suggested_post_message,omitempty"` + Price *SuggestedPostPrice `json:"price,omitempty"` + SendDate int `json:"send_date,omitempty"` +} + +// SuggestedPostApprovalFailed https://core.telegram.org/bots/api#suggestedpostapprovalfailed +type SuggestedPostApprovalFailed struct { + SuggestedPostMessage *Message `json:"suggested_post_message,omitempty"` + Price *SuggestedPostPrice `json:"price,omitempty"` +} + +// SuggestedPostDeclined https://core.telegram.org/bots/api#suggestedpostdeclined +type SuggestedPostDeclined struct { + SuggestedPostMessage *Message `json:"suggested_post_message,omitempty"` + Comment string `json:"comment,omitempty"` +} + +// SuggestedPostPaid https://core.telegram.org/bots/api#suggestedpostpaid +type SuggestedPostPaid struct { + SuggestedPostMessage *Message `json:"suggested_post_message,omitempty"` + Currency string `json:"currency"` + Amount int `json:"amount,omitempty"` + StarAmount *StarAmount `json:"star_amount,omitempty"` +} + +// SuggestedPostRefunded https://core.telegram.org/bots/api#suggestedpostrefunded +type SuggestedPostRefunded struct { + SuggestedPostMessage *Message `json:"suggested_post_message,omitempty"` + Reason string `json:"reason"` +} diff --git a/vendor/github.com/go-telegram/bot/raw_request.go b/vendor/github.com/go-telegram/bot/raw_request.go index 3c4019f..4c87c90 100644 --- a/vendor/github.com/go-telegram/bot/raw_request.go +++ b/vendor/github.com/go-telegram/bot/raw_request.go @@ -4,6 +4,7 @@ import ( "bytes" "context" "encoding/json" + "errors" "fmt" "io" "mime/multipart" @@ -24,28 +25,31 @@ type apiResponse struct { } func (b *Bot) rawRequest(ctx context.Context, method string, params any, dest any) error { - var httpBody io.Reader = http.NoBody - var contentType string - - if params != nil && !reflect.ValueOf(params).IsNil() { - buf := bytes.NewBuffer(nil) - form := multipart.NewWriter(buf) - - fieldsCount, errFormData := buildRequestForm(form, params) - if errFormData != nil { - return fmt.Errorf("error build request form for method %s, %w", method, errFormData) - } + pr, pw := io.Pipe() + form := multipart.NewWriter(pw) + + go func() { + if params != nil && !reflect.ValueOf(params).IsNil() { + _, errFormData := buildRequestForm(form, params) + if errFormData != nil { + if errClose := pw.CloseWithError(fmt.Errorf("error build request form for method %s, %w", method, errFormData)); errClose != nil { + b.errorsHandler(fmt.Errorf("error close pipe writer for method %s, %w", method, errClose)) + } + return + } - errFormClose := form.Close() - if errFormClose != nil { - return fmt.Errorf("error form close for method %s, %w", method, errFormClose) + errFormClose := form.Close() + if errFormClose != nil { + if errClose := pw.CloseWithError(fmt.Errorf("error form close for method %s, %w", method, errFormClose)); errClose != nil { + b.errorsHandler(fmt.Errorf("error close pipe writer for method %s, %w", method, errClose)) + } + return + } } - - if fieldsCount > 0 { - httpBody = buf - contentType = form.FormDataContentType() + if errClose := pw.Close(); errClose != nil { + b.errorsHandler(fmt.Errorf("error close pipe writer for method %s, %w", method, errClose)) } - } + }() u := b.url + "/bot" + b.token + "/" if b.testEnvironment { @@ -55,21 +59,23 @@ func (b *Bot) rawRequest(ctx context.Context, method string, params any, dest an if b.isDebug && strings.ToLower(method) != "getupdates" { requestDebugData, _ := json.Marshal(params) - b.debugHandler("request url: %s, payload: %s", u, requestDebugData) + b.debugHandler("request url: %s, payload: %s", strings.Replace(u, b.token, "***", 1), requestDebugData) } - req, errRequest := http.NewRequestWithContext(ctx, http.MethodPost, u, httpBody) + req, errRequest := http.NewRequestWithContext(ctx, http.MethodPost, u, pr) if errRequest != nil { return fmt.Errorf("error create request for method %s, %w", method, errRequest) } - if contentType != "" { - req.Header.Add("Content-Type", contentType) - } + req.Header.Add("Content-Type", form.FormDataContentType()) resp, errDo := b.client.Do(req) if errDo != nil { - return fmt.Errorf("error do request for method %s, %w", method, errDo) + if errClose := pr.CloseWithError(errDo); errClose != nil { + b.errorsHandler(fmt.Errorf("error close pipe reader for method %s, %w", method, errClose)) + } + errDoC := errors.New(strings.Replace(errDo.Error(), b.token, "***", -1)) + return fmt.Errorf("error do request for method %s, %w", method, errDoC) } defer func() { if err := resp.Body.Close(); err != nil { @@ -122,7 +128,7 @@ func (b *Bot) rawRequest(ctx context.Context, method string, params any, dest an if !bytes.Equal(r.Result, []byte("[]")) { if b.isDebug { - b.debugHandler("response from '%s' with payload '%s'", u, body) + b.debugHandler("response from '%s' with payload '%s'", strings.Replace(u, b.token, "***", 1), body) } } diff --git a/vendor/modules.txt b/vendor/modules.txt index 14645ae..19115b2 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,7 +1,7 @@ # github.com/davecgh/go-spew v1.1.1 ## explicit github.com/davecgh/go-spew/spew -# github.com/go-telegram/bot v1.16.0 +# github.com/go-telegram/bot v1.17.0 ## explicit; go 1.18 github.com/go-telegram/bot github.com/go-telegram/bot/models