(new): v1.2 release
Golang lint / lint (push) Successful in 11m32s

This commit is contained in:
2026-08-19 14:58:25 +03:00
parent f03a081ed6
commit 29b208eeec
79 changed files with 7301 additions and 2060 deletions
+379 -120
View File
@@ -45,29 +45,59 @@ func (u *Uploader) SendRichMessageDraftWithContext(ctx context.Context, params S
// Since: Bot API 1.0
// See https://core.telegram.org/bots/api#sendphoto
type UploadPhoto 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"`
// BusinessConnectionID Optional. Unique identifier of the business connection on behalf of which the
// message will be sent
BusinessConnectionID string `json:"business_connection_id,omitempty"`
// ChatID Required. Unique identifier for the target chat or username of the target bot, supergroup or
// channel in the format @username
ChatID int64 `json:"chat_id"`
// MessageThreadID Optional. Unique identifier for the target message thread (topic) of a forum; for forum
// supergroups and private chats of bots with forum topic mode enabled only
MessageThreadID int `json:"message_thread_id,omitempty"`
// DirectMessagesTopicID Optional. Identifier of the direct messages topic to which the message will be
// sent; required if the message is sent to a direct messages chat
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
// ReceiverUserID identifies the user who can see the ephemeral message.
ReceiverUserID int64 `json:"receiver_user_id,omitempty"` // Since: Bot API 10.2
// CallbackQueryID identifies the callback query that triggered an ephemeral response.
CallbackQueryID string `json:"callback_query_id,omitempty"` // Since: Bot API 10.2
Caption string `json:"caption,omitempty"`
ParseMode ParseMode `json:"parse_mode,omitempty"`
// Caption Optional. Photo caption (may also be used when resending photos by file_id), 0-1024 characters
// after entities parsing
Caption string `json:"caption,omitempty"`
// ParseMode Optional. Mode for parsing entities in the photo caption. See formatting options for more
// details.
ParseMode ParseMode `json:"parse_mode,omitempty"`
// CaptionEntities Optional. A JSON-serialized list of special entities that appear in the caption, which
// can be specified instead of parse_mode
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"`
// ShowCaptionAboveMedia Optional. Pass True if the caption must be shown above the message media
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
// HasSpoiler Optional. Pass True if the photo needs to be covered with a spoiler animation
HasSpoiler bool `json:"has_spoiler,omitempty"`
// DisableNotification Optional. Sends the message silently. Users will receive a notification with no
// sound.
DisableNotification bool `json:"disable_notification,omitempty"`
// ProtectContent Optional. Protects the contents of the sent message from forwarding and saving
ProtectContent bool `json:"protect_content,omitempty"`
// AllowPaidBroadcast Optional. Pass True to allow up to 1000 messages per second, ignoring broadcasting
// limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's
// balance.
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
// MessageEffectID Optional. Unique identifier of the message effect to be added to the message; for private
// chats only
MessageEffectID string `json:"message_effect_id,omitempty"`
// SuggestedPostParameters Optional. A JSON-serialized object containing the parameters of the suggested
// post to send; for direct messages chats only. If the message is sent as a reply to another suggested
// post, then that suggested post is automatically declined.
SuggestedPostParameters *SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
ReplyParameters *ReplyParameters `json:"reply_parameters,omitempty"`
ReplyMarkup *ReplyMarkup `json:"reply_markup,omitempty"`
// ReplyParameters Optional. Description of the message to reply to
ReplyParameters *ReplyParameters `json:"reply_parameters,omitempty"`
// ReplyMarkup Optional. Additional interface options. A JSON-serialized object for an inline keyboard,
// custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user.
ReplyMarkup *ReplyMarkup `json:"reply_markup,omitempty"`
}
// SendPhoto uploads a photo via multipart and sends it as a message.
@@ -92,31 +122,61 @@ func (u *Uploader) SendPhotoWithContext(ctx context.Context, params UploadPhoto,
// Since: Bot API 1.2
// See https://core.telegram.org/bots/api#sendaudio
type UploadAudio 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"`
// BusinessConnectionID Optional. Unique identifier of the business connection on behalf of which the
// message will be sent
BusinessConnectionID string `json:"business_connection_id,omitempty"`
// ChatID Required. Unique identifier for the target chat or username of the target bot, supergroup or
// channel in the format @username
ChatID int64 `json:"chat_id"`
// MessageThreadID Optional. Unique identifier for the target message thread (topic) of a forum; for forum
// supergroups and private chats of bots with forum topic mode enabled only
MessageThreadID int `json:"message_thread_id,omitempty"`
// DirectMessagesTopicID Optional. Identifier of the direct messages topic to which the message will be
// sent; required if the message is sent to a direct messages chat
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
// ReceiverUserID identifies the user who can see the ephemeral message.
ReceiverUserID int64 `json:"receiver_user_id,omitempty"` // Since: Bot API 10.2
// CallbackQueryID identifies the callback query that triggered an ephemeral response.
CallbackQueryID string `json:"callback_query_id,omitempty"` // Since: Bot API 10.2
Caption string `json:"caption,omitempty"`
ParseMode ParseMode `json:"parse_mode,omitempty"`
// Caption Optional. Audio caption, 0-1024 characters after entities parsing
Caption string `json:"caption,omitempty"`
// ParseMode Optional. Mode for parsing entities in the audio caption. See formatting options for more
// details.
ParseMode ParseMode `json:"parse_mode,omitempty"`
// CaptionEntities Optional. A JSON-serialized list of special entities that appear in the caption, which
// can be specified instead of parse_mode
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
Duration int `json:"duration,omitempty"`
// Duration Optional. Duration of the audio in seconds
Duration int `json:"duration,omitempty"`
// Performer Optional. Performer
Performer string `json:"performer,omitempty"`
Title string `json:"title,omitempty"`
// Title Optional. Track name
Title string `json:"title,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"`
// DisableNotification Optional. Sends the message silently. Users will receive a notification with no
// sound.
DisableNotification bool `json:"disable_notification,omitempty"`
// ProtectContent Optional. Protects the contents of the sent message from forwarding and saving
ProtectContent bool `json:"protect_content,omitempty"`
// AllowPaidBroadcast Optional. Pass True to allow up to 1000 messages per second, ignoring broadcasting
// limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's
// balance.
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
// MessageEffectID Optional. Unique identifier of the message effect to be added to the message; for private
// chats only
MessageEffectID string `json:"message_effect_id,omitempty"`
// SuggestedPostParameters Optional. A JSON-serialized object containing the parameters of the suggested
// post to send; for direct messages chats only. If the message is sent as a reply to another suggested
// post, then that suggested post is automatically declined.
SuggestedPostParameters *SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
ReplyParameters *ReplyParameters `json:"reply_parameters,omitempty"`
ReplyMarkup *ReplyMarkup `json:"reply_markup,omitempty"`
// ReplyParameters Optional. Description of the message to reply to
ReplyParameters *ReplyParameters `json:"reply_parameters,omitempty"`
// ReplyMarkup Optional. Additional interface options. A JSON-serialized object for an inline keyboard,
// custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user.
ReplyMarkup *ReplyMarkup `json:"reply_markup,omitempty"`
}
// SendAudio uploads an audio file via multipart and sends it as a message.
@@ -141,28 +201,58 @@ func (u *Uploader) SendAudioWithContext(ctx context.Context, params UploadAudio,
// Since: Bot API 1.0
// See https://core.telegram.org/bots/api#senddocument
type UploadDocument 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"`
// BusinessConnectionID Optional. Unique identifier of the business connection on behalf of which the
// message will be sent
BusinessConnectionID string `json:"business_connection_id,omitempty"`
// ChatID Required. Unique identifier for the target chat or username of the target bot, supergroup or
// channel in the format @username
ChatID int64 `json:"chat_id"`
// MessageThreadID Optional. Unique identifier for the target message thread (topic) of a forum; for forum
// supergroups and private chats of bots with forum topic mode enabled only
MessageThreadID int `json:"message_thread_id,omitempty"`
// DirectMessagesTopicID Optional. Identifier of the direct messages topic to which the message will be
// sent; required if the message is sent to a direct messages chat
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
// ReceiverUserID identifies the user who can see the ephemeral message.
ReceiverUserID int64 `json:"receiver_user_id,omitempty"` // Since: Bot API 10.2
// CallbackQueryID identifies the callback query that triggered an ephemeral response.
CallbackQueryID string `json:"callback_query_id,omitempty"` // Since: Bot API 10.2
Caption string `json:"caption,omitempty"`
ParseMode ParseMode `json:"parse_mode,omitempty"`
// Caption Optional. Document caption (may also be used when resending documents by file_id), 0-1024
// characters after entities parsing
Caption string `json:"caption,omitempty"`
// ParseMode Optional. Mode for parsing entities in the document caption. See formatting options for more
// details.
ParseMode ParseMode `json:"parse_mode,omitempty"`
// CaptionEntities Optional. A JSON-serialized list of special entities that appear in the caption, which
// can be specified instead of parse_mode
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
DisableContentTypeDetection bool `json:"disable_content_type_detection,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"`
// DisableContentTypeDetection Optional. Disables automatic server-side content type detection for files
// uploaded using multipart/form-data
DisableContentTypeDetection bool `json:"disable_content_type_detection,omitempty"`
// DisableNotification Optional. Sends the message silently. Users will receive a notification with no
// sound.
DisableNotification bool `json:"disable_notification,omitempty"`
// ProtectContent Optional. Protects the contents of the sent message from forwarding and saving
ProtectContent bool `json:"protect_content,omitempty"`
// AllowPaidBroadcast Optional. Pass True to allow up to 1000 messages per second, ignoring broadcasting
// limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's
// balance.
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
// MessageEffectID Optional. Unique identifier of the message effect to be added to the message; for private
// chats only
MessageEffectID string `json:"message_effect_id,omitempty"`
// SuggestedPostParameters Optional. A JSON-serialized object containing the parameters of the suggested
// post to send; for direct messages chats only. If the message is sent as a reply to another suggested
// post, then that suggested post is automatically declined.
SuggestedPostParameters *SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
ReplyParameters *ReplyParameters `json:"reply_parameters,omitempty"`
ReplyMarkup *ReplyMarkup `json:"reply_markup,omitempty"`
// ReplyParameters Optional. Description of the message to reply to
ReplyParameters *ReplyParameters `json:"reply_parameters,omitempty"`
// ReplyMarkup Optional. Additional interface options. A JSON-serialized object for an inline keyboard,
// custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user.
ReplyMarkup *ReplyMarkup `json:"reply_markup,omitempty"`
}
// SendDocument uploads a document via multipart and sends it as a message.
@@ -187,35 +277,70 @@ func (u *Uploader) SendDocumentWithContext(ctx context.Context, params UploadDoc
// Since: Bot API 1.0
// See https://core.telegram.org/bots/api#sendvideo
type UploadVideo 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"`
// BusinessConnectionID Optional. Unique identifier of the business connection on behalf of which the
// message will be sent
BusinessConnectionID string `json:"business_connection_id,omitempty"`
// ChatID Required. Unique identifier for the target chat or username of the target bot, supergroup or
// channel in the format @username
ChatID int64 `json:"chat_id"`
// MessageThreadID Optional. Unique identifier for the target message thread (topic) of a forum; for forum
// supergroups and private chats of bots with forum topic mode enabled only
MessageThreadID int `json:"message_thread_id,omitempty"`
// DirectMessagesTopicID Optional. Identifier of the direct messages topic to which the message will be
// sent; required if the message is sent to a direct messages chat
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
// ReceiverUserID identifies the user who can see the ephemeral message.
ReceiverUserID int64 `json:"receiver_user_id,omitempty"` // Since: Bot API 10.2
// CallbackQueryID identifies the callback query that triggered an ephemeral response.
CallbackQueryID string `json:"callback_query_id,omitempty"` // Since: Bot API 10.2
// Duration Optional. Duration of sent video in seconds
Duration int `json:"duration,omitempty"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
// Width Optional. Video width
Width int `json:"width,omitempty"`
// Height Optional. Video height
Height int `json:"height,omitempty"`
StartTimestamp int64 `json:"start_timestamp,omitempty"`
Caption string `json:"caption,omitempty"`
ParseMode ParseMode `json:"parse_mode,omitempty"`
// StartTimestamp Optional. Start timestamp for the video in the message
StartTimestamp int64 `json:"start_timestamp,omitempty"`
// Caption Optional. Video caption (may also be used when resending videos by file_id), 0-1024 characters
// after entities parsing
Caption string `json:"caption,omitempty"`
// ParseMode Optional. Mode for parsing entities in the video caption. See formatting options for more
// details.
ParseMode ParseMode `json:"parse_mode,omitempty"`
// CaptionEntities Optional. A JSON-serialized list of special entities that appear in the caption, which
// can be specified instead of parse_mode
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
HasSpoiler bool `json:"has_spoiler,omitempty"`
SupportsStreaming bool `json:"supports_streaming,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"`
// ShowCaptionAboveMedia Optional. Pass True if the caption must be shown above the message media
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
// HasSpoiler Optional. Pass True if the video needs to be covered with a spoiler animation
HasSpoiler bool `json:"has_spoiler,omitempty"`
// SupportsStreaming Optional. Pass True if the uploaded video is suitable for streaming
SupportsStreaming bool `json:"supports_streaming,omitempty"`
// DisableNotification Optional. Sends the message silently. Users will receive a notification with no
// sound.
DisableNotification bool `json:"disable_notification,omitempty"`
// ProtectContent Optional. Protects the contents of the sent message from forwarding and saving
ProtectContent bool `json:"protect_content,omitempty"`
// AllowPaidBroadcast Optional. Pass True to allow up to 1000 messages per second, ignoring broadcasting
// limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's
// balance.
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
// MessageEffectID Optional. Unique identifier of the message effect to be added to the message; for private
// chats only
MessageEffectID string `json:"message_effect_id,omitempty"`
// SuggestedPostParameters Optional. A JSON-serialized object containing the parameters of the suggested
// post to send; for direct messages chats only. If the message is sent as a reply to another suggested
// post, then that suggested post is automatically declined.
SuggestedPostParameters *SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
ReplyParameters *ReplyParameters `json:"reply_parameters,omitempty"`
ReplyMarkup *ReplyMarkup `json:"reply_markup,omitempty"`
// ReplyParameters Optional. Description of the message to reply to
ReplyParameters *ReplyParameters `json:"reply_parameters,omitempty"`
// ReplyMarkup Optional. Additional interface options. A JSON-serialized object for an inline keyboard,
// custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user.
ReplyMarkup *ReplyMarkup `json:"reply_markup,omitempty"`
}
// SendVideo uploads a video via multipart and sends it as a message.
@@ -240,33 +365,66 @@ func (u *Uploader) SendVideoWithContext(ctx context.Context, params UploadVideo,
// Since: Bot API 4.0
// See https://core.telegram.org/bots/api#sendanimation
type UploadAnimation 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"`
// BusinessConnectionID Optional. Unique identifier of the business connection on behalf of which the
// message will be sent
BusinessConnectionID string `json:"business_connection_id,omitempty"`
// ChatID Required. Unique identifier for the target chat or username of the target bot, supergroup or
// channel in the format @username
ChatID int64 `json:"chat_id"`
// MessageThreadID Optional. Unique identifier for the target message thread (topic) of a forum; for forum
// supergroups and private chats of bots with forum topic mode enabled only
MessageThreadID int `json:"message_thread_id,omitempty"`
// DirectMessagesTopicID Optional. Identifier of the direct messages topic to which the message will be
// sent; required if the message is sent to a direct messages chat
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
// ReceiverUserID identifies the user who can see the ephemeral message.
ReceiverUserID int64 `json:"receiver_user_id,omitempty"` // Since: Bot API 10.2
// CallbackQueryID identifies the callback query that triggered an ephemeral response.
CallbackQueryID string `json:"callback_query_id,omitempty"` // Since: Bot API 10.2
// Duration Optional. Duration of sent animation in seconds
Duration int `json:"duration,omitempty"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
// Width Optional. Animation width
Width int `json:"width,omitempty"`
// Height Optional. Animation height
Height int `json:"height,omitempty"`
Caption string `json:"caption,omitempty"`
ParseMode ParseMode `json:"parse_mode,omitempty"`
// Caption Optional. Animation caption (may also be used when resending animation by file_id), 0-1024
// characters after entities parsing
Caption string `json:"caption,omitempty"`
// ParseMode Optional. Mode for parsing entities in the animation caption. See formatting options for more
// details.
ParseMode ParseMode `json:"parse_mode,omitempty"`
// CaptionEntities Optional. A JSON-serialized list of special entities that appear in the caption, which
// can be specified instead of parse_mode
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"`
// ShowCaptionAboveMedia Optional. Pass True if the caption must be shown above the message media
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
// HasSpoiler Optional. Pass True if the animation needs to be covered with a spoiler animation
HasSpoiler bool `json:"has_spoiler,omitempty"`
// DisableNotification Optional. Sends the message silently. Users will receive a notification with no
// sound.
DisableNotification bool `json:"disable_notification,omitempty"`
// ProtectContent Optional. Protects the contents of the sent message from forwarding and saving
ProtectContent bool `json:"protect_content,omitempty"`
// AllowPaidBroadcast Optional. Pass True to allow up to 1000 messages per second, ignoring broadcasting
// limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's
// balance.
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
// MessageEffectID Optional. Unique identifier of the message effect to be added to the message; for private
// chats only
MessageEffectID string `json:"message_effect_id,omitempty"`
// SuggestedPostParameters Optional. A JSON-serialized object containing the parameters of the suggested
// post to send; for direct messages chats only. If the message is sent as a reply to another suggested
// post, then that suggested post is automatically declined.
SuggestedPostParameters *SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
ReplyParameters *ReplyParameters `json:"reply_parameters,omitempty"`
ReplyMarkup *ReplyMarkup `json:"reply_markup,omitempty"`
// ReplyParameters Optional. Description of the message to reply to
ReplyParameters *ReplyParameters `json:"reply_parameters,omitempty"`
// ReplyMarkup Optional. Additional interface options. A JSON-serialized object for an inline keyboard,
// custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user.
ReplyMarkup *ReplyMarkup `json:"reply_markup,omitempty"`
}
// SendAnimation uploads an animation via multipart and sends it as a message.
@@ -291,28 +449,56 @@ func (u *Uploader) SendAnimationWithContext(ctx context.Context, params UploadAn
// Since: Bot API 1.2
// See https://core.telegram.org/bots/api#sendvoice
type UploadVoice 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"`
// BusinessConnectionID Optional. Unique identifier of the business connection on behalf of which the
// message will be sent
BusinessConnectionID string `json:"business_connection_id,omitempty"`
// ChatID Required. Unique identifier for the target chat or username of the target bot, supergroup or
// channel in the format @username
ChatID int64 `json:"chat_id"`
// MessageThreadID Optional. Unique identifier for the target message thread (topic) of a forum; for forum
// supergroups and private chats of bots with forum topic mode enabled only
MessageThreadID int `json:"message_thread_id,omitempty"`
// DirectMessagesTopicID Optional. Identifier of the direct messages topic to which the message will be
// sent; required if the message is sent to a direct messages chat
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
// ReceiverUserID identifies the user who can see the ephemeral message.
ReceiverUserID int64 `json:"receiver_user_id,omitempty"` // Since: Bot API 10.2
// CallbackQueryID identifies the callback query that triggered an ephemeral response.
CallbackQueryID string `json:"callback_query_id,omitempty"` // Since: Bot API 10.2
Caption string `json:"caption,omitempty"`
ParseMode ParseMode `json:"parse_mode,omitempty"`
// Caption Optional. Voice message caption, 0-1024 characters after entities parsing
Caption string `json:"caption,omitempty"`
// ParseMode Optional. Mode for parsing entities in the voice message caption. See formatting options for
// more details.
ParseMode ParseMode `json:"parse_mode,omitempty"`
// CaptionEntities Optional. A JSON-serialized list of special entities that appear in the caption, which
// can be specified instead of parse_mode
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
Duration int `json:"duration,omitempty"`
// Duration Optional. Duration of the voice message in seconds
Duration int `json:"duration,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"`
// DisableNotification Optional. Sends the message silently. Users will receive a notification with no
// sound.
DisableNotification bool `json:"disable_notification,omitempty"`
// ProtectContent Optional. Protects the contents of the sent message from forwarding and saving
ProtectContent bool `json:"protect_content,omitempty"`
// AllowPaidBroadcast Optional. Pass True to allow up to 1000 messages per second, ignoring broadcasting
// limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's
// balance.
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
// MessageEffectID Optional. Unique identifier of the message effect to be added to the message; for private
// chats only
MessageEffectID string `json:"message_effect_id,omitempty"`
// SuggestedPostParameters Optional. A JSON-serialized object containing the parameters of the suggested
// post to send; for direct messages chats only. If the message is sent as a reply to another suggested
// post, then that suggested post is automatically declined.
SuggestedPostParameters *SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
ReplyParameters *ReplyParameters `json:"reply_parameters,omitempty"`
ReplyMarkup *ReplyMarkup `json:"reply_markup,omitempty"`
// ReplyParameters Optional. Description of the message to reply to
ReplyParameters *ReplyParameters `json:"reply_parameters,omitempty"`
// ReplyMarkup Optional. Additional interface options. A JSON-serialized object for an inline keyboard,
// custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user.
ReplyMarkup *ReplyMarkup `json:"reply_markup,omitempty"`
}
// SendVoice uploads a voice note via multipart and sends it as a message.
@@ -337,26 +523,50 @@ func (u *Uploader) SendVoiceWithContext(ctx context.Context, params UploadVoice,
// Since: Bot API 3.0
// See https://core.telegram.org/bots/api#sendvideonote
type UploadVideoNote 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"`
// BusinessConnectionID Optional. Unique identifier of the business connection on behalf of which the
// message will be sent
BusinessConnectionID string `json:"business_connection_id,omitempty"`
// ChatID Required. Unique identifier for the target chat or username of the target bot, supergroup or
// channel in the format @username
ChatID int64 `json:"chat_id"`
// MessageThreadID Optional. Unique identifier for the target message thread (topic) of a forum; for forum
// supergroups and private chats of bots with forum topic mode enabled only
MessageThreadID int `json:"message_thread_id,omitempty"`
// DirectMessagesTopicID Optional. Identifier of the direct messages topic to which the message will be
// sent; required if the message is sent to a direct messages chat
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
// ReceiverUserID identifies the user who can see the ephemeral message.
ReceiverUserID int64 `json:"receiver_user_id,omitempty"` // Since: Bot API 10.2
// CallbackQueryID identifies the callback query that triggered an ephemeral response.
CallbackQueryID string `json:"callback_query_id,omitempty"` // Since: Bot API 10.2
// Duration Optional. Duration of sent video in seconds
Duration int `json:"duration,omitempty"`
Length int `json:"length,omitempty"`
// Length Optional. Video width and height, i.e. diameter of the video message
Length int `json:"length,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"`
// DisableNotification Optional. Sends the message silently. Users will receive a notification with no
// sound.
DisableNotification bool `json:"disable_notification,omitempty"`
// ProtectContent Optional. Protects the contents of the sent message from forwarding and saving
ProtectContent bool `json:"protect_content,omitempty"`
// AllowPaidBroadcast Optional. Pass True to allow up to 1000 messages per second, ignoring broadcasting
// limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's
// balance.
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
// MessageEffectID Optional. Unique identifier of the message effect to be added to the message; for private
// chats only
MessageEffectID string `json:"message_effect_id,omitempty"`
// SuggestedPostParameters Optional. A JSON-serialized object containing the parameters of the suggested
// post to send; for direct messages chats only. If the message is sent as a reply to another suggested
// post, then that suggested post is automatically declined.
SuggestedPostParameters *SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
ReplyParameters *ReplyParameters `json:"reply_parameters,omitempty"`
ReplyMarkup *ReplyMarkup `json:"reply_markup,omitempty"`
// ReplyParameters Optional. Description of the message to reply to
ReplyParameters *ReplyParameters `json:"reply_parameters,omitempty"`
// ReplyMarkup Optional. Additional interface options. A JSON-serialized object for an inline keyboard,
// custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user.
ReplyMarkup *ReplyMarkup `json:"reply_markup,omitempty"`
}
// SendVideoNote uploads a video note via multipart and sends it as a message.
@@ -381,6 +591,8 @@ func (u *Uploader) SendVideoNoteWithContext(ctx context.Context, params UploadVi
// Since: Bot API 3.1
// See https://core.telegram.org/bots/api#setchatphoto
type UploadChatPhoto struct {
// ChatID Required. Unique identifier for the target chat or username of the target channel in the format
// @username
ChatID int64 `json:"chat_id"`
}
@@ -407,12 +619,29 @@ func (u *Uploader) SetChatPhotoWithContext(ctx context.Context, params UploadCha
// Use this type when uploading a self-signed certificate file.
// See https://core.telegram.org/bots/api#setwebhook
type UploadSetWebhook struct {
URL string `json:"url"`
IPAddress string `json:"ip_address,omitempty"`
MaxConnections int8 `json:"max_connections,omitempty"`
AllowedUpdates []UpdateType `json:"allowed_updates,omitempty"`
DropPendingUpdates bool `json:"drop_pending_updates,omitempty"`
SecretToken string `json:"secret_token,omitempty"`
// URL Required. HTTPS URL to send updates to. Use an empty string to remove webhook integration.
URL string `json:"url"`
// IPAddress Optional. The fixed IP address which will be used to send webhook requests instead of the IP
// address resolved through DNS
IPAddress string `json:"ip_address,omitempty"`
// MaxConnections Optional. The maximum allowed number of simultaneous HTTPS connections to the webhook for
// update delivery, 1-100. Defaults to 40. Use lower values to limit the load on your bot's server, and
// higher values to increase your bot's throughput.
MaxConnections int8 `json:"max_connections,omitempty"`
// AllowedUpdates Optional. A JSON-serialized list of the update types you want your bot to receive. For
// example, specify ["message", "edited_channel_post", "callback_query"] to only receive updates of these
// types. See Update for a complete list of available update types. Specify an empty list to receive all
// update types except chat_member, message_reaction, and message_reaction_count (default). If not
// specified, the previous setting will be used. Please note that this parameter doesn't affect updates
// created before the call to the setWebhook, so unwanted updates may be received for a short period of
// time.
AllowedUpdates []UpdateType `json:"allowed_updates,omitempty"`
// DropPendingUpdates Optional. Pass True to drop all pending updates
DropPendingUpdates bool `json:"drop_pending_updates,omitempty"`
// SecretToken Optional. A secret token to be sent in a header “X-Telegram-Bot-Api-Secret-Token” in
// every webhook request, 1-256 characters. Only characters A-Z, a-z, 0-9, _ and - are allowed. The header
// is useful to ensure that the request comes from a webhook set by you.
SecretToken string `json:"secret_token,omitempty"`
}
// SetWebhook uploads a certificate and sets a webhook URL.
@@ -437,29 +666,59 @@ func (u *Uploader) SetWebhookWithContext(ctx context.Context, params UploadSetWe
// 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"`
// BusinessConnectionID Optional. Unique identifier of the business connection on behalf of which the
// message will be sent
BusinessConnectionID string `json:"business_connection_id,omitempty"`
// ChatID Required. Unique identifier for the target chat or username of the target channel (in the format
// @channelusername)
ChatID int64 `json:"chat_id"`
// MessageThreadID Optional. Unique identifier for the target message thread (topic) of a forum; for forum
// supergroups and private chats of bots with forum topic mode enabled only
MessageThreadID int `json:"message_thread_id,omitempty"`
// DirectMessagesTopicID Optional. Identifier of the direct messages topic to which the message will be
// sent; required if the message is sent to a direct messages chat
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
// ReceiverUserID identifies the user who can see the ephemeral message.
ReceiverUserID int64 `json:"receiver_user_id,omitempty"` // Since: Bot API 10.2
// CallbackQueryID identifies the callback query that triggered an ephemeral response.
CallbackQueryID string `json:"callback_query_id,omitempty"` // Since: Bot API 10.2
Caption string `json:"caption,omitempty"`
ParseMode ParseMode `json:"parse_mode,omitempty"`
CallbackQueryID string `json:"callback_query_id,omitempty"` // Since: Bot API 10.2
// Caption Optional. Video caption (may also be used when resending videos by file_id), 0-1024 characters
// after entities parsing
Caption string `json:"caption,omitempty"`
// ParseMode Optional. Mode for parsing entities in the video caption. See formatting options for more
// details.
ParseMode ParseMode `json:"parse_mode,omitempty"`
// CaptionEntities Optional. A JSON-serialized list of special entities that appear in the caption, which
// can be specified instead of parse_mode
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"`
// ShowCaptionAboveMedia Optional. Pass True if the caption must be shown above the message media
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
// HasSpoiler Optional. Pass True if the video needs to be covered with a spoiler animation
HasSpoiler bool `json:"has_spoiler,omitempty"`
// DisableNotification Optional. Sends the message silently. Users will receive a notification with no
// sound.
DisableNotification bool `json:"disable_notification,omitempty"`
// ProtectContent Optional. Protects the contents of the sent message from forwarding and saving
ProtectContent bool `json:"protect_content,omitempty"`
// AllowPaidBroadcast Optional. Pass True to allow up to 1000 messages per second, ignoring broadcasting
// limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's
// balance.
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
// MessageEffectID Optional. Unique identifier of the message effect to be added to the message; for private
// chats only
MessageEffectID string `json:"message_effect_id,omitempty"`
// SuggestedPostParameters Optional. A JSON-serialized object containing the parameters of the suggested
// post to send; for direct messages chats only. If the message is sent as a reply to another suggested
// post, then that suggested post is automatically declined.
SuggestedPostParameters *SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
ReplyParameters *ReplyParameters `json:"reply_parameters,omitempty"`
ReplyMarkup *ReplyMarkup `json:"reply_markup,omitempty"`
// ReplyParameters Optional. Description of the message to reply to
ReplyParameters *ReplyParameters `json:"reply_parameters,omitempty"`
// ReplyMarkup Optional. Additional interface options. A JSON-serialized object for an inline keyboard,
// custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user.
ReplyMarkup *ReplyMarkup `json:"reply_markup,omitempty"`
}
// SendLivePhoto uploads a live-photo video and its static image via multipart.