v1.0.0 beta 15

This commit is contained in:
2026-03-12 17:45:53 +03:00
parent 3b6bb82e04
commit d6e2daec04
28 changed files with 1224 additions and 126 deletions

View File

@@ -1,5 +1,7 @@
package tgapi
// SendPhotoP holds parameters for the sendPhoto method.
// See https://core.telegram.org/bots/api#sendphoto
type SendPhotoP struct {
BusinessConnectionID string `json:"business_connection_id,omitempty"`
ChatID int64 `json:"chat_id"`
@@ -23,11 +25,15 @@ type SendPhotoP struct {
ReplyMarkup *ReplyMarkup `json:"reply_markup,omitempty"`
}
// SendPhoto sends a photo.
// See https://core.telegram.org/bots/api#sendphoto
func (api *API) SendPhoto(params SendPhotoP) (Message, error) {
req := NewRequestWithChatID[Message]("sendPhoto", params, params.ChatID)
return req.Do(api)
}
// SendAudioP holds parameters for the sendAudio method.
// See https://core.telegram.org/bots/api#sendaudio
type SendAudioP struct {
BusinessConnectionID string `json:"business_connection_id,omitempty"`
ChatID int64 `json:"chat_id"`
@@ -52,11 +58,15 @@ type SendAudioP struct {
ReplyMarkup *ReplyMarkup `json:"reply_markup,omitempty"`
}
// SendAudio sends an audio file.
// See https://core.telegram.org/bots/api#sendaudio
func (api *API) SendAudio(params SendAudioP) (Message, error) {
req := NewRequestWithChatID[Message]("sendAudio", params, params.ChatID)
return req.Do(api)
}
// SendDocumentP holds parameters for the sendDocument method.
// See https://core.telegram.org/bots/api#senddocument
type SendDocumentP struct {
BusinessConnectionID string `json:"business_connection_id,omitempty"`
ChatID int64 `json:"chat_id"`
@@ -78,11 +88,15 @@ type SendDocumentP struct {
ReplyMarkup *ReplyMarkup `json:"reply_markup,omitempty"`
}
// SendDocument sends a document.
// See https://core.telegram.org/bots/api#senddocument
func (api *API) SendDocument(params SendDocumentP) (Message, error) {
req := NewRequestWithChatID[Message]("sendDocument", params, params.ChatID)
return req.Do(api)
}
// SendVideoP holds parameters for the sendVideo method.
// See https://core.telegram.org/bots/api#sendvideo
type SendVideoP struct {
BusinessConnectionID string `json:"business_connection_id,omitempty"`
ChatID int64 `json:"chat_id"`
@@ -113,11 +127,15 @@ type SendVideoP struct {
ReplyMarkup *ReplyMarkup `json:"reply_markup,omitempty"`
}
// SendVideo sends a video.
// See https://core.telegram.org/bots/api#sendvideo
func (api *API) SendVideo(params SendVideoP) (Message, error) {
req := NewRequestWithChatID[Message]("sendVideo", params, params.ChatID)
return req.Do(api)
}
// SendAnimationP holds parameters for the sendAnimation method.
// See https://core.telegram.org/bots/api#sendanimation
type SendAnimationP struct {
BusinessConnectionID string `json:"business_connection_id,omitempty"`
ChatID int64 `json:"chat_id"`
@@ -144,11 +162,15 @@ type SendAnimationP struct {
ReplyMarkup *ReplyMarkup `json:"reply_markup,omitempty"`
}
// SendAnimation sends an animation file (GIF or H.264/MPEG-4 AVC video without sound).
// See https://core.telegram.org/bots/api#sendanimation
func (api *API) SendAnimation(params SendAnimationP) (Message, error) {
req := NewRequestWithChatID[Message]("sendAnimation", params, params.ChatID)
return req.Do(api)
}
// SendVoiceP holds parameters for the sendVoice method.
// See https://core.telegram.org/bots/api#sendvoice
type SendVoiceP struct {
BusinessConnectionID string `json:"business_connection_id,omitempty"`
ChatID int64 `json:"chat_id"`
@@ -170,11 +192,15 @@ type SendVoiceP struct {
ReplyMarkup *ReplyMarkup `json:"reply_markup,omitempty"`
}
// SendVoice sends a voice note.
// See https://core.telegram.org/bots/api#sendvoice
func (api *API) SendVoice(params *SendVoiceP) (Message, error) {
req := NewRequestWithChatID[Message]("sendVoice", params, params.ChatID)
return req.Do(api)
}
// SendVideoNoteP holds parameters for the sendVideoNote method.
// See https://core.telegram.org/bots/api#sendvideonote
type SendVideoNoteP struct {
BusinessConnectionID string `json:"business_connection_id,omitempty"`
ChatID int64 `json:"chat_id"`
@@ -194,11 +220,15 @@ type SendVideoNoteP struct {
ReplyMarkup *ReplyMarkup `json:"reply_markup,omitempty"`
}
// SendVideoNote sends a video note (rounded video message).
// See https://core.telegram.org/bots/api#sendvideonote
func (api *API) SendVideoNote(params SendVideoNoteP) (Message, error) {
req := NewRequestWithChatID[Message]("sendVideoNote", params, params.ChatID)
return req.Do(api)
}
// SendPaidMediaP holds parameters for the sendPaidMedia method.
// See https://core.telegram.org/bots/api#sendpaidmedia
type SendPaidMediaP struct {
BusinessConnectionID string `json:"business_connection_id,omitempty"`
ChatID int64 `json:"chat_id"`
@@ -221,11 +251,15 @@ type SendPaidMediaP struct {
ReplyMarkup *ReplyMarkup `json:"reply_markup,omitempty"`
}
// SendPaidMedia sends paid media.
// See https://core.telegram.org/bots/api#sendpaidmedia
func (api *API) SendPaidMedia(params SendPaidMediaP) (Message, error) {
req := NewRequestWithChatID[Message]("sendPaidMedia", params, params.ChatID)
return req.Do(api)
}
// SendMediaGroupP holds parameters for the sendMediaGroup method.
// See https://core.telegram.org/bots/api#sendmediagroup
type SendMediaGroupP struct {
BusinessConnectionID string `json:"business_connection_id,omitempty"`
ChatID int64 `json:"chat_id"`
@@ -240,6 +274,8 @@ type SendMediaGroupP struct {
ReplyParameters *ReplyParameters `json:"reply_parameters,omitempty"`
}
// SendMediaGroup sends a group of photos, videos, documents or audios as an album.
// See https://core.telegram.org/bots/api#sendmediagroup
func (api *API) SendMediaGroup(params SendMediaGroupP) (Message, error) {
req := NewRequestWithChatID[Message]("sendMediaGroup", params, params.ChatID)
return req.Do(api)