(new): Bot API 10.0
(doc): Since: Bot API X.Y annotations across all tgapi types and methods
This commit is contained in:
@@ -3,6 +3,7 @@ package tgapi
|
||||
import "context"
|
||||
|
||||
// SendPhoto holds parameters for the sendPhoto method.
|
||||
// Since: Bot API 1.0
|
||||
// See https://core.telegram.org/bots/api#sendphoto
|
||||
type SendPhoto struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -28,6 +29,7 @@ type SendPhoto struct {
|
||||
}
|
||||
|
||||
// SendPhoto sends a photo.
|
||||
// Since: Bot API 1.0
|
||||
// See https://core.telegram.org/bots/api#sendphoto
|
||||
func (api *API) SendPhoto(params SendPhoto) (Message, error) {
|
||||
req := NewRequestWithChatID[Message]("sendPhoto", params, params.ChatID)
|
||||
@@ -35,6 +37,7 @@ func (api *API) SendPhoto(params SendPhoto) (Message, error) {
|
||||
}
|
||||
|
||||
// SendPhotoWithContext is the context-aware variant of SendPhoto.
|
||||
// Since: Bot API 1.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#sendphoto
|
||||
func (api *API) SendPhotoWithContext(ctx context.Context, params SendPhoto) (Message, error) {
|
||||
@@ -43,6 +46,7 @@ func (api *API) SendPhotoWithContext(ctx context.Context, params SendPhoto) (Mes
|
||||
}
|
||||
|
||||
// SendAudio holds parameters for the sendAudio method.
|
||||
// Since: Bot API 1.2
|
||||
// See https://core.telegram.org/bots/api#sendaudio
|
||||
type SendAudio struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -70,6 +74,7 @@ type SendAudio struct {
|
||||
}
|
||||
|
||||
// SendAudio sends an audio file.
|
||||
// Since: Bot API 1.2
|
||||
// See https://core.telegram.org/bots/api#sendaudio
|
||||
func (api *API) SendAudio(params SendAudio) (Message, error) {
|
||||
req := NewRequestWithChatID[Message]("sendAudio", params, params.ChatID)
|
||||
@@ -77,6 +82,7 @@ func (api *API) SendAudio(params SendAudio) (Message, error) {
|
||||
}
|
||||
|
||||
// SendAudioWithContext is the context-aware variant of SendAudio.
|
||||
// Since: Bot API 1.2
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#sendaudio
|
||||
func (api *API) SendAudioWithContext(ctx context.Context, params SendAudio) (Message, error) {
|
||||
@@ -85,6 +91,7 @@ func (api *API) SendAudioWithContext(ctx context.Context, params SendAudio) (Mes
|
||||
}
|
||||
|
||||
// SendDocument holds parameters for the sendDocument method.
|
||||
// Since: Bot API 1.0
|
||||
// See https://core.telegram.org/bots/api#senddocument
|
||||
type SendDocument struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -110,6 +117,7 @@ type SendDocument struct {
|
||||
}
|
||||
|
||||
// SendDocument sends a document.
|
||||
// Since: Bot API 1.0
|
||||
// See https://core.telegram.org/bots/api#senddocument
|
||||
func (api *API) SendDocument(params SendDocument) (Message, error) {
|
||||
req := NewRequestWithChatID[Message]("sendDocument", params, params.ChatID)
|
||||
@@ -117,6 +125,7 @@ func (api *API) SendDocument(params SendDocument) (Message, error) {
|
||||
}
|
||||
|
||||
// SendDocumentWithContext is the context-aware variant of SendDocument.
|
||||
// Since: Bot API 1.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#senddocument
|
||||
func (api *API) SendDocumentWithContext(ctx context.Context, params SendDocument) (Message, error) {
|
||||
@@ -125,6 +134,7 @@ func (api *API) SendDocumentWithContext(ctx context.Context, params SendDocument
|
||||
}
|
||||
|
||||
// SendVideo holds parameters for the sendVideo method.
|
||||
// Since: Bot API 1.0
|
||||
// See https://core.telegram.org/bots/api#sendvideo
|
||||
type SendVideo struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -158,6 +168,7 @@ type SendVideo struct {
|
||||
}
|
||||
|
||||
// SendVideo sends a video.
|
||||
// Since: Bot API 1.0
|
||||
// See https://core.telegram.org/bots/api#sendvideo
|
||||
func (api *API) SendVideo(params SendVideo) (Message, error) {
|
||||
req := NewRequestWithChatID[Message]("sendVideo", params, params.ChatID)
|
||||
@@ -165,6 +176,7 @@ func (api *API) SendVideo(params SendVideo) (Message, error) {
|
||||
}
|
||||
|
||||
// SendVideoWithContext is the context-aware variant of SendVideo.
|
||||
// Since: Bot API 1.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#sendvideo
|
||||
func (api *API) SendVideoWithContext(ctx context.Context, params SendVideo) (Message, error) {
|
||||
@@ -173,6 +185,7 @@ func (api *API) SendVideoWithContext(ctx context.Context, params SendVideo) (Mes
|
||||
}
|
||||
|
||||
// SendAnimation holds parameters for the sendAnimation method.
|
||||
// Since: Bot API 4.0
|
||||
// See https://core.telegram.org/bots/api#sendanimation
|
||||
type SendAnimation struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -202,6 +215,7 @@ type SendAnimation struct {
|
||||
}
|
||||
|
||||
// SendAnimation sends an animation file (GIF or H.264/MPEG-4 AVC video without sound).
|
||||
// Since: Bot API 4.0
|
||||
// See https://core.telegram.org/bots/api#sendanimation
|
||||
func (api *API) SendAnimation(params SendAnimation) (Message, error) {
|
||||
req := NewRequestWithChatID[Message]("sendAnimation", params, params.ChatID)
|
||||
@@ -209,6 +223,7 @@ func (api *API) SendAnimation(params SendAnimation) (Message, error) {
|
||||
}
|
||||
|
||||
// SendAnimationWithContext is the context-aware variant of SendAnimation.
|
||||
// Since: Bot API 4.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#sendanimation
|
||||
func (api *API) SendAnimationWithContext(ctx context.Context, params SendAnimation) (Message, error) {
|
||||
@@ -217,6 +232,7 @@ func (api *API) SendAnimationWithContext(ctx context.Context, params SendAnimati
|
||||
}
|
||||
|
||||
// SendVoice holds parameters for the sendVoice method.
|
||||
// Since: Bot API 1.2
|
||||
// See https://core.telegram.org/bots/api#sendvoice
|
||||
type SendVoice struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -240,6 +256,7 @@ type SendVoice struct {
|
||||
}
|
||||
|
||||
// SendVoice sends a voice note.
|
||||
// Since: Bot API 1.2
|
||||
// See https://core.telegram.org/bots/api#sendvoice
|
||||
func (api *API) SendVoice(params SendVoice) (Message, error) {
|
||||
req := NewRequestWithChatID[Message]("sendVoice", params, params.ChatID)
|
||||
@@ -247,6 +264,7 @@ func (api *API) SendVoice(params SendVoice) (Message, error) {
|
||||
}
|
||||
|
||||
// SendVoiceWithContext is the context-aware variant of SendVoice.
|
||||
// Since: Bot API 1.2
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#sendvoice
|
||||
func (api *API) SendVoiceWithContext(ctx context.Context, params SendVoice) (Message, error) {
|
||||
@@ -255,6 +273,7 @@ func (api *API) SendVoiceWithContext(ctx context.Context, params SendVoice) (Mes
|
||||
}
|
||||
|
||||
// SendVideoNote holds parameters for the sendVideoNote method.
|
||||
// Since: Bot API 3.0
|
||||
// See https://core.telegram.org/bots/api#sendvideonote
|
||||
type SendVideoNote struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -277,6 +296,7 @@ type SendVideoNote struct {
|
||||
}
|
||||
|
||||
// SendVideoNote sends a video note (rounded video message).
|
||||
// Since: Bot API 3.0
|
||||
// See https://core.telegram.org/bots/api#sendvideonote
|
||||
func (api *API) SendVideoNote(params SendVideoNote) (Message, error) {
|
||||
req := NewRequestWithChatID[Message]("sendVideoNote", params, params.ChatID)
|
||||
@@ -284,6 +304,7 @@ func (api *API) SendVideoNote(params SendVideoNote) (Message, error) {
|
||||
}
|
||||
|
||||
// SendVideoNoteWithContext is the context-aware variant of SendVideoNote.
|
||||
// Since: Bot API 3.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#sendvideonote
|
||||
func (api *API) SendVideoNoteWithContext(ctx context.Context, params SendVideoNote) (Message, error) {
|
||||
@@ -292,6 +313,7 @@ func (api *API) SendVideoNoteWithContext(ctx context.Context, params SendVideoNo
|
||||
}
|
||||
|
||||
// SendPaidMedia holds parameters for the sendPaidMedia method.
|
||||
// Since: Bot API 7.6
|
||||
// See https://core.telegram.org/bots/api#sendpaidmedia
|
||||
type SendPaidMedia struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -316,6 +338,7 @@ type SendPaidMedia struct {
|
||||
}
|
||||
|
||||
// SendPaidMedia sends paid media.
|
||||
// Since: Bot API 7.6
|
||||
// See https://core.telegram.org/bots/api#sendpaidmedia
|
||||
func (api *API) SendPaidMedia(params SendPaidMedia) (Message, error) {
|
||||
req := NewRequestWithChatID[Message]("sendPaidMedia", params, params.ChatID)
|
||||
@@ -323,6 +346,7 @@ func (api *API) SendPaidMedia(params SendPaidMedia) (Message, error) {
|
||||
}
|
||||
|
||||
// SendPaidMediaWithContext is the context-aware variant of SendPaidMedia.
|
||||
// Since: Bot API 7.6
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#sendpaidmedia
|
||||
func (api *API) SendPaidMediaWithContext(ctx context.Context, params SendPaidMedia) (Message, error) {
|
||||
@@ -331,6 +355,7 @@ func (api *API) SendPaidMediaWithContext(ctx context.Context, params SendPaidMed
|
||||
}
|
||||
|
||||
// SendMediaGroup holds parameters for the sendMediaGroup method.
|
||||
// Since: Bot API 3.5
|
||||
// See https://core.telegram.org/bots/api#sendmediagroup
|
||||
type SendMediaGroup struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -347,6 +372,7 @@ type SendMediaGroup struct {
|
||||
}
|
||||
|
||||
// SendMediaGroup sends a group of photos, videos, documents or audios as an album.
|
||||
// Since: Bot API 3.5
|
||||
// See https://core.telegram.org/bots/api#sendmediagroup
|
||||
func (api *API) SendMediaGroup(params SendMediaGroup) ([]Message, error) {
|
||||
req := NewRequestWithChatID[[]Message]("sendMediaGroup", params, params.ChatID)
|
||||
@@ -354,9 +380,53 @@ func (api *API) SendMediaGroup(params SendMediaGroup) ([]Message, error) {
|
||||
}
|
||||
|
||||
// SendMediaGroupWithContext is the context-aware variant of SendMediaGroup.
|
||||
// Since: Bot API 3.5
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// 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)
|
||||
}
|
||||
|
||||
// SendLivePhoto holds parameters for the sendLivePhoto method.
|
||||
// Since: Bot API 10.0
|
||||
// See https://core.telegram.org/bots/api#sendlivephoto
|
||||
type SendLivePhoto struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
ChatID int64 `json:"chat_id"`
|
||||
MessageThreadID int `json:"message_thread_id,omitempty"`
|
||||
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
|
||||
|
||||
LivePhoto string `json:"live_photo"`
|
||||
Caption string `json:"caption,omitempty"`
|
||||
ParseMode ParseMode `json:"parse_mode,omitempty"`
|
||||
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
|
||||
|
||||
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
|
||||
HasSpoiler bool `json:"has_spoiler,omitempty"`
|
||||
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 *SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
|
||||
ReplyParameters *ReplyParameters `json:"reply_parameters,omitempty"`
|
||||
ReplyMarkup *ReplyMarkup `json:"reply_markup,omitempty"`
|
||||
}
|
||||
|
||||
// SendLivePhoto sends a live photo.
|
||||
// Since: Bot API 10.0
|
||||
// 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)
|
||||
}
|
||||
|
||||
// SendLivePhotoWithContext is the context-aware variant of SendLivePhoto.
|
||||
// Since: Bot API 10.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// 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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user