package tgapi import "context" // SendMessage holds parameters for the sendMessage method. // Since: Bot API 1.0 // See https://core.telegram.org/bots/api#sendmessage type SendMessage struct { // BusinessConnectionID 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 int64 `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 // Text Required. Text of the message to be sent, 1-4096 characters after entities parsing Text string `json:"text"` // ParseMode Optional. Mode for parsing entities in the message text. See formatting options for more // details. ParseMode ParseMode `json:"parse_mode,omitempty"` // Entities Optional. 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"` // LinkPreviewOptions Optional. Link preview generation options for the message LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options,omitempty"` // DisableNotifications Optional. Sends the message silently. Users will receive a notification with no // sound. DisableNotifications 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 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"` } // SendMessage sends a text message. // Since: Bot API 1.0 // See https://core.telegram.org/bots/api#sendmessage func (api *API) SendMessage(params SendMessage) (Message, error) { req := NewRequestWithChatID[Message]("sendMessage", params, params.ChatID) return req.Do(api) } // SendMessageWithContext is the context-aware variant of SendMessage. // Since: Bot API 1.0 // It executes the same request but uses ctx for cancellation and deadlines. // See https://core.telegram.org/bots/api#sendmessage func (api *API) SendMessageWithContext(ctx context.Context, params SendMessage) (Message, error) { req := NewRequestWithChatID[Message]("sendMessage", params, params.ChatID) return req.DoWithContext(ctx, api) } // ForwardMessage holds parameters for the forwardMessage method. // Since: Bot API 1.0 // See https://core.telegram.org/bots/api#forwardmessage type ForwardMessage struct { // 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 // forwarded; required if the message is forwarded to a direct messages chat DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"` // MessageID Required. Message identifier in the chat specified in from_chat_id MessageID int `json:"message_id,omitempty"` // FromChatID Required. Unique identifier for the chat where the original message was sent (or username of // the target bot, supergroup or channel in the format @username) FromChatID int64 `json:"from_chat_id,omitempty"` // VideoStartTimestamp Optional. New start timestamp for the forwarded video in the message VideoStartTimestamp int `json:"video_start_timestamp,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 forwarded message from forwarding and saving ProtectContent bool `json:"protect_content,omitempty"` // MessageEffectID Optional. Unique identifier of the message effect to be added to the message; only // available when forwarding to private chats 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 SuggestedPostParameters *SuggestedPostParameters `json:"suggested_post_parameters,omitempty"` } // ForwardMessage forwards a message. // Since: Bot API 1.0 // See https://core.telegram.org/bots/api#forwardmessage func (api *API) ForwardMessage(params ForwardMessage) (Message, error) { req := NewRequestWithChatID[Message]("forwardMessage", params, params.ChatID) return req.Do(api) } // ForwardMessageWithContext is the context-aware variant of ForwardMessage. // Since: Bot API 1.0 // It executes the same request but uses ctx for cancellation and deadlines. // See https://core.telegram.org/bots/api#forwardmessage func (api *API) ForwardMessageWithContext(ctx context.Context, params ForwardMessage) (Message, error) { req := NewRequestWithChatID[Message]("forwardMessage", params, params.ChatID) return req.DoWithContext(ctx, api) } // ForwardMessages holds parameters for the forwardMessages method. // Since: Bot API 7.0 // See https://core.telegram.org/bots/api#forwardmessages type ForwardMessages struct { // 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 messages will be // forwarded; required if the messages are forwarded to a direct messages chat DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"` // FromChatID Required. Unique identifier for the chat where the original messages were sent (or username of // the target bot, supergroup or channel in the format @username) FromChatID int64 `json:"from_chat_id,omitempty"` // MessageIDs Required. A JSON-serialized list of 1-100 identifiers of messages in the chat from_chat_id to // forward. The identifiers must be specified in a strictly increasing order. MessageIDs []int `json:"message_ids,omitempty"` // DisableNotification Optional. Sends the messages silently. Users will receive a notification with no // sound. DisableNotification bool `json:"disable_notification,omitempty"` // ProtectContent Optional. Protects the contents of the forwarded messages from forwarding and saving ProtectContent bool `json:"protect_content,omitempty"` } // ForwardMessages forwards multiple messages. // Since: Bot API 7.0 // Returns an array of message IDs of the sent messages. // See https://core.telegram.org/bots/api#forwardmessages func (api *API) ForwardMessages(params ForwardMessages) ([]MessageID, error) { req := NewRequestWithChatID[[]MessageID]("forwardMessages", params, params.ChatID) return req.Do(api) } // ForwardMessagesWithContext is the context-aware variant of ForwardMessages. // Since: Bot API 7.0 // It executes the same request but uses ctx for cancellation and deadlines. // See https://core.telegram.org/bots/api#forwardmessages func (api *API) ForwardMessagesWithContext(ctx context.Context, params ForwardMessages) ([]MessageID, error) { req := NewRequestWithChatID[[]MessageID]("forwardMessages", params, params.ChatID) return req.DoWithContext(ctx, api) } // CopyMessage holds parameters for the copyMessage method. // Since: Bot API 5.0 // See https://core.telegram.org/bots/api#copymessage type CopyMessage struct { // 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"` // FromChatID Required. Unique identifier for the chat where the original message was sent (or username of // the target bot, supergroup or channel in the format @username) FromChatID int64 `json:"from_chat_id"` // MessageID Required. Message identifier in the chat specified in from_chat_id MessageID int `json:"message_id"` // VideoStartTimestamp Optional. New start timestamp for the copied video in the message VideoStartTimestamp int `json:"video_start_timestamp,omitempty"` // Caption Optional. New caption for media, 0-1024 characters after entities parsing. If not specified, the // original caption is kept. Caption string `json:"caption,omitempty"` // ParseMode Optional. Mode for parsing entities in the new 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 new caption, // which can be specified instead of parse_mode CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` // ShowCaptionAboveMedia Optional. Pass True if the caption must be shown above the message media. Ignored // if a new caption isn't specified. ShowCaptionAboveMedia bool `json:"show_caption_above_media,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; only // available when copying to private chats 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 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"` } // CopyMessage copies a message. // Since: Bot API 5.0 // Returns the MessageID of the sent copy. // See https://core.telegram.org/bots/api#copymessage func (api *API) CopyMessage(params CopyMessage) (int, error) { msgID, err := NewRequestWithChatID[MessageID]("copyMessage", params, params.ChatID).Do(api) if err != nil { return 0, err } return msgID.MessageID, nil } // CopyMessageWithContext is the context-aware variant of CopyMessage. // Since: Bot API 5.0 // It executes the same request but uses ctx for cancellation and deadlines. // See https://core.telegram.org/bots/api#copymessage func (api *API) CopyMessageWithContext(ctx context.Context, params CopyMessage) (int, error) { msgID, err := NewRequestWithChatID[MessageID]("copyMessage", params, params.ChatID).DoWithContext(ctx, api) if err != nil { return 0, err } return msgID.MessageID, nil } // CopyMessages holds parameters for the copyMessages method. // Since: Bot API 7.0 // See https://core.telegram.org/bots/api#copymessages type CopyMessages struct { // 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 messages will be // sent; required if the messages are sent to a direct messages chat DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"` // FromChatID Required. Unique identifier for the chat where the original messages were sent (or username of // the target bot, supergroup or channel in the format @username) FromChatID int64 `json:"from_chat_id,omitempty"` // MessageIDs Required. A JSON-serialized list of 1-100 identifiers of messages in the chat from_chat_id to // copy. The identifiers must be specified in a strictly increasing order. MessageIDs []int `json:"message_ids,omitempty"` // DisableNotification Optional. Sends the messages silently. Users will receive a notification with no // sound. DisableNotification bool `json:"disable_notification,omitempty"` // ProtectContent Optional. Protects the contents of the sent messages from forwarding and saving ProtectContent bool `json:"protect_content,omitempty"` // RemoveCaption Optional. Pass True to copy the messages without their captions RemoveCaption bool `json:"remove_caption,omitempty"` } // CopyMessages copies multiple messages. // Since: Bot API 7.0 // Returns an array of message IDs of the sent copies. // See https://core.telegram.org/bots/api#copymessages func (api *API) CopyMessages(params CopyMessages) ([]MessageID, error) { req := NewRequestWithChatID[[]MessageID]("copyMessages", params, params.ChatID) return req.Do(api) } // CopyMessagesWithContext is the context-aware variant of CopyMessages. // Since: Bot API 7.0 // It executes the same request but uses ctx for cancellation and deadlines. // See https://core.telegram.org/bots/api#copymessages func (api *API) CopyMessagesWithContext(ctx context.Context, params CopyMessages) ([]MessageID, error) { req := NewRequestWithChatID[[]MessageID]("copyMessages", params, params.ChatID) return req.DoWithContext(ctx, api) } // SendLocation holds parameters for the sendLocation method. // Since: Bot API 1.0 // See https://core.telegram.org/bots/api#sendlocation type SendLocation struct { // 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 // Latitude Required. Latitude of the location Latitude float64 `json:"latitude"` // Longitude Required. Longitude of the location Longitude float64 `json:"longitude"` // HorizontalAccuracy Optional. The radius of uncertainty for the location, measured in meters; 0-1500 HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"` // LivePeriod Optional. Period in seconds during which the location will be updated (see Live Locations), // must be between 60 and 86400, or 0x7FFFFFFF for live locations that can be edited indefinitely. Must be 0 // for ephemeral messages. LivePeriod int `json:"live_period,omitempty"` // Heading Optional. For live locations, a direction in which the user is moving, in degrees. Must be // between 1 and 360 if specified. Heading int `json:"heading,omitempty"` // ProximityAlertRadius Optional. For live locations, a maximum distance for proximity alerts about // approaching another chat member, in meters. Must be between 1 and 100000 if specified. ProximityAlertRadius int `json:"proximity_alert_radius,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 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"` } // SendLocation sends a point on the map. // Since: Bot API 1.0 // See https://core.telegram.org/bots/api#sendlocation func (api *API) SendLocation(params SendLocation) (Message, error) { req := NewRequestWithChatID[Message]("sendLocation", params, params.ChatID) return req.Do(api) } // SendLocationWithContext is the context-aware variant of SendLocation. // Since: Bot API 1.0 // It executes the same request but uses ctx for cancellation and deadlines. // See https://core.telegram.org/bots/api#sendlocation func (api *API) SendLocationWithContext(ctx context.Context, params SendLocation) (Message, error) { req := NewRequestWithChatID[Message]("sendLocation", params, params.ChatID) return req.DoWithContext(ctx, api) } // SendVenue holds parameters for the sendVenue method. // Since: Bot API 2.0 // See https://core.telegram.org/bots/api#sendvenue type SendVenue struct { // 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 // Latitude Required. Latitude of the venue Latitude float64 `json:"latitude"` // Longitude Required. Longitude of the venue Longitude float64 `json:"longitude"` // Title Required. Name of the venue Title string `json:"title"` // Address Required. Address of the venue Address string `json:"address"` // FoursquareID Optional. Foursquare identifier of the venue FoursquareID string `json:"foursquare_id,omitempty"` // FoursquareType Optional. Foursquare type of the venue, if known. (For example, // “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.) FoursquareType string `json:"foursquare_type,omitempty"` // GooglePlaceID Optional. Google Places identifier of the venue GooglePlaceID string `json:"google_place_id,omitempty"` // GooglePlaceType Optional. Google Places type of the venue. (See supported types.) GooglePlaceType string `json:"google_place_type,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 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"` } // SendVenue sends information about a venue. // Since: Bot API 2.0 // See https://core.telegram.org/bots/api#sendvenue func (api *API) SendVenue(params SendVenue) (Message, error) { req := NewRequestWithChatID[Message]("sendVenue", params, params.ChatID) return req.Do(api) } // SendVenueWithContext is the context-aware variant of SendVenue. // Since: Bot API 2.0 // It executes the same request but uses ctx for cancellation and deadlines. // See https://core.telegram.org/bots/api#sendvenue func (api *API) SendVenueWithContext(ctx context.Context, params SendVenue) (Message, error) { req := NewRequestWithChatID[Message]("sendVenue", params, params.ChatID) return req.DoWithContext(ctx, api) } // SendContact holds parameters for the sendContact method. // Since: Bot API 2.0 // See https://core.telegram.org/bots/api#sendcontact type SendContact struct { // 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 // PhoneNumber Required. Contact's phone number PhoneNumber string `json:"phone_number"` // FirstName Required. Contact's first name FirstName string `json:"first_name"` // LastName Optional. Contact's last name LastName string `json:"last_name,omitempty"` // Vcard Optional. Additional data about the contact in the form of a vCard, 0-2048 bytes Vcard string `json:"vcard"` // 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 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"` } // SendContact sends a phone contact. // Since: Bot API 2.0 // See https://core.telegram.org/bots/api#sendcontact func (api *API) SendContact(params SendContact) (Message, error) { req := NewRequestWithChatID[Message]("sendContact", params, params.ChatID) return req.Do(api) } // SendContactWithContext is the context-aware variant of SendContact. // Since: Bot API 2.0 // It executes the same request but uses ctx for cancellation and deadlines. // See https://core.telegram.org/bots/api#sendcontact func (api *API) SendContactWithContext(ctx context.Context, params SendContact) (Message, error) { req := NewRequestWithChatID[Message]("sendContact", params, params.ChatID) return req.DoWithContext(ctx, api) } // SendPoll holds parameters for the sendPoll method. // Since: Bot API 4.2 // See https://core.telegram.org/bots/api#sendpoll type SendPoll struct { // 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. Polls can't be sent to channel direct messages chats. 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"` // Question Required. Poll question, 1-300 characters Question string `json:"question"` // QuestionParseMode Optional. Mode for parsing entities in the question. See formatting options for more // details. Currently, only custom emoji entities are allowed. QuestionParseMode ParseMode `json:"question_parse_mode,omitempty"` // QuestionEntities Optional. A JSON-serialized list of special entities that appear in the poll question. // It can be specified instead of question_parse_mode. QuestionEntities []MessageEntity `json:"question_entities,omitempty"` // Options Required. A JSON-serialized list of 1-12 answer options Options []InputPollOption `json:"options"` // IsAnonymous Optional. True, if the poll needs to be anonymous, defaults to True IsAnonymous bool `json:"is_anonymous,omitempty"` // Type Optional. Poll type, “quiz” or “regular”, defaults to “regular” Type PollType `json:"type"` // AllowsMultipleAnswers Optional. Pass True if the poll allows multiple answers, defaults to False AllowsMultipleAnswers bool `json:"allows_multiple_answers,omitempty"` // AllowsRevoting Optional. Pass True if the poll allows to change chosen answer options, defaults to False // for quizzes and to True for regular polls AllowsRevoting bool `json:"allows_revoting,omitempty"` // ShuffleOptions Optional. Pass True if the poll options must be shown in random order ShuffleOptions bool `json:"shuffle_options,omitempty"` // AllowAddingOptions Optional. Pass True if answer options can be added to the poll after creation; not // supported for anonymous polls and quizzes AllowAddingOptions bool `json:"allow_adding_options,omitempty"` // HideResultsUntilCloses Optional. Pass True if poll results must be shown only after the poll closes HideResultsUntilCloses bool `json:"hide_results_until_closes,omitempty"` // MembersOnly Optional. Pass True if voting is limited to users who have been members of the chat where the // poll is being sent for more than 24 hours; for channel chats only MembersOnly bool `json:"members_only,omitempty"` // Since: Bot API 10.0 // CountryCodes Optional. A JSON-serialized list of 0-12 two-letter ISO 3166-1 alpha-2 country codes // indicating the countries from which users can vote in the poll; for channel chats only. Use “FT” as a // country code to allow users with anonymous numbers to vote. If omitted or empty, then users from any // country can participate in the poll. CountryCodes []string `json:"country_codes,omitempty"` // Since: Bot API 10.0 // CorrectOptionIDs Optional. A JSON-serialized list of monotonically increasing 0-based identifiers of the // correct answer options, required for polls in quiz mode CorrectOptionIDs []int `json:"correct_option_ids,omitempty"` // Explanation Optional. Text that is shown when a user chooses an incorrect answer or taps on the lamp icon // in a quiz-style poll, 0-200 characters with at most 2 line feeds after entities parsing Explanation string `json:"explanation,omitempty"` // ExplanationParseMode Optional. Mode for parsing entities in the explanation. See formatting options for // more details. ExplanationParseMode ParseMode `json:"explanation_parse_mode,omitempty"` // ExplanationEntities Optional. A JSON-serialized list of special entities that appear in the poll // explanation. It can be specified instead of explanation_parse_mode. ExplanationEntities []MessageEntity `json:"explanation_entities,omitempty"` // ExplanationMedia Optional. Media added to the quiz explanation ExplanationMedia *InputPollMedia `json:"explanation_media,omitempty"` // Media Optional. Media added to the poll description Media *InputPollMedia `json:"media,omitempty"` // OpenPeriod Optional. Amount of time in seconds the poll will be active after creation, 5-2628000. Can't // be used together with close_date. OpenPeriod int `json:"open_period,omitempty"` // CloseDate Optional. Point in time (Unix timestamp) when the poll will be automatically closed. Must be at // least 5 and no more than 2628000 seconds in the future. Can't be used together with open_period. CloseDate int `json:"close_date"` // IsClosed Optional. Pass True if the poll needs to be immediately closed. This can be useful for poll // preview. IsClosed bool `json:"is_closed,omitempty"` // Description Optional. Description of the poll to be sent, 0-1024 characters after entities parsing Description string `json:"description"` // DescriptionParseMode Optional. Mode for parsing entities in the poll description. See formatting options // for more details. DescriptionParseMode ParseMode `json:"description_parse_mode,omitempty"` // DescriptionEntities Optional. A JSON-serialized list of special entities that appear in the poll // description, which can be specified instead of description_parse_mode DescriptionEntities []MessageEntity `json:"description_entities,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"` // 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"` } // SendPoll sends a native poll. // Since: Bot API 4.2 // See https://core.telegram.org/bots/api#sendpoll func (api *API) SendPoll(params SendPoll) (Message, error) { req := NewRequestWithChatID[Message]("sendPoll", params, params.ChatID) return req.Do(api) } // SendPollWithContext is the context-aware variant of SendPoll. // Since: Bot API 4.2 // It executes the same request but uses ctx for cancellation and deadlines. // See https://core.telegram.org/bots/api#sendpoll func (api *API) SendPollWithContext(ctx context.Context, params SendPoll) (Message, error) { req := NewRequestWithChatID[Message]("sendPoll", params, params.ChatID) return req.DoWithContext(ctx, api) } // SendChecklist holds parameters for the sendChecklist method. // Since: Bot API 9.1 // See https://core.telegram.org/bots/api#sendchecklist type SendChecklist struct { // BusinessConnectionID Required. Unique identifier of the business connection on behalf of which the // message will be sent BusinessConnectionID string `json:"business_connection_id"` // ChatID Required. Unique identifier for the target chat or username of the target bot in the format // @username ChatID int64 `json:"chat_id"` // Checklist Required. A JSON-serialized object for the checklist to send Checklist InputChecklist `json:"checklist"` // 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"` // MessageEffectID Optional. Unique identifier of the message effect to be added to the message MessageEffectID string `json:"message_effect_id,omitempty"` // ReplyParameters Optional. A JSON-serialized object for description of the message to reply to ReplyParameters *ReplyParameters `json:"reply_parameters,omitempty"` // ReplyMarkup Optional. A JSON-serialized object for an inline keyboard ReplyMarkup *ReplyMarkup `json:"reply_markup,omitempty"` } // SendChecklist sends a checklist. // Since: Bot API 9.1 // See https://core.telegram.org/bots/api#sendchecklist func (api *API) SendChecklist(params SendChecklist) (Message, error) { req := NewRequestWithChatID[Message]("sendChecklist", params, params.ChatID) return req.Do(api) } // SendChecklistWithContext is the context-aware variant of SendChecklist. // Since: Bot API 9.1 // It executes the same request but uses ctx for cancellation and deadlines. // See https://core.telegram.org/bots/api#sendchecklist func (api *API) SendChecklistWithContext(ctx context.Context, params SendChecklist) (Message, error) { req := NewRequestWithChatID[Message]("sendChecklist", params, params.ChatID) return req.DoWithContext(ctx, api) } // SendDice holds parameters for the sendDice method. // Since: Bot API 4.7 // See https://core.telegram.org/bots/api#senddice type SendDice struct { // 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"` // Emoji Optional. Emoji on which the dice throw animation is based. Currently, must be one of “”, // “”, “”, “”, “”, or “”. Dice can have values 1-6 for “”, “” and “”, values // 1-5 for “” and “”, and values 1-64 for “”. Defaults to “”. Emoji string `json:"emoji,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 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 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"` } // SendDice sends a dice, which will have a random value. // Since: Bot API 4.7 // See https://core.telegram.org/bots/api#senddice func (api *API) SendDice(params SendDice) (Message, error) { req := NewRequestWithChatID[Message]("sendDice", params, params.ChatID) return req.Do(api) } // SendDiceWithContext is the context-aware variant of SendDice. // Since: Bot API 4.7 // It executes the same request but uses ctx for cancellation and deadlines. // See https://core.telegram.org/bots/api#senddice func (api *API) SendDiceWithContext(ctx context.Context, params SendDice) (Message, error) { req := NewRequestWithChatID[Message]("sendDice", params, params.ChatID) return req.DoWithContext(ctx, api) } // SendMessageDraft holds parameters for the sendMessageDraft method. // Since: Bot API 9.1 // See https://core.telegram.org/bots/api#sendmessagedraft type SendMessageDraft struct { // ChatID Required. Unique identifier for the target private chat ChatID int64 `json:"chat_id"` // MessageThreadID Optional. Unique identifier for the target message thread MessageThreadID int `json:"message_thread_id,omitempty"` // DraftID Required. Unique identifier of the message draft; must be non-zero. Changes to drafts with the // same identifier are animated. DraftID uint64 `json:"draft_id"` // Text Optional. 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"` // ParseMode Optional. Mode for parsing entities in the message text. See formatting options for more // details. ParseMode ParseMode `json:"parse_mode,omitempty"` // Entities Optional. 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"` } // SendMessageDraft sends or updates a draft message in the target chat. // Since: Bot API 9.1 // Returns True on success. // See https://core.telegram.org/bots/api#sendmessagedraft func (api *API) SendMessageDraft(params SendMessageDraft) (bool, error) { req := NewRequestWithChatID[bool]("sendMessageDraft", params, params.ChatID) return req.Do(api) } // SendMessageDraftWithContext is the context-aware variant of SendMessageDraft. // Since: Bot API 9.1 // It executes the same request but uses ctx for cancellation and deadlines. // See https://core.telegram.org/bots/api#sendmessagedraft func (api *API) SendMessageDraftWithContext(ctx context.Context, params SendMessageDraft) (bool, error) { req := NewRequestWithChatID[bool]("sendMessageDraft", params, params.ChatID) return req.DoWithContext(ctx, api) } // SendChatAction holds parameters for the sendChatAction method. // Since: Bot API 1.0 // See https://core.telegram.org/bots/api#sendchataction type SendChatAction struct { // BusinessConnectionID Optional. Unique identifier of the business connection on behalf of which the action // will be sent BusinessConnectionID string `json:"business_connection_id,omitempty"` // ChatID Required. Unique identifier for the target chat or username of the target bot or supergroup in the // format @username. Channel chats and channel direct messages chats aren't supported. ChatID int64 `json:"chat_id"` // MessageThreadID Optional. Unique identifier for the target message thread or topic of a forum; for // supergroups and private chats of bots with forum topic mode enabled only MessageThreadID int `json:"message_thread_id,omitempty"` // Action Required. Type of action to broadcast. Choose one, depending on what the user is about to receive: // typing for text messages, upload_photo for photos, record_video or upload_video for videos, record_voice // or upload_voice for voice notes, upload_document for general files, choose_sticker for stickers, // find_location for location data, record_video_note or upload_video_note for video notes. Action ChatActionType `json:"action"` } // SendChatAction sends a chat action (typing, uploading photo, etc.). // Since: Bot API 1.0 // Returns True on success. // See https://core.telegram.org/bots/api#sendchataction func (api *API) SendChatAction(params SendChatAction) (bool, error) { req := NewRequestWithChatID[bool]("sendChatAction", params, params.ChatID) return req.Do(api) } // SendChatActionWithContext is the context-aware variant of SendChatAction. // Since: Bot API 1.0 // It executes the same request but uses ctx for cancellation and deadlines. // See https://core.telegram.org/bots/api#sendchataction func (api *API) SendChatActionWithContext(ctx context.Context, params SendChatAction) (bool, error) { req := NewRequestWithChatID[bool]("sendChatAction", params, params.ChatID) return req.DoWithContext(ctx, api) } // SetMessageReaction holds parameters for the setMessageReaction method. // Since: Bot API 7.0 // See https://core.telegram.org/bots/api#setmessagereaction type SetMessageReaction struct { // 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"` // MessageID Required. Identifier of the target message. If the message belongs to a media group, the // reaction is set to the first non-deleted message in the group instead. MessageID int `json:"message_id"` // Reaction Optional. A JSON-serialized list of reaction types to set on the message. Currently, as // non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it // is either already present on the message or explicitly allowed by chat administrators. Paid reactions // can't be used by bots. Reaction []ReactionType `json:"reaction"` // IsBig Optional. Pass True to set the reaction with a big animation IsBig bool `json:"is_big,omitempty"` } // SetMessageReaction changes the chosen reaction on a message. // Since: Bot API 7.0 // Returns True on success. // See https://core.telegram.org/bots/api#setmessagereaction func (api *API) SetMessageReaction(params SetMessageReaction) (bool, error) { req := NewRequestWithChatID[bool]("setMessageReaction", params, params.ChatID) return req.Do(api) } // SetMessageReactionWithContext is the context-aware variant of SetMessageReaction. // Since: Bot API 7.0 // It executes the same request but uses ctx for cancellation and deadlines. // See https://core.telegram.org/bots/api#setmessagereaction func (api *API) SetMessageReactionWithContext(ctx context.Context, params SetMessageReaction) (bool, error) { req := NewRequestWithChatID[bool]("setMessageReaction", params, params.ChatID) return req.DoWithContext(ctx, api) } // EditMessageText holds parameters for the editMessageText method. // Since: Bot API 2.0 // See https://core.telegram.org/bots/api#editmessagetext type EditMessageText struct { // BusinessConnectionID Optional. Unique identifier of the business connection on behalf of which the // message to be edited was sent BusinessConnectionID string `json:"business_connection_id,omitempty"` // ChatID Optional. Required if inline_message_id is not specified. Unique identifier for the target chat or // username of the target bot, supergroup or channel in the format @username. ChatID int64 `json:"chat_id,omitempty"` // MessageID Optional. Required if inline_message_id is not specified. Identifier of the message to edit. MessageID int `json:"message_id,omitempty"` // InlineMessageID Optional. Required if chat_id and message_id are not specified. Identifier of the inline // message. InlineMessageID string `json:"inline_message_id,omitempty"` // Text Optional. New text of the message, 1-4096 characters after entity parsing; required if rich_message // isn't specified Text string `json:"text,omitempty"` // required unless RichMessage is set // ParseMode Optional. Mode for parsing entities in the message text. See formatting options for more // details. ParseMode ParseMode `json:"parse_mode,omitempty"` // Entities Optional. 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"` // LinkPreviewOptions Optional. Link preview generation options for the message LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options,omitempty"` // RichMessage contains structured rich-message content. RichMessage *InputRichMessage `json:"rich_message,omitempty"` // Since: Bot API 10.1; required if Text is not specified // ReplyMarkup Optional. A JSON-serialized object for an inline keyboard ReplyMarkup *ReplyMarkup `json:"reply_markup,omitempty"` } // EditMessageText edits text messages. // Since: Bot API 2.0 // If inline_message_id is provided, returns a boolean success flag; // otherwise returns the edited Message. // See https://core.telegram.org/bots/api#editmessagetext func (api *API) EditMessageText(params EditMessageText) (Message, bool, error) { var zero Message if params.InlineMessageID != "" { req := NewRequestWithChatID[bool]("editMessageText", params, params.ChatID) res, err := req.Do(api) return zero, res, err } req := NewRequestWithChatID[Message]("editMessageText", params, params.ChatID) res, err := req.Do(api) return res, false, err } // EditMessageTextWithContext is the context-aware variant of EditMessageText. // Since: Bot API 2.0 // It executes the same request but uses ctx for cancellation and deadlines. // See https://core.telegram.org/bots/api#editmessagetext func (api *API) EditMessageTextWithContext(ctx context.Context, params EditMessageText) (Message, bool, error) { var zero Message if params.InlineMessageID != "" { req := NewRequestWithChatID[bool]("editMessageText", params, params.ChatID) res, err := req.DoWithContext(ctx, api) return zero, res, err } req := NewRequestWithChatID[Message]("editMessageText", params, params.ChatID) res, err := req.DoWithContext(ctx, api) return res, false, err } // EditMessageCaption holds parameters for the editMessageCaption method. // Since: Bot API 2.0 // See https://core.telegram.org/bots/api#editmessagecaption type EditMessageCaption struct { // BusinessConnectionID Optional. Unique identifier of the business connection on behalf of which the // message to be edited was sent BusinessConnectionID string `json:"business_connection_id,omitempty"` // ChatID Optional. Required if inline_message_id is not specified. Unique identifier for the target chat or // username of the target bot, supergroup or channel in the format @username. ChatID int64 `json:"chat_id,omitempty"` // MessageID Optional. Required if inline_message_id is not specified. Identifier of the message to edit. MessageID int `json:"message_id,omitempty"` // InlineMessageID Optional. Required if chat_id and message_id are not specified. Identifier of the inline // message. InlineMessageID string `json:"inline_message_id,omitempty"` // Caption Optional. New caption of the message, 0-1024 characters after entities parsing Caption string `json:"caption"` // ParseMode Optional. Mode for parsing entities in the 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"` // ShowCaptionAboveMedia Optional. 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"` // ReplyMarkup Optional. A JSON-serialized object for an inline keyboard ReplyMarkup *ReplyMarkup `json:"reply_markup,omitempty"` } // EditMessageCaption edits captions of messages. // Since: Bot API 2.0 // If inline_message_id is provided, returns a boolean success flag; // otherwise returns the edited Message. // See https://core.telegram.org/bots/api#editmessagecaption func (api *API) EditMessageCaption(params EditMessageCaption) (Message, bool, error) { var zero Message if params.InlineMessageID != "" { req := NewRequestWithChatID[bool]("editMessageCaption", params, params.ChatID) res, err := req.Do(api) return zero, res, err } req := NewRequestWithChatID[Message]("editMessageCaption", params, params.ChatID) res, err := req.Do(api) return res, false, err } // EditMessageCaptionWithContext is the context-aware variant of EditMessageCaption. // Since: Bot API 2.0 // It executes the same request but uses ctx for cancellation and deadlines. // See https://core.telegram.org/bots/api#editmessagecaption func (api *API) EditMessageCaptionWithContext(ctx context.Context, params EditMessageCaption) (Message, bool, error) { var zero Message if params.InlineMessageID != "" { req := NewRequestWithChatID[bool]("editMessageCaption", params, params.ChatID) res, err := req.DoWithContext(ctx, api) return zero, res, err } req := NewRequestWithChatID[Message]("editMessageCaption", params, params.ChatID) res, err := req.DoWithContext(ctx, api) return res, false, err } // EditMessageMedia holds parameters for the editMessageMedia method. // Since: Bot API 4.0 // See https://core.telegram.org/bots/api#editmessagemedia type EditMessageMedia struct { // BusinessConnectionID Optional. Unique identifier of the business connection on behalf of which the // message to be edited was sent BusinessConnectionID string `json:"business_connection_id,omitempty"` // ChatID Optional. Required if inline_message_id is not specified. Unique identifier for the target chat or // username of the target bot, supergroup or channel in the format @username. ChatID int64 `json:"chat_id,omitempty"` // MessageID Optional. Required if inline_message_id is not specified. Identifier of the message to edit. MessageID int `json:"message_id,omitempty"` // InlineMessageID Optional. Required if chat_id and message_id are not specified. Identifier of the inline // message. InlineMessageID string `json:"inline_message_id,omitempty"` // Media Required. A JSON-serialized object for the new media content of the message Media InputMedia `json:"media"` // ReplyMarkup Optional. A JSON-serialized object for a new inline keyboard ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` } // EditMessageMedia edits media messages. // Since: Bot API 4.0 // If inline_message_id is provided, returns a boolean success flag; // otherwise returns the edited Message. // See https://core.telegram.org/bots/api#editmessagemedia func (api *API) EditMessageMedia(params EditMessageMedia) (Message, bool, error) { var zero Message if params.InlineMessageID != "" { req := NewRequestWithChatID[bool]("editMessageMedia", params, params.ChatID) res, err := req.Do(api) return zero, res, err } req := NewRequestWithChatID[Message]("editMessageMedia", params, params.ChatID) res, err := req.Do(api) return res, false, err } // EditMessageMediaWithContext is the context-aware variant of EditMessageMedia. // Since: Bot API 4.0 // It executes the same request but uses ctx for cancellation and deadlines. // See https://core.telegram.org/bots/api#editmessagemedia func (api *API) EditMessageMediaWithContext(ctx context.Context, params EditMessageMedia) (Message, bool, error) { var zero Message if params.InlineMessageID != "" { req := NewRequestWithChatID[bool]("editMessageMedia", params, params.ChatID) res, err := req.DoWithContext(ctx, api) return zero, res, err } req := NewRequestWithChatID[Message]("editMessageMedia", params, params.ChatID) res, err := req.DoWithContext(ctx, api) return res, false, err } // EditMessageLiveLocation holds parameters for the editMessageLiveLocation method. // Since: Bot API 3.4 // See https://core.telegram.org/bots/api#editmessagelivelocation type EditMessageLiveLocation struct { // BusinessConnectionID Optional. Unique identifier of the business connection on behalf of which the // message to be edited was sent BusinessConnectionID string `json:"business_connection_id,omitempty"` // ChatID Optional. Required if inline_message_id is not specified. Unique identifier for the target chat or // username of the target bot, supergroup or channel in the format @username. ChatID int64 `json:"chat_id,omitempty"` // MessageID Optional. Required if inline_message_id is not specified. Identifier of the message to edit. MessageID int `json:"message_id,omitempty"` // InlineMessageID Optional. Required if chat_id and message_id are not specified. Identifier of the inline // message. InlineMessageID string `json:"inline_message_id,omitempty"` // Latitude Required. Latitude of new location Latitude float64 `json:"latitude"` // Longitude Required. Longitude of new location Longitude float64 `json:"longitude"` // LivePeriod Optional. New period in seconds during which the location can be updated, starting from the // message send date. If 0x7FFFFFFF is specified, then the location can be updated forever. Otherwise, the // new value must not exceed the current live_period by more than a day, and the live location expiration // date must remain within the next 90 days. If not specified, then live_period remains unchanged. LivePeriod int `json:"live_period,omitempty"` // HorizontalAccuracy Optional. The radius of uncertainty for the location, measured in meters; 0-1500 HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"` // Heading Optional. Direction in which the user is moving, in degrees. Must be between 1 and 360 if // specified. Heading int `json:"heading,omitempty"` // ProximityAlertRadius Optional. The maximum distance for proximity alerts about approaching another chat // member, in meters. Must be between 1 and 100000 if specified. ProximityAlertRadius int `json:"proximity_alert_radius,omitempty"` // ReplyMarkup Optional. A JSON-serialized object for a new inline keyboard ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` } // EditMessageLiveLocation edits live location messages. // Since: Bot API 3.4 // If inline_message_id is provided, returns a boolean success flag; // otherwise returns the edited Message. // See https://core.telegram.org/bots/api#editmessagelivelocation func (api *API) EditMessageLiveLocation(params EditMessageLiveLocation) (Message, bool, error) { var zero Message if params.InlineMessageID != "" { req := NewRequestWithChatID[bool]("editMessageLiveLocation", params, params.ChatID) res, err := req.Do(api) return zero, res, err } req := NewRequestWithChatID[Message]("editMessageLiveLocation", params, params.ChatID) res, err := req.Do(api) return res, false, err } // EditMessageLiveLocationWithContext is the context-aware variant of EditMessageLiveLocation. // Since: Bot API 3.4 // It executes the same request but uses ctx for cancellation and deadlines. // See https://core.telegram.org/bots/api#editmessagelivelocation func (api *API) EditMessageLiveLocationWithContext(ctx context.Context, params EditMessageLiveLocation) (Message, bool, error) { var zero Message if params.InlineMessageID != "" { req := NewRequestWithChatID[bool]("editMessageLiveLocation", params, params.ChatID) res, err := req.DoWithContext(ctx, api) return zero, res, err } req := NewRequestWithChatID[Message]("editMessageLiveLocation", params, params.ChatID) res, err := req.DoWithContext(ctx, api) return res, false, err } // StopMessageLiveLocation holds parameters for the stopMessageLiveLocation method. // Since: Bot API 3.4 // See https://core.telegram.org/bots/api#stopmessagelivelocation type StopMessageLiveLocation struct { // BusinessConnectionID Optional. Unique identifier of the business connection on behalf of which the // message to be edited was sent BusinessConnectionID string `json:"business_connection_id,omitempty"` // ChatID Optional. Required if inline_message_id is not specified. Unique identifier for the target chat or // username of the target bot, supergroup or channel in the format @username. ChatID int64 `json:"chat_id,omitempty"` // MessageID Optional. Required if inline_message_id is not specified. Identifier of the message with live // location to stop. MessageID int `json:"message_id,omitempty"` // InlineMessageID Optional. Required if chat_id and message_id are not specified. Identifier of the inline // message. InlineMessageID string `json:"inline_message_id,omitempty"` // ReplyMarkup Optional. A JSON-serialized object for a new inline keyboard ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` } // StopMessageLiveLocation stops a live location message. // Since: Bot API 3.4 // If inline_message_id is provided, returns a boolean success flag; // otherwise returns the edited Message. // See https://core.telegram.org/bots/api#stopmessagelivelocation func (api *API) StopMessageLiveLocation(params StopMessageLiveLocation) (Message, bool, error) { var zero Message if params.InlineMessageID != "" { req := NewRequestWithChatID[bool]("stopMessageLiveLocation", params, params.ChatID) res, err := req.Do(api) return zero, res, err } req := NewRequestWithChatID[Message]("stopMessageLiveLocation", params, params.ChatID) res, err := req.Do(api) return res, false, err } // StopMessageLiveLocationWithContext is the context-aware variant of StopMessageLiveLocation. // Since: Bot API 3.4 // It executes the same request but uses ctx for cancellation and deadlines. // See https://core.telegram.org/bots/api#stopmessagelivelocation func (api *API) StopMessageLiveLocationWithContext(ctx context.Context, params StopMessageLiveLocation) (Message, bool, error) { var zero Message if params.InlineMessageID != "" { req := NewRequestWithChatID[bool]("stopMessageLiveLocation", params, params.ChatID) res, err := req.DoWithContext(ctx, api) return zero, res, err } req := NewRequestWithChatID[Message]("stopMessageLiveLocation", params, params.ChatID) res, err := req.DoWithContext(ctx, api) return res, false, err } // EditMessageChecklist holds parameters for the editMessageChecklist method. // Since: Bot API 9.1 // See https://core.telegram.org/bots/api#editmessagechecklist type EditMessageChecklist struct { // BusinessConnectionID Required. Unique identifier of the business connection on behalf of which the // message will be sent BusinessConnectionID string `json:"business_connection_id"` // ChatID Required. Unique identifier for the target chat or username of the target bot in the format // @username ChatID int64 `json:"chat_id"` // MessageID Required. Unique identifier for the target message MessageID int `json:"message_id"` // Checklist Required. A JSON-serialized object for the new checklist Checklist InputChecklist `json:"checklist"` // ReplyMarkup Optional. A JSON-serialized object for the new inline keyboard for the message ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` } // EditMessageChecklist edits a checklist message. // Since: Bot API 9.1 // See https://core.telegram.org/bots/api#editmessagechecklist func (api *API) EditMessageChecklist(params EditMessageChecklist) (Message, error) { req := NewRequestWithChatID[Message]("editMessageChecklist", params, params.ChatID) return req.Do(api) } // EditMessageChecklistWithContext is the context-aware variant of EditMessageChecklist. // Since: Bot API 9.1 // It executes the same request but uses ctx for cancellation and deadlines. // See https://core.telegram.org/bots/api#editmessagechecklist func (api *API) EditMessageChecklistWithContext(ctx context.Context, params EditMessageChecklist) (Message, error) { req := NewRequestWithChatID[Message]("editMessageChecklist", params, params.ChatID) return req.DoWithContext(ctx, api) } // EditMessageReplyMarkup holds parameters for the editMessageReplyMarkup method. // Since: Bot API 2.0 // See https://core.telegram.org/bots/api#editmessagereplymarkup type EditMessageReplyMarkup struct { // BusinessConnectionID Optional. Unique identifier of the business connection on behalf of which the // message to be edited was sent BusinessConnectionID string `json:"business_connection_id,omitempty"` // ChatID Optional. Required if inline_message_id is not specified. Unique identifier for the target chat or // username of the target bot, supergroup or channel in the format @username. ChatID int64 `json:"chat_id,omitempty"` // MessageID Optional. Required if inline_message_id is not specified. Identifier of the message to edit. MessageID int `json:"message_id,omitempty"` // InlineMessageID Optional. Required if chat_id and message_id are not specified. Identifier of the inline // message. InlineMessageID string `json:"inline_message_id,omitempty"` // ReplyMarkup Optional. A JSON-serialized object for an inline keyboard ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` } // EditMessageReplyMarkup edits only the reply markup of messages. // Since: Bot API 2.0 // If inline_message_id is provided, returns a boolean success flag; // otherwise returns the edited Message. // See https://core.telegram.org/bots/api#editmessagereplymarkup func (api *API) EditMessageReplyMarkup(params EditMessageReplyMarkup) (Message, bool, error) { var zero Message if params.InlineMessageID != "" { req := NewRequestWithChatID[bool]("editMessageReplyMarkup", params, params.ChatID) res, err := req.Do(api) return zero, res, err } req := NewRequestWithChatID[Message]("editMessageReplyMarkup", params, params.ChatID) res, err := req.Do(api) return res, false, err } // EditMessageReplyMarkupWithContext is the context-aware variant of EditMessageReplyMarkup. // Since: Bot API 2.0 // It executes the same request but uses ctx for cancellation and deadlines. // See https://core.telegram.org/bots/api#editmessagereplymarkup func (api *API) EditMessageReplyMarkupWithContext(ctx context.Context, params EditMessageReplyMarkup) (Message, bool, error) { var zero Message if params.InlineMessageID != "" { req := NewRequestWithChatID[bool]("editMessageReplyMarkup", params, params.ChatID) res, err := req.DoWithContext(ctx, api) return zero, res, err } req := NewRequestWithChatID[Message]("editMessageReplyMarkup", params, params.ChatID) res, err := req.DoWithContext(ctx, api) return res, false, err } // StopPoll holds parameters for the stopPoll method. // Since: Bot API 4.2 // See https://core.telegram.org/bots/api#stoppoll type StopPoll struct { // BusinessConnectionID Optional. Unique identifier of the business connection on behalf of which the // message to be edited was 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"` // MessageID Required. Identifier of the original message with the poll MessageID int `json:"message_id"` // ReplyMarkup Optional. A JSON-serialized object for a new message inline keyboard ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` } // StopPoll stops a poll that was sent by the bot. // Since: Bot API 4.2 // Returns the stopped Poll. // See https://core.telegram.org/bots/api#stoppoll func (api *API) StopPoll(params StopPoll) (Poll, error) { req := NewRequestWithChatID[Poll]("stopPoll", params, params.ChatID) return req.Do(api) } // StopPollWithContext is the context-aware variant of StopPoll. // Since: Bot API 4.2 // It executes the same request but uses ctx for cancellation and deadlines. // See https://core.telegram.org/bots/api#stoppoll func (api *API) StopPollWithContext(ctx context.Context, params StopPoll) (Poll, error) { req := NewRequestWithChatID[Poll]("stopPoll", params, params.ChatID) return req.DoWithContext(ctx, api) } // ApproveSuggestedPost holds parameters for the approveSuggestedPost method. // Since: Bot API 9.2 // See https://core.telegram.org/bots/api#approvesuggestedpost type ApproveSuggestedPost struct { // ChatID Required. Unique identifier for the target direct messages chat ChatID int64 `json:"chat_id"` // MessageID Required. Identifier of a suggested post message to approve MessageID int `json:"message_id"` // SendDate Optional. Point in time (Unix timestamp) when the post is expected to be published; omit if the // date has already been specified when the suggested post was created. If specified, then the date must be // not more than 2678400 seconds (30 days) in the future. SendDate int `json:"send_date,omitempty"` } // ApproveSuggestedPost approves a suggested channel post. // Since: Bot API 9.2 // Returns True on success. // See https://core.telegram.org/bots/api#approvesuggestedpost func (api *API) ApproveSuggestedPost(params ApproveSuggestedPost) (bool, error) { req := NewRequestWithChatID[bool]("approveSuggestedPost", params, params.ChatID) return req.Do(api) } // ApproveSuggestedPostWithContext is the context-aware variant of ApproveSuggestedPost. // Since: Bot API 9.2 // It executes the same request but uses ctx for cancellation and deadlines. // See https://core.telegram.org/bots/api#approvesuggestedpost func (api *API) ApproveSuggestedPostWithContext(ctx context.Context, params ApproveSuggestedPost) (bool, error) { req := NewRequestWithChatID[bool]("approveSuggestedPost", params, params.ChatID) return req.DoWithContext(ctx, api) } // DeclineSuggestedPost holds parameters for the declineSuggestedPost method. // Since: Bot API 9.2 // See https://core.telegram.org/bots/api#declinesuggestedpost type DeclineSuggestedPost struct { // ChatID Required. Unique identifier for the target direct messages chat ChatID int64 `json:"chat_id"` // MessageID Required. Identifier of a suggested post message to decline MessageID int `json:"message_id"` // Comment Optional. Comment for the creator of the suggested post; 0-128 characters Comment string `json:"comment,omitempty"` } // DeclineSuggestedPost declines a suggested channel post. // Since: Bot API 9.2 // Returns True on success. // See https://core.telegram.org/bots/api#declinesuggestedpost func (api *API) DeclineSuggestedPost(params DeclineSuggestedPost) (bool, error) { req := NewRequestWithChatID[bool]("declineSuggestedPost", params, params.ChatID) return req.Do(api) } // DeclineSuggestedPostWithContext is the context-aware variant of DeclineSuggestedPost. // Since: Bot API 9.2 // It executes the same request but uses ctx for cancellation and deadlines. // See https://core.telegram.org/bots/api#declinesuggestedpost func (api *API) DeclineSuggestedPostWithContext(ctx context.Context, params DeclineSuggestedPost) (bool, error) { req := NewRequestWithChatID[bool]("declineSuggestedPost", params, params.ChatID) return req.DoWithContext(ctx, api) } // DeleteMessage holds parameters for the deleteMessage method. // Since: Bot API 3.0 // See https://core.telegram.org/bots/api#deletemessage type DeleteMessage struct { // 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"` // MessageID Required. Identifier of the message to delete MessageID int `json:"message_id"` } // DeleteMessage deletes a message. // Since: Bot API 3.0 // Returns True on success. // See https://core.telegram.org/bots/api#deletemessage func (api *API) DeleteMessage(params DeleteMessage) (bool, error) { req := NewRequestWithChatID[bool]("deleteMessage", params, params.ChatID) return req.Do(api) } // DeleteMessageWithContext is the context-aware variant of DeleteMessage. // Since: Bot API 3.0 // It executes the same request but uses ctx for cancellation and deadlines. // See https://core.telegram.org/bots/api#deletemessage func (api *API) DeleteMessageWithContext(ctx context.Context, params DeleteMessage) (bool, error) { req := NewRequestWithChatID[bool]("deleteMessage", params, params.ChatID) return req.DoWithContext(ctx, api) } // DeleteMessages holds parameters for the deleteMessages method. // Since: Bot API 7.0 // See https://core.telegram.org/bots/api#deletemessages type DeleteMessages struct { // 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"` // MessageIDs Required. A JSON-serialized list of 1-100 identifiers of messages to delete. See deleteMessage // for limitations on which messages can be deleted. MessageIDs []int `json:"message_ids"` } // DeleteMessages deletes multiple messages at once. // Since: Bot API 7.0 // Returns True on success. // See https://core.telegram.org/bots/api#deletemessages func (api *API) DeleteMessages(params DeleteMessages) (bool, error) { req := NewRequestWithChatID[bool]("deleteMessages", params, params.ChatID) return req.Do(api) } // DeleteMessagesWithContext is the context-aware variant of DeleteMessages. // Since: Bot API 7.0 // It executes the same request but uses ctx for cancellation and deadlines. // See https://core.telegram.org/bots/api#deletemessages func (api *API) DeleteMessagesWithContext(ctx context.Context, params DeleteMessages) (bool, error) { req := NewRequestWithChatID[bool]("deleteMessages", params, params.ChatID) return req.DoWithContext(ctx, api) } // AnswerCallbackQuery holds parameters for the answerCallbackQuery method. // Since: Bot API 2.0 // See https://core.telegram.org/bots/api#answercallbackquery type AnswerCallbackQuery struct { // CallbackQueryID Required. Unique identifier for the query to be answered CallbackQueryID string `json:"callback_query_id"` // Text Optional. Text of the notification. If not specified, nothing will be shown to the user, 0-200 // characters. Text string `json:"text,omitempty"` // ShowAlert Optional. If True, an alert will be shown by the client instead of a notification at the top of // the chat screen. Defaults to False. ShowAlert bool `json:"show_alert,omitempty"` // URL Optional. 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"` // CacheTime Optional. 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. CacheTime int `json:"cache_time,omitempty"` } // AnswerCallbackQuery sends answers to callback queries sent from inline keyboards. // Since: Bot API 2.0 // Returns True on success. // See https://core.telegram.org/bots/api#answercallbackquery func (api *API) AnswerCallbackQuery(params AnswerCallbackQuery) (bool, error) { req := NewRequest[bool]("answerCallbackQuery", params) return req.Do(api) } // AnswerCallbackQueryWithContext is the context-aware variant of AnswerCallbackQuery. // Since: Bot API 2.0 // It executes the same request but uses ctx for cancellation and deadlines. // See https://core.telegram.org/bots/api#answercallbackquery func (api *API) AnswerCallbackQueryWithContext(ctx context.Context, params AnswerCallbackQuery) (bool, error) { req := NewRequest[bool]("answerCallbackQuery", params) return req.DoWithContext(ctx, api) } // AnswerGuestQuery holds parameters for the answerGuestQuery method. // Since: Bot API 10.0 // See https://core.telegram.org/bots/api#answerguestquery type AnswerGuestQuery struct { // GuestQueryID Required. Unique identifier for the query to be answered GuestQueryID string `json:"guest_query_id"` // Result Required. A JSON-serialized object describing the message to be sent Result InlineQueryResult `json:"result"` } // AnswerGuestQuery answers a guest query. // Since: Bot API 10.0 // See https://core.telegram.org/bots/api#answerguestquery func (api *API) AnswerGuestQuery(params AnswerGuestQuery) (SentGuestMessage, error) { req := NewRequest[SentGuestMessage]("answerGuestQuery", params) return req.Do(api) } // AnswerGuestQueryWithContext is the context-aware variant of AnswerGuestQuery. // Since: Bot API 10.0 // It executes the same request but uses ctx for cancellation and deadlines. // See https://core.telegram.org/bots/api#answerguestquery func (api *API) AnswerGuestQueryWithContext(ctx context.Context, params AnswerGuestQuery) (SentGuestMessage, error) { req := NewRequest[SentGuestMessage]("answerGuestQuery", params) return req.DoWithContext(ctx, api) } // DeleteAllMessageReactions holds parameters for the deleteAllMessageReactions method. // Since: Bot API 10.0 // See https://core.telegram.org/bots/api#deleteallmessagereactions type DeleteAllMessageReactions struct { // ChatID Required. Unique identifier for the target chat or username of the target supergroup in the format // @username ChatID int64 `json:"chat_id"` // UserID Optional. Identifier of the user whose reactions will be removed, if the reactions were added by a // user UserID int64 `json:"user_id,omitempty"` // ActorChatID Optional. Identifier of the chat whose reactions will be removed, if the reactions were added // by a chat ActorChatID int64 `json:"actor_chat_id,omitempty"` } // DeleteAllMessageReactions deletes all reactions on a message. // Since: Bot API 10.0 // Returns True on success. // See https://core.telegram.org/bots/api#deleteallmessagereactions func (api *API) DeleteAllMessageReactions(params DeleteAllMessageReactions) (bool, error) { req := NewRequest[bool]("deleteAllMessageReactions", params) return req.Do(api) } // DeleteAllMessageReactionWithContext is the context-aware variant of DeleteAllMessageReactions. // // Deprecated: use DeleteAllMessageReactionsWithContext. The misspelled alias is // retained for v1 compatibility and is subject to removal in v2. // Since: Bot API 10.0 // It executes the same request but uses ctx for cancellation and deadlines. // See https://core.telegram.org/bots/api#deleteallmessagereactions func (api *API) DeleteAllMessageReactionWithContext(ctx context.Context, params DeleteAllMessageReactions) (bool, error) { return api.DeleteAllMessageReactionsWithContext(ctx, params) } // DeleteAllMessageReactionsWithContext is the context-aware variant of DeleteAllMessageReactions. // Since: Bot API 10.0 // It executes the same request but uses ctx for cancellation and deadlines. // See https://core.telegram.org/bots/api#deleteallmessagereactions func (api *API) DeleteAllMessageReactionsWithContext(ctx context.Context, params DeleteAllMessageReactions) (bool, error) { req := NewRequest[bool]("deleteAllMessageReactions", params) return req.DoWithContext(ctx, api) } // DeleteMessageReaction holds parameters for the deleteMessageReaction method. // Since: Bot API 10.0 // See https://core.telegram.org/bots/api#deletemessagereaction type DeleteMessageReaction struct { // ChatID Required. Unique identifier for the target chat or username of the target supergroup in the format // @username ChatID int64 `json:"chat_id"` // MessageID Required. Identifier of the target message MessageID int `json:"message_id"` // UserID Optional. Identifier of the user whose reaction will be removed, if the reaction was added by a // user UserID int64 `json:"user_id,omitempty"` // ActorChatID Optional. Identifier of the chat whose reaction will be removed, if the reaction was added by // a chat ActorChatID int64 `json:"actor_chat_id,omitempty"` } // DeleteMessageReaction deletes a reaction on a message. // Since: Bot API 10.0 // Returns True on success. // See https://core.telegram.org/bots/api#deletemessagereaction func (api *API) DeleteMessageReaction(params DeleteMessageReaction) (bool, error) { req := NewRequest[bool]("deleteMessageReaction", params) return req.Do(api) } // DeleteMessageReactionWithContext is the context-aware variant of DeleteMessageReaction. // Since: Bot API 10.0 // It executes the same request but uses ctx for cancellation and deadlines. // See https://core.telegram.org/bots/api#deletemessagereaction func (api *API) DeleteMessageReactionWithContext(ctx context.Context, params DeleteMessageReaction) (bool, error) { req := NewRequest[bool]("deleteMessageReaction", params) return req.DoWithContext(ctx, api) } // SendRichMessage holds parameters for the sendRichMessage method. // Since: Bot API 10.1 // See https://core.telegram.org/bots/api#sendrichmessage type SendRichMessage struct { // BusinessConnectionID identifies the business connection used to send the message. BusinessConnectionID string `json:"business_connection_id,omitempty"` // ChatID identifies the target chat. ChatID int64 `json:"chat_id"` // MessageThreadID identifies the target message thread. MessageThreadID int64 `json:"message_thread_id,omitempty"` // DirectMessagesTopicID identifies the target direct-messages topic. DirectMessagesTopicID int64 `json:"direct_messages_topic_id,omitempty"` // RichMessage contains structured rich-message content. RichMessage InputRichMessage `json:"rich_message"` // DisableNotification requests delivery without a notification sound. DisableNotification bool `json:"disable_notification,omitempty"` // ProtectContent prevents forwarding and saving the sent content. ProtectContent bool `json:"protect_content,omitempty"` // AllowPaidBroadcast permits high-throughput delivery using paid broadcast capacity. AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"` // MessageEffectID identifies the message effect to apply. MessageEffectID string `json:"message_effect_id,omitempty"` // SuggestedPostParameters contains parameters for a suggested channel post. SuggestedPostParameters *SuggestedPostParameters `json:"suggested_post_parameters,omitempty"` // ReplyParameters describes the message being replied to. ReplyParameters *ReplyParameters `json:"reply_parameters,omitempty"` // ReplyMarkup defines the message's inline keyboard. ReplyMarkup *ReplyMarkup `json:"reply_markup,omitempty"` } // SendRichMessage sends a rich formatted message. // Since: Bot API 10.1 // See https://core.telegram.org/bots/api#sendrichmessage func (api *API) SendRichMessage(params SendRichMessage) (Message, error) { req := NewRequestWithChatID[Message]("sendRichMessage", params, params.ChatID) return req.Do(api) } // SendRichMessageWithContext is the context-aware variant of SendRichMessage. // Since: Bot API 10.1 // It executes the same request but uses ctx for cancellation and deadlines. // See https://core.telegram.org/bots/api#sendrichmessage func (api *API) SendRichMessageWithContext(ctx context.Context, params SendRichMessage) (Message, error) { req := NewRequestWithChatID[Message]("sendRichMessage", params, params.ChatID) return req.DoWithContext(ctx, api) } // SendRichMessageDraft holds parameters for the sendRichMessageDraft method. // Since: Bot API 10.1 // See https://core.telegram.org/bots/api#sendrichmessagedraft type SendRichMessageDraft struct { // ChatID identifies the target chat. ChatID int64 `json:"chat_id"` // MessageThreadID identifies the target message thread. MessageThreadID int64 `json:"message_thread_id,omitempty"` // DraftID must be non-zero; changes to drafts with the same identifier are animated. DraftID int64 `json:"draft_id"` // RichMessage contains structured rich-message content. RichMessage InputRichMessage `json:"rich_message"` } // SendRichMessageDraft streams a partial rich message to a private chat while // the message is being generated. The draft is an ephemeral ~30-second // preview; call SendRichMessage with the complete message to persist it. // Since: Bot API 10.1 // Returns True on success. // See https://core.telegram.org/bots/api#sendrichmessagedraft func (api *API) SendRichMessageDraft(params SendRichMessageDraft) (bool, error) { req := NewRequestWithChatID[bool]("sendRichMessageDraft", params, params.ChatID) return req.Do(api) } // SendRichMessageDraftWithContext is the context-aware variant of SendRichMessageDraft. // Since: Bot API 10.1 // It executes the same request but uses ctx for cancellation and deadlines. // See https://core.telegram.org/bots/api#sendrichmessagedraft func (api *API) SendRichMessageDraftWithContext(ctx context.Context, params SendRichMessageDraft) (bool, error) { req := NewRequestWithChatID[bool]("sendRichMessageDraft", params, params.ChatID) return req.DoWithContext(ctx, api) } // EditEphemeralMessageText holds parameters for editing an ephemeral text message. // // Since: Bot API 10.2 type EditEphemeralMessageText struct { // ChatID identifies the target chat. ChatID int64 `json:"chat_id"` // ReceiverUserID identifies the user who can see the ephemeral message. ReceiverUserID int64 `json:"receiver_user_id"` // EphemeralMessageID identifies the ephemeral message. EphemeralMessageID int64 `json:"ephemeral_message_id"` // Text contains the formatted or plain text content. Text string `json:"text"` // ParseMode selects the formatting syntax used by the text or caption. ParseMode ParseMode `json:"parse_mode,omitempty"` // Entities describes explicit formatting entities in Text. Entities []MessageEntity `json:"entities,omitempty"` // LinkPreviewOptions controls link preview generation for Text. LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options,omitempty"` // ReplyMarkup defines the message's inline keyboard. ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` } // EditEphemeralMessageText edits an ephemeral text message. // // Since: Bot API 10.2 func (api *API) EditEphemeralMessageText(params EditEphemeralMessageText) (bool, error) { req := NewRequestWithChatID[bool]("editEphemeralMessageText", params, params.ChatID) return req.Do(api) } // EditEphemeralMessageTextWithContext is the context-aware variant of EditEphemeralMessageText. // // Since: Bot API 10.2 func (api *API) EditEphemeralMessageTextWithContext(ctx context.Context, params EditEphemeralMessageText) (bool, error) { req := NewRequestWithChatID[bool]("editEphemeralMessageText", params, params.ChatID) return req.DoWithContext(ctx, api) } // EditEphemeralMessageMedia holds parameters for editing ephemeral message media. // New files cannot be uploaded; use a file ID or URL. // // Since: Bot API 10.2 type EditEphemeralMessageMedia struct { // ChatID identifies the target chat. ChatID int64 `json:"chat_id"` // ReceiverUserID identifies the user who can see the ephemeral message. ReceiverUserID int64 `json:"receiver_user_id"` // EphemeralMessageID identifies the ephemeral message. EphemeralMessageID int64 `json:"ephemeral_message_id"` // Media contains or identifies media associated with the value. Media InputMedia `json:"media"` // ReplyMarkup defines the message's inline keyboard. ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` } // EditEphemeralMessageMedia edits the media of an ephemeral message. // // Since: Bot API 10.2 func (api *API) EditEphemeralMessageMedia(params EditEphemeralMessageMedia) (bool, error) { req := NewRequestWithChatID[bool]("editEphemeralMessageMedia", params, params.ChatID) return req.Do(api) } // EditEphemeralMessageMediaWithContext is the context-aware variant of EditEphemeralMessageMedia. // // Since: Bot API 10.2 func (api *API) EditEphemeralMessageMediaWithContext(ctx context.Context, params EditEphemeralMessageMedia) (bool, error) { req := NewRequestWithChatID[bool]("editEphemeralMessageMedia", params, params.ChatID) return req.DoWithContext(ctx, api) } // EditEphemeralMessageCaption holds parameters for editing an ephemeral message caption. // // Since: Bot API 10.2 type EditEphemeralMessageCaption struct { // ChatID identifies the target chat. ChatID int64 `json:"chat_id"` // ReceiverUserID identifies the user who can see the ephemeral message. ReceiverUserID int64 `json:"receiver_user_id"` // EphemeralMessageID identifies the ephemeral message. EphemeralMessageID int64 `json:"ephemeral_message_id"` // Caption contains the media or block caption. Caption string `json:"caption,omitempty"` // ParseMode selects the formatting syntax used by the text or caption. ParseMode ParseMode `json:"parse_mode,omitempty"` // CaptionEntities describes formatting entities in Caption. CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` // ReplyMarkup defines the message's inline keyboard. ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` } // EditEphemeralMessageCaption edits an ephemeral message caption. // // Since: Bot API 10.2 func (api *API) EditEphemeralMessageCaption(params EditEphemeralMessageCaption) (bool, error) { req := NewRequestWithChatID[bool]("editEphemeralMessageCaption", params, params.ChatID) return req.Do(api) } // EditEphemeralMessageCaptionWithContext is the context-aware variant of EditEphemeralMessageCaption. // // Since: Bot API 10.2 func (api *API) EditEphemeralMessageCaptionWithContext(ctx context.Context, params EditEphemeralMessageCaption) (bool, error) { req := NewRequestWithChatID[bool]("editEphemeralMessageCaption", params, params.ChatID) return req.DoWithContext(ctx, api) } // EditEphemeralMessageReplyMarkup holds parameters for editing an ephemeral message's inline keyboard. // // Since: Bot API 10.2 type EditEphemeralMessageReplyMarkup struct { // ChatID identifies the target chat. ChatID int64 `json:"chat_id"` // ReceiverUserID identifies the user who can see the ephemeral message. ReceiverUserID int64 `json:"receiver_user_id"` // EphemeralMessageID identifies the ephemeral message. EphemeralMessageID int64 `json:"ephemeral_message_id"` // ReplyMarkup defines the message's inline keyboard. ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` } // EditEphemeralMessageReplyMarkup edits an ephemeral message's inline keyboard. // // Since: Bot API 10.2 func (api *API) EditEphemeralMessageReplyMarkup(params EditEphemeralMessageReplyMarkup) (bool, error) { req := NewRequestWithChatID[bool]("editEphemeralMessageReplyMarkup", params, params.ChatID) return req.Do(api) } // EditEphemeralMessageReplyMarkupWithContext is the context-aware variant of EditEphemeralMessageReplyMarkup. // // Since: Bot API 10.2 func (api *API) EditEphemeralMessageReplyMarkupWithContext(ctx context.Context, params EditEphemeralMessageReplyMarkup) (bool, error) { req := NewRequestWithChatID[bool]("editEphemeralMessageReplyMarkup", params, params.ChatID) return req.DoWithContext(ctx, api) } // DeleteEphemeralMessage holds parameters for deleting an ephemeral message. // // Since: Bot API 10.2 type DeleteEphemeralMessage struct { // ChatID identifies the target chat. ChatID int64 `json:"chat_id"` // ReceiverUserID identifies the user who can see the ephemeral message. ReceiverUserID int64 `json:"receiver_user_id"` // EphemeralMessageID identifies the ephemeral message. EphemeralMessageID int64 `json:"ephemeral_message_id"` } // DeleteEphemeralMessage deletes an ephemeral message. // // Since: Bot API 10.2 func (api *API) DeleteEphemeralMessage(params DeleteEphemeralMessage) (bool, error) { req := NewRequestWithChatID[bool]("deleteEphemeralMessage", params, params.ChatID) return req.Do(api) } // DeleteEphemeralMessageWithContext is the context-aware variant of DeleteEphemeralMessage. // // Since: Bot API 10.2 func (api *API) DeleteEphemeralMessageWithContext(ctx context.Context, params DeleteEphemeralMessage) (bool, error) { req := NewRequestWithChatID[bool]("deleteEphemeralMessage", params, params.ChatID) return req.DoWithContext(ctx, api) }