chore(api): regenerate from Telegram Bot API v10.3 (#16)

Co-authored-by: lukaszraczylo <[email protected]>
This commit is contained in:
github-actions[bot]
2026-08-31 06:39:17 +00:00
committed by GitHub
co-authored by lukaszraczylo
parent 4511c823a3
commit 926d51881d
8 changed files with 26234 additions and 1497 deletions
+24 -8
View File
@@ -200,14 +200,17 @@ const (
InputRichBlockTypeAnchor InputRichBlockType = "anchor"
InputRichBlockTypeList InputRichBlockType = "list"
InputRichBlockTypeBlockquote InputRichBlockType = "blockquote"
InputRichBlockTypeExpandableBlockquote InputRichBlockType = "expandable_blockquote"
InputRichBlockTypePullquote InputRichBlockType = "pullquote"
InputRichBlockTypeCollage InputRichBlockType = "collage"
InputRichBlockTypeSlideshow InputRichBlockType = "slideshow"
InputRichBlockTypeTable InputRichBlockType = "table"
InputRichBlockTypeDetails InputRichBlockType = "details"
InputRichBlockTypeMap InputRichBlockType = "map"
InputRichBlockTypeButtons InputRichBlockType = "buttons"
InputRichBlockTypeAnimation InputRichBlockType = "animation"
InputRichBlockTypeAudio InputRichBlockType = "audio"
InputRichBlockTypeDocument InputRichBlockType = "document"
InputRichBlockTypePhoto InputRichBlockType = "photo"
InputRichBlockTypeVideo InputRichBlockType = "video"
InputRichBlockTypeVoiceNote InputRichBlockType = "voice_note"
@@ -414,6 +417,14 @@ const (
RevenueWithdrawalStateKindFailed RevenueWithdrawalStateKind = "failed"
)
type RichBlockButtonsAlign string
const (
RichBlockButtonsAlignLeft RichBlockButtonsAlign = "left"
RichBlockButtonsAlignCenter RichBlockButtonsAlign = "center"
RichBlockButtonsAlignRight RichBlockButtonsAlign = "right"
)
type RichBlockListItemType string
const (
@@ -424,14 +435,6 @@ const (
RichBlockListItemType1 RichBlockListItemType = "1"
)
type RichBlockTableCellAlign string
const (
RichBlockTableCellAlignLeft RichBlockTableCellAlign = "left"
RichBlockTableCellAlignCenter RichBlockTableCellAlign = "center"
RichBlockTableCellAlignRight RichBlockTableCellAlign = "right"
)
type RichBlockTableCellValign string
const (
@@ -452,20 +455,32 @@ const (
RichBlockTypeAnchor RichBlockType = "anchor"
RichBlockTypeList RichBlockType = "list"
RichBlockTypeBlockquote RichBlockType = "blockquote"
RichBlockTypeExpandableBlockquote RichBlockType = "expandable_blockquote"
RichBlockTypePullquote RichBlockType = "pullquote"
RichBlockTypeCollage RichBlockType = "collage"
RichBlockTypeSlideshow RichBlockType = "slideshow"
RichBlockTypeTable RichBlockType = "table"
RichBlockTypeDetails RichBlockType = "details"
RichBlockTypeMap RichBlockType = "map"
RichBlockTypeButtons RichBlockType = "buttons"
RichBlockTypeAnimation RichBlockType = "animation"
RichBlockTypeAudio RichBlockType = "audio"
RichBlockTypeDocument RichBlockType = "document"
RichBlockTypePhoto RichBlockType = "photo"
RichBlockTypeVideo RichBlockType = "video"
RichBlockTypeVoiceNote RichBlockType = "voice_note"
RichBlockTypeThinking RichBlockType = "thinking"
)
type RichMessageButtonStyle string
const (
RichMessageButtonStyleDanger RichMessageButtonStyle = "danger"
RichMessageButtonStyleSuccess RichMessageButtonStyle = "success"
RichMessageButtonStylePrimary RichMessageButtonStyle = "primary"
RichMessageButtonStyleLink RichMessageButtonStyle = "link"
)
type RichTextType string
const (
@@ -490,6 +505,7 @@ const (
RichTextTypeHashtag RichTextType = "hashtag"
RichTextTypeCashtag RichTextType = "cashtag"
RichTextTypeBotCommand RichTextType = "bot_command"
RichTextTypeButton RichTextType = "button"
RichTextTypeAnchor RichTextType = "anchor"
RichTextTypeAnchorLink RichTextType = "anchor_link"
RichTextTypeReference RichTextType = "reference"
+90 -109
View File
@@ -195,10 +195,8 @@ type SendMessageParams struct {
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// 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 *int64 `json:"direct_messages_topic_id,omitempty"`
// For outgoing ephemeral messages, unique identifier of the user who will receive the message; for group and supergroup chats only. It is not guaranteed that the user will receive the message, especially if they are offline. See ephemeral message sending for more details.
ReceiverUserID *int64 `json:"receiver_user_id,omitempty"`
// For outgoing ephemeral messages, identifier of the callback query which triggered the message if any
CallbackQueryID string `json:"callback_query_id,omitempty"`
// A JSON-serialized object containing the parameters of the ephemeral message to send
EphemeralMessageParameters *EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"`
// Text of the message to be sent, 1-4096 characters after entities parsing
Text string `json:"text"`
// Mode for parsing entities in the message text. See formatting options for more details.
@@ -378,10 +376,8 @@ type SendPhotoParams struct {
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// 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 *int64 `json:"direct_messages_topic_id,omitempty"`
// For outgoing ephemeral messages, unique identifier of the user who will receive the message; for group and supergroup chats only. It is not guaranteed that the user will receive the message, especially if they are offline. See ephemeral message sending for more details.
ReceiverUserID *int64 `json:"receiver_user_id,omitempty"`
// For outgoing ephemeral messages, identifier of the callback query which triggered the message if any
CallbackQueryID string `json:"callback_query_id,omitempty"`
// A JSON-serialized object containing the parameters of the ephemeral message to send
EphemeralMessageParameters *EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"`
// Photo to send. Pass a file_id as String to send a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, or upload a new photo using multipart/form-data. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20. More information on Sending Files »
Photo *InputFile `json:"photo"`
// Photo caption (may also be used when resending photos by file_id), 0-1024 characters after entities parsing
@@ -431,11 +427,10 @@ func (p *SendPhotoParams) MultipartFields() map[string]string {
if p.DirectMessagesTopicID != nil {
out["direct_messages_topic_id"] = strconv.FormatInt(*p.DirectMessagesTopicID, 10)
}
if p.ReceiverUserID != nil {
out["receiver_user_id"] = strconv.FormatInt(*p.ReceiverUserID, 10)
}
if p.CallbackQueryID != "" {
out["callback_query_id"] = p.CallbackQueryID
if p.EphemeralMessageParameters != nil {
if b, _ := json.Marshal(p.EphemeralMessageParameters); len(b) > 0 {
out["ephemeral_message_parameters"] = string(b)
}
}
if p.Caption != "" {
out["caption"] = p.Caption
@@ -516,10 +511,8 @@ type SendLivePhotoParams struct {
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// 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 *int64 `json:"direct_messages_topic_id,omitempty"`
// For outgoing ephemeral messages, unique identifier of the user who will receive the message; for group and supergroup chats only. It is not guaranteed that the user will receive the message, especially if they are offline. See ephemeral message sending for more details.
ReceiverUserID *int64 `json:"receiver_user_id,omitempty"`
// For outgoing ephemeral messages, identifier of the callback query which triggered the message if any
CallbackQueryID string `json:"callback_query_id,omitempty"`
// A JSON-serialized object containing the parameters of the ephemeral message to send
EphemeralMessageParameters *EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"`
// Live photo video to send. The video must be no longer than 10 seconds and must not exceed 10 MB in size. Pass a file_id as String to send a video that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data. More information on Sending Files ». Sending live photos by a URL is currently unsupported.
LivePhoto *InputFile `json:"live_photo"`
// The static photo to send. Pass a file_id as String to send a photo that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data. More information on Sending Files ». Sending live photos by a URL is currently unsupported.
@@ -574,11 +567,10 @@ func (p *SendLivePhotoParams) MultipartFields() map[string]string {
if p.DirectMessagesTopicID != nil {
out["direct_messages_topic_id"] = strconv.FormatInt(*p.DirectMessagesTopicID, 10)
}
if p.ReceiverUserID != nil {
out["receiver_user_id"] = strconv.FormatInt(*p.ReceiverUserID, 10)
}
if p.CallbackQueryID != "" {
out["callback_query_id"] = p.CallbackQueryID
if p.EphemeralMessageParameters != nil {
if b, _ := json.Marshal(p.EphemeralMessageParameters); len(b) > 0 {
out["ephemeral_message_parameters"] = string(b)
}
}
if p.Caption != "" {
out["caption"] = p.Caption
@@ -667,10 +659,8 @@ type SendAudioParams struct {
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// 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 *int64 `json:"direct_messages_topic_id,omitempty"`
// For outgoing ephemeral messages, unique identifier of the user who will receive the message; for group and supergroup chats only. It is not guaranteed that the user will receive the message, especially if they are offline. See ephemeral message sending for more details.
ReceiverUserID *int64 `json:"receiver_user_id,omitempty"`
// For outgoing ephemeral messages, identifier of the callback query which triggered the message if any
CallbackQueryID string `json:"callback_query_id,omitempty"`
// A JSON-serialized object containing the parameters of the ephemeral message to send
EphemeralMessageParameters *EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"`
// Audio file to send. Pass a file_id as String to send an audio file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files »
Audio *InputFile `json:"audio"`
// Audio caption, 0-1024 characters after entities parsing
@@ -727,11 +717,10 @@ func (p *SendAudioParams) MultipartFields() map[string]string {
if p.DirectMessagesTopicID != nil {
out["direct_messages_topic_id"] = strconv.FormatInt(*p.DirectMessagesTopicID, 10)
}
if p.ReceiverUserID != nil {
out["receiver_user_id"] = strconv.FormatInt(*p.ReceiverUserID, 10)
}
if p.CallbackQueryID != "" {
out["callback_query_id"] = p.CallbackQueryID
if p.EphemeralMessageParameters != nil {
if b, _ := json.Marshal(p.EphemeralMessageParameters); len(b) > 0 {
out["ephemeral_message_parameters"] = string(b)
}
}
if p.Caption != "" {
out["caption"] = p.Caption
@@ -823,10 +812,8 @@ type SendDocumentParams struct {
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// 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 *int64 `json:"direct_messages_topic_id,omitempty"`
// For outgoing ephemeral messages, unique identifier of the user who will receive the message; for group and supergroup chats only. It is not guaranteed that the user will receive the message, especially if they are offline. See ephemeral message sending for more details.
ReceiverUserID *int64 `json:"receiver_user_id,omitempty"`
// For outgoing ephemeral messages, identifier of the callback query which triggered the message if any
CallbackQueryID string `json:"callback_query_id,omitempty"`
// A JSON-serialized object containing the parameters of the ephemeral message to send
EphemeralMessageParameters *EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"`
// File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files »
Document *InputFile `json:"document"`
// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files »
@@ -879,11 +866,10 @@ func (p *SendDocumentParams) MultipartFields() map[string]string {
if p.DirectMessagesTopicID != nil {
out["direct_messages_topic_id"] = strconv.FormatInt(*p.DirectMessagesTopicID, 10)
}
if p.ReceiverUserID != nil {
out["receiver_user_id"] = strconv.FormatInt(*p.ReceiverUserID, 10)
}
if p.CallbackQueryID != "" {
out["callback_query_id"] = p.CallbackQueryID
if p.EphemeralMessageParameters != nil {
if b, _ := json.Marshal(p.EphemeralMessageParameters); len(b) > 0 {
out["ephemeral_message_parameters"] = string(b)
}
}
if p.Caption != "" {
out["caption"] = p.Caption
@@ -968,10 +954,8 @@ type SendVideoParams struct {
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// 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 *int64 `json:"direct_messages_topic_id,omitempty"`
// For outgoing ephemeral messages, unique identifier of the user who will receive the message; for group and supergroup chats only. It is not guaranteed that the user will receive the message, especially if they are offline. See ephemeral message sending for more details.
ReceiverUserID *int64 `json:"receiver_user_id,omitempty"`
// For outgoing ephemeral messages, identifier of the callback query which triggered the message if any
CallbackQueryID string `json:"callback_query_id,omitempty"`
// A JSON-serialized object containing the parameters of the ephemeral message to send
EphemeralMessageParameters *EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"`
// Video to send. Pass a file_id as String to send a video that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a video from the Internet, or upload a new video using multipart/form-data. More information on Sending Files »
Video *InputFile `json:"video"`
// Duration of sent video in seconds
@@ -1041,11 +1025,10 @@ func (p *SendVideoParams) MultipartFields() map[string]string {
if p.DirectMessagesTopicID != nil {
out["direct_messages_topic_id"] = strconv.FormatInt(*p.DirectMessagesTopicID, 10)
}
if p.ReceiverUserID != nil {
out["receiver_user_id"] = strconv.FormatInt(*p.ReceiverUserID, 10)
}
if p.CallbackQueryID != "" {
out["callback_query_id"] = p.CallbackQueryID
if p.EphemeralMessageParameters != nil {
if b, _ := json.Marshal(p.EphemeralMessageParameters); len(b) > 0 {
out["ephemeral_message_parameters"] = string(b)
}
}
if p.Duration != nil {
out["duration"] = strconv.FormatInt(*p.Duration, 10)
@@ -1155,10 +1138,8 @@ type SendAnimationParams struct {
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// 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 *int64 `json:"direct_messages_topic_id,omitempty"`
// For outgoing ephemeral messages, unique identifier of the user who will receive the message; for group and supergroup chats only. It is not guaranteed that the user will receive the message, especially if they are offline. See ephemeral message sending for more details.
ReceiverUserID *int64 `json:"receiver_user_id,omitempty"`
// For outgoing ephemeral messages, identifier of the callback query which triggered the message if any
CallbackQueryID string `json:"callback_query_id,omitempty"`
// A JSON-serialized object containing the parameters of the ephemeral message to send
EphemeralMessageParameters *EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"`
// Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the Internet, or upload a new animation using multipart/form-data. More information on Sending Files »
Animation *InputFile `json:"animation"`
// Duration of sent animation in seconds
@@ -1219,11 +1200,10 @@ func (p *SendAnimationParams) MultipartFields() map[string]string {
if p.DirectMessagesTopicID != nil {
out["direct_messages_topic_id"] = strconv.FormatInt(*p.DirectMessagesTopicID, 10)
}
if p.ReceiverUserID != nil {
out["receiver_user_id"] = strconv.FormatInt(*p.ReceiverUserID, 10)
}
if p.CallbackQueryID != "" {
out["callback_query_id"] = p.CallbackQueryID
if p.EphemeralMessageParameters != nil {
if b, _ := json.Marshal(p.EphemeralMessageParameters); len(b) > 0 {
out["ephemeral_message_parameters"] = string(b)
}
}
if p.Duration != nil {
out["duration"] = strconv.FormatInt(*p.Duration, 10)
@@ -1320,10 +1300,8 @@ type SendVoiceParams struct {
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// 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 *int64 `json:"direct_messages_topic_id,omitempty"`
// For outgoing ephemeral messages, unique identifier of the user who will receive the message; for group and supergroup chats only. It is not guaranteed that the user will receive the message, especially if they are offline. See ephemeral message sending for more details.
ReceiverUserID *int64 `json:"receiver_user_id,omitempty"`
// For outgoing ephemeral messages, identifier of the callback query which triggered the message if any
CallbackQueryID string `json:"callback_query_id,omitempty"`
// A JSON-serialized object containing the parameters of the ephemeral message to send
EphemeralMessageParameters *EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"`
// Audio file to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files »
Voice *InputFile `json:"voice"`
// Voice message caption, 0-1024 characters after entities parsing
@@ -1371,11 +1349,10 @@ func (p *SendVoiceParams) MultipartFields() map[string]string {
if p.DirectMessagesTopicID != nil {
out["direct_messages_topic_id"] = strconv.FormatInt(*p.DirectMessagesTopicID, 10)
}
if p.ReceiverUserID != nil {
out["receiver_user_id"] = strconv.FormatInt(*p.ReceiverUserID, 10)
}
if p.CallbackQueryID != "" {
out["callback_query_id"] = p.CallbackQueryID
if p.EphemeralMessageParameters != nil {
if b, _ := json.Marshal(p.EphemeralMessageParameters); len(b) > 0 {
out["ephemeral_message_parameters"] = string(b)
}
}
if p.Caption != "" {
out["caption"] = p.Caption
@@ -1443,7 +1420,7 @@ func SendVoice(ctx context.Context, b *client.Bot, p *SendVoiceParams) (*Message
// SendVideoNoteParams is the parameter set for SendVideoNote.
//
// As of v.4.0, Telegram clients support rounded square MPEG4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent Message is returned.
// Use this method to send a rounded square MPEG4 video of up to 1 minute long. On success, the sent Message is returned.
type SendVideoNoteParams struct {
// Unique identifier of the business connection on behalf of which the message will be sent
BusinessConnectionID string `json:"business_connection_id,omitempty"`
@@ -1453,10 +1430,8 @@ type SendVideoNoteParams struct {
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// 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 *int64 `json:"direct_messages_topic_id,omitempty"`
// For outgoing ephemeral messages, unique identifier of the user who will receive the message; for group and supergroup chats only. It is not guaranteed that the user will receive the message, especially if they are offline. See ephemeral message sending for more details.
ReceiverUserID *int64 `json:"receiver_user_id,omitempty"`
// For outgoing ephemeral messages, identifier of the callback query which triggered the message if any
CallbackQueryID string `json:"callback_query_id,omitempty"`
// A JSON-serialized object containing the parameters of the ephemeral message to send
EphemeralMessageParameters *EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"`
// Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data. More information on Sending Files ». Sending video notes by a URL is currently unsupported.
VideoNote *InputFile `json:"video_note"`
// Duration of sent video in seconds
@@ -1505,11 +1480,10 @@ func (p *SendVideoNoteParams) MultipartFields() map[string]string {
if p.DirectMessagesTopicID != nil {
out["direct_messages_topic_id"] = strconv.FormatInt(*p.DirectMessagesTopicID, 10)
}
if p.ReceiverUserID != nil {
out["receiver_user_id"] = strconv.FormatInt(*p.ReceiverUserID, 10)
}
if p.CallbackQueryID != "" {
out["callback_query_id"] = p.CallbackQueryID
if p.EphemeralMessageParameters != nil {
if b, _ := json.Marshal(p.EphemeralMessageParameters); len(b) > 0 {
out["ephemeral_message_parameters"] = string(b)
}
}
if p.Duration != nil {
out["duration"] = strconv.FormatInt(*p.Duration, 10)
@@ -1569,7 +1543,7 @@ func (p *SendVideoNoteParams) MultipartFiles() []client.MultipartFile {
// SendVideoNote calls the sendVideoNote Telegram Bot API method.
//
// As of v.4.0, Telegram clients support rounded square MPEG4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent Message is returned.
// Use this method to send a rounded square MPEG4 video of up to 1 minute long. On success, the sent Message is returned.
func SendVideoNote(ctx context.Context, b *client.Bot, p *SendVideoNoteParams) (*Message, error) {
return client.Call[*SendVideoNoteParams, *Message](ctx, b, "sendVideoNote", p)
}
@@ -1785,10 +1759,8 @@ type SendLocationParams struct {
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// 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 *int64 `json:"direct_messages_topic_id,omitempty"`
// For outgoing ephemeral messages, unique identifier of the user who will receive the message; for group and supergroup chats only. It is not guaranteed that the user will receive the message, especially if they are offline. See ephemeral message sending for more details.
ReceiverUserID *int64 `json:"receiver_user_id,omitempty"`
// For outgoing ephemeral messages, identifier of the callback query which triggered the message if any
CallbackQueryID string `json:"callback_query_id,omitempty"`
// A JSON-serialized object containing the parameters of the ephemeral message to send
EphemeralMessageParameters *EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"`
// Latitude of the location
Latitude float64 `json:"latitude"`
// Longitude of the location
@@ -1836,10 +1808,8 @@ type SendVenueParams struct {
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// 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 *int64 `json:"direct_messages_topic_id,omitempty"`
// For outgoing ephemeral messages, unique identifier of the user who will receive the message; for group and supergroup chats only. It is not guaranteed that the user will receive the message, especially if they are offline. See ephemeral message sending for more details.
ReceiverUserID *int64 `json:"receiver_user_id,omitempty"`
// For outgoing ephemeral messages, identifier of the callback query which triggered the message if any
CallbackQueryID string `json:"callback_query_id,omitempty"`
// A JSON-serialized object containing the parameters of the ephemeral message to send
EphemeralMessageParameters *EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"`
// Latitude of the venue
Latitude float64 `json:"latitude"`
// Longitude of the venue
@@ -1891,10 +1861,8 @@ type SendContactParams struct {
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// 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 *int64 `json:"direct_messages_topic_id,omitempty"`
// For outgoing ephemeral messages, unique identifier of the user who will receive the message; for group and supergroup chats only. It is not guaranteed that the user will receive the message, especially if they are offline. See ephemeral message sending for more details.
ReceiverUserID *int64 `json:"receiver_user_id,omitempty"`
// For outgoing ephemeral messages, identifier of the callback query which triggered the message if any
CallbackQueryID string `json:"callback_query_id,omitempty"`
// A JSON-serialized object containing the parameters of the ephemeral message to send
EphemeralMessageParameters *EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"`
// Contact's phone number
PhoneNumber string `json:"phone_number"`
// Contact's first name
@@ -2081,7 +2049,7 @@ type SendMessageDraftParams struct {
ChatID int64 `json:"chat_id"`
// Unique identifier for the target message thread
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// Unique identifier of the message draft; must be non-zero. Changes to drafts with the same identifier are animated.
// Unique identifier of the message draft; must be non-zero. Changes to drafts with the same identifier are animated. Otherwise, the draft is replaced without animation.
DraftID int64 `json:"draft_id"`
// Text of the message to be sent, 0-4096 characters after entities parsing. Pass an empty text to show a “Thinking…” placeholder.
Text string `json:"text,omitempty"`
@@ -2089,6 +2057,10 @@ type SendMessageDraftParams struct {
ParseMode ParseMode `json:"parse_mode,omitempty"`
// A JSON-serialized list of special entities that appear in message text, which can be specified instead of parse_mode
Entities []MessageEntity `json:"entities,omitempty"`
// Pass True to show the user a button to stop further drafts. The bot will receive an Update “stopped_message_generation” if the user presses the button.
CanStop *bool `json:"can_stop,omitempty"`
// Pass True to keep the draft in the chat when the button is pressed. The draft will still disappear after a short time or if the bot sends a message. To fully preserve the partial draft, the bot should send it as a new message.
KeepOnStop *bool `json:"keep_on_stop,omitempty"`
}
// SendMessageDraft calls the sendMessageDraft Telegram Bot API method.
@@ -2323,6 +2295,8 @@ type PromoteChatMemberParams struct {
CanManageDirectMessages *bool `json:"can_manage_direct_messages,omitempty"`
// Pass True if the administrator can edit the tags of regular members; for groups and supergroups only
CanManageTags *bool `json:"can_manage_tags,omitempty"`
// Pass True if the administrator can manage chat welcome messages or directly send them in the case of bots
CanSendWelcomeMessages *bool `json:"can_send_welcome_messages,omitempty"`
}
// PromoteChatMember calls the promoteChatMember Telegram Bot API method.
@@ -3138,7 +3112,7 @@ type AnswerCallbackQueryParams struct {
ShowAlert *bool `json:"show_alert,omitempty"`
// URL that will be opened by the user's client. If you have created a Game and accepted the conditions via @BotFather, specify the URL that opens your game - note that this will only work if the query comes from a callback_game button.Otherwise, you may use links like t.me/your_bot?start=XXXX that open your bot with a parameter.
URL string `json:"url,omitempty"`
// The maximum amount of time in seconds that the result of the callback query may be cached client-side. Telegram apps will support caching starting in version 3.14. Defaults to 0.
// The maximum amount of time in seconds that the result of the callback query may be cached client-side. Defaults to 0.
CacheTime *int64 `json:"cache_time,omitempty"`
}
@@ -4152,7 +4126,7 @@ type EditMessageTextParams struct {
Entities []MessageEntity `json:"entities,omitempty"`
// Link preview generation options for the message
LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options,omitempty"`
// New rich content of the message; required if text isn't specified. Direct upload of new files isn't supported when an inline message is edited.
// New rich content of the message; required if text isn't specified. Direct upload of new files and explicit upload of files by a URL isn't supported when an inline message is edited.
RichMessage *InputRichMessage `json:"rich_message,omitempty"`
// A JSON-serialized object for an inline keyboard
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
@@ -4385,7 +4359,7 @@ func StopPoll(ctx context.Context, b *client.Bot, p *StopPollParams) (*Poll, err
// EditEphemeralMessageTextParams is the parameter set for EditEphemeralMessageText.
//
// Use this method to edit an ephemeral text message. Note that it is not guaranteed that the user will receive the message edit event, especially if they are offline. On success, True is returned.
// Use this method to edit an ephemeral text or rich message. Note that it is not guaranteed that the user will receive the message edit event, especially if they are offline. On success, True is returned.
type EditEphemeralMessageTextParams struct {
// Unique identifier for the target chat or username of the target supergroup in the format @username
ChatID ChatID `json:"chat_id"`
@@ -4393,12 +4367,14 @@ type EditEphemeralMessageTextParams struct {
ReceiverUserID int64 `json:"receiver_user_id"`
// Identifier of the ephemeral message to edit
EphemeralMessageID int64 `json:"ephemeral_message_id"`
// New text of the message, 1-4096 characters after entity parsing
Text string `json:"text"`
// New text of the message, 1-4096 characters after entity parsing; required if rich_message isn't specified
Text string `json:"text,omitempty"`
// Mode for parsing entities in the message text. See formatting options for more details.
ParseMode ParseMode `json:"parse_mode,omitempty"`
// A JSON-serialized list of special entities that appear in message text, which can be specified instead of parse_mode
Entities []MessageEntity `json:"entities,omitempty"`
// New rich content of the message; required if text isn't specified
RichMessage *InputRichMessage `json:"rich_message,omitempty"`
// Link preview generation options for the message
LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options,omitempty"`
// A JSON-serialized object for an inline keyboard
@@ -4407,7 +4383,7 @@ type EditEphemeralMessageTextParams struct {
// EditEphemeralMessageText calls the editEphemeralMessageText Telegram Bot API method.
//
// Use this method to edit an ephemeral text message. Note that it is not guaranteed that the user will receive the message edit event, especially if they are offline. On success, True is returned.
// Use this method to edit an ephemeral text or rich message. Note that it is not guaranteed that the user will receive the message edit event, especially if they are offline. On success, True is returned.
func EditEphemeralMessageText(ctx context.Context, b *client.Bot, p *EditEphemeralMessageTextParams) (bool, error) {
return client.Call[*EditEphemeralMessageTextParams, bool](ctx, b, "editEphemeralMessageText", p)
}
@@ -4422,7 +4398,7 @@ type EditEphemeralMessageMediaParams struct {
ReceiverUserID int64 `json:"receiver_user_id"`
// Identifier of the ephemeral message to edit
EphemeralMessageID int64 `json:"ephemeral_message_id"`
// A JSON-serialized object for the new media content of the message. A new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL.
// A JSON-serialized object for the new media content of the message
Media InputMedia `json:"media"`
// A JSON-serialized object for an inline keyboard
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
@@ -4479,6 +4455,8 @@ type EditEphemeralMessageCaptionParams struct {
ParseMode ParseMode `json:"parse_mode,omitempty"`
// 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"`
// Pass True if the caption must be shown above the message media. Supported only for animation, photo and video messages.
ShowCaptionAboveMedia *bool `json:"show_caption_above_media,omitempty"`
// A JSON-serialized object for an inline keyboard
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}
@@ -4654,10 +4632,8 @@ type SendStickerParams struct {
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// 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 *int64 `json:"direct_messages_topic_id,omitempty"`
// For outgoing ephemeral messages, unique identifier of the user who will receive the message; for group and supergroup chats only. It is not guaranteed that the user will receive the message, especially if they are offline. See ephemeral message sending for more details.
ReceiverUserID *int64 `json:"receiver_user_id,omitempty"`
// For outgoing ephemeral messages, identifier of the callback query which triggered the message if any
CallbackQueryID string `json:"callback_query_id,omitempty"`
// A JSON-serialized object containing the parameters of the ephemeral message to send
EphemeralMessageParameters *EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"`
// Sticker to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a .WEBP sticker from the Internet, or upload a new .WEBP, .TGS, or .WEBM sticker using multipart/form-data. More information on Sending Files ». Video and animated stickers can't be sent via an HTTP URL.
Sticker *InputFile `json:"sticker"`
// Emoji associated with the sticker; only for just uploaded stickers
@@ -4699,11 +4675,10 @@ func (p *SendStickerParams) MultipartFields() map[string]string {
if p.DirectMessagesTopicID != nil {
out["direct_messages_topic_id"] = strconv.FormatInt(*p.DirectMessagesTopicID, 10)
}
if p.ReceiverUserID != nil {
out["receiver_user_id"] = strconv.FormatInt(*p.ReceiverUserID, 10)
}
if p.CallbackQueryID != "" {
out["callback_query_id"] = p.CallbackQueryID
if p.EphemeralMessageParameters != nil {
if b, _ := json.Marshal(p.EphemeralMessageParameters); len(b) > 0 {
out["ephemeral_message_parameters"] = string(b)
}
}
if p.Emoji != "" {
out["emoji"] = p.Emoji
@@ -5096,6 +5071,8 @@ type SendRichMessageParams struct {
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// 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 *int64 `json:"direct_messages_topic_id,omitempty"`
// A JSON-serialized object containing the parameters of the ephemeral message to send
EphemeralMessageParameters *EphemeralMessageParameters `json:"ephemeral_message_parameters,omitempty"`
// The message to be sent
RichMessage InputRichMessage `json:"rich_message"`
// Sends the message silently. Users will receive a notification with no sound.
@@ -5129,10 +5106,14 @@ type SendRichMessageDraftParams struct {
ChatID int64 `json:"chat_id"`
// Unique identifier for the target message thread
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// Unique identifier of the message draft; must be non-zero. Changes to drafts with the same identifier are animated.
// Unique identifier of the message draft; must be non-zero. Changes to drafts with the same identifier are animated. Otherwise, the draft is replaced without animation.
DraftID int64 `json:"draft_id"`
// The partial message to be streamed. Direct upload of new files isn't supported.
// The partial message to be streamed. Direct upload of new files and explicit upload of files by a URL isn't supported.
RichMessage InputRichMessage `json:"rich_message"`
// Pass True to show the user a button to stop further drafts. The bot will receive an Update “stopped_message_generation” if the user presses the button.
CanStop *bool `json:"can_stop,omitempty"`
// Pass True to keep the draft in the chat when the button is pressed. The draft will still disappear after a short time or if the bot sends a message. To fully preserve the partial draft, the bot should send it as a new message.
KeepOnStop *bool `json:"keep_on_stop,omitempty"`
}
// SendRichMessageDraft calls the sendRichMessageDraft Telegram Bot API method.
-7
View File
@@ -19954,7 +19954,6 @@ func Test_EditEphemeralMessageText_Success(t *testing.T) {
ChatID: ChatIDFromInt(123),
ReceiverUserID: 42,
EphemeralMessageID: 42,
Text: "test_value",
}
_, err := EditEphemeralMessageText(context.Background(), bot, params)
require.NoError(t, err)
@@ -19970,7 +19969,6 @@ func Test_EditEphemeralMessageText_APIError(t *testing.T) {
ChatID: ChatIDFromInt(123),
ReceiverUserID: 42,
EphemeralMessageID: 42,
Text: "test_value",
}
_, err := EditEphemeralMessageText(context.Background(), bot, params)
require.Error(t, err)
@@ -19989,7 +19987,6 @@ func Test_EditEphemeralMessageText_NetworkError(t *testing.T) {
ChatID: ChatIDFromInt(123),
ReceiverUserID: 42,
EphemeralMessageID: 42,
Text: "test_value",
}
_, err := EditEphemeralMessageText(context.Background(), bot, params)
require.Error(t, err)
@@ -20006,7 +20003,6 @@ func Test_EditEphemeralMessageText_ParseError(t *testing.T) {
ChatID: ChatIDFromInt(123),
ReceiverUserID: 42,
EphemeralMessageID: 42,
Text: "test_value",
}
_, err := EditEphemeralMessageText(context.Background(), bot, params)
require.Error(t, err)
@@ -20026,7 +20022,6 @@ func Test_EditEphemeralMessageText_ContextCanceled(t *testing.T) {
ChatID: ChatIDFromInt(123),
ReceiverUserID: 42,
EphemeralMessageID: 42,
Text: "test_value",
}
_, err := EditEphemeralMessageText(ctx, bot, params)
require.Error(t, err)
@@ -20068,7 +20063,6 @@ func Test_EditEphemeralMessageText_Forbidden(t *testing.T) {
ChatID: ChatIDFromInt(123),
ReceiverUserID: 42,
EphemeralMessageID: 42,
Text: "test_value",
}
_, err := EditEphemeralMessageText(context.Background(), bot, params)
require.Error(t, err)
@@ -20091,7 +20085,6 @@ func Test_EditEphemeralMessageText_ServerError(t *testing.T) {
ChatID: ChatIDFromInt(123),
ReceiverUserID: 42,
EphemeralMessageID: 42,
Text: "test_value",
}
_, err := EditEphemeralMessageText(context.Background(), bot, params)
require.Error(t, err)
+311 -25
View File
@@ -72,6 +72,8 @@ type Update struct {
ManagedBot *ManagedBotUpdated `json:"managed_bot,omitempty"`
// Optional. User payment subscription has changed
Subscription *BotSubscriptionUpdated `json:"subscription,omitempty"`
// Optional. A user asked the bot to stop the generation of a message
StoppedMessageGeneration *MessageGenerationStopped `json:"stopped_message_generation,omitempty"`
}
// Describes the current status of a webhook.
@@ -482,9 +484,11 @@ type Message struct {
ChecklistTasksDone *ChecklistTasksDone `json:"checklist_tasks_done,omitempty"`
// Optional. Service message: tasks were added to a checklist
ChecklistTasksAdded *ChecklistTasksAdded `json:"checklist_tasks_added,omitempty"`
// Optional. Service message: chat added to a Community
// Optional. Service message: chat or bot added to a Community
CommunityChatAdded *CommunityChatAdded `json:"community_chat_added,omitempty"`
// Optional. Service message: chat removed from a Community
// Optional. Service message: chat was joined by a user from a Community
CommunityChatJoined *CommunityChatJoined `json:"community_chat_joined,omitempty"`
// Optional. Service message: chat or bot removed from a Community
CommunityChatRemoved *CommunityChatRemoved `json:"community_chat_removed,omitempty"`
// Optional. Service message: the price for paid messages in the corresponding direct messages chat of a channel has changed
DirectMessagePriceChanged *DirectMessagePriceChanged `json:"direct_message_price_changed,omitempty"`
@@ -767,6 +771,15 @@ type ReplyParameters struct {
PollOptionID string `json:"poll_option_id,omitempty"`
}
type EphemeralMessageParameters struct {
// Identifier of the user who will receive the message. It is not guaranteed that the user will receive the message, especially if they are offline. See here for more details.
ReceiverUserID int64 `json:"receiver_user_id"`
// Optional. Identifier of the callback query which triggered the message, if any
CallbackQueryID string `json:"callback_query_id,omitempty"`
// Optional. Pass True if the ephemeral message must be shown in place of the original message. Must be False for callback queries from ephemeral messages, which must be edited using regular editEphemeralMessage… methods.
ReplaceCallbackQueryMessage *bool `json:"replace_callback_query_message,omitempty"`
}
// MessageOrigin is a union type. The following concrete variants implement
// it:
// - MessageOriginUser
@@ -1073,7 +1086,7 @@ type Video struct {
FileSize *int64 `json:"file_size,omitempty"`
}
// This object represents a video message (available in Telegram apps as of v.4.0).
// This object represents a video message.
type VideoNote struct {
// Identifier for this file, which can be used to download or reuse the file
FileID string `json:"file_id"`
@@ -1651,6 +1664,16 @@ type BotSubscriptionUpdated struct {
State BotSubscriptionUpdatedState `json:"state"`
}
// This object describes an update about a user stopping message generation.
type MessageGenerationStopped struct {
// Chat in which the message is generated
Chat Chat `json:"chat"`
// Optional. Unique identifier of the message thread in which the message is generated
MessageThreadID *int64 `json:"message_thread_id,omitempty"`
// Unique identifier of the message draft which was stopped
DraftID int64 `json:"draft_id"`
}
// Describes a service message about an option added to a poll.
type PollOptionAdded struct {
// Optional. Message containing the poll to which the option was added, if known. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply.
@@ -2107,13 +2130,19 @@ type ChecklistTasksAdded struct {
Tasks []ChecklistTask `json:"tasks"`
}
// Describes a service message about a chat being added to a community.
// Describes a service message about a chat or a bot being added to a community.
type CommunityChatAdded struct {
// The new community to which the chat belongs
// The new community to which the chat or the bot belongs
Community Community `json:"community"`
}
// Describes a service message about a chat being removed from a community. Currently holds no information.
// Describes a service message about a chat being joined by a user from a community.
type CommunityChatJoined struct {
// The community from which the chat was joined
Community Community `json:"community"`
}
// Describes a service message about a chat or a bot being removed from a community. Currently holds no information.
type CommunityChatRemoved struct {
}
@@ -2446,6 +2475,8 @@ type ReplyKeyboardMarkup struct {
InputFieldPlaceholder string `json:"input_field_placeholder,omitempty"`
// Optional. Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply to a message in the same chat and forum topic, sender of the original message.Example: A user requests to change the bot's language, bot replies to the request with a keyboard to select the new language. Other users in the group don't see the keyboard.
Selective *bool `json:"selective,omitempty"`
// Optional. Pass True if the reply interface must be shown to the user, as if they had manually selected the bot's message and tapped 'Reply'
ForceReply *bool `json:"force_reply,omitempty"`
}
// This object represents one button of the reply keyboard. At most one of the fields other than text, icon_custom_emoji_id, and style must be used to specify the type of the button. For simple text buttons, String can be used instead of this object to specify the button text.
@@ -2544,6 +2575,8 @@ type ReplyKeyboardRemove struct {
type InlineKeyboardMarkup struct {
// Array of button rows, each represented by an Array of InlineKeyboardButton objects
InlineKeyboard [][]InlineKeyboardButton `json:"inline_keyboard"`
// Optional. Pass True if the reply interface must be shown to the user, as if they had manually selected the bot's message and tapped 'Reply'. The value of the field can't be changed when the inline keyboard is edited.
ForceReply *bool `json:"force_reply,omitempty"`
}
// This object represents one button of an inline keyboard. Exactly one of the fields other than text, icon_custom_emoji_id, and style must be used to specify the type of the button.
@@ -2560,7 +2593,7 @@ type InlineKeyboardButton struct {
CallbackData string `json:"callback_data,omitempty"`
// Optional. Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. Available only in private chats between a user and the bot. Not supported for messages sent on behalf of a business account.
WebApp *WebAppInfo `json:"web_app,omitempty"`
// Optional. An HTTPS URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget.
// Optional. An HTTPS URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget. Not supported for ephemeral messages.
LoginURL *LoginUrl `json:"login_url,omitempty"`
// Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted. Not supported for messages sent in channel direct messages chats and on behalf of a business account.
SwitchInlineQuery string `json:"switch_inline_query,omitempty"`
@@ -2574,17 +2607,18 @@ type InlineKeyboardButton struct {
CallbackGame *CallbackGame `json:"callback_game,omitempty"`
// Optional. Specify True, to send a Pay button. Substrings “” and “XTR” in the buttons's text will be replaced with a Telegram Star icon.NOTE: This type of button must always be the first button in the first row and can only be used in invoice messages.
Pay *bool `json:"pay,omitempty"`
// Optional. If set, then the button is disabled and does nothing
Disabled *DisabledButton `json:"disabled,omitempty"`
}
// This object represents a parameter of the inline keyboard button used to automatically authorize a user. Serves as a great replacement for the Telegram Login Widget when the user is coming from Telegram. All the user needs to do is tap/click a button and confirm that they want to log in:
// Telegram apps support these buttons as of version 5.7.
// Sample bot: @discussbot
// This object represents a parameter of the inline keyboard button used to automatically authorize a user. It serves as a great replacement for the Telegram Login Widget when the user is coming from Telegram. All the user needs to do is tap/click a button and confirm that they want to log in:
// Sample bot: @DiscussBot
type LoginUrl struct {
// An HTTPS URL to be opened with user authorization data added to the query string when the button is pressed. If the user refuses to provide authorization data, the original URL without information about the user will be opened. The data added is the same as described in Receiving authorization data.NOTE: You must always check the hash of the received data to verify the authentication and the integrity of the data as described in Checking authorization.
URL string `json:"url"`
// Optional. New text of the button in forwarded messages
ForwardText string `json:"forward_text,omitempty"`
// Optional. Username of a bot, which will be used for user authorization. See Setting up a bot for more details. If not specified, the current bot's username will be assumed. The url's domain must be the same as the domain linked with the bot. See Linking your domain to the bot for more details.
// Optional. Username of a bot, which will be used for user authorization; not supported in RichMessageButton. See Setting up a bot for more details. If not specified, the current bot's username will be assumed. The url's domain must be the same as the domain linked with the bot. See Linking your domain to the bot for more details.
BotUsername string `json:"bot_username,omitempty"`
// Optional. Pass True to request the permission for your bot to send messages to the user
RequestWriteAccess *bool `json:"request_write_access,omitempty"`
@@ -2610,6 +2644,10 @@ type CopyTextButton struct {
Text string `json:"text"`
}
// This object represents a disabled button which does nothing. Currently holds no information.
type DisabledButton struct {
}
// This object represents an incoming callback query from a callback button in an inline keyboard. If the button that originated the query was attached to a message sent by the bot, the field message will be present. If the button was attached to a message sent via the bot (in inline mode), the field inline_message_id will be present. Exactly one of the fields data or game_short_name will be present.
// NOTE: After the user presses a callback button, Telegram clients will display a progress bar until you call answerCallbackQuery. It is, therefore, necessary to react by calling answerCallbackQuery even if no notification to the user is needed (e.g., without specifying any of the optional parameters).
type CallbackQuery struct {
@@ -2657,7 +2695,7 @@ func (m *CallbackQuery) UnmarshalJSON(data []byte) error {
// Example: A poll bot for groups runs in privacy mode (only receives commands, replies to its messages and mentions). There could be two ways to create a new poll:
// The last option is definitely more attractive. And if you use ForceReply in your bot's questions, it will receive the user's answers even if it only receives replies, commands and mentions - without any extra work for the user.
type ForceReply struct {
// Shows reply interface to the user, as if they manually selected the bot's message and tapped 'Reply'
// Shows reply interface to the user, as if they had manually selected the bot's message and tapped 'Reply'
ForceReply bool `json:"force_reply"`
// Optional. The placeholder to be shown in the input field when the reply is active; 1-64 characters
InputFieldPlaceholder string `json:"input_field_placeholder,omitempty"`
@@ -2745,8 +2783,10 @@ type ChatAdministratorRights struct {
CanManageTopics *bool `json:"can_manage_topics,omitempty"`
// Optional. True, if the administrator can manage direct messages of the channel and decline suggested posts; for channels only
CanManageDirectMessages *bool `json:"can_manage_direct_messages,omitempty"`
// Optional. True, if the administrator can edit the tags of regular members; for groups and supergroups only. If omitted, defaults to the value of can_pin_messages.
// Optional. True, if the administrator can edit the tags of regular members; for groups and supergroups only
CanManageTags *bool `json:"can_manage_tags,omitempty"`
// True, if the administrator can manage chat welcome messages or directly send them in the case of bots
CanSendWelcomeMessages bool `json:"can_send_welcome_messages"`
}
// This object represents changes in the status of a chat member.
@@ -2933,8 +2973,10 @@ type ChatMemberAdministrator struct {
CanManageTopics *bool `json:"can_manage_topics,omitempty"`
// Optional. True, if the administrator can manage direct messages of the channel and decline suggested posts; for channels only
CanManageDirectMessages *bool `json:"can_manage_direct_messages,omitempty"`
// Optional. True, if the administrator can edit the tags of regular members; for groups and supergroups only. If omitted, defaults to the value of can_pin_messages.
// Optional. True, if the administrator can edit the tags of regular members; for groups and supergroups only
CanManageTags *bool `json:"can_manage_tags,omitempty"`
// True, if the administrator can manage chat welcome messages or directly send them in the case of bots
CanSendWelcomeMessages bool `json:"can_send_welcome_messages"`
// Optional. Custom title for this user
CustomTitle string `json:"custom_title,omitempty"`
}
@@ -3889,6 +3931,12 @@ type UniqueGiftInfo struct {
Gift UniqueGift `json:"gift"`
// Origin of the gift. Currently, either “upgrade” for gifts upgraded from regular gifts, “transfer” for gifts transferred from other users or channels, “resale” for gifts bought from other users, “gifted_upgrade” for upgrades purchased after the gift was sent, or “offer” for gifts bought or sold through gift purchase offers.
Origin UniqueGiftInfoOrigin `json:"origin"`
// Optional. Text of the message that was added to the gift
Text string `json:"text,omitempty"`
// Optional. Special entities that appear in the text
Entities []MessageEntity `json:"entities,omitempty"`
// Optional. True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them
IsPrivate *bool `json:"is_private,omitempty"`
// Optional. For gifts bought from other users, the currency in which the payment for the gift was done. Currently, one of “XTR” for Telegram Stars or “TON” for TON grams.
LastResaleCurrency SuggestedPostPaidCurrency `json:"last_resale_currency,omitempty"`
// Optional. For gifts bought from other users, the price paid for the gift in either Telegram Stars or nanograms
@@ -5464,7 +5512,7 @@ type InputRichMessage struct {
HTML string `json:"html,omitempty"`
// Optional. Content of the rich message to send described using Markdown formatting. See rich message formatting options for more details. Use media field to specify the media used in the message.
Markdown string `json:"markdown,omitempty"`
// Optional. List of media that are specified in the markdown or html fields using tg://photo?id=, tg://video?id=, and tg://audio?id= links
// Optional. List of media that are specified in the markdown or html fields using tg://photo?id=, tg://video?id=, tg://document?id=, and tg://audio?id= links
Media []InputRichMessageMedia `json:"media,omitempty"`
// Optional. Pass True if the rich message must be shown right-to-left
IsRtl *bool `json:"is_rtl,omitempty"`
@@ -5474,12 +5522,38 @@ type InputRichMessage struct {
// Describes a media element embedded in an outgoing rich message.
type InputRichMessageMedia struct {
// Unique identifier of the media used in a tg://photo?id=, tg://video?id=, or tg://audio?id= link. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed.
// Unique identifier of the media used in a tg://photo?id=, tg://video?id=, tg://document?id=, or tg://audio?id= link. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed.
ID string `json:"id"`
// The media to be sent. Everything except the media itself and its properties is ignored.
Media any `json:"media"`
}
// This object represents a button in a RichMessage. Exactly one of the fields other than text and style must be used to specify the type of the button.
type RichMessageButton struct {
// Text of the button. May contain only plain text, RichTextCustomEmoji and RichTextDateTime entities.
Text RichText `json:"text"`
// Optional. Style of the button. Must be one of “danger”, “success”, “primary”, or “link” (the button is shown as a regular link without borders). Apps may use theme-specific colors for the button background and text based on the style. The style “link” is allowed only for callback buttons.
Style RichMessageButtonStyle `json:"style,omitempty"`
// Optional. HTTP or tg:// URL to be opened when the button is pressed. Links tg://user?id=<user_id> can be used to mention a user by their identifier without using a username, if this is allowed by their privacy settings.
URL string `json:"url,omitempty"`
// Optional. Data to be sent in a callback query to the bot when the button is pressed, 1-64 bytes
CallbackData string `json:"callback_data,omitempty"`
// Optional. Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. Available only in private chats between a user and the bot. Not supported for messages sent on behalf of a business account.
WebApp *WebAppInfo `json:"web_app,omitempty"`
// Optional. An HTTPS URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget. Not supported for ephemeral messages.
LoginURL *LoginUrl `json:"login_url,omitempty"`
// Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted. Not supported for messages sent in channel direct messages chats and on behalf of a business account.
SwitchInlineQuery string `json:"switch_inline_query,omitempty"`
// Optional. If set, pressing the button will insert the bot's username and the specified inline query in the current chat's input field. May be empty, in which case only the bot's username will be inserted. Not supported in channels and for messages sent in channel direct messages chats and on behalf of a business account.
SwitchInlineQueryCurrentChat string `json:"switch_inline_query_current_chat,omitempty"`
// Optional. If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot's username and the specified inline query in the input field. Not supported for messages sent in channel direct messages chats and on behalf of a business account.
SwitchInlineQueryChosenChat *SwitchInlineQueryChosenChat `json:"switch_inline_query_chosen_chat,omitempty"`
// Optional. A button that copies the specified text to the clipboard
CopyText *CopyTextButton `json:"copy_text,omitempty"`
// Optional. If set, then the button is disabled and does nothing
Disabled *DisabledButton `json:"disabled,omitempty"`
}
// RichText is a union type. The following concrete variants implement
// it:
// - RichTextBold
@@ -5503,6 +5577,7 @@ type InputRichMessageMedia struct {
// - RichTextHashtag
// - RichTextCashtag
// - RichTextBotCommand
// - RichTextButton
// - RichTextAnchor
// - RichTextAnchorLink
// - RichTextReference
@@ -5574,6 +5649,9 @@ func (*RichTextCashtag) isRichText() {}
// isRichText is the marker method that makes RichTextBotCommand implement RichText.
func (*RichTextBotCommand) isRichText() {}
// isRichText is the marker method that makes RichTextButton implement RichText.
func (*RichTextButton) isRichText() {}
// isRichText is the marker method that makes RichTextAnchor implement RichText.
func (*RichTextAnchor) isRichText() {}
@@ -6114,6 +6192,30 @@ func (v *RichTextBotCommand) MarshalJSON() ([]byte, error) {
})
}
// A button.
type RichTextButton struct {
// Type of the rich text, always “button”
Type RichTextType `json:"type"`
// The button
Button RichMessageButton `json:"button"`
}
// MarshalJSON encodes RichTextButton with the discriminator field
// "type" forced to "button".
// The hardcoded value frees callers from setting Type by hand —
// any user-supplied value on the struct literal is overridden so a typo
// can't slip through to Telegram.
func (v *RichTextButton) MarshalJSON() ([]byte, error) {
type alias RichTextButton
return json.Marshal(&struct {
Type string `json:"type"`
*alias
}{
Type: "button",
alias: (*alias)(v),
})
}
// An anchor.
type RichTextAnchor struct {
// Type of the rich text, always “anchor”
@@ -6235,7 +6337,7 @@ type RichBlockTableCell struct {
// Optional. The number of rows the cell spans if it is bigger than 1
Rowspan *int64 `json:"rowspan,omitempty"`
// Horizontal cell content alignment. Currently, must be one of “left”, “center”, or “right”.
Align RichBlockTableCellAlign `json:"align"`
Align RichBlockButtonsAlign `json:"align"`
// Vertical cell content alignment. Currently, must be one of “top”, “middle”, or “bottom”.
Valign RichBlockTableCellValign `json:"valign"`
}
@@ -6267,14 +6369,17 @@ type RichBlockListItem struct {
// - RichBlockAnchor
// - RichBlockList
// - RichBlockBlockQuotation
// - RichBlockExpandableBlockQuotation
// - RichBlockPullQuotation
// - RichBlockCollage
// - RichBlockSlideshow
// - RichBlockTable
// - RichBlockDetails
// - RichBlockMap
// - RichBlockButtons
// - RichBlockAnimation
// - RichBlockAudio
// - RichBlockDocument
// - RichBlockPhoto
// - RichBlockVideo
// - RichBlockVoiceNote
@@ -6310,6 +6415,9 @@ func (*RichBlockList) isRichBlock() {}
// isRichBlock is the marker method that makes RichBlockBlockQuotation implement RichBlock.
func (*RichBlockBlockQuotation) isRichBlock() {}
// isRichBlock is the marker method that makes RichBlockExpandableBlockQuotation implement RichBlock.
func (*RichBlockExpandableBlockQuotation) isRichBlock() {}
// isRichBlock is the marker method that makes RichBlockPullQuotation implement RichBlock.
func (*RichBlockPullQuotation) isRichBlock() {}
@@ -6328,12 +6436,18 @@ func (*RichBlockDetails) isRichBlock() {}
// isRichBlock is the marker method that makes RichBlockMap implement RichBlock.
func (*RichBlockMap) isRichBlock() {}
// isRichBlock is the marker method that makes RichBlockButtons implement RichBlock.
func (*RichBlockButtons) isRichBlock() {}
// isRichBlock is the marker method that makes RichBlockAnimation implement RichBlock.
func (*RichBlockAnimation) isRichBlock() {}
// isRichBlock is the marker method that makes RichBlockAudio implement RichBlock.
func (*RichBlockAudio) isRichBlock() {}
// isRichBlock is the marker method that makes RichBlockDocument implement RichBlock.
func (*RichBlockDocument) isRichBlock() {}
// isRichBlock is the marker method that makes RichBlockPhoto implement RichBlock.
func (*RichBlockPhoto) isRichBlock() {}
@@ -6566,6 +6680,32 @@ func (v *RichBlockBlockQuotation) MarshalJSON() ([]byte, error) {
})
}
// A block quotation, corresponding to the HTML tag <blockquote> with custom attribute "expandable".
type RichBlockExpandableBlockQuotation struct {
// Type of the block, always “expandable_blockquote”
Type RichBlockType `json:"type"`
// Content of the block
Text RichText `json:"text"`
// Optional. Credit of the block
Credit RichText `json:"credit,omitempty"`
}
// MarshalJSON encodes RichBlockExpandableBlockQuotation with the discriminator field
// "type" forced to "expandable_blockquote".
// The hardcoded value frees callers from setting Type by hand —
// any user-supplied value on the struct literal is overridden so a typo
// can't slip through to Telegram.
func (v *RichBlockExpandableBlockQuotation) MarshalJSON() ([]byte, error) {
type alias RichBlockExpandableBlockQuotation
return json.Marshal(&struct {
Type string `json:"type"`
*alias
}{
Type: "expandable_blockquote",
alias: (*alias)(v),
})
}
// A quotation with centered text, loosely corresponding to the HTML tag <aside>.
type RichBlockPullQuotation struct {
// Type of the block, always “pullquote”
@@ -6654,6 +6794,8 @@ type RichBlockTable struct {
IsBordered *bool `json:"is_bordered,omitempty"`
// Optional. True, if the table is striped
IsStriped *bool `json:"is_striped,omitempty"`
// Optional. True, if table cells have smaller indents
IsCompact *bool `json:"is_compact,omitempty"`
// Optional. Caption of the table
Caption RichText `json:"caption,omitempty"`
}
@@ -6708,7 +6850,7 @@ type RichBlockMap struct {
Type RichBlockType `json:"type"`
// Location of the center of the map
Location Location `json:"location"`
// Map zoom level; 13-20
// Map zoom level
Zoom int64 `json:"zoom"`
// Expected width of the map
Width int64 `json:"width"`
@@ -6734,6 +6876,32 @@ func (v *RichBlockMap) MarshalJSON() ([]byte, error) {
})
}
// A block containing a list of buttons that are shown in one row, corresponding to the custom HTML tag <tg-button-row>.
type RichBlockButtons struct {
// Type of the block, always “buttons”
Type RichBlockType `json:"type"`
// The buttons
Buttons []RichMessageButton `json:"buttons"`
// Optional. Horizontal alignment of the buttons. Currently, must be one of “left”, “center”, or “right”.
Align RichBlockButtonsAlign `json:"align,omitempty"`
}
// MarshalJSON encodes RichBlockButtons with the discriminator field
// "type" forced to "buttons".
// The hardcoded value frees callers from setting Type by hand —
// any user-supplied value on the struct literal is overridden so a typo
// can't slip through to Telegram.
func (v *RichBlockButtons) MarshalJSON() ([]byte, error) {
type alias RichBlockButtons
return json.Marshal(&struct {
Type string `json:"type"`
*alias
}{
Type: "buttons",
alias: (*alias)(v),
})
}
// A block with an animation, corresponding to the HTML tag <video>.
type RichBlockAnimation struct {
// Type of the block, always “animation”
@@ -6788,6 +6956,32 @@ func (v *RichBlockAudio) MarshalJSON() ([]byte, error) {
})
}
// A block with a general file, corresponding to the custom HTML tag <tg-document>.
type RichBlockDocument struct {
// Type of the block, always “document”
Type RichBlockType `json:"type"`
// The document
Document Document `json:"document"`
// Optional. Caption of the block
Caption *RichBlockCaption `json:"caption,omitempty"`
}
// MarshalJSON encodes RichBlockDocument with the discriminator field
// "type" forced to "document".
// The hardcoded value frees callers from setting Type by hand —
// any user-supplied value on the struct literal is overridden so a typo
// can't slip through to Telegram.
func (v *RichBlockDocument) MarshalJSON() ([]byte, error) {
type alias RichBlockDocument
return json.Marshal(&struct {
Type string `json:"type"`
*alias
}{
Type: "document",
alias: (*alias)(v),
})
}
// A block with a photo, corresponding to the HTML tag <img>.
type RichBlockPhoto struct {
// Type of the block, always “photo”
@@ -6919,14 +7113,17 @@ type InputRichBlockListItem struct {
// - InputRichBlockAnchor
// - InputRichBlockList
// - InputRichBlockBlockQuotation
// - InputRichBlockExpandableBlockQuotation
// - InputRichBlockPullQuotation
// - InputRichBlockCollage
// - InputRichBlockSlideshow
// - InputRichBlockTable
// - InputRichBlockDetails
// - InputRichBlockMap
// - InputRichBlockButtons
// - InputRichBlockAnimation
// - InputRichBlockAudio
// - InputRichBlockDocument
// - InputRichBlockPhoto
// - InputRichBlockVideo
// - InputRichBlockVoiceNote
@@ -6962,6 +7159,9 @@ func (*InputRichBlockList) isInputRichBlock() {}
// isInputRichBlock is the marker method that makes InputRichBlockBlockQuotation implement InputRichBlock.
func (*InputRichBlockBlockQuotation) isInputRichBlock() {}
// isInputRichBlock is the marker method that makes InputRichBlockExpandableBlockQuotation implement InputRichBlock.
func (*InputRichBlockExpandableBlockQuotation) isInputRichBlock() {}
// isInputRichBlock is the marker method that makes InputRichBlockPullQuotation implement InputRichBlock.
func (*InputRichBlockPullQuotation) isInputRichBlock() {}
@@ -6980,12 +7180,18 @@ func (*InputRichBlockDetails) isInputRichBlock() {}
// isInputRichBlock is the marker method that makes InputRichBlockMap implement InputRichBlock.
func (*InputRichBlockMap) isInputRichBlock() {}
// isInputRichBlock is the marker method that makes InputRichBlockButtons implement InputRichBlock.
func (*InputRichBlockButtons) isInputRichBlock() {}
// isInputRichBlock is the marker method that makes InputRichBlockAnimation implement InputRichBlock.
func (*InputRichBlockAnimation) isInputRichBlock() {}
// isInputRichBlock is the marker method that makes InputRichBlockAudio implement InputRichBlock.
func (*InputRichBlockAudio) isInputRichBlock() {}
// isInputRichBlock is the marker method that makes InputRichBlockDocument implement InputRichBlock.
func (*InputRichBlockDocument) isInputRichBlock() {}
// isInputRichBlock is the marker method that makes InputRichBlockPhoto implement InputRichBlock.
func (*InputRichBlockPhoto) isInputRichBlock() {}
@@ -7218,6 +7424,32 @@ func (v *InputRichBlockBlockQuotation) MarshalJSON() ([]byte, error) {
})
}
// A block quotation, corresponding to the HTML tag <blockquote> with custom attribute "expandable".
type InputRichBlockExpandableBlockQuotation struct {
// Type of the block, always “expandable_blockquote”
Type InputRichBlockType `json:"type"`
// Content of the block
Text RichText `json:"text"`
// Optional. Credit of the block
Credit RichText `json:"credit,omitempty"`
}
// MarshalJSON encodes InputRichBlockExpandableBlockQuotation with the discriminator field
// "type" forced to "expandable_blockquote".
// The hardcoded value frees callers from setting Type by hand —
// any user-supplied value on the struct literal is overridden so a typo
// can't slip through to Telegram.
func (v *InputRichBlockExpandableBlockQuotation) MarshalJSON() ([]byte, error) {
type alias InputRichBlockExpandableBlockQuotation
return json.Marshal(&struct {
Type string `json:"type"`
*alias
}{
Type: "expandable_blockquote",
alias: (*alias)(v),
})
}
// A quotation with centered text, loosely corresponding to the HTML tag <aside>.
type InputRichBlockPullQuotation struct {
// Type of the block, always “pullquote”
@@ -7306,6 +7538,8 @@ type InputRichBlockTable struct {
IsBordered *bool `json:"is_bordered,omitempty"`
// Optional. Pass True if the table is striped
IsStriped *bool `json:"is_striped,omitempty"`
// Optional. Pass True if table cells must have smaller indents
IsCompact *bool `json:"is_compact,omitempty"`
// Optional. Caption of the table
Caption RichText `json:"caption,omitempty"`
}
@@ -7360,12 +7594,12 @@ type InputRichBlockMap struct {
Type InputRichBlockType `json:"type"`
// Location of the center of the map
Location Location `json:"location"`
// Map zoom level; 0-24
Zoom int64 `json:"zoom"`
// Map width; 0-10000
Width int64 `json:"width"`
// Map height; 0-10000
Height int64 `json:"height"`
// Optional. Map zoom level; 0-24
Zoom *int64 `json:"zoom,omitempty"`
// Optional. Map width; 0-10000
Width *int64 `json:"width,omitempty"`
// Optional. Map height; 0-10000
Height *int64 `json:"height,omitempty"`
// Optional. Caption of the block
Caption *RichBlockCaption `json:"caption,omitempty"`
}
@@ -7386,6 +7620,32 @@ func (v *InputRichBlockMap) MarshalJSON() ([]byte, error) {
})
}
// A block containing a list of buttons that are shown in one row, corresponding to the custom HTML tag <tg-button-row>.
type InputRichBlockButtons struct {
// Type of the block, always “buttons”
Type InputRichBlockType `json:"type"`
// List of 1-8 buttons to send
Buttons []RichMessageButton `json:"buttons"`
// Optional. Horizontal alignment of the buttons. Currently, must be one of “left”, “center”, or “right”.
Align RichBlockButtonsAlign `json:"align,omitempty"`
}
// MarshalJSON encodes InputRichBlockButtons with the discriminator field
// "type" forced to "buttons".
// The hardcoded value frees callers from setting Type by hand —
// any user-supplied value on the struct literal is overridden so a typo
// can't slip through to Telegram.
func (v *InputRichBlockButtons) MarshalJSON() ([]byte, error) {
type alias InputRichBlockButtons
return json.Marshal(&struct {
Type string `json:"type"`
*alias
}{
Type: "buttons",
alias: (*alias)(v),
})
}
// A block with an animation, corresponding to the HTML tag <video>.
type InputRichBlockAnimation struct {
// Type of the block, always “animation”
@@ -7438,6 +7698,32 @@ func (v *InputRichBlockAudio) MarshalJSON() ([]byte, error) {
})
}
// A block with a general file, corresponding to the custom HTML tag <tg-document>.
type InputRichBlockDocument struct {
// Type of the block, always “document”
Type InputRichBlockType `json:"type"`
// The document. Caption is ignored.
Document InputMediaDocument `json:"document"`
// Optional. Caption of the block
Caption *RichBlockCaption `json:"caption,omitempty"`
}
// MarshalJSON encodes InputRichBlockDocument with the discriminator field
// "type" forced to "document".
// The hardcoded value frees callers from setting Type by hand —
// any user-supplied value on the struct literal is overridden so a typo
// can't slip through to Telegram.
func (v *InputRichBlockDocument) MarshalJSON() ([]byte, error) {
type alias InputRichBlockDocument
return json.Marshal(&struct {
Type string `json:"type"`
*alias
}{
Type: "document",
alias: (*alias)(v),
})
}
// A block with a photo, corresponding to the HTML tag <img>.
type InputRichBlockPhoto struct {
// Type of the block, always “photo”
@@ -8544,7 +8830,7 @@ type InputTextMessageContent struct {
// Represents the content of a rich message to be sent as the result of an inline query.
type InputRichMessageContent struct {
// The message to be sent
// The message to be sent. Only previously uploaded files may be used in the message.
RichMessage InputRichMessage `json:"rich_message"`
}