(new): Bot API 10.0
Golang lint / lint (push) Successful in 2m53s
Golang lint / lint (pull_request) Successful in 2m54s

(doc): Since: Bot API X.Y annotations across all tgapi types and methods
This commit is contained in:
2026-05-19 13:42:10 +03:00
parent affb802a7b
commit 1e26d871b5
29 changed files with 1347 additions and 242 deletions
+102
View File
@@ -3,6 +3,7 @@ package tgapi
import "context"
// SetMyCommands holds parameters for the setMyCommands method.
// Since: Bot API 4.7
// See https://core.telegram.org/bots/api#setmycommands
type SetMyCommands struct {
Commands []BotCommand `json:"commands"`
@@ -11,6 +12,7 @@ type SetMyCommands struct {
}
// SetMyCommands changes the list of the bot's commands.
// Since: Bot API 4.7
// Returns true on success.
// See https://core.telegram.org/bots/api#setmycommands
func (api *API) SetMyCommands(params SetMyCommands) (bool, error) {
@@ -19,6 +21,7 @@ func (api *API) SetMyCommands(params SetMyCommands) (bool, error) {
}
// SetMyCommandsWithContext is the context-aware variant of SetMyCommands.
// Since: Bot API 4.7
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#setmycommands
func (api *API) SetMyCommandsWithContext(ctx context.Context, params SetMyCommands) (bool, error) {
@@ -27,6 +30,7 @@ func (api *API) SetMyCommandsWithContext(ctx context.Context, params SetMyComman
}
// DeleteMyCommands holds parameters for the deleteMyCommands method.
// Since: Bot API 5.3
// See https://core.telegram.org/bots/api#deletemycommands
type DeleteMyCommands struct {
Scope *BotCommandScope `json:"scope,omitempty"`
@@ -34,6 +38,7 @@ type DeleteMyCommands struct {
}
// DeleteMyCommands deletes the list of the bot's commands for the given scope and user language.
// Since: Bot API 5.3
// Returns true on success.
// See https://core.telegram.org/bots/api#deletemycommands
func (api *API) DeleteMyCommands(params DeleteMyCommands) (bool, error) {
@@ -42,6 +47,7 @@ func (api *API) DeleteMyCommands(params DeleteMyCommands) (bool, error) {
}
// DeleteMyCommandsWithContext is the context-aware variant of DeleteMyCommands.
// Since: Bot API 5.3
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#deletemycommands
func (api *API) DeleteMyCommandsWithContext(ctx context.Context, params DeleteMyCommands) (bool, error) {
@@ -50,6 +56,7 @@ func (api *API) DeleteMyCommandsWithContext(ctx context.Context, params DeleteMy
}
// GetMyCommands holds parameters for the getMyCommands method.
// Since: Bot API 4.7
// See https://core.telegram.org/bots/api#getmycommands
type GetMyCommands struct {
Scope *BotCommandScope `json:"scope,omitempty"`
@@ -57,6 +64,7 @@ type GetMyCommands struct {
}
// GetMyCommands returns the current list of the bot's commands for the given scope and user language.
// Since: Bot API 4.7
// See https://core.telegram.org/bots/api#getmycommands
func (api *API) GetMyCommands(params GetMyCommands) ([]BotCommand, error) {
req := NewRequest[[]BotCommand]("getMyCommands", params)
@@ -64,6 +72,7 @@ func (api *API) GetMyCommands(params GetMyCommands) ([]BotCommand, error) {
}
// GetMyCommandsWithContext is the context-aware variant of GetMyCommands.
// Since: Bot API 4.7
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#getmycommands
func (api *API) GetMyCommandsWithContext(ctx context.Context, params GetMyCommands) ([]BotCommand, error) {
@@ -72,6 +81,7 @@ func (api *API) GetMyCommandsWithContext(ctx context.Context, params GetMyComman
}
// SetMyName holds parameters for the setMyName method.
// Since: Bot API 6.7
// See https://core.telegram.org/bots/api#setmyname
type SetMyName struct {
Name string `json:"name"`
@@ -79,6 +89,7 @@ type SetMyName struct {
}
// SetMyName changes the bot's name.
// Since: Bot API 6.7
// Returns true on success.
// See https://core.telegram.org/bots/api#setmyname
func (api *API) SetMyName(params SetMyName) (bool, error) {
@@ -87,6 +98,7 @@ func (api *API) SetMyName(params SetMyName) (bool, error) {
}
// SetMyNameWithContext is the context-aware variant of SetMyName.
// Since: Bot API 6.7
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#setmyname
func (api *API) SetMyNameWithContext(ctx context.Context, params SetMyName) (bool, error) {
@@ -95,12 +107,14 @@ func (api *API) SetMyNameWithContext(ctx context.Context, params SetMyName) (boo
}
// GetMyName holds parameters for the getMyName method.
// Since: Bot API 6.7
// See https://core.telegram.org/bots/api#getmyname
type GetMyName struct {
Language string `json:"language_code,omitempty"`
}
// GetMyName returns the bot's name for the given language.
// Since: Bot API 6.7
// See https://core.telegram.org/bots/api#getmyname
func (api *API) GetMyName(params GetMyName) (BotName, error) {
req := NewRequest[BotName]("getMyName", params)
@@ -108,6 +122,7 @@ func (api *API) GetMyName(params GetMyName) (BotName, error) {
}
// GetMyNameWithContext is the context-aware variant of GetMyName.
// Since: Bot API 6.7
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#getmyname
func (api *API) GetMyNameWithContext(ctx context.Context, params GetMyName) (BotName, error) {
@@ -116,6 +131,7 @@ func (api *API) GetMyNameWithContext(ctx context.Context, params GetMyName) (Bot
}
// SetMyDescription holds parameters for the setMyDescription method.
// Since: Bot API 6.6
// See https://core.telegram.org/bots/api#setmydescription
type SetMyDescription struct {
Description string `json:"description"`
@@ -123,6 +139,7 @@ type SetMyDescription struct {
}
// SetMyDescription changes the bot's description.
// Since: Bot API 6.6
// Returns true on success.
// See https://core.telegram.org/bots/api#setmydescription
func (api *API) SetMyDescription(params SetMyDescription) (bool, error) {
@@ -131,6 +148,7 @@ func (api *API) SetMyDescription(params SetMyDescription) (bool, error) {
}
// SetMyDescriptionWithContext is the context-aware variant of SetMyDescription.
// Since: Bot API 6.6
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#setmydescription
func (api *API) SetMyDescriptionWithContext(ctx context.Context, params SetMyDescription) (bool, error) {
@@ -139,12 +157,14 @@ func (api *API) SetMyDescriptionWithContext(ctx context.Context, params SetMyDes
}
// GetMyDescription holds parameters for the getMyDescription method.
// Since: Bot API 6.6
// See https://core.telegram.org/bots/api#getmydescription
type GetMyDescription struct {
Language string `json:"language_code,omitempty"`
}
// GetMyDescription returns the bot's description for the given language.
// Since: Bot API 6.6
// See https://core.telegram.org/bots/api#getmydescription
func (api *API) GetMyDescription(params GetMyDescription) (BotDescription, error) {
req := NewRequest[BotDescription]("getMyDescription", params)
@@ -152,6 +172,7 @@ func (api *API) GetMyDescription(params GetMyDescription) (BotDescription, error
}
// GetMyDescriptionWithContext is the context-aware variant of GetMyDescription.
// Since: Bot API 6.6
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#getmydescription
func (api *API) GetMyDescriptionWithContext(ctx context.Context, params GetMyDescription) (BotDescription, error) {
@@ -160,6 +181,7 @@ func (api *API) GetMyDescriptionWithContext(ctx context.Context, params GetMyDes
}
// SetMyShortDescription holds parameters for the setMyShortDescription method.
// Since: Bot API 6.6
// See https://core.telegram.org/bots/api#setmyshortdescription
type SetMyShortDescription struct {
ShortDescription string `json:"short_description,omitempty"`
@@ -167,6 +189,7 @@ type SetMyShortDescription struct {
}
// SetMyShortDescription changes the bot's short description.
// Since: Bot API 6.6
// Returns true on success.
// See https://core.telegram.org/bots/api#setmyshortdescription
func (api *API) SetMyShortDescription(params SetMyShortDescription) (bool, error) {
@@ -175,6 +198,7 @@ func (api *API) SetMyShortDescription(params SetMyShortDescription) (bool, error
}
// SetMyShortDescriptionWithContext is the context-aware variant of SetMyShortDescription.
// Since: Bot API 6.6
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#setmyshortdescription
func (api *API) SetMyShortDescriptionWithContext(ctx context.Context, params SetMyShortDescription) (bool, error) {
@@ -183,12 +207,14 @@ func (api *API) SetMyShortDescriptionWithContext(ctx context.Context, params Set
}
// GetMyShortDescription holds parameters for the getMyShortDescription method.
// Since: Bot API 6.6
// See https://core.telegram.org/bots/api#getmyshortdescription
type GetMyShortDescription struct {
Language string `json:"language_code,omitempty"`
}
// GetMyShortDescription returns the bot's short description for the given language.
// Since: Bot API 6.6
// See https://core.telegram.org/bots/api#getmyshortdescription
func (api *API) GetMyShortDescription(params GetMyShortDescription) (BotShortDescription, error) {
req := NewRequest[BotShortDescription]("getMyShortDescription", params)
@@ -196,6 +222,7 @@ func (api *API) GetMyShortDescription(params GetMyShortDescription) (BotShortDes
}
// GetMyShortDescriptionWithContext is the context-aware variant of GetMyShortDescription.
// Since: Bot API 6.6
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#getmyshortdescription
func (api *API) GetMyShortDescriptionWithContext(ctx context.Context, params GetMyShortDescription) (BotShortDescription, error) {
@@ -204,12 +231,14 @@ func (api *API) GetMyShortDescriptionWithContext(ctx context.Context, params Get
}
// SetMyProfilePhoto holds parameters for the setMyProfilePhoto method.
// Since: Bot API 9.0
// See https://core.telegram.org/bots/api#setmyprofilephoto
type SetMyProfilePhoto struct {
Photo InputProfilePhoto `json:"photo"`
}
// SetMyProfilePhoto changes the bot's profile photo.
// Since: Bot API 9.0
// Returns true on success.
// See https://core.telegram.org/bots/api#setmyprofilephoto
func (api *API) SetMyProfilePhoto(params SetMyProfilePhoto) (bool, error) {
@@ -218,6 +247,7 @@ func (api *API) SetMyProfilePhoto(params SetMyProfilePhoto) (bool, error) {
}
// SetMyProfilePhotoWithContext is the context-aware variant of SetMyProfilePhoto.
// Since: Bot API 9.0
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#setmyprofilephoto
func (api *API) SetMyProfilePhotoWithContext(ctx context.Context, params SetMyProfilePhoto) (bool, error) {
@@ -226,6 +256,7 @@ func (api *API) SetMyProfilePhotoWithContext(ctx context.Context, params SetMyPr
}
// RemoveMyProfilePhoto removes the bot's profile photo.
// Since: Bot API 9.0
// Returns true on success.
// See https://core.telegram.org/bots/api#removemyprofilephoto
func (api *API) RemoveMyProfilePhoto() (bool, error) {
@@ -234,6 +265,7 @@ func (api *API) RemoveMyProfilePhoto() (bool, error) {
}
// RemoveMyProfilePhotoWithContext is the context-aware variant of RemoveMyProfilePhoto.
// Since: Bot API 9.0
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#removemyprofilephoto
func (api *API) RemoveMyProfilePhotoWithContext(ctx context.Context) (bool, error) {
@@ -242,6 +274,7 @@ func (api *API) RemoveMyProfilePhotoWithContext(ctx context.Context) (bool, erro
}
// SetChatMenuButton holds parameters for the setChatMenuButton method.
// Since: Bot API 6.0
// See https://core.telegram.org/bots/api#setchatmenubutton
type SetChatMenuButton struct {
ChatID int64 `json:"chat_id,omitempty"`
@@ -249,6 +282,7 @@ type SetChatMenuButton struct {
}
// SetChatMenuButton changes the menu button for a given chat or the default menu button.
// Since: Bot API 6.0
// Returns true on success.
// See https://core.telegram.org/bots/api#setchatmenubutton
func (api *API) SetChatMenuButton(params SetChatMenuButton) (bool, error) {
@@ -257,6 +291,7 @@ func (api *API) SetChatMenuButton(params SetChatMenuButton) (bool, error) {
}
// SetChatMenuButtonWithContext is the context-aware variant of SetChatMenuButton.
// Since: Bot API 6.0
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#setchatmenubutton
func (api *API) SetChatMenuButtonWithContext(ctx context.Context, params SetChatMenuButton) (bool, error) {
@@ -265,12 +300,14 @@ func (api *API) SetChatMenuButtonWithContext(ctx context.Context, params SetChat
}
// GetChatMenuButton holds parameters for the getChatMenuButton method.
// Since: Bot API 6.0
// See https://core.telegram.org/bots/api#getchatmenubutton
type GetChatMenuButton struct {
ChatID int64 `json:"chat_id,omitempty"`
}
// GetChatMenuButton returns the current menu button for the given chat.
// Since: Bot API 6.0
// See https://core.telegram.org/bots/api#getchatmenubutton
func (api *API) GetChatMenuButton(params GetChatMenuButton) (MenuButton, error) {
req := NewRequest[MenuButton]("getChatMenuButton", params)
@@ -278,6 +315,7 @@ func (api *API) GetChatMenuButton(params GetChatMenuButton) (MenuButton, error)
}
// GetChatMenuButtonWithContext is the context-aware variant of GetChatMenuButton.
// Since: Bot API 6.0
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#getchatmenubutton
func (api *API) GetChatMenuButtonWithContext(ctx context.Context, params GetChatMenuButton) (MenuButton, error) {
@@ -286,6 +324,7 @@ func (api *API) GetChatMenuButtonWithContext(ctx context.Context, params GetChat
}
// SetMyDefaultAdministratorRights holds parameters for the setMyDefaultAdministratorRights method.
// Since: Bot API 6.0
// See https://core.telegram.org/bots/api#setmydefaultadministratorrights
type SetMyDefaultAdministratorRights struct {
Rights *ChatAdministratorRights `json:"rights"`
@@ -293,6 +332,7 @@ type SetMyDefaultAdministratorRights struct {
}
// SetMyDefaultAdministratorRights changes the default administrator rights for the bot.
// Since: Bot API 6.0
// Returns true on success.
// See https://core.telegram.org/bots/api#setmydefaultadministratorrights
func (api *API) SetMyDefaultAdministratorRights(params SetMyDefaultAdministratorRights) (bool, error) {
@@ -301,6 +341,7 @@ func (api *API) SetMyDefaultAdministratorRights(params SetMyDefaultAdministrator
}
// SetMyDefaultAdministratorRightsWithContext is the context-aware variant of SetMyDefaultAdministratorRights.
// Since: Bot API 6.0
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#setmydefaultadministratorrights
func (api *API) SetMyDefaultAdministratorRightsWithContext(ctx context.Context, params SetMyDefaultAdministratorRights) (bool, error) {
@@ -309,12 +350,14 @@ func (api *API) SetMyDefaultAdministratorRightsWithContext(ctx context.Context,
}
// GetMyDefaultAdministratorRights holds parameters for the getMyDefaultAdministratorRights method.
// Since: Bot API 6.0
// See https://core.telegram.org/bots/api#getmydefaultadministratorrights
type GetMyDefaultAdministratorRights struct {
ForChannels bool `json:"for_channels"`
}
// GetMyDefaultAdministratorRights returns the current default administrator rights for the bot.
// Since: Bot API 6.0
// See https://core.telegram.org/bots/api#getmydefaultadministratorrights
func (api *API) GetMyDefaultAdministratorRights(params GetMyDefaultAdministratorRights) (ChatAdministratorRights, error) {
req := NewRequest[ChatAdministratorRights]("getMyDefaultAdministratorRights", params)
@@ -322,6 +365,7 @@ func (api *API) GetMyDefaultAdministratorRights(params GetMyDefaultAdministrator
}
// GetMyDefaultAdministratorRightsWithContext is the context-aware variant of GetMyDefaultAdministratorRights.
// Since: Bot API 6.0
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#getmydefaultadministratorrights
func (api *API) GetMyDefaultAdministratorRightsWithContext(ctx context.Context, params GetMyDefaultAdministratorRights) (ChatAdministratorRights, error) {
@@ -330,6 +374,7 @@ func (api *API) GetMyDefaultAdministratorRightsWithContext(ctx context.Context,
}
// GetAvailableGifts returns the list of gifts that can be sent by the bot.
// Since: Bot API 9.0
// See https://core.telegram.org/bots/api#getavailablegifts
func (api *API) GetAvailableGifts() (Gifts, error) {
req := NewRequest[Gifts]("getAvailableGifts", NoParams)
@@ -337,6 +382,7 @@ func (api *API) GetAvailableGifts() (Gifts, error) {
}
// GetAvailableGiftsWithContext is the context-aware variant of GetAvailableGifts.
// Since: Bot API 9.0
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#getavailablegifts
func (api *API) GetAvailableGiftsWithContext(ctx context.Context) (Gifts, error) {
@@ -345,6 +391,7 @@ func (api *API) GetAvailableGiftsWithContext(ctx context.Context) (Gifts, error)
}
// SendGift holds parameters for the sendGift method.
// Since: Bot API 9.0
// See https://core.telegram.org/bots/api#sendgift
type SendGift struct {
UserID int64 `json:"user_id,omitempty"`
@@ -357,6 +404,7 @@ type SendGift struct {
}
// SendGift sends a gift to the given user or chat.
// Since: Bot API 9.0
// Returns true on success.
// See https://core.telegram.org/bots/api#sendgift
func (api *API) SendGift(params SendGift) (bool, error) {
@@ -365,6 +413,7 @@ func (api *API) SendGift(params SendGift) (bool, error) {
}
// SendGiftWithContext is the context-aware variant of SendGift.
// Since: Bot API 9.0
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#sendgift
func (api *API) SendGiftWithContext(ctx context.Context, params SendGift) (bool, error) {
@@ -373,6 +422,7 @@ func (api *API) SendGiftWithContext(ctx context.Context, params SendGift) (bool,
}
// GiftPremiumSubscription holds parameters for the giftPremiumSubscription method.
// Since: Bot API 9.0
// See https://core.telegram.org/bots/api#giftpremiumsubscription
type GiftPremiumSubscription struct {
UserID int64 `json:"user_id"`
@@ -384,6 +434,7 @@ type GiftPremiumSubscription struct {
}
// GiftPremiumSubscription gifts a Telegram Premium subscription to the user.
// Since: Bot API 9.0
// Returns true on success.
// See https://core.telegram.org/bots/api#giftpremiumsubscription
func (api *API) GiftPremiumSubscription(params GiftPremiumSubscription) (bool, error) {
@@ -392,9 +443,60 @@ func (api *API) GiftPremiumSubscription(params GiftPremiumSubscription) (bool, e
}
// GiftPremiumSubscriptionWithContext is the context-aware variant of GiftPremiumSubscription.
// Since: Bot API 9.0
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#giftpremiumsubscription
func (api *API) GiftPremiumSubscriptionWithContext(ctx context.Context, params GiftPremiumSubscription) (bool, error) {
req := NewRequest[bool]("giftPremiumSubscription", params)
return req.DoWithContext(ctx, api)
}
// GetManagedBotAccessSettings holds parameters for the getManagedBotAccessSettings method.
// Since: Bot API 10.0
// See https://core.telegram.org/bots/api#getmanagedbotaccesssettings
type GetManagedBotAccessSettings struct {
BotUserID int64 `json:"bot_user_id"`
}
// GetManagedBotAccessSettings returns the access settings of a managed bot.
// Since: Bot API 10.0
// See https://core.telegram.org/bots/api#getmanagedbotaccesssettings
func (api *API) GetManagedBotAccessSettings(params GetManagedBotAccessSettings) (BotAccessSettings, error) {
req := NewRequest[BotAccessSettings]("getManagedBotAccessSettings", params)
return req.Do(api)
}
// GetManagedBotAccessSettingsWithContext is the context-aware variant of GetManagedBotAccessSettings.
// Since: Bot API 10.0
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#getmanagedbotaccesssettings
func (api *API) GetManagedBotAccessSettingsWithContext(ctx context.Context, params GetManagedBotAccessSettings) (BotAccessSettings, error) {
req := NewRequest[BotAccessSettings]("getManagedBotAccessSettings", params)
return req.DoWithContext(ctx, api)
}
// SetManagedBotAccessSettings holds parameters for the setManagedBotAccessSettings method.
// Since: Bot API 10.0
// See https://core.telegram.org/bots/api#setmanagedbotaccesssettings
type SetManagedBotAccessSettings struct {
BotUserID int64 `json:"bot_user_id"`
AccessSettings BotAccessSettings `json:"access_settings"`
}
// SetManagedBotAccessSettings changes the access settings of a managed bot.
// Since: Bot API 10.0
// Returns True on success.
// See https://core.telegram.org/bots/api#setmanagedbotaccesssettings
func (api *API) SetManagedBotAccessSettings(params SetManagedBotAccessSettings) (bool, error) {
req := NewRequest[bool]("setManagedBotAccessSettings", params)
return req.Do(api)
}
// SetManagedBotAccessSettingsWithContext is the context-aware variant of SetManagedBotAccessSettings.
// Since: Bot API 10.0
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#setmanagedbotaccesssettings
func (api *API) SetManagedBotAccessSettingsWithContext(ctx context.Context, params SetManagedBotAccessSettings) (bool, error) {
req := NewRequest[bool]("setManagedBotAccessSettings", params)
return req.DoWithContext(ctx, api)
}