(new): support Bot API 10.3
Golang lint / lint (push) Failing after 1m37s

(fix): finalize v2 contracts
(tests): cover v2 migration
(doc): prepare release guidance
This commit is contained in:
2026-09-08 23:21:38 +03:00
parent 24040fe164
commit d78526242b
88 changed files with 2321 additions and 918 deletions
+34 -36
View File
@@ -18,10 +18,8 @@ type SendSticker struct {
// DirectMessagesTopicID Optional. Identifier of the direct messages topic to which the message will be
// sent; required if the message is sent to a direct messages chat
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
// ReceiverUserID identifies the user who can see the ephemeral message.
ReceiverUserID int64 `json:"receiver_user_id,omitempty"` // Since: Bot API 10.2
// CallbackQueryID identifies the callback query that triggered an ephemeral response.
CallbackQueryID string `json:"callback_query_id,omitempty"` // Since: Bot API 10.2
// EphemeralMessageParameters configures an ephemeral response.
EphemeralMessageParameters *EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"` // Since: Bot API 10.3
// Sticker Required. Sticker to send. Pass a file_id as String to send a file that exists on the Telegram
// servers (recommended), pass an HTTP URL as a String for Telegram to get a .WEBP sticker from the
@@ -59,7 +57,7 @@ type SendSticker struct {
// See https://core.telegram.org/bots/api#sendsticker
func (api *API) SendSticker(params SendSticker) (Message, error) {
req := NewRequestWithChatID[Message]("sendSticker", params, params.ChatID)
return req.Do(api)
return api.Do(req)
}
// SendStickerWithContext is the context-aware variant of SendSticker.
@@ -68,7 +66,7 @@ func (api *API) SendSticker(params SendSticker) (Message, error) {
// See https://core.telegram.org/bots/api#sendsticker
func (api *API) SendStickerWithContext(ctx context.Context, params SendSticker) (Message, error) {
req := NewRequestWithChatID[Message]("sendSticker", params, params.ChatID)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// GetStickerSet holds parameters for the getStickerSet method.
@@ -84,7 +82,7 @@ type GetStickerSet struct {
// See https://core.telegram.org/bots/api#getstickerset
func (api *API) GetStickerSet(params GetStickerSet) (StickerSet, error) {
req := NewRequest[StickerSet]("getStickerSet", params)
return req.Do(api)
return api.Do(req)
}
// GetStickerSetWithContext is the context-aware variant of GetStickerSet.
@@ -93,7 +91,7 @@ func (api *API) GetStickerSet(params GetStickerSet) (StickerSet, error) {
// See https://core.telegram.org/bots/api#getstickerset
func (api *API) GetStickerSetWithContext(ctx context.Context, params GetStickerSet) (StickerSet, error) {
req := NewRequest[StickerSet]("getStickerSet", params)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// GetCustomEmojiStickers holds parameters for the getCustomEmojiStickers method.
@@ -110,7 +108,7 @@ type GetCustomEmojiStickers struct {
// See https://core.telegram.org/bots/api#getcustomemojistickers
func (api *API) GetCustomEmojiStickers(params GetCustomEmojiStickers) ([]Sticker, error) {
req := NewRequest[[]Sticker]("getCustomEmojiStickers", params)
return req.Do(api)
return api.Do(req)
}
// GetCustomEmojiStickersWithContext is the context-aware variant of GetCustomEmojiStickers.
@@ -119,7 +117,7 @@ func (api *API) GetCustomEmojiStickers(params GetCustomEmojiStickers) ([]Sticker
// See https://core.telegram.org/bots/api#getcustomemojistickers
func (api *API) GetCustomEmojiStickersWithContext(ctx context.Context, params GetCustomEmojiStickers) ([]Sticker, error) {
req := NewRequest[[]Sticker]("getCustomEmojiStickers", params)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// UploadStickerFile holds parameters for the uploadStickerFile method.
@@ -142,7 +140,7 @@ func (api *API) UploadStickerFile(params UploadStickerFile, sticker UploaderFile
_ = uploader.Close()
}()
req := NewUploaderRequest[File]("uploadStickerFile", params, sticker.SetType(UploaderStickerType))
return req.Do(uploader)
return uploader.Do(req)
}
// UploadStickerFileWithContext is the context-aware variant of UploadStickerFile.
@@ -155,7 +153,7 @@ func (api *API) UploadStickerFileWithContext(ctx context.Context, params UploadS
_ = uploader.Close()
}()
req := NewUploaderRequest[File]("uploadStickerFile", params, sticker.SetType(UploaderStickerType))
return req.DoWithContext(ctx, uploader)
return uploader.DoWithContext(ctx, req)
}
// CreateNewStickerSet holds parameters for the createNewStickerSet method.
@@ -188,7 +186,7 @@ type CreateNewStickerSet struct {
// See https://core.telegram.org/bots/api#createnewstickerset
func (api *API) CreateNewStickerSet(params CreateNewStickerSet) (bool, error) {
req := NewRequest[bool]("createNewStickerSet", params)
return req.Do(api)
return api.Do(req)
}
// CreateNewStickerSetWithContext is the context-aware variant of CreateNewStickerSet.
@@ -197,7 +195,7 @@ func (api *API) CreateNewStickerSet(params CreateNewStickerSet) (bool, error) {
// See https://core.telegram.org/bots/api#createnewstickerset
func (api *API) CreateNewStickerSetWithContext(ctx context.Context, params CreateNewStickerSet) (bool, error) {
req := NewRequest[bool]("createNewStickerSet", params)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// AddStickerToSet holds parameters for the addStickerToSet method.
@@ -219,7 +217,7 @@ type AddStickerToSet struct {
// See https://core.telegram.org/bots/api#addstickertoset
func (api *API) AddStickerToSet(params AddStickerToSet) (bool, error) {
req := NewRequest[bool]("addStickerToSet", params)
return req.Do(api)
return api.Do(req)
}
// AddStickerToSetWithContext is the context-aware variant of AddStickerToSet.
@@ -228,7 +226,7 @@ func (api *API) AddStickerToSet(params AddStickerToSet) (bool, error) {
// See https://core.telegram.org/bots/api#addstickertoset
func (api *API) AddStickerToSetWithContext(ctx context.Context, params AddStickerToSet) (bool, error) {
req := NewRequest[bool]("addStickerToSet", params)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// SetStickerPositionInSet holds parameters for the setStickerPositionInSet method.
@@ -247,7 +245,7 @@ type SetStickerPositionInSet struct {
// See https://core.telegram.org/bots/api#setstickerpositioninset
func (api *API) SetStickerPositionInSet(params SetStickerPositionInSet) (bool, error) {
req := NewRequest[bool]("setStickerPositionInSet", params)
return req.Do(api)
return api.Do(req)
}
// SetStickerPositionInSetWithContext is the context-aware variant of SetStickerPositionInSet.
@@ -256,7 +254,7 @@ func (api *API) SetStickerPositionInSet(params SetStickerPositionInSet) (bool, e
// See https://core.telegram.org/bots/api#setstickerpositioninset
func (api *API) SetStickerPositionInSetWithContext(ctx context.Context, params SetStickerPositionInSet) (bool, error) {
req := NewRequest[bool]("setStickerPositionInSet", params)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// DeleteStickerFromSet holds parameters for the deleteStickerFromSet method.
@@ -273,7 +271,7 @@ type DeleteStickerFromSet struct {
// See https://core.telegram.org/bots/api#deletestickerfromset
func (api *API) DeleteStickerFromSet(params DeleteStickerFromSet) (bool, error) {
req := NewRequest[bool]("deleteStickerFromSet", params)
return req.Do(api)
return api.Do(req)
}
// DeleteStickerFromSetWithContext is the context-aware variant of DeleteStickerFromSet.
@@ -282,7 +280,7 @@ func (api *API) DeleteStickerFromSet(params DeleteStickerFromSet) (bool, error)
// See https://core.telegram.org/bots/api#deletestickerfromset
func (api *API) DeleteStickerFromSetWithContext(ctx context.Context, params DeleteStickerFromSet) (bool, error) {
req := NewRequest[bool]("deleteStickerFromSet", params)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// ReplaceStickerInSet holds parameters for the replaceStickerInSet method.
@@ -306,7 +304,7 @@ type ReplaceStickerInSet struct {
// See https://core.telegram.org/bots/api#replacestickerinset
func (api *API) ReplaceStickerInSet(params ReplaceStickerInSet) (bool, error) {
req := NewRequest[bool]("replaceStickerInSet", params)
return req.Do(api)
return api.Do(req)
}
// ReplaceStickerInSetWithContext is the context-aware variant of ReplaceStickerInSet.
@@ -315,7 +313,7 @@ func (api *API) ReplaceStickerInSet(params ReplaceStickerInSet) (bool, error) {
// See https://core.telegram.org/bots/api#replacestickerinset
func (api *API) ReplaceStickerInSetWithContext(ctx context.Context, params ReplaceStickerInSet) (bool, error) {
req := NewRequest[bool]("replaceStickerInSet", params)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// SetStickerEmojiList holds parameters for the setStickerEmojiList method.
@@ -334,7 +332,7 @@ type SetStickerEmojiList struct {
// See https://core.telegram.org/bots/api#setstickeremojilist
func (api *API) SetStickerEmojiList(params SetStickerEmojiList) (bool, error) {
req := NewRequest[bool]("setStickerEmojiList", params)
return req.Do(api)
return api.Do(req)
}
// SetStickerEmojiListWithContext is the context-aware variant of SetStickerEmojiList.
@@ -343,7 +341,7 @@ func (api *API) SetStickerEmojiList(params SetStickerEmojiList) (bool, error) {
// See https://core.telegram.org/bots/api#setstickeremojilist
func (api *API) SetStickerEmojiListWithContext(ctx context.Context, params SetStickerEmojiList) (bool, error) {
req := NewRequest[bool]("setStickerEmojiList", params)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// SetStickerKeywords holds parameters for the setStickerKeywords method.
@@ -363,7 +361,7 @@ type SetStickerKeywords struct {
// See https://core.telegram.org/bots/api#setstickerkeywords
func (api *API) SetStickerKeywords(params SetStickerKeywords) (bool, error) {
req := NewRequest[bool]("setStickerKeywords", params)
return req.Do(api)
return api.Do(req)
}
// SetStickerKeywordsWithContext is the context-aware variant of SetStickerKeywords.
@@ -372,7 +370,7 @@ func (api *API) SetStickerKeywords(params SetStickerKeywords) (bool, error) {
// See https://core.telegram.org/bots/api#setstickerkeywords
func (api *API) SetStickerKeywordsWithContext(ctx context.Context, params SetStickerKeywords) (bool, error) {
req := NewRequest[bool]("setStickerKeywords", params)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// SetStickerMaskPosition holds parameters for the setStickerMaskPosition method.
@@ -392,7 +390,7 @@ type SetStickerMaskPosition struct {
// See https://core.telegram.org/bots/api#setstickermaskposition
func (api *API) SetStickerMaskPosition(params SetStickerMaskPosition) (bool, error) {
req := NewRequest[bool]("setStickerMaskPosition", params)
return req.Do(api)
return api.Do(req)
}
// SetStickerMaskPositionWithContext is the context-aware variant of SetStickerMaskPosition.
@@ -401,7 +399,7 @@ func (api *API) SetStickerMaskPosition(params SetStickerMaskPosition) (bool, err
// See https://core.telegram.org/bots/api#setstickermaskposition
func (api *API) SetStickerMaskPositionWithContext(ctx context.Context, params SetStickerMaskPosition) (bool, error) {
req := NewRequest[bool]("setStickerMaskPosition", params)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// SetStickerSetTitle holds parameters for the setStickerSetTitle method.
@@ -420,7 +418,7 @@ type SetStickerSetTitle struct {
// See https://core.telegram.org/bots/api#setstickersettitle
func (api *API) SetStickerSetTitle(params SetStickerSetTitle) (bool, error) {
req := NewRequest[bool]("setStickerSetTitle", params)
return req.Do(api)
return api.Do(req)
}
// SetStickerSetTitleWithContext is the context-aware variant of SetStickerSetTitle.
@@ -429,7 +427,7 @@ func (api *API) SetStickerSetTitle(params SetStickerSetTitle) (bool, error) {
// See https://core.telegram.org/bots/api#setstickersettitle
func (api *API) SetStickerSetTitleWithContext(ctx context.Context, params SetStickerSetTitle) (bool, error) {
req := NewRequest[bool]("setStickerSetTitle", params)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// SetStickerSetThumbnail holds parameters for the setStickerSetThumbnail method.
@@ -461,7 +459,7 @@ type SetStickerSetThumbnail struct {
// See https://core.telegram.org/bots/api#setstickersetthumbnail
func (api *API) SetStickerSetThumbnail(params SetStickerSetThumbnail) (bool, error) {
req := NewRequest[bool]("setStickerSetThumbnail", params)
return req.Do(api)
return api.Do(req)
}
// SetStickerSetThumbnailWithContext is the context-aware variant of SetStickerSetThumbnail.
@@ -470,7 +468,7 @@ func (api *API) SetStickerSetThumbnail(params SetStickerSetThumbnail) (bool, err
// See https://core.telegram.org/bots/api#setstickersetthumbnail
func (api *API) SetStickerSetThumbnailWithContext(ctx context.Context, params SetStickerSetThumbnail) (bool, error) {
req := NewRequest[bool]("setStickerSetThumbnail", params)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// SetCustomEmojiStickerSetThumbnail holds parameters for the setCustomEmojiStickerSetThumbnail method.
@@ -490,7 +488,7 @@ type SetCustomEmojiStickerSetThumbnail struct {
// See https://core.telegram.org/bots/api#setcustomemojistickersetthumbnail
func (api *API) SetCustomEmojiStickerSetThumbnail(params SetCustomEmojiStickerSetThumbnail) (bool, error) {
req := NewRequest[bool]("setCustomEmojiStickerSetThumbnail", params)
return req.Do(api)
return api.Do(req)
}
// SetCustomEmojiStickerSetThumbnailWithContext is the context-aware variant of SetCustomEmojiStickerSetThumbnail.
@@ -499,7 +497,7 @@ func (api *API) SetCustomEmojiStickerSetThumbnail(params SetCustomEmojiStickerSe
// See https://core.telegram.org/bots/api#setcustomemojistickersetthumbnail
func (api *API) SetCustomEmojiStickerSetThumbnailWithContext(ctx context.Context, params SetCustomEmojiStickerSetThumbnail) (bool, error) {
req := NewRequest[bool]("setCustomEmojiStickerSetThumbnail", params)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// DeleteStickerSet holds parameters for the deleteStickerSet method.
@@ -516,7 +514,7 @@ type DeleteStickerSet struct {
// See https://core.telegram.org/bots/api#deletestickerset
func (api *API) DeleteStickerSet(params DeleteStickerSet) (bool, error) {
req := NewRequest[bool]("deleteStickerSet", params)
return req.Do(api)
return api.Do(req)
}
// DeleteStickerSetWithContext is the context-aware variant of DeleteStickerSet.
@@ -525,5 +523,5 @@ func (api *API) DeleteStickerSet(params DeleteStickerSet) (bool, error) {
// See https://core.telegram.org/bots/api#deletestickerset
func (api *API) DeleteStickerSetWithContext(ctx context.Context, params DeleteStickerSet) (bool, error) {
req := NewRequest[bool]("deleteStickerSet", params)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}