FILE / ScuroNeko/Laniakea

tgapi/bot_types.go

Исходный файл и его история в репозитории.
FILE 29b208eeec6d77c16e9b5c5a4c4d280b36c10dea
Files
Laniakea/tgapi/bot_types.go
T
ScuroNeko 29b208eeec
Golang lint / lint (push) Successful in 11m32s
(new): v1.2 release
2026-08-19 14:58:25 +03:00

139 lines
5.8 KiB
Go

package tgapi
// BotCommand represents a bot command.
// Since: Bot API 4.7
// See https://core.telegram.org/bots/api#botcommand
type BotCommand struct {
// Command Text of the command; 1-32 characters. Can contain only lowercase English letters, digits and
// underscores.
Command string `json:"command"`
// Description Description of the command; 1-256 characters
Description string `json:"description"`
// IsEphemeral marks the command as visible only in ephemeral command contexts.
IsEphemeral bool `json:"is_ephemeral,omitempty"` // Since: Bot API 10.2
}
// BotCommandScopeType indicates the type of a command scope.
type BotCommandScopeType string
const (
// BotCommandScopeDefaultType is the default command scope.
BotCommandScopeDefaultType BotCommandScopeType = "default"
// BotCommandScopePrivateType covers all private chats.
BotCommandScopePrivateType BotCommandScopeType = "all_private_chats"
// BotCommandScopeGroupType covers all group and supergroup chats.
BotCommandScopeGroupType BotCommandScopeType = "all_group_chats"
// BotCommandScopeAllChatAdministratorsType covers all chat administrators.
BotCommandScopeAllChatAdministratorsType BotCommandScopeType = "all_chat_administrators"
// BotCommandScopeChatType covers a specific chat.
BotCommandScopeChatType BotCommandScopeType = "chat"
// BotCommandScopeChatAdministratorsType covers administrators of a specific chat.
BotCommandScopeChatAdministratorsType BotCommandScopeType = "chat_administrators"
// BotCommandScopeChatMemberType covers a specific member of a specific chat.
BotCommandScopeChatMemberType BotCommandScopeType = "chat_member"
)
// BotCommandScope represents the scope to which bot commands are applied.
// Since: Bot API 5.3
// See https://core.telegram.org/bots/api#botcommandscope
type BotCommandScope struct {
// Type identifies the concrete command-scope variant.
Type BotCommandScopeType `json:"type"`
// ChatID Unique identifier for the target chat or username of the target supergroup in the format
// @username. Channel direct messages chats and channel chats aren't supported.
ChatID *int64 `json:"chat_id,omitempty"`
// UserID Unique identifier of the target user
UserID *int64 `json:"user_id,omitempty"`
}
// BotName represents the bot's name.
// Since: Bot API 6.7
type BotName struct {
// Name The bot's name
Name string `json:"name"`
}
// BotDescription represents the bot's description.
// Since: Bot API 6.6
type BotDescription struct {
// Description The bot's description
Description string `json:"description"`
}
// BotShortDescription represents the bot's short description.
// Since: Bot API 6.6
type BotShortDescription struct {
// ShortDescription The bot's short description
ShortDescription string `json:"short_description"`
}
// InputProfilePhotoType indicates the type of a profile photo input.
type InputProfilePhotoType string
const (
// InputProfilePhotoStaticType identifies a static profile photo input.
InputProfilePhotoStaticType InputProfilePhotoType = "static"
// InputProfilePhotoAnimatedType identifies an animated profile photo input.
InputProfilePhotoAnimatedType InputProfilePhotoType = "animated"
)
// InputProfilePhoto describes a profile photo to set.
// Since: Bot API 9.0
// See https://core.telegram.org/bots/api#inputprofilephoto
type InputProfilePhoto struct {
// Type identifies the static-photo or animated-photo variant.
Type InputProfilePhotoType `json:"type"`
// Photo The static profile photo. Profile photos can't be reused and can only be uploaded as a new file, so
// you can pass “attach://<file_attach_name>” if the photo was uploaded using multipart/form-data under
// <file_attach_name>. More information on Sending Files »
// Static fields (for static photos)
Photo *string `json:"photo,omitempty"`
// Animation The animated profile photo. Profile photos can't be reused and can only be uploaded as a new
// file, so you can pass “attach://<file_attach_name>” if the photo was uploaded using
// multipart/form-data under <file_attach_name>. More information on Sending Files »
// Animated fields (for animated profile videos)
Animation *string `json:"animation,omitempty"`
// MainFrameTimestamp Optional. Timestamp in seconds of the frame that will be used as the static profile
// photo. Defaults to 0.0.
MainFrameTimestamp *float64 `json:"main_frame_timestamp,omitempty"`
}
// MenuButtonType indicates the type of a menu button.
type MenuButtonType string
const (
// MenuButtonCommandsType identifies a commands menu button.
MenuButtonCommandsType MenuButtonType = "commands"
// MenuButtonWebAppType identifies a web app menu button.
MenuButtonWebAppType MenuButtonType = "web_app"
// MenuButtonDefaultType identifies Telegram's default menu button.
MenuButtonDefaultType MenuButtonType = "default"
)
// MenuButton represents a menu button.
// Since: Bot API 6.0
// See https://core.telegram.org/bots/api#menubutton
type MenuButton struct {
// Type identifies the commands, web_app, or default menu-button variant.
Type MenuButtonType `json:"type"`
// Text Text on the button
// WebApp fields (for web_app button)
Text *string `json:"text"`
// WebApp Description of the Web App that will be launched when the user presses the button. The Web App
// will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery.
// Alternatively, a t.me link to a Web App of the bot can be specified in the object instead of the Web
// App's URL, in which case the Web App will be opened as if the user pressed the link.
WebApp *WebAppInfo `json:"web_app"`
}
// BotAccessSettings describes access settings of a managed bot.
// Since: Bot API 10.0
// See https://core.telegram.org/bots/api#botaccesssettings
type BotAccessSettings struct {
// AllowAllPrivateChats reports whether the managed bot may access all private chats of its owner.
AllowAllPrivateChats bool `json:"allow_all_private_chats"`
}