(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
+36 -52
View File
@@ -18,10 +18,8 @@ type SendPhoto 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 *EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"` // Since: Bot API 10.3
// Photo Required. Photo to send. Pass a file_id as String to send a photo that exists on the Telegram
// servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, or
@@ -72,7 +70,7 @@ type SendPhoto struct {
// See https://core.telegram.org/bots/api#sendphoto
func (api *API) SendPhoto(params SendPhoto) (Message, error) {
req := NewRequestWithChatID[Message]("sendPhoto", params, params.ChatID)
return req.Do(api)
return api.Do(req)
}
// SendPhotoWithContext is the context-aware variant of SendPhoto.
@@ -81,7 +79,7 @@ func (api *API) SendPhoto(params SendPhoto) (Message, error) {
// See https://core.telegram.org/bots/api#sendphoto
func (api *API) SendPhotoWithContext(ctx context.Context, params SendPhoto) (Message, error) {
req := NewRequestWithChatID[Message]("sendPhoto", params, params.ChatID)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// SendAudio holds parameters for the sendAudio method.
@@ -100,10 +98,8 @@ type SendAudio 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 *EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"` // Since: Bot API 10.3
// Audio Required. Audio file to send. Pass a file_id as String to send an audio file that exists on the
// Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the
@@ -160,7 +156,7 @@ type SendAudio struct {
// See https://core.telegram.org/bots/api#sendaudio
func (api *API) SendAudio(params SendAudio) (Message, error) {
req := NewRequestWithChatID[Message]("sendAudio", params, params.ChatID)
return req.Do(api)
return api.Do(req)
}
// SendAudioWithContext is the context-aware variant of SendAudio.
@@ -169,7 +165,7 @@ func (api *API) SendAudio(params SendAudio) (Message, error) {
// See https://core.telegram.org/bots/api#sendaudio
func (api *API) SendAudioWithContext(ctx context.Context, params SendAudio) (Message, error) {
req := NewRequestWithChatID[Message]("sendAudio", params, params.ChatID)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// SendDocument holds parameters for the sendDocument method.
@@ -188,10 +184,8 @@ type SendDocument 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 *EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"` // Since: Bot API 10.3
// Document Required. File 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 file from the Internet, or
@@ -246,7 +240,7 @@ type SendDocument struct {
// See https://core.telegram.org/bots/api#senddocument
func (api *API) SendDocument(params SendDocument) (Message, error) {
req := NewRequestWithChatID[Message]("sendDocument", params, params.ChatID)
return req.Do(api)
return api.Do(req)
}
// SendDocumentWithContext is the context-aware variant of SendDocument.
@@ -255,7 +249,7 @@ func (api *API) SendDocument(params SendDocument) (Message, error) {
// See https://core.telegram.org/bots/api#senddocument
func (api *API) SendDocumentWithContext(ctx context.Context, params SendDocument) (Message, error) {
req := NewRequestWithChatID[Message]("sendDocument", params, params.ChatID)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// SendVideo holds parameters for the sendVideo method.
@@ -274,10 +268,8 @@ type SendVideo 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 *EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"` // Since: Bot API 10.3
// Video Required. Video to send. Pass a file_id as String to send a video that exists on the Telegram
// servers (recommended), pass an HTTP URL as a String for Telegram to get a video from the Internet, or
@@ -349,7 +341,7 @@ type SendVideo struct {
// See https://core.telegram.org/bots/api#sendvideo
func (api *API) SendVideo(params SendVideo) (Message, error) {
req := NewRequestWithChatID[Message]("sendVideo", params, params.ChatID)
return req.Do(api)
return api.Do(req)
}
// SendVideoWithContext is the context-aware variant of SendVideo.
@@ -358,7 +350,7 @@ func (api *API) SendVideo(params SendVideo) (Message, error) {
// See https://core.telegram.org/bots/api#sendvideo
func (api *API) SendVideoWithContext(ctx context.Context, params SendVideo) (Message, error) {
req := NewRequestWithChatID[Message]("sendVideo", params, params.ChatID)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// SendAnimation holds parameters for the sendAnimation method.
@@ -377,10 +369,8 @@ type SendAnimation 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 *EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"` // Since: Bot API 10.3
// Animation Required. Animation to send. Pass a file_id as String to send an animation that exists on the
// Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the
@@ -442,7 +432,7 @@ type SendAnimation struct {
// See https://core.telegram.org/bots/api#sendanimation
func (api *API) SendAnimation(params SendAnimation) (Message, error) {
req := NewRequestWithChatID[Message]("sendAnimation", params, params.ChatID)
return req.Do(api)
return api.Do(req)
}
// SendAnimationWithContext is the context-aware variant of SendAnimation.
@@ -451,7 +441,7 @@ func (api *API) SendAnimation(params SendAnimation) (Message, error) {
// See https://core.telegram.org/bots/api#sendanimation
func (api *API) SendAnimationWithContext(ctx context.Context, params SendAnimation) (Message, error) {
req := NewRequestWithChatID[Message]("sendAnimation", params, params.ChatID)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// SendVoice holds parameters for the sendVoice method.
@@ -470,10 +460,8 @@ type SendVoice 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 *EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"` // Since: Bot API 10.3
// Voice Required. Audio file 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 file from the Internet, or
@@ -518,7 +506,7 @@ type SendVoice struct {
// See https://core.telegram.org/bots/api#sendvoice
func (api *API) SendVoice(params SendVoice) (Message, error) {
req := NewRequestWithChatID[Message]("sendVoice", params, params.ChatID)
return req.Do(api)
return api.Do(req)
}
// SendVoiceWithContext is the context-aware variant of SendVoice.
@@ -527,7 +515,7 @@ func (api *API) SendVoice(params SendVoice) (Message, error) {
// See https://core.telegram.org/bots/api#sendvoice
func (api *API) SendVoiceWithContext(ctx context.Context, params SendVoice) (Message, error) {
req := NewRequestWithChatID[Message]("sendVoice", params, params.ChatID)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// SendVideoNote holds parameters for the sendVideoNote method.
@@ -546,10 +534,8 @@ type SendVideoNote 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 *EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"` // Since: Bot API 10.3
// VideoNote Required. Video note to send. Pass a file_id as String to send a video note that exists on the
// Telegram servers (recommended) or upload a new video using multipart/form-data. More information on
@@ -595,7 +581,7 @@ type SendVideoNote struct {
// See https://core.telegram.org/bots/api#sendvideonote
func (api *API) SendVideoNote(params SendVideoNote) (Message, error) {
req := NewRequestWithChatID[Message]("sendVideoNote", params, params.ChatID)
return req.Do(api)
return api.Do(req)
}
// SendVideoNoteWithContext is the context-aware variant of SendVideoNote.
@@ -604,7 +590,7 @@ func (api *API) SendVideoNote(params SendVideoNote) (Message, error) {
// See https://core.telegram.org/bots/api#sendvideonote
func (api *API) SendVideoNoteWithContext(ctx context.Context, params SendVideoNote) (Message, error) {
req := NewRequestWithChatID[Message]("sendVideoNote", params, params.ChatID)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// SendPaidMedia holds parameters for the sendPaidMedia method.
@@ -668,7 +654,7 @@ type SendPaidMedia struct {
// See https://core.telegram.org/bots/api#sendpaidmedia
func (api *API) SendPaidMedia(params SendPaidMedia) (Message, error) {
req := NewRequestWithChatID[Message]("sendPaidMedia", params, params.ChatID)
return req.Do(api)
return api.Do(req)
}
// SendPaidMediaWithContext is the context-aware variant of SendPaidMedia.
@@ -677,7 +663,7 @@ func (api *API) SendPaidMedia(params SendPaidMedia) (Message, error) {
// See https://core.telegram.org/bots/api#sendpaidmedia
func (api *API) SendPaidMediaWithContext(ctx context.Context, params SendPaidMedia) (Message, error) {
req := NewRequestWithChatID[Message]("sendPaidMedia", params, params.ChatID)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// SendMediaGroup holds parameters for the sendMediaGroup method.
@@ -719,7 +705,7 @@ type SendMediaGroup struct {
// See https://core.telegram.org/bots/api#sendmediagroup
func (api *API) SendMediaGroup(params SendMediaGroup) ([]Message, error) {
req := NewRequestWithChatID[[]Message]("sendMediaGroup", params, params.ChatID)
return req.Do(api)
return api.Do(req)
}
// SendMediaGroupWithContext is the context-aware variant of SendMediaGroup.
@@ -728,7 +714,7 @@ func (api *API) SendMediaGroup(params SendMediaGroup) ([]Message, error) {
// See https://core.telegram.org/bots/api#sendmediagroup
func (api *API) SendMediaGroupWithContext(ctx context.Context, params SendMediaGroup) ([]Message, error) {
req := NewRequestWithChatID[[]Message]("sendMediaGroup", params, params.ChatID)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}
// SendLivePhoto holds parameters for the sendLivePhoto method.
@@ -748,10 +734,8 @@ type SendLivePhoto struct {
// 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 *EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"` // Since: Bot API 10.3
// LivePhoto Required. Live photo video to send. The video must be no longer than 10 seconds and must not
// exceed 10 MB in size. Pass a file_id as String to send a video that exists on the Telegram servers
// (recommended) or upload a new video using multipart/form-data. More information on Sending Files ».
@@ -802,7 +786,7 @@ type SendLivePhoto struct {
// See https://core.telegram.org/bots/api#sendlivephoto
func (api *API) SendLivePhoto(params SendLivePhoto) (Message, error) {
req := NewRequestWithChatID[Message]("sendLivePhoto", params, params.ChatID)
return req.Do(api)
return api.Do(req)
}
// SendLivePhotoWithContext is the context-aware variant of SendLivePhoto.
@@ -811,5 +795,5 @@ func (api *API) SendLivePhoto(params SendLivePhoto) (Message, error) {
// See https://core.telegram.org/bots/api#sendlivephoto
func (api *API) SendLivePhotoWithContext(ctx context.Context, params SendLivePhoto) (Message, error) {
req := NewRequestWithChatID[Message]("sendLivePhoto", params, params.ChatID)
return req.DoWithContext(ctx, api)
return api.DoWithContext(ctx, req)
}