+97
-27
@@ -6,9 +6,15 @@ import "context"
|
||||
// Since: Bot API 4.7
|
||||
// See https://core.telegram.org/bots/api#setmycommands
|
||||
type SetMyCommands struct {
|
||||
Commands []BotCommand `json:"commands"`
|
||||
Scope *BotCommandScope `json:"scope,omitempty"`
|
||||
Language string `json:"language_code,omitempty"`
|
||||
// Commands Required. A JSON-serialized list of bot commands to be set as the list of the bot's commands. At
|
||||
// most 100 commands can be specified.
|
||||
Commands []BotCommand `json:"commands"`
|
||||
// Scope Optional. A JSON-serialized object, describing scope of users for which the commands are relevant.
|
||||
// Defaults to BotCommandScopeDefault.
|
||||
Scope *BotCommandScope `json:"scope,omitempty"`
|
||||
// Language Optional. A two-letter ISO 639-1 language code. If empty, commands will be applied to all users
|
||||
// from the given scope, for whose language there are no dedicated commands.
|
||||
Language string `json:"language_code,omitempty"`
|
||||
}
|
||||
|
||||
// SetMyCommands changes the list of the bot's commands.
|
||||
@@ -33,8 +39,12 @@ func (api *API) SetMyCommandsWithContext(ctx context.Context, params SetMyComman
|
||||
// Since: Bot API 5.3
|
||||
// See https://core.telegram.org/bots/api#deletemycommands
|
||||
type DeleteMyCommands struct {
|
||||
Scope *BotCommandScope `json:"scope,omitempty"`
|
||||
Language string `json:"language_code,omitempty"`
|
||||
// Scope Optional. A JSON-serialized object, describing scope of users for which the commands are relevant.
|
||||
// Defaults to BotCommandScopeDefault.
|
||||
Scope *BotCommandScope `json:"scope,omitempty"`
|
||||
// Language Optional. A two-letter ISO 639-1 language code. If empty, commands will be applied to all users
|
||||
// from the given scope, for whose language there are no dedicated commands.
|
||||
Language string `json:"language_code,omitempty"`
|
||||
}
|
||||
|
||||
// DeleteMyCommands deletes the list of the bot's commands for the given scope and user language.
|
||||
@@ -59,8 +69,10 @@ func (api *API) DeleteMyCommandsWithContext(ctx context.Context, params DeleteMy
|
||||
// Since: Bot API 4.7
|
||||
// See https://core.telegram.org/bots/api#getmycommands
|
||||
type GetMyCommands struct {
|
||||
Scope *BotCommandScope `json:"scope,omitempty"`
|
||||
Language string `json:"language_code,omitempty"`
|
||||
// Scope Optional. A JSON-serialized object, describing scope of users. Defaults to BotCommandScopeDefault.
|
||||
Scope *BotCommandScope `json:"scope,omitempty"`
|
||||
// Language Optional. A two-letter ISO 639-1 language code or an empty string
|
||||
Language string `json:"language_code,omitempty"`
|
||||
}
|
||||
|
||||
// GetMyCommands returns the current list of the bot's commands for the given scope and user language.
|
||||
@@ -84,7 +96,11 @@ func (api *API) GetMyCommandsWithContext(ctx context.Context, params GetMyComman
|
||||
// Since: Bot API 6.7
|
||||
// See https://core.telegram.org/bots/api#setmyname
|
||||
type SetMyName struct {
|
||||
Name string `json:"name"`
|
||||
// Name Optional. New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the
|
||||
// given language.
|
||||
Name string `json:"name"`
|
||||
// Language Optional. A two-letter ISO 639-1 language code. If empty, the name will be shown to all users
|
||||
// for whose language there is no dedicated name.
|
||||
Language string `json:"language_code,omitempty"`
|
||||
}
|
||||
|
||||
@@ -110,6 +126,7 @@ func (api *API) SetMyNameWithContext(ctx context.Context, params SetMyName) (boo
|
||||
// Since: Bot API 6.7
|
||||
// See https://core.telegram.org/bots/api#getmyname
|
||||
type GetMyName struct {
|
||||
// Language Optional. A two-letter ISO 639-1 language code or an empty string
|
||||
Language string `json:"language_code,omitempty"`
|
||||
}
|
||||
|
||||
@@ -134,8 +151,12 @@ func (api *API) GetMyNameWithContext(ctx context.Context, params GetMyName) (Bot
|
||||
// Since: Bot API 6.6
|
||||
// See https://core.telegram.org/bots/api#setmydescription
|
||||
type SetMyDescription struct {
|
||||
// Description Optional. New bot description; 0-512 characters. Pass an empty string to remove the dedicated
|
||||
// description for the given language.
|
||||
Description string `json:"description"`
|
||||
Language string `json:"language_code,omitempty"`
|
||||
// Language Optional. A two-letter ISO 639-1 language code. If empty, the description will be applied to all
|
||||
// users for whose language there is no dedicated description.
|
||||
Language string `json:"language_code,omitempty"`
|
||||
}
|
||||
|
||||
// SetMyDescription changes the bot's description.
|
||||
@@ -160,6 +181,7 @@ func (api *API) SetMyDescriptionWithContext(ctx context.Context, params SetMyDes
|
||||
// Since: Bot API 6.6
|
||||
// See https://core.telegram.org/bots/api#getmydescription
|
||||
type GetMyDescription struct {
|
||||
// Language Optional. A two-letter ISO 639-1 language code or an empty string
|
||||
Language string `json:"language_code,omitempty"`
|
||||
}
|
||||
|
||||
@@ -184,8 +206,12 @@ func (api *API) GetMyDescriptionWithContext(ctx context.Context, params GetMyDes
|
||||
// Since: Bot API 6.6
|
||||
// See https://core.telegram.org/bots/api#setmyshortdescription
|
||||
type SetMyShortDescription struct {
|
||||
// ShortDescription Optional. New short description for the bot; 0-120 characters. Pass an empty string to
|
||||
// remove the dedicated short description for the given language.
|
||||
ShortDescription string `json:"short_description,omitempty"`
|
||||
Language string `json:"language_code,omitempty"`
|
||||
// Language Optional. A two-letter ISO 639-1 language code. If empty, the short description will be applied
|
||||
// to all users for whose language there is no dedicated short description.
|
||||
Language string `json:"language_code,omitempty"`
|
||||
}
|
||||
|
||||
// SetMyShortDescription changes the bot's short description.
|
||||
@@ -210,6 +236,7 @@ func (api *API) SetMyShortDescriptionWithContext(ctx context.Context, params Set
|
||||
// Since: Bot API 6.6
|
||||
// See https://core.telegram.org/bots/api#getmyshortdescription
|
||||
type GetMyShortDescription struct {
|
||||
// Language Optional. A two-letter ISO 639-1 language code or an empty string
|
||||
Language string `json:"language_code,omitempty"`
|
||||
}
|
||||
|
||||
@@ -234,6 +261,7 @@ func (api *API) GetMyShortDescriptionWithContext(ctx context.Context, params Get
|
||||
// Since: Bot API 9.0
|
||||
// See https://core.telegram.org/bots/api#setmyprofilephoto
|
||||
type SetMyProfilePhoto struct {
|
||||
// Photo Required. The new profile photo to set
|
||||
Photo InputProfilePhoto `json:"photo"`
|
||||
}
|
||||
|
||||
@@ -277,7 +305,11 @@ func (api *API) RemoveMyProfilePhotoWithContext(ctx context.Context) (bool, erro
|
||||
// Since: Bot API 6.0
|
||||
// See https://core.telegram.org/bots/api#setchatmenubutton
|
||||
type SetChatMenuButton struct {
|
||||
ChatID int64 `json:"chat_id,omitempty"`
|
||||
// ChatID Optional. Unique identifier for the target private chat. If not specified, the bot's default menu
|
||||
// button will be changed.
|
||||
ChatID int64 `json:"chat_id,omitempty"`
|
||||
// MenuButton Optional. A JSON-serialized object for the bot's new menu button. Defaults to
|
||||
// MenuButtonDefault.
|
||||
MenuButton *MenuButton `json:"menu_button,omitempty"`
|
||||
}
|
||||
|
||||
@@ -303,6 +335,8 @@ func (api *API) SetChatMenuButtonWithContext(ctx context.Context, params SetChat
|
||||
// Since: Bot API 6.0
|
||||
// See https://core.telegram.org/bots/api#getchatmenubutton
|
||||
type GetChatMenuButton struct {
|
||||
// ChatID Optional. Unique identifier for the target private chat. If not specified, the bot's default menu
|
||||
// button will be returned.
|
||||
ChatID int64 `json:"chat_id,omitempty"`
|
||||
}
|
||||
|
||||
@@ -327,8 +361,12 @@ func (api *API) GetChatMenuButtonWithContext(ctx context.Context, params GetChat
|
||||
// Since: Bot API 6.0
|
||||
// See https://core.telegram.org/bots/api#setmydefaultadministratorrights
|
||||
type SetMyDefaultAdministratorRights struct {
|
||||
Rights *ChatAdministratorRights `json:"rights"`
|
||||
ForChannels bool `json:"for_channels"`
|
||||
// Rights Optional. A JSON-serialized object describing new default administrator rights. If not specified,
|
||||
// the default administrator rights will be cleared.
|
||||
Rights *ChatAdministratorRights `json:"rights"`
|
||||
// ForChannels Optional. Pass True to change the default administrator rights of the bot in channels.
|
||||
// Otherwise, the default administrator rights of the bot for groups and supergroups will be changed.
|
||||
ForChannels bool `json:"for_channels"`
|
||||
}
|
||||
|
||||
// SetMyDefaultAdministratorRights changes the default administrator rights for the bot.
|
||||
@@ -353,6 +391,8 @@ func (api *API) SetMyDefaultAdministratorRightsWithContext(ctx context.Context,
|
||||
// Since: Bot API 6.0
|
||||
// See https://core.telegram.org/bots/api#getmydefaultadministratorrights
|
||||
type GetMyDefaultAdministratorRights struct {
|
||||
// ForChannels Optional. Pass True to get default administrator rights of the bot in channels. Otherwise,
|
||||
// default administrator rights of the bot for groups and supergroups will be returned.
|
||||
ForChannels bool `json:"for_channels"`
|
||||
}
|
||||
|
||||
@@ -394,13 +434,27 @@ func (api *API) GetAvailableGiftsWithContext(ctx context.Context) (Gifts, error)
|
||||
// Since: Bot API 9.0
|
||||
// See https://core.telegram.org/bots/api#sendgift
|
||||
type SendGift struct {
|
||||
UserID int64 `json:"user_id,omitempty"`
|
||||
ChatID int64 `json:"chat_id,omitempty"`
|
||||
GiftID string `json:"gift_id"`
|
||||
PayForUpgrade bool `json:"pay_for_upgrade"`
|
||||
Text string `json:"text"`
|
||||
TextParseMode ParseMode `json:"text_parse_mode,omitempty"`
|
||||
TextEntities []MessageEntity `json:"text_entities,omitempty"`
|
||||
// UserID Optional. Required if chat_id is not specified. Unique identifier of the target user who will
|
||||
// receive the gift.
|
||||
UserID int64 `json:"user_id,omitempty"`
|
||||
// ChatID Optional. Required if user_id is not specified. Unique identifier for the chat or username of the
|
||||
// channel (in the format @username) that will receive the gift.
|
||||
ChatID int64 `json:"chat_id,omitempty"`
|
||||
// GiftID Required. Identifier of the gift; limited gifts can't be sent to channel chats
|
||||
GiftID string `json:"gift_id"`
|
||||
// PayForUpgrade Optional. Pass True to pay for the gift upgrade from the bot's balance, thereby making the
|
||||
// upgrade free for the receiver
|
||||
PayForUpgrade bool `json:"pay_for_upgrade"`
|
||||
// Text Optional. Text that will be shown along with the gift; 0-128 characters
|
||||
Text string `json:"text"`
|
||||
// TextParseMode Optional. Mode for parsing entities in the text. See formatting options for more details.
|
||||
// Entities other than “bold”, “italic”, “underline”, “strikethrough”, “spoiler”,
|
||||
// “custom_emoji”, and “date_time” are ignored.
|
||||
TextParseMode ParseMode `json:"text_parse_mode,omitempty"`
|
||||
// TextEntities Optional. A JSON-serialized list of special entities that appear in the gift text. It can be
|
||||
// specified instead of text_parse_mode. Entities other than “bold”, “italic”, “underline”,
|
||||
// “strikethrough”, “spoiler”, “custom_emoji”, and “date_time” are ignored.
|
||||
TextEntities []MessageEntity `json:"text_entities,omitempty"`
|
||||
}
|
||||
|
||||
// SendGift sends a gift to the given user or chat.
|
||||
@@ -425,12 +479,25 @@ func (api *API) SendGiftWithContext(ctx context.Context, params SendGift) (bool,
|
||||
// Since: Bot API 9.0
|
||||
// See https://core.telegram.org/bots/api#giftpremiumsubscription
|
||||
type GiftPremiumSubscription struct {
|
||||
UserID int64 `json:"user_id"`
|
||||
MonthCount int `json:"month_count"`
|
||||
StarCount int `json:"star_count"`
|
||||
Text string `json:"text,omitempty"`
|
||||
TextParseMode ParseMode `json:"text_parse_mode,omitempty"`
|
||||
TextEntities []MessageEntity `json:"text_entities,omitempty"`
|
||||
// UserID Required. Unique identifier of the target user who will receive a Telegram Premium subscription
|
||||
UserID int64 `json:"user_id"`
|
||||
// MonthCount Required. Number of months the Telegram Premium subscription will be active for the user; must
|
||||
// be one of 3, 6, or 12
|
||||
MonthCount int `json:"month_count"`
|
||||
// StarCount Required. Number of Telegram Stars to pay for the Telegram Premium subscription; must be 1000
|
||||
// for 3 months, 1500 for 6 months, and 2500 for 12 months
|
||||
StarCount int `json:"star_count"`
|
||||
// Text Optional. Text that will be shown along with the service message about the subscription; 0-128
|
||||
// characters
|
||||
Text string `json:"text,omitempty"`
|
||||
// TextParseMode Optional. Mode for parsing entities in the text. See formatting options for more details.
|
||||
// Entities other than “bold”, “italic”, “underline”, “strikethrough”, “spoiler”,
|
||||
// “custom_emoji”, and “date_time” are ignored.
|
||||
TextParseMode ParseMode `json:"text_parse_mode,omitempty"`
|
||||
// TextEntities Optional. A JSON-serialized list of special entities that appear in the gift text. It can be
|
||||
// specified instead of text_parse_mode. Entities other than “bold”, “italic”, “underline”,
|
||||
// “strikethrough”, “spoiler”, “custom_emoji”, and “date_time” are ignored.
|
||||
TextEntities []MessageEntity `json:"text_entities,omitempty"`
|
||||
}
|
||||
|
||||
// GiftPremiumSubscription gifts a Telegram Premium subscription to the user.
|
||||
@@ -455,6 +522,7 @@ func (api *API) GiftPremiumSubscriptionWithContext(ctx context.Context, params G
|
||||
// Since: Bot API 10.0
|
||||
// See https://core.telegram.org/bots/api#getmanagedbotaccesssettings
|
||||
type GetManagedBotAccessSettings struct {
|
||||
// BotUserID identifies the managed bot.
|
||||
BotUserID int64 `json:"bot_user_id"`
|
||||
}
|
||||
|
||||
@@ -479,7 +547,9 @@ func (api *API) GetManagedBotAccessSettingsWithContext(ctx context.Context, para
|
||||
// Since: Bot API 10.0
|
||||
// See https://core.telegram.org/bots/api#setmanagedbotaccesssettings
|
||||
type SetManagedBotAccessSettings struct {
|
||||
BotUserID int64 `json:"bot_user_id"`
|
||||
// BotUserID identifies the managed bot.
|
||||
BotUserID int64 `json:"bot_user_id"`
|
||||
// AccessSettings contains the access settings to apply to the managed bot.
|
||||
AccessSettings BotAccessSettings `json:"access_settings"`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user