(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)
|
||||
}
|
||||
|
||||
+151
-36
@@ -1,5 +1,7 @@
|
||||
package tgapi
|
||||
|
||||
// Animation represents an animation file (GIF or H.264/MPEG-4 AVC without sound).
|
||||
// Since: Bot API 4.0
|
||||
type Animation struct {
|
||||
FileID string `json:"file_id"`
|
||||
FileUniqueID string `json:"file_unique_id"`
|
||||
@@ -14,6 +16,7 @@ type Animation struct {
|
||||
}
|
||||
|
||||
// Audio represents an audio file to be treated as music by the Telegram clients.
|
||||
// Since: Bot API 1.2
|
||||
// See https://core.telegram.org/bots/api#audio
|
||||
type Audio struct {
|
||||
FileID string `json:"file_id"`
|
||||
@@ -22,12 +25,14 @@ type Audio struct {
|
||||
|
||||
Performer string `json:"performer,omitempty"`
|
||||
Title string `json:"title,omitempty"`
|
||||
FileName string `json:"file_name,omitempty"`
|
||||
FileName string `json:"file_name,omitempty"` // Since: Bot API 5.0
|
||||
MimeType string `json:"mime_type,omitempty"`
|
||||
FileSize int64 `json:"file_size,omitempty"`
|
||||
Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
|
||||
}
|
||||
|
||||
// Document represents a general file (as opposed to photos, voice messages and audio files).
|
||||
// Since: Bot API 1.0
|
||||
type Document struct {
|
||||
FileID string `json:"file_id"`
|
||||
FileUniqueID string `json:"file_unique_id"`
|
||||
@@ -38,11 +43,14 @@ type Document struct {
|
||||
}
|
||||
|
||||
// Story represents a story.
|
||||
// Since: Bot API 6.8
|
||||
type Story struct {
|
||||
Chat Chat `json:"chat"`
|
||||
ID int `json:"id"`
|
||||
}
|
||||
|
||||
// Video represents a video file.
|
||||
// Since: Bot API 1.0
|
||||
type Video struct {
|
||||
FileID string `json:"file_id"`
|
||||
FileUniqueID string `json:"file_unique_id"`
|
||||
@@ -51,15 +59,16 @@ type Video struct {
|
||||
Duration int `json:"duration"`
|
||||
|
||||
Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
|
||||
Cover []PhotoSize `json:"cover,omitempty"`
|
||||
StartTimestamp int64 `json:"start_timestamp"`
|
||||
Qualities []VideoQuality `json:"qualities,omitempty"`
|
||||
Cover []PhotoSize `json:"cover,omitempty"` // Since: Bot API 8.3
|
||||
StartTimestamp int64 `json:"start_timestamp"` // Since: Bot API 8.3
|
||||
Qualities []VideoQuality `json:"qualities,omitempty"` // Since: Bot API 9.4
|
||||
FileName string `json:"file_name,omitempty"`
|
||||
MimeType string `json:"mime_type,omitempty"`
|
||||
FileSize int64 `json:"file_size,omitempty"`
|
||||
}
|
||||
|
||||
// VideoQuality describes an alternative quality for a video.
|
||||
// Since: Bot API 9.4
|
||||
// See https://core.telegram.org/bots/api#videoquality
|
||||
type VideoQuality struct {
|
||||
FileID string `json:"file_id"`
|
||||
@@ -70,6 +79,8 @@ type VideoQuality struct {
|
||||
FileSize int64 `json:"file_size,omitempty"`
|
||||
}
|
||||
|
||||
// VideoNote represents a video message.
|
||||
// Since: Bot API 3.0
|
||||
type VideoNote struct {
|
||||
FileID string `json:"file_id"`
|
||||
FileUniqueID string `json:"file_unique_id"`
|
||||
@@ -79,6 +90,8 @@ type VideoNote struct {
|
||||
FileSize int64 `json:"file_size,omitempty"`
|
||||
}
|
||||
|
||||
// Voice represents a voice note.
|
||||
// Since: Bot API 1.2
|
||||
type Voice struct {
|
||||
FileID string `json:"file_id"`
|
||||
FileUniqueID string `json:"file_unique_id"`
|
||||
@@ -87,18 +100,26 @@ type Voice struct {
|
||||
FileSize int `json:"file_size,omitempty"`
|
||||
}
|
||||
|
||||
// PaidMediaInfo describes paid media.
|
||||
// Since: Bot API 7.6
|
||||
type PaidMediaInfo struct {
|
||||
StarCount int `json:"star_count"`
|
||||
PaidMedia []PaidMedia `json:"paid_media"`
|
||||
}
|
||||
|
||||
// PaidMediaType represents the type of paid media.
|
||||
// Since: Bot API 7.6
|
||||
type PaidMediaType string
|
||||
|
||||
const (
|
||||
PaidMediaPreviewType PaidMediaType = "preview"
|
||||
PaidMediaPhotoType PaidMediaType = "photo"
|
||||
PaidMediaVideoType PaidMediaType = "video"
|
||||
PaidMediaPreviewType PaidMediaType = "preview"
|
||||
PaidMediaPhotoType PaidMediaType = "photo"
|
||||
PaidMediaVideoType PaidMediaType = "video"
|
||||
PaidMediaLivePhotoType PaidMediaType = "live_photo" // Since: Bot API 10.0
|
||||
)
|
||||
|
||||
// PaidMedia describes paid media content.
|
||||
// Since: Bot API 7.6
|
||||
type PaidMedia struct {
|
||||
Type PaidMediaType `json:"type,omitempty"`
|
||||
|
||||
@@ -108,9 +129,12 @@ type PaidMedia struct {
|
||||
|
||||
Photo []PhotoSize `json:"photo,omitempty"`
|
||||
|
||||
Video *Video `json:"video,omitempty"`
|
||||
Video *Video `json:"video,omitempty"`
|
||||
LivePhoto *LivePhoto `json:"live_photo,omitempty"` // Since: Bot API 10.0
|
||||
}
|
||||
|
||||
// Contact represents a phone contact.
|
||||
// Since: Bot API 1.0
|
||||
type Contact struct {
|
||||
PhoneNumber string `json:"phone_number"`
|
||||
FirstName string `json:"first_name"`
|
||||
@@ -119,32 +143,56 @@ type Contact struct {
|
||||
Vcard string `json:"vcard,omitempty"`
|
||||
}
|
||||
|
||||
// Dice represents an animated emoji with a random value.
|
||||
// Since: Bot API 4.7
|
||||
type Dice struct {
|
||||
Emoji string `json:"emoji"`
|
||||
Value int `json:"value"`
|
||||
}
|
||||
|
||||
// PollOption contains information about one answer option in a poll.
|
||||
// Since: Bot API 4.2
|
||||
// See https://core.telegram.org/bots/api#polloption
|
||||
type PollOption struct {
|
||||
PersistentID string `json:"persistent_id"`
|
||||
PersistentID string `json:"persistent_id"` // Since: Bot API 9.6
|
||||
Text string `json:"text"`
|
||||
TextEntities []MessageEntity `json:"text_entities"`
|
||||
Media *PollMedia `json:"media,omitempty"` // Since: Bot API 10.0
|
||||
VoterCount int `json:"voter_count"`
|
||||
|
||||
AddedByUser *User `json:"added_by_user,omitempty"`
|
||||
AddedByChat *Chat `json:"added_by_chat,omitempty"`
|
||||
AdditionDate int `json:"addition_date,omitempty"`
|
||||
AddedByUser *User `json:"added_by_user,omitempty"` // Since: Bot API 9.6
|
||||
AddedByChat *Chat `json:"added_by_chat,omitempty"` // Since: Bot API 9.6
|
||||
AdditionDate int `json:"addition_date,omitempty"` // Since: Bot API 9.6
|
||||
}
|
||||
|
||||
// InputPollOptionMedia describes the media to attach to a poll option.
|
||||
// Since: Bot API 10.0
|
||||
// See https://core.telegram.org/bots/api#inputpolloptionmedia
|
||||
type InputPollOptionMedia struct {
|
||||
Type string `json:"type"`
|
||||
Media string `json:"media"`
|
||||
}
|
||||
|
||||
// InputPollOption contains information about one answer option in a poll to be sent.
|
||||
// Since: Bot API 7.3
|
||||
// See https://core.telegram.org/bots/api#inputpolloption
|
||||
type InputPollOption struct {
|
||||
Text string `json:"text"`
|
||||
TextParseMode ParseMode `json:"text_parse_mode,omitempty"`
|
||||
TextEntities []MessageEntity `json:"text_entities,omitempty"`
|
||||
Text string `json:"text"`
|
||||
TextParseMode ParseMode `json:"text_parse_mode,omitempty"`
|
||||
TextEntities []MessageEntity `json:"text_entities,omitempty"`
|
||||
Media *InputPollOptionMedia `json:"media,omitempty"` // Since: Bot API 10.0
|
||||
}
|
||||
|
||||
// InputPollMedia describes the media to attach to a poll or its explanation.
|
||||
// Since: Bot API 10.0
|
||||
// See https://core.telegram.org/bots/api#inputpollmedia
|
||||
type InputPollMedia struct {
|
||||
Type string `json:"type"`
|
||||
Media string `json:"media"`
|
||||
}
|
||||
|
||||
// PollOptionAdded describes a service message about a poll option being added.
|
||||
// Since: Bot API 9.6
|
||||
type PollOptionAdded struct {
|
||||
PollMessage *InaccessibleMessage `json:"poll_message,omitempty"`
|
||||
OptionPersistentID string `json:"option_persistent_id"`
|
||||
@@ -152,6 +200,8 @@ type PollOptionAdded struct {
|
||||
OptionTextEntities []MessageEntity `json:"option_text_entities,omitempty"`
|
||||
}
|
||||
|
||||
// PollOptionDeleted describes a service message about a poll option being deleted.
|
||||
// Since: Bot API 9.6
|
||||
type PollOptionDeleted struct {
|
||||
PollMessage *InaccessibleMessage `json:"poll_message,omitempty"`
|
||||
OptionPersistentID string `json:"option_persistent_id"`
|
||||
@@ -170,38 +220,60 @@ const (
|
||||
)
|
||||
|
||||
// PollAnswer represents an answer of a user in a poll.
|
||||
// Since: Bot API 4.6
|
||||
// See https://core.telegram.org/bots/api#pollanswer
|
||||
type PollAnswer struct {
|
||||
PollID string `json:"poll_id"`
|
||||
VoterChat Chat `json:"voter_chat"`
|
||||
VoterChat Chat `json:"voter_chat"` // Since: Bot API 6.8
|
||||
User User `json:"user"`
|
||||
OptionIDs []int `json:"option_ids"`
|
||||
OptionPersistentIDs []string `json:"option_persistent_ids"`
|
||||
OptionPersistentIDs []string `json:"option_persistent_ids"` // Since: Bot API 9.6
|
||||
}
|
||||
|
||||
// Poll contains information about a poll.
|
||||
// Since: Bot API 4.2
|
||||
// See https://core.telegram.org/bots/api#poll
|
||||
type Poll struct {
|
||||
ID string `json:"id"`
|
||||
Question string `json:"question"`
|
||||
QuestionEntities []MessageEntity `json:"question_entities"`
|
||||
QuestionEntities []MessageEntity `json:"question_entities"` // Since: Bot API 7.3
|
||||
Options []PollOption `json:"options"`
|
||||
TotalVoterCount int `json:"total_voter_count"`
|
||||
IsClosed bool `json:"is_closed"`
|
||||
IsAnonymous bool `json:"is_anonymous"`
|
||||
IsClosed bool `json:"is_closed,omitempty"`
|
||||
IsAnonymous bool `json:"is_anonymous,omitempty"`
|
||||
Type PollType `json:"type"`
|
||||
|
||||
AllowsMultipleAnswers bool `json:"allows_multiple_answers"`
|
||||
AllowsRevoting bool `json:"allows_revoting"`
|
||||
CorrectOptionIDs []int `json:"correct_option_ids,omitempty"`
|
||||
Explanation string `json:"explanation,omitempty"`
|
||||
ExplanationEntities []MessageEntity `json:"explanation_entities,omitempty"`
|
||||
OpenPeriod int `json:"open_period,omitempty"`
|
||||
CloseDate int `json:"close_date,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
DescriptionEntities []MessageEntity `json:"description_entities,omitempty"`
|
||||
AllowsMultipleAnswers bool `json:"allows_multiple_answers,omitempty"` // Since: Bot API 4.6
|
||||
AllowsRevoting bool `json:"allows_revoting,omitempty"` // Since: Bot API 9.6
|
||||
MembersOnly bool `json:"members_only,omitempty"` // Since: Bot API 10.0
|
||||
CountryCodes []string `json:"country_codes,omitempty"` // Since: Bot API 10.0
|
||||
CorrectOptionIDs []int `json:"correct_option_ids,omitempty"` // Since: Bot API 9.6
|
||||
Explanation string `json:"explanation,omitempty"` // Since: Bot API 4.8
|
||||
ExplanationEntities []MessageEntity `json:"explanation_entities,omitempty"` // Since: Bot API 4.8
|
||||
ExplanationMedia *PollMedia `json:"explanation_media,omitempty"` // Since: Bot API 10.0
|
||||
OpenPeriod int `json:"open_period,omitempty"` // Since: Bot API 4.8
|
||||
CloseDate int `json:"close_date,omitempty"` // Since: Bot API 4.8
|
||||
Description string `json:"description,omitempty"` // Since: Bot API 9.6
|
||||
DescriptionEntities []MessageEntity `json:"description_entities,omitempty"` // Since: Bot API 9.6
|
||||
Media *PollMedia `json:"media,omitempty"` // Since: Bot API 10.0
|
||||
}
|
||||
|
||||
// PollMedia represents media attached to a poll.
|
||||
// Since: Bot API 10.0
|
||||
type PollMedia struct {
|
||||
Animation *Animation `json:"animation,omitempty"`
|
||||
Audio *Audio `json:"audio,omitempty"`
|
||||
Document *Document `json:"document,omitempty"`
|
||||
LivePhoto *LivePhoto `json:"live_photo,omitempty"`
|
||||
Location *Location `json:"location,omitempty"`
|
||||
Photo []PhotoSize `json:"photo,omitempty"`
|
||||
Sticker *Sticker `json:"sticker,omitempty"`
|
||||
Venue *Venue `json:"venue,omitempty"`
|
||||
Video *Video `json:"video,omitempty"`
|
||||
}
|
||||
|
||||
// ChecklistTask represents a single task in a checklist.
|
||||
// Since: Bot API 9.1
|
||||
type ChecklistTask struct {
|
||||
ID int `json:"id"`
|
||||
Text string `json:"text"`
|
||||
@@ -211,6 +283,8 @@ type ChecklistTask struct {
|
||||
CompletionDate int `json:"completion_date,omitempty"`
|
||||
}
|
||||
|
||||
// Checklist represents a checklist.
|
||||
// Since: Bot API 9.1
|
||||
type Checklist struct {
|
||||
Title string `json:"title"`
|
||||
TitleEntities []MessageEntity `json:"title_entities,omitempty"`
|
||||
@@ -220,6 +294,7 @@ type Checklist struct {
|
||||
}
|
||||
|
||||
// InputChecklistTask describes a task in a checklist.
|
||||
// Since: Bot API 9.1
|
||||
type InputChecklistTask struct {
|
||||
ID int `json:"id"`
|
||||
Text string `json:"text"`
|
||||
@@ -228,6 +303,7 @@ type InputChecklistTask struct {
|
||||
}
|
||||
|
||||
// InputChecklist represents a checklist to be sent.
|
||||
// Since: Bot API 9.1
|
||||
type InputChecklist struct {
|
||||
Title string `json:"title"`
|
||||
ParseMode ParseMode `json:"parse_mode,omitempty"`
|
||||
@@ -237,12 +313,16 @@ type InputChecklist struct {
|
||||
OtherCanMarkTasksAsDone bool `json:"other_can_mark_tasks_as_done,omitempty"`
|
||||
}
|
||||
|
||||
// ChecklistTaskDone describes a service message about checklist tasks being marked as done.
|
||||
// Since: Bot API 9.1
|
||||
type ChecklistTaskDone struct {
|
||||
ChecklistMessage *Message `json:"checklist_message,omitempty"`
|
||||
MarkedAsDoneTaskIDs []int `json:"marked_as_done_task_ids,omitempty"`
|
||||
MarkedAsNotDoneTaskIDs []int `json:"marked_as_not_done_task_ids,omitempty"`
|
||||
}
|
||||
|
||||
// ChecklistTasksAdded describes a service message about new checklist tasks being added.
|
||||
// Since: Bot API 9.1
|
||||
type ChecklistTasksAdded struct {
|
||||
ChecklistMessage *Message `json:"checklist_message,omitempty"`
|
||||
Tasks []ChecklistTask `json:"tasks"`
|
||||
@@ -262,10 +342,16 @@ const (
|
||||
InputMediaTypeVideo InputMediaType = "video"
|
||||
// InputMediaTypeAudio is an audio file.
|
||||
InputMediaTypeAudio InputMediaType = "audio"
|
||||
|
||||
InputMediaTypeSticker InputMediaType = "sticker"
|
||||
InputMediaTypeLocation InputMediaType = "location"
|
||||
InputMediaTypeVenue InputMediaType = "venue"
|
||||
InputMediaTypeLivePhoto InputMediaType = "live_photo" // Since: Bot API 10.0
|
||||
)
|
||||
|
||||
// InputMedia represents the content of a media message to be sent.
|
||||
// It is a union type described in https://core.telegram.org/bots/api#inputmedia.
|
||||
// Since: Bot API 4.0
|
||||
// See https://core.telegram.org/bots/api#inputmedia
|
||||
type InputMedia struct {
|
||||
Type InputMediaType `json:"type"`
|
||||
Media string `json:"media"`
|
||||
@@ -273,11 +359,11 @@ type InputMedia struct {
|
||||
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"`
|
||||
ShowCaptionAboveMedia *bool `json:"show_caption_above_media,omitempty"` // Since: Bot API 7.4
|
||||
HasSpoiler *bool `json:"has_spoiler,omitempty"` // Since: Bot API 6.4
|
||||
|
||||
Cover *string `json:"cover"`
|
||||
StartTimestamp *int `json:"start_timestamp"`
|
||||
Cover *string `json:"cover"` // Since: Bot API 8.3
|
||||
StartTimestamp *int `json:"start_timestamp"` // Since: Bot API 8.3
|
||||
Width *int `json:"width,omitempty"`
|
||||
Height *int `json:"height,omitempty"`
|
||||
Duration *int `json:"duration,omitempty"`
|
||||
@@ -285,6 +371,18 @@ type InputMedia struct {
|
||||
|
||||
Performer *string `json:"performer,omitempty"`
|
||||
Title *string `json:"title,omitempty"`
|
||||
|
||||
Emoji *string `json:"emoji,omitempty"`
|
||||
|
||||
Latitude *float64 `json:"latitude,omitempty"`
|
||||
Longitude *float64 `json:"longitude,omitempty"`
|
||||
Address *string `json:"address,omitempty"`
|
||||
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"`
|
||||
|
||||
HorizontalAccuracy *float64 `json:"horizontal_accuracy,omitempty"`
|
||||
}
|
||||
|
||||
// InputPaidMediaType represents the type of paid media.
|
||||
@@ -295,16 +393,19 @@ const (
|
||||
InputPaidMediaTypeVideo InputPaidMediaType = "video"
|
||||
// InputPaidMediaTypePhoto represents a paid photo.
|
||||
InputPaidMediaTypePhoto InputPaidMediaType = "photo"
|
||||
// InputPaidMediaTypeLivePhoto represents a paid live photo.
|
||||
InputPaidMediaTypeLivePhoto InputPaidMediaType = "live_photo" // Since: Bot API 10.0
|
||||
)
|
||||
|
||||
// InputPaidMedia describes the paid media to be sent.
|
||||
// Since: Bot API 7.6
|
||||
// See https://core.telegram.org/bots/api#inputpaidmedia
|
||||
type InputPaidMedia struct {
|
||||
Type InputPaidMediaType `json:"type"`
|
||||
Media string `json:"media"`
|
||||
|
||||
Cover *string `json:"cover,omitempty"`
|
||||
StartTimestamp *int64 `json:"start_timestamp,omitempty"`
|
||||
Cover *string `json:"cover,omitempty"` // Since: Bot API 8.3
|
||||
StartTimestamp *int64 `json:"start_timestamp,omitempty"` // Since: Bot API 8.3
|
||||
Width *int `json:"width,omitempty"`
|
||||
Height *int `json:"height,omitempty"`
|
||||
Duration *int `json:"duration,omitempty"`
|
||||
@@ -312,6 +413,7 @@ type InputPaidMedia struct {
|
||||
}
|
||||
|
||||
// PhotoSize represents one size of a photo or a file/sticker thumbnail.
|
||||
// Since: Bot API 1.0
|
||||
// See https://core.telegram.org/bots/api#photosize
|
||||
type PhotoSize struct {
|
||||
FileID string `json:"file_id"`
|
||||
@@ -320,3 +422,16 @@ type PhotoSize struct {
|
||||
Height int `json:"height"`
|
||||
FileSize int64 `json:"file_size,omitempty"`
|
||||
}
|
||||
|
||||
// LivePhoto represents a live photo (a photo with a short video attached).
|
||||
// Since: Bot API 10.0
|
||||
type LivePhoto struct {
|
||||
Photo []PhotoSize `json:"photo,omitempty"`
|
||||
FileID string `json:"file_id"`
|
||||
FileUniqueID string `json:"file_unique_id"`
|
||||
Width int `json:"width"`
|
||||
Height int `json:"height"`
|
||||
Duration int `json:"duration"`
|
||||
MIMEType string `json:"mime_type,omitempty"`
|
||||
FileSize int64 `json:"file_size,omitempty"`
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package tgapi
|
||||
import "context"
|
||||
|
||||
// SetMyCommands holds parameters for the setMyCommands method.
|
||||
// Since: Bot API 4.7
|
||||
// See https://core.telegram.org/bots/api#setmycommands
|
||||
type SetMyCommands struct {
|
||||
Commands []BotCommand `json:"commands"`
|
||||
@@ -11,6 +12,7 @@ type SetMyCommands struct {
|
||||
}
|
||||
|
||||
// SetMyCommands changes the list of the bot's commands.
|
||||
// Since: Bot API 4.7
|
||||
// Returns true on success.
|
||||
// See https://core.telegram.org/bots/api#setmycommands
|
||||
func (api *API) SetMyCommands(params SetMyCommands) (bool, error) {
|
||||
@@ -19,6 +21,7 @@ func (api *API) SetMyCommands(params SetMyCommands) (bool, error) {
|
||||
}
|
||||
|
||||
// SetMyCommandsWithContext is the context-aware variant of SetMyCommands.
|
||||
// Since: Bot API 4.7
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#setmycommands
|
||||
func (api *API) SetMyCommandsWithContext(ctx context.Context, params SetMyCommands) (bool, error) {
|
||||
@@ -27,6 +30,7 @@ func (api *API) SetMyCommandsWithContext(ctx context.Context, params SetMyComman
|
||||
}
|
||||
|
||||
// DeleteMyCommands holds parameters for the deleteMyCommands method.
|
||||
// Since: Bot API 5.3
|
||||
// See https://core.telegram.org/bots/api#deletemycommands
|
||||
type DeleteMyCommands struct {
|
||||
Scope *BotCommandScope `json:"scope,omitempty"`
|
||||
@@ -34,6 +38,7 @@ type DeleteMyCommands struct {
|
||||
}
|
||||
|
||||
// DeleteMyCommands deletes the list of the bot's commands for the given scope and user language.
|
||||
// Since: Bot API 5.3
|
||||
// Returns true on success.
|
||||
// See https://core.telegram.org/bots/api#deletemycommands
|
||||
func (api *API) DeleteMyCommands(params DeleteMyCommands) (bool, error) {
|
||||
@@ -42,6 +47,7 @@ func (api *API) DeleteMyCommands(params DeleteMyCommands) (bool, error) {
|
||||
}
|
||||
|
||||
// DeleteMyCommandsWithContext is the context-aware variant of DeleteMyCommands.
|
||||
// Since: Bot API 5.3
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#deletemycommands
|
||||
func (api *API) DeleteMyCommandsWithContext(ctx context.Context, params DeleteMyCommands) (bool, error) {
|
||||
@@ -50,6 +56,7 @@ func (api *API) DeleteMyCommandsWithContext(ctx context.Context, params DeleteMy
|
||||
}
|
||||
|
||||
// GetMyCommands holds parameters for the getMyCommands method.
|
||||
// Since: Bot API 4.7
|
||||
// See https://core.telegram.org/bots/api#getmycommands
|
||||
type GetMyCommands struct {
|
||||
Scope *BotCommandScope `json:"scope,omitempty"`
|
||||
@@ -57,6 +64,7 @@ type GetMyCommands struct {
|
||||
}
|
||||
|
||||
// GetMyCommands returns the current list of the bot's commands for the given scope and user language.
|
||||
// Since: Bot API 4.7
|
||||
// See https://core.telegram.org/bots/api#getmycommands
|
||||
func (api *API) GetMyCommands(params GetMyCommands) ([]BotCommand, error) {
|
||||
req := NewRequest[[]BotCommand]("getMyCommands", params)
|
||||
@@ -64,6 +72,7 @@ func (api *API) GetMyCommands(params GetMyCommands) ([]BotCommand, error) {
|
||||
}
|
||||
|
||||
// GetMyCommandsWithContext is the context-aware variant of GetMyCommands.
|
||||
// Since: Bot API 4.7
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#getmycommands
|
||||
func (api *API) GetMyCommandsWithContext(ctx context.Context, params GetMyCommands) ([]BotCommand, error) {
|
||||
@@ -72,6 +81,7 @@ func (api *API) GetMyCommandsWithContext(ctx context.Context, params GetMyComman
|
||||
}
|
||||
|
||||
// SetMyName holds parameters for the setMyName method.
|
||||
// Since: Bot API 6.7
|
||||
// See https://core.telegram.org/bots/api#setmyname
|
||||
type SetMyName struct {
|
||||
Name string `json:"name"`
|
||||
@@ -79,6 +89,7 @@ type SetMyName struct {
|
||||
}
|
||||
|
||||
// SetMyName changes the bot's name.
|
||||
// Since: Bot API 6.7
|
||||
// Returns true on success.
|
||||
// See https://core.telegram.org/bots/api#setmyname
|
||||
func (api *API) SetMyName(params SetMyName) (bool, error) {
|
||||
@@ -87,6 +98,7 @@ func (api *API) SetMyName(params SetMyName) (bool, error) {
|
||||
}
|
||||
|
||||
// SetMyNameWithContext is the context-aware variant of SetMyName.
|
||||
// Since: Bot API 6.7
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#setmyname
|
||||
func (api *API) SetMyNameWithContext(ctx context.Context, params SetMyName) (bool, error) {
|
||||
@@ -95,12 +107,14 @@ func (api *API) SetMyNameWithContext(ctx context.Context, params SetMyName) (boo
|
||||
}
|
||||
|
||||
// GetMyName holds parameters for the getMyName method.
|
||||
// Since: Bot API 6.7
|
||||
// See https://core.telegram.org/bots/api#getmyname
|
||||
type GetMyName struct {
|
||||
Language string `json:"language_code,omitempty"`
|
||||
}
|
||||
|
||||
// GetMyName returns the bot's name for the given language.
|
||||
// Since: Bot API 6.7
|
||||
// See https://core.telegram.org/bots/api#getmyname
|
||||
func (api *API) GetMyName(params GetMyName) (BotName, error) {
|
||||
req := NewRequest[BotName]("getMyName", params)
|
||||
@@ -108,6 +122,7 @@ func (api *API) GetMyName(params GetMyName) (BotName, error) {
|
||||
}
|
||||
|
||||
// GetMyNameWithContext is the context-aware variant of GetMyName.
|
||||
// Since: Bot API 6.7
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#getmyname
|
||||
func (api *API) GetMyNameWithContext(ctx context.Context, params GetMyName) (BotName, error) {
|
||||
@@ -116,6 +131,7 @@ func (api *API) GetMyNameWithContext(ctx context.Context, params GetMyName) (Bot
|
||||
}
|
||||
|
||||
// SetMyDescription holds parameters for the setMyDescription method.
|
||||
// Since: Bot API 6.6
|
||||
// See https://core.telegram.org/bots/api#setmydescription
|
||||
type SetMyDescription struct {
|
||||
Description string `json:"description"`
|
||||
@@ -123,6 +139,7 @@ type SetMyDescription struct {
|
||||
}
|
||||
|
||||
// SetMyDescription changes the bot's description.
|
||||
// Since: Bot API 6.6
|
||||
// Returns true on success.
|
||||
// See https://core.telegram.org/bots/api#setmydescription
|
||||
func (api *API) SetMyDescription(params SetMyDescription) (bool, error) {
|
||||
@@ -131,6 +148,7 @@ func (api *API) SetMyDescription(params SetMyDescription) (bool, error) {
|
||||
}
|
||||
|
||||
// SetMyDescriptionWithContext is the context-aware variant of SetMyDescription.
|
||||
// Since: Bot API 6.6
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#setmydescription
|
||||
func (api *API) SetMyDescriptionWithContext(ctx context.Context, params SetMyDescription) (bool, error) {
|
||||
@@ -139,12 +157,14 @@ func (api *API) SetMyDescriptionWithContext(ctx context.Context, params SetMyDes
|
||||
}
|
||||
|
||||
// GetMyDescription holds parameters for the getMyDescription method.
|
||||
// Since: Bot API 6.6
|
||||
// See https://core.telegram.org/bots/api#getmydescription
|
||||
type GetMyDescription struct {
|
||||
Language string `json:"language_code,omitempty"`
|
||||
}
|
||||
|
||||
// GetMyDescription returns the bot's description for the given language.
|
||||
// Since: Bot API 6.6
|
||||
// See https://core.telegram.org/bots/api#getmydescription
|
||||
func (api *API) GetMyDescription(params GetMyDescription) (BotDescription, error) {
|
||||
req := NewRequest[BotDescription]("getMyDescription", params)
|
||||
@@ -152,6 +172,7 @@ func (api *API) GetMyDescription(params GetMyDescription) (BotDescription, error
|
||||
}
|
||||
|
||||
// GetMyDescriptionWithContext is the context-aware variant of GetMyDescription.
|
||||
// Since: Bot API 6.6
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#getmydescription
|
||||
func (api *API) GetMyDescriptionWithContext(ctx context.Context, params GetMyDescription) (BotDescription, error) {
|
||||
@@ -160,6 +181,7 @@ func (api *API) GetMyDescriptionWithContext(ctx context.Context, params GetMyDes
|
||||
}
|
||||
|
||||
// SetMyShortDescription holds parameters for the setMyShortDescription method.
|
||||
// Since: Bot API 6.6
|
||||
// See https://core.telegram.org/bots/api#setmyshortdescription
|
||||
type SetMyShortDescription struct {
|
||||
ShortDescription string `json:"short_description,omitempty"`
|
||||
@@ -167,6 +189,7 @@ type SetMyShortDescription struct {
|
||||
}
|
||||
|
||||
// SetMyShortDescription changes the bot's short description.
|
||||
// Since: Bot API 6.6
|
||||
// Returns true on success.
|
||||
// See https://core.telegram.org/bots/api#setmyshortdescription
|
||||
func (api *API) SetMyShortDescription(params SetMyShortDescription) (bool, error) {
|
||||
@@ -175,6 +198,7 @@ func (api *API) SetMyShortDescription(params SetMyShortDescription) (bool, error
|
||||
}
|
||||
|
||||
// SetMyShortDescriptionWithContext is the context-aware variant of SetMyShortDescription.
|
||||
// Since: Bot API 6.6
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#setmyshortdescription
|
||||
func (api *API) SetMyShortDescriptionWithContext(ctx context.Context, params SetMyShortDescription) (bool, error) {
|
||||
@@ -183,12 +207,14 @@ func (api *API) SetMyShortDescriptionWithContext(ctx context.Context, params Set
|
||||
}
|
||||
|
||||
// GetMyShortDescription holds parameters for the getMyShortDescription method.
|
||||
// Since: Bot API 6.6
|
||||
// See https://core.telegram.org/bots/api#getmyshortdescription
|
||||
type GetMyShortDescription struct {
|
||||
Language string `json:"language_code,omitempty"`
|
||||
}
|
||||
|
||||
// GetMyShortDescription returns the bot's short description for the given language.
|
||||
// Since: Bot API 6.6
|
||||
// See https://core.telegram.org/bots/api#getmyshortdescription
|
||||
func (api *API) GetMyShortDescription(params GetMyShortDescription) (BotShortDescription, error) {
|
||||
req := NewRequest[BotShortDescription]("getMyShortDescription", params)
|
||||
@@ -196,6 +222,7 @@ func (api *API) GetMyShortDescription(params GetMyShortDescription) (BotShortDes
|
||||
}
|
||||
|
||||
// GetMyShortDescriptionWithContext is the context-aware variant of GetMyShortDescription.
|
||||
// Since: Bot API 6.6
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#getmyshortdescription
|
||||
func (api *API) GetMyShortDescriptionWithContext(ctx context.Context, params GetMyShortDescription) (BotShortDescription, error) {
|
||||
@@ -204,12 +231,14 @@ func (api *API) GetMyShortDescriptionWithContext(ctx context.Context, params Get
|
||||
}
|
||||
|
||||
// SetMyProfilePhoto holds parameters for the setMyProfilePhoto method.
|
||||
// Since: Bot API 9.0
|
||||
// See https://core.telegram.org/bots/api#setmyprofilephoto
|
||||
type SetMyProfilePhoto struct {
|
||||
Photo InputProfilePhoto `json:"photo"`
|
||||
}
|
||||
|
||||
// SetMyProfilePhoto changes the bot's profile photo.
|
||||
// Since: Bot API 9.0
|
||||
// Returns true on success.
|
||||
// See https://core.telegram.org/bots/api#setmyprofilephoto
|
||||
func (api *API) SetMyProfilePhoto(params SetMyProfilePhoto) (bool, error) {
|
||||
@@ -218,6 +247,7 @@ func (api *API) SetMyProfilePhoto(params SetMyProfilePhoto) (bool, error) {
|
||||
}
|
||||
|
||||
// SetMyProfilePhotoWithContext is the context-aware variant of SetMyProfilePhoto.
|
||||
// Since: Bot API 9.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#setmyprofilephoto
|
||||
func (api *API) SetMyProfilePhotoWithContext(ctx context.Context, params SetMyProfilePhoto) (bool, error) {
|
||||
@@ -226,6 +256,7 @@ func (api *API) SetMyProfilePhotoWithContext(ctx context.Context, params SetMyPr
|
||||
}
|
||||
|
||||
// RemoveMyProfilePhoto removes the bot's profile photo.
|
||||
// Since: Bot API 9.0
|
||||
// Returns true on success.
|
||||
// See https://core.telegram.org/bots/api#removemyprofilephoto
|
||||
func (api *API) RemoveMyProfilePhoto() (bool, error) {
|
||||
@@ -234,6 +265,7 @@ func (api *API) RemoveMyProfilePhoto() (bool, error) {
|
||||
}
|
||||
|
||||
// RemoveMyProfilePhotoWithContext is the context-aware variant of RemoveMyProfilePhoto.
|
||||
// Since: Bot API 9.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#removemyprofilephoto
|
||||
func (api *API) RemoveMyProfilePhotoWithContext(ctx context.Context) (bool, error) {
|
||||
@@ -242,6 +274,7 @@ func (api *API) RemoveMyProfilePhotoWithContext(ctx context.Context) (bool, erro
|
||||
}
|
||||
|
||||
// SetChatMenuButton holds parameters for the setChatMenuButton method.
|
||||
// Since: Bot API 6.0
|
||||
// See https://core.telegram.org/bots/api#setchatmenubutton
|
||||
type SetChatMenuButton struct {
|
||||
ChatID int64 `json:"chat_id,omitempty"`
|
||||
@@ -249,6 +282,7 @@ type SetChatMenuButton struct {
|
||||
}
|
||||
|
||||
// SetChatMenuButton changes the menu button for a given chat or the default menu button.
|
||||
// Since: Bot API 6.0
|
||||
// Returns true on success.
|
||||
// See https://core.telegram.org/bots/api#setchatmenubutton
|
||||
func (api *API) SetChatMenuButton(params SetChatMenuButton) (bool, error) {
|
||||
@@ -257,6 +291,7 @@ func (api *API) SetChatMenuButton(params SetChatMenuButton) (bool, error) {
|
||||
}
|
||||
|
||||
// SetChatMenuButtonWithContext is the context-aware variant of SetChatMenuButton.
|
||||
// Since: Bot API 6.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#setchatmenubutton
|
||||
func (api *API) SetChatMenuButtonWithContext(ctx context.Context, params SetChatMenuButton) (bool, error) {
|
||||
@@ -265,12 +300,14 @@ func (api *API) SetChatMenuButtonWithContext(ctx context.Context, params SetChat
|
||||
}
|
||||
|
||||
// GetChatMenuButton holds parameters for the getChatMenuButton method.
|
||||
// Since: Bot API 6.0
|
||||
// See https://core.telegram.org/bots/api#getchatmenubutton
|
||||
type GetChatMenuButton struct {
|
||||
ChatID int64 `json:"chat_id,omitempty"`
|
||||
}
|
||||
|
||||
// GetChatMenuButton returns the current menu button for the given chat.
|
||||
// Since: Bot API 6.0
|
||||
// See https://core.telegram.org/bots/api#getchatmenubutton
|
||||
func (api *API) GetChatMenuButton(params GetChatMenuButton) (MenuButton, error) {
|
||||
req := NewRequest[MenuButton]("getChatMenuButton", params)
|
||||
@@ -278,6 +315,7 @@ func (api *API) GetChatMenuButton(params GetChatMenuButton) (MenuButton, error)
|
||||
}
|
||||
|
||||
// GetChatMenuButtonWithContext is the context-aware variant of GetChatMenuButton.
|
||||
// Since: Bot API 6.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#getchatmenubutton
|
||||
func (api *API) GetChatMenuButtonWithContext(ctx context.Context, params GetChatMenuButton) (MenuButton, error) {
|
||||
@@ -286,6 +324,7 @@ func (api *API) GetChatMenuButtonWithContext(ctx context.Context, params GetChat
|
||||
}
|
||||
|
||||
// SetMyDefaultAdministratorRights holds parameters for the setMyDefaultAdministratorRights method.
|
||||
// Since: Bot API 6.0
|
||||
// See https://core.telegram.org/bots/api#setmydefaultadministratorrights
|
||||
type SetMyDefaultAdministratorRights struct {
|
||||
Rights *ChatAdministratorRights `json:"rights"`
|
||||
@@ -293,6 +332,7 @@ type SetMyDefaultAdministratorRights struct {
|
||||
}
|
||||
|
||||
// SetMyDefaultAdministratorRights changes the default administrator rights for the bot.
|
||||
// Since: Bot API 6.0
|
||||
// Returns true on success.
|
||||
// See https://core.telegram.org/bots/api#setmydefaultadministratorrights
|
||||
func (api *API) SetMyDefaultAdministratorRights(params SetMyDefaultAdministratorRights) (bool, error) {
|
||||
@@ -301,6 +341,7 @@ func (api *API) SetMyDefaultAdministratorRights(params SetMyDefaultAdministrator
|
||||
}
|
||||
|
||||
// SetMyDefaultAdministratorRightsWithContext is the context-aware variant of SetMyDefaultAdministratorRights.
|
||||
// Since: Bot API 6.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#setmydefaultadministratorrights
|
||||
func (api *API) SetMyDefaultAdministratorRightsWithContext(ctx context.Context, params SetMyDefaultAdministratorRights) (bool, error) {
|
||||
@@ -309,12 +350,14 @@ func (api *API) SetMyDefaultAdministratorRightsWithContext(ctx context.Context,
|
||||
}
|
||||
|
||||
// GetMyDefaultAdministratorRights holds parameters for the getMyDefaultAdministratorRights method.
|
||||
// Since: Bot API 6.0
|
||||
// See https://core.telegram.org/bots/api#getmydefaultadministratorrights
|
||||
type GetMyDefaultAdministratorRights struct {
|
||||
ForChannels bool `json:"for_channels"`
|
||||
}
|
||||
|
||||
// GetMyDefaultAdministratorRights returns the current default administrator rights for the bot.
|
||||
// Since: Bot API 6.0
|
||||
// See https://core.telegram.org/bots/api#getmydefaultadministratorrights
|
||||
func (api *API) GetMyDefaultAdministratorRights(params GetMyDefaultAdministratorRights) (ChatAdministratorRights, error) {
|
||||
req := NewRequest[ChatAdministratorRights]("getMyDefaultAdministratorRights", params)
|
||||
@@ -322,6 +365,7 @@ func (api *API) GetMyDefaultAdministratorRights(params GetMyDefaultAdministrator
|
||||
}
|
||||
|
||||
// GetMyDefaultAdministratorRightsWithContext is the context-aware variant of GetMyDefaultAdministratorRights.
|
||||
// Since: Bot API 6.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#getmydefaultadministratorrights
|
||||
func (api *API) GetMyDefaultAdministratorRightsWithContext(ctx context.Context, params GetMyDefaultAdministratorRights) (ChatAdministratorRights, error) {
|
||||
@@ -330,6 +374,7 @@ func (api *API) GetMyDefaultAdministratorRightsWithContext(ctx context.Context,
|
||||
}
|
||||
|
||||
// GetAvailableGifts returns the list of gifts that can be sent by the bot.
|
||||
// Since: Bot API 9.0
|
||||
// See https://core.telegram.org/bots/api#getavailablegifts
|
||||
func (api *API) GetAvailableGifts() (Gifts, error) {
|
||||
req := NewRequest[Gifts]("getAvailableGifts", NoParams)
|
||||
@@ -337,6 +382,7 @@ func (api *API) GetAvailableGifts() (Gifts, error) {
|
||||
}
|
||||
|
||||
// GetAvailableGiftsWithContext is the context-aware variant of GetAvailableGifts.
|
||||
// Since: Bot API 9.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#getavailablegifts
|
||||
func (api *API) GetAvailableGiftsWithContext(ctx context.Context) (Gifts, error) {
|
||||
@@ -345,6 +391,7 @@ func (api *API) GetAvailableGiftsWithContext(ctx context.Context) (Gifts, error)
|
||||
}
|
||||
|
||||
// SendGift holds parameters for the sendGift method.
|
||||
// Since: Bot API 9.0
|
||||
// See https://core.telegram.org/bots/api#sendgift
|
||||
type SendGift struct {
|
||||
UserID int64 `json:"user_id,omitempty"`
|
||||
@@ -357,6 +404,7 @@ type SendGift struct {
|
||||
}
|
||||
|
||||
// SendGift sends a gift to the given user or chat.
|
||||
// Since: Bot API 9.0
|
||||
// Returns true on success.
|
||||
// See https://core.telegram.org/bots/api#sendgift
|
||||
func (api *API) SendGift(params SendGift) (bool, error) {
|
||||
@@ -365,6 +413,7 @@ func (api *API) SendGift(params SendGift) (bool, error) {
|
||||
}
|
||||
|
||||
// SendGiftWithContext is the context-aware variant of SendGift.
|
||||
// Since: Bot API 9.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#sendgift
|
||||
func (api *API) SendGiftWithContext(ctx context.Context, params SendGift) (bool, error) {
|
||||
@@ -373,6 +422,7 @@ func (api *API) SendGiftWithContext(ctx context.Context, params SendGift) (bool,
|
||||
}
|
||||
|
||||
// GiftPremiumSubscription holds parameters for the giftPremiumSubscription method.
|
||||
// Since: Bot API 9.0
|
||||
// See https://core.telegram.org/bots/api#giftpremiumsubscription
|
||||
type GiftPremiumSubscription struct {
|
||||
UserID int64 `json:"user_id"`
|
||||
@@ -384,6 +434,7 @@ type GiftPremiumSubscription struct {
|
||||
}
|
||||
|
||||
// GiftPremiumSubscription gifts a Telegram Premium subscription to the user.
|
||||
// Since: Bot API 9.0
|
||||
// Returns true on success.
|
||||
// See https://core.telegram.org/bots/api#giftpremiumsubscription
|
||||
func (api *API) GiftPremiumSubscription(params GiftPremiumSubscription) (bool, error) {
|
||||
@@ -392,9 +443,60 @@ func (api *API) GiftPremiumSubscription(params GiftPremiumSubscription) (bool, e
|
||||
}
|
||||
|
||||
// GiftPremiumSubscriptionWithContext is the context-aware variant of GiftPremiumSubscription.
|
||||
// Since: Bot API 9.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#giftpremiumsubscription
|
||||
func (api *API) GiftPremiumSubscriptionWithContext(ctx context.Context, params GiftPremiumSubscription) (bool, error) {
|
||||
req := NewRequest[bool]("giftPremiumSubscription", params)
|
||||
return req.DoWithContext(ctx, api)
|
||||
}
|
||||
|
||||
// GetManagedBotAccessSettings holds parameters for the getManagedBotAccessSettings method.
|
||||
// Since: Bot API 10.0
|
||||
// See https://core.telegram.org/bots/api#getmanagedbotaccesssettings
|
||||
type GetManagedBotAccessSettings struct {
|
||||
BotUserID int64 `json:"bot_user_id"`
|
||||
}
|
||||
|
||||
// GetManagedBotAccessSettings returns the access settings of a managed bot.
|
||||
// Since: Bot API 10.0
|
||||
// See https://core.telegram.org/bots/api#getmanagedbotaccesssettings
|
||||
func (api *API) GetManagedBotAccessSettings(params GetManagedBotAccessSettings) (BotAccessSettings, error) {
|
||||
req := NewRequest[BotAccessSettings]("getManagedBotAccessSettings", params)
|
||||
return req.Do(api)
|
||||
}
|
||||
|
||||
// GetManagedBotAccessSettingsWithContext is the context-aware variant of GetManagedBotAccessSettings.
|
||||
// Since: Bot API 10.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#getmanagedbotaccesssettings
|
||||
func (api *API) GetManagedBotAccessSettingsWithContext(ctx context.Context, params GetManagedBotAccessSettings) (BotAccessSettings, error) {
|
||||
req := NewRequest[BotAccessSettings]("getManagedBotAccessSettings", params)
|
||||
return req.DoWithContext(ctx, api)
|
||||
}
|
||||
|
||||
// SetManagedBotAccessSettings holds parameters for the setManagedBotAccessSettings method.
|
||||
// Since: Bot API 10.0
|
||||
// See https://core.telegram.org/bots/api#setmanagedbotaccesssettings
|
||||
type SetManagedBotAccessSettings struct {
|
||||
BotUserID int64 `json:"bot_user_id"`
|
||||
AccessSettings BotAccessSettings `json:"access_settings"`
|
||||
}
|
||||
|
||||
// SetManagedBotAccessSettings changes the access settings of a managed bot.
|
||||
// Since: Bot API 10.0
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#setmanagedbotaccesssettings
|
||||
func (api *API) SetManagedBotAccessSettings(params SetManagedBotAccessSettings) (bool, error) {
|
||||
req := NewRequest[bool]("setManagedBotAccessSettings", params)
|
||||
return req.Do(api)
|
||||
}
|
||||
|
||||
// SetManagedBotAccessSettingsWithContext is the context-aware variant of SetManagedBotAccessSettings.
|
||||
// Since: Bot API 10.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#setmanagedbotaccesssettings
|
||||
func (api *API) SetManagedBotAccessSettingsWithContext(ctx context.Context, params SetManagedBotAccessSettings) (bool, error) {
|
||||
req := NewRequest[bool]("setManagedBotAccessSettings", params)
|
||||
return req.DoWithContext(ctx, api)
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package tgapi
|
||||
|
||||
// BotCommand represents a bot command.
|
||||
// Since: Bot API 4.7
|
||||
// See https://core.telegram.org/bots/api#botcommand
|
||||
type BotCommand struct {
|
||||
Command string `json:"command"`
|
||||
@@ -28,6 +29,7 @@ const (
|
||||
)
|
||||
|
||||
// BotCommandScope represents the scope to which bot commands are applied.
|
||||
// Since: Bot API 5.3
|
||||
// See https://core.telegram.org/bots/api#botcommandscope
|
||||
type BotCommandScope struct {
|
||||
Type BotCommandScopeType `json:"type"`
|
||||
@@ -36,16 +38,19 @@ type BotCommandScope struct {
|
||||
}
|
||||
|
||||
// BotName represents the bot's name.
|
||||
// Since: Bot API 6.7
|
||||
type BotName struct {
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// BotDescription represents the bot's description.
|
||||
// Since: Bot API 6.6
|
||||
type BotDescription struct {
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
// BotShortDescription represents the bot's short description.
|
||||
// Since: Bot API 6.6
|
||||
type BotShortDescription struct {
|
||||
ShortDescription string `json:"short_description"`
|
||||
}
|
||||
@@ -61,6 +66,7 @@ const (
|
||||
)
|
||||
|
||||
// InputProfilePhoto describes a profile photo to set.
|
||||
// Since: Bot API 9.0
|
||||
// See https://core.telegram.org/bots/api#inputprofilephoto
|
||||
type InputProfilePhoto struct {
|
||||
Type InputProfilePhotoType `json:"type"`
|
||||
@@ -86,6 +92,7 @@ const (
|
||||
)
|
||||
|
||||
// MenuButton represents a menu button.
|
||||
// Since: Bot API 6.0
|
||||
// See https://core.telegram.org/bots/api#menubutton
|
||||
type MenuButton struct {
|
||||
Type MenuButtonType `json:"type"`
|
||||
@@ -94,3 +101,10 @@ type MenuButton struct {
|
||||
Text *string `json:"text"`
|
||||
WebApp *WebAppInfo `json:"web_app"`
|
||||
}
|
||||
|
||||
// BotAccessSettings describes access settings of a managed bot.
|
||||
// Since: Bot API 10.0
|
||||
// See https://core.telegram.org/bots/api#botaccesssettings
|
||||
type BotAccessSettings struct {
|
||||
AllowAllPrivateChats bool `json:"allow_all_private_chats"`
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package tgapi
|
||||
import "context"
|
||||
|
||||
// VerifyUser holds parameters for the verifyUser method.
|
||||
// Since: Bot API 8.0
|
||||
// See https://core.telegram.org/bots/api#verifyuser
|
||||
type VerifyUser struct {
|
||||
UserID int64 `json:"user_id"`
|
||||
@@ -10,6 +11,7 @@ type VerifyUser struct {
|
||||
}
|
||||
|
||||
// VerifyUser verifies a user.
|
||||
// Since: Bot API 8.0
|
||||
// Returns true on success.
|
||||
// See https://core.telegram.org/bots/api#verifyuser
|
||||
func (api *API) VerifyUser(params VerifyUser) (bool, error) {
|
||||
@@ -18,6 +20,7 @@ func (api *API) VerifyUser(params VerifyUser) (bool, error) {
|
||||
}
|
||||
|
||||
// VerifyUserWithContext is the context-aware variant of VerifyUser.
|
||||
// Since: Bot API 8.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#verifyuser
|
||||
func (api *API) VerifyUserWithContext(ctx context.Context, params VerifyUser) (bool, error) {
|
||||
@@ -26,6 +29,7 @@ func (api *API) VerifyUserWithContext(ctx context.Context, params VerifyUser) (b
|
||||
}
|
||||
|
||||
// VerifyChat holds parameters for the verifyChat method.
|
||||
// Since: Bot API 8.0
|
||||
// See https://core.telegram.org/bots/api#verifychat
|
||||
type VerifyChat struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -33,6 +37,7 @@ type VerifyChat struct {
|
||||
}
|
||||
|
||||
// VerifyChat verifies a chat.
|
||||
// Since: Bot API 8.0
|
||||
// Returns true on success.
|
||||
// See https://core.telegram.org/bots/api#verifychat
|
||||
func (api *API) VerifyChat(params VerifyChat) (bool, error) {
|
||||
@@ -41,6 +46,7 @@ func (api *API) VerifyChat(params VerifyChat) (bool, error) {
|
||||
}
|
||||
|
||||
// VerifyChatWithContext is the context-aware variant of VerifyChat.
|
||||
// Since: Bot API 8.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#verifychat
|
||||
func (api *API) VerifyChatWithContext(ctx context.Context, params VerifyChat) (bool, error) {
|
||||
@@ -49,12 +55,14 @@ func (api *API) VerifyChatWithContext(ctx context.Context, params VerifyChat) (b
|
||||
}
|
||||
|
||||
// RemoveUserVerification holds parameters for the removeUserVerification method.
|
||||
// Since: Bot API 8.0
|
||||
// See https://core.telegram.org/bots/api#removeuserverification
|
||||
type RemoveUserVerification struct {
|
||||
UserID int64 `json:"user_id"`
|
||||
}
|
||||
|
||||
// RemoveUserVerification removes a user's verification.
|
||||
// Since: Bot API 8.0
|
||||
// Returns true on success.
|
||||
// See https://core.telegram.org/bots/api#removeuserverification
|
||||
func (api *API) RemoveUserVerification(params RemoveUserVerification) (bool, error) {
|
||||
@@ -63,6 +71,7 @@ func (api *API) RemoveUserVerification(params RemoveUserVerification) (bool, err
|
||||
}
|
||||
|
||||
// RemoveUserVerificationWithContext is the context-aware variant of RemoveUserVerification.
|
||||
// Since: Bot API 8.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#removeuserverification
|
||||
func (api *API) RemoveUserVerificationWithContext(ctx context.Context, params RemoveUserVerification) (bool, error) {
|
||||
@@ -71,12 +80,14 @@ func (api *API) RemoveUserVerificationWithContext(ctx context.Context, params Re
|
||||
}
|
||||
|
||||
// RemoveChatVerification holds parameters for the removeChatVerification method.
|
||||
// Since: Bot API 8.0
|
||||
// See https://core.telegram.org/bots/api#removechatverification
|
||||
type RemoveChatVerification struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
}
|
||||
|
||||
// RemoveChatVerification removes a chat's verification.
|
||||
// Since: Bot API 8.0
|
||||
// Returns true on success.
|
||||
// See https://core.telegram.org/bots/api#removechatverification
|
||||
func (api *API) RemoveChatVerification(params RemoveChatVerification) (bool, error) {
|
||||
@@ -85,6 +96,7 @@ func (api *API) RemoveChatVerification(params RemoveChatVerification) (bool, err
|
||||
}
|
||||
|
||||
// RemoveChatVerificationWithContext is the context-aware variant of RemoveChatVerification.
|
||||
// Since: Bot API 8.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#removechatverification
|
||||
func (api *API) RemoveChatVerificationWithContext(ctx context.Context, params RemoveChatVerification) (bool, error) {
|
||||
@@ -93,6 +105,7 @@ func (api *API) RemoveChatVerificationWithContext(ctx context.Context, params Re
|
||||
}
|
||||
|
||||
// ReadBusinessMessage holds parameters for the readBusinessMessage method.
|
||||
// Since: Bot API 9.0
|
||||
// See https://core.telegram.org/bots/api#readbusinessmessage
|
||||
type ReadBusinessMessage struct {
|
||||
BusinessConnectionID string `json:"business_connection_id"`
|
||||
@@ -101,6 +114,7 @@ type ReadBusinessMessage struct {
|
||||
}
|
||||
|
||||
// ReadBusinessMessage marks a business message as read.
|
||||
// Since: Bot API 9.0
|
||||
// Returns true on success.
|
||||
// See https://core.telegram.org/bots/api#readbusinessmessage
|
||||
func (api *API) ReadBusinessMessage(params ReadBusinessMessage) (bool, error) {
|
||||
@@ -109,6 +123,7 @@ func (api *API) ReadBusinessMessage(params ReadBusinessMessage) (bool, error) {
|
||||
}
|
||||
|
||||
// ReadBusinessMessageWithContext is the context-aware variant of ReadBusinessMessage.
|
||||
// Since: Bot API 9.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#readbusinessmessage
|
||||
func (api *API) ReadBusinessMessageWithContext(ctx context.Context, params ReadBusinessMessage) (bool, error) {
|
||||
@@ -117,12 +132,14 @@ func (api *API) ReadBusinessMessageWithContext(ctx context.Context, params ReadB
|
||||
}
|
||||
|
||||
// GetBusinessConnection holds parameters for the getBusinessConnection method.
|
||||
// Since: Bot API 7.2
|
||||
// See https://core.telegram.org/bots/api#getbusinessconnection
|
||||
type GetBusinessConnection struct {
|
||||
BusinessConnectionID string `json:"business_connection_id"`
|
||||
}
|
||||
|
||||
// GetBusinessConnection returns information about a business connection.
|
||||
// Since: Bot API 7.2
|
||||
// See https://core.telegram.org/bots/api#getbusinessconnection
|
||||
func (api *API) GetBusinessConnection(params GetBusinessConnection) (BusinessConnection, error) {
|
||||
req := NewRequest[BusinessConnection]("getBusinessConnection", params)
|
||||
@@ -130,6 +147,7 @@ func (api *API) GetBusinessConnection(params GetBusinessConnection) (BusinessCon
|
||||
}
|
||||
|
||||
// GetBusinessConnectionWithContext is the context-aware variant of GetBusinessConnection.
|
||||
// Since: Bot API 7.2
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#getbusinessconnection
|
||||
func (api *API) GetBusinessConnectionWithContext(ctx context.Context, params GetBusinessConnection) (BusinessConnection, error) {
|
||||
@@ -138,6 +156,7 @@ func (api *API) GetBusinessConnectionWithContext(ctx context.Context, params Get
|
||||
}
|
||||
|
||||
// DeleteBusinessMessages holds parameters for the deleteBusinessMessages method.
|
||||
// Since: Bot API 9.0
|
||||
// See https://core.telegram.org/bots/api#deletebusinessmessages
|
||||
type DeleteBusinessMessages struct {
|
||||
BusinessConnectionID string `json:"business_connection_id"`
|
||||
@@ -145,6 +164,7 @@ type DeleteBusinessMessages struct {
|
||||
}
|
||||
|
||||
// DeleteBusinessMessages deletes business messages.
|
||||
// Since: Bot API 9.0
|
||||
// Returns true on success.
|
||||
// See https://core.telegram.org/bots/api#deletebusinessmessages
|
||||
func (api *API) DeleteBusinessMessages(params DeleteBusinessMessages) (bool, error) {
|
||||
@@ -153,6 +173,7 @@ func (api *API) DeleteBusinessMessages(params DeleteBusinessMessages) (bool, err
|
||||
}
|
||||
|
||||
// DeleteBusinessMessagesWithContext is the context-aware variant of DeleteBusinessMessages.
|
||||
// Since: Bot API 9.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#deletebusinessmessages
|
||||
func (api *API) DeleteBusinessMessagesWithContext(ctx context.Context, params DeleteBusinessMessages) (bool, error) {
|
||||
@@ -161,6 +182,7 @@ func (api *API) DeleteBusinessMessagesWithContext(ctx context.Context, params De
|
||||
}
|
||||
|
||||
// SetBusinessAccountName holds parameters for the setBusinessAccountName method.
|
||||
// Since: Bot API 9.0
|
||||
// See https://core.telegram.org/bots/api#setbusinessaccountname
|
||||
type SetBusinessAccountName struct {
|
||||
BusinessConnectionID string `json:"business_connection_id"`
|
||||
@@ -169,6 +191,7 @@ type SetBusinessAccountName struct {
|
||||
}
|
||||
|
||||
// SetBusinessAccountName sets the first and last name of a business account.
|
||||
// Since: Bot API 9.0
|
||||
// Returns true on success.
|
||||
// See https://core.telegram.org/bots/api#setbusinessaccountname
|
||||
func (api *API) SetBusinessAccountName(params SetBusinessAccountName) (bool, error) {
|
||||
@@ -177,6 +200,7 @@ func (api *API) SetBusinessAccountName(params SetBusinessAccountName) (bool, err
|
||||
}
|
||||
|
||||
// SetBusinessAccountNameWithContext is the context-aware variant of SetBusinessAccountName.
|
||||
// Since: Bot API 9.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#setbusinessaccountname
|
||||
func (api *API) SetBusinessAccountNameWithContext(ctx context.Context, params SetBusinessAccountName) (bool, error) {
|
||||
@@ -185,6 +209,7 @@ func (api *API) SetBusinessAccountNameWithContext(ctx context.Context, params Se
|
||||
}
|
||||
|
||||
// SetBusinessAccountUsername holds parameters for the setBusinessAccountUsername method.
|
||||
// Since: Bot API 9.0
|
||||
// See https://core.telegram.org/bots/api#setbusinessaccountusername
|
||||
type SetBusinessAccountUsername struct {
|
||||
BusinessConnectionID string `json:"business_connection_id"`
|
||||
@@ -192,6 +217,7 @@ type SetBusinessAccountUsername struct {
|
||||
}
|
||||
|
||||
// SetBusinessAccountUsername sets the username of a business account.
|
||||
// Since: Bot API 9.0
|
||||
// Returns true on success.
|
||||
// See https://core.telegram.org/bots/api#setbusinessaccountusername
|
||||
func (api *API) SetBusinessAccountUsername(params SetBusinessAccountUsername) (bool, error) {
|
||||
@@ -200,6 +226,7 @@ func (api *API) SetBusinessAccountUsername(params SetBusinessAccountUsername) (b
|
||||
}
|
||||
|
||||
// SetBusinessAccountUsernameWithContext is the context-aware variant of SetBusinessAccountUsername.
|
||||
// Since: Bot API 9.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#setbusinessaccountusername
|
||||
func (api *API) SetBusinessAccountUsernameWithContext(ctx context.Context, params SetBusinessAccountUsername) (bool, error) {
|
||||
@@ -208,6 +235,7 @@ func (api *API) SetBusinessAccountUsernameWithContext(ctx context.Context, param
|
||||
}
|
||||
|
||||
// SetBusinessAccountBio holds parameters for the setBusinessAccountBio method.
|
||||
// Since: Bot API 9.0
|
||||
// See https://core.telegram.org/bots/api#setbusinessaccountbio
|
||||
type SetBusinessAccountBio struct {
|
||||
BusinessConnectionID string `json:"business_connection_id"`
|
||||
@@ -215,6 +243,7 @@ type SetBusinessAccountBio struct {
|
||||
}
|
||||
|
||||
// SetBusinessAccountBio sets the bio of a business account.
|
||||
// Since: Bot API 9.0
|
||||
// Returns true on success.
|
||||
// See https://core.telegram.org/bots/api#setbusinessaccountbio
|
||||
func (api *API) SetBusinessAccountBio(params SetBusinessAccountBio) (bool, error) {
|
||||
@@ -223,6 +252,7 @@ func (api *API) SetBusinessAccountBio(params SetBusinessAccountBio) (bool, error
|
||||
}
|
||||
|
||||
// SetBusinessAccountBioWithContext is the context-aware variant of SetBusinessAccountBio.
|
||||
// Since: Bot API 9.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#setbusinessaccountbio
|
||||
func (api *API) SetBusinessAccountBioWithContext(ctx context.Context, params SetBusinessAccountBio) (bool, error) {
|
||||
@@ -231,6 +261,7 @@ func (api *API) SetBusinessAccountBioWithContext(ctx context.Context, params Set
|
||||
}
|
||||
|
||||
// SetBusinessAccountProfilePhoto holds parameters for the setBusinessAccountProfilePhoto method.
|
||||
// Since: Bot API 9.0
|
||||
// See https://core.telegram.org/bots/api#setbusinessaccountprofilephoto
|
||||
type SetBusinessAccountProfilePhoto struct {
|
||||
BusinessConnectionID string `json:"business_connection_id"`
|
||||
@@ -239,6 +270,7 @@ type SetBusinessAccountProfilePhoto struct {
|
||||
}
|
||||
|
||||
// SetBusinessAccountProfilePhoto sets the profile photo of a business account.
|
||||
// Since: Bot API 9.0
|
||||
// Returns true on success.
|
||||
// See https://core.telegram.org/bots/api#setbusinessaccountprofilephoto
|
||||
func (api *API) SetBusinessAccountProfilePhoto(params SetBusinessAccountProfilePhoto) (bool, error) {
|
||||
@@ -247,6 +279,7 @@ func (api *API) SetBusinessAccountProfilePhoto(params SetBusinessAccountProfileP
|
||||
}
|
||||
|
||||
// SetBusinessAccountProfilePhotoWithContext is the context-aware variant of SetBusinessAccountProfilePhoto.
|
||||
// Since: Bot API 9.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#setbusinessaccountprofilephoto
|
||||
func (api *API) SetBusinessAccountProfilePhotoWithContext(ctx context.Context, params SetBusinessAccountProfilePhoto) (bool, error) {
|
||||
@@ -255,6 +288,7 @@ func (api *API) SetBusinessAccountProfilePhotoWithContext(ctx context.Context, p
|
||||
}
|
||||
|
||||
// RemoveBusinessAccountProfilePhoto holds parameters for the removeBusinessAccountProfilePhoto method.
|
||||
// Since: Bot API 9.0
|
||||
// See https://core.telegram.org/bots/api#removebusinessaccountprofilephoto
|
||||
type RemoveBusinessAccountProfilePhoto struct {
|
||||
BusinessConnectionID string `json:"business_connection_id"`
|
||||
@@ -262,6 +296,7 @@ type RemoveBusinessAccountProfilePhoto struct {
|
||||
}
|
||||
|
||||
// RemoveBusinessAccountProfilePhoto removes the profile photo of a business account.
|
||||
// Since: Bot API 9.0
|
||||
// Returns true on success.
|
||||
// See https://core.telegram.org/bots/api#removebusinessaccountprofilephoto
|
||||
func (api *API) RemoveBusinessAccountProfilePhoto(params RemoveBusinessAccountProfilePhoto) (bool, error) {
|
||||
@@ -270,6 +305,7 @@ func (api *API) RemoveBusinessAccountProfilePhoto(params RemoveBusinessAccountPr
|
||||
}
|
||||
|
||||
// RemoveBusinessAccountProfilePhotoWithContext is the context-aware variant of RemoveBusinessAccountProfilePhoto.
|
||||
// Since: Bot API 9.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#removebusinessaccountprofilephoto
|
||||
func (api *API) RemoveBusinessAccountProfilePhotoWithContext(ctx context.Context, params RemoveBusinessAccountProfilePhoto) (bool, error) {
|
||||
@@ -278,6 +314,7 @@ func (api *API) RemoveBusinessAccountProfilePhotoWithContext(ctx context.Context
|
||||
}
|
||||
|
||||
// SetBusinessAccountGiftSettings holds parameters for the setBusinessAccountGiftSettings method.
|
||||
// Since: Bot API 9.0
|
||||
// See https://core.telegram.org/bots/api#setbusinessaccountgiftsettings
|
||||
type SetBusinessAccountGiftSettings struct {
|
||||
BusinessConnectionID string `json:"business_connection_id"`
|
||||
@@ -286,6 +323,7 @@ type SetBusinessAccountGiftSettings struct {
|
||||
}
|
||||
|
||||
// SetBusinessAccountGiftSettings sets gift settings for a business account.
|
||||
// Since: Bot API 9.0
|
||||
// Returns true on success.
|
||||
// See https://core.telegram.org/bots/api#setbusinessaccountgiftsettings
|
||||
func (api *API) SetBusinessAccountGiftSettings(params SetBusinessAccountGiftSettings) (bool, error) {
|
||||
@@ -294,6 +332,7 @@ func (api *API) SetBusinessAccountGiftSettings(params SetBusinessAccountGiftSett
|
||||
}
|
||||
|
||||
// SetBusinessAccountGiftSettingsWithContext is the context-aware variant of SetBusinessAccountGiftSettings.
|
||||
// Since: Bot API 9.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#setbusinessaccountgiftsettings
|
||||
func (api *API) SetBusinessAccountGiftSettingsWithContext(ctx context.Context, params SetBusinessAccountGiftSettings) (bool, error) {
|
||||
@@ -302,12 +341,14 @@ func (api *API) SetBusinessAccountGiftSettingsWithContext(ctx context.Context, p
|
||||
}
|
||||
|
||||
// GetBusinessAccountStarBalance holds parameters for the getBusinessAccountStarBalance method.
|
||||
// Since: Bot API 9.0
|
||||
// See https://core.telegram.org/bots/api#getbusinessaccountstarbalance
|
||||
type GetBusinessAccountStarBalance struct {
|
||||
BusinessConnectionID string `json:"business_connection_id"`
|
||||
}
|
||||
|
||||
// GetBusinessAccountStarBalance returns the star balance of a business account.
|
||||
// Since: Bot API 9.0
|
||||
// See https://core.telegram.org/bots/api#getbusinessaccountstarbalance
|
||||
func (api *API) GetBusinessAccountStarBalance(params GetBusinessAccountStarBalance) (StarAmount, error) {
|
||||
req := NewRequest[StarAmount]("getBusinessAccountStarBalance", params)
|
||||
@@ -315,6 +356,7 @@ func (api *API) GetBusinessAccountStarBalance(params GetBusinessAccountStarBalan
|
||||
}
|
||||
|
||||
// GetBusinessAccountStarBalanceWithContext is the context-aware variant of GetBusinessAccountStarBalance.
|
||||
// Since: Bot API 9.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#getbusinessaccountstarbalance
|
||||
func (api *API) GetBusinessAccountStarBalanceWithContext(ctx context.Context, params GetBusinessAccountStarBalance) (StarAmount, error) {
|
||||
@@ -323,6 +365,7 @@ func (api *API) GetBusinessAccountStarBalanceWithContext(ctx context.Context, pa
|
||||
}
|
||||
|
||||
// TransferBusinessAccountStars holds parameters for the transferBusinessAccountStars method.
|
||||
// Since: Bot API 9.0
|
||||
// See https://core.telegram.org/bots/api#transferbusinessaccountstars
|
||||
type TransferBusinessAccountStars struct {
|
||||
BusinessConnectionID string `json:"business_connection_id"`
|
||||
@@ -330,6 +373,7 @@ type TransferBusinessAccountStars struct {
|
||||
}
|
||||
|
||||
// TransferBusinessAccountStars transfers stars from a business account.
|
||||
// Since: Bot API 9.0
|
||||
// Returns true on success.
|
||||
// See https://core.telegram.org/bots/api#transferbusinessaccountstars
|
||||
func (api *API) TransferBusinessAccountStars(params TransferBusinessAccountStars) (bool, error) {
|
||||
@@ -338,6 +382,7 @@ func (api *API) TransferBusinessAccountStars(params TransferBusinessAccountStars
|
||||
}
|
||||
|
||||
// TransferBusinessAccountStarsWithContext is the context-aware variant of TransferBusinessAccountStars.
|
||||
// Since: Bot API 9.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#transferbusinessaccountstars
|
||||
func (api *API) TransferBusinessAccountStarsWithContext(ctx context.Context, params TransferBusinessAccountStars) (bool, error) {
|
||||
@@ -346,6 +391,7 @@ func (api *API) TransferBusinessAccountStarsWithContext(ctx context.Context, par
|
||||
}
|
||||
|
||||
// GetBusinessAccountGifts holds parameters for the getBusinessAccountGifts method.
|
||||
// Since: Bot API 9.0
|
||||
// See https://core.telegram.org/bots/api#getbusinessaccountgifts
|
||||
type GetBusinessAccountGifts struct {
|
||||
BusinessConnectionID string `json:"business_connection_id"`
|
||||
@@ -362,6 +408,7 @@ type GetBusinessAccountGifts struct {
|
||||
}
|
||||
|
||||
// GetBusinessAccountGifts returns gifts owned by a business account.
|
||||
// Since: Bot API 9.0
|
||||
// See https://core.telegram.org/bots/api#getbusinessaccountgifts
|
||||
func (api *API) GetBusinessAccountGifts(params GetBusinessAccountGifts) (OwnedGifts, error) {
|
||||
req := NewRequest[OwnedGifts]("getBusinessAccountGifts", params)
|
||||
@@ -369,6 +416,7 @@ func (api *API) GetBusinessAccountGifts(params GetBusinessAccountGifts) (OwnedGi
|
||||
}
|
||||
|
||||
// GetBusinessAccountGiftsWithContext is the context-aware variant of GetBusinessAccountGifts.
|
||||
// Since: Bot API 9.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#getbusinessaccountgifts
|
||||
func (api *API) GetBusinessAccountGiftsWithContext(ctx context.Context, params GetBusinessAccountGifts) (OwnedGifts, error) {
|
||||
@@ -377,6 +425,7 @@ func (api *API) GetBusinessAccountGiftsWithContext(ctx context.Context, params G
|
||||
}
|
||||
|
||||
// ConvertGiftToStars holds parameters for the convertGiftToStars method.
|
||||
// Since: Bot API 9.0
|
||||
// See https://core.telegram.org/bots/api#convertgifttostars
|
||||
type ConvertGiftToStars struct {
|
||||
BusinessConnectionID string `json:"business_connection_id"`
|
||||
@@ -384,6 +433,7 @@ type ConvertGiftToStars struct {
|
||||
}
|
||||
|
||||
// ConvertGiftToStars converts a gift to Telegram Stars.
|
||||
// Since: Bot API 9.0
|
||||
// Returns true on success.
|
||||
// See https://core.telegram.org/bots/api#convertgifttostars
|
||||
func (api *API) ConvertGiftToStars(params ConvertGiftToStars) (bool, error) {
|
||||
@@ -392,6 +442,7 @@ func (api *API) ConvertGiftToStars(params ConvertGiftToStars) (bool, error) {
|
||||
}
|
||||
|
||||
// ConvertGiftToStarsWithContext is the context-aware variant of ConvertGiftToStars.
|
||||
// Since: Bot API 9.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#convertgifttostars
|
||||
func (api *API) ConvertGiftToStarsWithContext(ctx context.Context, params ConvertGiftToStars) (bool, error) {
|
||||
@@ -400,6 +451,7 @@ func (api *API) ConvertGiftToStarsWithContext(ctx context.Context, params Conver
|
||||
}
|
||||
|
||||
// UpgradeGift holds parameters for the upgradeGift method.
|
||||
// Since: Bot API 9.0
|
||||
// See https://core.telegram.org/bots/api#upgradegift
|
||||
type UpgradeGift struct {
|
||||
BusinessConnectionID string `json:"business_connection_id"`
|
||||
@@ -409,6 +461,7 @@ type UpgradeGift struct {
|
||||
}
|
||||
|
||||
// UpgradeGift upgrades a gift.
|
||||
// Since: Bot API 9.0
|
||||
// Returns true on success.
|
||||
// See https://core.telegram.org/bots/api#upgradegift
|
||||
func (api *API) UpgradeGift(params UpgradeGift) (bool, error) {
|
||||
@@ -417,6 +470,7 @@ func (api *API) UpgradeGift(params UpgradeGift) (bool, error) {
|
||||
}
|
||||
|
||||
// UpgradeGiftWithContext is the context-aware variant of UpgradeGift.
|
||||
// Since: Bot API 9.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#upgradegift
|
||||
func (api *API) UpgradeGiftWithContext(ctx context.Context, params UpgradeGift) (bool, error) {
|
||||
@@ -425,6 +479,7 @@ func (api *API) UpgradeGiftWithContext(ctx context.Context, params UpgradeGift)
|
||||
}
|
||||
|
||||
// TransferGift holds parameters for the transferGift method.
|
||||
// Since: Bot API 9.0
|
||||
// See https://core.telegram.org/bots/api#transfergift
|
||||
type TransferGift struct {
|
||||
BusinessConnectionID string `json:"business_connection_id"`
|
||||
@@ -434,6 +489,7 @@ type TransferGift struct {
|
||||
}
|
||||
|
||||
// TransferGift transfers a gift to another chat.
|
||||
// Since: Bot API 9.0
|
||||
// Returns true on success.
|
||||
// See https://core.telegram.org/bots/api#transfergift
|
||||
func (api *API) TransferGift(params TransferGift) (bool, error) {
|
||||
@@ -442,6 +498,7 @@ func (api *API) TransferGift(params TransferGift) (bool, error) {
|
||||
}
|
||||
|
||||
// TransferGiftWithContext is the context-aware variant of TransferGift.
|
||||
// Since: Bot API 9.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#transfergift
|
||||
func (api *API) TransferGiftWithContext(ctx context.Context, params TransferGift) (bool, error) {
|
||||
@@ -450,6 +507,7 @@ func (api *API) TransferGiftWithContext(ctx context.Context, params TransferGift
|
||||
}
|
||||
|
||||
// PostStory holds parameters for the postStory method.
|
||||
// Since: Bot API 7.2
|
||||
// See https://core.telegram.org/bots/api#poststory
|
||||
type PostStory struct {
|
||||
BusinessConnectionID string `json:"business_connection_id"`
|
||||
@@ -466,13 +524,15 @@ type PostStory struct {
|
||||
}
|
||||
|
||||
// PostStory posts a story with a photo.
|
||||
// Since: Bot API 7.2
|
||||
// See https://core.telegram.org/bots/api#poststory
|
||||
func (api *API) PostStory(params PostStory) (Story, error) {
|
||||
req := NewRequest[Story]("postStory", params)
|
||||
return req.Do(api)
|
||||
}
|
||||
|
||||
// PostStoryWithContext is the context-aware variant of PostStoryPhoto.
|
||||
// PostStoryWithContext is the context-aware variant of PostStory.
|
||||
// Since: Bot API 7.2
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#poststory
|
||||
func (api *API) PostStoryWithContext(ctx context.Context, params PostStory) (Story, error) {
|
||||
@@ -481,6 +541,7 @@ func (api *API) PostStoryWithContext(ctx context.Context, params PostStory) (Sto
|
||||
}
|
||||
|
||||
// RepostStory holds parameters for the repostStory method.
|
||||
// Since: Bot API 7.2
|
||||
// See https://core.telegram.org/bots/api#repoststory
|
||||
type RepostStory struct {
|
||||
BusinessConnectionID string `json:"business_connection_id"`
|
||||
@@ -492,6 +553,7 @@ type RepostStory struct {
|
||||
}
|
||||
|
||||
// RepostStory reposts a story from another chat.
|
||||
// Since: Bot API 7.2
|
||||
// Returns the reposted story.
|
||||
// See https://core.telegram.org/bots/api#repoststory
|
||||
func (api *API) RepostStory(params RepostStory) (Story, error) {
|
||||
@@ -500,6 +562,7 @@ func (api *API) RepostStory(params RepostStory) (Story, error) {
|
||||
}
|
||||
|
||||
// RepostStoryWithContext is the context-aware variant of RepostStory.
|
||||
// Since: Bot API 7.2
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#repoststory
|
||||
func (api *API) RepostStoryWithContext(ctx context.Context, params RepostStory) (Story, error) {
|
||||
@@ -508,6 +571,7 @@ func (api *API) RepostStoryWithContext(ctx context.Context, params RepostStory)
|
||||
}
|
||||
|
||||
// EditStory holds parameters for the editStory method.
|
||||
// Since: Bot API 7.2
|
||||
// See https://core.telegram.org/bots/api#editstory
|
||||
type EditStory struct {
|
||||
BusinessConnectionID string `json:"business_connection_id"`
|
||||
@@ -521,6 +585,7 @@ type EditStory struct {
|
||||
}
|
||||
|
||||
// EditStory edits an existing story.
|
||||
// Since: Bot API 7.2
|
||||
// Returns the updated story.
|
||||
// See https://core.telegram.org/bots/api#editstory
|
||||
func (api *API) EditStory(params EditStory) (Story, error) {
|
||||
@@ -529,6 +594,7 @@ func (api *API) EditStory(params EditStory) (Story, error) {
|
||||
}
|
||||
|
||||
// EditStoryWithContext is the context-aware variant of EditStory.
|
||||
// Since: Bot API 7.2
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#editstory
|
||||
func (api *API) EditStoryWithContext(ctx context.Context, params EditStory) (Story, error) {
|
||||
@@ -537,6 +603,7 @@ func (api *API) EditStoryWithContext(ctx context.Context, params EditStory) (Sto
|
||||
}
|
||||
|
||||
// DeleteStory holds parameters for the deleteStory method.
|
||||
// Since: Bot API 7.2
|
||||
// See https://core.telegram.org/bots/api#deletestory
|
||||
type DeleteStory struct {
|
||||
BusinessConnectionID string `json:"business_connection_id"`
|
||||
@@ -544,6 +611,7 @@ type DeleteStory struct {
|
||||
}
|
||||
|
||||
// DeleteStory deletes a story.
|
||||
// Since: Bot API 7.2
|
||||
// Returns true on success.
|
||||
// See https://core.telegram.org/bots/api#deletestory
|
||||
func (api *API) DeleteStory(params DeleteStory) (bool, error) {
|
||||
@@ -552,6 +620,7 @@ func (api *API) DeleteStory(params DeleteStory) (bool, error) {
|
||||
}
|
||||
|
||||
// DeleteStoryWithContext is the context-aware variant of DeleteStory.
|
||||
// Since: Bot API 7.2
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#deletestory
|
||||
func (api *API) DeleteStoryWithContext(ctx context.Context, params DeleteStory) (bool, error) {
|
||||
|
||||
+11
-1
@@ -1,6 +1,7 @@
|
||||
package tgapi
|
||||
|
||||
// BusinessIntro contains information about the business intro.
|
||||
// Since: Bot API 7.2
|
||||
// See https://core.telegram.org/bots/api#businessintro
|
||||
type BusinessIntro struct {
|
||||
Title string `json:"title,omitempty"`
|
||||
@@ -9,6 +10,7 @@ type BusinessIntro struct {
|
||||
}
|
||||
|
||||
// BusinessLocation contains information about the business location.
|
||||
// Since: Bot API 7.2
|
||||
// See https://core.telegram.org/bots/api#businesslocation
|
||||
type BusinessLocation struct {
|
||||
Address string `json:"address"`
|
||||
@@ -16,6 +18,7 @@ type BusinessLocation struct {
|
||||
}
|
||||
|
||||
// BusinessOpeningHoursInterval represents an interval of opening hours.
|
||||
// Since: Bot API 7.2
|
||||
// See https://core.telegram.org/bots/api#businessopeninghoursinterval
|
||||
type BusinessOpeningHoursInterval struct {
|
||||
OpeningMinute int `json:"opening_minute"`
|
||||
@@ -23,6 +26,7 @@ type BusinessOpeningHoursInterval struct {
|
||||
}
|
||||
|
||||
// BusinessOpeningHours represents the opening hours of a business.
|
||||
// Since: Bot API 7.2
|
||||
// See https://core.telegram.org/bots/api#businessopeninghours
|
||||
type BusinessOpeningHours struct {
|
||||
TimeZoneName string `json:"time_zone_name"`
|
||||
@@ -31,6 +35,7 @@ type BusinessOpeningHours struct {
|
||||
|
||||
// BusinessBotRights represents the rights of a business bot.
|
||||
// All fields are optional booleans that, when present, are always true.
|
||||
// Since: Bot API 9.0
|
||||
// See https://core.telegram.org/bots/api#businessbotrights
|
||||
type BusinessBotRights struct {
|
||||
CanReply *bool `json:"can_reply,omitempty"`
|
||||
@@ -50,6 +55,7 @@ type BusinessBotRights struct {
|
||||
}
|
||||
|
||||
// BusinessConnection contains information about a business connection.
|
||||
// Since: Bot API 7.2
|
||||
// See https://core.telegram.org/bots/api#businessconnection
|
||||
type BusinessConnection struct {
|
||||
ID string `json:"id"`
|
||||
@@ -61,6 +67,7 @@ type BusinessConnection struct {
|
||||
}
|
||||
|
||||
// BusinessMessagesDeleted is received when messages are deleted from a connected business account.
|
||||
// Since: Bot API 7.2
|
||||
// See https://core.telegram.org/bots/api#businessmessagesdeleted
|
||||
type BusinessMessagesDeleted struct {
|
||||
BusinessConnectionID string `json:"business_connection_id"`
|
||||
@@ -79,6 +86,7 @@ const (
|
||||
)
|
||||
|
||||
// InputStoryContent represents the content of a story to be posted.
|
||||
// Since: Bot API 9.0
|
||||
// See https://core.telegram.org/bots/api#inputstorycontent
|
||||
type InputStoryContent struct {
|
||||
Type InputStoryContentType `json:"type"`
|
||||
@@ -94,6 +102,7 @@ type InputStoryContent struct {
|
||||
}
|
||||
|
||||
// StoryAreaPosition describes the position of a clickable area on a story.
|
||||
// Since: Bot API 9.0
|
||||
// See https://core.telegram.org/bots/api#storyareaposition
|
||||
type StoryAreaPosition struct {
|
||||
XPercentage float64 `json:"x_percentage"`
|
||||
@@ -121,7 +130,7 @@ const (
|
||||
)
|
||||
|
||||
// StoryAreaType describes the type of a clickable area on a story.
|
||||
// Fields should be set according to the Type.
|
||||
// Since: Bot API 9.0
|
||||
// See https://core.telegram.org/bots/api#storyareatype
|
||||
type StoryAreaType struct {
|
||||
Type StoryAreaTypeType `json:"type"`
|
||||
@@ -149,6 +158,7 @@ type StoryAreaType struct {
|
||||
}
|
||||
|
||||
// StoryArea represents a clickable area on a story.
|
||||
// Since: Bot API 9.0
|
||||
// See https://core.telegram.org/bots/api#storyarea
|
||||
type StoryArea struct {
|
||||
Position StoryAreaPosition `json:"position"`
|
||||
|
||||
+113
-14
@@ -3,6 +3,7 @@ package tgapi
|
||||
import "context"
|
||||
|
||||
// BanChatMember holds parameters for the banChatMember method.
|
||||
// Since: Bot API 5.3
|
||||
// See https://core.telegram.org/bots/api#banchatmember
|
||||
type BanChatMember struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -12,6 +13,7 @@ type BanChatMember struct {
|
||||
}
|
||||
|
||||
// BanChatMember bans a user in a chat.
|
||||
// Since: Bot API 5.3
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#banchatmember
|
||||
func (api *API) BanChatMember(params BanChatMember) (bool, error) {
|
||||
@@ -20,6 +22,7 @@ func (api *API) BanChatMember(params BanChatMember) (bool, error) {
|
||||
}
|
||||
|
||||
// BanChatMemberWithContext is the context-aware variant of BanChatMember.
|
||||
// Since: Bot API 5.3
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#banchatmember
|
||||
func (api *API) BanChatMemberWithContext(ctx context.Context, params BanChatMember) (bool, error) {
|
||||
@@ -28,6 +31,7 @@ func (api *API) BanChatMemberWithContext(ctx context.Context, params BanChatMemb
|
||||
}
|
||||
|
||||
// UnbanChatMember holds parameters for the unbanChatMember method.
|
||||
// Since: Bot API 2.0
|
||||
// See https://core.telegram.org/bots/api#unbanchatmember
|
||||
type UnbanChatMember struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -36,6 +40,7 @@ type UnbanChatMember struct {
|
||||
}
|
||||
|
||||
// UnbanChatMember unbans a previously banned user in a chat.
|
||||
// Since: Bot API 2.0
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#unbanchatmember
|
||||
func (api *API) UnbanChatMember(params UnbanChatMember) (bool, error) {
|
||||
@@ -44,6 +49,7 @@ func (api *API) UnbanChatMember(params UnbanChatMember) (bool, error) {
|
||||
}
|
||||
|
||||
// UnbanChatMemberWithContext is the context-aware variant of UnbanChatMember.
|
||||
// Since: Bot API 2.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#unbanchatmember
|
||||
func (api *API) UnbanChatMemberWithContext(ctx context.Context, params UnbanChatMember) (bool, error) {
|
||||
@@ -52,6 +58,7 @@ func (api *API) UnbanChatMemberWithContext(ctx context.Context, params UnbanChat
|
||||
}
|
||||
|
||||
// RestrictChatMember holds parameters for the restrictChatMember method.
|
||||
// Since: Bot API 3.1
|
||||
// See https://core.telegram.org/bots/api#restrictchatmember
|
||||
type RestrictChatMember struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -62,6 +69,7 @@ type RestrictChatMember struct {
|
||||
}
|
||||
|
||||
// RestrictChatMember restricts a user in a chat.
|
||||
// Since: Bot API 3.1
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#restrictchatmember
|
||||
func (api *API) RestrictChatMember(params RestrictChatMember) (bool, error) {
|
||||
@@ -70,6 +78,7 @@ func (api *API) RestrictChatMember(params RestrictChatMember) (bool, error) {
|
||||
}
|
||||
|
||||
// RestrictChatMemberWithContext is the context-aware variant of RestrictChatMember.
|
||||
// Since: Bot API 3.1
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#restrictchatmember
|
||||
func (api *API) RestrictChatMemberWithContext(ctx context.Context, params RestrictChatMember) (bool, error) {
|
||||
@@ -78,31 +87,33 @@ func (api *API) RestrictChatMemberWithContext(ctx context.Context, params Restri
|
||||
}
|
||||
|
||||
// PromoteChatMember holds parameters for the promoteChatMember method.
|
||||
// Since: Bot API 3.1
|
||||
// See https://core.telegram.org/bots/api#promotechatmember
|
||||
type PromoteChatMember struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
UserID int64 `json:"user_id"`
|
||||
IsAnonymous bool `json:"is_anonymous,omitempty"`
|
||||
IsAnonymous bool `json:"is_anonymous,omitempty"` // Since: Bot API 5.1
|
||||
|
||||
CanManageChat bool `json:"can_manage_chat,omitempty"`
|
||||
CanManageChat bool `json:"can_manage_chat,omitempty"` // Since: Bot API 5.3
|
||||
CanDeleteMessages bool `json:"can_delete_messages,omitempty"`
|
||||
CanManageVideoChats bool `json:"can_manage_video_chats,omitempty"`
|
||||
CanManageVideoChats bool `json:"can_manage_video_chats,omitempty"` // Since: Bot API 6.0
|
||||
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"`
|
||||
CanPostStories bool `json:"can_post_stories,omitempty"`
|
||||
CanEditStories bool `json:"can_edit_stories,omitempty"`
|
||||
CanDeleteStories bool `json:"can_delete_stories,omitempty"`
|
||||
CanPostStories bool `json:"can_post_stories,omitempty"` // Since: Bot API 6.9
|
||||
CanEditStories bool `json:"can_edit_stories,omitempty"` // Since: Bot API 6.9
|
||||
CanDeleteStories bool `json:"can_delete_stories,omitempty"` // Since: Bot API 6.9
|
||||
CanPostMessages bool `json:"can_post_messages,omitempty"`
|
||||
CanEditMessages bool `json:"can_edit_messages,omitempty"`
|
||||
CanPinMessages bool `json:"can_pin_messages,omitempty"`
|
||||
CanManageTopics bool `json:"can_manage_topics,omitempty"`
|
||||
CanManageDirectMessages bool `json:"can_manage_direct_messages,omitempty"`
|
||||
CanManageTags bool `json:"can_manage_tags,omitempty"`
|
||||
CanManageTopics bool `json:"can_manage_topics,omitempty"` // Since: Bot API 6.3
|
||||
CanManageDirectMessages bool `json:"can_manage_direct_messages,omitempty"` // Since: Bot API 9.1
|
||||
CanManageTags bool `json:"can_manage_tags,omitempty"` // Since: Bot API 9.5
|
||||
}
|
||||
|
||||
// PromoteChatMember promotes or demotes a user in a chat.
|
||||
// Since: Bot API 3.1
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#promotechatmember
|
||||
func (api *API) PromoteChatMember(params PromoteChatMember) (bool, error) {
|
||||
@@ -111,6 +122,7 @@ func (api *API) PromoteChatMember(params PromoteChatMember) (bool, error) {
|
||||
}
|
||||
|
||||
// PromoteChatMemberWithContext is the context-aware variant of PromoteChatMember.
|
||||
// Since: Bot API 3.1
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#promotechatmember
|
||||
func (api *API) PromoteChatMemberWithContext(ctx context.Context, params PromoteChatMember) (bool, error) {
|
||||
@@ -119,6 +131,7 @@ func (api *API) PromoteChatMemberWithContext(ctx context.Context, params Promote
|
||||
}
|
||||
|
||||
// SetChatAdministratorCustomTitle holds parameters for the setChatAdministratorCustomTitle method.
|
||||
// Since: Bot API 5.0
|
||||
// See https://core.telegram.org/bots/api#setchatadministratorcustomtitle
|
||||
type SetChatAdministratorCustomTitle struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -127,6 +140,7 @@ type SetChatAdministratorCustomTitle struct {
|
||||
}
|
||||
|
||||
// SetChatAdministratorCustomTitle sets a custom title for an administrator.
|
||||
// Since: Bot API 5.0
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#setchatadministratorcustomtitle
|
||||
func (api *API) SetChatAdministratorCustomTitle(params SetChatAdministratorCustomTitle) (bool, error) {
|
||||
@@ -135,6 +149,7 @@ func (api *API) SetChatAdministratorCustomTitle(params SetChatAdministratorCusto
|
||||
}
|
||||
|
||||
// SetChatAdministratorCustomTitleWithContext is the context-aware variant of SetChatAdministratorCustomTitle.
|
||||
// Since: Bot API 5.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#setchatadministratorcustomtitle
|
||||
func (api *API) SetChatAdministratorCustomTitleWithContext(ctx context.Context, params SetChatAdministratorCustomTitle) (bool, error) {
|
||||
@@ -143,6 +158,7 @@ func (api *API) SetChatAdministratorCustomTitleWithContext(ctx context.Context,
|
||||
}
|
||||
|
||||
// SetChatMemberTag holds parameters for the setChatMemberTag method.
|
||||
// Since: Bot API 9.5
|
||||
// See https://core.telegram.org/bots/api#setchatmembertag
|
||||
type SetChatMemberTag struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -151,6 +167,7 @@ type SetChatMemberTag struct {
|
||||
}
|
||||
|
||||
// SetChatMemberTag sets a tag for a chat member.
|
||||
// Since: Bot API 9.5
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#setchatmembertag
|
||||
func (api *API) SetChatMemberTag(params SetChatMemberTag) (bool, error) {
|
||||
@@ -159,6 +176,7 @@ func (api *API) SetChatMemberTag(params SetChatMemberTag) (bool, error) {
|
||||
}
|
||||
|
||||
// SetChatMemberTagWithContext is the context-aware variant of SetChatMemberTag.
|
||||
// Since: Bot API 9.5
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#setchatmembertag
|
||||
func (api *API) SetChatMemberTagWithContext(ctx context.Context, params SetChatMemberTag) (bool, error) {
|
||||
@@ -167,6 +185,7 @@ func (api *API) SetChatMemberTagWithContext(ctx context.Context, params SetChatM
|
||||
}
|
||||
|
||||
// BanChatSenderChat holds parameters for the banChatSenderChat method.
|
||||
// Since: Bot API 5.6
|
||||
// See https://core.telegram.org/bots/api#banchatsenderchat
|
||||
type BanChatSenderChat struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -174,6 +193,7 @@ type BanChatSenderChat struct {
|
||||
}
|
||||
|
||||
// BanChatSenderChat bans a channel chat in a supergroup or channel.
|
||||
// Since: Bot API 5.6
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#banchatsenderchat
|
||||
func (api *API) BanChatSenderChat(params BanChatSenderChat) (bool, error) {
|
||||
@@ -182,6 +202,7 @@ func (api *API) BanChatSenderChat(params BanChatSenderChat) (bool, error) {
|
||||
}
|
||||
|
||||
// BanChatSenderChatWithContext is the context-aware variant of BanChatSenderChat.
|
||||
// Since: Bot API 5.6
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#banchatsenderchat
|
||||
func (api *API) BanChatSenderChatWithContext(ctx context.Context, params BanChatSenderChat) (bool, error) {
|
||||
@@ -190,6 +211,7 @@ func (api *API) BanChatSenderChatWithContext(ctx context.Context, params BanChat
|
||||
}
|
||||
|
||||
// UnbanChatSenderChat holds parameters for the unbanChatSenderChat method.
|
||||
// Since: Bot API 5.6
|
||||
// See https://core.telegram.org/bots/api#unbanchatsenderchat
|
||||
type UnbanChatSenderChat struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -197,6 +219,7 @@ type UnbanChatSenderChat struct {
|
||||
}
|
||||
|
||||
// UnbanChatSenderChat unbans a previously banned channel chat.
|
||||
// Since: Bot API 5.6
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#unbanchatsenderchat
|
||||
func (api *API) UnbanChatSenderChat(params UnbanChatSenderChat) (bool, error) {
|
||||
@@ -205,6 +228,7 @@ func (api *API) UnbanChatSenderChat(params UnbanChatSenderChat) (bool, error) {
|
||||
}
|
||||
|
||||
// UnbanChatSenderChatWithContext is the context-aware variant of UnbanChatSenderChat.
|
||||
// Since: Bot API 5.6
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#unbanchatsenderchat
|
||||
func (api *API) UnbanChatSenderChatWithContext(ctx context.Context, params UnbanChatSenderChat) (bool, error) {
|
||||
@@ -213,6 +237,7 @@ func (api *API) UnbanChatSenderChatWithContext(ctx context.Context, params Unban
|
||||
}
|
||||
|
||||
// SetChatPermissions holds parameters for the setChatPermissions method.
|
||||
// Since: Bot API 4.4
|
||||
// See https://core.telegram.org/bots/api#setchatpermissions
|
||||
type SetChatPermissions struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -221,6 +246,7 @@ type SetChatPermissions struct {
|
||||
}
|
||||
|
||||
// SetChatPermissions sets default chat permissions for all members.
|
||||
// Since: Bot API 4.4
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#setchatpermissions
|
||||
func (api *API) SetChatPermissions(params SetChatPermissions) (bool, error) {
|
||||
@@ -229,6 +255,7 @@ func (api *API) SetChatPermissions(params SetChatPermissions) (bool, error) {
|
||||
}
|
||||
|
||||
// SetChatPermissionsWithContext is the context-aware variant of SetChatPermissions.
|
||||
// Since: Bot API 4.4
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#setchatpermissions
|
||||
func (api *API) SetChatPermissionsWithContext(ctx context.Context, params SetChatPermissions) (bool, error) {
|
||||
@@ -237,12 +264,14 @@ func (api *API) SetChatPermissionsWithContext(ctx context.Context, params SetCha
|
||||
}
|
||||
|
||||
// ExportChatInviteLink holds parameters for the exportChatInviteLink method.
|
||||
// Since: Bot API 3.1
|
||||
// See https://core.telegram.org/bots/api#exportchatinvitelink
|
||||
type ExportChatInviteLink struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
}
|
||||
|
||||
// ExportChatInviteLink generates a new primary invite link for a chat.
|
||||
// Since: Bot API 3.1
|
||||
// Returns the new invite link as string.
|
||||
// See https://core.telegram.org/bots/api#exportchatinvitelink
|
||||
func (api *API) ExportChatInviteLink(params ExportChatInviteLink) (string, error) {
|
||||
@@ -251,6 +280,7 @@ func (api *API) ExportChatInviteLink(params ExportChatInviteLink) (string, error
|
||||
}
|
||||
|
||||
// ExportChatInviteLinkWithContext is the context-aware variant of ExportChatInviteLink.
|
||||
// Since: Bot API 3.1
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#exportchatinvitelink
|
||||
func (api *API) ExportChatInviteLinkWithContext(ctx context.Context, params ExportChatInviteLink) (string, error) {
|
||||
@@ -259,6 +289,7 @@ func (api *API) ExportChatInviteLinkWithContext(ctx context.Context, params Expo
|
||||
}
|
||||
|
||||
// CreateChatInviteLink holds parameters for the createChatInviteLink method.
|
||||
// Since: Bot API 5.1
|
||||
// See https://core.telegram.org/bots/api#createchatinvitelink
|
||||
type CreateChatInviteLink struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -269,6 +300,7 @@ type CreateChatInviteLink struct {
|
||||
}
|
||||
|
||||
// CreateChatInviteLink creates an additional invite link for a chat.
|
||||
// Since: Bot API 5.1
|
||||
// Returns the created invite link.
|
||||
// See https://core.telegram.org/bots/api#createchatinvitelink
|
||||
func (api *API) CreateChatInviteLink(params CreateChatInviteLink) (ChatInviteLink, error) {
|
||||
@@ -277,6 +309,7 @@ func (api *API) CreateChatInviteLink(params CreateChatInviteLink) (ChatInviteLin
|
||||
}
|
||||
|
||||
// CreateChatInviteLinkWithContext is the context-aware variant of CreateChatInviteLink.
|
||||
// Since: Bot API 5.1
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#createchatinvitelink
|
||||
func (api *API) CreateChatInviteLinkWithContext(ctx context.Context, params CreateChatInviteLink) (ChatInviteLink, error) {
|
||||
@@ -285,6 +318,7 @@ func (api *API) CreateChatInviteLinkWithContext(ctx context.Context, params Crea
|
||||
}
|
||||
|
||||
// EditChatInviteLink holds parameters for the editChatInviteLink method.
|
||||
// Since: Bot API 5.1
|
||||
// See https://core.telegram.org/bots/api#editchatinvitelink
|
||||
type EditChatInviteLink struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -297,6 +331,7 @@ type EditChatInviteLink struct {
|
||||
}
|
||||
|
||||
// EditChatInviteLink edits a non‑primary invite link.
|
||||
// Since: Bot API 5.1
|
||||
// Returns the edited invite link.
|
||||
// See https://core.telegram.org/bots/api#editchatinvitelink
|
||||
func (api *API) EditChatInviteLink(params EditChatInviteLink) (ChatInviteLink, error) {
|
||||
@@ -305,6 +340,7 @@ func (api *API) EditChatInviteLink(params EditChatInviteLink) (ChatInviteLink, e
|
||||
}
|
||||
|
||||
// EditChatInviteLinkWithContext is the context-aware variant of EditChatInviteLink.
|
||||
// Since: Bot API 5.1
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#editchatinvitelink
|
||||
func (api *API) EditChatInviteLinkWithContext(ctx context.Context, params EditChatInviteLink) (ChatInviteLink, error) {
|
||||
@@ -313,6 +349,7 @@ func (api *API) EditChatInviteLinkWithContext(ctx context.Context, params EditCh
|
||||
}
|
||||
|
||||
// CreateChatSubscriptionInviteLink holds parameters for the createChatSubscriptionInviteLink method.
|
||||
// Since: Bot API 8.0
|
||||
// See https://core.telegram.org/bots/api#createchatsubscriptioninvitelink
|
||||
type CreateChatSubscriptionInviteLink struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -322,6 +359,7 @@ type CreateChatSubscriptionInviteLink struct {
|
||||
}
|
||||
|
||||
// CreateChatSubscriptionInviteLink creates a subscription invite link for a channel chat.
|
||||
// Since: Bot API 8.0
|
||||
// Returns the created invite link.
|
||||
// See https://core.telegram.org/bots/api#createchatsubscriptioninvitelink
|
||||
func (api *API) CreateChatSubscriptionInviteLink(params CreateChatSubscriptionInviteLink) (ChatInviteLink, error) {
|
||||
@@ -330,6 +368,7 @@ func (api *API) CreateChatSubscriptionInviteLink(params CreateChatSubscriptionIn
|
||||
}
|
||||
|
||||
// CreateChatSubscriptionInviteLinkWithContext is the context-aware variant of CreateChatSubscriptionInviteLink.
|
||||
// Since: Bot API 8.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#createchatsubscriptioninvitelink
|
||||
func (api *API) CreateChatSubscriptionInviteLinkWithContext(ctx context.Context, params CreateChatSubscriptionInviteLink) (ChatInviteLink, error) {
|
||||
@@ -338,6 +377,7 @@ func (api *API) CreateChatSubscriptionInviteLinkWithContext(ctx context.Context,
|
||||
}
|
||||
|
||||
// EditChatSubscriptionInviteLink holds parameters for the editChatSubscriptionInviteLink method.
|
||||
// Since: Bot API 8.0
|
||||
// See https://core.telegram.org/bots/api#editchatsubscriptioninvitelink
|
||||
type EditChatSubscriptionInviteLink struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -346,6 +386,7 @@ type EditChatSubscriptionInviteLink struct {
|
||||
}
|
||||
|
||||
// EditChatSubscriptionInviteLink edits a subscription invite link.
|
||||
// Since: Bot API 8.0
|
||||
// Returns the edited invite link.
|
||||
// See https://core.telegram.org/bots/api#editchatsubscriptioninvitelink
|
||||
func (api *API) EditChatSubscriptionInviteLink(params EditChatSubscriptionInviteLink) (ChatInviteLink, error) {
|
||||
@@ -354,6 +395,7 @@ func (api *API) EditChatSubscriptionInviteLink(params EditChatSubscriptionInvite
|
||||
}
|
||||
|
||||
// EditChatSubscriptionInviteLinkWithContext is the context-aware variant of EditChatSubscriptionInviteLink.
|
||||
// Since: Bot API 8.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#editchatsubscriptioninvitelink
|
||||
func (api *API) EditChatSubscriptionInviteLinkWithContext(ctx context.Context, params EditChatSubscriptionInviteLink) (ChatInviteLink, error) {
|
||||
@@ -362,6 +404,7 @@ func (api *API) EditChatSubscriptionInviteLinkWithContext(ctx context.Context, p
|
||||
}
|
||||
|
||||
// RevokeChatInviteLink holds parameters for the revokeChatInviteLink method.
|
||||
// Since: Bot API 5.1
|
||||
// See https://core.telegram.org/bots/api#revokechatinvitelink
|
||||
type RevokeChatInviteLink struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -369,6 +412,7 @@ type RevokeChatInviteLink struct {
|
||||
}
|
||||
|
||||
// RevokeChatInviteLink revokes an invite link.
|
||||
// Since: Bot API 5.1
|
||||
// Returns the revoked invite link object.
|
||||
// See https://core.telegram.org/bots/api#revokechatinvitelink
|
||||
func (api *API) RevokeChatInviteLink(params RevokeChatInviteLink) (ChatInviteLink, error) {
|
||||
@@ -377,6 +421,7 @@ func (api *API) RevokeChatInviteLink(params RevokeChatInviteLink) (ChatInviteLin
|
||||
}
|
||||
|
||||
// RevokeChatInviteLinkWithContext is the context-aware variant of RevokeChatInviteLink.
|
||||
// Since: Bot API 5.1
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#revokechatinvitelink
|
||||
func (api *API) RevokeChatInviteLinkWithContext(ctx context.Context, params RevokeChatInviteLink) (ChatInviteLink, error) {
|
||||
@@ -385,6 +430,7 @@ func (api *API) RevokeChatInviteLinkWithContext(ctx context.Context, params Revo
|
||||
}
|
||||
|
||||
// ApproveChatJoinRequest holds parameters for the approveChatJoinRequest method.
|
||||
// Since: Bot API 5.4
|
||||
// See https://core.telegram.org/bots/api#approvechatjoinrequest
|
||||
type ApproveChatJoinRequest struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -392,6 +438,7 @@ type ApproveChatJoinRequest struct {
|
||||
}
|
||||
|
||||
// ApproveChatJoinRequest approves a chat join request.
|
||||
// Since: Bot API 5.4
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#approvechatjoinrequest
|
||||
func (api *API) ApproveChatJoinRequest(params ApproveChatJoinRequest) (bool, error) {
|
||||
@@ -400,6 +447,7 @@ func (api *API) ApproveChatJoinRequest(params ApproveChatJoinRequest) (bool, err
|
||||
}
|
||||
|
||||
// ApproveChatJoinRequestWithContext is the context-aware variant of ApproveChatJoinRequest.
|
||||
// Since: Bot API 5.4
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#approvechatjoinrequest
|
||||
func (api *API) ApproveChatJoinRequestWithContext(ctx context.Context, params ApproveChatJoinRequest) (bool, error) {
|
||||
@@ -408,6 +456,7 @@ func (api *API) ApproveChatJoinRequestWithContext(ctx context.Context, params Ap
|
||||
}
|
||||
|
||||
// DeclineChatJoinRequest holds parameters for the declineChatJoinRequest method.
|
||||
// Since: Bot API 5.4
|
||||
// See https://core.telegram.org/bots/api#declinechatjoinrequest
|
||||
type DeclineChatJoinRequest struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -415,6 +464,7 @@ type DeclineChatJoinRequest struct {
|
||||
}
|
||||
|
||||
// DeclineChatJoinRequest declines a chat join request.
|
||||
// Since: Bot API 5.4
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#declinechatjoinrequest
|
||||
func (api *API) DeclineChatJoinRequest(params DeclineChatJoinRequest) (bool, error) {
|
||||
@@ -423,6 +473,7 @@ func (api *API) DeclineChatJoinRequest(params DeclineChatJoinRequest) (bool, err
|
||||
}
|
||||
|
||||
// DeclineChatJoinRequestWithContext is the context-aware variant of DeclineChatJoinRequest.
|
||||
// Since: Bot API 5.4
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#declinechatjoinrequest
|
||||
func (api *API) DeclineChatJoinRequestWithContext(ctx context.Context, params DeclineChatJoinRequest) (bool, error) {
|
||||
@@ -431,12 +482,14 @@ func (api *API) DeclineChatJoinRequestWithContext(ctx context.Context, params De
|
||||
}
|
||||
|
||||
// SetChatPhoto holds parameters for the setChatPhoto method.
|
||||
// Since: Bot API 3.1
|
||||
// See https://core.telegram.org/bots/api#setchatphoto
|
||||
type SetChatPhoto struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
}
|
||||
|
||||
// SetChatPhoto changes the chat photo.
|
||||
// Since: Bot API 3.1
|
||||
// photo is the file to upload as the new photo.
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#setchatphoto
|
||||
@@ -450,12 +503,14 @@ func (api *API) SetChatPhoto(params SetChatPhoto, photo UploaderFile) (bool, err
|
||||
}
|
||||
|
||||
// DeleteChatPhoto holds parameters for the deleteChatPhoto method.
|
||||
// Since: Bot API 3.1
|
||||
// See https://core.telegram.org/bots/api#deletechatphoto
|
||||
type DeleteChatPhoto struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
}
|
||||
|
||||
// DeleteChatPhoto deletes a chat photo.
|
||||
// Since: Bot API 3.1
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#deletechatphoto
|
||||
func (api *API) DeleteChatPhoto(params DeleteChatPhoto) (bool, error) {
|
||||
@@ -464,6 +519,7 @@ func (api *API) DeleteChatPhoto(params DeleteChatPhoto) (bool, error) {
|
||||
}
|
||||
|
||||
// DeleteChatPhotoWithContext is the context-aware variant of DeleteChatPhoto.
|
||||
// Since: Bot API 3.1
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#deletechatphoto
|
||||
func (api *API) DeleteChatPhotoWithContext(ctx context.Context, params DeleteChatPhoto) (bool, error) {
|
||||
@@ -472,6 +528,7 @@ func (api *API) DeleteChatPhotoWithContext(ctx context.Context, params DeleteCha
|
||||
}
|
||||
|
||||
// SetChatTitle holds parameters for the setChatTitle method.
|
||||
// Since: Bot API 3.1
|
||||
// See https://core.telegram.org/bots/api#setchattitle
|
||||
type SetChatTitle struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -479,6 +536,7 @@ type SetChatTitle struct {
|
||||
}
|
||||
|
||||
// SetChatTitle changes the chat title.
|
||||
// Since: Bot API 3.1
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#setchattitle
|
||||
func (api *API) SetChatTitle(params SetChatTitle) (bool, error) {
|
||||
@@ -487,6 +545,7 @@ func (api *API) SetChatTitle(params SetChatTitle) (bool, error) {
|
||||
}
|
||||
|
||||
// SetChatTitleWithContext is the context-aware variant of SetChatTitle.
|
||||
// Since: Bot API 3.1
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#setchattitle
|
||||
func (api *API) SetChatTitleWithContext(ctx context.Context, params SetChatTitle) (bool, error) {
|
||||
@@ -495,6 +554,7 @@ func (api *API) SetChatTitleWithContext(ctx context.Context, params SetChatTitle
|
||||
}
|
||||
|
||||
// SetChatDescription holds parameters for the setChatDescription method.
|
||||
// Since: Bot API 3.1
|
||||
// See https://core.telegram.org/bots/api#setchatdescription
|
||||
type SetChatDescription struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -502,6 +562,7 @@ type SetChatDescription struct {
|
||||
}
|
||||
|
||||
// SetChatDescription changes the chat description.
|
||||
// Since: Bot API 3.1
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#setchatdescription
|
||||
func (api *API) SetChatDescription(params SetChatDescription) (bool, error) {
|
||||
@@ -510,6 +571,7 @@ func (api *API) SetChatDescription(params SetChatDescription) (bool, error) {
|
||||
}
|
||||
|
||||
// SetChatDescriptionWithContext is the context-aware variant of SetChatDescription.
|
||||
// Since: Bot API 3.1
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#setchatdescription
|
||||
func (api *API) SetChatDescriptionWithContext(ctx context.Context, params SetChatDescription) (bool, error) {
|
||||
@@ -518,6 +580,7 @@ func (api *API) SetChatDescriptionWithContext(ctx context.Context, params SetCha
|
||||
}
|
||||
|
||||
// PinChatMessage holds parameters for the pinChatMessage method.
|
||||
// Since: Bot API 3.1
|
||||
// See https://core.telegram.org/bots/api#pinchatmessage
|
||||
type PinChatMessage struct {
|
||||
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
|
||||
@@ -527,6 +590,7 @@ type PinChatMessage struct {
|
||||
}
|
||||
|
||||
// PinChatMessage pins a message in a chat.
|
||||
// Since: Bot API 3.1
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#pinchatmessage
|
||||
func (api *API) PinChatMessage(params PinChatMessage) (bool, error) {
|
||||
@@ -535,6 +599,7 @@ func (api *API) PinChatMessage(params PinChatMessage) (bool, error) {
|
||||
}
|
||||
|
||||
// PinChatMessageWithContext is the context-aware variant of PinChatMessage.
|
||||
// Since: Bot API 3.1
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#pinchatmessage
|
||||
func (api *API) PinChatMessageWithContext(ctx context.Context, params PinChatMessage) (bool, error) {
|
||||
@@ -543,6 +608,7 @@ func (api *API) PinChatMessageWithContext(ctx context.Context, params PinChatMes
|
||||
}
|
||||
|
||||
// UnpinChatMessage holds parameters for the unpinChatMessage method.
|
||||
// Since: Bot API 3.1
|
||||
// See https://core.telegram.org/bots/api#unpinchatmessage
|
||||
type UnpinChatMessage struct {
|
||||
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
|
||||
@@ -551,6 +617,7 @@ type UnpinChatMessage struct {
|
||||
}
|
||||
|
||||
// UnpinChatMessage unpins a message in a chat.
|
||||
// Since: Bot API 3.1
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#unpinchatmessage
|
||||
func (api *API) UnpinChatMessage(params UnpinChatMessage) (bool, error) {
|
||||
@@ -559,6 +626,7 @@ func (api *API) UnpinChatMessage(params UnpinChatMessage) (bool, error) {
|
||||
}
|
||||
|
||||
// UnpinChatMessageWithContext is the context-aware variant of UnpinChatMessage.
|
||||
// Since: Bot API 3.1
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#unpinchatmessage
|
||||
func (api *API) UnpinChatMessageWithContext(ctx context.Context, params UnpinChatMessage) (bool, error) {
|
||||
@@ -567,12 +635,14 @@ func (api *API) UnpinChatMessageWithContext(ctx context.Context, params UnpinCha
|
||||
}
|
||||
|
||||
// UnpinAllChatMessages holds parameters for the unpinAllChatMessages method.
|
||||
// Since: Bot API 5.0
|
||||
// See https://core.telegram.org/bots/api#unpinallchatmessages
|
||||
type UnpinAllChatMessages struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
}
|
||||
|
||||
// UnpinAllChatMessages unpins all pinned messages in a chat.
|
||||
// Since: Bot API 5.0
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#unpinallchatmessages
|
||||
func (api *API) UnpinAllChatMessages(params UnpinAllChatMessages) (bool, error) {
|
||||
@@ -581,6 +651,7 @@ func (api *API) UnpinAllChatMessages(params UnpinAllChatMessages) (bool, error)
|
||||
}
|
||||
|
||||
// UnpinAllChatMessagesWithContext is the context-aware variant of UnpinAllChatMessages.
|
||||
// Since: Bot API 5.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#unpinallchatmessages
|
||||
func (api *API) UnpinAllChatMessagesWithContext(ctx context.Context, params UnpinAllChatMessages) (bool, error) {
|
||||
@@ -589,55 +660,64 @@ func (api *API) UnpinAllChatMessagesWithContext(ctx context.Context, params Unpi
|
||||
}
|
||||
|
||||
// LeaveChat holds parameters for the leaveChat method.
|
||||
// Since: Bot API 2.1
|
||||
// See https://core.telegram.org/bots/api#leavechat
|
||||
type LeaveChat struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
}
|
||||
|
||||
// LeaveChat makes the bot leave a chat.
|
||||
// Since: Bot API 2.1
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#leavechat
|
||||
func (api *API) LeaveChat(params LeaveChat) (bool, error) {
|
||||
req := NewRequestWithChatID[bool]("leaveChat", params, params.ChatID) // fixed method name
|
||||
req := NewRequestWithChatID[bool]("leaveChat", params, params.ChatID)
|
||||
return req.Do(api)
|
||||
}
|
||||
|
||||
// LeaveChatWithContext is the context-aware variant of LeaveChat.
|
||||
// Since: Bot API 2.1
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#leavechat
|
||||
func (api *API) LeaveChatWithContext(ctx context.Context, params LeaveChat) (bool, error) {
|
||||
req := NewRequestWithChatID[bool]("leaveChat", params, params.ChatID) // fixed method name
|
||||
req := NewRequestWithChatID[bool]("leaveChat", params, params.ChatID)
|
||||
return req.DoWithContext(ctx, api)
|
||||
}
|
||||
|
||||
// GetChat holds parameters for the getChat method.
|
||||
// Since: Bot API 2.1
|
||||
// See https://core.telegram.org/bots/api#getchat
|
||||
type GetChat struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
}
|
||||
|
||||
// GetChat gets up‑to‑date information about a chat.
|
||||
// Since: Bot API 2.1
|
||||
// See https://core.telegram.org/bots/api#getchat
|
||||
func (api *API) GetChat(params GetChat) (ChatFullInfo, error) {
|
||||
req := NewRequestWithChatID[ChatFullInfo]("getChat", params, params.ChatID) // fixed method name
|
||||
req := NewRequestWithChatID[ChatFullInfo]("getChat", params, params.ChatID)
|
||||
return req.Do(api)
|
||||
}
|
||||
|
||||
// GetChatWithContext is the context-aware variant of GetChat.
|
||||
// Since: Bot API 2.1
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#getchat
|
||||
func (api *API) GetChatWithContext(ctx context.Context, params GetChat) (ChatFullInfo, error) {
|
||||
req := NewRequestWithChatID[ChatFullInfo]("getChat", params, params.ChatID) // fixed method name
|
||||
req := NewRequestWithChatID[ChatFullInfo]("getChat", params, params.ChatID)
|
||||
return req.DoWithContext(ctx, api)
|
||||
}
|
||||
|
||||
// GetChatAdministrators holds parameters for the getChatAdministrators method.
|
||||
// Since: Bot API 2.1
|
||||
// See https://core.telegram.org/bots/api#getchatadministrators
|
||||
type GetChatAdministrators struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
ChatID int64 `json:"chat_id"`
|
||||
ReturnBots bool `json:"return_bots,omitempty"` // Since: Bot API 10.0
|
||||
}
|
||||
|
||||
// GetChatAdministrators returns a list of administrators in a chat.
|
||||
// Since: Bot API 2.1
|
||||
// See https://core.telegram.org/bots/api#getchatadministrators
|
||||
func (api *API) GetChatAdministrators(params GetChatAdministrators) ([]ChatMember, error) {
|
||||
req := NewRequestWithChatID[[]ChatMember]("getChatAdministrators", params, params.ChatID)
|
||||
@@ -645,6 +725,7 @@ func (api *API) GetChatAdministrators(params GetChatAdministrators) ([]ChatMembe
|
||||
}
|
||||
|
||||
// GetChatAdministratorsWithContext is the context-aware variant of GetChatAdministrators.
|
||||
// Since: Bot API 2.1
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#getchatadministrators
|
||||
func (api *API) GetChatAdministratorsWithContext(ctx context.Context, params GetChatAdministrators) ([]ChatMember, error) {
|
||||
@@ -653,12 +734,14 @@ func (api *API) GetChatAdministratorsWithContext(ctx context.Context, params Get
|
||||
}
|
||||
|
||||
// GetChatMemberCount holds parameters for the getChatMemberCount method.
|
||||
// Since: Bot API 2.1
|
||||
// See https://core.telegram.org/bots/api#getchatmembercount
|
||||
type GetChatMemberCount struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
}
|
||||
|
||||
// GetChatMemberCount returns the number of members in a chat.
|
||||
// Since: Bot API 2.1
|
||||
// See https://core.telegram.org/bots/api#getchatmembercount
|
||||
func (api *API) GetChatMemberCount(params GetChatMemberCount) (int, error) {
|
||||
req := NewRequestWithChatID[int]("getChatMemberCount", params, params.ChatID)
|
||||
@@ -666,6 +749,7 @@ func (api *API) GetChatMemberCount(params GetChatMemberCount) (int, error) {
|
||||
}
|
||||
|
||||
// GetChatMemberCountWithContext is the context-aware variant of GetChatMemberCount.
|
||||
// Since: Bot API 2.1
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#getchatmembercount
|
||||
func (api *API) GetChatMemberCountWithContext(ctx context.Context, params GetChatMemberCount) (int, error) {
|
||||
@@ -674,6 +758,7 @@ func (api *API) GetChatMemberCountWithContext(ctx context.Context, params GetCha
|
||||
}
|
||||
|
||||
// GetChatMember holds parameters for the getChatMember method.
|
||||
// Since: Bot API 2.1
|
||||
// See https://core.telegram.org/bots/api#getchatmember
|
||||
type GetChatMember struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -681,6 +766,7 @@ type GetChatMember struct {
|
||||
}
|
||||
|
||||
// GetChatMember returns information about a member of a chat.
|
||||
// Since: Bot API 2.1
|
||||
// See https://core.telegram.org/bots/api#getchatmember
|
||||
func (api *API) GetChatMember(params GetChatMember) (ChatMember, error) {
|
||||
req := NewRequestWithChatID[ChatMember]("getChatMember", params, params.ChatID)
|
||||
@@ -688,6 +774,7 @@ func (api *API) GetChatMember(params GetChatMember) (ChatMember, error) {
|
||||
}
|
||||
|
||||
// GetChatMemberWithContext is the context-aware variant of GetChatMember.
|
||||
// Since: Bot API 2.1
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#getchatmember
|
||||
func (api *API) GetChatMemberWithContext(ctx context.Context, params GetChatMember) (ChatMember, error) {
|
||||
@@ -696,6 +783,7 @@ func (api *API) GetChatMemberWithContext(ctx context.Context, params GetChatMemb
|
||||
}
|
||||
|
||||
// SetChatStickerSet holds parameters for the setChatStickerSet method.
|
||||
// Since: Bot API 3.2
|
||||
// See https://core.telegram.org/bots/api#setchatstickerset
|
||||
type SetChatStickerSet struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -703,6 +791,7 @@ type SetChatStickerSet struct {
|
||||
}
|
||||
|
||||
// SetChatStickerSet associates a sticker set with a supergroup.
|
||||
// Since: Bot API 3.2
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#setchatstickerset
|
||||
func (api *API) SetChatStickerSet(params SetChatStickerSet) (bool, error) {
|
||||
@@ -711,6 +800,7 @@ func (api *API) SetChatStickerSet(params SetChatStickerSet) (bool, error) {
|
||||
}
|
||||
|
||||
// SetChatStickerSetWithContext is the context-aware variant of SetChatStickerSet.
|
||||
// Since: Bot API 3.2
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#setchatstickerset
|
||||
func (api *API) SetChatStickerSetWithContext(ctx context.Context, params SetChatStickerSet) (bool, error) {
|
||||
@@ -719,12 +809,14 @@ func (api *API) SetChatStickerSetWithContext(ctx context.Context, params SetChat
|
||||
}
|
||||
|
||||
// DeleteChatStickerSet holds parameters for the deleteChatStickerSet method.
|
||||
// Since: Bot API 3.2
|
||||
// See https://core.telegram.org/bots/api#deletechatstickerset
|
||||
type DeleteChatStickerSet struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
}
|
||||
|
||||
// DeleteChatStickerSet deletes a sticker set from a supergroup.
|
||||
// Since: Bot API 3.2
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#deletechatstickerset
|
||||
func (api *API) DeleteChatStickerSet(params DeleteChatStickerSet) (bool, error) {
|
||||
@@ -733,6 +825,7 @@ func (api *API) DeleteChatStickerSet(params DeleteChatStickerSet) (bool, error)
|
||||
}
|
||||
|
||||
// DeleteChatStickerSetWithContext is the context-aware variant of DeleteChatStickerSet.
|
||||
// Since: Bot API 3.2
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#deletechatstickerset
|
||||
func (api *API) DeleteChatStickerSetWithContext(ctx context.Context, params DeleteChatStickerSet) (bool, error) {
|
||||
@@ -741,6 +834,7 @@ func (api *API) DeleteChatStickerSetWithContext(ctx context.Context, params Dele
|
||||
}
|
||||
|
||||
// GetUserChatBoosts holds parameters for the getUserChatBoosts method.
|
||||
// Since: Bot API 7.0
|
||||
// See https://core.telegram.org/bots/api#getuserchatboosts
|
||||
type GetUserChatBoosts struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -748,6 +842,7 @@ type GetUserChatBoosts struct {
|
||||
}
|
||||
|
||||
// GetUserChatBoosts returns the list of boosts a user has given to a chat.
|
||||
// Since: Bot API 7.0
|
||||
// See https://core.telegram.org/bots/api#getuserchatboosts
|
||||
func (api *API) GetUserChatBoosts(params GetUserChatBoosts) (UserChatBoosts, error) {
|
||||
req := NewRequestWithChatID[UserChatBoosts]("getUserChatBoosts", params, params.ChatID)
|
||||
@@ -755,6 +850,7 @@ func (api *API) GetUserChatBoosts(params GetUserChatBoosts) (UserChatBoosts, err
|
||||
}
|
||||
|
||||
// GetUserChatBoostsWithContext is the context-aware variant of GetUserChatBoosts.
|
||||
// Since: Bot API 7.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#getuserchatboosts
|
||||
func (api *API) GetUserChatBoostsWithContext(ctx context.Context, params GetUserChatBoosts) (UserChatBoosts, error) {
|
||||
@@ -763,6 +859,7 @@ func (api *API) GetUserChatBoostsWithContext(ctx context.Context, params GetUser
|
||||
}
|
||||
|
||||
// GetChatGifts holds parameters for the getChatGifts method.
|
||||
// Since: Bot API 9.3
|
||||
// See https://core.telegram.org/bots/api#getchatgifts
|
||||
type GetChatGifts struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -779,6 +876,7 @@ type GetChatGifts struct {
|
||||
}
|
||||
|
||||
// GetChatGifts returns gifts owned by a chat.
|
||||
// Since: Bot API 9.3
|
||||
// See https://core.telegram.org/bots/api#getchatgifts
|
||||
func (api *API) GetChatGifts(params GetChatGifts) (OwnedGifts, error) {
|
||||
req := NewRequestWithChatID[OwnedGifts]("getChatGifts", params, params.ChatID)
|
||||
@@ -786,6 +884,7 @@ func (api *API) GetChatGifts(params GetChatGifts) (OwnedGifts, error) {
|
||||
}
|
||||
|
||||
// GetChatGiftsWithContext is the context-aware variant of GetChatGifts.
|
||||
// Since: Bot API 9.3
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#getchatgifts
|
||||
func (api *API) GetChatGiftsWithContext(ctx context.Context, params GetChatGifts) (OwnedGifts, error) {
|
||||
|
||||
+50
-28
@@ -1,6 +1,7 @@
|
||||
package tgapi
|
||||
|
||||
// Chat represents a chat (private, group, supergroup, channel).
|
||||
// Since: Bot API 1.0
|
||||
// See https://core.telegram.org/bots/api#chat
|
||||
type Chat struct {
|
||||
ID int64 `json:"id"`
|
||||
@@ -9,8 +10,8 @@ type Chat struct {
|
||||
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"`
|
||||
IsForum *bool `json:"is_forum,omitempty"` // Since: Bot API 6.3
|
||||
IsDirectMessages *bool `json:"is_direct_messages,omitempty"` // Since: Bot API 9.2
|
||||
}
|
||||
|
||||
// ChatType represents the type of a chat.
|
||||
@@ -28,6 +29,7 @@ const (
|
||||
)
|
||||
|
||||
// ChatFullInfo contains full information about a chat.
|
||||
// Since: Bot API 7.5
|
||||
// See https://core.telegram.org/bots/api#chatfullinfo
|
||||
type ChatFullInfo struct {
|
||||
ID int64 `json:"id"`
|
||||
@@ -49,7 +51,7 @@ type ChatFullInfo struct {
|
||||
BusinessOpeningHours *BusinessOpeningHours `json:"business_opening_hours,omitempty"`
|
||||
|
||||
PersonalChat *Chat `json:"personal_chat,omitempty"`
|
||||
ParentChat *Chat `json:"parent_chat,omitempty"`
|
||||
ParentChat *Chat `json:"parent_chat,omitempty"` // Since: Bot API 9.2
|
||||
|
||||
AvailableReaction []ReactionType `json:"available_reaction,omitempty"`
|
||||
|
||||
@@ -86,12 +88,13 @@ type ChatFullInfo struct {
|
||||
|
||||
Location *ChatLocation `json:"location,omitempty"`
|
||||
Rating *UserRating `json:"rating,omitempty"`
|
||||
FirstProfileAudio *Audio `json:"first_profile_audio,omitempty"`
|
||||
UniqueGiftColors *UniqueGiftColors `json:"unique_gift_colors,omitempty"`
|
||||
PaidMessageStarCount *int `json:"paid_message_star_count,omitempty"`
|
||||
FirstProfileAudio *Audio `json:"first_profile_audio,omitempty"` // Since: Bot API 9.4
|
||||
UniqueGiftColors *UniqueGiftColors `json:"unique_gift_colors,omitempty"` // Since: Bot API 9.3
|
||||
PaidMessageStarCount *int `json:"paid_message_star_count,omitempty"` // Since: Bot API 9.3
|
||||
}
|
||||
|
||||
// ChatPhoto represents a chat photo.
|
||||
// Since: Bot API 3.1
|
||||
// See https://core.telegram.org/bots/api#chatphoto
|
||||
type ChatPhoto struct {
|
||||
SmallFileID string `json:"small_file_id"`
|
||||
@@ -101,26 +104,29 @@ type ChatPhoto struct {
|
||||
}
|
||||
|
||||
// ChatPermissions describes actions that a non‑administrator user is allowed to take in a chat.
|
||||
// Since: Bot API 4.4
|
||||
// See https://core.telegram.org/bots/api#chatpermissions
|
||||
type ChatPermissions struct {
|
||||
CanSendMessages bool `json:"can_send_messages"`
|
||||
CanSendAudios bool `json:"can_send_audios"`
|
||||
CanSendDocuments bool `json:"can_send_documents"`
|
||||
CanSendPhotos bool `json:"can_send_photos"`
|
||||
CanSendVideos bool `json:"can_send_videos"`
|
||||
CanSendVideoNotes bool `json:"can_send_video_notes"`
|
||||
CanSendVoiceNotes bool `json:"can_send_voice_notes"`
|
||||
CanSendAudios bool `json:"can_send_audios"` // Since: Bot API 6.5
|
||||
CanSendDocuments bool `json:"can_send_documents"` // Since: Bot API 6.5
|
||||
CanSendPhotos bool `json:"can_send_photos"` // Since: Bot API 6.5
|
||||
CanSendVideos bool `json:"can_send_videos"` // Since: Bot API 6.5
|
||||
CanSendVideoNotes bool `json:"can_send_video_notes"` // Since: Bot API 6.5
|
||||
CanSendVoiceNotes bool `json:"can_send_voice_notes"` // Since: Bot API 6.5
|
||||
CanSendPolls bool `json:"can_send_polls"`
|
||||
CanSendOtherMessages bool `json:"can_send_other_messages"`
|
||||
CanAddWebPagePreview bool `json:"can_add_web_page_previews"`
|
||||
CanEditTag bool `json:"can_edit_tag"`
|
||||
CanReactToMessages bool `json:"can_react_to_messages"` // Since: Bot API 10.0
|
||||
CanEditTag bool `json:"can_edit_tag"` // Since: Bot API 9.5
|
||||
CanChangeInfo bool `json:"can_change_info"`
|
||||
CanInviteUsers bool `json:"can_invite_users"`
|
||||
CanPinMessages bool `json:"can_pin_messages"`
|
||||
CanManageTopics bool `json:"can_manage_topics"`
|
||||
CanManageTopics bool `json:"can_manage_topics"` // Since: Bot API 6.3
|
||||
}
|
||||
|
||||
// ChatLocation represents a location to which a chat is connected.
|
||||
// Since: Bot API 5.0
|
||||
// See https://core.telegram.org/bots/api#chatlocation
|
||||
type ChatLocation struct {
|
||||
Location Location `json:"location"`
|
||||
@@ -128,6 +134,7 @@ type ChatLocation struct {
|
||||
}
|
||||
|
||||
// ChatInviteLink represents an invite link for a chat.
|
||||
// Since: Bot API 5.1
|
||||
// See https://core.telegram.org/bots/api#chatinvitelink
|
||||
type ChatInviteLink struct {
|
||||
InviteLink string `json:"invite_link"`
|
||||
@@ -163,11 +170,12 @@ const (
|
||||
)
|
||||
|
||||
// ChatMember contains information about one member of a chat.
|
||||
// Since: Bot API 3.1
|
||||
// See https://core.telegram.org/bots/api#chatmember
|
||||
type ChatMember struct {
|
||||
Status ChatMemberStatusType `json:"status"`
|
||||
User User `json:"user"`
|
||||
Tag string `json:"tag,omitempty"`
|
||||
Tag string `json:"tag,omitempty"` // Since: Bot API 9.5
|
||||
|
||||
// Owner
|
||||
IsAnonymous *bool `json:"is_anonymous"`
|
||||
@@ -182,16 +190,16 @@ type ChatMember struct {
|
||||
CanPromoteMembers *bool `json:"can_promote_members,omitempty"`
|
||||
CanChangeInfo *bool `json:"can_change_info,omitempty"`
|
||||
CanInviteUsers *bool `json:"can_invite_users,omitempty"`
|
||||
CanPostStories *bool `json:"can_post_stories,omitempty"`
|
||||
CanEditStories *bool `json:"can_edit_stories,omitempty"`
|
||||
CanDeleteStories *bool `json:"can_delete_stories,omitempty"`
|
||||
CanPostStories *bool `json:"can_post_stories,omitempty"` // Since: Bot API 6.9
|
||||
CanEditStories *bool `json:"can_edit_stories,omitempty"` // Since: Bot API 6.9
|
||||
CanDeleteStories *bool `json:"can_delete_stories,omitempty"` // Since: Bot API 6.9
|
||||
|
||||
CanPostMessages *bool `json:"can_post_messages,omitempty"`
|
||||
CanEditMessages *bool `json:"can_edit_messages,omitempty"`
|
||||
CanPinMessages *bool `json:"can_pin_messages,omitempty"`
|
||||
CanManageTopics *bool `json:"can_manage_topics,omitempty"`
|
||||
CanManageDirectMessages *bool `json:"can_manage_direct_messages,omitempty"`
|
||||
CanManageTags *bool `json:"can_manage_tags,omitempty"`
|
||||
CanManageTopics *bool `json:"can_manage_topics,omitempty"` // Since: Bot API 6.3
|
||||
CanManageDirectMessages *bool `json:"can_manage_direct_messages,omitempty"` // Since: Bot API 9.1
|
||||
CanManageTags *bool `json:"can_manage_tags,omitempty"` // Since: Bot API 9.5
|
||||
|
||||
// Member
|
||||
UntilDate *int `json:"until_date,omitempty"`
|
||||
@@ -199,19 +207,21 @@ type ChatMember struct {
|
||||
// Restricted
|
||||
IsMember *bool `json:"is_member,omitempty"`
|
||||
CanSendMessages *bool `json:"can_send_messages,omitempty"`
|
||||
CanSendAudios *bool `json:"can_send_audios,omitempty"`
|
||||
CanSendDocuments *bool `json:"can_send_documents,omitempty"`
|
||||
CanSendPhotos *bool `json:"can_send_photos,omitempty"`
|
||||
CanSendVideos *bool `json:"can_send_videos,omitempty"`
|
||||
CanSendVideoNotes *bool `json:"can_send_video_notes,omitempty"`
|
||||
CanSendVoiceNotes *bool `json:"can_send_voice_notes,omitempty"`
|
||||
CanSendAudios *bool `json:"can_send_audios,omitempty"` // Since: Bot API 6.5
|
||||
CanSendDocuments *bool `json:"can_send_documents,omitempty"` // Since: Bot API 6.5
|
||||
CanSendPhotos *bool `json:"can_send_photos,omitempty"` // Since: Bot API 6.5
|
||||
CanSendVideos *bool `json:"can_send_videos,omitempty"` // Since: Bot API 6.5
|
||||
CanSendVideoNotes *bool `json:"can_send_video_notes,omitempty"` // Since: Bot API 6.5
|
||||
CanSendVoiceNotes *bool `json:"can_send_voice_notes,omitempty"` // Since: Bot API 6.5
|
||||
CanSendPolls *bool `json:"can_send_polls,omitempty"`
|
||||
CanSendOtherMessages *bool `json:"can_send_other_messages,omitempty"`
|
||||
CanAddWebPagePreview *bool `json:"can_add_web_page_previews,omitempty"`
|
||||
CanEditTag *bool `json:"can_edit_tag,omitempty"`
|
||||
CanReactToMessages *bool `json:"can_react_to_messages,omitempty"` // Since: Bot API 10.0
|
||||
CanEditTag *bool `json:"can_edit_tag,omitempty"` // Since: Bot API 9.5
|
||||
}
|
||||
|
||||
// ChatBoostSource describes the source of a chat boost.
|
||||
// Since: Bot API 7.0
|
||||
// See https://core.telegram.org/bots/api#chatboostsource
|
||||
type ChatBoostSource struct {
|
||||
Source string `json:"source"`
|
||||
@@ -224,6 +234,7 @@ type ChatBoostSource struct {
|
||||
}
|
||||
|
||||
// ChatBoost represents a boost added to a chat.
|
||||
// Since: Bot API 7.0
|
||||
// See https://core.telegram.org/bots/api#chatboost
|
||||
type ChatBoost struct {
|
||||
BoostID string `json:"boost_id"`
|
||||
@@ -233,31 +244,40 @@ type ChatBoost struct {
|
||||
}
|
||||
|
||||
// UserChatBoosts represents a list of boosts a user has given to a chat.
|
||||
// Since: Bot API 7.0
|
||||
// See https://core.telegram.org/bots/api#userchatboosts
|
||||
type UserChatBoosts struct {
|
||||
Boosts []ChatBoost `json:"boosts"`
|
||||
}
|
||||
|
||||
// ChatBoostAdded describes a service message about a user boosting a chat.
|
||||
// Since: Bot API 7.1
|
||||
type ChatBoostAdded struct {
|
||||
BoostCount int `json:"boost_count"`
|
||||
}
|
||||
|
||||
// ChatBackground represents a chat background.
|
||||
// Since: Bot API 7.5
|
||||
type ChatBackground struct {
|
||||
Type BackgroundType `json:"type"`
|
||||
}
|
||||
|
||||
// ChatOwnerLeft describes a service message about a chat owner leaving.
|
||||
// Since: Bot API 9.4
|
||||
// See https://core.telegram.org/bots/api#chatownerleft
|
||||
type ChatOwnerLeft struct {
|
||||
NewOwner *User `json:"new_owner,omitempty"`
|
||||
}
|
||||
|
||||
// ChatOwnerChanged describes a service message about a chat owner change.
|
||||
// Since: Bot API 9.4
|
||||
// See https://core.telegram.org/bots/api#chatownerchanged
|
||||
type ChatOwnerChanged struct {
|
||||
NewOwner User `json:"new_owner"`
|
||||
}
|
||||
|
||||
// ChatAdministratorRights represents the rights of an administrator in a chat.
|
||||
// Since: Bot API 6.0
|
||||
// See https://core.telegram.org/bots/api#chatadministratorrights
|
||||
type ChatAdministratorRights struct {
|
||||
IsAnonymous bool `json:"is_anonymous"`
|
||||
@@ -281,6 +301,7 @@ type ChatAdministratorRights struct {
|
||||
}
|
||||
|
||||
// ChatBoostUpdated represents a boost added to a chat or changed.
|
||||
// Since: Bot API 7.0
|
||||
// See https://core.telegram.org/bots/api#chatboostupdated
|
||||
type ChatBoostUpdated struct {
|
||||
Chat Chat `json:"chat"`
|
||||
@@ -288,6 +309,7 @@ type ChatBoostUpdated struct {
|
||||
}
|
||||
|
||||
// ChatBoostRemoved represents a boost removed from a chat.
|
||||
// Since: Bot API 7.0
|
||||
// See https://core.telegram.org/bots/api#chatboostremoved
|
||||
type ChatBoostRemoved struct {
|
||||
Chat Chat `json:"chat"`
|
||||
|
||||
@@ -3,12 +3,14 @@ package tgapi
|
||||
import "context"
|
||||
|
||||
// BaseForumTopic contains common fields for forum topic operations that require a chat ID and a message thread ID.
|
||||
// Since: Bot API 6.3
|
||||
type BaseForumTopic struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
MessageThreadID int `json:"message_thread_id"`
|
||||
}
|
||||
|
||||
// GetForumTopicIconStickers returns the list of custom emoji that can be used as a forum topic icon.
|
||||
// Since: Bot API 6.3
|
||||
// See https://core.telegram.org/bots/api#getforumtopiciconstickers
|
||||
func (api *API) GetForumTopicIconStickers() ([]Sticker, error) {
|
||||
req := NewRequest[[]Sticker]("getForumTopicIconStickers", NoParams)
|
||||
@@ -16,6 +18,7 @@ func (api *API) GetForumTopicIconStickers() ([]Sticker, error) {
|
||||
}
|
||||
|
||||
// GetForumTopicIconStickersWithContext is the context-aware variant of GetForumTopicIconStickers.
|
||||
// Since: Bot API 6.3
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#getforumtopiciconstickers
|
||||
func (api *API) GetForumTopicIconStickersWithContext(ctx context.Context) ([]Sticker, error) {
|
||||
@@ -24,6 +27,7 @@ func (api *API) GetForumTopicIconStickersWithContext(ctx context.Context) ([]Sti
|
||||
}
|
||||
|
||||
// CreateForumTopic holds parameters for the createForumTopic method.
|
||||
// Since: Bot API 6.3
|
||||
// See https://core.telegram.org/bots/api#createforumtopic
|
||||
type CreateForumTopic struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -33,6 +37,7 @@ type CreateForumTopic struct {
|
||||
}
|
||||
|
||||
// CreateForumTopic creates a topic in a forum supergroup.
|
||||
// Since: Bot API 6.3
|
||||
// Returns the created ForumTopic on success.
|
||||
// See https://core.telegram.org/bots/api#createforumtopic
|
||||
func (api *API) CreateForumTopic(params CreateForumTopic) (ForumTopic, error) {
|
||||
@@ -41,6 +46,7 @@ func (api *API) CreateForumTopic(params CreateForumTopic) (ForumTopic, error) {
|
||||
}
|
||||
|
||||
// CreateForumTopicWithContext is the context-aware variant of CreateForumTopic.
|
||||
// Since: Bot API 6.3
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#createforumtopic
|
||||
func (api *API) CreateForumTopicWithContext(ctx context.Context, params CreateForumTopic) (ForumTopic, error) {
|
||||
@@ -49,6 +55,7 @@ func (api *API) CreateForumTopicWithContext(ctx context.Context, params CreateFo
|
||||
}
|
||||
|
||||
// EditForumTopic holds parameters for the editForumTopic method.
|
||||
// Since: Bot API 6.3
|
||||
// See https://core.telegram.org/bots/api#editforumtopic
|
||||
type EditForumTopic struct {
|
||||
BaseForumTopic
|
||||
@@ -57,6 +64,7 @@ type EditForumTopic struct {
|
||||
}
|
||||
|
||||
// EditForumTopic edits name and icon of a forum topic.
|
||||
// Since: Bot API 6.3
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#editforumtopic
|
||||
func (api *API) EditForumTopic(params EditForumTopic) (bool, error) {
|
||||
@@ -65,6 +73,7 @@ func (api *API) EditForumTopic(params EditForumTopic) (bool, error) {
|
||||
}
|
||||
|
||||
// EditForumTopicWithContext is the context-aware variant of EditForumTopic.
|
||||
// Since: Bot API 6.3
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#editforumtopic
|
||||
func (api *API) EditForumTopicWithContext(ctx context.Context, params EditForumTopic) (bool, error) {
|
||||
@@ -73,6 +82,7 @@ func (api *API) EditForumTopicWithContext(ctx context.Context, params EditForumT
|
||||
}
|
||||
|
||||
// CloseForumTopic closes an open forum topic.
|
||||
// Since: Bot API 6.3
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#closeforumtopic
|
||||
func (api *API) CloseForumTopic(params BaseForumTopic) (bool, error) {
|
||||
@@ -81,6 +91,7 @@ func (api *API) CloseForumTopic(params BaseForumTopic) (bool, error) {
|
||||
}
|
||||
|
||||
// CloseForumTopicWithContext is the context-aware variant of CloseForumTopic.
|
||||
// Since: Bot API 6.3
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#closeforumtopic
|
||||
func (api *API) CloseForumTopicWithContext(ctx context.Context, params BaseForumTopic) (bool, error) {
|
||||
@@ -89,6 +100,7 @@ func (api *API) CloseForumTopicWithContext(ctx context.Context, params BaseForum
|
||||
}
|
||||
|
||||
// ReopenForumTopic reopens a closed forum topic.
|
||||
// Since: Bot API 6.3
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#reopenforumtopic
|
||||
func (api *API) ReopenForumTopic(params BaseForumTopic) (bool, error) {
|
||||
@@ -97,6 +109,7 @@ func (api *API) ReopenForumTopic(params BaseForumTopic) (bool, error) {
|
||||
}
|
||||
|
||||
// ReopenForumTopicWithContext is the context-aware variant of ReopenForumTopic.
|
||||
// Since: Bot API 6.3
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#reopenforumtopic
|
||||
func (api *API) ReopenForumTopicWithContext(ctx context.Context, params BaseForumTopic) (bool, error) {
|
||||
@@ -105,6 +118,7 @@ func (api *API) ReopenForumTopicWithContext(ctx context.Context, params BaseForu
|
||||
}
|
||||
|
||||
// DeleteForumTopic deletes a forum topic.
|
||||
// Since: Bot API 6.3
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#deleteforumtopic
|
||||
func (api *API) DeleteForumTopic(params BaseForumTopic) (bool, error) {
|
||||
@@ -113,6 +127,7 @@ func (api *API) DeleteForumTopic(params BaseForumTopic) (bool, error) {
|
||||
}
|
||||
|
||||
// DeleteForumTopicWithContext is the context-aware variant of DeleteForumTopic.
|
||||
// Since: Bot API 6.3
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#deleteforumtopic
|
||||
func (api *API) DeleteForumTopicWithContext(ctx context.Context, params BaseForumTopic) (bool, error) {
|
||||
@@ -121,6 +136,7 @@ func (api *API) DeleteForumTopicWithContext(ctx context.Context, params BaseForu
|
||||
}
|
||||
|
||||
// UnpinAllForumTopicMessages clears the list of pinned messages in a forum topic.
|
||||
// Since: Bot API 6.3
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#unpinallforumtopicmessages
|
||||
func (api *API) UnpinAllForumTopicMessages(params BaseForumTopic) (bool, error) {
|
||||
@@ -129,6 +145,7 @@ func (api *API) UnpinAllForumTopicMessages(params BaseForumTopic) (bool, error)
|
||||
}
|
||||
|
||||
// UnpinAllForumTopicMessagesWithContext is the context-aware variant of UnpinAllForumTopicMessages.
|
||||
// Since: Bot API 6.3
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#unpinallforumtopicmessages
|
||||
func (api *API) UnpinAllForumTopicMessagesWithContext(ctx context.Context, params BaseForumTopic) (bool, error) {
|
||||
@@ -137,11 +154,13 @@ func (api *API) UnpinAllForumTopicMessagesWithContext(ctx context.Context, param
|
||||
}
|
||||
|
||||
// BaseGeneralForumTopic contains common fields for general forum topic operations that require a chat ID.
|
||||
// Since: Bot API 6.4
|
||||
type BaseGeneralForumTopic struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
}
|
||||
|
||||
// EditGeneralForumTopic holds parameters for the editGeneralForumTopic method.
|
||||
// Since: Bot API 6.4
|
||||
// See https://core.telegram.org/bots/api#editgeneralforumtopic
|
||||
type EditGeneralForumTopic struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -149,6 +168,7 @@ type EditGeneralForumTopic struct {
|
||||
}
|
||||
|
||||
// EditGeneralForumTopic edits the name of the 'General' topic in a forum supergroup.
|
||||
// Since: Bot API 6.4
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#editgeneralforumtopic
|
||||
func (api *API) EditGeneralForumTopic(params EditGeneralForumTopic) (bool, error) {
|
||||
@@ -157,6 +177,7 @@ func (api *API) EditGeneralForumTopic(params EditGeneralForumTopic) (bool, error
|
||||
}
|
||||
|
||||
// EditGeneralForumTopicWithContext is the context-aware variant of EditGeneralForumTopic.
|
||||
// Since: Bot API 6.4
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#editgeneralforumtopic
|
||||
func (api *API) EditGeneralForumTopicWithContext(ctx context.Context, params EditGeneralForumTopic) (bool, error) {
|
||||
@@ -165,6 +186,7 @@ func (api *API) EditGeneralForumTopicWithContext(ctx context.Context, params Edi
|
||||
}
|
||||
|
||||
// CloseGeneralForumTopic closes the 'General' topic in a forum supergroup.
|
||||
// Since: Bot API 6.4
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#closegeneralforumtopic
|
||||
func (api *API) CloseGeneralForumTopic(params BaseGeneralForumTopic) (bool, error) {
|
||||
@@ -173,6 +195,7 @@ func (api *API) CloseGeneralForumTopic(params BaseGeneralForumTopic) (bool, erro
|
||||
}
|
||||
|
||||
// CloseGeneralForumTopicWithContext is the context-aware variant of CloseGeneralForumTopic.
|
||||
// Since: Bot API 6.4
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#closegeneralforumtopic
|
||||
func (api *API) CloseGeneralForumTopicWithContext(ctx context.Context, params BaseGeneralForumTopic) (bool, error) {
|
||||
@@ -181,6 +204,7 @@ func (api *API) CloseGeneralForumTopicWithContext(ctx context.Context, params Ba
|
||||
}
|
||||
|
||||
// ReopenGeneralForumTopic reopens the 'General' topic in a forum supergroup.
|
||||
// Since: Bot API 6.4
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#reopengeneralforumtopic
|
||||
func (api *API) ReopenGeneralForumTopic(params BaseGeneralForumTopic) (bool, error) {
|
||||
@@ -189,6 +213,7 @@ func (api *API) ReopenGeneralForumTopic(params BaseGeneralForumTopic) (bool, err
|
||||
}
|
||||
|
||||
// ReopenGeneralForumTopicWithContext is the context-aware variant of ReopenGeneralForumTopic.
|
||||
// Since: Bot API 6.4
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#reopengeneralforumtopic
|
||||
func (api *API) ReopenGeneralForumTopicWithContext(ctx context.Context, params BaseGeneralForumTopic) (bool, error) {
|
||||
@@ -197,6 +222,7 @@ func (api *API) ReopenGeneralForumTopicWithContext(ctx context.Context, params B
|
||||
}
|
||||
|
||||
// HideGeneralForumTopic hides the 'General' topic in a forum supergroup.
|
||||
// Since: Bot API 6.4
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#hidegeneralforumtopic
|
||||
func (api *API) HideGeneralForumTopic(params BaseGeneralForumTopic) (bool, error) {
|
||||
@@ -205,6 +231,7 @@ func (api *API) HideGeneralForumTopic(params BaseGeneralForumTopic) (bool, error
|
||||
}
|
||||
|
||||
// HideGeneralForumTopicWithContext is the context-aware variant of HideGeneralForumTopic.
|
||||
// Since: Bot API 6.4
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#hidegeneralforumtopic
|
||||
func (api *API) HideGeneralForumTopicWithContext(ctx context.Context, params BaseGeneralForumTopic) (bool, error) {
|
||||
@@ -213,6 +240,7 @@ func (api *API) HideGeneralForumTopicWithContext(ctx context.Context, params Bas
|
||||
}
|
||||
|
||||
// UnhideGeneralForumTopic unhides the 'General' topic in a forum supergroup.
|
||||
// Since: Bot API 6.4
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#unhidegeneralforumtopic
|
||||
func (api *API) UnhideGeneralForumTopic(params BaseGeneralForumTopic) (bool, error) {
|
||||
@@ -221,6 +249,7 @@ func (api *API) UnhideGeneralForumTopic(params BaseGeneralForumTopic) (bool, err
|
||||
}
|
||||
|
||||
// UnhideGeneralForumTopicWithContext is the context-aware variant of UnhideGeneralForumTopic.
|
||||
// Since: Bot API 6.4
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#unhidegeneralforumtopic
|
||||
func (api *API) UnhideGeneralForumTopicWithContext(ctx context.Context, params BaseGeneralForumTopic) (bool, error) {
|
||||
@@ -229,6 +258,7 @@ func (api *API) UnhideGeneralForumTopicWithContext(ctx context.Context, params B
|
||||
}
|
||||
|
||||
// UnpinAllGeneralForumTopicMessages clears the list of pinned messages in the 'General' topic.
|
||||
// Since: Bot API 6.4
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#unpinallgeneralforumtopicmessages
|
||||
func (api *API) UnpinAllGeneralForumTopicMessages(params BaseGeneralForumTopic) (bool, error) {
|
||||
@@ -237,6 +267,7 @@ func (api *API) UnpinAllGeneralForumTopicMessages(params BaseGeneralForumTopic)
|
||||
}
|
||||
|
||||
// UnpinAllGeneralForumTopicMessagesWithContext is the context-aware variant of UnpinAllGeneralForumTopicMessages.
|
||||
// Since: Bot API 6.4
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#unpinallgeneralforumtopicmessages
|
||||
func (api *API) UnpinAllGeneralForumTopicMessagesWithContext(ctx context.Context, params BaseGeneralForumTopic) (bool, error) {
|
||||
|
||||
+20
-2
@@ -1,6 +1,7 @@
|
||||
package tgapi
|
||||
|
||||
// ForumTopic represents a forum topic.
|
||||
// Since: Bot API 6.3
|
||||
// See https://core.telegram.org/bots/api#forumtopic
|
||||
type ForumTopic struct {
|
||||
MessageThreadID int `json:"message_thread_id"`
|
||||
@@ -12,6 +13,7 @@ type ForumTopic struct {
|
||||
|
||||
// ForumTopicIconColor represents the color of a forum topic icon.
|
||||
// The value is an integer representing the color in RGB format.
|
||||
// Since: Bot API 6.3
|
||||
// See https://core.telegram.org/bots/api#forumtopiciconcolor
|
||||
type ForumTopicIconColor int
|
||||
|
||||
@@ -20,18 +22,34 @@ const (
|
||||
ForumTopicIconColorBlue ForumTopicIconColor = 7322096
|
||||
)
|
||||
|
||||
// ForumTopicCreated represents a service message about a new forum topic created.
|
||||
// Since: Bot API 6.3
|
||||
type ForumTopicCreated struct {
|
||||
Name string `json:"name"`
|
||||
IconColor int `json:"icon_color"`
|
||||
IconCustomEmojiID string `json:"icon_custom_emoji_id,omitempty"`
|
||||
IsNameImplicit bool `json:"is_name_implicit,omitempty"`
|
||||
}
|
||||
|
||||
// ForumTopicEdited represents a service message about an edited forum topic.
|
||||
// Since: Bot API 6.4
|
||||
type ForumTopicEdited struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
IconCustomEmojiID string `json:"icon_custom_emoji_id,omitempty"`
|
||||
}
|
||||
|
||||
// ForumTopicClosed represents a service message about a forum topic closed.
|
||||
// Since: Bot API 6.3
|
||||
type ForumTopicClosed struct{}
|
||||
|
||||
// ForumTopicReopened represents a service message about a forum topic reopened.
|
||||
// Since: Bot API 6.3
|
||||
type ForumTopicReopened struct{}
|
||||
|
||||
// GeneralForumTopicHidden represents a service message about the General forum topic hidden.
|
||||
// Since: Bot API 6.4
|
||||
type GeneralForumTopicHidden struct{}
|
||||
type GeneralForumTopicUnhidden struct {
|
||||
}
|
||||
|
||||
// GeneralForumTopicUnhidden represents a service message about the General forum topic unhidden.
|
||||
// Since: Bot API 6.4
|
||||
type GeneralForumTopicUnhidden struct{}
|
||||
|
||||
@@ -3,6 +3,7 @@ package tgapi
|
||||
import "context"
|
||||
|
||||
// SendGame holds parameters for the sendGame method.
|
||||
// Since: Bot API 2.2
|
||||
// See https://core.telegram.org/bots/api#sendgame
|
||||
type SendGame struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -20,6 +21,7 @@ type SendGame struct {
|
||||
}
|
||||
|
||||
// SendGame sends a game message.
|
||||
// Since: Bot API 2.2
|
||||
// See https://core.telegram.org/bots/api#sendgame
|
||||
func (api *API) SendGame(params SendGame) (Message, error) {
|
||||
req := NewRequestWithChatID[Message]("sendGame", params, params.ChatID)
|
||||
@@ -27,6 +29,7 @@ func (api *API) SendGame(params SendGame) (Message, error) {
|
||||
}
|
||||
|
||||
// SendGameWithContext is the context-aware variant of SendGame.
|
||||
// Since: Bot API 2.2
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#sendgame
|
||||
func (api *API) SendGameWithContext(ctx context.Context, params SendGame) (Message, error) {
|
||||
@@ -35,6 +38,7 @@ func (api *API) SendGameWithContext(ctx context.Context, params SendGame) (Messa
|
||||
}
|
||||
|
||||
// SetGameScore holds parameters for the setGameScore method.
|
||||
// Since: Bot API 2.2
|
||||
// See https://core.telegram.org/bots/api#setgamescore
|
||||
type SetGameScore struct {
|
||||
UserID int64 `json:"user_id"`
|
||||
@@ -47,6 +51,7 @@ type SetGameScore struct {
|
||||
}
|
||||
|
||||
// SetGameScore sets a user's score in a game message.
|
||||
// Since: Bot API 2.2
|
||||
// If inline_message_id is provided, returns a boolean success flag.
|
||||
// Otherwise returns the edited Message.
|
||||
// See https://core.telegram.org/bots/api#setgamescore
|
||||
@@ -63,6 +68,7 @@ func (api *API) SetGameScore(params SetGameScore) (Message, bool, error) {
|
||||
}
|
||||
|
||||
// SetGameScoreWithContext is the context-aware variant of SetGameScore.
|
||||
// Since: Bot API 2.2
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#setgamescore
|
||||
func (api *API) SetGameScoreWithContext(ctx context.Context, params SetGameScore) (Message, bool, error) {
|
||||
@@ -78,6 +84,7 @@ func (api *API) SetGameScoreWithContext(ctx context.Context, params SetGameScore
|
||||
}
|
||||
|
||||
// GetGameHighScores holds parameters for the getGameHighScores method.
|
||||
// Since: Bot API 2.2
|
||||
// See https://core.telegram.org/bots/api#getgamehighscores
|
||||
type GetGameHighScores struct {
|
||||
UserID int64 `json:"user_id"`
|
||||
@@ -87,6 +94,7 @@ type GetGameHighScores struct {
|
||||
}
|
||||
|
||||
// GetGameHighScores returns game high score data for a user.
|
||||
// Since: Bot API 2.2
|
||||
// See https://core.telegram.org/bots/api#getgamehighscores
|
||||
func (api *API) GetGameHighScores(params GetGameHighScores) ([]GameHighScore, error) {
|
||||
req := NewRequestWithChatID[[]GameHighScore]("getGameHighScores", params, params.ChatID)
|
||||
@@ -94,6 +102,7 @@ func (api *API) GetGameHighScores(params GetGameHighScores) ([]GameHighScore, er
|
||||
}
|
||||
|
||||
// GetGameHighScoresWithContext is the context-aware variant of GetGameHighScores.
|
||||
// Since: Bot API 2.2
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#getgamehighscores
|
||||
func (api *API) GetGameHighScoresWithContext(ctx context.Context, params GetGameHighScores) ([]GameHighScore, error) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package tgapi
|
||||
|
||||
// Game represents a game.
|
||||
// Since: Bot API 2.2
|
||||
type Game struct {
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
@@ -8,9 +10,13 @@ type Game struct {
|
||||
TextEntities []MessageEntity `json:"text_entities,omitempty"`
|
||||
Animation *Animation `json:"animation,omitempty"`
|
||||
}
|
||||
|
||||
// CallbackGame is a placeholder for the future use of callback games.
|
||||
// Since: Bot API 2.2
|
||||
type CallbackGame struct{}
|
||||
|
||||
// GameHighScore represents one row in a game high score table.
|
||||
// Since: Bot API 2.2
|
||||
// See https://core.telegram.org/bots/api#gamehighscore
|
||||
type GameHighScore struct {
|
||||
Position int `json:"position"`
|
||||
|
||||
@@ -3,6 +3,7 @@ package tgapi
|
||||
import "context"
|
||||
|
||||
// AnswerInlineQuery holds parameters for the answerInlineQuery method.
|
||||
// Since: Bot API 1.7
|
||||
// See https://core.telegram.org/bots/api#answerinlinequery
|
||||
type AnswerInlineQuery struct {
|
||||
InlineQueryID string `json:"inline_query_id"`
|
||||
@@ -14,6 +15,7 @@ type AnswerInlineQuery struct {
|
||||
}
|
||||
|
||||
// AnswerInlineQuery sends answers to an inline query.
|
||||
// Since: Bot API 1.7
|
||||
// Returns true on success.
|
||||
// See https://core.telegram.org/bots/api#answerinlinequery
|
||||
func (api *API) AnswerInlineQuery(params AnswerInlineQuery) (bool, error) {
|
||||
@@ -22,6 +24,7 @@ func (api *API) AnswerInlineQuery(params AnswerInlineQuery) (bool, error) {
|
||||
}
|
||||
|
||||
// AnswerInlineQueryWithContext is the context-aware variant of AnswerInlineQuery.
|
||||
// Since: Bot API 1.7
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#answerinlinequery
|
||||
func (api *API) AnswerInlineQueryWithContext(ctx context.Context, params AnswerInlineQuery) (bool, error) {
|
||||
@@ -30,6 +33,7 @@ func (api *API) AnswerInlineQueryWithContext(ctx context.Context, params AnswerI
|
||||
}
|
||||
|
||||
// AnswerWebAppQuery holds parameters for the answerWebAppQuery method.
|
||||
// Since: Bot API 8.0
|
||||
// See https://core.telegram.org/bots/api#answerwebappquery
|
||||
type AnswerWebAppQuery struct {
|
||||
WebAppQueryID string `json:"web_app_query_id"`
|
||||
@@ -37,6 +41,7 @@ type AnswerWebAppQuery struct {
|
||||
}
|
||||
|
||||
// AnswerWebAppQuery sets the result of a Web App interaction.
|
||||
// Since: Bot API 8.0
|
||||
// See https://core.telegram.org/bots/api#answerwebappquery
|
||||
func (api *API) AnswerWebAppQuery(params AnswerWebAppQuery) (SentWebAppMessage, error) {
|
||||
req := NewRequest[SentWebAppMessage]("answerWebAppQuery", params)
|
||||
@@ -44,6 +49,7 @@ func (api *API) AnswerWebAppQuery(params AnswerWebAppQuery) (SentWebAppMessage,
|
||||
}
|
||||
|
||||
// AnswerWebAppQueryWithContext is the context-aware variant of AnswerWebAppQuery.
|
||||
// Since: Bot API 8.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#answerwebappquery
|
||||
func (api *API) AnswerWebAppQueryWithContext(ctx context.Context, params AnswerWebAppQuery) (SentWebAppMessage, error) {
|
||||
@@ -52,6 +58,7 @@ func (api *API) AnswerWebAppQueryWithContext(ctx context.Context, params AnswerW
|
||||
}
|
||||
|
||||
// SavePreparedInlineMessage holds parameters for the savePreparedInlineMessage method.
|
||||
// Since: Bot API 8.0
|
||||
// See https://core.telegram.org/bots/api#savepreparedinlinemessage
|
||||
type SavePreparedInlineMessage struct {
|
||||
UserID int64 `json:"user_id"`
|
||||
@@ -63,6 +70,7 @@ type SavePreparedInlineMessage struct {
|
||||
}
|
||||
|
||||
// SavePreparedInlineMessage stores a prepared message for Mini App users.
|
||||
// Since: Bot API 8.0
|
||||
// See https://core.telegram.org/bots/api#savepreparedinlinemessage
|
||||
func (api *API) SavePreparedInlineMessage(params SavePreparedInlineMessage) (PreparedInlineMessage, error) {
|
||||
req := NewRequest[PreparedInlineMessage]("savePreparedInlineMessage", params)
|
||||
@@ -70,6 +78,7 @@ func (api *API) SavePreparedInlineMessage(params SavePreparedInlineMessage) (Pre
|
||||
}
|
||||
|
||||
// SavePreparedInlineMessageWithContext is the context-aware variant of SavePreparedInlineMessage.
|
||||
// Since: Bot API 8.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#savepreparedinlinemessage
|
||||
func (api *API) SavePreparedInlineMessageWithContext(ctx context.Context, params SavePreparedInlineMessage) (PreparedInlineMessage, error) {
|
||||
@@ -78,6 +87,7 @@ func (api *API) SavePreparedInlineMessageWithContext(ctx context.Context, params
|
||||
}
|
||||
|
||||
// SavePreparedKeyboardButton holds parameters for the savePreparedKeyboardButton method.
|
||||
// Since: Bot API 8.0
|
||||
// See https://core.telegram.org/bots/api#savepreparedkeyboardbutton
|
||||
type SavePreparedKeyboardButton struct {
|
||||
UserID int64 `json:"user_id"`
|
||||
@@ -85,6 +95,7 @@ type SavePreparedKeyboardButton struct {
|
||||
}
|
||||
|
||||
// SavePreparedKeyboardButton stores a prepared keyboard button for Mini App users.
|
||||
// Since: Bot API 8.0
|
||||
// See https://core.telegram.org/bots/api#savepreparedkeyboardbutton
|
||||
func (api *API) SavePreparedKeyboardButton(params SavePreparedKeyboardButton) (PreparedKeyboardButton, error) {
|
||||
req := NewRequest[PreparedKeyboardButton]("savePreparedKeyboardButton", params)
|
||||
@@ -92,6 +103,7 @@ func (api *API) SavePreparedKeyboardButton(params SavePreparedKeyboardButton) (P
|
||||
}
|
||||
|
||||
// SavePreparedKeyboardButtonWithContext is the context-aware variant of SavePreparedKeyboardButton.
|
||||
// Since: Bot API 8.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#savepreparedkeyboardbutton
|
||||
func (api *API) SavePreparedKeyboardButtonWithContext(ctx context.Context, params SavePreparedKeyboardButton) (PreparedKeyboardButton, error) {
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package tgapi
|
||||
|
||||
// InlineQueryResult is a JSON-serializable inline query result object.
|
||||
// Since: Bot API 1.7
|
||||
// See https://core.telegram.org/bots/api#inlinequeryresult
|
||||
type InlineQueryResult map[string]any
|
||||
|
||||
// InlineQueryResultsButton represents a button shown above inline query results.
|
||||
// Since: Bot API 6.3
|
||||
// See https://core.telegram.org/bots/api#inlinequeryresultsbutton
|
||||
type InlineQueryResultsButton struct {
|
||||
Text string `json:"text"`
|
||||
@@ -13,12 +15,14 @@ type InlineQueryResultsButton struct {
|
||||
}
|
||||
|
||||
// SentWebAppMessage describes an inline message sent by a Web App on behalf of a user.
|
||||
// Since: Bot API 8.0
|
||||
// See https://core.telegram.org/bots/api#sentwebappmessage
|
||||
type SentWebAppMessage struct {
|
||||
InlineMessageID string `json:"inline_message_id,omitempty"`
|
||||
}
|
||||
|
||||
// PreparedInlineMessage describes a prepared inline message.
|
||||
// Since: Bot API 8.0
|
||||
// See https://core.telegram.org/bots/api#preparedinlinemessage
|
||||
type PreparedInlineMessage struct {
|
||||
ID string `json:"id"`
|
||||
@@ -26,6 +30,7 @@ type PreparedInlineMessage struct {
|
||||
}
|
||||
|
||||
// PreparedKeyboardButton describes a prepared keyboard button.
|
||||
// Since: Bot API 8.0
|
||||
// See https://core.telegram.org/bots/api#preparedkeyboardbutton
|
||||
type PreparedKeyboardButton struct {
|
||||
ID string `json:"id"`
|
||||
|
||||
@@ -3,6 +3,7 @@ package tgapi
|
||||
import "context"
|
||||
|
||||
// SendMessage holds parameters for the sendMessage method.
|
||||
// Since: Bot API 1.0
|
||||
// See https://core.telegram.org/bots/api#sendmessage
|
||||
type SendMessage struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -25,6 +26,7 @@ type SendMessage struct {
|
||||
}
|
||||
|
||||
// SendMessage sends a text message.
|
||||
// Since: Bot API 1.0
|
||||
// See https://core.telegram.org/bots/api#sendmessage
|
||||
func (api *API) SendMessage(params SendMessage) (Message, error) {
|
||||
req := NewRequestWithChatID[Message, SendMessage]("sendMessage", params, params.ChatID)
|
||||
@@ -32,6 +34,7 @@ func (api *API) SendMessage(params SendMessage) (Message, error) {
|
||||
}
|
||||
|
||||
// SendMessageWithContext is the context-aware variant of SendMessage.
|
||||
// Since: Bot API 1.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#sendmessage
|
||||
func (api *API) SendMessageWithContext(ctx context.Context, params SendMessage) (Message, error) {
|
||||
@@ -40,6 +43,7 @@ func (api *API) SendMessageWithContext(ctx context.Context, params SendMessage)
|
||||
}
|
||||
|
||||
// ForwardMessage holds parameters for the forwardMessage method.
|
||||
// Since: Bot API 1.0
|
||||
// See https://core.telegram.org/bots/api#forwardmessage
|
||||
type ForwardMessage struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -57,6 +61,7 @@ type ForwardMessage struct {
|
||||
}
|
||||
|
||||
// ForwardMessage forwards a message.
|
||||
// Since: Bot API 1.0
|
||||
// See https://core.telegram.org/bots/api#forwardmessage
|
||||
func (api *API) ForwardMessage(params ForwardMessage) (Message, error) {
|
||||
req := NewRequestWithChatID[Message]("forwardMessage", params, params.ChatID)
|
||||
@@ -64,6 +69,7 @@ func (api *API) ForwardMessage(params ForwardMessage) (Message, error) {
|
||||
}
|
||||
|
||||
// ForwardMessageWithContext is the context-aware variant of ForwardMessage.
|
||||
// Since: Bot API 1.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#forwardmessage
|
||||
func (api *API) ForwardMessageWithContext(ctx context.Context, params ForwardMessage) (Message, error) {
|
||||
@@ -72,6 +78,7 @@ func (api *API) ForwardMessageWithContext(ctx context.Context, params ForwardMes
|
||||
}
|
||||
|
||||
// ForwardMessages holds parameters for the forwardMessages method.
|
||||
// Since: Bot API 7.0
|
||||
// See https://core.telegram.org/bots/api#forwardmessages
|
||||
type ForwardMessages struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -85,6 +92,7 @@ type ForwardMessages struct {
|
||||
}
|
||||
|
||||
// ForwardMessages forwards multiple messages.
|
||||
// Since: Bot API 7.0
|
||||
// Returns an array of message IDs of the sent messages.
|
||||
// See https://core.telegram.org/bots/api#forwardmessages
|
||||
func (api *API) ForwardMessages(params ForwardMessages) ([]MessageID, error) {
|
||||
@@ -93,6 +101,7 @@ func (api *API) ForwardMessages(params ForwardMessages) ([]MessageID, error) {
|
||||
}
|
||||
|
||||
// ForwardMessagesWithContext is the context-aware variant of ForwardMessages.
|
||||
// Since: Bot API 7.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#forwardmessages
|
||||
func (api *API) ForwardMessagesWithContext(ctx context.Context, params ForwardMessages) ([]MessageID, error) {
|
||||
@@ -101,6 +110,7 @@ func (api *API) ForwardMessagesWithContext(ctx context.Context, params ForwardMe
|
||||
}
|
||||
|
||||
// CopyMessage holds parameters for the copyMessage method.
|
||||
// Since: Bot API 5.0
|
||||
// See https://core.telegram.org/bots/api#copymessage
|
||||
type CopyMessage struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -126,6 +136,7 @@ type CopyMessage struct {
|
||||
}
|
||||
|
||||
// CopyMessage copies a message.
|
||||
// Since: Bot API 5.0
|
||||
// Returns the MessageID of the sent copy.
|
||||
// See https://core.telegram.org/bots/api#copymessage
|
||||
func (api *API) CopyMessage(params CopyMessage) (int, error) {
|
||||
@@ -137,6 +148,7 @@ func (api *API) CopyMessage(params CopyMessage) (int, error) {
|
||||
}
|
||||
|
||||
// CopyMessageWithContext is the context-aware variant of CopyMessage.
|
||||
// Since: Bot API 5.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#copymessage
|
||||
func (api *API) CopyMessageWithContext(ctx context.Context, params CopyMessage) (int, error) {
|
||||
@@ -148,6 +160,7 @@ func (api *API) CopyMessageWithContext(ctx context.Context, params CopyMessage)
|
||||
}
|
||||
|
||||
// CopyMessages holds parameters for the copyMessages method.
|
||||
// Since: Bot API 7.0
|
||||
// See https://core.telegram.org/bots/api#copymessages
|
||||
type CopyMessages struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -162,6 +175,7 @@ type CopyMessages struct {
|
||||
}
|
||||
|
||||
// CopyMessages copies multiple messages.
|
||||
// Since: Bot API 7.0
|
||||
// Returns an array of message IDs of the sent copies.
|
||||
// See https://core.telegram.org/bots/api#copymessages
|
||||
func (api *API) CopyMessages(params CopyMessages) ([]MessageID, error) {
|
||||
@@ -170,6 +184,7 @@ func (api *API) CopyMessages(params CopyMessages) ([]MessageID, error) {
|
||||
}
|
||||
|
||||
// CopyMessagesWithContext is the context-aware variant of CopyMessages.
|
||||
// Since: Bot API 7.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#copymessages
|
||||
func (api *API) CopyMessagesWithContext(ctx context.Context, params CopyMessages) ([]MessageID, error) {
|
||||
@@ -178,6 +193,7 @@ func (api *API) CopyMessagesWithContext(ctx context.Context, params CopyMessages
|
||||
}
|
||||
|
||||
// SendLocation holds parameters for the sendLocation method.
|
||||
// Since: Bot API 1.0
|
||||
// See https://core.telegram.org/bots/api#sendlocation
|
||||
type SendLocation struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -203,6 +219,7 @@ type SendLocation struct {
|
||||
}
|
||||
|
||||
// SendLocation sends a point on the map.
|
||||
// Since: Bot API 1.0
|
||||
// See https://core.telegram.org/bots/api#sendlocation
|
||||
func (api *API) SendLocation(params SendLocation) (Message, error) {
|
||||
req := NewRequestWithChatID[Message]("sendLocation", params, params.ChatID)
|
||||
@@ -210,6 +227,7 @@ func (api *API) SendLocation(params SendLocation) (Message, error) {
|
||||
}
|
||||
|
||||
// SendLocationWithContext is the context-aware variant of SendLocation.
|
||||
// Since: Bot API 1.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#sendlocation
|
||||
func (api *API) SendLocationWithContext(ctx context.Context, params SendLocation) (Message, error) {
|
||||
@@ -218,6 +236,7 @@ func (api *API) SendLocationWithContext(ctx context.Context, params SendLocation
|
||||
}
|
||||
|
||||
// SendVenue holds parameters for the sendVenue method.
|
||||
// Since: Bot API 2.0
|
||||
// See https://core.telegram.org/bots/api#sendvenue
|
||||
type SendVenue struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -245,6 +264,7 @@ type SendVenue struct {
|
||||
}
|
||||
|
||||
// SendVenue sends information about a venue.
|
||||
// Since: Bot API 2.0
|
||||
// See https://core.telegram.org/bots/api#sendvenue
|
||||
func (api *API) SendVenue(params SendVenue) (Message, error) {
|
||||
req := NewRequestWithChatID[Message]("sendVenue", params, params.ChatID)
|
||||
@@ -252,6 +272,7 @@ func (api *API) SendVenue(params SendVenue) (Message, error) {
|
||||
}
|
||||
|
||||
// SendVenueWithContext is the context-aware variant of SendVenue.
|
||||
// Since: Bot API 2.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#sendvenue
|
||||
func (api *API) SendVenueWithContext(ctx context.Context, params SendVenue) (Message, error) {
|
||||
@@ -260,6 +281,7 @@ func (api *API) SendVenueWithContext(ctx context.Context, params SendVenue) (Mes
|
||||
}
|
||||
|
||||
// SendContact holds parameters for the sendContact method.
|
||||
// Since: Bot API 2.0
|
||||
// See https://core.telegram.org/bots/api#sendcontact
|
||||
type SendContact struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -283,6 +305,7 @@ type SendContact struct {
|
||||
}
|
||||
|
||||
// SendContact sends a phone contact.
|
||||
// Since: Bot API 2.0
|
||||
// See https://core.telegram.org/bots/api#sendcontact
|
||||
func (api *API) SendContact(params SendContact) (Message, error) {
|
||||
req := NewRequestWithChatID[Message]("sendContact", params, params.ChatID)
|
||||
@@ -290,6 +313,7 @@ func (api *API) SendContact(params SendContact) (Message, error) {
|
||||
}
|
||||
|
||||
// SendContactWithContext is the context-aware variant of SendContact.
|
||||
// Since: Bot API 2.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#sendcontact
|
||||
func (api *API) SendContactWithContext(ctx context.Context, params SendContact) (Message, error) {
|
||||
@@ -298,6 +322,7 @@ func (api *API) SendContactWithContext(ctx context.Context, params SendContact)
|
||||
}
|
||||
|
||||
// SendPoll holds parameters for the sendPoll method.
|
||||
// Since: Bot API 4.2
|
||||
// See https://core.telegram.org/bots/api#sendpoll
|
||||
type SendPoll struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -315,10 +340,14 @@ type SendPoll struct {
|
||||
ShuffleOptions bool `json:"shuffle_options,omitempty"`
|
||||
AllowAddingOptions bool `json:"allow_adding_options,omitempty"`
|
||||
HideResultsUntilCloses bool `json:"hide_results_until_closes,omitempty"`
|
||||
MembersOnly bool `json:"members_only,omitempty"` // Since: Bot API 10.0
|
||||
CountryCodes []string `json:"country_codes,omitempty"` // Since: Bot API 10.0
|
||||
CorrectOptionIDs []int `json:"correct_option_ids,omitempty"`
|
||||
Explanation string `json:"explanation,omitempty"`
|
||||
ExplanationParseMode ParseMode `json:"explanation_parse_mode,omitempty"`
|
||||
ExplanationEntities []MessageEntity `json:"explanation_entities,omitempty"`
|
||||
ExplanationMedia *InputPollMedia `json:"explanation_media,omitempty"`
|
||||
Media *InputPollMedia `json:"media,omitempty"`
|
||||
OpenPeriod int `json:"open_period,omitempty"`
|
||||
CloseDate int `json:"close_date"`
|
||||
IsClosed bool `json:"is_closed,omitempty"`
|
||||
@@ -337,6 +366,7 @@ type SendPoll struct {
|
||||
}
|
||||
|
||||
// SendPoll sends a native poll.
|
||||
// Since: Bot API 4.2
|
||||
// See https://core.telegram.org/bots/api#sendpoll
|
||||
func (api *API) SendPoll(params SendPoll) (Message, error) {
|
||||
req := NewRequestWithChatID[Message]("sendPoll", params, params.ChatID)
|
||||
@@ -344,6 +374,7 @@ func (api *API) SendPoll(params SendPoll) (Message, error) {
|
||||
}
|
||||
|
||||
// SendPollWithContext is the context-aware variant of SendPoll.
|
||||
// Since: Bot API 4.2
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#sendpoll
|
||||
func (api *API) SendPollWithContext(ctx context.Context, params SendPoll) (Message, error) {
|
||||
@@ -352,6 +383,7 @@ func (api *API) SendPollWithContext(ctx context.Context, params SendPoll) (Messa
|
||||
}
|
||||
|
||||
// SendChecklist holds parameters for the sendChecklist method.
|
||||
// Since: Bot API 9.1
|
||||
// See https://core.telegram.org/bots/api#sendchecklist
|
||||
type SendChecklist struct {
|
||||
BusinessConnectionID string `json:"business_connection_id"`
|
||||
@@ -367,6 +399,7 @@ type SendChecklist struct {
|
||||
}
|
||||
|
||||
// SendChecklist sends a checklist.
|
||||
// Since: Bot API 9.1
|
||||
// See https://core.telegram.org/bots/api#sendchecklist
|
||||
func (api *API) SendChecklist(params SendChecklist) (Message, error) {
|
||||
req := NewRequestWithChatID[Message]("sendChecklist", params, params.ChatID)
|
||||
@@ -374,6 +407,7 @@ func (api *API) SendChecklist(params SendChecklist) (Message, error) {
|
||||
}
|
||||
|
||||
// SendChecklistWithContext is the context-aware variant of SendChecklist.
|
||||
// Since: Bot API 9.1
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#sendchecklist
|
||||
func (api *API) SendChecklistWithContext(ctx context.Context, params SendChecklist) (Message, error) {
|
||||
@@ -382,6 +416,7 @@ func (api *API) SendChecklistWithContext(ctx context.Context, params SendCheckli
|
||||
}
|
||||
|
||||
// SendDice holds parameters for the sendDice method.
|
||||
// Since: Bot API 4.7
|
||||
// See https://core.telegram.org/bots/api#senddice
|
||||
type SendDice struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -402,6 +437,7 @@ type SendDice struct {
|
||||
}
|
||||
|
||||
// SendDice sends a dice, which will have a random value.
|
||||
// Since: Bot API 4.7
|
||||
// See https://core.telegram.org/bots/api#senddice
|
||||
func (api *API) SendDice(params SendDice) (Message, error) {
|
||||
req := NewRequestWithChatID[Message]("sendDice", params, params.ChatID)
|
||||
@@ -409,6 +445,7 @@ func (api *API) SendDice(params SendDice) (Message, error) {
|
||||
}
|
||||
|
||||
// SendDiceWithContext is the context-aware variant of SendDice.
|
||||
// Since: Bot API 4.7
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#senddice
|
||||
func (api *API) SendDiceWithContext(ctx context.Context, params SendDice) (Message, error) {
|
||||
@@ -417,6 +454,7 @@ func (api *API) SendDiceWithContext(ctx context.Context, params SendDice) (Messa
|
||||
}
|
||||
|
||||
// SendMessageDraft holds parameters for the sendMessageDraft method.
|
||||
// Since: Bot API 9.1
|
||||
// See https://core.telegram.org/bots/api#sendmessagedraft
|
||||
type SendMessageDraft struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -428,6 +466,7 @@ type SendMessageDraft struct {
|
||||
}
|
||||
|
||||
// SendMessageDraft sends or updates a draft message in the target chat.
|
||||
// Since: Bot API 9.1
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#sendmessagedraft
|
||||
func (api *API) SendMessageDraft(params SendMessageDraft) (bool, error) {
|
||||
@@ -436,6 +475,7 @@ func (api *API) SendMessageDraft(params SendMessageDraft) (bool, error) {
|
||||
}
|
||||
|
||||
// SendMessageDraftWithContext is the context-aware variant of SendMessageDraft.
|
||||
// Since: Bot API 9.1
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#sendmessagedraft
|
||||
func (api *API) SendMessageDraftWithContext(ctx context.Context, params SendMessageDraft) (bool, error) {
|
||||
@@ -444,6 +484,7 @@ func (api *API) SendMessageDraftWithContext(ctx context.Context, params SendMess
|
||||
}
|
||||
|
||||
// SendChatAction holds parameters for the sendChatAction method.
|
||||
// Since: Bot API 1.0
|
||||
// See https://core.telegram.org/bots/api#sendchataction
|
||||
type SendChatAction struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -453,6 +494,7 @@ type SendChatAction struct {
|
||||
}
|
||||
|
||||
// SendChatAction sends a chat action (typing, uploading photo, etc.).
|
||||
// Since: Bot API 1.0
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#sendchataction
|
||||
func (api *API) SendChatAction(params SendChatAction) (bool, error) {
|
||||
@@ -461,6 +503,7 @@ func (api *API) SendChatAction(params SendChatAction) (bool, error) {
|
||||
}
|
||||
|
||||
// SendChatActionWithContext is the context-aware variant of SendChatAction.
|
||||
// Since: Bot API 1.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#sendchataction
|
||||
func (api *API) SendChatActionWithContext(ctx context.Context, params SendChatAction) (bool, error) {
|
||||
@@ -469,6 +512,7 @@ func (api *API) SendChatActionWithContext(ctx context.Context, params SendChatAc
|
||||
}
|
||||
|
||||
// SetMessageReaction holds parameters for the setMessageReaction method.
|
||||
// Since: Bot API 7.0
|
||||
// See https://core.telegram.org/bots/api#setmessagereaction
|
||||
type SetMessageReaction struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -478,6 +522,7 @@ type SetMessageReaction struct {
|
||||
}
|
||||
|
||||
// SetMessageReaction changes the chosen reaction on a message.
|
||||
// Since: Bot API 7.0
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#setmessagereaction
|
||||
func (api *API) SetMessageReaction(params SetMessageReaction) (bool, error) {
|
||||
@@ -486,6 +531,7 @@ func (api *API) SetMessageReaction(params SetMessageReaction) (bool, error) {
|
||||
}
|
||||
|
||||
// SetMessageReactionWithContext is the context-aware variant of SetMessageReaction.
|
||||
// Since: Bot API 7.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#setmessagereaction
|
||||
func (api *API) SetMessageReactionWithContext(ctx context.Context, params SetMessageReaction) (bool, error) {
|
||||
@@ -494,6 +540,7 @@ func (api *API) SetMessageReactionWithContext(ctx context.Context, params SetMes
|
||||
}
|
||||
|
||||
// EditMessageText holds parameters for the editMessageText method.
|
||||
// Since: Bot API 2.0
|
||||
// See https://core.telegram.org/bots/api#editmessagetext
|
||||
type EditMessageText struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -508,6 +555,7 @@ type EditMessageText struct {
|
||||
}
|
||||
|
||||
// EditMessageText edits text messages.
|
||||
// Since: Bot API 2.0
|
||||
// If inline_message_id is provided, returns a boolean success flag;
|
||||
// otherwise returns the edited Message.
|
||||
// See https://core.telegram.org/bots/api#editmessagetext
|
||||
@@ -524,6 +572,7 @@ func (api *API) EditMessageText(params EditMessageText) (Message, bool, error) {
|
||||
}
|
||||
|
||||
// EditMessageTextWithContext is the context-aware variant of EditMessageText.
|
||||
// Since: Bot API 2.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#editmessagetext
|
||||
func (api *API) EditMessageTextWithContext(ctx context.Context, params EditMessageText) (Message, bool, error) {
|
||||
@@ -539,6 +588,7 @@ func (api *API) EditMessageTextWithContext(ctx context.Context, params EditMessa
|
||||
}
|
||||
|
||||
// EditMessageCaption holds parameters for the editMessageCaption method.
|
||||
// Since: Bot API 2.0
|
||||
// See https://core.telegram.org/bots/api#editmessagecaption
|
||||
type EditMessageCaption struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -553,6 +603,7 @@ type EditMessageCaption struct {
|
||||
}
|
||||
|
||||
// EditMessageCaption edits captions of messages.
|
||||
// Since: Bot API 2.0
|
||||
// If inline_message_id is provided, returns a boolean success flag;
|
||||
// otherwise returns the edited Message.
|
||||
// See https://core.telegram.org/bots/api#editmessagecaption
|
||||
@@ -569,6 +620,7 @@ func (api *API) EditMessageCaption(params EditMessageCaption) (Message, bool, er
|
||||
}
|
||||
|
||||
// EditMessageCaptionWithContext is the context-aware variant of EditMessageCaption.
|
||||
// Since: Bot API 2.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#editmessagecaption
|
||||
func (api *API) EditMessageCaptionWithContext(ctx context.Context, params EditMessageCaption) (Message, bool, error) {
|
||||
@@ -584,6 +636,7 @@ func (api *API) EditMessageCaptionWithContext(ctx context.Context, params EditMe
|
||||
}
|
||||
|
||||
// EditMessageMedia holds parameters for the editMessageMedia method.
|
||||
// Since: Bot API 4.0
|
||||
// See https://core.telegram.org/bots/api#editmessagemedia
|
||||
type EditMessageMedia struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -595,6 +648,7 @@ type EditMessageMedia struct {
|
||||
}
|
||||
|
||||
// EditMessageMedia edits media messages.
|
||||
// Since: Bot API 4.0
|
||||
// If inline_message_id is provided, returns a boolean success flag;
|
||||
// otherwise returns the edited Message.
|
||||
// See https://core.telegram.org/bots/api#editmessagemedia
|
||||
@@ -611,6 +665,7 @@ func (api *API) EditMessageMedia(params EditMessageMedia) (Message, bool, error)
|
||||
}
|
||||
|
||||
// EditMessageMediaWithContext is the context-aware variant of EditMessageMedia.
|
||||
// Since: Bot API 4.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#editmessagemedia
|
||||
func (api *API) EditMessageMediaWithContext(ctx context.Context, params EditMessageMedia) (Message, bool, error) {
|
||||
@@ -626,6 +681,7 @@ func (api *API) EditMessageMediaWithContext(ctx context.Context, params EditMess
|
||||
}
|
||||
|
||||
// EditMessageLiveLocation holds parameters for the editMessageLiveLocation method.
|
||||
// Since: Bot API 3.4
|
||||
// See https://core.telegram.org/bots/api#editmessagelivelocation
|
||||
type EditMessageLiveLocation struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -643,6 +699,7 @@ type EditMessageLiveLocation struct {
|
||||
}
|
||||
|
||||
// EditMessageLiveLocation edits live location messages.
|
||||
// Since: Bot API 3.4
|
||||
// If inline_message_id is provided, returns a boolean success flag;
|
||||
// otherwise returns the edited Message.
|
||||
// See https://core.telegram.org/bots/api#editmessagelivelocation
|
||||
@@ -659,6 +716,7 @@ func (api *API) EditMessageLiveLocation(params EditMessageLiveLocation) (Message
|
||||
}
|
||||
|
||||
// EditMessageLiveLocationWithContext is the context-aware variant of EditMessageLiveLocation.
|
||||
// Since: Bot API 3.4
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#editmessagelivelocation
|
||||
func (api *API) EditMessageLiveLocationWithContext(ctx context.Context, params EditMessageLiveLocation) (Message, bool, error) {
|
||||
@@ -674,6 +732,7 @@ func (api *API) EditMessageLiveLocationWithContext(ctx context.Context, params E
|
||||
}
|
||||
|
||||
// StopMessageLiveLocation holds parameters for the stopMessageLiveLocation method.
|
||||
// Since: Bot API 3.4
|
||||
// See https://core.telegram.org/bots/api#stopmessagelivelocation
|
||||
type StopMessageLiveLocation struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -684,6 +743,7 @@ type StopMessageLiveLocation struct {
|
||||
}
|
||||
|
||||
// StopMessageLiveLocation stops a live location message.
|
||||
// Since: Bot API 3.4
|
||||
// If inline_message_id is provided, returns a boolean success flag;
|
||||
// otherwise returns the edited Message.
|
||||
// See https://core.telegram.org/bots/api#stopmessagelivelocation
|
||||
@@ -700,6 +760,7 @@ func (api *API) StopMessageLiveLocation(params StopMessageLiveLocation) (Message
|
||||
}
|
||||
|
||||
// StopMessageLiveLocationWithContext is the context-aware variant of StopMessageLiveLocation.
|
||||
// Since: Bot API 3.4
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#stopmessagelivelocation
|
||||
func (api *API) StopMessageLiveLocationWithContext(ctx context.Context, params StopMessageLiveLocation) (Message, bool, error) {
|
||||
@@ -715,6 +776,8 @@ func (api *API) StopMessageLiveLocationWithContext(ctx context.Context, params S
|
||||
}
|
||||
|
||||
// EditMessageChecklist holds parameters for the editMessageChecklist method.
|
||||
// Since: Bot API 9.1
|
||||
// See https://core.telegram.org/bots/api#editmessagechecklist
|
||||
type EditMessageChecklist struct {
|
||||
BusinessConnectionID string `json:"business_connection_id"`
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -724,6 +787,7 @@ type EditMessageChecklist struct {
|
||||
}
|
||||
|
||||
// EditMessageChecklist edits a checklist message.
|
||||
// Since: Bot API 9.1
|
||||
// See https://core.telegram.org/bots/api#editmessagechecklist
|
||||
func (api *API) EditMessageChecklist(params EditMessageChecklist) (Message, error) {
|
||||
req := NewRequestWithChatID[Message]("editMessageChecklist", params, params.ChatID)
|
||||
@@ -731,6 +795,7 @@ func (api *API) EditMessageChecklist(params EditMessageChecklist) (Message, erro
|
||||
}
|
||||
|
||||
// EditMessageChecklistWithContext is the context-aware variant of EditMessageChecklist.
|
||||
// Since: Bot API 9.1
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#editmessagechecklist
|
||||
func (api *API) EditMessageChecklistWithContext(ctx context.Context, params EditMessageChecklist) (Message, error) {
|
||||
@@ -739,6 +804,7 @@ func (api *API) EditMessageChecklistWithContext(ctx context.Context, params Edit
|
||||
}
|
||||
|
||||
// EditMessageReplyMarkup holds parameters for the editMessageReplyMarkup method.
|
||||
// Since: Bot API 2.0
|
||||
// See https://core.telegram.org/bots/api#editmessagereplymarkup
|
||||
type EditMessageReplyMarkup struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -749,6 +815,7 @@ type EditMessageReplyMarkup struct {
|
||||
}
|
||||
|
||||
// EditMessageReplyMarkup edits only the reply markup of messages.
|
||||
// Since: Bot API 2.0
|
||||
// If inline_message_id is provided, returns a boolean success flag;
|
||||
// otherwise returns the edited Message.
|
||||
// See https://core.telegram.org/bots/api#editmessagereplymarkup
|
||||
@@ -765,6 +832,7 @@ func (api *API) EditMessageReplyMarkup(params EditMessageReplyMarkup) (Message,
|
||||
}
|
||||
|
||||
// EditMessageReplyMarkupWithContext is the context-aware variant of EditMessageReplyMarkup.
|
||||
// Since: Bot API 2.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#editmessagereplymarkup
|
||||
func (api *API) EditMessageReplyMarkupWithContext(ctx context.Context, params EditMessageReplyMarkup) (Message, bool, error) {
|
||||
@@ -780,6 +848,7 @@ func (api *API) EditMessageReplyMarkupWithContext(ctx context.Context, params Ed
|
||||
}
|
||||
|
||||
// StopPoll holds parameters for the stopPoll method.
|
||||
// Since: Bot API 4.2
|
||||
// See https://core.telegram.org/bots/api#stoppoll
|
||||
type StopPoll struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -789,6 +858,7 @@ type StopPoll struct {
|
||||
}
|
||||
|
||||
// StopPoll stops a poll that was sent by the bot.
|
||||
// Since: Bot API 4.2
|
||||
// Returns the stopped Poll.
|
||||
// See https://core.telegram.org/bots/api#stoppoll
|
||||
func (api *API) StopPoll(params StopPoll) (Poll, error) {
|
||||
@@ -797,6 +867,7 @@ func (api *API) StopPoll(params StopPoll) (Poll, error) {
|
||||
}
|
||||
|
||||
// StopPollWithContext is the context-aware variant of StopPoll.
|
||||
// Since: Bot API 4.2
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#stoppoll
|
||||
func (api *API) StopPollWithContext(ctx context.Context, params StopPoll) (Poll, error) {
|
||||
@@ -805,6 +876,7 @@ func (api *API) StopPollWithContext(ctx context.Context, params StopPoll) (Poll,
|
||||
}
|
||||
|
||||
// ApproveSuggestedPost holds parameters for the approveSuggestedPost method.
|
||||
// Since: Bot API 9.2
|
||||
// See https://core.telegram.org/bots/api#approvesuggestedpost
|
||||
type ApproveSuggestedPost struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -813,6 +885,7 @@ type ApproveSuggestedPost struct {
|
||||
}
|
||||
|
||||
// ApproveSuggestedPost approves a suggested channel post.
|
||||
// Since: Bot API 9.2
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#approvesuggestedpost
|
||||
func (api *API) ApproveSuggestedPost(params ApproveSuggestedPost) (bool, error) {
|
||||
@@ -821,6 +894,7 @@ func (api *API) ApproveSuggestedPost(params ApproveSuggestedPost) (bool, error)
|
||||
}
|
||||
|
||||
// ApproveSuggestedPostWithContext is the context-aware variant of ApproveSuggestedPost.
|
||||
// Since: Bot API 9.2
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#approvesuggestedpost
|
||||
func (api *API) ApproveSuggestedPostWithContext(ctx context.Context, params ApproveSuggestedPost) (bool, error) {
|
||||
@@ -829,6 +903,7 @@ func (api *API) ApproveSuggestedPostWithContext(ctx context.Context, params Appr
|
||||
}
|
||||
|
||||
// DeclineSuggestedPost holds parameters for the declineSuggestedPost method.
|
||||
// Since: Bot API 9.2
|
||||
// See https://core.telegram.org/bots/api#declinesuggestedpost
|
||||
type DeclineSuggestedPost struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -837,6 +912,7 @@ type DeclineSuggestedPost struct {
|
||||
}
|
||||
|
||||
// DeclineSuggestedPost declines a suggested channel post.
|
||||
// Since: Bot API 9.2
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#declinesuggestedpost
|
||||
func (api *API) DeclineSuggestedPost(params DeclineSuggestedPost) (bool, error) {
|
||||
@@ -845,6 +921,7 @@ func (api *API) DeclineSuggestedPost(params DeclineSuggestedPost) (bool, error)
|
||||
}
|
||||
|
||||
// DeclineSuggestedPostWithContext is the context-aware variant of DeclineSuggestedPost.
|
||||
// Since: Bot API 9.2
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#declinesuggestedpost
|
||||
func (api *API) DeclineSuggestedPostWithContext(ctx context.Context, params DeclineSuggestedPost) (bool, error) {
|
||||
@@ -853,6 +930,7 @@ func (api *API) DeclineSuggestedPostWithContext(ctx context.Context, params Decl
|
||||
}
|
||||
|
||||
// DeleteMessage holds parameters for the deleteMessage method.
|
||||
// Since: Bot API 3.0
|
||||
// See https://core.telegram.org/bots/api#deletemessage
|
||||
type DeleteMessage struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -860,6 +938,7 @@ type DeleteMessage struct {
|
||||
}
|
||||
|
||||
// DeleteMessage deletes a message.
|
||||
// Since: Bot API 3.0
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#deletemessage
|
||||
func (api *API) DeleteMessage(params DeleteMessage) (bool, error) {
|
||||
@@ -868,6 +947,7 @@ func (api *API) DeleteMessage(params DeleteMessage) (bool, error) {
|
||||
}
|
||||
|
||||
// DeleteMessageWithContext is the context-aware variant of DeleteMessage.
|
||||
// Since: Bot API 3.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#deletemessage
|
||||
func (api *API) DeleteMessageWithContext(ctx context.Context, params DeleteMessage) (bool, error) {
|
||||
@@ -876,6 +956,7 @@ func (api *API) DeleteMessageWithContext(ctx context.Context, params DeleteMessa
|
||||
}
|
||||
|
||||
// DeleteMessages holds parameters for the deleteMessages method.
|
||||
// Since: Bot API 7.0
|
||||
// See https://core.telegram.org/bots/api#deletemessages
|
||||
type DeleteMessages struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -883,6 +964,7 @@ type DeleteMessages struct {
|
||||
}
|
||||
|
||||
// DeleteMessages deletes multiple messages at once.
|
||||
// Since: Bot API 7.0
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#deletemessages
|
||||
func (api *API) DeleteMessages(params DeleteMessages) (bool, error) {
|
||||
@@ -891,6 +973,7 @@ func (api *API) DeleteMessages(params DeleteMessages) (bool, error) {
|
||||
}
|
||||
|
||||
// DeleteMessagesWithContext is the context-aware variant of DeleteMessages.
|
||||
// Since: Bot API 7.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#deletemessages
|
||||
func (api *API) DeleteMessagesWithContext(ctx context.Context, params DeleteMessages) (bool, error) {
|
||||
@@ -899,6 +982,7 @@ func (api *API) DeleteMessagesWithContext(ctx context.Context, params DeleteMess
|
||||
}
|
||||
|
||||
// AnswerCallbackQuery holds parameters for the answerCallbackQuery method.
|
||||
// Since: Bot API 2.0
|
||||
// See https://core.telegram.org/bots/api#answercallbackquery
|
||||
type AnswerCallbackQuery struct {
|
||||
CallbackQueryID string `json:"callback_query_id"`
|
||||
@@ -909,6 +993,7 @@ type AnswerCallbackQuery struct {
|
||||
}
|
||||
|
||||
// AnswerCallbackQuery sends answers to callback queries sent from inline keyboards.
|
||||
// Since: Bot API 2.0
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#answercallbackquery
|
||||
func (api *API) AnswerCallbackQuery(params AnswerCallbackQuery) (bool, error) {
|
||||
@@ -917,9 +1002,90 @@ func (api *API) AnswerCallbackQuery(params AnswerCallbackQuery) (bool, error) {
|
||||
}
|
||||
|
||||
// AnswerCallbackQueryWithContext is the context-aware variant of AnswerCallbackQuery.
|
||||
// Since: Bot API 2.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#answercallbackquery
|
||||
func (api *API) AnswerCallbackQueryWithContext(ctx context.Context, params AnswerCallbackQuery) (bool, error) {
|
||||
req := NewRequest[bool]("answerCallbackQuery", params)
|
||||
return req.DoWithContext(ctx, api)
|
||||
}
|
||||
|
||||
// AnswerGuestQuery holds parameters for the answerGuestQuery method.
|
||||
// Since: Bot API 10.0
|
||||
// See https://core.telegram.org/bots/api#answerguestquery
|
||||
type AnswerGuestQuery struct {
|
||||
GuestQueryID string `json:"guest_query_id"`
|
||||
Result InlineQueryResult `json:"result"`
|
||||
}
|
||||
|
||||
// AnswerGuestQuery answers a guest query.
|
||||
// Since: Bot API 10.0
|
||||
// See https://core.telegram.org/bots/api#answerguestquery
|
||||
func (api *API) AnswerGuestQuery(params AnswerGuestQuery) (SentGuestMessage, error) {
|
||||
req := NewRequest[SentGuestMessage]("answerGuestQuery", params)
|
||||
return req.Do(api)
|
||||
}
|
||||
|
||||
// AnswerGuestQueryWithContext is the context-aware variant of AnswerGuestQuery.
|
||||
// Since: Bot API 10.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#answerguestquery
|
||||
func (api *API) AnswerGuestQueryWithContext(ctx context.Context, params AnswerGuestQuery) (SentGuestMessage, error) {
|
||||
req := NewRequest[SentGuestMessage]("answerGuestQuery", params)
|
||||
return req.DoWithContext(ctx, api)
|
||||
}
|
||||
|
||||
// DeleteAllMessageReactions holds parameters for the deleteAllMessageReactions method.
|
||||
// Since: Bot API 10.0
|
||||
// See https://core.telegram.org/bots/api#deleteallmessagereactions
|
||||
type DeleteAllMessageReactions struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
UserID int64 `json:"user_id,omitempty"`
|
||||
ActorChatID int64 `json:"actor_chat_id,omitempty"`
|
||||
}
|
||||
|
||||
// DeleteAllMessageReactions deletes all reactions on a message.
|
||||
// Since: Bot API 10.0
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#deleteallmessagereactions
|
||||
func (api *API) DeleteAllMessageReactions(params DeleteAllMessageReactions) (bool, error) {
|
||||
req := NewRequest[bool]("deleteAllMessageReactions", params)
|
||||
return req.Do(api)
|
||||
}
|
||||
|
||||
// DeleteAllMessageReactionWithContext is the context-aware variant of DeleteAllMessageReactions.
|
||||
// Since: Bot API 10.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#deleteallmessagereactions
|
||||
func (api *API) DeleteAllMessageReactionWithContext(ctx context.Context, params DeleteAllMessageReactions) (bool, error) {
|
||||
req := NewRequest[bool]("deleteAllMessageReactions", params)
|
||||
return req.DoWithContext(ctx, api)
|
||||
}
|
||||
|
||||
// DeleteMessageReaction holds parameters for the deleteMessageReaction method.
|
||||
// Since: Bot API 10.0
|
||||
// See https://core.telegram.org/bots/api#deletemessagereaction
|
||||
type DeleteMessageReaction struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
MessageID int `json:"message_id"`
|
||||
UserID int64 `json:"user_id,omitempty"`
|
||||
ActorChatID int64 `json:"actor_chat_id,omitempty"`
|
||||
}
|
||||
|
||||
// DeleteMessageReaction deletes a reaction on a message.
|
||||
// Since: Bot API 10.0
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#deletemessagereaction
|
||||
func (api *API) DeleteMessageReaction(params DeleteMessageReaction) (bool, error) {
|
||||
req := NewRequest[bool]("deleteMessageReaction", params)
|
||||
return req.Do(api)
|
||||
}
|
||||
|
||||
// DeleteMessageReactionWithContext is the context-aware variant of DeleteMessageReaction.
|
||||
// Since: Bot API 10.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#deletemessagereaction
|
||||
func (api *API) DeleteMessageReactionWithContext(ctx context.Context, params DeleteMessageReaction) (bool, error) {
|
||||
req := NewRequest[bool]("deleteMessageReaction", params)
|
||||
return req.DoWithContext(ctx, api)
|
||||
}
|
||||
|
||||
+174
-90
@@ -7,16 +7,19 @@ import (
|
||||
)
|
||||
|
||||
// MessageID represents a message identifier wrapper returned by some API methods.
|
||||
// Since: Bot API 7.0
|
||||
type MessageID struct {
|
||||
MessageID int `json:"message_id"`
|
||||
}
|
||||
|
||||
// DirectMessageTopic represents a forum topic in a direct message.
|
||||
// Since: Bot API 9.2
|
||||
type DirectMessageTopic struct {
|
||||
TopicID int64 `json:"topic_id"`
|
||||
User *User `json:"user,omitempty"`
|
||||
}
|
||||
|
||||
// MessageOriginType represents the type of a message origin.
|
||||
type MessageOriginType string
|
||||
|
||||
const (
|
||||
@@ -26,6 +29,8 @@ const (
|
||||
MessageOriginChannel = "channel"
|
||||
)
|
||||
|
||||
// MessageOrigin describes the origin of a message.
|
||||
// Since: Bot API 7.0
|
||||
type MessageOrigin struct {
|
||||
Type MessageOriginType `json:"type"`
|
||||
Date int64 `json:"date"`
|
||||
@@ -42,6 +47,8 @@ type MessageOrigin struct {
|
||||
AuthorSignature string `json:"author_signature,omitempty"`
|
||||
}
|
||||
|
||||
// ExternalReplyInfo contains information about a message that is being replied to.
|
||||
// Since: Bot API 7.0
|
||||
type ExternalReplyInfo struct {
|
||||
Origin MessageOrigin `json:"origin"`
|
||||
Chat *Chat `json:"chat,omitempty"`
|
||||
@@ -50,15 +57,16 @@ type ExternalReplyInfo struct {
|
||||
Animation *Animation `json:"animation,omitempty"`
|
||||
Audio *Audio `json:"audio,omitempty"`
|
||||
Document *Document `json:"document,omitempty"`
|
||||
PaidMedia *PaidMediaInfo `json:"paid_media,omitempty"`
|
||||
PaidMedia *PaidMediaInfo `json:"paid_media,omitempty"` // Since: Bot API 7.6
|
||||
Photo []PhotoSize `json:"photo,omitempty"`
|
||||
LivePhoto *LivePhoto `json:"live_photo,omitempty"` // Since: Bot API 10.0
|
||||
Sticker *Sticker `json:"sticker,omitempty"`
|
||||
Story *Story `json:"story,omitempty"`
|
||||
Video *Video `json:"video,omitempty"`
|
||||
VideoNote *VideoNote `json:"video_note,omitempty"`
|
||||
Voice *Voice `json:"voice,omitempty"`
|
||||
HasMediaSpoiler bool `json:"has_media_spoiler,omitempty"`
|
||||
Checklist *Checklist `json:"checklist,omitempty"`
|
||||
Checklist *Checklist `json:"checklist,omitempty"` // Since: Bot API 9.1
|
||||
Contact *Contact `json:"contact,omitempty"`
|
||||
Dice *Dice `json:"dice,omitempty"`
|
||||
Game *Game `json:"game,omitempty"`
|
||||
@@ -70,6 +78,8 @@ type ExternalReplyInfo struct {
|
||||
Venue *Venue `json:"venue,omitempty"`
|
||||
}
|
||||
|
||||
// TextQuote contains information about the quoted part of a message.
|
||||
// Since: Bot API 7.0
|
||||
type TextQuote struct {
|
||||
Text string `json:"text"`
|
||||
Entities []MessageEntity `json:"entities"`
|
||||
@@ -77,75 +87,86 @@ type TextQuote struct {
|
||||
IsManual bool `json:"is_manual,omitempty"`
|
||||
}
|
||||
|
||||
// MessageAutoDeleteTimerChanged represents a service message about a change in auto-delete timer settings.
|
||||
// Since: Bot API 5.1
|
||||
type MessageAutoDeleteTimerChanged struct {
|
||||
MessageAutoDeleteTime int `json:"message_auto_delete_time"`
|
||||
}
|
||||
|
||||
// DirectMessagePriceChanged represents a service message about a change in the price of direct messages.
|
||||
// Since: Bot API 9.1
|
||||
type DirectMessagePriceChanged struct {
|
||||
AreDirectMessagesEnabled bool `json:"are_direct_messages_enabled"`
|
||||
DirectMessageStarCount int `json:"direct_message_star_count,omitempty"`
|
||||
}
|
||||
|
||||
// PaidMessagePriceChanged represents a service message about a change in the price of paid messages.
|
||||
// Since: Bot API 9.x
|
||||
type PaidMessagePriceChanged struct {
|
||||
PaidMessageStarCount int `json:"paid_message_star_count"`
|
||||
}
|
||||
|
||||
// Message represents a Telegram message.
|
||||
// Since: Bot API 1.0
|
||||
// See https://core.telegram.org/bots/api#message
|
||||
type Message struct {
|
||||
MessageID int `json:"message_id"`
|
||||
MessageThreadID int `json:"message_thread_id,omitempty"`
|
||||
DirectMessageTopic *DirectMessageTopic `json:"direct_message_topic,omitempty"`
|
||||
MessageThreadID int `json:"message_thread_id,omitempty"` // Since: Bot API 6.3
|
||||
DirectMessageTopic *DirectMessageTopic `json:"direct_message_topic,omitempty"` // Since: Bot API 9.2
|
||||
From *User `json:"from,omitempty"`
|
||||
|
||||
SenderChat *Chat `json:"sender_chat,omitempty"`
|
||||
SenderBoostCount int `json:"sender_boost_count,omitempty"`
|
||||
SenderBusinessBot *User `json:"sender_business_bot,omitempty"`
|
||||
SenderTag string `json:"sender_tag,omitempty"`
|
||||
SenderChat *Chat `json:"sender_chat,omitempty"` // Since: Bot API 5.0
|
||||
SenderBoostCount int `json:"sender_boost_count,omitempty"` // Since: Bot API 7.1
|
||||
SenderBusinessBot *User `json:"sender_business_bot,omitempty"` // Since: Bot API 7.2
|
||||
SenderTag string `json:"sender_tag,omitempty"` // Since: Bot API 9.5
|
||||
Date int `json:"date"`
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
GuestQueryID string `json:"guest_query_id,omitempty"` // Since: Bot API 10.0
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"` // Since: Bot API 7.2
|
||||
Chat *Chat `json:"chat,omitempty"`
|
||||
ForwardOrigin *MessageOrigin `json:"forward_origin,omitempty"`
|
||||
ForwardOrigin *MessageOrigin `json:"forward_origin,omitempty"` // Since: Bot API 7.0
|
||||
|
||||
IsTopicMessage bool `json:"is_topic_message,omitempty"`
|
||||
IsAutomaticForward bool `json:"is_automatic_forward,omitempty"`
|
||||
IsTopicMessage bool `json:"is_topic_message,omitempty"` // Since: Bot API 6.3
|
||||
IsAutomaticForward bool `json:"is_automatic_forward,omitempty"` // Since: Bot API 5.5
|
||||
ReplyToMessage *Message `json:"reply_to_message,omitempty"`
|
||||
ExternalReply *ExternalReplyInfo `json:"external_reply,omitempty"`
|
||||
Quote *TextQuote `json:"quote,omitempty"`
|
||||
ExternalReply *ExternalReplyInfo `json:"external_reply,omitempty"` // Since: Bot API 7.0
|
||||
Quote *TextQuote `json:"quote,omitempty"` // Since: Bot API 7.0
|
||||
|
||||
ReplyToStory *Story `json:"reply_to_story,omitempty"`
|
||||
ReplyToChecklistTaskID int `json:"reply_to_checklist_task_id,omitempty"`
|
||||
ReplyToPollOptionID string `json:"reply_to_poll_option_id,omitempty"`
|
||||
ReplyToStory *Story `json:"reply_to_story,omitempty"` // Since: Bot API 7.1
|
||||
ReplyToChecklistTaskID int `json:"reply_to_checklist_task_id,omitempty"` // Since: Bot API 9.1
|
||||
ReplyToPollOptionID string `json:"reply_to_poll_option_id,omitempty"` // Since: Bot API 9.6
|
||||
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"`
|
||||
GuestBotCallerUser *User `json:"guest_bot_caller_user,omitempty"` // Since: Bot API 10.0
|
||||
GuestBotCallerChat *Chat `json:"guest_bot_caller_chat,omitempty"` // Since: Bot API 10.0
|
||||
EditDate int `json:"edit_date,omitempty"` // Since: Bot API 2.1
|
||||
HasProtectedContent bool `json:"has_protected_content,omitempty"` // Since: Bot API 5.5
|
||||
IsFromOffline bool `json:"is_from_offline,omitempty"` // Since: Bot API 7.2
|
||||
IsPaidPost bool `json:"is_paid_post,omitempty"` // Since: Bot API 9.1
|
||||
MediaGroupID string `json:"media_group_id,omitempty"` // Since: Bot API 3.5
|
||||
AuthorSignature string `json:"author_signature,omitempty"`
|
||||
PaidStarCount int `json:"paid_star_count,omitempty"`
|
||||
PaidStarCount int `json:"paid_star_count,omitempty"` // Since: Bot API 8.3
|
||||
|
||||
Text string `json:"text"`
|
||||
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"`
|
||||
SuggestedPostInfo *SuggestedPostInfo `json:"suggested_post_info,omitempty"` // Since: Bot API 9.1
|
||||
EffectID string `json:"effect_id,omitempty"` // Since: Bot API 7.4
|
||||
|
||||
Animation *Animation `json:"animation,omitempty"`
|
||||
Animation *Animation `json:"animation,omitempty"` // Since: Bot API 4.0
|
||||
Audio *Audio `json:"audio,omitempty"`
|
||||
Document *Document `json:"document,omitempty"`
|
||||
PaidMedia *PaidMediaInfo `json:"paid_media,omitempty"`
|
||||
PaidMedia *PaidMediaInfo `json:"paid_media,omitempty"` // Since: Bot API 7.6
|
||||
Photo extypes.Slice[PhotoSize] `json:"photo,omitempty"`
|
||||
LivePhoto *LivePhoto `json:"live_photo,omitempty"` // Since: Bot API 10.0
|
||||
Sticker *Sticker `json:"sticker,omitempty"`
|
||||
Story *Story `json:"story,omitempty"`
|
||||
Video *Video `json:"video,omitempty"`
|
||||
VideoNote *VideoNote `json:"video_note,omitempty"`
|
||||
Voice *Voice `json:"voice,omitempty"`
|
||||
Caption string `json:"caption,omitempty"`
|
||||
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
|
||||
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
|
||||
HasMediaSpoiler bool `json:"has_media_spoiler,omitempty"`
|
||||
Checklist *Checklist `json:"checklist,omitempty"`
|
||||
VideoNote *VideoNote `json:"video_note,omitempty"` // Since: Bot API 3.0
|
||||
Voice *Voice `json:"voice,omitempty"` // Since: Bot API 1.2
|
||||
Caption string `json:"caption,omitempty"` // Since: Bot API 3.4
|
||||
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` // Since: Bot API 3.4
|
||||
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"` // Since: Bot API 7.4
|
||||
HasMediaSpoiler bool `json:"has_media_spoiler,omitempty"` // Since: Bot API 6.4
|
||||
Checklist *Checklist `json:"checklist,omitempty"` // Since: Bot API 9.1
|
||||
Contact *Contact `json:"contact,omitempty"`
|
||||
Dice *Dice `json:"dice,omitempty"`
|
||||
Game *Game `json:"game,omitempty"`
|
||||
@@ -163,63 +184,64 @@ type Message struct {
|
||||
GroupChatCreated bool `json:"group_chat_created,omitempty"`
|
||||
SupergroupChatCreated bool `json:"supergroup_chat_created,omitempty"`
|
||||
ChannelChatCreated bool `json:"channel_chat_created,omitempty"`
|
||||
MessageAutoDeleteTimerChanged *MessageAutoDeleteTimerChanged `json:"message_auto_delete_timer_changed,omitempty"`
|
||||
MessageAutoDeleteTimerChanged *MessageAutoDeleteTimerChanged `json:"message_auto_delete_timer_changed,omitempty"` // Since: Bot API 5.1
|
||||
MigrateToChatID int64 `json:"migrate_to_chat_id,omitempty"`
|
||||
MigrateFromChatID int64 `json:"migrate_from_chat_id,omitempty"`
|
||||
PinnedMessage *MaybeInaccessibleMessage `json:"pinned_message,omitempty"`
|
||||
|
||||
Invoice *Invoice `json:"invoice,omitempty"`
|
||||
SuccessfulPayment *SuccessfulPayment `json:"successful_payment,omitempty"`
|
||||
RefundedPayment *RefundedPayment `json:"refunded_payment,omitempty"`
|
||||
UsersShared *UsersShared `json:"users_shared,omitempty"`
|
||||
ChatShared *ChatShared `json:"chat_shared,omitempty"`
|
||||
Gift *GiftInfo `json:"gift,omitempty"`
|
||||
UniqueGift *UniqueGiftInfo `json:"unique_gift,omitempty"`
|
||||
GiftUpgradeSent *GiftInfo `json:"gift_upgrade_sent,omitempty"`
|
||||
Invoice *Invoice `json:"invoice,omitempty"` // Since: Bot API 3.0
|
||||
SuccessfulPayment *SuccessfulPayment `json:"successful_payment,omitempty"` // Since: Bot API 3.0
|
||||
RefundedPayment *RefundedPayment `json:"refunded_payment,omitempty"` // Since: Bot API 7.7
|
||||
UsersShared *UsersShared `json:"users_shared,omitempty"` // Since: Bot API 6.5
|
||||
ChatShared *ChatShared `json:"chat_shared,omitempty"` // Since: Bot API 6.5
|
||||
Gift *GiftInfo `json:"gift,omitempty"` // Since: Bot API 9.0
|
||||
UniqueGift *UniqueGiftInfo `json:"unique_gift,omitempty"` // Since: Bot API 9.0
|
||||
GiftUpgradeSent *GiftInfo `json:"gift_upgrade_sent,omitempty"` // Since: Bot API 9.3
|
||||
|
||||
ConnectedWebsite string `json:"connected_website,omitempty"`
|
||||
WriteAccessAllowed *WriteAccessAllowed `json:"write_access_allowed,omitempty"`
|
||||
WriteAccessAllowed *WriteAccessAllowed `json:"write_access_allowed,omitempty"` // Since: Bot API 6.4
|
||||
PassportData *PassportData `json:"passport_data,omitempty"`
|
||||
ProximityAlertTriggered *ProximityAlertTriggered `json:"proximity_alert_triggered,omitempty"`
|
||||
BoostAdded *ChatBoostAdded `json:"boost_added,omitempty"`
|
||||
ChatBackgroundSet *ChatBackground `json:"chat_background_set,omitempty"`
|
||||
ProximityAlertTriggered *ProximityAlertTriggered `json:"proximity_alert_triggered,omitempty"` // Since: Bot API 5.0
|
||||
BoostAdded *ChatBoostAdded `json:"boost_added,omitempty"` // Since: Bot API 7.1
|
||||
ChatBackgroundSet *ChatBackground `json:"chat_background_set,omitempty"` // Since: Bot API 7.5
|
||||
|
||||
ChecklistTaskDone *ChecklistTaskDone `json:"checklist_task_done,omitempty"`
|
||||
ChecklistTasksAdded *ChecklistTasksAdded `json:"checklist_tasks_added,omitempty"`
|
||||
DirectMessagePriceChanged *DirectMessagePriceChanged `json:"direct_message_price_changed,omitempty"`
|
||||
ForumTopicCreated *ForumTopicCreated `json:"forum_topic_created,omitempty"`
|
||||
ForumTopicEdited *ForumTopicEdited `json:"forum_topic_edited,omitempty"`
|
||||
ForumTopicClosed *ForumTopicClosed `json:"forum_topic_closed,omitempty"`
|
||||
ForumTopicReopened *ForumTopicReopened `json:"forum_topic_reopened,omitempty"`
|
||||
GeneralForumTopicHidden *GeneralForumTopicHidden `json:"general_forum_topic_hidden,omitempty"`
|
||||
GeneralForumTopicUnhidden *GeneralForumTopicUnhidden `json:"general_forum_topic_unhidden,omitempty"`
|
||||
ChecklistTaskDone *ChecklistTaskDone `json:"checklist_task_done,omitempty"` // Since: Bot API 9.1
|
||||
ChecklistTasksAdded *ChecklistTasksAdded `json:"checklist_tasks_added,omitempty"` // Since: Bot API 9.1
|
||||
DirectMessagePriceChanged *DirectMessagePriceChanged `json:"direct_message_price_changed,omitempty"` // Since: Bot API 9.1
|
||||
PaidMessagePriceChanged *PaidMessagePriceChanged `json:"paid_message_price_changed,omitempty"` // Since: Bot API 9.x
|
||||
ForumTopicCreated *ForumTopicCreated `json:"forum_topic_created,omitempty"` // Since: Bot API 6.3
|
||||
ForumTopicEdited *ForumTopicEdited `json:"forum_topic_edited,omitempty"` // Since: Bot API 6.4
|
||||
ForumTopicClosed *ForumTopicClosed `json:"forum_topic_closed,omitempty"` // Since: Bot API 6.3
|
||||
ForumTopicReopened *ForumTopicReopened `json:"forum_topic_reopened,omitempty"` // Since: Bot API 6.3
|
||||
GeneralForumTopicHidden *GeneralForumTopicHidden `json:"general_forum_topic_hidden,omitempty"` // Since: Bot API 6.4
|
||||
GeneralForumTopicUnhidden *GeneralForumTopicUnhidden `json:"general_forum_topic_unhidden,omitempty"` // Since: Bot API 6.4
|
||||
|
||||
GiveawayCreated *GiveawayCreated `json:"giveaway_created,omitempty"`
|
||||
Giveaway *Giveaway `json:"giveaway,omitempty"`
|
||||
GiveawayWinners *GiveawayWinners `json:"giveaway_winners,omitempty"`
|
||||
GiveawayCompleted *GiveawayCompleted `json:"giveaway_completed,omitempty"`
|
||||
GiveawayCreated *GiveawayCreated `json:"giveaway_created,omitempty"` // Since: Bot API 7.0
|
||||
Giveaway *Giveaway `json:"giveaway,omitempty"` // Since: Bot API 7.0
|
||||
GiveawayWinners *GiveawayWinners `json:"giveaway_winners,omitempty"` // Since: Bot API 7.0
|
||||
GiveawayCompleted *GiveawayCompleted `json:"giveaway_completed,omitempty"` // Since: Bot API 7.0
|
||||
|
||||
ManagedBotCreated *ManagedBotCreated `json:"managed_bot_created,omitempty"`
|
||||
PaidMessagePriceChanged *PaidMessagePriceChanged `json:"paid_message_price_changed,omitempty"`
|
||||
PollOptionAdded *PollOptionAdded `json:"poll_option_added,omitempty"`
|
||||
PollOptionDeleted *PollOptionDeleted `json:"poll_option_deleted,omitempty"`
|
||||
ManagedBotCreated *ManagedBotCreated `json:"managed_bot_created,omitempty"` // Since: Bot API 9.6
|
||||
PollOptionAdded *PollOptionAdded `json:"poll_option_added,omitempty"` // Since: Bot API 9.6
|
||||
PollOptionDeleted *PollOptionDeleted `json:"poll_option_deleted,omitempty"` // Since: Bot API 9.6
|
||||
|
||||
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"`
|
||||
SuggestedPostApproved *SuggestedPostApproved `json:"suggested_post_approved,omitempty"` // Since: Bot API 9.1
|
||||
SuggestedPostApprovalFailed *SuggestedPostApprovalFailed `json:"suggested_post_approval_failed,omitempty"` // Since: Bot API 9.1
|
||||
SuggestedPostDeclined *SuggestedPostDeclined `json:"suggested_post_declined,omitempty"` // Since: Bot API 9.1
|
||||
SuggestedPostPaid *SuggestedPostPaid `json:"suggested_post_paid,omitempty"` // Since: Bot API 9.1
|
||||
SuggestedPostRefunded *SuggestedPostRefunded `json:"suggested_post_refunded,omitempty"` // Since: Bot API 9.1
|
||||
|
||||
VideoChatScheduled *VideoChatScheduled `json:"video_chat_scheduled,omitempty"`
|
||||
VideoChatStarted *VideoChatStarted `json:"video_chat_started,omitempty"`
|
||||
VideoChatEnded *VideoChatEnded `json:"video_chat_ended,omitempty"`
|
||||
VideoChatParticipantsInvited *VideoChatParticipantsInvited `json:"video_chat_participants_invited,omitempty"`
|
||||
VideoChatScheduled *VideoChatScheduled `json:"video_chat_scheduled,omitempty"` // Since: Bot API 6.0
|
||||
VideoChatStarted *VideoChatStarted `json:"video_chat_started,omitempty"` // Since: Bot API 5.1
|
||||
VideoChatEnded *VideoChatEnded `json:"video_chat_ended,omitempty"` // Since: Bot API 5.1
|
||||
VideoChatParticipantsInvited *VideoChatParticipantsInvited `json:"video_chat_participants_invited,omitempty"` // Since: Bot API 5.1
|
||||
|
||||
WebAppData *WebAppData `json:"web_app_data,omitempty"`
|
||||
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
|
||||
WebAppData *WebAppData `json:"web_app_data,omitempty"` // Since: Bot API 6.0
|
||||
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` // Since: Bot API 4.3
|
||||
}
|
||||
|
||||
// InaccessibleMessage describes a message that was deleted or is otherwise inaccessible.
|
||||
// Since: Bot API 7.0
|
||||
// See https://core.telegram.org/bots/api#inaccessiblemessage
|
||||
type InaccessibleMessage struct {
|
||||
Chat Chat `json:"chat"`
|
||||
@@ -228,6 +250,7 @@ type InaccessibleMessage struct {
|
||||
}
|
||||
|
||||
// MaybeInaccessibleMessage is a union type that can be either Message or InaccessibleMessage.
|
||||
// Since: Bot API 7.0
|
||||
// See https://core.telegram.org/bots/api#maybeinaccessiblemessage
|
||||
type MaybeInaccessibleMessage struct {
|
||||
msg *Message
|
||||
@@ -331,11 +354,11 @@ const (
|
||||
// MessageEntityStrike identifies strikethrough text.
|
||||
MessageEntityStrike MessageEntityType = "strikethrough"
|
||||
// MessageEntitySpoiler identifies spoiler text.
|
||||
MessageEntitySpoiler MessageEntityType = "spoiler"
|
||||
MessageEntitySpoiler MessageEntityType = "spoiler" // Since: Bot API 5.6
|
||||
// MessageEntityBlockquote identifies a blockquote entity.
|
||||
MessageEntityBlockquote MessageEntityType = "blockquote"
|
||||
// MessageEntityExpandableBlockquote identifies an expandable blockquote entity.
|
||||
MessageEntityExpandableBlockquote MessageEntityType = "expandable_blockquote"
|
||||
MessageEntityExpandableBlockquote MessageEntityType = "expandable_blockquote" // Since: Bot API 7.5
|
||||
// MessageEntityCode identifies inline code.
|
||||
MessageEntityCode MessageEntityType = "code"
|
||||
// MessageEntityPre identifies a preformatted block.
|
||||
@@ -345,12 +368,13 @@ const (
|
||||
// MessageEntityTextMention identifies a text mention.
|
||||
MessageEntityTextMention MessageEntityType = "text_mention"
|
||||
// MessageEntityCustomEmoji identifies a custom emoji entity.
|
||||
MessageEntityCustomEmoji MessageEntityType = "custom_emoji"
|
||||
MessageEntityCustomEmoji MessageEntityType = "custom_emoji" // Since: Bot API 6.2
|
||||
// MessageEntityDateTime identifies a date-time entity.
|
||||
MessageEntityDateTime MessageEntityType = "date_time"
|
||||
MessageEntityDateTime MessageEntityType = "date_time" // Since: Bot API 9.5
|
||||
)
|
||||
|
||||
// MessageEntity represents one special entity in a text message.
|
||||
// Since: Bot API 2.0
|
||||
// See https://core.telegram.org/bots/api#messageentity
|
||||
type MessageEntity struct {
|
||||
Type MessageEntityType `json:"type"`
|
||||
@@ -360,13 +384,14 @@ type MessageEntity struct {
|
||||
URL string `json:"url,omitempty"`
|
||||
User *User `json:"user,omitempty"`
|
||||
Language string `json:"language,omitempty"`
|
||||
CustomEmojiID string `json:"custom_emoji_id,omitempty"`
|
||||
CustomEmojiID string `json:"custom_emoji_id,omitempty"` // Since: Bot API 6.2
|
||||
|
||||
UnixTime int64 `json:"unix_time,omitempty"`
|
||||
DateTimeFormat string `json:"date_time_format,omitempty"`
|
||||
DateTimeFormat string `json:"date_time_format,omitempty"` // Since: Bot API 9.5
|
||||
}
|
||||
|
||||
// ReplyParameters describes the parameters to use when replying to a message.
|
||||
// Since: Bot API 7.0
|
||||
// See https://core.telegram.org/bots/api#replyparameters
|
||||
type ReplyParameters struct {
|
||||
MessageID int `json:"message_id"`
|
||||
@@ -382,6 +407,7 @@ type ReplyParameters struct {
|
||||
}
|
||||
|
||||
// LinkPreviewOptions describes the options used for link preview generation.
|
||||
// Since: Bot API 7.0
|
||||
// See https://core.telegram.org/bots/api#linkpreviewoptions
|
||||
type LinkPreviewOptions struct {
|
||||
IsDisabled bool `json:"is_disabled,omitempty"`
|
||||
@@ -392,6 +418,7 @@ type LinkPreviewOptions struct {
|
||||
}
|
||||
|
||||
// ReplyMarkup represents a custom keyboard or inline keyboard.
|
||||
// Since: Bot API 1.0
|
||||
// See https://core.telegram.org/bots/api#replymarkup
|
||||
type ReplyMarkup struct {
|
||||
InlineKeyboard [][]InlineKeyboardButton `json:"inline_keyboard,omitempty"`
|
||||
@@ -409,6 +436,7 @@ type ReplyMarkup struct {
|
||||
}
|
||||
|
||||
// InlineKeyboardMarkup represents an inline keyboard that appears right next to the message it belongs to.
|
||||
// Since: Bot API 2.0
|
||||
// See https://core.telegram.org/bots/api#inlinekeyboardmarkup
|
||||
type InlineKeyboardMarkup struct {
|
||||
InlineKeyboard [][]InlineKeyboardButton `json:"inline_keyboard,omitempty"`
|
||||
@@ -427,21 +455,23 @@ const (
|
||||
)
|
||||
|
||||
// KeyboardButton represents one button of the reply keyboard.
|
||||
// Since: Bot API 2.0
|
||||
// See https://core.telegram.org/bots/api#keyboardbutton
|
||||
type KeyboardButton struct {
|
||||
Text string `json:"text"`
|
||||
IconCustomEmojiID string `json:"icon_custom_emoji_id,omitempty"`
|
||||
Style KeyboardButtonStyle `json:"style,omitempty"`
|
||||
RequestUsers *KeyboardButtonRequestUsers `json:"request_users,omitempty"`
|
||||
RequestChat *KeyboardButtonRequestChat `json:"request_chat,omitempty"`
|
||||
RequestManagedBot *KeyboardButtonRequestManagedBot `json:"request_managed_bot,omitempty"`
|
||||
IconCustomEmojiID string `json:"icon_custom_emoji_id,omitempty"` // Since: Bot API 9.4
|
||||
Style KeyboardButtonStyle `json:"style,omitempty"` // Since: Bot API 9.4
|
||||
RequestUsers *KeyboardButtonRequestUsers `json:"request_users,omitempty"` // Since: Bot API 7.0
|
||||
RequestChat *KeyboardButtonRequestChat `json:"request_chat,omitempty"` // Since: Bot API 6.5
|
||||
RequestManagedBot *KeyboardButtonRequestManagedBot `json:"request_managed_bot,omitempty"` // Since: Bot API 9.6
|
||||
RequestContact bool `json:"request_contact,omitempty"`
|
||||
RequestLocation bool `json:"request_location,omitempty"`
|
||||
RequestPoll *KeyboardButtonPollType `json:"request_poll,omitempty"`
|
||||
WebApp *WebAppInfo `json:"web_app,omitempty"`
|
||||
RequestPoll *KeyboardButtonPollType `json:"request_poll,omitempty"` // Since: Bot API 4.6
|
||||
WebApp *WebAppInfo `json:"web_app,omitempty"` // Since: Bot API 6.0
|
||||
}
|
||||
|
||||
// KeyboardButtonRequestUsers defines criteria used to request suitable users.
|
||||
// Since: Bot API 7.0
|
||||
// See https://core.telegram.org/bots/api#keyboardbuttonrequestusers
|
||||
type KeyboardButtonRequestUsers struct {
|
||||
RequestID int `json:"request_id"`
|
||||
@@ -454,6 +484,7 @@ type KeyboardButtonRequestUsers struct {
|
||||
}
|
||||
|
||||
// KeyboardButtonRequestChat defines criteria used to request a suitable chat.
|
||||
// Since: Bot API 6.5
|
||||
// See https://core.telegram.org/bots/api#keyboardbuttonrequestchat
|
||||
type KeyboardButtonRequestChat struct {
|
||||
RequestID int `json:"request_id"`
|
||||
@@ -470,6 +501,7 @@ type KeyboardButtonRequestChat struct {
|
||||
}
|
||||
|
||||
// KeyboardButtonRequestManagedBot defines criteria used to request a managed bot.
|
||||
// Since: Bot API 9.6
|
||||
// See https://core.telegram.org/bots/api#keyboardbuttonrequestmanagedbot
|
||||
type KeyboardButtonRequestManagedBot struct {
|
||||
RequestID int32 `json:"request_id"`
|
||||
@@ -478,22 +510,25 @@ type KeyboardButtonRequestManagedBot struct {
|
||||
}
|
||||
|
||||
// KeyboardButtonPollType represents the type of a poll that may be created from a keyboard button.
|
||||
// Since: Bot API 4.6
|
||||
// See https://core.telegram.org/bots/api#keyboardbuttonpolltype
|
||||
type KeyboardButtonPollType struct {
|
||||
Type PollType `json:"type,omitempty"`
|
||||
}
|
||||
|
||||
// InlineKeyboardButton represents one button of an inline keyboard.
|
||||
// Since: Bot API 2.0
|
||||
// See https://core.telegram.org/bots/api#inlinekeyboardbutton
|
||||
type InlineKeyboardButton struct {
|
||||
Text string `json:"text"`
|
||||
URL string `json:"url,omitempty"`
|
||||
CallbackData string `json:"callback_data,omitempty"`
|
||||
Style KeyboardButtonStyle `json:"style,omitempty"`
|
||||
IconCustomEmojiID string `json:"icon_custom_emoji_id,omitempty"`
|
||||
Style KeyboardButtonStyle `json:"style,omitempty"` // Since: Bot API 9.4
|
||||
IconCustomEmojiID string `json:"icon_custom_emoji_id,omitempty"` // Since: Bot API 9.4
|
||||
}
|
||||
|
||||
// ReplyKeyboardMarkup represents a custom keyboard with reply options.
|
||||
// Since: Bot API 1.0
|
||||
// See https://core.telegram.org/bots/api#replykeyboardmarkup
|
||||
type ReplyKeyboardMarkup struct {
|
||||
Keyboard [][]KeyboardButton `json:"keyboard"`
|
||||
@@ -505,6 +540,7 @@ type ReplyKeyboardMarkup struct {
|
||||
}
|
||||
|
||||
// CallbackQuery represents an incoming callback query from a callback button in an inline keyboard.
|
||||
// Since: Bot API 2.0
|
||||
// See https://core.telegram.org/bots/api#callbackquery
|
||||
type CallbackQuery struct {
|
||||
ID string `json:"id"`
|
||||
@@ -541,6 +577,7 @@ const (
|
||||
)
|
||||
|
||||
// MessageReactionUpdated represents a change of a reaction on a message.
|
||||
// Since: Bot API 7.0
|
||||
// See https://core.telegram.org/bots/api#messagereactionupdated
|
||||
type MessageReactionUpdated struct {
|
||||
Chat *Chat `json:"chat"`
|
||||
@@ -553,6 +590,7 @@ type MessageReactionUpdated struct {
|
||||
}
|
||||
|
||||
// MessageReactionCountUpdated represents a change in the count of reactions on a message.
|
||||
// Since: Bot API 7.0
|
||||
// See https://core.telegram.org/bots/api#messagereactioncountupdated
|
||||
type MessageReactionCountUpdated struct {
|
||||
Chat *Chat `json:"chat"`
|
||||
@@ -562,6 +600,7 @@ type MessageReactionCountUpdated struct {
|
||||
}
|
||||
|
||||
// ReactionType describes the type of a reaction.
|
||||
// Since: Bot API 7.0
|
||||
// See https://core.telegram.org/bots/api#reactiontype
|
||||
type ReactionType struct {
|
||||
Type string `json:"type"`
|
||||
@@ -572,6 +611,7 @@ type ReactionType struct {
|
||||
}
|
||||
|
||||
// ReactionCount represents a reaction added to a message along with the number of times it was added.
|
||||
// Since: Bot API 7.0
|
||||
// See https://core.telegram.org/bots/api#reactioncount
|
||||
type ReactionCount struct {
|
||||
Type ReactionType `json:"type"`
|
||||
@@ -579,12 +619,14 @@ type ReactionCount struct {
|
||||
}
|
||||
|
||||
// SuggestedPostPrice represents the price of a suggested post.
|
||||
// Since: Bot API 9.1
|
||||
type SuggestedPostPrice struct {
|
||||
Currency string `json:"currency"`
|
||||
Amount int `json:"amount"`
|
||||
}
|
||||
|
||||
// SuggestedPostInfo contains information about a suggested post.
|
||||
// Since: Bot API 9.1
|
||||
// See https://core.telegram.org/bots/api#suggestedpostinfo
|
||||
type SuggestedPostInfo struct {
|
||||
State string `json:"state"` // "pending", "approved", or "declined"
|
||||
@@ -593,24 +635,29 @@ type SuggestedPostInfo struct {
|
||||
}
|
||||
|
||||
// SuggestedPostParameters holds parameters for suggesting a post.
|
||||
// Since: Bot API 9.2
|
||||
type SuggestedPostParameters struct {
|
||||
Price SuggestedPostPrice `json:"price"`
|
||||
SendDate int `json:"send_date"`
|
||||
}
|
||||
|
||||
// ManagedBotCreated describes a service message about a newly created managed bot.
|
||||
// Since: Bot API 9.6
|
||||
// See https://core.telegram.org/bots/api#managedbotcreated
|
||||
type ManagedBotCreated struct {
|
||||
Bot User `json:"bot"`
|
||||
}
|
||||
|
||||
// ManagedBotUpdated describes an update about a managed bot and its manager.
|
||||
// Since: Bot API 9.6
|
||||
// See https://core.telegram.org/bots/api#managedbotupdated
|
||||
type ManagedBotUpdated struct {
|
||||
User User `json:"user"`
|
||||
Bot User `json:"bot"`
|
||||
}
|
||||
|
||||
// SharedUser represents a user shared via a KeyboardButtonRequestUsers button.
|
||||
// Since: Bot API 7.2
|
||||
type SharedUser struct {
|
||||
UserID int64 `json:"user_id"`
|
||||
FirstName string `json:"first_name,omitempty"`
|
||||
@@ -618,10 +665,16 @@ type SharedUser struct {
|
||||
Username string `json:"username,omitempty"`
|
||||
Photo []PhotoSize `json:"photo,omitempty"`
|
||||
}
|
||||
|
||||
// UsersShared represents a service message about users shared via a KeyboardButtonRequestUsers button.
|
||||
// Since: Bot API 6.5
|
||||
type UsersShared struct {
|
||||
RequestID int `json:"request_id"`
|
||||
Users []SharedUser `json:"users"`
|
||||
}
|
||||
|
||||
// ChatShared represents a service message about a chat shared via a KeyboardButtonRequestChat button.
|
||||
// Since: Bot API 6.5
|
||||
type ChatShared struct {
|
||||
RequestID int `json:"request_id"`
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -630,37 +683,68 @@ type ChatShared struct {
|
||||
Photo []PhotoSize `json:"photo,omitempty"`
|
||||
}
|
||||
|
||||
// SuggestedPostApproved is a service message about an approved suggested post.
|
||||
// Since: Bot API 9.1
|
||||
type SuggestedPostApproved struct {
|
||||
SuggestedPostMessage *Message `json:"suggested_post_message,omitempty"`
|
||||
Price SuggestedPostPrice `json:"price"`
|
||||
SendDate int `json:"send_date"`
|
||||
}
|
||||
|
||||
// SuggestedPostApprovalFailed is a service message about a failed suggested post approval.
|
||||
// Since: Bot API 9.1
|
||||
type SuggestedPostApprovalFailed struct {
|
||||
SuggestedPostMessage *Message `json:"suggested_post_message,omitempty"`
|
||||
Price SuggestedPostPrice `json:"price"`
|
||||
}
|
||||
|
||||
// SuggestedPostDeclined is a service message about a declined suggested post.
|
||||
// Since: Bot API 9.1
|
||||
type SuggestedPostDeclined struct {
|
||||
SuggestedPostMessage *Message `json:"suggested_post_message,omitempty"`
|
||||
Comment string `json:"comment,omitempty"`
|
||||
}
|
||||
|
||||
// SuggestedPostPaid is a service message about a paid suggested post.
|
||||
// Since: Bot API 9.1
|
||||
type SuggestedPostPaid struct {
|
||||
SuggestedPostMessage *Message `json:"suggested_post_message,omitempty"`
|
||||
Currency string `json:"currency"`
|
||||
Amount int `json:"amount"`
|
||||
StarAmount *StarAmount `json:"star_amount,omitempty"`
|
||||
}
|
||||
|
||||
// SuggestedPostRefunded is a service message about a refunded suggested post.
|
||||
// Since: Bot API 9.1
|
||||
type SuggestedPostRefunded struct {
|
||||
SuggestedPostMessage *Message `json:"suggested_post_message,omitempty"`
|
||||
Reason string `json:"reason,omitempty"`
|
||||
}
|
||||
|
||||
// VideoChatScheduled represents a service message about a video chat scheduled in the chat.
|
||||
// Since: Bot API 6.0
|
||||
type VideoChatScheduled struct {
|
||||
StartDate int64 `json:"start_date"`
|
||||
}
|
||||
|
||||
// VideoChatStarted represents a service message about a video chat started in the chat.
|
||||
// Since: Bot API 5.1
|
||||
type VideoChatStarted struct{}
|
||||
|
||||
// VideoChatEnded represents a service message about a video chat ended in the chat.
|
||||
// Since: Bot API 5.1
|
||||
type VideoChatEnded struct {
|
||||
Duration int64 `json:"duration"`
|
||||
}
|
||||
|
||||
// VideoChatParticipantsInvited represents a service message about new members invited to a video chat.
|
||||
// Since: Bot API 5.1
|
||||
type VideoChatParticipantsInvited struct {
|
||||
Users []User `json:"users"`
|
||||
}
|
||||
|
||||
// SentGuestMessage describes an inline message sent by a guest bot.
|
||||
// Since: Bot API 10.0
|
||||
type SentGuestMessage struct {
|
||||
InlineMessageID string `json:"inline_message_id"`
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package tgapi
|
||||
import "context"
|
||||
|
||||
// SetPassportDataErrors holds parameters for the setPassportDataErrors method.
|
||||
// Since: Bot API 4.0
|
||||
// See https://core.telegram.org/bots/api#setpassportdataerrors
|
||||
type SetPassportDataErrors struct {
|
||||
UserID int64 `json:"user_id"`
|
||||
@@ -10,6 +11,7 @@ type SetPassportDataErrors struct {
|
||||
}
|
||||
|
||||
// SetPassportDataErrors informs a user about Telegram Passport data errors.
|
||||
// Since: Bot API 4.0
|
||||
// Returns true on success.
|
||||
// See https://core.telegram.org/bots/api#setpassportdataerrors
|
||||
func (api *API) SetPassportDataErrors(params SetPassportDataErrors) (bool, error) {
|
||||
@@ -18,6 +20,7 @@ func (api *API) SetPassportDataErrors(params SetPassportDataErrors) (bool, error
|
||||
}
|
||||
|
||||
// SetPassportDataErrorsWithContext is the context-aware variant of SetPassportDataErrors.
|
||||
// Since: Bot API 4.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#setpassportdataerrors
|
||||
func (api *API) SetPassportDataErrorsWithContext(ctx context.Context, params SetPassportDataErrors) (bool, error) {
|
||||
|
||||
@@ -1,15 +1,22 @@
|
||||
package tgapi
|
||||
|
||||
// PassportData contains information about Telegram Passport data shared with the bot.
|
||||
// Since: Bot API 4.0
|
||||
type PassportData struct {
|
||||
Data []EncryptedPassportElement `json:"data"`
|
||||
Credentials EncryptedCredentials `json:"credentials"`
|
||||
}
|
||||
|
||||
// PassportFile represents a file uploaded to Telegram Passport.
|
||||
// Since: Bot API 4.0
|
||||
type PassportFile struct {
|
||||
FileID string `json:"file_id"`
|
||||
FileUniqueID string `json:"file_unique_id"`
|
||||
FileSize int64 `json:"file_size"`
|
||||
FileDate int64 `json:"file_date"`
|
||||
}
|
||||
|
||||
// PassportElementType represents the type of a Telegram Passport element.
|
||||
type PassportElementType string
|
||||
|
||||
const (
|
||||
@@ -28,6 +35,8 @@ const (
|
||||
PassportEmailType PassportElementType = "email"
|
||||
)
|
||||
|
||||
// EncryptedPassportElement contains information about documents or other Telegram Passport elements.
|
||||
// Since: Bot API 4.0
|
||||
type EncryptedPassportElement struct {
|
||||
Type PassportElementType `json:"type"`
|
||||
Data string `json:"data,omitempty"`
|
||||
@@ -40,6 +49,9 @@ type EncryptedPassportElement struct {
|
||||
Translation *PassportFile `json:"translation,omitempty"`
|
||||
Hash string `json:"hash,omitempty"`
|
||||
}
|
||||
|
||||
// EncryptedCredentials contains data required for decrypting and authenticating EncryptedPassportElement.
|
||||
// Since: Bot API 4.0
|
||||
type EncryptedCredentials struct {
|
||||
Data string `json:"data"`
|
||||
Hash string `json:"hash"`
|
||||
@@ -47,6 +59,7 @@ type EncryptedCredentials struct {
|
||||
}
|
||||
|
||||
// PassportElementError is a JSON-serializable passport element error object.
|
||||
// Since: Bot API 4.0
|
||||
// See https://core.telegram.org/bots/api#passportelementerror
|
||||
type PassportElementError struct {
|
||||
Source string `json:"source"`
|
||||
|
||||
@@ -3,6 +3,7 @@ package tgapi
|
||||
import "context"
|
||||
|
||||
// SendInvoice holds parameters for the sendInvoice method.
|
||||
// Since: Bot API 3.0
|
||||
// See https://core.telegram.org/bots/api#sendinvoice
|
||||
type SendInvoice struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
@@ -42,6 +43,7 @@ type SendInvoice struct {
|
||||
}
|
||||
|
||||
// SendInvoice sends an invoice.
|
||||
// Since: Bot API 3.0
|
||||
// See https://core.telegram.org/bots/api#sendinvoice
|
||||
func (api *API) SendInvoice(params SendInvoice) (Message, error) {
|
||||
req := NewRequestWithChatID[Message]("sendInvoice", params, params.ChatID)
|
||||
@@ -49,6 +51,7 @@ func (api *API) SendInvoice(params SendInvoice) (Message, error) {
|
||||
}
|
||||
|
||||
// SendInvoiceWithContext is the context-aware variant of SendInvoice.
|
||||
// Since: Bot API 3.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#sendinvoice
|
||||
func (api *API) SendInvoiceWithContext(ctx context.Context, params SendInvoice) (Message, error) {
|
||||
@@ -57,6 +60,7 @@ func (api *API) SendInvoiceWithContext(ctx context.Context, params SendInvoice)
|
||||
}
|
||||
|
||||
// CreateInvoiceLink holds parameters for the createInvoiceLink method.
|
||||
// Since: Bot API 6.1
|
||||
// See https://core.telegram.org/bots/api#createinvoicelink
|
||||
type CreateInvoiceLink struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -86,6 +90,7 @@ type CreateInvoiceLink struct {
|
||||
}
|
||||
|
||||
// CreateInvoiceLink creates an invoice link.
|
||||
// Since: Bot API 6.1
|
||||
// See https://core.telegram.org/bots/api#createinvoicelink
|
||||
func (api *API) CreateInvoiceLink(params CreateInvoiceLink) (string, error) {
|
||||
req := NewRequest[string]("createInvoiceLink", params)
|
||||
@@ -93,6 +98,7 @@ func (api *API) CreateInvoiceLink(params CreateInvoiceLink) (string, error) {
|
||||
}
|
||||
|
||||
// CreateInvoiceLinkWithContext is the context-aware variant of CreateInvoiceLink.
|
||||
// Since: Bot API 6.1
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#createinvoicelink
|
||||
func (api *API) CreateInvoiceLinkWithContext(ctx context.Context, params CreateInvoiceLink) (string, error) {
|
||||
@@ -101,6 +107,7 @@ func (api *API) CreateInvoiceLinkWithContext(ctx context.Context, params CreateI
|
||||
}
|
||||
|
||||
// AnswerShippingQuery holds parameters for the answerShippingQuery method.
|
||||
// Since: Bot API 3.0
|
||||
// See https://core.telegram.org/bots/api#answershippingquery
|
||||
type AnswerShippingQuery struct {
|
||||
ShippingQueryID string `json:"shipping_query_id"`
|
||||
@@ -110,6 +117,7 @@ type AnswerShippingQuery struct {
|
||||
}
|
||||
|
||||
// AnswerShippingQuery answers a shipping query.
|
||||
// Since: Bot API 3.0
|
||||
// Returns true on success.
|
||||
// See https://core.telegram.org/bots/api#answershippingquery
|
||||
func (api *API) AnswerShippingQuery(params AnswerShippingQuery) (bool, error) {
|
||||
@@ -118,6 +126,7 @@ func (api *API) AnswerShippingQuery(params AnswerShippingQuery) (bool, error) {
|
||||
}
|
||||
|
||||
// AnswerShippingQueryWithContext is the context-aware variant of AnswerShippingQuery.
|
||||
// Since: Bot API 3.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#answershippingquery
|
||||
func (api *API) AnswerShippingQueryWithContext(ctx context.Context, params AnswerShippingQuery) (bool, error) {
|
||||
@@ -126,6 +135,7 @@ func (api *API) AnswerShippingQueryWithContext(ctx context.Context, params Answe
|
||||
}
|
||||
|
||||
// AnswerPreCheckoutQuery holds parameters for the answerPreCheckoutQuery method.
|
||||
// Since: Bot API 3.0
|
||||
// See https://core.telegram.org/bots/api#answerprecheckoutquery
|
||||
type AnswerPreCheckoutQuery struct {
|
||||
PreCheckoutQueryID string `json:"pre_checkout_query_id"`
|
||||
@@ -134,6 +144,7 @@ type AnswerPreCheckoutQuery struct {
|
||||
}
|
||||
|
||||
// AnswerPreCheckoutQuery answers a pre-checkout query.
|
||||
// Since: Bot API 3.0
|
||||
// Returns true on success.
|
||||
// See https://core.telegram.org/bots/api#answerprecheckoutquery
|
||||
func (api *API) AnswerPreCheckoutQuery(params AnswerPreCheckoutQuery) (bool, error) {
|
||||
@@ -142,6 +153,7 @@ func (api *API) AnswerPreCheckoutQuery(params AnswerPreCheckoutQuery) (bool, err
|
||||
}
|
||||
|
||||
// AnswerPreCheckoutQueryWithContext is the context-aware variant of AnswerPreCheckoutQuery.
|
||||
// Since: Bot API 3.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#answerprecheckoutquery
|
||||
func (api *API) AnswerPreCheckoutQueryWithContext(ctx context.Context, params AnswerPreCheckoutQuery) (bool, error) {
|
||||
|
||||
+16
-3
@@ -1,12 +1,15 @@
|
||||
package tgapi
|
||||
|
||||
// LabeledPrice represents a price portion.
|
||||
// Since: Bot API 3.0
|
||||
// See https://core.telegram.org/bots/api#labeledprice
|
||||
type LabeledPrice struct {
|
||||
Label string `json:"label"`
|
||||
Amount int `json:"amount"`
|
||||
}
|
||||
|
||||
// Invoice contains basic information about an invoice.
|
||||
// Since: Bot API 3.0
|
||||
type Invoice struct {
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
@@ -16,6 +19,7 @@ type Invoice struct {
|
||||
}
|
||||
|
||||
// ShippingQuery represents an incoming shipping query.
|
||||
// Since: Bot API 3.0
|
||||
// See https://core.telegram.org/bots/api#shippingquery
|
||||
type ShippingQuery struct {
|
||||
ID string `json:"id"`
|
||||
@@ -25,6 +29,7 @@ type ShippingQuery struct {
|
||||
}
|
||||
|
||||
// ShippingAddress represents a shipping address.
|
||||
// Since: Bot API 3.0
|
||||
// See https://core.telegram.org/bots/api#shippingaddress
|
||||
type ShippingAddress struct {
|
||||
CountryCode string `json:"country_code"`
|
||||
@@ -36,6 +41,7 @@ type ShippingAddress struct {
|
||||
}
|
||||
|
||||
// OrderInfo represents information about an order.
|
||||
// Since: Bot API 3.0
|
||||
// See https://core.telegram.org/bots/api#orderinfo
|
||||
type OrderInfo struct {
|
||||
Name string `json:"name"`
|
||||
@@ -45,6 +51,7 @@ type OrderInfo struct {
|
||||
}
|
||||
|
||||
// PreCheckoutQuery represents an incoming pre-checkout query.
|
||||
// Since: Bot API 3.0
|
||||
// See https://core.telegram.org/bots/api#precheckoutquery
|
||||
type PreCheckoutQuery struct {
|
||||
ID string `json:"id"`
|
||||
@@ -57,6 +64,7 @@ type PreCheckoutQuery struct {
|
||||
}
|
||||
|
||||
// PaidMediaPurchased represents a purchased paid media.
|
||||
// Since: Bot API 7.10
|
||||
// See https://core.telegram.org/bots/api#paidmediapurchased
|
||||
type PaidMediaPurchased struct {
|
||||
From User `json:"from"`
|
||||
@@ -64,6 +72,7 @@ type PaidMediaPurchased struct {
|
||||
}
|
||||
|
||||
// ShippingOption represents one shipping option.
|
||||
// Since: Bot API 3.0
|
||||
// See https://core.telegram.org/bots/api#shippingoption
|
||||
type ShippingOption struct {
|
||||
ID string `json:"id"`
|
||||
@@ -71,14 +80,16 @@ type ShippingOption struct {
|
||||
Prices []LabeledPrice `json:"prices"`
|
||||
}
|
||||
|
||||
// SuccessfulPayment contains basic information about a successful payment.
|
||||
// Since: Bot API 3.0
|
||||
type SuccessfulPayment struct {
|
||||
Currency string `json:"currency"`
|
||||
TotalAmount int `json:"total_amount"`
|
||||
InvoicePayload string `json:"invoice_payload"`
|
||||
|
||||
SubscriptionExpirationDate int `json:"subscription_expiration_date,omitempty"`
|
||||
IsRecurring bool `json:"is_recurring,omitempty"`
|
||||
IsFirstRecurring bool `json:"is_first_recurring,omitempty"`
|
||||
SubscriptionExpirationDate int `json:"subscription_expiration_date,omitempty"` // Since: Bot API 8.0
|
||||
IsRecurring bool `json:"is_recurring,omitempty"` // Since: Bot API 8.0
|
||||
IsFirstRecurring bool `json:"is_first_recurring,omitempty"` // Since: Bot API 8.0
|
||||
ShippingOptionID string `json:"shipping_option_id,omitempty"`
|
||||
OrderInfo *OrderInfo `json:"order_info,omitempty"`
|
||||
|
||||
@@ -86,6 +97,8 @@ type SuccessfulPayment struct {
|
||||
ProviderPaymentChargeID string `json:"proviced_payment_charge_id"`
|
||||
}
|
||||
|
||||
// RefundedPayment contains basic information about a refunded payment.
|
||||
// Since: Bot API 7.7
|
||||
type RefundedPayment struct {
|
||||
Currency string `json:"currency"`
|
||||
TotalAmount int `json:"total_amount"`
|
||||
|
||||
@@ -3,6 +3,7 @@ package tgapi
|
||||
import "context"
|
||||
|
||||
// GetStarTransactions holds parameters for the getStarTransactions method.
|
||||
// Since: Bot API 7.5
|
||||
// See https://core.telegram.org/bots/api#getstartransactions
|
||||
type GetStarTransactions struct {
|
||||
Offset int `json:"offset,omitempty"`
|
||||
@@ -10,6 +11,7 @@ type GetStarTransactions struct {
|
||||
}
|
||||
|
||||
// GetMyStarBalance returns the bot's Telegram Star balance.
|
||||
// Since: Bot API 7.5
|
||||
// See https://core.telegram.org/bots/api#getmystarbalance
|
||||
func (api *API) GetMyStarBalance() (StarAmount, error) {
|
||||
req := NewRequest[StarAmount]("getMyStarBalance", NoParams)
|
||||
@@ -17,6 +19,7 @@ func (api *API) GetMyStarBalance() (StarAmount, error) {
|
||||
}
|
||||
|
||||
// GetMyStarBalanceWithContext is the context-aware variant of GetMyStarBalance.
|
||||
// Since: Bot API 7.5
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#getmystarbalance
|
||||
func (api *API) GetMyStarBalanceWithContext(ctx context.Context) (StarAmount, error) {
|
||||
@@ -25,6 +28,7 @@ func (api *API) GetMyStarBalanceWithContext(ctx context.Context) (StarAmount, er
|
||||
}
|
||||
|
||||
// GetStarTransactions returns Telegram Star transactions for the bot.
|
||||
// Since: Bot API 7.5
|
||||
// See https://core.telegram.org/bots/api#getstartransactions
|
||||
func (api *API) GetStarTransactions(params GetStarTransactions) (StarTransactions, error) {
|
||||
req := NewRequest[StarTransactions]("getStarTransactions", params)
|
||||
@@ -32,6 +36,7 @@ func (api *API) GetStarTransactions(params GetStarTransactions) (StarTransaction
|
||||
}
|
||||
|
||||
// GetStarTransactionsWithContext is the context-aware variant of GetStarTransactions.
|
||||
// Since: Bot API 7.5
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#getstartransactions
|
||||
func (api *API) GetStarTransactionsWithContext(ctx context.Context, params GetStarTransactions) (StarTransactions, error) {
|
||||
@@ -40,6 +45,7 @@ func (api *API) GetStarTransactionsWithContext(ctx context.Context, params GetSt
|
||||
}
|
||||
|
||||
// RefundStarPayment holds parameters for the refundStarPayment method.
|
||||
// Since: Bot API 7.4
|
||||
// See https://core.telegram.org/bots/api#refundstarpayment
|
||||
type RefundStarPayment struct {
|
||||
UserID int64 `json:"user_id"`
|
||||
@@ -47,6 +53,7 @@ type RefundStarPayment struct {
|
||||
}
|
||||
|
||||
// RefundStarPayment refunds a successful Telegram Stars payment.
|
||||
// Since: Bot API 7.4
|
||||
// Returns true on success.
|
||||
// See https://core.telegram.org/bots/api#refundstarpayment
|
||||
func (api *API) RefundStarPayment(params RefundStarPayment) (bool, error) {
|
||||
@@ -55,6 +62,7 @@ func (api *API) RefundStarPayment(params RefundStarPayment) (bool, error) {
|
||||
}
|
||||
|
||||
// RefundStarPaymentWithContext is the context-aware variant of RefundStarPayment.
|
||||
// Since: Bot API 7.4
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#refundstarpayment
|
||||
func (api *API) RefundStarPaymentWithContext(ctx context.Context, params RefundStarPayment) (bool, error) {
|
||||
@@ -63,6 +71,7 @@ func (api *API) RefundStarPaymentWithContext(ctx context.Context, params RefundS
|
||||
}
|
||||
|
||||
// EditUserStarSubscription holds parameters for the editUserStarSubscription method.
|
||||
// Since: Bot API 8.0
|
||||
// See https://core.telegram.org/bots/api#edituserstarsubscription
|
||||
type EditUserStarSubscription struct {
|
||||
UserID int64 `json:"user_id"`
|
||||
@@ -71,6 +80,7 @@ type EditUserStarSubscription struct {
|
||||
}
|
||||
|
||||
// EditUserStarSubscription cancels or re-enables a user star subscription extension.
|
||||
// Since: Bot API 8.0
|
||||
// Returns true on success.
|
||||
// See https://core.telegram.org/bots/api#edituserstarsubscription
|
||||
func (api *API) EditUserStarSubscription(params EditUserStarSubscription) (bool, error) {
|
||||
@@ -79,6 +89,7 @@ func (api *API) EditUserStarSubscription(params EditUserStarSubscription) (bool,
|
||||
}
|
||||
|
||||
// EditUserStarSubscriptionWithContext is the context-aware variant of EditUserStarSubscription.
|
||||
// Since: Bot API 8.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#edituserstarsubscription
|
||||
func (api *API) EditUserStarSubscriptionWithContext(ctx context.Context, params EditUserStarSubscription) (bool, error) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package tgapi
|
||||
|
||||
// StarTransaction describes a Telegram Star transaction.
|
||||
// Since: Bot API 7.5
|
||||
// See https://core.telegram.org/bots/api#startransaction
|
||||
type StarTransaction struct {
|
||||
ID string `json:"id"`
|
||||
@@ -12,6 +13,7 @@ type StarTransaction struct {
|
||||
}
|
||||
|
||||
// StarTransactions contains a list of Telegram Star transactions.
|
||||
// Since: Bot API 7.5
|
||||
// See https://core.telegram.org/bots/api#startransactions
|
||||
type StarTransactions struct {
|
||||
Transactions []StarTransaction `json:"transactions"`
|
||||
|
||||
@@ -3,6 +3,7 @@ package tgapi
|
||||
import "context"
|
||||
|
||||
// SendSticker holds parameters for the sendSticker method.
|
||||
// Since: Bot API 1.3
|
||||
// See https://core.telegram.org/bots/api#sendsticker
|
||||
type SendSticker struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -23,6 +24,7 @@ type SendSticker struct {
|
||||
}
|
||||
|
||||
// SendSticker sends a static .WEBP, animated .TGS, or video .WEBM sticker.
|
||||
// Since: Bot API 1.3
|
||||
// See https://core.telegram.org/bots/api#sendsticker
|
||||
func (api *API) SendSticker(params SendSticker) (Message, error) {
|
||||
req := NewRequestWithChatID[Message]("sendSticker", params, params.ChatID)
|
||||
@@ -30,6 +32,7 @@ func (api *API) SendSticker(params SendSticker) (Message, error) {
|
||||
}
|
||||
|
||||
// SendStickerWithContext is the context-aware variant of SendSticker.
|
||||
// Since: Bot API 1.3
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#sendsticker
|
||||
func (api *API) SendStickerWithContext(ctx context.Context, params SendSticker) (Message, error) {
|
||||
@@ -38,12 +41,14 @@ func (api *API) SendStickerWithContext(ctx context.Context, params SendSticker)
|
||||
}
|
||||
|
||||
// GetStickerSet holds parameters for the getStickerSet method.
|
||||
// Since: Bot API 3.2
|
||||
// See https://core.telegram.org/bots/api#getstickerset
|
||||
type GetStickerSet struct {
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// GetStickerSet returns a sticker set by its name.
|
||||
// Since: Bot API 3.2
|
||||
// See https://core.telegram.org/bots/api#getstickerset
|
||||
func (api *API) GetStickerSet(params GetStickerSet) (StickerSet, error) {
|
||||
req := NewRequest[StickerSet]("getStickerSet", params)
|
||||
@@ -51,6 +56,7 @@ func (api *API) GetStickerSet(params GetStickerSet) (StickerSet, error) {
|
||||
}
|
||||
|
||||
// GetStickerSetWithContext is the context-aware variant of GetStickerSet.
|
||||
// Since: Bot API 3.2
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#getstickerset
|
||||
func (api *API) GetStickerSetWithContext(ctx context.Context, params GetStickerSet) (StickerSet, error) {
|
||||
@@ -59,12 +65,14 @@ func (api *API) GetStickerSetWithContext(ctx context.Context, params GetStickerS
|
||||
}
|
||||
|
||||
// GetCustomEmojiStickers holds parameters for the getCustomEmojiStickers method.
|
||||
// Since: Bot API 6.2
|
||||
// See https://core.telegram.org/bots/api#getcustomemojistickers
|
||||
type GetCustomEmojiStickers struct {
|
||||
CustomEmojiIDs []string `json:"custom_emoji_ids"`
|
||||
}
|
||||
|
||||
// GetCustomEmojiStickers returns information about custom emoji stickers by their IDs.
|
||||
// Since: Bot API 6.2
|
||||
// See https://core.telegram.org/bots/api#getcustomemojistickers
|
||||
func (api *API) GetCustomEmojiStickers(params GetCustomEmojiStickers) ([]Sticker, error) {
|
||||
req := NewRequest[[]Sticker]("getCustomEmojiStickers", params)
|
||||
@@ -72,6 +80,7 @@ func (api *API) GetCustomEmojiStickers(params GetCustomEmojiStickers) ([]Sticker
|
||||
}
|
||||
|
||||
// GetCustomEmojiStickersWithContext is the context-aware variant of GetCustomEmojiStickers.
|
||||
// Since: Bot API 6.2
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#getcustomemojistickers
|
||||
func (api *API) GetCustomEmojiStickersWithContext(ctx context.Context, params GetCustomEmojiStickers) ([]Sticker, error) {
|
||||
@@ -80,6 +89,7 @@ func (api *API) GetCustomEmojiStickersWithContext(ctx context.Context, params Ge
|
||||
}
|
||||
|
||||
// UploadStickerFile holds parameters for the uploadStickerFile method.
|
||||
// Since: Bot API 3.2
|
||||
// See https://core.telegram.org/bots/api#uploadstickerfile
|
||||
type UploadStickerFile struct {
|
||||
UserID int64 `json:"user_id"`
|
||||
@@ -87,6 +97,7 @@ type UploadStickerFile struct {
|
||||
}
|
||||
|
||||
// UploadStickerFile uploads a sticker file for later use in sticker set methods.
|
||||
// Since: Bot API 3.2
|
||||
// sticker is the file to upload.
|
||||
// See https://core.telegram.org/bots/api#uploadstickerfile
|
||||
func (api *API) UploadStickerFile(params UploadStickerFile, sticker UploaderFile) (File, error) {
|
||||
@@ -99,6 +110,7 @@ func (api *API) UploadStickerFile(params UploadStickerFile, sticker UploaderFile
|
||||
}
|
||||
|
||||
// UploadStickerFileWithContext is the context-aware variant of UploadStickerFile.
|
||||
// Since: Bot API 3.2
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#uploadstickerfile
|
||||
func (api *API) UploadStickerFileWithContext(ctx context.Context, params UploadStickerFile, sticker UploaderFile) (File, error) {
|
||||
@@ -111,6 +123,7 @@ func (api *API) UploadStickerFileWithContext(ctx context.Context, params UploadS
|
||||
}
|
||||
|
||||
// CreateNewStickerSet holds parameters for the createNewStickerSet method.
|
||||
// Since: Bot API 3.2
|
||||
// See https://core.telegram.org/bots/api#createnewstickerset
|
||||
type CreateNewStickerSet struct {
|
||||
UserID int64 `json:"user_id"`
|
||||
@@ -123,6 +136,7 @@ type CreateNewStickerSet struct {
|
||||
}
|
||||
|
||||
// CreateNewStickerSet creates a new sticker set owned by a user.
|
||||
// Since: Bot API 3.2
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#createnewstickerset
|
||||
func (api *API) CreateNewStickerSet(params CreateNewStickerSet) (bool, error) {
|
||||
@@ -131,6 +145,7 @@ func (api *API) CreateNewStickerSet(params CreateNewStickerSet) (bool, error) {
|
||||
}
|
||||
|
||||
// CreateNewStickerSetWithContext is the context-aware variant of CreateNewStickerSet.
|
||||
// Since: Bot API 3.2
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#createnewstickerset
|
||||
func (api *API) CreateNewStickerSetWithContext(ctx context.Context, params CreateNewStickerSet) (bool, error) {
|
||||
@@ -139,6 +154,7 @@ func (api *API) CreateNewStickerSetWithContext(ctx context.Context, params Creat
|
||||
}
|
||||
|
||||
// AddStickerToSet holds parameters for the addStickerToSet method.
|
||||
// Since: Bot API 3.2
|
||||
// See https://core.telegram.org/bots/api#addstickertoset
|
||||
type AddStickerToSet struct {
|
||||
UserID int64 `json:"user_id"`
|
||||
@@ -147,6 +163,7 @@ type AddStickerToSet struct {
|
||||
}
|
||||
|
||||
// AddStickerToSet adds a new sticker to a set created by the bot.
|
||||
// Since: Bot API 3.2
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#addstickertoset
|
||||
func (api *API) AddStickerToSet(params AddStickerToSet) (bool, error) {
|
||||
@@ -155,6 +172,7 @@ func (api *API) AddStickerToSet(params AddStickerToSet) (bool, error) {
|
||||
}
|
||||
|
||||
// AddStickerToSetWithContext is the context-aware variant of AddStickerToSet.
|
||||
// Since: Bot API 3.2
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#addstickertoset
|
||||
func (api *API) AddStickerToSetWithContext(ctx context.Context, params AddStickerToSet) (bool, error) {
|
||||
@@ -163,6 +181,7 @@ func (api *API) AddStickerToSetWithContext(ctx context.Context, params AddSticke
|
||||
}
|
||||
|
||||
// SetStickerPositionInSet holds parameters for the setStickerPositionInSet method.
|
||||
// Since: Bot API 3.2
|
||||
// See https://core.telegram.org/bots/api#setstickerpositioninset
|
||||
type SetStickerPositionInSet struct {
|
||||
Sticker string `json:"sticker"`
|
||||
@@ -170,6 +189,7 @@ type SetStickerPositionInSet struct {
|
||||
}
|
||||
|
||||
// SetStickerPositionInSet moves a sticker in a set to a specific position.
|
||||
// Since: Bot API 3.2
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#setstickerpositioninset
|
||||
func (api *API) SetStickerPositionInSet(params SetStickerPositionInSet) (bool, error) {
|
||||
@@ -178,6 +198,7 @@ func (api *API) SetStickerPositionInSet(params SetStickerPositionInSet) (bool, e
|
||||
}
|
||||
|
||||
// SetStickerPositionInSetWithContext is the context-aware variant of SetStickerPositionInSet.
|
||||
// Since: Bot API 3.2
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#setstickerpositioninset
|
||||
func (api *API) SetStickerPositionInSetWithContext(ctx context.Context, params SetStickerPositionInSet) (bool, error) {
|
||||
@@ -186,12 +207,14 @@ func (api *API) SetStickerPositionInSetWithContext(ctx context.Context, params S
|
||||
}
|
||||
|
||||
// DeleteStickerFromSet holds parameters for the deleteStickerFromSet method.
|
||||
// Since: Bot API 3.2
|
||||
// See https://core.telegram.org/bots/api#deletestickerfromset
|
||||
type DeleteStickerFromSet struct {
|
||||
Sticker string `json:"sticker"`
|
||||
}
|
||||
|
||||
// DeleteStickerFromSet deletes a sticker from a set created by the bot.
|
||||
// Since: Bot API 3.2
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#deletestickerfromset
|
||||
func (api *API) DeleteStickerFromSet(params DeleteStickerFromSet) (bool, error) {
|
||||
@@ -200,6 +223,7 @@ func (api *API) DeleteStickerFromSet(params DeleteStickerFromSet) (bool, error)
|
||||
}
|
||||
|
||||
// DeleteStickerFromSetWithContext is the context-aware variant of DeleteStickerFromSet.
|
||||
// Since: Bot API 3.2
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#deletestickerfromset
|
||||
func (api *API) DeleteStickerFromSetWithContext(ctx context.Context, params DeleteStickerFromSet) (bool, error) {
|
||||
@@ -208,6 +232,7 @@ func (api *API) DeleteStickerFromSetWithContext(ctx context.Context, params Dele
|
||||
}
|
||||
|
||||
// ReplaceStickerInSet holds parameters for the replaceStickerInSet method.
|
||||
// Since: Bot API 7.2
|
||||
// See https://core.telegram.org/bots/api#replacestickerinset
|
||||
type ReplaceStickerInSet struct {
|
||||
UserID int64 `json:"user_id"`
|
||||
@@ -217,6 +242,7 @@ type ReplaceStickerInSet struct {
|
||||
}
|
||||
|
||||
// ReplaceStickerInSet replaces an existing sticker in a set with a new one.
|
||||
// Since: Bot API 7.2
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#replacestickerinset
|
||||
func (api *API) ReplaceStickerInSet(params ReplaceStickerInSet) (bool, error) {
|
||||
@@ -225,6 +251,7 @@ func (api *API) ReplaceStickerInSet(params ReplaceStickerInSet) (bool, error) {
|
||||
}
|
||||
|
||||
// ReplaceStickerInSetWithContext is the context-aware variant of ReplaceStickerInSet.
|
||||
// Since: Bot API 7.2
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#replacestickerinset
|
||||
func (api *API) ReplaceStickerInSetWithContext(ctx context.Context, params ReplaceStickerInSet) (bool, error) {
|
||||
@@ -233,6 +260,7 @@ func (api *API) ReplaceStickerInSetWithContext(ctx context.Context, params Repla
|
||||
}
|
||||
|
||||
// SetStickerEmojiList holds parameters for the setStickerEmojiList method.
|
||||
// Since: Bot API 6.6
|
||||
// See https://core.telegram.org/bots/api#setstickeremojilist
|
||||
type SetStickerEmojiList struct {
|
||||
Sticker string `json:"sticker"`
|
||||
@@ -240,6 +268,7 @@ type SetStickerEmojiList struct {
|
||||
}
|
||||
|
||||
// SetStickerEmojiList changes the list of emoji associated with a sticker.
|
||||
// Since: Bot API 6.6
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#setstickeremojilist
|
||||
func (api *API) SetStickerEmojiList(params SetStickerEmojiList) (bool, error) {
|
||||
@@ -248,6 +277,7 @@ func (api *API) SetStickerEmojiList(params SetStickerEmojiList) (bool, error) {
|
||||
}
|
||||
|
||||
// SetStickerEmojiListWithContext is the context-aware variant of SetStickerEmojiList.
|
||||
// Since: Bot API 6.6
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#setstickeremojilist
|
||||
func (api *API) SetStickerEmojiListWithContext(ctx context.Context, params SetStickerEmojiList) (bool, error) {
|
||||
@@ -256,6 +286,7 @@ func (api *API) SetStickerEmojiListWithContext(ctx context.Context, params SetSt
|
||||
}
|
||||
|
||||
// SetStickerKeywords holds parameters for the setStickerKeywords method.
|
||||
// Since: Bot API 6.6
|
||||
// See https://core.telegram.org/bots/api#setstickerkeywords
|
||||
type SetStickerKeywords struct {
|
||||
Sticker string `json:"sticker"`
|
||||
@@ -263,6 +294,7 @@ type SetStickerKeywords struct {
|
||||
}
|
||||
|
||||
// SetStickerKeywords changes the keywords of a sticker.
|
||||
// Since: Bot API 6.6
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#setstickerkeywords
|
||||
func (api *API) SetStickerKeywords(params SetStickerKeywords) (bool, error) {
|
||||
@@ -271,6 +303,7 @@ func (api *API) SetStickerKeywords(params SetStickerKeywords) (bool, error) {
|
||||
}
|
||||
|
||||
// SetStickerKeywordsWithContext is the context-aware variant of SetStickerKeywords.
|
||||
// Since: Bot API 6.6
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#setstickerkeywords
|
||||
func (api *API) SetStickerKeywordsWithContext(ctx context.Context, params SetStickerKeywords) (bool, error) {
|
||||
@@ -279,6 +312,7 @@ func (api *API) SetStickerKeywordsWithContext(ctx context.Context, params SetSti
|
||||
}
|
||||
|
||||
// SetStickerMaskPosition holds parameters for the setStickerMaskPosition method.
|
||||
// Since: Bot API 6.6
|
||||
// See https://core.telegram.org/bots/api#setstickermaskposition
|
||||
type SetStickerMaskPosition struct {
|
||||
Sticker string `json:"sticker"`
|
||||
@@ -286,6 +320,7 @@ type SetStickerMaskPosition struct {
|
||||
}
|
||||
|
||||
// SetStickerMaskPosition changes the mask position of a mask sticker.
|
||||
// Since: Bot API 6.6
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#setstickermaskposition
|
||||
func (api *API) SetStickerMaskPosition(params SetStickerMaskPosition) (bool, error) {
|
||||
@@ -294,6 +329,7 @@ func (api *API) SetStickerMaskPosition(params SetStickerMaskPosition) (bool, err
|
||||
}
|
||||
|
||||
// SetStickerMaskPositionWithContext is the context-aware variant of SetStickerMaskPosition.
|
||||
// Since: Bot API 6.6
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#setstickermaskposition
|
||||
func (api *API) SetStickerMaskPositionWithContext(ctx context.Context, params SetStickerMaskPosition) (bool, error) {
|
||||
@@ -302,6 +338,7 @@ func (api *API) SetStickerMaskPositionWithContext(ctx context.Context, params Se
|
||||
}
|
||||
|
||||
// SetStickerSetTitle holds parameters for the setStickerSetTitle method.
|
||||
// Since: Bot API 6.6
|
||||
// See https://core.telegram.org/bots/api#setstickersettitle
|
||||
type SetStickerSetTitle struct {
|
||||
Name string `json:"name"`
|
||||
@@ -309,6 +346,7 @@ type SetStickerSetTitle struct {
|
||||
}
|
||||
|
||||
// SetStickerSetTitle sets the title of a sticker set created by the bot.
|
||||
// Since: Bot API 6.6
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#setstickersettitle
|
||||
func (api *API) SetStickerSetTitle(params SetStickerSetTitle) (bool, error) {
|
||||
@@ -317,6 +355,7 @@ func (api *API) SetStickerSetTitle(params SetStickerSetTitle) (bool, error) {
|
||||
}
|
||||
|
||||
// SetStickerSetTitleWithContext is the context-aware variant of SetStickerSetTitle.
|
||||
// Since: Bot API 6.6
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#setstickersettitle
|
||||
func (api *API) SetStickerSetTitleWithContext(ctx context.Context, params SetStickerSetTitle) (bool, error) {
|
||||
@@ -325,6 +364,7 @@ func (api *API) SetStickerSetTitleWithContext(ctx context.Context, params SetSti
|
||||
}
|
||||
|
||||
// SetStickerSetThumbnail holds parameters for the setStickerSetThumbnail method.
|
||||
// Since: Bot API 6.6
|
||||
// See https://core.telegram.org/bots/api#setstickersetthumbnail
|
||||
type SetStickerSetThumbnail struct {
|
||||
Name string `json:"name"`
|
||||
@@ -334,6 +374,7 @@ type SetStickerSetThumbnail struct {
|
||||
}
|
||||
|
||||
// SetStickerSetThumbnail sets the thumbnail of a sticker set.
|
||||
// Since: Bot API 6.6
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#setstickersetthumbnail
|
||||
func (api *API) SetStickerSetThumbnail(params SetStickerSetThumbnail) (bool, error) {
|
||||
@@ -342,6 +383,7 @@ func (api *API) SetStickerSetThumbnail(params SetStickerSetThumbnail) (bool, err
|
||||
}
|
||||
|
||||
// SetStickerSetThumbnailWithContext is the context-aware variant of SetStickerSetThumbnail.
|
||||
// Since: Bot API 6.6
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#setstickersetthumbnail
|
||||
func (api *API) SetStickerSetThumbnailWithContext(ctx context.Context, params SetStickerSetThumbnail) (bool, error) {
|
||||
@@ -350,6 +392,7 @@ func (api *API) SetStickerSetThumbnailWithContext(ctx context.Context, params Se
|
||||
}
|
||||
|
||||
// SetCustomEmojiStickerSetThumbnail holds parameters for the setCustomEmojiStickerSetThumbnail method.
|
||||
// Since: Bot API 6.6
|
||||
// See https://core.telegram.org/bots/api#setcustomemojistickersetthumbnail
|
||||
type SetCustomEmojiStickerSetThumbnail struct {
|
||||
Name string `json:"name"`
|
||||
@@ -357,6 +400,7 @@ type SetCustomEmojiStickerSetThumbnail struct {
|
||||
}
|
||||
|
||||
// SetCustomEmojiStickerSetThumbnail sets the thumbnail of a custom emoji sticker set.
|
||||
// Since: Bot API 6.6
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#setcustomemojistickersetthumbnail
|
||||
func (api *API) SetCustomEmojiStickerSetThumbnail(params SetCustomEmojiStickerSetThumbnail) (bool, error) {
|
||||
@@ -365,6 +409,7 @@ func (api *API) SetCustomEmojiStickerSetThumbnail(params SetCustomEmojiStickerSe
|
||||
}
|
||||
|
||||
// SetCustomEmojiStickerSetThumbnailWithContext is the context-aware variant of SetCustomEmojiStickerSetThumbnail.
|
||||
// Since: Bot API 6.6
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#setcustomemojistickersetthumbnail
|
||||
func (api *API) SetCustomEmojiStickerSetThumbnailWithContext(ctx context.Context, params SetCustomEmojiStickerSetThumbnail) (bool, error) {
|
||||
@@ -373,12 +418,14 @@ func (api *API) SetCustomEmojiStickerSetThumbnailWithContext(ctx context.Context
|
||||
}
|
||||
|
||||
// DeleteStickerSet holds parameters for the deleteStickerSet method.
|
||||
// Since: Bot API 6.6
|
||||
// See https://core.telegram.org/bots/api#deletestickerset
|
||||
type DeleteStickerSet struct {
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// DeleteStickerSet deletes a sticker set created by the bot.
|
||||
// Since: Bot API 6.6
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#deletestickerset
|
||||
func (api *API) DeleteStickerSet(params DeleteStickerSet) (bool, error) {
|
||||
@@ -387,6 +434,7 @@ func (api *API) DeleteStickerSet(params DeleteStickerSet) (bool, error) {
|
||||
}
|
||||
|
||||
// DeleteStickerSetWithContext is the context-aware variant of DeleteStickerSet.
|
||||
// Since: Bot API 6.6
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#deletestickerset
|
||||
func (api *API) DeleteStickerSetWithContext(ctx context.Context, params DeleteStickerSet) (bool, error) {
|
||||
|
||||
+16
-12
@@ -15,6 +15,7 @@ const (
|
||||
)
|
||||
|
||||
// MaskPosition describes the position on faces where a mask should be placed by default.
|
||||
// Since: Bot API 3.2
|
||||
// See https://core.telegram.org/bots/api#maskposition
|
||||
type MaskPosition struct {
|
||||
Point MaskPositionPoint `json:"point"`
|
||||
@@ -36,26 +37,28 @@ const (
|
||||
)
|
||||
|
||||
// Sticker represents a sticker.
|
||||
// Since: Bot API 1.0
|
||||
// See https://core.telegram.org/bots/api#sticker
|
||||
type Sticker struct {
|
||||
FileID string `json:"file_id"`
|
||||
FileUniqueID string `json:"file_unique_id"`
|
||||
Type StickerType `json:"type"`
|
||||
Width int `json:"width"`
|
||||
Height int `json:"height"`
|
||||
IsAnimated bool `json:"is_animated"`
|
||||
IsVideo bool `json:"is_video"`
|
||||
FileID string `json:"file_id"`
|
||||
FileUniqueID string `json:"file_unique_id"`
|
||||
Width int `json:"width"`
|
||||
Height int `json:"height"`
|
||||
|
||||
Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
|
||||
Type StickerType `json:"type"` // Since: Bot API 6.2
|
||||
IsAnimated bool `json:"is_animated"` // Since: Bot API 4.4
|
||||
IsVideo bool `json:"is_video"` // Since: Bot API 5.7
|
||||
Thumbnail *PhotoSize `json:"thumbnail,omitempty"` // Since: Bot API 6.6
|
||||
Emoji *string `json:"emoji,omitempty"`
|
||||
SetName *string `json:"set_name,omitempty"`
|
||||
MaskPosition *MaskPosition `json:"mask_position,omitempty"`
|
||||
CustomEmojiID *string `json:"custom_emoji_id,omitempty"`
|
||||
NeedRepainting *bool `json:"need_repainting,omitempty"`
|
||||
SetName *string `json:"set_name,omitempty"` // Since: Bot API 3.2
|
||||
MaskPosition *MaskPosition `json:"mask_position,omitempty"` // Since: Bot API 3.2
|
||||
CustomEmojiID *string `json:"custom_emoji_id,omitempty"` // Since: Bot API 6.2
|
||||
NeedRepainting *bool `json:"need_repainting,omitempty"` // Since: Bot API 6.6
|
||||
FileSize *int64 `json:"file_size,omitempty"`
|
||||
}
|
||||
|
||||
// StickerSet represents a sticker set.
|
||||
// Since: Bot API 3.2
|
||||
// See https://core.telegram.org/bots/api#stickerset
|
||||
type StickerSet struct {
|
||||
Name string `json:"name"`
|
||||
@@ -78,6 +81,7 @@ const (
|
||||
)
|
||||
|
||||
// InputSticker describes a sticker to be added to a sticker set.
|
||||
// Since: Bot API 6.6
|
||||
// See https://core.telegram.org/bots/api#inputsticker
|
||||
type InputSticker struct {
|
||||
Sticker string `json:"sticker"`
|
||||
|
||||
+88
-22
@@ -59,9 +59,13 @@ const (
|
||||
UpdateTypeRemovedChatBoost UpdateType = "removed_chat_boost"
|
||||
|
||||
UpdateTypeManagedBot UpdateType = "managed_bot"
|
||||
|
||||
// UpdateTypeGuestMessage is a guest message update.
|
||||
UpdateTypeGuestMessage UpdateType = "guest_message"
|
||||
)
|
||||
|
||||
// Update represents an incoming update from Telegram.
|
||||
// Since: Bot API 1.0
|
||||
// See https://core.telegram.org/bots/api#update
|
||||
type Update struct {
|
||||
Type UpdateType `json:"-"`
|
||||
@@ -69,32 +73,33 @@ type Update struct {
|
||||
UpdateID int `json:"update_id"`
|
||||
Message *Message `json:"message,omitempty"`
|
||||
EditedMessage *Message `json:"edited_message,omitempty"`
|
||||
ChannelPost *Message `json:"channel_post,omitempty"`
|
||||
EditedChannelPost *Message `json:"edited_channel_post,omitempty"`
|
||||
ChannelPost *Message `json:"channel_post,omitempty"` // Since: Bot API 2.3
|
||||
EditedChannelPost *Message `json:"edited_channel_post,omitempty"` // Since: Bot API 2.3
|
||||
|
||||
BusinessConnection *BusinessConnection `json:"business_connection,omitempty"`
|
||||
BusinessMessage *Message `json:"business_message,omitempty"`
|
||||
EditedBusinessMessage *Message `json:"edited_business_message,omitempty"`
|
||||
DeletedBusinessMessages *BusinessMessagesDeleted `json:"deleted_business_messages,omitempty"`
|
||||
MessageReaction *MessageReactionUpdated `json:"message_reaction,omitempty"`
|
||||
MessageReactionCount *MessageReactionCountUpdated `json:"message_reaction_count,omitempty"`
|
||||
BusinessConnection *BusinessConnection `json:"business_connection,omitempty"` // Since: Bot API 7.2
|
||||
BusinessMessage *Message `json:"business_message,omitempty"` // Since: Bot API 7.2
|
||||
EditedBusinessMessage *Message `json:"edited_business_message,omitempty"` // Since: Bot API 7.2
|
||||
DeletedBusinessMessages *BusinessMessagesDeleted `json:"deleted_business_messages,omitempty"` // Since: Bot API 7.2
|
||||
GuestMessage *Message `json:"guest_message,omitempty"` // Since: Bot API 10.0
|
||||
MessageReaction *MessageReactionUpdated `json:"message_reaction,omitempty"` // Since: Bot API 7.0
|
||||
MessageReactionCount *MessageReactionCountUpdated `json:"message_reaction_count,omitempty"` // Since: Bot API 7.0
|
||||
|
||||
InlineQuery *InlineQuery `json:"inline_query,omitempty"`
|
||||
ChosenInlineResult *ChosenInlineResult `json:"chosen_inline_result,omitempty"`
|
||||
CallbackQuery *CallbackQuery `json:"callback_query,omitempty"`
|
||||
ShippingQuery *ShippingQuery `json:"shipping_query,omitempty"`
|
||||
PreCheckoutQuery *PreCheckoutQuery `json:"pre_checkout_query,omitempty"`
|
||||
PurchasedPaidMedia *PaidMediaPurchased `json:"purchased_paid_media,omitempty"`
|
||||
InlineQuery *InlineQuery `json:"inline_query,omitempty"` // Since: Bot API 1.7
|
||||
ChosenInlineResult *ChosenInlineResult `json:"chosen_inline_result,omitempty"` // Since: Bot API 1.8
|
||||
CallbackQuery *CallbackQuery `json:"callback_query,omitempty"` // Since: Bot API 2.0
|
||||
ShippingQuery *ShippingQuery `json:"shipping_query,omitempty"` // Since: Bot API 3.0
|
||||
PreCheckoutQuery *PreCheckoutQuery `json:"pre_checkout_query,omitempty"` // Since: Bot API 3.0
|
||||
PurchasedPaidMedia *PaidMediaPurchased `json:"purchased_paid_media,omitempty"` // Since: Bot API 7.10
|
||||
|
||||
Poll *Poll `json:"poll,omitempty"`
|
||||
PollAnswer *PollAnswer `json:"poll_answer,omitempty"`
|
||||
MyChatMember *ChatMemberUpdated `json:"my_chat_member,omitempty"`
|
||||
ChatMember *ChatMemberUpdated `json:"chat_member,omitempty"`
|
||||
ChatJoinRequest *ChatJoinRequest `json:"chat_join_request,omitempty"`
|
||||
ChatBoost *ChatBoostUpdated `json:"chat_boost,omitempty"`
|
||||
RemovedChatBoost *ChatBoostRemoved `json:"removed_chat_boost,omitempty"`
|
||||
Poll *Poll `json:"poll,omitempty"` // Since: Bot API 4.2
|
||||
PollAnswer *PollAnswer `json:"poll_answer,omitempty"` // Since: Bot API 4.6
|
||||
MyChatMember *ChatMemberUpdated `json:"my_chat_member,omitempty"` // Since: Bot API 5.1
|
||||
ChatMember *ChatMemberUpdated `json:"chat_member,omitempty"` // Since: Bot API 5.1
|
||||
ChatJoinRequest *ChatJoinRequest `json:"chat_join_request,omitempty"` // Since: Bot API 5.4
|
||||
ChatBoost *ChatBoostUpdated `json:"chat_boost,omitempty"` // Since: Bot API 7.0
|
||||
RemovedChatBoost *ChatBoostRemoved `json:"removed_chat_boost,omitempty"` // Since: Bot API 7.0
|
||||
|
||||
ManagedBot *ManagedBotUpdated `json:"managed_bot,omitempty"`
|
||||
ManagedBot *ManagedBotUpdated `json:"managed_bot,omitempty"` // Since: Bot API 9.6
|
||||
}
|
||||
|
||||
// UnmarshalJSON decodes an update and derives its Type from the populated payload field.
|
||||
@@ -126,6 +131,8 @@ func (u *Update) UnmarshalJSON(data []byte) error {
|
||||
u.Type = UpdateTypeEditedBusinessMessage
|
||||
case u.DeletedBusinessMessages != nil:
|
||||
u.Type = UpdateTypeDeletedBusinessMessages
|
||||
case u.GuestMessage != nil:
|
||||
u.Type = UpdateTypeGuestMessage
|
||||
case u.MessageReaction != nil:
|
||||
u.Type = UpdateTypeMessageReaction
|
||||
case u.MessageReactionCount != nil:
|
||||
@@ -168,6 +175,7 @@ func (u *Update) UnmarshalJSON(data []byte) error {
|
||||
}
|
||||
|
||||
// WebhookInfo describes the current webhook status.
|
||||
// Since: Bot API 2.2
|
||||
// See https://core.telegram.org/bots/api#webhookinfo
|
||||
type WebhookInfo struct {
|
||||
URL string `json:"url"`
|
||||
@@ -181,6 +189,8 @@ type WebhookInfo struct {
|
||||
AllowedUpdates []string `json:"allowed_updates,omitempty"`
|
||||
}
|
||||
|
||||
// ProximityAlertTriggered represents the content of a service message sent when a user triggers a proximity alert.
|
||||
// Since: Bot API 5.0
|
||||
type ProximityAlertTriggered struct {
|
||||
Traveler User `json:"traveler"`
|
||||
Watcher User `json:"watcher"`
|
||||
@@ -188,6 +198,7 @@ type ProximityAlertTriggered struct {
|
||||
}
|
||||
|
||||
// InlineQuery represents an incoming inline query.
|
||||
// Since: Bot API 1.7
|
||||
// See https://core.telegram.org/bots/api#inlinequery
|
||||
type InlineQuery struct {
|
||||
ID string `json:"id"`
|
||||
@@ -199,6 +210,7 @@ type InlineQuery struct {
|
||||
}
|
||||
|
||||
// ChosenInlineResult represents a result of an inline query that was chosen by the user.
|
||||
// Since: Bot API 1.8
|
||||
// See https://core.telegram.org/bots/api#choseninlineresult
|
||||
type ChosenInlineResult struct {
|
||||
ResultID string `json:"result_id"`
|
||||
@@ -209,6 +221,7 @@ type ChosenInlineResult struct {
|
||||
}
|
||||
|
||||
// File represents a file ready to be downloaded.
|
||||
// Since: Bot API 1.0
|
||||
// See https://core.telegram.org/bots/api#file
|
||||
type File struct {
|
||||
FileID string `json:"file_id"`
|
||||
@@ -218,6 +231,7 @@ type File struct {
|
||||
}
|
||||
|
||||
// ChatMemberUpdated represents changes in the status of a chat member.
|
||||
// Since: Bot API 5.1
|
||||
// See https://core.telegram.org/bots/api#chatmemberupdated
|
||||
type ChatMemberUpdated struct {
|
||||
Chat Chat `json:"chat"`
|
||||
@@ -231,6 +245,7 @@ type ChatMemberUpdated struct {
|
||||
}
|
||||
|
||||
// ChatJoinRequest represents a join request sent to a chat.
|
||||
// Since: Bot API 5.4
|
||||
// See https://core.telegram.org/bots/api#chatjoinrequest
|
||||
type ChatJoinRequest struct {
|
||||
Chat Chat `json:"chat"`
|
||||
@@ -242,6 +257,7 @@ type ChatJoinRequest struct {
|
||||
}
|
||||
|
||||
// Location represents a point on the map.
|
||||
// Since: Bot API 1.0
|
||||
// See https://core.telegram.org/bots/api#location
|
||||
type Location struct {
|
||||
Latitude float64 `json:"latitude"`
|
||||
@@ -253,6 +269,7 @@ type Location struct {
|
||||
}
|
||||
|
||||
// LocationAddress represents a human-readable address of a location.
|
||||
// Since: Bot API 8.0
|
||||
type LocationAddress struct {
|
||||
CountryCode string `json:"country_code"`
|
||||
State *string `json:"state,omitempty"`
|
||||
@@ -261,6 +278,7 @@ type LocationAddress struct {
|
||||
}
|
||||
|
||||
// Venue represents a venue.
|
||||
// Since: Bot API 2.0
|
||||
// See https://core.telegram.org/bots/api#venue
|
||||
type Venue struct {
|
||||
Location Location `json:"location"`
|
||||
@@ -273,23 +291,28 @@ type Venue struct {
|
||||
}
|
||||
|
||||
// WebAppInfo contains information about a Web App.
|
||||
// Since: Bot API 6.0
|
||||
// See https://core.telegram.org/bots/api#webappinfo
|
||||
type WebAppInfo struct {
|
||||
URL string `json:"url"`
|
||||
}
|
||||
|
||||
// WebAppData represents data sent from a Web App to the bot.
|
||||
// Since: Bot API 6.0
|
||||
type WebAppData struct {
|
||||
Data string `json:"data"`
|
||||
ButtonText string `json:"button_text"`
|
||||
}
|
||||
|
||||
// StarAmount represents an amount of Telegram Stars.
|
||||
// Since: Bot API 7.5
|
||||
type StarAmount struct {
|
||||
Amount int `json:"amount"`
|
||||
NanostarAmount int `json:"nanostar_amount"`
|
||||
}
|
||||
|
||||
// AcceptedGiftTypes represents the types of gifts accepted by a user or chat.
|
||||
// Since: Bot API 9.0
|
||||
type AcceptedGiftTypes struct {
|
||||
UnlimitedGifts bool `json:"unlimited_gifts"`
|
||||
LimitedGifts bool `json:"limited_gifts"`
|
||||
@@ -299,6 +322,7 @@ type AcceptedGiftTypes struct {
|
||||
}
|
||||
|
||||
// GiftBackground represents the background of a gift.
|
||||
// Since: Bot API 9.0
|
||||
type GiftBackground struct {
|
||||
CenterColor int `json:"center_color"`
|
||||
EdgeColor int `json:"edge_color"`
|
||||
@@ -306,6 +330,7 @@ type GiftBackground struct {
|
||||
}
|
||||
|
||||
// Gift represents a gift that can be sent.
|
||||
// Since: Bot API 9.0
|
||||
type Gift struct {
|
||||
ID string `json:"id"`
|
||||
Sticker Sticker `json:"sticker"`
|
||||
@@ -323,27 +348,39 @@ type Gift struct {
|
||||
}
|
||||
|
||||
// Gifts represents a list of gifts.
|
||||
// Since: Bot API 9.0
|
||||
type Gifts struct {
|
||||
Gifts []Gift `json:"gifts"`
|
||||
}
|
||||
|
||||
// UniqueGiftModel describes the model component of a unique gift.
|
||||
// Since: Bot API 9.0
|
||||
type UniqueGiftModel struct {
|
||||
Name string `json:"name"`
|
||||
Sticker Sticker `json:"sticker"`
|
||||
RarityPerMille int `json:"rarity_per_mille"`
|
||||
Rarity string `json:"rarity,omitempty"`
|
||||
}
|
||||
|
||||
// UniqueGiftSymbol describes the symbol component of a unique gift.
|
||||
// Since: Bot API 9.0
|
||||
type UniqueGiftSymbol struct {
|
||||
Name string `json:"name"`
|
||||
Sticker Sticker `json:"sticker"`
|
||||
RarityPerMille int `json:"rarity_per_mille"`
|
||||
}
|
||||
|
||||
// UniqueGiftBackdropColors describes the colors of a unique gift backdrop.
|
||||
// Since: Bot API 9.0
|
||||
type UniqueGiftBackdropColors struct {
|
||||
CenterColor int `json:"center_color"`
|
||||
EdgeColor int `json:"edge_color"`
|
||||
SymbolColor int `json:"symbol_color"`
|
||||
TextColor int `json:"text_color"`
|
||||
}
|
||||
|
||||
// UniqueGiftBackdrop describes the backdrop of a unique gift.
|
||||
// Since: Bot API 9.0
|
||||
type UniqueGiftBackdrop struct {
|
||||
Name string `json:"name"`
|
||||
Colors UniqueGiftBackdropColors `json:"colors"`
|
||||
@@ -351,6 +388,7 @@ type UniqueGiftBackdrop struct {
|
||||
}
|
||||
|
||||
// UniqueGiftColors represents color information for a unique gift.
|
||||
// Since: Bot API 9.3
|
||||
type UniqueGiftColors struct {
|
||||
ModelCustomEmojiID string `json:"model_custom_emoji_id"`
|
||||
SymbolCustomEmojiID string `json:"symbol_custom_emoji_id"`
|
||||
@@ -360,6 +398,8 @@ type UniqueGiftColors struct {
|
||||
DarkThemeOtherColors []int `json:"dark_theme_other_colors"`
|
||||
}
|
||||
|
||||
// UniqueGift represents a unique gift.
|
||||
// Since: Bot API 9.0
|
||||
type UniqueGift struct {
|
||||
GiftID string `json:"gift_id"`
|
||||
BaseName string `json:"base_name"`
|
||||
@@ -376,6 +416,8 @@ type UniqueGift struct {
|
||||
PublisherChat *Chat `json:"publisher_chat,omitempty"`
|
||||
}
|
||||
|
||||
// GiftInfo contains information about a received gift.
|
||||
// Since: Bot API 9.0
|
||||
type GiftInfo struct {
|
||||
Gift Gift `json:"gift"`
|
||||
|
||||
@@ -389,6 +431,9 @@ type GiftInfo struct {
|
||||
IsPrivate bool `json:"is_private,omitempty"`
|
||||
UniqueGiftNumber int `json:"unique_gift_number,omitempty"`
|
||||
}
|
||||
|
||||
// UniqueGiftInfo contains information about a received unique gift.
|
||||
// Since: Bot API 9.0
|
||||
type UniqueGiftInfo struct {
|
||||
Gift UniqueGift `json:"gift"`
|
||||
Origin string `json:"origin"`
|
||||
@@ -400,6 +445,7 @@ type UniqueGiftInfo struct {
|
||||
}
|
||||
|
||||
// OwnedGiftType represents the type of an owned gift.
|
||||
// Since: Bot API 9.0
|
||||
type OwnedGiftType string
|
||||
|
||||
const (
|
||||
@@ -410,6 +456,7 @@ const (
|
||||
)
|
||||
|
||||
// OwnedGift represents a gift owned by a user or chat.
|
||||
// Since: Bot API 9.0
|
||||
type OwnedGift struct {
|
||||
Type OwnedGiftType `json:"type"`
|
||||
OwnedGiftID string `json:"ownen_gift_id,omitempty"`
|
||||
@@ -436,16 +483,21 @@ type OwnedGift struct {
|
||||
}
|
||||
|
||||
// OwnedGifts represents a list of owned gifts with pagination.
|
||||
// Since: Bot API 9.0
|
||||
type OwnedGifts struct {
|
||||
TotalCount int `json:"total_count"`
|
||||
Gifts []OwnedGift `json:"gifts"`
|
||||
NextOffset string `json:"next_offset"`
|
||||
}
|
||||
|
||||
// GiveawayCreated represents a service message about a giveaway being created.
|
||||
// Since: Bot API 7.0
|
||||
type GiveawayCreated struct {
|
||||
PrizeStarCount int `json:"prize_star_count,omitempty"`
|
||||
}
|
||||
|
||||
// Giveaway represents a message about a scheduled giveaway.
|
||||
// Since: Bot API 7.0
|
||||
type Giveaway struct {
|
||||
Chats []Chat `json:"chats"`
|
||||
WinnersSelectionDate int `json:"winners_selection_date"`
|
||||
@@ -459,6 +511,8 @@ type Giveaway struct {
|
||||
PremiumSubscriptionMonthCount int `json:"premium_subscription_month_count,omitempty"`
|
||||
}
|
||||
|
||||
// GiveawayWinners represents a message about the completion of a giveaway with public winners.
|
||||
// Since: Bot API 7.0
|
||||
type GiveawayWinners struct {
|
||||
Chat Chat `json:"chat"`
|
||||
GiveawayMessageID int `json:"giveaway_message_id"`
|
||||
@@ -475,6 +529,8 @@ type GiveawayWinners struct {
|
||||
PrizeDescription string `json:"prize_description,omitempty"`
|
||||
}
|
||||
|
||||
// GiveawayCompleted represents a service message about the completion of a giveaway without public winners.
|
||||
// Since: Bot API 7.0
|
||||
type GiveawayCompleted struct {
|
||||
WinnerCount int `json:"winner_count"`
|
||||
UnclaimedPrizeCount int `json:"unclaimed_prize_count,omitempty"`
|
||||
@@ -482,12 +538,16 @@ type GiveawayCompleted struct {
|
||||
IsStarGiveaway bool `json:"is_star_giveaway,omitempty"`
|
||||
}
|
||||
|
||||
// WriteAccessAllowed represents a service message about a user allowing a bot to write messages.
|
||||
// Since: Bot API 6.4
|
||||
type WriteAccessAllowed struct {
|
||||
FromRequest bool `json:"from_request,omitempty"`
|
||||
WebAppName string `json:"web_app_name,omitempty"`
|
||||
FromAttachmentMenu bool `json:"from_attachment_menu,omitempty"`
|
||||
}
|
||||
|
||||
// BackgroundFillType represents the type of a background fill.
|
||||
// Since: Bot API 7.5
|
||||
type BackgroundFillType string
|
||||
|
||||
const (
|
||||
@@ -496,6 +556,8 @@ const (
|
||||
BackgroundFillFreeformGradientType BackgroundFillType = "freeform_gradient"
|
||||
)
|
||||
|
||||
// BackgroundFill describes the way a background is filled.
|
||||
// Since: Bot API 7.5
|
||||
type BackgroundFill struct {
|
||||
Type BackgroundFillType `json:"type"`
|
||||
|
||||
@@ -508,6 +570,8 @@ type BackgroundFill struct {
|
||||
Colors []int `json:"colors,omitempty"`
|
||||
}
|
||||
|
||||
// BackgroundTypeType represents the type of a chat background.
|
||||
// Since: Bot API 7.5
|
||||
type BackgroundTypeType string
|
||||
|
||||
const (
|
||||
@@ -517,6 +581,8 @@ const (
|
||||
BackgroundTypeChatThemeType BackgroundTypeType = "chat_theme"
|
||||
)
|
||||
|
||||
// BackgroundType describes the type of a background.
|
||||
// Since: Bot API 7.5
|
||||
type BackgroundType struct {
|
||||
Type BackgroundTypeType `json:"type"`
|
||||
|
||||
|
||||
@@ -33,6 +33,8 @@ const (
|
||||
UploaderStickerType UploaderFileType = "sticker"
|
||||
// UploaderCertificateType is the multipart field name for webhook certificate uploads.
|
||||
UploaderCertificateType UploaderFileType = "certificate"
|
||||
// UploaderLivePhotoType is the multipart field name for live photo uploads.
|
||||
UploaderLivePhotoType UploaderFileType = "live_photo"
|
||||
)
|
||||
|
||||
// UploaderFileType represents the Telegram form field name for a file upload.
|
||||
|
||||
+71
-17
@@ -3,6 +3,7 @@ package tgapi
|
||||
import "context"
|
||||
|
||||
// UploadPhoto holds parameters for uploading a photo using the Uploader.
|
||||
// Since: Bot API 1.0
|
||||
// See https://core.telegram.org/bots/api#sendphoto
|
||||
type UploadPhoto struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -27,6 +28,7 @@ type UploadPhoto struct {
|
||||
}
|
||||
|
||||
// SendPhoto uploads a photo via multipart and sends it as a message.
|
||||
// Since: Bot API 1.0
|
||||
// file is the photo file to upload.
|
||||
// See https://core.telegram.org/bots/api#sendphoto
|
||||
func (u *Uploader) SendPhoto(params UploadPhoto, file UploaderFile) (Message, error) {
|
||||
@@ -35,8 +37,7 @@ func (u *Uploader) SendPhoto(params UploadPhoto, file UploaderFile) (Message, er
|
||||
}
|
||||
|
||||
// SendPhotoWithContext is the context-aware variant of SendPhoto.
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// 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 (u *Uploader) SendPhotoWithContext(ctx context.Context, params UploadPhoto, file UploaderFile) (Message, error) {
|
||||
@@ -45,6 +46,7 @@ func (u *Uploader) SendPhotoWithContext(ctx context.Context, params UploadPhoto,
|
||||
}
|
||||
|
||||
// UploadAudio holds parameters for uploading an audio file using the Uploader.
|
||||
// Since: Bot API 1.2
|
||||
// See https://core.telegram.org/bots/api#sendaudio
|
||||
type UploadAudio struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -71,6 +73,7 @@ type UploadAudio struct {
|
||||
}
|
||||
|
||||
// SendAudio uploads an audio file via multipart and sends it as a message.
|
||||
// Since: Bot API 1.2
|
||||
// files are the audio file(s) to upload (typically one file).
|
||||
// See https://core.telegram.org/bots/api#sendaudio
|
||||
func (u *Uploader) SendAudio(params UploadAudio, files ...UploaderFile) (Message, error) {
|
||||
@@ -79,8 +82,7 @@ func (u *Uploader) SendAudio(params UploadAudio, files ...UploaderFile) (Message
|
||||
}
|
||||
|
||||
// SendAudioWithContext is the context-aware variant of SendAudio.
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// 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 (u *Uploader) SendAudioWithContext(ctx context.Context, params UploadAudio, files ...UploaderFile) (Message, error) {
|
||||
@@ -89,6 +91,7 @@ func (u *Uploader) SendAudioWithContext(ctx context.Context, params UploadAudio,
|
||||
}
|
||||
|
||||
// UploadDocument holds parameters for uploading a document using the Uploader.
|
||||
// Since: Bot API 1.0
|
||||
// See https://core.telegram.org/bots/api#senddocument
|
||||
type UploadDocument struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -112,6 +115,7 @@ type UploadDocument struct {
|
||||
}
|
||||
|
||||
// SendDocument uploads a document via multipart and sends it as a message.
|
||||
// Since: Bot API 1.0
|
||||
// files are the document file(s) to upload (typically one file).
|
||||
// See https://core.telegram.org/bots/api#senddocument
|
||||
func (u *Uploader) SendDocument(params UploadDocument, files ...UploaderFile) (Message, error) {
|
||||
@@ -120,8 +124,7 @@ func (u *Uploader) SendDocument(params UploadDocument, files ...UploaderFile) (M
|
||||
}
|
||||
|
||||
// SendDocumentWithContext is the context-aware variant of SendDocument.
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// 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 (u *Uploader) SendDocumentWithContext(ctx context.Context, params UploadDocument, files ...UploaderFile) (Message, error) {
|
||||
@@ -130,6 +133,7 @@ func (u *Uploader) SendDocumentWithContext(ctx context.Context, params UploadDoc
|
||||
}
|
||||
|
||||
// UploadVideo holds parameters for uploading a video using the Uploader.
|
||||
// Since: Bot API 1.0
|
||||
// See https://core.telegram.org/bots/api#sendvideo
|
||||
type UploadVideo struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -160,6 +164,7 @@ type UploadVideo struct {
|
||||
}
|
||||
|
||||
// SendVideo uploads a video via multipart and sends it as a message.
|
||||
// Since: Bot API 1.0
|
||||
// files are the video file(s) to upload (typically one file).
|
||||
// See https://core.telegram.org/bots/api#sendvideo
|
||||
func (u *Uploader) SendVideo(params UploadVideo, files ...UploaderFile) (Message, error) {
|
||||
@@ -168,8 +173,7 @@ func (u *Uploader) SendVideo(params UploadVideo, files ...UploaderFile) (Message
|
||||
}
|
||||
|
||||
// SendVideoWithContext is the context-aware variant of SendVideo.
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// 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 (u *Uploader) SendVideoWithContext(ctx context.Context, params UploadVideo, files ...UploaderFile) (Message, error) {
|
||||
@@ -178,6 +182,7 @@ func (u *Uploader) SendVideoWithContext(ctx context.Context, params UploadVideo,
|
||||
}
|
||||
|
||||
// UploadAnimation holds parameters for uploading an animation using the Uploader.
|
||||
// Since: Bot API 4.0
|
||||
// See https://core.telegram.org/bots/api#sendanimation
|
||||
type UploadAnimation struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -206,6 +211,7 @@ type UploadAnimation struct {
|
||||
}
|
||||
|
||||
// SendAnimation uploads an animation via multipart and sends it as a message.
|
||||
// Since: Bot API 4.0
|
||||
// files are the animation file(s) to upload (typically one file).
|
||||
// See https://core.telegram.org/bots/api#sendanimation
|
||||
func (u *Uploader) SendAnimation(params UploadAnimation, files ...UploaderFile) (Message, error) {
|
||||
@@ -214,8 +220,7 @@ func (u *Uploader) SendAnimation(params UploadAnimation, files ...UploaderFile)
|
||||
}
|
||||
|
||||
// SendAnimationWithContext is the context-aware variant of SendAnimation.
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// 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 (u *Uploader) SendAnimationWithContext(ctx context.Context, params UploadAnimation, files ...UploaderFile) (Message, error) {
|
||||
@@ -224,6 +229,7 @@ func (u *Uploader) SendAnimationWithContext(ctx context.Context, params UploadAn
|
||||
}
|
||||
|
||||
// UploadVoice holds parameters for uploading a voice note using the Uploader.
|
||||
// Since: Bot API 1.2
|
||||
// See https://core.telegram.org/bots/api#sendvoice
|
||||
type UploadVoice struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -247,6 +253,7 @@ type UploadVoice struct {
|
||||
}
|
||||
|
||||
// SendVoice uploads a voice note via multipart and sends it as a message.
|
||||
// Since: Bot API 1.2
|
||||
// files are the voice file(s) to upload (typically one file).
|
||||
// See https://core.telegram.org/bots/api#sendvoice
|
||||
func (u *Uploader) SendVoice(params UploadVoice, files ...UploaderFile) (Message, error) {
|
||||
@@ -255,8 +262,7 @@ func (u *Uploader) SendVoice(params UploadVoice, files ...UploaderFile) (Message
|
||||
}
|
||||
|
||||
// SendVoiceWithContext is the context-aware variant of SendVoice.
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// 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 (u *Uploader) SendVoiceWithContext(ctx context.Context, params UploadVoice, files ...UploaderFile) (Message, error) {
|
||||
@@ -265,6 +271,7 @@ func (u *Uploader) SendVoiceWithContext(ctx context.Context, params UploadVoice,
|
||||
}
|
||||
|
||||
// UploadVideoNote holds parameters for uploading a video note (rounded video) using the Uploader.
|
||||
// Since: Bot API 3.0
|
||||
// See https://core.telegram.org/bots/api#sendvideonote
|
||||
type UploadVideoNote struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
@@ -286,6 +293,7 @@ type UploadVideoNote struct {
|
||||
}
|
||||
|
||||
// SendVideoNote uploads a video note via multipart and sends it as a message.
|
||||
// Since: Bot API 3.0
|
||||
// files are the video note file(s) to upload (typically one file).
|
||||
// See https://core.telegram.org/bots/api#sendvideonote
|
||||
func (u *Uploader) SendVideoNote(params UploadVideoNote, files ...UploaderFile) (Message, error) {
|
||||
@@ -294,8 +302,7 @@ func (u *Uploader) SendVideoNote(params UploadVideoNote, files ...UploaderFile)
|
||||
}
|
||||
|
||||
// SendVideoNoteWithContext is the context-aware variant of SendVideoNote.
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// 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 (u *Uploader) SendVideoNoteWithContext(ctx context.Context, params UploadVideoNote, files ...UploaderFile) (Message, error) {
|
||||
@@ -304,12 +311,14 @@ func (u *Uploader) SendVideoNoteWithContext(ctx context.Context, params UploadVi
|
||||
}
|
||||
|
||||
// UploadChatPhoto holds parameters for uploading a chat photo using the Uploader.
|
||||
// Since: Bot API 3.1
|
||||
// See https://core.telegram.org/bots/api#setchatphoto
|
||||
type UploadChatPhoto struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
}
|
||||
|
||||
// SetChatPhoto uploads a new chat photo.
|
||||
// Since: Bot API 3.1
|
||||
// photo is the photo file to upload.
|
||||
// See https://core.telegram.org/bots/api#setchatphoto
|
||||
func (u *Uploader) SetChatPhoto(params UploadChatPhoto, photo UploaderFile) (bool, error) {
|
||||
@@ -318,8 +327,7 @@ func (u *Uploader) SetChatPhoto(params UploadChatPhoto, photo UploaderFile) (boo
|
||||
}
|
||||
|
||||
// SetChatPhotoWithContext is the context-aware variant of SetChatPhoto.
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// SetChatPhotoWithContext is the context-aware variant of SetChatPhoto.
|
||||
// Since: Bot API 3.1
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#setchatphoto
|
||||
func (u *Uploader) SetChatPhotoWithContext(ctx context.Context, params UploadChatPhoto, photo UploaderFile) (bool, error) {
|
||||
@@ -328,6 +336,7 @@ func (u *Uploader) SetChatPhotoWithContext(ctx context.Context, params UploadCha
|
||||
}
|
||||
|
||||
// UploadSetWebhook holds multipart parameters for the setWebhook method.
|
||||
// Since: Bot API 1.0
|
||||
// Use this type when uploading a self-signed certificate file.
|
||||
// See https://core.telegram.org/bots/api#setwebhook
|
||||
type UploadSetWebhook struct {
|
||||
@@ -340,7 +349,8 @@ type UploadSetWebhook struct {
|
||||
}
|
||||
|
||||
// SetWebhook uploads a certificate and sets a webhook URL.
|
||||
// certificate maps to the multipart field \"certificate\".
|
||||
// Since: Bot API 1.0
|
||||
// certificate maps to the multipart field "certificate".
|
||||
// See https://core.telegram.org/bots/api#setwebhook
|
||||
func (u *Uploader) SetWebhook(params UploadSetWebhook, certificate UploaderFile) (bool, error) {
|
||||
req := NewUploaderRequest[bool]("setWebhook", params, certificate.SetType(UploaderCertificateType))
|
||||
@@ -348,9 +358,53 @@ func (u *Uploader) SetWebhook(params UploadSetWebhook, certificate UploaderFile)
|
||||
}
|
||||
|
||||
// SetWebhookWithContext is the context-aware variant of SetWebhook.
|
||||
// Since: Bot API 1.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#setwebhook
|
||||
func (u *Uploader) SetWebhookWithContext(ctx context.Context, params UploadSetWebhook, certificate UploaderFile) (bool, error) {
|
||||
req := NewUploaderRequest[bool]("setWebhook", params, certificate.SetType(UploaderCertificateType))
|
||||
return req.DoWithContext(ctx, u)
|
||||
}
|
||||
|
||||
// UploadLivePhoto holds parameters for uploading a live photo using the Uploader.
|
||||
// Since: Bot API 10.0
|
||||
// See https://core.telegram.org/bots/api#sendlivephoto
|
||||
type UploadLivePhoto 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"`
|
||||
|
||||
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 uploads a live photo via multipart and sends it as a message.
|
||||
// Since: Bot API 10.0
|
||||
// file is the live photo file to upload.
|
||||
// See https://core.telegram.org/bots/api#sendlivephoto
|
||||
func (u *Uploader) SendLivePhoto(params UploadLivePhoto, file UploaderFile) (Message, error) {
|
||||
req := NewUploaderRequestWithChatID[Message]("sendLivePhoto", params, params.ChatID, file.SetType(UploaderLivePhotoType))
|
||||
return req.Do(u)
|
||||
}
|
||||
|
||||
// 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 (u *Uploader) SendLivePhotoWithContext(ctx context.Context, params UploadLivePhoto, file UploaderFile) (Message, error) {
|
||||
req := NewUploaderRequestWithChatID[Message]("sendLivePhoto", params, params.ChatID, file.SetType(UploaderLivePhotoType))
|
||||
return req.DoWithContext(ctx, u)
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package tgapi
|
||||
import "context"
|
||||
|
||||
// GetUserProfilePhotos holds parameters for the GetUserProfilePhotos method.
|
||||
// Since: Bot API 1.4
|
||||
// See https://core.telegram.org/bots/api#getuserprofilephotos
|
||||
type GetUserProfilePhotos struct {
|
||||
UserID int64 `json:"user_id"`
|
||||
@@ -11,6 +12,7 @@ type GetUserProfilePhotos struct {
|
||||
}
|
||||
|
||||
// GetUserProfilePhotos returns a list of profile pictures for a user.
|
||||
// Since: Bot API 1.4
|
||||
// See https://core.telegram.org/bots/api#getuserprofilephotos
|
||||
func (api *API) GetUserProfilePhotos(params GetUserProfilePhotos) (UserProfilePhotos, error) {
|
||||
req := NewRequest[UserProfilePhotos]("getUserProfilePhotos", params)
|
||||
@@ -18,6 +20,7 @@ func (api *API) GetUserProfilePhotos(params GetUserProfilePhotos) (UserProfilePh
|
||||
}
|
||||
|
||||
// GetUserProfilePhotosWithContext is the context-aware variant of GetUserProfilePhotos.
|
||||
// Since: Bot API 1.4
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#getuserprofilephotos
|
||||
func (api *API) GetUserProfilePhotosWithContext(ctx context.Context, params GetUserProfilePhotos) (UserProfilePhotos, error) {
|
||||
@@ -26,6 +29,7 @@ func (api *API) GetUserProfilePhotosWithContext(ctx context.Context, params GetU
|
||||
}
|
||||
|
||||
// GetUserProfileAudios holds parameters for the GetUserProfileAudios method.
|
||||
// Since: Bot API 9.3
|
||||
// See https://core.telegram.org/bots/api#getuserprofileaudios
|
||||
type GetUserProfileAudios struct {
|
||||
UserID int64 `json:"user_id"`
|
||||
@@ -34,6 +38,7 @@ type GetUserProfileAudios struct {
|
||||
}
|
||||
|
||||
// GetUserProfileAudios returns a list of profile audios for a user.
|
||||
// Since: Bot API 9.3
|
||||
// See https://core.telegram.org/bots/api#getuserprofileaudios
|
||||
func (api *API) GetUserProfileAudios(params GetUserProfileAudios) (UserProfileAudios, error) {
|
||||
req := NewRequest[UserProfileAudios]("getUserProfileAudios", params)
|
||||
@@ -41,6 +46,7 @@ func (api *API) GetUserProfileAudios(params GetUserProfileAudios) (UserProfileAu
|
||||
}
|
||||
|
||||
// GetUserProfileAudiosWithContext is the context-aware variant of GetUserProfileAudios.
|
||||
// Since: Bot API 9.3
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#getuserprofileaudios
|
||||
func (api *API) GetUserProfileAudiosWithContext(ctx context.Context, params GetUserProfileAudios) (UserProfileAudios, error) {
|
||||
@@ -49,6 +55,7 @@ func (api *API) GetUserProfileAudiosWithContext(ctx context.Context, params GetU
|
||||
}
|
||||
|
||||
// SetUserEmojiStatus holds parameters for the SetUserEmojiStatus method.
|
||||
// Since: Bot API 8.0
|
||||
// See https://core.telegram.org/bots/api#setuseremojistatus
|
||||
type SetUserEmojiStatus struct {
|
||||
UserID int64 `json:"user_id"`
|
||||
@@ -57,6 +64,7 @@ type SetUserEmojiStatus struct {
|
||||
}
|
||||
|
||||
// SetUserEmojiStatus sets a custom emoji status for a user.
|
||||
// Since: Bot API 8.0
|
||||
// Returns true on success.
|
||||
// See https://core.telegram.org/bots/api#setuseremojistatus
|
||||
func (api *API) SetUserEmojiStatus(params SetUserEmojiStatus) (bool, error) {
|
||||
@@ -65,6 +73,7 @@ func (api *API) SetUserEmojiStatus(params SetUserEmojiStatus) (bool, error) {
|
||||
}
|
||||
|
||||
// SetUserEmojiStatusWithContext is the context-aware variant of SetUserEmojiStatus.
|
||||
// Since: Bot API 8.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#setuseremojistatus
|
||||
func (api *API) SetUserEmojiStatusWithContext(ctx context.Context, params SetUserEmojiStatus) (bool, error) {
|
||||
@@ -73,6 +82,7 @@ func (api *API) SetUserEmojiStatusWithContext(ctx context.Context, params SetUse
|
||||
}
|
||||
|
||||
// GetUserGifts holds parameters for the GetUserGifts method.
|
||||
// Since: Bot API 9.3
|
||||
// See https://core.telegram.org/bots/api#getusergifts
|
||||
type GetUserGifts struct {
|
||||
UserID int64 `json:"user_id"`
|
||||
@@ -87,6 +97,7 @@ type GetUserGifts struct {
|
||||
}
|
||||
|
||||
// GetUserGifts returns gifts owned by a user.
|
||||
// Since: Bot API 9.3
|
||||
// See https://core.telegram.org/bots/api#getusergifts
|
||||
func (api *API) GetUserGifts(params GetUserGifts) (OwnedGifts, error) {
|
||||
req := NewRequest[OwnedGifts]("getUserGifts", params)
|
||||
@@ -94,9 +105,36 @@ func (api *API) GetUserGifts(params GetUserGifts) (OwnedGifts, error) {
|
||||
}
|
||||
|
||||
// GetUserGiftsWithContext is the context-aware variant of GetUserGifts.
|
||||
// Since: Bot API 9.3
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#getusergifts
|
||||
func (api *API) GetUserGiftsWithContext(ctx context.Context, params GetUserGifts) (OwnedGifts, error) {
|
||||
req := NewRequest[OwnedGifts]("getUserGifts", params)
|
||||
return req.DoWithContext(ctx, api)
|
||||
}
|
||||
|
||||
// GetUserPersonalChatMessages holds parameters for the getUserPersonalChatMessages method.
|
||||
// Since: Bot API 10.0
|
||||
// See https://core.telegram.org/bots/api#getuserpersonalchatmessages
|
||||
type GetUserPersonalChatMessages struct {
|
||||
UserID int64 `json:"user_id"`
|
||||
Offset int `json:"offset,omitempty"`
|
||||
Limit int `json:"limit,omitempty"`
|
||||
}
|
||||
|
||||
// GetUserPersonalChatMessages returns messages from the personal chat of the user with the bot.
|
||||
// Since: Bot API 10.0
|
||||
// See https://core.telegram.org/bots/api#getuserpersonalchatmessages
|
||||
func (api *API) GetUserPersonalChatMessages(params GetUserPersonalChatMessages) ([]Message, error) {
|
||||
req := NewRequest[[]Message]("getUserPersonalChatMessages", params)
|
||||
return req.Do(api)
|
||||
}
|
||||
|
||||
// GetUserPersonalChatMessagesWithContext is the context-aware variant of GetUserPersonalChatMessages.
|
||||
// Since: Bot API 10.0
|
||||
// It executes the same request but uses ctx for cancellation and deadlines.
|
||||
// See https://core.telegram.org/bots/api#getuserpersonalchatmessages
|
||||
func (api *API) GetUserPersonalChatMessagesWithContext(ctx context.Context, params GetUserPersonalChatMessages) ([]Message, error) {
|
||||
req := NewRequest[[]Message]("getUserPersonalChatMessages", params)
|
||||
return req.DoWithContext(ctx, api)
|
||||
}
|
||||
|
||||
+23
-16
@@ -1,27 +1,31 @@
|
||||
package tgapi
|
||||
|
||||
// User represents a Telegram user or bot.
|
||||
// Since: Bot API 1.0
|
||||
// See https://core.telegram.org/bots/api#user
|
||||
type User struct {
|
||||
ID int64 `json:"id"`
|
||||
IsBot bool `json:"is_bot"`
|
||||
FirstName string `json:"first_name"`
|
||||
LastName *string `json:"last_name,omitempty"`
|
||||
Username *string `json:"username,omitempty"`
|
||||
LanguageCode *string `json:"language_code,omitempty"`
|
||||
IsPremium *bool `json:"is_premium,omitempty"`
|
||||
AddedToAttachmentMenu *bool `json:"added_to_attachment_menu,omitempty"`
|
||||
CanJoinGroups *bool `json:"can_join_groups,omitempty"`
|
||||
CanReadAllGroupMessages *bool `json:"can_read_all_group_messages,omitempty"`
|
||||
CanManageBots *bool `json:"can_manage_bots,omitempty"`
|
||||
SupportsInlineQueries *bool `json:"supports_inline_queries,omitempty"`
|
||||
CanConnectToBusiness *bool `json:"can_connect_to_business,omitempty"`
|
||||
HasMainWebApp *bool `json:"has_main_web_app,omitempty"`
|
||||
HasTopicsEnabled *bool `json:"has_topics_enabled,omitempty"`
|
||||
AllowsUsersToCreateTopics *bool `json:"allows_users_to_create_topics,omitempty"`
|
||||
ID int64 `json:"id"`
|
||||
FirstName string `json:"first_name"`
|
||||
LastName *string `json:"last_name,omitempty"`
|
||||
Username *string `json:"username,omitempty"`
|
||||
|
||||
IsBot bool `json:"is_bot"` // Since: Bot API 3.3
|
||||
LanguageCode *string `json:"language_code,omitempty"` // Since: Bot API 3.0
|
||||
IsPremium *bool `json:"is_premium,omitempty"` // Since: Bot API 6.1
|
||||
AddedToAttachmentMenu *bool `json:"added_to_attachment_menu,omitempty"` // Since: Bot API 6.1
|
||||
CanJoinGroups *bool `json:"can_join_groups,omitempty"` // Since: Bot API 4.6
|
||||
CanReadAllGroupMessages *bool `json:"can_read_all_group_messages,omitempty"` // Since: Bot API 4.6
|
||||
SupportsInlineQueries *bool `json:"supports_inline_queries,omitempty"` // Since: Bot API 4.6
|
||||
CanConnectToBusiness *bool `json:"can_connect_to_business,omitempty"` // Since: Bot API 7.2
|
||||
HasMainWebApp *bool `json:"has_main_web_app,omitempty"` // Since: Bot API 7.8
|
||||
HasTopicsEnabled *bool `json:"has_topics_enabled,omitempty"` // Since: Bot API 9.3
|
||||
AllowsUsersToCreateTopics *bool `json:"allows_users_to_create_topics,omitempty"` // Since: Bot API 9.4
|
||||
CanManageBots *bool `json:"can_manage_bots,omitempty"` // Since: Bot API 9.6
|
||||
SupportsGuestQueries *bool `json:"supports_guest_queries,omitempty"` // Since: Bot API 10.0
|
||||
}
|
||||
|
||||
// UserProfilePhotos represents a user's profile photos.
|
||||
// Since: Bot API 1.4
|
||||
// See https://core.telegram.org/bots/api#userprofilephotos
|
||||
type UserProfilePhotos struct {
|
||||
TotalCount int `json:"total_count"`
|
||||
@@ -29,6 +33,7 @@ type UserProfilePhotos struct {
|
||||
}
|
||||
|
||||
// UserProfileAudios represents a user's profile audios.
|
||||
// Since: Bot API 9.3
|
||||
// See https://core.telegram.org/bots/api#userprofileaudios
|
||||
type UserProfileAudios struct {
|
||||
TotalCount int `json:"total_count"`
|
||||
@@ -36,6 +41,7 @@ type UserProfileAudios struct {
|
||||
}
|
||||
|
||||
// UserRating represents a user's rating with level progression.
|
||||
// Since: Bot API 9.3
|
||||
// See https://core.telegram.org/bots/api#userrating
|
||||
type UserRating struct {
|
||||
Level int `json:"level"`
|
||||
@@ -45,6 +51,7 @@ type UserRating struct {
|
||||
}
|
||||
|
||||
// Birthdate represents a user's birthdate.
|
||||
// Since: Bot API 7.2
|
||||
// See https://core.telegram.org/bots/api#birthdate
|
||||
type Birthdate struct {
|
||||
Day int `json:"day"`
|
||||
|
||||
Reference in New Issue
Block a user