Documentation
¶
Overview ¶
Package tgbotapi has functions and types used for interacting with the Telegram Bot API.
Index ¶
- Constants
- func EscapeText(parseMode string, text string) string
- func NewManagedBotLink(managerUsername, suggestedUsername, suggestedName string) string
- func SetLogger(logger BotLogger) error
- func ValidateWebAppData(token, telegramInitData string) (bool, error)
- func WriteToHTTPResponse(w http.ResponseWriter, c Chattable) error
- type APIResponse
- type AcceptedGiftTypes
- type AddStickerConfig
- type AffiliateInfo
- type Animation
- type AnimationConfig
- type AnswerChatJoinRequestQueryConfig
- type AnswerGuestQueryConfig
- type AnswerWebAppQueryConfig
- type ApproveChatJoinRequestConfig
- type ApproveSuggestedPostConfig
- type Audio
- type AudioConfig
- type BackgroundFill
- type BackgroundType
- type BanChatMemberConfig
- type BanChatSenderChatConfig
- type BaseChat
- type BaseEdit
- type BaseEphemeralEdit
- type BaseFile
- type BaseInputMedia
- type Birthdate
- type BotAPI
- func (bot *BotAPI) AnswerGuestQuery(config AnswerGuestQueryConfig) (SentGuestMessage, error)
- func (bot *BotAPI) AnswerWebAppQuery(config AnswerWebAppQueryConfig) (SentWebAppMessage, error)
- func (bot *BotAPI) CopyMessage(config CopyMessageConfig) (MessageID, error)
- func (bot *BotAPI) CopyMessages(config CopyMessagesConfig) ([]MessageID, error)
- func (bot *BotAPI) CreateForumTopic(config CreateForumTopicConfig) (ForumTopic, error)
- func (bot *BotAPI) EditStory(config EditStoryConfig) (Story, error)
- func (bot *BotAPI) FileLink(f File) string
- func (bot *BotAPI) ForwardMessages(config ForwardMessagesConfig) ([]MessageID, error)
- func (bot *BotAPI) GetAvailableGifts() (Gifts, error)
- func (bot *BotAPI) GetBusinessAccountGifts(config GetBusinessAccountGiftsConfig) (OwnedGifts, error)
- func (bot *BotAPI) GetBusinessAccountStarBalance(config GetBusinessAccountStarBalanceConfig) (StarAmount, error)
- func (bot *BotAPI) GetBusinessConnection(config GetBusinessConnectionConfig) (BusinessConnection, error)
- func (bot *BotAPI) GetChat(config ChatInfoConfig) (ChatFullInfo, error)
- func (bot *BotAPI) GetChatAdministrators(config ChatAdministratorsConfig) ([]ChatMember, error)
- func (bot *BotAPI) GetChatGifts(config GetChatGiftsConfig) (OwnedGifts, error)
- func (bot *BotAPI) GetChatMember(config GetChatMemberConfig) (ChatMember, error)
- func (bot *BotAPI) GetChatMemberCount(config ChatMemberCountConfig) (int, error)
- func (bot *BotAPI) GetChatMembersCount(config ChatMemberCountConfig) (int, error)deprecated
- func (bot *BotAPI) GetCustomEmojiStickers(config GetCustomEmojiStickersConfig) ([]Sticker, error)
- func (bot *BotAPI) GetFile(config FileConfig) (File, error)
- func (bot *BotAPI) GetFileDirectURL(fileID string) (string, error)
- func (bot *BotAPI) GetForumTopicIconStickers() ([]Sticker, error)
- func (bot *BotAPI) GetGameHighScores(config GetGameHighScoresConfig) ([]GameHighScore, error)
- func (bot *BotAPI) GetInviteLink(config ChatInviteLinkConfig) (string, error)
- func (bot *BotAPI) GetManagedBotAccessSettings(config GetManagedBotAccessSettingsConfig) (BotAccessSettings, error)
- func (bot *BotAPI) GetManagedBotToken(config GetManagedBotTokenConfig) (string, error)
- func (bot *BotAPI) GetMe() (User, error)
- func (bot *BotAPI) GetMyCommands() ([]BotCommand, error)
- func (bot *BotAPI) GetMyCommandsWithConfig(config GetMyCommandsConfig) ([]BotCommand, error)
- func (bot *BotAPI) GetMyDefaultAdministratorRights(config GetMyDefaultAdministratorRightsConfig) (ChatAdministratorRights, error)
- func (bot *BotAPI) GetMyDescription(config GetMyDescriptionConfig) (BotDescription, error)
- func (bot *BotAPI) GetMyName(config GetMyNameConfig) (BotName, error)
- func (bot *BotAPI) GetMyShortDescription(config GetMyShortDescriptionConfig) (BotShortDescription, error)
- func (bot *BotAPI) GetMyStarBalance() (StarAmount, error)
- func (bot *BotAPI) GetStarTransactions(config GetStarTransactionsConfig) (StarTransactions, error)
- func (bot *BotAPI) GetStickerSet(config GetStickerSetConfig) (StickerSet, error)
- func (bot *BotAPI) GetUpdates(config UpdateConfig) ([]Update, error)
- func (bot *BotAPI) GetUpdatesChan(config UpdateConfig) UpdatesChannel
- func (bot *BotAPI) GetUserChatBoosts(config GetUserChatBoostsConfig) (UserChatBoosts, error)
- func (bot *BotAPI) GetUserGifts(config GetUserGiftsConfig) (OwnedGifts, error)
- func (bot *BotAPI) GetUserPersonalChatMessages(config GetUserPersonalChatMessagesConfig) ([]Message, error)
- func (bot *BotAPI) GetUserProfileAudios(config GetUserProfileAudiosConfig) (UserProfileAudios, error)
- func (bot *BotAPI) GetUserProfilePhotos(config UserProfilePhotosConfig) (UserProfilePhotos, error)
- func (bot *BotAPI) GetWebhookInfo() (WebhookInfo, error)
- func (bot *BotAPI) HandleUpdate(r *http.Request) (*Update, error)
- func (bot *BotAPI) IsMessageToMe(message Message) bool
- func (bot *BotAPI) ListenForWebhook(pattern string) UpdatesChannel
- func (bot *BotAPI) ListenForWebhookRespReqFormat(w http.ResponseWriter, r *http.Request) UpdatesChannel
- func (bot *BotAPI) MakeRequest(endpoint string, params Params) (*APIResponse, error)
- func (bot *BotAPI) PostStory(config PostStoryConfig) (Story, error)
- func (bot *BotAPI) ReplaceManagedBotToken(config ReplaceManagedBotTokenConfig) (string, error)
- func (bot *BotAPI) RepostStory(config RepostStoryConfig) (Story, error)
- func (bot *BotAPI) Request(c Chattable) (*APIResponse, error)
- func (bot *BotAPI) SavePreparedInlineMessage(config SavePreparedInlineMessageConfig) (PreparedInlineMessage, error)
- func (bot *BotAPI) SavePreparedKeyboardButton(config SavePreparedKeyboardButtonConfig) (PreparedKeyboardButton, error)
- func (bot *BotAPI) Send(c Chattable) (Message, error)
- func (bot *BotAPI) SendMediaGroup(config MediaGroupConfig) ([]Message, error)
- func (bot *BotAPI) SetAPIEndpoint(apiEndpoint string)
- func (bot *BotAPI) SetFileEndpoint(fileEndpoint string)
- func (bot *BotAPI) StopPoll(config StopPollConfig) (Poll, error)
- func (bot *BotAPI) StopReceivingUpdates()
- func (bot *BotAPI) UploadFiles(endpoint string, params Params, files []RequestFile) (*APIResponse, error)
- type BotAccessSettings
- type BotCommand
- type BotCommandScope
- func NewBotCommandScopeAllChatAdministrators() BotCommandScope
- func NewBotCommandScopeAllGroupChats() BotCommandScope
- func NewBotCommandScopeAllPrivateChats() BotCommandScope
- func NewBotCommandScopeChat(chatID int64) BotCommandScope
- func NewBotCommandScopeChatAdministrators(chatID int64) BotCommandScope
- func NewBotCommandScopeChatMember(chatID, userID int64) BotCommandScope
- func NewBotCommandScopeDefault() BotCommandScope
- type BotDescription
- type BotLogger
- type BotName
- type BotShortDescription
- type BotSubscriptionUpdated
- type BusinessBotRights
- type BusinessConnection
- type BusinessIntro
- type BusinessLocation
- type BusinessMessagesDeleted
- type BusinessOpeningHours
- type BusinessOpeningHoursInterval
- type CallbackConfig
- type CallbackGame
- type CallbackQuery
- type Chat
- type ChatActionConfig
- type ChatAdministratorRights
- type ChatAdministratorsConfig
- type ChatBackground
- type ChatBoost
- type ChatBoostAdded
- type ChatBoostRemoved
- type ChatBoostSource
- type ChatBoostUpdated
- type ChatConfig
- type ChatConfigWithUser
- type ChatFullInfo
- type ChatInfoConfig
- type ChatInviteLink
- type ChatInviteLinkConfig
- type ChatJoinRequest
- type ChatLocation
- type ChatMember
- type ChatMemberConfig
- type ChatMemberCountConfig
- type ChatMemberUpdated
- type ChatOwnerChanged
- type ChatOwnerLeft
- type ChatPermissions
- type ChatPhoto
- type ChatShared
- type Chattable
- type Checklist
- type ChecklistTask
- type ChecklistTasksAdded
- type ChecklistTasksDone
- type ChosenInlineResult
- type CloseConfig
- type CloseForumTopicConfig
- type CloseGeneralForumTopicConfig
- type Community
- type CommunityChatAdded
- type CommunityChatJoined
- type CommunityChatRemoved
- type Contact
- type ContactConfig
- type ConvertGiftToStarsConfig
- type CopyMessageConfig
- type CopyMessagesConfig
- type CopyTextButton
- type CreateChatInviteLinkConfig
- type CreateChatSubscriptionInviteLinkConfig
- type CreateForumTopicConfig
- type Credentials
- type DataCredentials
- type DeclineChatJoinRequest
- type DeclineSuggestedPostConfig
- type DeleteAllMessageReactionsConfig
- type DeleteBusinessMessagesConfig
- type DeleteChatPhotoConfig
- type DeleteChatStickerSetConfig
- type DeleteEphemeralMessageConfig
- type DeleteForumTopicConfig
- type DeleteMessageConfig
- type DeleteMessageReactionConfig
- type DeleteMessagesConfig
- type DeleteMyCommandsConfig
- type DeleteStickerConfig
- type DeleteStickerSetConfig
- type DeleteStoryConfig
- type DeleteWebhookConfig
- type Dice
- type DiceConfig
- type DirectMessagePriceChanged
- type DirectMessagesTopic
- type DisabledButton
- type Document
- type DocumentConfig
- type EditChatInviteLinkConfig
- type EditChatSubscriptionInviteLinkConfig
- type EditEphemeralMessageCaptionConfig
- type EditEphemeralMessageMediaConfig
- type EditEphemeralMessageReplyMarkupConfig
- type EditEphemeralMessageTextConfig
- type EditForumTopicConfig
- type EditGeneralForumTopicConfig
- type EditMessageCaptionConfig
- type EditMessageChecklistConfig
- type EditMessageLiveLocationConfig
- type EditMessageMediaConfig
- type EditMessageReplyMarkupConfig
- type EditMessageTextConfig
- type EditStoryConfig
- type EditUserStarSubscriptionConfig
- type EncryptedCredentials
- type EncryptedPassportElement
- type EphemeralMessageParameters
- type EphemeralSendParams
- type Error
- type ExternalReplyInfo
- type File
- type FileBytes
- type FileConfig
- type FileCredentials
- type FileID
- type FilePath
- type FileReader
- type FileURL
- type Fileable
- type ForceReply
- type ForumTopic
- type ForumTopicClosed
- type ForumTopicCreated
- type ForumTopicEdited
- type ForumTopicReopened
- type ForwardConfig
- type ForwardMessagesConfig
- type Game
- type GameConfig
- type GameHighScore
- type GeneralForumTopicHidden
- type GeneralForumTopicUnhidden
- type GetAvailableGiftsConfig
- type GetBusinessAccountGiftsConfig
- type GetBusinessAccountStarBalanceConfig
- type GetBusinessConnectionConfig
- type GetChatGiftsConfig
- type GetChatMemberConfig
- type GetChatMenuButtonConfig
- type GetCustomEmojiStickersConfig
- type GetForumTopicIconStickersConfig
- type GetGameHighScoresConfig
- type GetManagedBotAccessSettingsConfig
- type GetManagedBotTokenConfig
- type GetMyCommandsConfig
- type GetMyDefaultAdministratorRightsConfig
- type GetMyDescriptionConfig
- type GetMyNameConfig
- type GetMyShortDescriptionConfig
- type GetMyStarBalanceConfig
- type GetStarTransactionsConfig
- type GetStickerSetConfig
- type GetUserChatBoostsConfig
- type GetUserGiftsConfig
- type GetUserPersonalChatMessagesConfig
- type GetUserProfileAudiosConfig
- type Gift
- type GiftBackground
- type GiftInfo
- type GiftPremiumSubscriptionConfig
- type Gifts
- type Giveaway
- type GiveawayCompleted
- type GiveawayCreated
- type GiveawayWinners
- type HTTPClient
- type HideGeneralForumTopicConfig
- type IDDocumentData
- type InaccessibleMessage
- type InlineConfig
- type InlineKeyboardButton
- func NewInlineKeyboardButtonData(text, data string) InlineKeyboardButton
- func NewInlineKeyboardButtonLoginURL(text string, loginURL LoginURL) InlineKeyboardButton
- func NewInlineKeyboardButtonSwitch(text, sw string) InlineKeyboardButton
- func NewInlineKeyboardButtonURL(text, url string) InlineKeyboardButton
- func NewInlineKeyboardButtonWebApp(text string, webapp WebAppInfo) InlineKeyboardButton
- func NewInlineKeyboardRow(buttons ...InlineKeyboardButton) []InlineKeyboardButton
- type InlineKeyboardMarkup
- type InlineQuery
- type InlineQueryResultArticle
- func NewInlineQueryResultArticle(id, title, messageText string) InlineQueryResultArticle
- func NewInlineQueryResultArticleHTML(id, title, messageText string) InlineQueryResultArticle
- func NewInlineQueryResultArticleMarkdown(id, title, messageText string) InlineQueryResultArticle
- func NewInlineQueryResultArticleMarkdownV2(id, title, messageText string) InlineQueryResultArticle
- type InlineQueryResultAudio
- type InlineQueryResultCachedAudio
- type InlineQueryResultCachedDocument
- type InlineQueryResultCachedGIF
- type InlineQueryResultCachedMPEG4GIF
- type InlineQueryResultCachedPhoto
- type InlineQueryResultCachedSticker
- type InlineQueryResultCachedVideo
- type InlineQueryResultCachedVoice
- type InlineQueryResultContact
- type InlineQueryResultDocument
- type InlineQueryResultGIF
- type InlineQueryResultGame
- type InlineQueryResultLocation
- type InlineQueryResultMPEG4GIF
- type InlineQueryResultPhoto
- type InlineQueryResultVenue
- type InlineQueryResultVideo
- type InlineQueryResultVoice
- type InlineQueryResultsButton
- type InputChecklist
- type InputChecklistTask
- type InputContactMessageContent
- type InputInvoiceMessageContent
- type InputLocationMessageContent
- type InputMediaAnimation
- type InputMediaAudio
- type InputMediaDocument
- type InputMediaLink
- type InputMediaLivePhoto
- type InputMediaLocation
- type InputMediaPhoto
- type InputMediaSticker
- type InputMediaVenue
- type InputMediaVideo
- type InputMediaVoiceNote
- type InputPaidMedia
- type InputPollOption
- type InputProfilePhoto
- type InputRichBlock
- type InputRichBlockListItem
- type InputRichMessage
- type InputRichMessageContent
- type InputRichMessageMedia
- type InputSticker
- type InputStoryContent
- type InputTextMessageContent
- type InputVenueMessageContent
- type Invoice
- type InvoiceConfig
- type InvoiceLinkConfig
- type KeyboardButton
- func NewKeyboardButton(text string) KeyboardButton
- func NewKeyboardButtonContact(text string) KeyboardButton
- func NewKeyboardButtonLocation(text string) KeyboardButton
- func NewKeyboardButtonRow(buttons ...KeyboardButton) []KeyboardButton
- func NewKeyboardButtonWebApp(text string, webapp WebAppInfo) KeyboardButton
- type KeyboardButtonPollType
- type KeyboardButtonRequestChat
- type KeyboardButtonRequestManagedBot
- type KeyboardButtonRequestUsers
- type KickChatMemberConfig
- type LabeledPrice
- type LeaveChatConfig
- type Link
- type LinkPreviewOptions
- type LivePhoto
- type LivePhotoConfig
- type Location
- type LocationAddress
- type LocationConfig
- type LogOutConfig
- type LoginURL
- type ManagedBotCreated
- type ManagedBotUpdated
- type MaskPosition
- type MediaGroupConfig
- type MenuButton
- type Message
- type MessageAutoDeleteTimerChanged
- type MessageConfig
- type MessageEntity
- func (e MessageEntity) IsBold() bool
- func (e MessageEntity) IsCode() bool
- func (e MessageEntity) IsCommand() bool
- func (e MessageEntity) IsEmail() bool
- func (e MessageEntity) IsHashtag() bool
- func (e MessageEntity) IsItalic() bool
- func (e MessageEntity) IsMention() bool
- func (e MessageEntity) IsPre() bool
- func (e MessageEntity) IsTextLink() bool
- func (e MessageEntity) IsTextMention() bool
- func (e MessageEntity) IsURL() bool
- func (e MessageEntity) ParseURL() (*url.URL, error)
- type MessageGenerationStopped
- type MessageID
- type MessageOrigin
- type MessageReactionCountUpdated
- type MessageReactionUpdated
- type NewStickerSetConfig
- type OrderInfo
- type OwnedGift
- type OwnedGifts
- type PaidMedia
- type PaidMediaInfo
- type PaidMediaPurchased
- type PaidMessagePriceChanged
- type Params
- func (p Params) AddAny(key string, value any) error
- func (p Params) AddBool(key string, value bool)
- func (p Params) AddFirstValid(key string, args ...interface{}) error
- func (p Params) AddInterface(key string, value interface{}) error
- func (p Params) AddNonEmpty(key, value string)
- func (p Params) AddNonZero(key string, value int)
- func (p Params) AddNonZero64(key string, value int64)
- func (p Params) AddNonZeroFloat(key string, value float64)
- type PassportData
- type PassportElementError
- type PassportElementErrorDataField
- type PassportElementErrorFile
- type PassportElementErrorFiles
- type PassportElementErrorFrontSide
- type PassportElementErrorReverseSide
- type PassportElementErrorSelfie
- type PassportElementErrorTranslationFile
- type PassportElementErrorTranslationFiles
- type PassportElementErrorUnspecified
- type PassportFile
- type PassportRequestInfoConfig
- type PassportScope
- type PassportScopeElement
- type PassportScopeElementOne
- type PassportScopeElementOneOfSeveral
- type PersonalDetails
- type PhotoConfig
- type PhotoSize
- type PinChatMessageConfig
- type Poll
- type PollAnswer
- type PollMedia
- type PollOption
- type PollOptionAdded
- type PollOptionDeleted
- type PostStoryConfig
- type PreCheckoutConfig
- type PreCheckoutQuery
- type PreparedInlineMessage
- type PreparedKeyboardButton
- type PromoteChatMemberConfig
- type ProximityAlertTriggered
- type ReactionCount
- type ReactionType
- type ReadBusinessMessageConfig
- type RefundStarPaymentConfig
- type RefundedPayment
- type RemoveBusinessAccountProfilePhotoConfig
- type RemoveChatVerificationConfig
- type RemoveMyProfilePhotoConfig
- type RemoveUserVerificationConfig
- type ReopenForumTopicConfig
- type ReopenGeneralForumTopicConfig
- type ReplaceManagedBotTokenConfig
- type ReplaceStickerInSetConfig
- type ReplyKeyboardMarkup
- type ReplyKeyboardRemove
- type ReplyParameters
- type RepostStoryConfig
- type RequestFile
- type RequestFileData
- type ResponseParameters
- type RestrictChatMemberConfig
- type RevenueWithdrawalState
- type RevokeChatInviteLinkConfig
- type RichBlock
- type RichBlockCaption
- type RichBlockListItem
- type RichBlockTableCell
- type RichMessage
- type RichMessageButton
- type RichText
- type SavePreparedInlineMessageConfig
- type SavePreparedKeyboardButtonConfig
- type SecureData
- type SecureValue
- type SendChatJoinRequestWebAppConfig
- type SendChecklistConfig
- type SendGiftConfig
- type SendMessageDraftConfig
- type SendPaidMediaConfig
- type SendPollConfig
- type SendRichMessageConfig
- type SendRichMessageDraftConfig
- type SentGuestMessage
- type SentWebAppMessage
- type SetBusinessAccountBioConfig
- type SetBusinessAccountGiftSettingsConfig
- type SetBusinessAccountNameConfig
- type SetBusinessAccountProfilePhotoConfig
- type SetBusinessAccountUsernameConfig
- type SetChatAdministratorCustomTitle
- type SetChatDescriptionConfig
- type SetChatMemberTagConfig
- type SetChatMenuButtonConfig
- type SetChatPermissionsConfig
- type SetChatPhotoConfig
- type SetChatStickerSetConfig
- type SetChatTitleConfig
- type SetCustomEmojiStickerSetThumbnailConfig
- type SetGameScoreConfig
- type SetManagedBotAccessSettingsConfig
- type SetMessageReactionConfig
- type SetMyCommandsConfig
- type SetMyDefaultAdministratorRightsConfig
- type SetMyDescriptionConfig
- type SetMyNameConfig
- type SetMyProfilePhotoConfig
- type SetMyShortDescriptionConfig
- type SetPassportDataErrorsConfig
- type SetStickerEmojiListConfig
- type SetStickerKeywordsConfig
- type SetStickerMaskPositionConfig
- type SetStickerPositionConfig
- type SetStickerSetThumbnailConfig
- type SetStickerSetTitleConfig
- type SetUserEmojiStatusConfig
- type SharedUser
- type ShippingAddress
- type ShippingConfig
- type ShippingOption
- type ShippingQuery
- type StarAmount
- type StarTransaction
- type StarTransactions
- type Sticker
- type StickerConfig
- type StickerSet
- type StopMessageLiveLocationConfig
- type StopPollConfig
- type Story
- type StoryArea
- type StoryAreaPosition
- type StoryAreaType
- type SuccessfulPayment
- type SuggestedPostApprovalFailed
- type SuggestedPostApproved
- type SuggestedPostDeclined
- type SuggestedPostInfo
- type SuggestedPostPaid
- type SuggestedPostParameters
- type SuggestedPostPrice
- type SuggestedPostRefunded
- type SwitchInlineQueryChosenChat
- type TextQuote
- type TransactionPartner
- type TransferBusinessAccountStarsConfig
- type TransferGiftConfig
- type UnbanChatMemberConfig
- type UnbanChatSenderChatConfig
- type UnhideGeneralForumTopicConfig
- type UniqueGift
- type UniqueGiftBackdrop
- type UniqueGiftBackdropColors
- type UniqueGiftColors
- type UniqueGiftInfo
- type UniqueGiftModel
- type UniqueGiftSymbol
- type UnpinAllChatMessagesConfig
- type UnpinAllForumTopicMessagesConfig
- type UnpinAllGeneralForumTopicMessagesConfig
- type UnpinChatMessageConfig
- type Update
- type UpdateConfig
- type UpdatesChannel
- type UpgradeGiftConfig
- type UploadStickerConfig
- type User
- type UserChatBoosts
- type UserProfileAudios
- type UserProfilePhotos
- type UserProfilePhotosConfig
- type UserRating
- type UsersShared
- type Venue
- type VenueConfig
- type VerifyChatConfig
- type VerifyUserConfig
- type Video
- type VideoChatEnded
- type VideoChatParticipantsInvited
- type VideoChatScheduled
- type VideoChatStarted
- type VideoConfig
- type VideoNote
- type VideoNoteConfig
- type VideoQuality
- type Voice
- type VoiceConfig
- type WebAppData
- type WebAppInfo
- type WebhookConfig
- type WebhookInfo
- type WriteAccessAllowed
Examples ¶
Constants ¶
const ( // APIEndpoint is the endpoint for all API methods, // with formatting for Sprintf. APIEndpoint = "https://api.telegram.org/bot%s/%s" // FileEndpoint is the endpoint for downloading a file from Telegram. FileEndpoint = "https://api.telegram.org/file/bot%s/%s" )
Telegram constants
const ( ChatTyping = "typing" ChatUploadPhoto = "upload_photo" ChatRecordVideo = "record_video" ChatUploadVideo = "upload_video" ChatRecordVoice = "record_voice" ChatUploadVoice = "upload_voice" ChatUploadDocument = "upload_document" ChatChooseSticker = "choose_sticker" ChatFindLocation = "find_location" ChatRecordVideoNote = "record_video_note" ChatUploadVideoNote = "upload_video_note" )
Constant values for ChatActions
const ( ModeMarkdown = "Markdown" ModeMarkdownV2 = "MarkdownV2" ModeHTML = "HTML" )
Constant values for ParseMode in MessageConfig
const ( // UpdateTypeMessage is new incoming message of any kind — text, photo, sticker, etc. UpdateTypeMessage = "message" // UpdateTypeEditedMessage is new version of a message that is known to the bot and was edited UpdateTypeEditedMessage = "edited_message" // UpdateTypeChannelPost is new incoming channel post of any kind — text, photo, sticker, etc. UpdateTypeChannelPost = "channel_post" // UpdateTypeEditedChannelPost is new version of a channel post that is known to the bot and was edited UpdateTypeEditedChannelPost = "edited_channel_post" // UpdateTypeInlineQuery is new incoming inline query UpdateTypeInlineQuery = "inline_query" // UpdateTypeChosenInlineResult i the result of an inline query that was chosen by a user and sent to their // chat partner. Please see the documentation on the feedback collecting for // details on how to enable these updates for your bot. UpdateTypeChosenInlineResult = "chosen_inline_result" // UpdateTypeCallbackQuery is new incoming callback query UpdateTypeCallbackQuery = "callback_query" // UpdateTypeShippingQuery is new incoming shipping query. Only for invoices with flexible price UpdateTypeShippingQuery = "shipping_query" // UpdateTypePreCheckoutQuery is new incoming pre-checkout query. Contains full information about checkout UpdateTypePreCheckoutQuery = "pre_checkout_query" // UpdateTypePoll is new poll state. Bots receive only updates about stopped polls and polls // which are sent by the bot UpdateTypePoll = "poll" // UpdateTypePollAnswer is when user changed their answer in a non-anonymous poll. Bots receive new votes // only in polls that were sent by the bot itself. UpdateTypePollAnswer = "poll_answer" // UpdateTypeMessageReaction is when a reaction to a message was changed by a user. UpdateTypeMessageReaction = "message_reaction" // UpdateTypeMessageReactionCount is when reactions to a message with anonymous reactions were changed. UpdateTypeMessageReactionCount = "message_reaction_count" // UpdateTypeChatBoost is when a boost was added to a chat or changed. UpdateTypeChatBoost = "chat_boost" // UpdateTypeRemovedChatBoost is when a boost was removed from a chat. UpdateTypeRemovedChatBoost = "removed_chat_boost" // UpdateTypeBusinessConnection is when the bot was connected to or // disconnected from a business account, or a user edited an existing // connection with the bot. UpdateTypeBusinessConnection = "business_connection" // UpdateTypeBusinessMessage is a new non-service message from a connected // business account. UpdateTypeBusinessMessage = "business_message" // UpdateTypeEditedBusinessMessage is a new version of a message from a // connected business account. UpdateTypeEditedBusinessMessage = "edited_business_message" // UpdateTypeDeletedBusinessMessages is when messages were deleted from a // connected business account. UpdateTypeDeletedBusinessMessages = "deleted_business_messages" // UpdateTypePurchasedPaidMedia is when a user purchased paid media with // a non-empty payload sent by the bot in a non-channel chat. UpdateTypePurchasedPaidMedia = "purchased_paid_media" // UpdateTypeMyChatMember is when the bot's chat member status was updated in a chat. For private chats, this // update is received only when the bot is blocked or unblocked by the user. UpdateTypeMyChatMember = "my_chat_member" // UpdateTypeChatMember is when the bot must be an administrator in the chat and must explicitly specify // this update in the list of allowed_updates to receive these updates. UpdateTypeChatMember = "chat_member" // UpdateTypeChatJoinRequest is when a request to join the chat has been sent. // The bot must have the can_invite_users administrator right in the chat to // receive these updates. UpdateTypeChatJoinRequest = "chat_join_request" // UpdateTypeGuestMessage is a new guest message. The bot can use // Message.GuestQueryID and the answerGuestQuery method to reply to it. UpdateTypeGuestMessage = "guest_message" // UpdateTypeManagedBot is when a new bot was created to be managed by the bot, // or token or owner of a managed bot was changed. UpdateTypeManagedBot = "managed_bot" // UpdateTypeSubscription is when a user payment subscription toward the // bot was changed. UpdateTypeSubscription = "subscription" // UpdateTypeStoppedMessageGeneration is when a user asked the bot to stop // the generation of a message. UpdateTypeStoppedMessageGeneration = "stopped_message_generation" )
Constant values for update types
const ( // ChatJoinRequestApprove allows the user to join the chat. ChatJoinRequestApprove = "approve" // ChatJoinRequestDecline disallows the user from joining the chat. ChatJoinRequestDecline = "decline" // ChatJoinRequestQueue leaves the decision to other administrators. ChatJoinRequestQueue = "queue" )
Result values for AnswerChatJoinRequestQueryConfig.
const ( EffectFire = "5104841245755180586" // 🔥 EffectThumbsUp = "5107584321108051014" // 👍 EffectThumbsDown = "5104858069142078462" // 👎 EffectHeart = "5159385139981059251" // ❤️ EffectParty = "5046509860389126442" // 🎉 EffectPoop = "5046589136895476101" // 💩 )
const ( BackgroundFillTypeSolid = "solid" BackgroundFillTypeGradient = "gradient" BackgroundFillTypeFreeformGradient = "freeform_gradient" )
Background fill type constants.
const ( BackgroundTypeFill = "fill" BackgroundTypeWallpaper = "wallpaper" BackgroundTypePattern = "pattern" BackgroundTypeChatTheme = "chat_theme" )
Background type constants.
const ( RevenueWithdrawalStateTypePending = "pending" RevenueWithdrawalStateTypeSucceeded = "succeeded" RevenueWithdrawalStateTypeFailed = "failed" )
Revenue withdrawal state type constants.
const ( TransactionPartnerTypeUser = "user" TransactionPartnerTypeChat = "chat" TransactionPartnerTypeAffiliateProgram = "affiliate_program" TransactionPartnerTypeFragment = "fragment" TransactionPartnerTypeTelegramAds = "telegram_ads" TransactionPartnerTypeTelegramApi = "telegram_api" TransactionPartnerTypeOther = "other" )
Transaction partner type constants.
const ( PaidMediaTypePreview = "preview" PaidMediaTypePhoto = "photo" PaidMediaTypeVideo = "video" PaidMediaTypeLivePhoto = "live_photo" )
Paid media type constants.
const ( UniqueGiftOriginUpgrade = "upgrade" UniqueGiftOriginTransfer = "transfer" UniqueGiftOriginResale = "resale" UniqueGiftOriginGiftedUpgrade = "gifted_upgrade" UniqueGiftOriginOffer = "offer" )
Unique gift origin constants.
const ( OwnedGiftTypeRegular = "regular" OwnedGiftTypeUnique = "unique" )
Owned gift type constants.
const ( InputProfilePhotoTypeStatic = "static" InputProfilePhotoTypeAnimated = "animated" )
InputProfilePhoto type constants.
const ( InputStoryContentTypePhoto = "photo" InputStoryContentTypeVideo = "video" )
Input story content type constants.
const ( StoryAreaTypeLocation = "location" StoryAreaTypeSuggestedReaction = "suggested_reaction" StoryAreaTypeLink = "link" StoryAreaTypeWeather = "weather" StoryAreaTypeUniqueGift = "unique_gift" )
Story area type constants.
const ( InputPaidMediaTypePhoto = "photo" InputPaidMediaTypeVideo = "video" InputPaidMediaTypeLivePhoto = "live_photo" )
Input paid media type constants.
const ( ReactionTypeEmoji = "emoji" ReactionTypeCustomEmoji = "custom_emoji" ReactionTypePaid = "paid" )
Reaction type constants.
const ( ChatBoostSourcePremium = "premium" ChatBoostSourceGiftCode = "gift_code" ChatBoostSourceGiveaway = "giveaway" )
Chat boost source constants.
const ( MessageOriginTypeUser = "user" MessageOriginTypeHiddenUser = "hidden_user" MessageOriginTypeChat = "chat" MessageOriginTypeChannel = "channel" )
Message origin type constants.
const ( StickerTypeRegular = "regular" StickerTypeMask = "mask" StickerTypeCustomEmoji = "custom_emoji" )
Sticker type constants.
const ( StickerFormatStatic = "static" StickerFormatAnimated = "animated" StickerFormatVideo = "video" )
Sticker format constants for the createNewStickerSet method and the uploadStickerFile method.
const ( RichTextTypeBold = "bold" RichTextTypeItalic = "italic" RichTextTypeUnderline = "underline" RichTextTypeStrikethrough = "strikethrough" RichTextTypeSpoiler = "spoiler" RichTextTypeDateTime = "date_time" RichTextTypeTextMention = "text_mention" RichTextTypeSubscript = "subscript" RichTextTypeSuperscript = "superscript" RichTextTypeMarked = "marked" RichTextTypeCode = "code" RichTextTypeCustomEmoji = "custom_emoji" RichTextTypeMathematicalExpression = "mathematical_expression" RichTextTypeURL = "url" RichTextTypeEmailAddress = "email_address" RichTextTypePhoneNumber = "phone_number" RichTextTypeBankCardNumber = "bank_card_number" RichTextTypeMention = "mention" RichTextTypeHashtag = "hashtag" RichTextTypeCashtag = "cashtag" RichTextTypeBotCommand = "bot_command" RichTextTypeButton = "button" RichTextTypeAnchor = "anchor" RichTextTypeAnchorLink = "anchor_link" RichTextTypeReference = "reference" RichTextTypeReferenceLink = "reference_link" )
RichText styled-span (object form) discriminators.
const ( RichBlockTypeParagraph = "paragraph" RichBlockTypeHeading = "heading" RichBlockTypePre = "pre" RichBlockTypeDivider = "divider" RichBlockTypeMathematicalExpression = "mathematical_expression" RichBlockTypeAnchor = "anchor" RichBlockTypeList = "list" RichBlockTypeBlockquote = "blockquote" RichBlockTypeExpandableBlockquote = "expandable_blockquote" RichBlockTypePullquote = "pullquote" RichBlockTypeCollage = "collage" RichBlockTypeSlideshow = "slideshow" RichBlockTypeTable = "table" RichBlockTypeDetails = "details" RichBlockTypeMap = "map" RichBlockTypeButtons = "buttons" RichBlockTypeAnimation = "animation" RichBlockTypeAudio = "audio" RichBlockTypeDocument = "document" RichBlockTypePhoto = "photo" RichBlockTypeVideo = "video" RichBlockTypeVoiceNote = "voice_note" RichBlockTypeThinking = "thinking" )
RichBlock block-type discriminators.
const ( // BotSubscriptionStateCanceled means the user canceled the subscription. BotSubscriptionStateCanceled = "canceled" // BotSubscriptionStateActive means the user re-enabled a previously // canceled subscription. BotSubscriptionStateActive = "active" // BotSubscriptionStateFailed means payment for the subscription failed. BotSubscriptionStateFailed = "failed" )
BotSubscriptionUpdated.State values.
const (
// ErrAPIForbidden happens when a token is bad
ErrAPIForbidden = "forbidden"
)
API errors
const (
ErrBadURL = "bad or empty url"
)
Library errors
const InputMediaLinkType = "link"
InputMediaLinkType is the discriminator value for InputMediaLink.
Variables ¶
This section is empty.
Functions ¶
func EscapeText ¶
EscapeText takes an input text and escape Telegram markup symbols. In this way we can send a text without being afraid of having to escape the characters manually. Note that you don't have to include the formatting style in the input text, or it will be escaped too. If there is an error, an empty string will be returned.
parseMode is the text formatting mode (ModeMarkdown, ModeMarkdownV2 or ModeHTML) text is the input string that will be escaped
func NewManagedBotLink ¶
todo add comment
func ValidateWebAppData ¶
ValidateWebAppData validate data received via the Web App https://core.telegram.org/bots/webapps#validating-data-received-via-the-web-app
func WriteToHTTPResponse ¶
func WriteToHTTPResponse(w http.ResponseWriter, c Chattable) error
WriteToHTTPResponse writes the request to the HTTP ResponseWriter.
It doesn't support uploading files.
See https://core.telegram.org/bots/api#making-requests-when-getting-updates for details.
Types ¶
type APIResponse ¶
type APIResponse struct {
Ok bool `json:"ok"`
Result json.RawMessage `json:"result,omitempty"`
ErrorCode int `json:"error_code,omitempty"`
Description string `json:"description,omitempty"`
Parameters *ResponseParameters `json:"parameters,omitempty"`
}
APIResponse is a response from the Telegram API with the result stored raw.
type AcceptedGiftTypes ¶
type AcceptedGiftTypes struct {
// UnlimitedGifts is true, if unlimited regular gifts are accepted.
UnlimitedGifts bool `json:"unlimited_gifts"`
// LimitedGifts is true, if limited regular gifts are accepted.
LimitedGifts bool `json:"limited_gifts"`
// UniqueGifts is true, if unique gifts or gifts that can be upgraded to
// unique for free are accepted.
UniqueGifts bool `json:"unique_gifts"`
// PremiumSubscription is true, if a Telegram Premium subscription is
// accepted.
PremiumSubscription bool `json:"premium_subscription"`
// GiftsFromChannels is true, if gifts published by channels are accepted.
//
// optional
GiftsFromChannels bool `json:"gifts_from_channels,omitempty"`
}
AcceptedGiftTypes describes the types of gifts accepted by a user or chat.
type AddStickerConfig ¶
type AddStickerConfig struct {
UserID int64
Name string
Sticker InputSticker
}
AddStickerConfig adds a new sticker to an existing sticker set.
type AffiliateInfo ¶
type AffiliateInfo struct {
// AffiliateUser is the bot or user that received the commission.
//
// optional
AffiliateUser *User `json:"affiliate_user,omitempty"`
// AffiliateChat is the chat that received the commission.
//
// optional
AffiliateChat *Chat `json:"affiliate_chat,omitempty"`
// CommissionPerMille is the number of Telegram Stars received by the
// affiliate for each 1000 Telegram Stars received by the bot from
// referred users.
CommissionPerMille int `json:"commission_per_mille"`
// Amount is the integer amount of Telegram Stars received by the
// affiliate from the transaction, rounded to 0; can be negative.
Amount int `json:"amount"`
// NanostarAmount is the number of 1/1000000000 shares of Telegram Stars
// received by the affiliate. Can be negative.
//
// optional
NanostarAmount int `json:"nanostar_amount,omitempty"`
}
AffiliateInfo contains information about the affiliate that received a commission via an affiliate program.
type Animation ¶
type Animation struct {
// FileID is the identifier for this file, which can be used to download or reuse
// the file
FileID string `json:"file_id"`
// FileUniqueID is the unique identifier for this file, which is supposed to
// be the same over time and for different bots. Can't be used to download
// or reuse the file.
FileUniqueID string `json:"file_unique_id"`
// Width video width as defined by sender
Width int `json:"width"`
// Height video height as defined by sender
Height int `json:"height"`
// Duration of the video in seconds as defined by sender
Duration int `json:"duration"`
// Thumbnail animation thumbnail as defined by sender
//
// optional
Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
// FileName original animation filename as defined by sender
//
// optional
FileName string `json:"file_name,omitempty"`
// MimeType of the file as defined by sender
//
// optional
MimeType string `json:"mime_type,omitempty"`
// FileSize file size
//
// optional
FileSize int64 `json:"file_size,omitempty"`
}
Animation represents an animation file.
type AnimationConfig ¶
type AnimationConfig struct {
BaseFile
EphemeralSendParams
Duration int
Width int
Height int
Thumbnail RequestFileData
Caption string
ParseMode string
CaptionEntities []MessageEntity
ShowCaptionAboveMedia bool
HasSpoiler bool
}
AnimationConfig contains information about a SendAnimation request.
func NewAnimation ¶
func NewAnimation(chatID int64, file RequestFileData) AnimationConfig
NewAnimation creates a new sendAnimation request.
type AnswerChatJoinRequestQueryConfig ¶
type AnswerChatJoinRequestQueryConfig struct {
// ChatJoinRequestQueryID is the unique identifier of the join request
// query. Required.
ChatJoinRequestQueryID string
// Result of the query. Must be one of ChatJoinRequestApprove,
// ChatJoinRequestDecline, or ChatJoinRequestQueue. Required.
Result string
}
AnswerChatJoinRequestQueryConfig processes a received chat join request query. Returns True on success, so use BotAPI.Request.
type AnswerGuestQueryConfig ¶
AnswerGuestQueryConfig replies to a received guest message. The Result is any of the InlineQueryResult* variants describing the message to be sent.
type AnswerWebAppQueryConfig ¶
type AnswerWebAppQueryConfig struct {
// WebAppQueryID is the unique identifier for the query to be answered.
WebAppQueryID string `json:"web_app_query_id"`
// Result is an InlineQueryResult object describing the message to be sent.
Result interface{} `json:"result"`
}
AnswerWebAppQueryConfig is used to set the result of an interaction with a Web App and send a corresponding message on behalf of the user to the chat from which the query originated.
type ApproveChatJoinRequestConfig ¶
type ApproveChatJoinRequestConfig struct {
ChatConfig
UserID int64
}
ApproveChatJoinRequestConfig allows you to approve a chat join request.
type ApproveSuggestedPostConfig ¶
ApproveSuggestedPostConfig approves a suggested post in a direct messages chat.
type Audio ¶
type Audio struct {
// FileID is an identifier for this file, which can be used to download or
// reuse the file
FileID string `json:"file_id"`
// FileUniqueID is the unique identifier for this file, which is supposed to
// be the same over time and for different bots. Can't be used to download
// or reuse the file.
FileUniqueID string `json:"file_unique_id"`
// Duration of the audio in seconds as defined by sender
Duration int `json:"duration"`
// Performer of the audio as defined by sender or by audio tags
//
// optional
Performer string `json:"performer,omitempty"`
// Title of the audio as defined by sender or by audio tags
//
// optional
Title string `json:"title,omitempty"`
// FileName is the original filename as defined by sender
//
// optional
FileName string `json:"file_name,omitempty"`
// MimeType of the file as defined by sender
//
// optional
MimeType string `json:"mime_type,omitempty"`
// FileSize file size
//
// optional
FileSize int64 `json:"file_size,omitempty"`
// Thumbnail is the album cover to which the music file belongs
//
// optional
Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
}
Audio represents an audio file to be treated as music by the Telegram clients.
type AudioConfig ¶
type AudioConfig struct {
BaseFile
EphemeralSendParams
Thumbnail RequestFileData
Caption string
ParseMode string
CaptionEntities []MessageEntity
Duration int
Performer string
Title string
}
AudioConfig contains information about a SendAudio request.
func NewAudio ¶
func NewAudio(chatID int64, file RequestFileData) AudioConfig
NewAudio creates a new sendAudio request.
type BackgroundFill ¶
type BackgroundFill struct {
// Type of the fill. One of "solid", "gradient", "freeform_gradient".
Type string `json:"type"`
// Color is the fill color in RGB format. Set when Type is "solid".
//
// optional
Color int `json:"color,omitempty"`
// TopColor is the top color of the gradient in RGB format. Set when Type
// is "gradient".
//
// optional
TopColor int `json:"top_color,omitempty"`
// BottomColor is the bottom color of the gradient in RGB format. Set
// when Type is "gradient".
//
// optional
BottomColor int `json:"bottom_color,omitempty"`
// RotationAngle is the clockwise rotation angle of the background fill
// in degrees; 0-359. Set when Type is "gradient".
//
// optional
RotationAngle int `json:"rotation_angle,omitempty"`
// Colors is a list of 3 or 4 RGB colors. Set when Type is
// "freeform_gradient".
//
// optional
Colors []int `json:"colors,omitempty"`
}
BackgroundFill describes the way a background is filled based on the selected colors. Flat polymorphic by Type:
- "solid" → Color
- "gradient" → TopColor, BottomColor, RotationAngle
- "freeform_gradient" → Colors (3 or 4 RGB colors)
type BackgroundType ¶
type BackgroundType struct {
// Type of the background. One of "fill", "wallpaper", "pattern",
// "chat_theme".
Type string `json:"type"`
// Fill is the background fill. Set when Type is "fill" or "pattern".
//
// optional
Fill *BackgroundFill `json:"fill,omitempty"`
// DarkThemeDimming is the dimming of the background in dark themes, as
// a percentage; 0-100. Set when Type is "fill" or "wallpaper".
//
// optional
DarkThemeDimming int `json:"dark_theme_dimming,omitempty"`
// Document is the document with the wallpaper/pattern. Set when Type is
// "wallpaper" or "pattern".
//
// optional
Document *Document `json:"document,omitempty"`
// IsBlurred is true, if the wallpaper is downscaled to fit in a 450x450
// square and then box-blurred with radius 12. Set when Type is "wallpaper".
//
// optional
IsBlurred bool `json:"is_blurred,omitempty"`
// IsMoving is true, if the background moves slightly when the device is
// tilted. Set when Type is "wallpaper" or "pattern".
//
// optional
IsMoving bool `json:"is_moving,omitempty"`
// Intensity is the intensity of the pattern when it is shown above the
// filled background; 0-100. Set when Type is "pattern".
//
// optional
Intensity int `json:"intensity,omitempty"`
// IsInverted is true, if the background fill must be applied only to
// the pattern itself. All other pixels are black. Set when Type is
// "pattern".
//
// optional
IsInverted bool `json:"is_inverted,omitempty"`
// ThemeName is the name of the chat theme, which is usually an emoji.
// Set when Type is "chat_theme".
//
// optional
ThemeName string `json:"theme_name,omitempty"`
}
BackgroundType describes the type of a chat background. Flat polymorphic by Type:
- "fill" → Fill, DarkThemeDimming
- "wallpaper" → Document, DarkThemeDimming, IsBlurred, IsMoving
- "pattern" → Document, Fill, Intensity, IsInverted, IsMoving
- "chat_theme" → ThemeName
type BanChatMemberConfig ¶
type BanChatMemberConfig struct {
ChatMemberConfig
UntilDate int64
RevokeMessages bool
}
BanChatMemberConfig contains extra fields to kick user.
type BanChatSenderChatConfig ¶
type BanChatSenderChatConfig struct {
ChatID int64
ChannelUsername string
SenderChatID int64
// Deprecated: banChatSenderChat no longer accepts until_date; sender chats
// are banned until they are explicitly unbanned. The value is ignored by
// Telegram.
UntilDate int
}
BanChatSenderChatConfig bans a channel chat in a supergroup or a channel. The owner of the chat will not be able to send messages and join live streams on behalf of the chat, unless it is unbanned first. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights.
type BaseChat ¶
type BaseChat struct {
ChatID int64 // required
ChannelUsername string
BusinessConnectionID string
MessageThreadID int
DirectMessagesTopicID int
MessageEffectID string
ProtectContent bool
AllowPaidBroadcast bool
ReplyParameters *ReplyParameters
ReplyMarkup interface{}
DisableNotification bool
// SuggestedPostParameters contains 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
}
BaseChat is base type for all chat config types.
type BaseEdit ¶
type BaseEdit struct {
BusinessConnectionID string
ChatID int64
ChannelUsername string
MessageID int
InlineMessageID string
ReplyMarkup *InlineKeyboardMarkup
}
BaseEdit is base type of all chat edits.
type BaseEphemeralEdit ¶
type BaseEphemeralEdit struct {
// ChatID is the unique identifier for the target chat.
ChatID int64
// ChannelUsername is the username of the target supergroup, in the
// @username format. Used when ChatID is not set.
ChannelUsername string
// ReceiverUserID is the identifier of the user who received the message.
ReceiverUserID int64
// EphemeralMessageID is the identifier of the ephemeral message.
EphemeralMessageID int
}
BaseEphemeralEdit is the base type for edits and deletions of ephemeral messages. Ephemeral messages are addressed by the chat they were sent to, the user who received them, and their per-chat ephemeral identifier, so they do not use BaseEdit.
Either ChatID or ChannelUsername must be set; ChannelUsername targets a supergroup in the @username format.
type BaseFile ¶
type BaseFile struct {
BaseChat
File RequestFileData
}
BaseFile is a base type for all file config types.
type BaseInputMedia ¶
type BaseInputMedia struct {
// Type of the result.
Type string `json:"type"`
// Media file to send. Pass a file_id to send a file
// that exists on the Telegram servers (recommended),
// pass an HTTP URL for Telegram to get a file from the Internet,
// or pass “attach://<file_attach_name>” to upload a new one
// using multipart/form-data under <file_attach_name> name.
Media RequestFileData `json:"media"`
// Caption of the video to be sent, 0-1024 characters after entities parsing.
//
// optional
Caption string `json:"caption,omitempty"`
// ParseMode mode for parsing entities in the video caption.
// See formatting options for more details
// (https://core.telegram.org/bots/api#formatting-options).
//
// optional
ParseMode string `json:"parse_mode,omitempty"`
// CaptionEntities is a list of special entities that appear in the caption,
// which can be specified instead of parse_mode
//
// optional
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
// ShowCaptionAboveMedia pass True if the caption must be shown above the
// message media. Valid for photo, video, and animation variants only; the
// field is ignored for audio and document.
//
// optional
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
// HasSpoiler pass True if the media needs to be covered with a spoiler
// animation. Valid for photo, video, and animation variants only; the
// field is ignored for audio and document.
//
// optional
HasSpoiler bool `json:"has_spoiler,omitempty"`
}
BaseInputMedia is a base type for the InputMedia types.
type Birthdate ¶
type Birthdate struct {
// Day of the user's birth; 1-31.
Day int `json:"day"`
// Month of the user's birth; 1-12.
Month int `json:"month"`
// Year of the user's birth.
//
// optional
Year int `json:"year,omitempty"`
}
Birthdate contains information about a user's birthdate.
type BotAPI ¶
type BotAPI struct {
Token string `json:"token"`
Debug bool `json:"debug"`
Buffer int `json:"buffer"`
Self User `json:"-"`
Client HTTPClient `json:"-"`
// contains filtered or unexported fields
}
BotAPI allows you to interact with the Telegram Bot API.
func NewBotAPI ¶
NewBotAPI creates a new BotAPI instance.
It requires a token, provided by @BotFather on Telegram.
Example ¶
bot, err := NewBotAPI("MyAwesomeBotToken")
if err != nil {
panic(err)
}
bot.Debug = true
log.Printf("Authorized on account %s", bot.Self.UserName)
u := NewUpdate(0)
u.Timeout = 60
updates := bot.GetUpdatesChan(u)
// Optional: wait for updates and clear them if you don't want to handle
// a large backlog of old messages
time.Sleep(time.Millisecond * 500)
updates.Clear()
for update := range updates {
if update.Message == nil {
continue
}
log.Printf("[%s] %s", update.Message.From.UserName, update.Message.Text)
msg := NewMessage(update.Message.Chat.ID, update.Message.Text)
msg.ReplyParameters = &ReplyParameters{MessageID: update.Message.MessageID}
bot.Send(msg)
}
func NewBotAPIWithAPIEndpoint ¶
NewBotAPIWithAPIEndpoint creates a new BotAPI instance and allows you to pass API endpoint.
It requires a token, provided by @BotFather on Telegram and API endpoint.
func NewBotAPIWithClient ¶
func NewBotAPIWithClient(token, apiEndpoint string, client HTTPClient) (*BotAPI, error)
NewBotAPIWithClient creates a new BotAPI instance and allows you to pass a http.Client.
It requires a token, provided by @BotFather on Telegram and API endpoint.
func (*BotAPI) AnswerGuestQuery ¶
func (bot *BotAPI) AnswerGuestQuery(config AnswerGuestQueryConfig) (SentGuestMessage, error)
AnswerGuestQuery replies to a received guest message and returns the resulting SentGuestMessage.
func (*BotAPI) AnswerWebAppQuery ¶
func (bot *BotAPI) AnswerWebAppQuery(config AnswerWebAppQueryConfig) (SentWebAppMessage, error)
AnswerWebAppQuery sets the result of an interaction with a Web App and send a corresponding message on behalf of the user to the chat from which the query originated.
func (*BotAPI) CopyMessage ¶
func (bot *BotAPI) CopyMessage(config CopyMessageConfig) (MessageID, error)
CopyMessage copy messages of any kind. The method is analogous to the method forwardMessage, but the copied message doesn't have a link to the original message. Returns the MessageID of the sent message on success.
func (*BotAPI) CopyMessages ¶
func (bot *BotAPI) CopyMessages(config CopyMessagesConfig) ([]MessageID, error)
CopyMessages copies messages of any kind and returns the identifiers of the sent messages.
func (*BotAPI) CreateForumTopic ¶
func (bot *BotAPI) CreateForumTopic(config CreateForumTopicConfig) (ForumTopic, error)
CreateForumTopic creates a topic in a forum supergroup chat and returns information about the created topic.
func (*BotAPI) EditStory ¶
func (bot *BotAPI) EditStory(config EditStoryConfig) (Story, error)
EditStory edits a story previously posted by the bot and returns the edited Story.
func (*BotAPI) FileLink ¶
FileLink returns the full download URL for the given File, using the file endpoint configured on this BotAPI instance.
func (*BotAPI) ForwardMessages ¶
func (bot *BotAPI) ForwardMessages(config ForwardMessagesConfig) ([]MessageID, error)
ForwardMessages forwards multiple messages of any kind and returns the identifiers of the sent messages.
func (*BotAPI) GetAvailableGifts ¶
GetAvailableGifts returns the list of gifts that can be sent by the bot to users.
func (*BotAPI) GetBusinessAccountGifts ¶
func (bot *BotAPI) GetBusinessAccountGifts(config GetBusinessAccountGiftsConfig) (OwnedGifts, error)
GetBusinessAccountGifts returns the gifts received and owned by a managed business account.
func (*BotAPI) GetBusinessAccountStarBalance ¶
func (bot *BotAPI) GetBusinessAccountStarBalance(config GetBusinessAccountStarBalanceConfig) (StarAmount, error)
GetBusinessAccountStarBalance returns the amount of Telegram Stars owned by a managed business account.
func (*BotAPI) GetBusinessConnection ¶
func (bot *BotAPI) GetBusinessConnection(config GetBusinessConnectionConfig) (BusinessConnection, error)
GetBusinessConnection returns information about the connection of the bot with a business account.
func (*BotAPI) GetChat ¶
func (bot *BotAPI) GetChat(config ChatInfoConfig) (ChatFullInfo, error)
GetChat gets full information about a chat.
As of Bot API 7.3 the return type is ChatFullInfo, which embeds Chat and adds the fields that are only populated by getChat.
func (*BotAPI) GetChatAdministrators ¶
func (bot *BotAPI) GetChatAdministrators(config ChatAdministratorsConfig) ([]ChatMember, error)
GetChatAdministrators gets a list of administrators in the chat.
If none have been appointed, only the creator will be returned. Bots are not shown, even if they are an administrator.
func (*BotAPI) GetChatGifts ¶
func (bot *BotAPI) GetChatGifts(config GetChatGiftsConfig) (OwnedGifts, error)
GetChatGifts returns the list of gifts received and owned by a chat.
func (*BotAPI) GetChatMember ¶
func (bot *BotAPI) GetChatMember(config GetChatMemberConfig) (ChatMember, error)
GetChatMember gets a specific chat member.
func (*BotAPI) GetChatMemberCount ¶
func (bot *BotAPI) GetChatMemberCount(config ChatMemberCountConfig) (int, error)
GetChatMemberCount gets the number of members in a chat.
func (*BotAPI) GetChatMembersCount
deprecated
func (bot *BotAPI) GetChatMembersCount(config ChatMemberCountConfig) (int, error)
GetChatMembersCount gets the number of users in a chat.
Deprecated: use GetChatMemberCount, which matches the Bot API method name.
func (*BotAPI) GetCustomEmojiStickers ¶
func (bot *BotAPI) GetCustomEmojiStickers(config GetCustomEmojiStickersConfig) ([]Sticker, error)
GetCustomEmojiStickers returns information about custom emoji stickers by their identifiers.
func (*BotAPI) GetFile ¶
func (bot *BotAPI) GetFile(config FileConfig) (File, error)
GetFile returns a File which can download a file from Telegram.
Requires FileID.
func (*BotAPI) GetFileDirectURL ¶
GetFileDirectURL returns direct URL to file
It requires the FileID.
func (*BotAPI) GetForumTopicIconStickers ¶
GetForumTopicIconStickers returns custom emoji stickers, which can be used as a forum topic icon by any user.
func (*BotAPI) GetGameHighScores ¶
func (bot *BotAPI) GetGameHighScores(config GetGameHighScoresConfig) ([]GameHighScore, error)
GetGameHighScores allows you to get the high scores for a game.
func (*BotAPI) GetInviteLink ¶
func (bot *BotAPI) GetInviteLink(config ChatInviteLinkConfig) (string, error)
GetInviteLink get InviteLink for a chat
func (*BotAPI) GetManagedBotAccessSettings ¶
func (bot *BotAPI) GetManagedBotAccessSettings(config GetManagedBotAccessSettingsConfig) (BotAccessSettings, error)
GetManagedBotAccessSettings returns the access settings of a managed bot.
func (*BotAPI) GetManagedBotToken ¶
func (bot *BotAPI) GetManagedBotToken(config GetManagedBotTokenConfig) (string, error)
GetManagedBotToken returns the token of a managed bot.
func (*BotAPI) GetMe ¶
GetMe fetches the currently authenticated bot.
This method is called upon creation to validate the token, and so you may get this data from BotAPI.Self without the need for another request.
func (*BotAPI) GetMyCommands ¶
func (bot *BotAPI) GetMyCommands() ([]BotCommand, error)
GetMyCommands gets the currently registered commands.
func (*BotAPI) GetMyCommandsWithConfig ¶
func (bot *BotAPI) GetMyCommandsWithConfig(config GetMyCommandsConfig) ([]BotCommand, error)
GetMyCommandsWithConfig gets the currently registered commands with a config.
func (*BotAPI) GetMyDefaultAdministratorRights ¶
func (bot *BotAPI) GetMyDefaultAdministratorRights(config GetMyDefaultAdministratorRightsConfig) (ChatAdministratorRights, error)
GetMyDefaultAdministratorRights gets the current default administrator rights of the bot.
func (*BotAPI) GetMyDescription ¶
func (bot *BotAPI) GetMyDescription(config GetMyDescriptionConfig) (BotDescription, error)
GetMyDescription returns the current bot description for the given user language.
func (*BotAPI) GetMyName ¶
func (bot *BotAPI) GetMyName(config GetMyNameConfig) (BotName, error)
GetMyName returns the current bot name for the given user language.
func (*BotAPI) GetMyShortDescription ¶
func (bot *BotAPI) GetMyShortDescription(config GetMyShortDescriptionConfig) (BotShortDescription, error)
GetMyShortDescription returns the current bot short description for the given user language.
func (*BotAPI) GetMyStarBalance ¶
func (bot *BotAPI) GetMyStarBalance() (StarAmount, error)
GetMyStarBalance returns the current Telegram Stars balance of the bot.
func (*BotAPI) GetStarTransactions ¶
func (bot *BotAPI) GetStarTransactions(config GetStarTransactionsConfig) (StarTransactions, error)
GetStarTransactions returns the bot's Telegram Star transactions in chronological order.
func (*BotAPI) GetStickerSet ¶
func (bot *BotAPI) GetStickerSet(config GetStickerSetConfig) (StickerSet, error)
GetStickerSet returns a StickerSet.
func (*BotAPI) GetUpdates ¶
func (bot *BotAPI) GetUpdates(config UpdateConfig) ([]Update, error)
GetUpdates fetches updates. If a WebHook is set, this will not return any data!
Offset, Limit, Timeout, and AllowedUpdates are optional. To avoid stale items, set Offset to one higher than the previous item. Set Timeout to a large number to reduce requests, so you can get updates instantly instead of having to wait between requests.
func (*BotAPI) GetUpdatesChan ¶
func (bot *BotAPI) GetUpdatesChan(config UpdateConfig) UpdatesChannel
GetUpdatesChan starts and returns a channel for getting updates.
func (*BotAPI) GetUserChatBoosts ¶
func (bot *BotAPI) GetUserChatBoosts(config GetUserChatBoostsConfig) (UserChatBoosts, error)
GetUserChatBoosts returns the list of boosts added to a chat by a user.
func (*BotAPI) GetUserGifts ¶
func (bot *BotAPI) GetUserGifts(config GetUserGiftsConfig) (OwnedGifts, error)
GetUserGifts returns the list of gifts received and owned by a user.
func (*BotAPI) GetUserPersonalChatMessages ¶
func (bot *BotAPI) GetUserPersonalChatMessages(config GetUserPersonalChatMessagesConfig) ([]Message, error)
GetUserPersonalChatMessages returns the last messages from the personal chat of a user.
func (*BotAPI) GetUserProfileAudios ¶
func (bot *BotAPI) GetUserProfileAudios(config GetUserProfileAudiosConfig) (UserProfileAudios, error)
GetUserProfileAudios fetches a list of audios added to the profile of a user.
func (*BotAPI) GetUserProfilePhotos ¶
func (bot *BotAPI) GetUserProfilePhotos(config UserProfilePhotosConfig) (UserProfilePhotos, error)
GetUserProfilePhotos gets a user's profile photos.
It requires UserID. Offset and Limit are optional.
func (*BotAPI) GetWebhookInfo ¶
func (bot *BotAPI) GetWebhookInfo() (WebhookInfo, error)
GetWebhookInfo allows you to fetch information about a webhook and if one currently is set, along with pending update count and error messages.
func (*BotAPI) HandleUpdate ¶
HandleUpdate parses and returns update received via webhook
func (*BotAPI) IsMessageToMe ¶
IsMessageToMe returns true if message directed to this bot.
It requires the Message.
func (*BotAPI) ListenForWebhook ¶
func (bot *BotAPI) ListenForWebhook(pattern string) UpdatesChannel
ListenForWebhook registers a http handler for a webhook.
func (*BotAPI) ListenForWebhookRespReqFormat ¶
func (bot *BotAPI) ListenForWebhookRespReqFormat(w http.ResponseWriter, r *http.Request) UpdatesChannel
ListenForWebhookRespReqFormat registers a http handler for a single incoming webhook.
func (*BotAPI) MakeRequest ¶
func (bot *BotAPI) MakeRequest(endpoint string, params Params) (*APIResponse, error)
MakeRequest makes a request to a specific endpoint with our token.
func (*BotAPI) PostStory ¶
func (bot *BotAPI) PostStory(config PostStoryConfig) (Story, error)
PostStory posts a story on behalf of a managed business account and returns the posted Story.
func (*BotAPI) ReplaceManagedBotToken ¶
func (bot *BotAPI) ReplaceManagedBotToken(config ReplaceManagedBotTokenConfig) (string, error)
ReplaceManagedBotToken revokes the current token of a managed bot and generates a new one. Returns the new token.
func (*BotAPI) RepostStory ¶
func (bot *BotAPI) RepostStory(config RepostStoryConfig) (Story, error)
RepostStory reposts a story across different business accounts managed by the bot and returns the newly posted Story.
func (*BotAPI) Request ¶
func (bot *BotAPI) Request(c Chattable) (*APIResponse, error)
Request sends a Chattable to Telegram, and returns the APIResponse.
func (*BotAPI) SavePreparedInlineMessage ¶
func (bot *BotAPI) SavePreparedInlineMessage(config SavePreparedInlineMessageConfig) (PreparedInlineMessage, error)
SavePreparedInlineMessage stores a message that can be sent by a user of a Mini App and returns a PreparedInlineMessage.
func (*BotAPI) SavePreparedKeyboardButton ¶
func (bot *BotAPI) SavePreparedKeyboardButton(config SavePreparedKeyboardButtonConfig) (PreparedKeyboardButton, error)
SavePreparedKeyboardButton stores a keyboard button that can be used by a user within a Mini App. Returns a PreparedKeyboardButton.
func (*BotAPI) Send ¶
Send will send a Chattable item to Telegram and provides the returned Message.
Some Bot API methods (banChatMember, setChatTitle, sendChatAction, etc.) return a bare `true` on success rather than a Message. Send tolerates that shape and returns a zero Message with nil error, so callers that reach for Send by reflex don't get a confusing JSON unmarshal error. Prefer Request for methods whose documented return type is not a Message.
func (*BotAPI) SendMediaGroup ¶
func (bot *BotAPI) SendMediaGroup(config MediaGroupConfig) ([]Message, error)
SendMediaGroup sends a media group and returns the resulting messages.
func (*BotAPI) SetAPIEndpoint ¶
SetAPIEndpoint changes the Telegram Bot API endpoint used by the instance.
func (*BotAPI) SetFileEndpoint ¶
SetFileEndpoint changes the file download endpoint used by the instance. The value must be a format string with two %s placeholders for token and file path, matching the default FileEndpoint constant.
func (*BotAPI) StopPoll ¶
func (bot *BotAPI) StopPoll(config StopPollConfig) (Poll, error)
StopPoll stops a poll and returns the result.
func (*BotAPI) StopReceivingUpdates ¶
func (bot *BotAPI) StopReceivingUpdates()
StopReceivingUpdates stops the go routine which receives updates
func (*BotAPI) UploadFiles ¶
func (bot *BotAPI) UploadFiles(endpoint string, params Params, files []RequestFile) (*APIResponse, error)
UploadFiles makes a request to the API with files.
type BotAccessSettings ¶
type BotAccessSettings struct {
// IsAccessRestricted is true, if only selected users can access the
// bot. The bot's owner can always access it.
IsAccessRestricted bool `json:"is_access_restricted"`
// AddedUsers is the list of other users who have access to the bot if
// the access is restricted.
//
// optional
AddedUsers []User `json:"added_users,omitempty"`
}
BotAccessSettings describes the access settings of a managed bot.
type 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 of the command, 3-256 characters.
Description string `json:"description"`
// IsEphemeral is true if the result of the command is an ephemeral
// message, visible only to the user who sent the command and the bot.
//
// optional
IsEphemeral bool `json:"is_ephemeral,omitempty"`
}
BotCommand represents a bot command.
type BotCommandScope ¶
type BotCommandScope struct {
Type string `json:"type"`
ChatID int64 `json:"chat_id,omitempty"`
UserID int64 `json:"user_id,omitempty"`
}
BotCommandScope represents the scope to which bot commands are applied.
It contains the fields for all types of scopes, different types only support specific (or no) fields.
func NewBotCommandScopeAllChatAdministrators ¶
func NewBotCommandScopeAllChatAdministrators() BotCommandScope
NewBotCommandScopeAllChatAdministrators represents the scope of bot commands, covering all group and supergroup chat administrators.
func NewBotCommandScopeAllGroupChats ¶
func NewBotCommandScopeAllGroupChats() BotCommandScope
NewBotCommandScopeAllGroupChats represents the scope of bot commands, covering all group and supergroup chats.
func NewBotCommandScopeAllPrivateChats ¶
func NewBotCommandScopeAllPrivateChats() BotCommandScope
NewBotCommandScopeAllPrivateChats represents the scope of bot commands, covering all private chats.
func NewBotCommandScopeChat ¶
func NewBotCommandScopeChat(chatID int64) BotCommandScope
NewBotCommandScopeChat represents the scope of bot commands, covering a specific chat.
func NewBotCommandScopeChatAdministrators ¶
func NewBotCommandScopeChatAdministrators(chatID int64) BotCommandScope
NewBotCommandScopeChatAdministrators represents the scope of bot commands, covering all administrators of a specific group or supergroup chat.
func NewBotCommandScopeChatMember ¶
func NewBotCommandScopeChatMember(chatID, userID int64) BotCommandScope
NewBotCommandScopeChatMember represents the scope of bot commands, covering a specific member of a group or supergroup chat.
func NewBotCommandScopeDefault ¶
func NewBotCommandScopeDefault() BotCommandScope
NewBotCommandScopeDefault represents the default scope of bot commands.
type BotDescription ¶
type BotDescription struct {
Description string `json:"description"`
}
BotDescription represents the bot's description.
type BotLogger ¶
type BotLogger interface {
Println(v ...interface{})
Printf(format string, v ...interface{})
}
BotLogger is an interface that represents the required methods to log data.
Instead of requiring the standard logger, we can just specify the methods we use and allow users to pass anything that implements these.
type BotShortDescription ¶
type BotShortDescription struct {
ShortDescription string `json:"short_description"`
}
BotShortDescription represents the bot's short description, shown on the bot's profile page and sent together with the link when users share the bot.
type BotSubscriptionUpdated ¶
type BotSubscriptionUpdated struct {
// User who subscribed for payments toward the bot.
User User `json:"user"`
// InvoicePayload is the bot-specified invoice payload.
InvoicePayload string `json:"invoice_payload"`
// State is the new state of the subscription, one of the
// BotSubscriptionState* constants.
State string `json:"state"`
}
BotSubscriptionUpdated contains information about changes to a user payment subscription toward the current bot.
type BusinessBotRights ¶
type BusinessBotRights struct {
// CanReply is true, if the bot can send and edit messages in the chats
// that were active in the last 24 hours.
//
// optional
CanReply bool `json:"can_reply,omitempty"`
// CanReadMessages is true, if the bot can mark incoming private messages as read.
//
// optional
CanReadMessages bool `json:"can_read_messages,omitempty"`
// CanDeleteSentMessages is true, if the bot can delete sent messages.
//
// optional
CanDeleteSentMessages bool `json:"can_delete_sent_messages,omitempty"`
// CanDeleteAllMessages is true, if the bot can delete any message.
//
// optional
CanDeleteAllMessages bool `json:"can_delete_all_messages,omitempty"`
// CanEditName is true, if the bot can edit the first and last name of the account.
//
// optional
CanEditName bool `json:"can_edit_name,omitempty"`
// CanEditBio is true, if the bot can edit the bio of the account.
//
// optional
CanEditBio bool `json:"can_edit_bio,omitempty"`
// CanEditProfilePhoto is true, if the bot can edit the profile photo of the account.
//
// optional
CanEditProfilePhoto bool `json:"can_edit_profile_photo,omitempty"`
// CanEditUsername is true, if the bot can edit the username of the account.
//
// optional
CanEditUsername bool `json:"can_edit_username,omitempty"`
// CanChangeGiftSettings is true, if the bot can change the privacy settings
// pertaining to gifts for the account.
//
// optional
CanChangeGiftSettings bool `json:"can_change_gift_settings,omitempty"`
// CanViewGiftsAndStars is true, if the bot can view gifts and the amount
// of Telegram Stars owned by the account.
//
// optional
CanViewGiftsAndStars bool `json:"can_view_gifts_and_stars,omitempty"`
// CanConvertGiftsToStars is true, if the bot can convert regular gifts owned
// by the account to Telegram Stars.
//
// optional
CanConvertGiftsToStars bool `json:"can_convert_gifts_to_stars,omitempty"`
// CanTransferAndUpgradeGifts is true, if the bot can transfer and upgrade
// gifts owned by the account.
//
// optional
CanTransferAndUpgradeGifts bool `json:"can_transfer_and_upgrade_gifts,omitempty"`
// CanTransferStars is true, if the bot can transfer Telegram Stars received
// by the account.
//
// optional
CanTransferStars bool `json:"can_transfer_stars,omitempty"`
// CanManageStories is true, if the bot can post, edit and delete stories
// on behalf of the account.
//
// optional
CanManageStories bool `json:"can_manage_stories,omitempty"`
}
BusinessBotRights represents the rights of a business bot.
type BusinessConnection ¶
type BusinessConnection struct {
// ID is the unique identifier of the business connection.
ID string `json:"id"`
// User is the business account user that created the business connection.
User User `json:"user"`
// UserChatID is the identifier of a private chat with the user who
// created the business connection.
UserChatID int64 `json:"user_chat_id"`
// Date the connection was established in Unix time.
Date int `json:"date"`
// Rights is the rights of the business bot.
//
// optional
Rights *BusinessBotRights `json:"rights,omitempty"`
// IsEnabled is true, if the connection is active.
IsEnabled bool `json:"is_enabled"`
}
BusinessConnection describes the connection of the bot with a business account.
type BusinessIntro ¶
type BusinessIntro struct {
// Title text of the business intro.
//
// optional
Title string `json:"title,omitempty"`
// Message text of the business intro.
//
// optional
Message string `json:"message,omitempty"`
// Sticker of the business intro.
//
// optional
Sticker *Sticker `json:"sticker,omitempty"`
}
BusinessIntro contains information about the intro of a business.
type BusinessLocation ¶
type BusinessLocation struct {
// Address of the business.
Address string `json:"address"`
// Location of the business.
//
// optional
Location *Location `json:"location,omitempty"`
}
BusinessLocation contains information about the location of a business.
type BusinessMessagesDeleted ¶
type BusinessMessagesDeleted struct {
// BusinessConnectionID is the unique identifier of the business connection.
BusinessConnectionID string `json:"business_connection_id"`
// Chat in which the messages were deleted. The bot may not have access to
// the chat or the corresponding user.
Chat Chat `json:"chat"`
// MessageIDs is the list of identifiers of deleted messages in the chat.
MessageIDs []int `json:"message_ids"`
}
BusinessMessagesDeleted is received when messages are deleted from a connected business account.
type BusinessOpeningHours ¶
type BusinessOpeningHours struct {
// TimeZoneName is the unique name of the time zone for which the opening
// hours are defined.
TimeZoneName string `json:"time_zone_name"`
// OpeningHours is the list of time intervals describing business opening
// hours.
OpeningHours []BusinessOpeningHoursInterval `json:"opening_hours"`
}
BusinessOpeningHours describes the opening hours of a business.
type BusinessOpeningHoursInterval ¶
type BusinessOpeningHoursInterval struct {
// OpeningMinute is the minute's sequence number in a week, starting on
// Monday, marking the start of the time interval during which the
// business is open; 0 - 7 * 24 * 60.
OpeningMinute int `json:"opening_minute"`
// ClosingMinute is the minute's sequence number in a week, starting on
// Monday, marking the end of the time interval during which the business
// is open; 0 - 8 * 24 * 60.
ClosingMinute int `json:"closing_minute"`
}
BusinessOpeningHoursInterval describes an interval of time during which a business is open.
type CallbackConfig ¶
type CallbackConfig struct {
CallbackQueryID string `json:"callback_query_id"`
Text string `json:"text"`
ShowAlert bool `json:"show_alert"`
URL string `json:"url"`
CacheTime int `json:"cache_time"`
}
CallbackConfig contains information on making a CallbackQuery response.
func NewCallback ¶
func NewCallback(id, text string) CallbackConfig
NewCallback creates a new callback message.
func NewCallbackWithAlert ¶
func NewCallbackWithAlert(id, text string) CallbackConfig
NewCallbackWithAlert creates a new callback message that alerts the user.
type CallbackGame ¶
type CallbackGame struct{}
CallbackGame is for starting a game in an inline keyboard button.
type CallbackQuery ¶
type CallbackQuery struct {
// ID unique identifier for this query
ID string `json:"id"`
// From sender
From *User `json:"from"`
// Message with the callback button that originated the query. The message
// can be inaccessible (deleted or otherwise unreachable) — in that case
// only Message.MessageID and Message.Chat are populated and Message.Date
// is 0. See InaccessibleMessage for the equivalent dedicated type.
//
// optional
Message *Message `json:"message,omitempty"`
// InlineMessageID identifier of the message sent via the bot in inline
// mode, that originated the query.
//
// optional
InlineMessageID string `json:"inline_message_id,omitempty"`
// ChatInstance global identifier, uniquely corresponding to the chat to
// which the message with the callback button was sent. Useful for high
// scores in games.
ChatInstance string `json:"chat_instance"`
// Data associated with the callback button. Be aware that
// a bad client can send arbitrary data in this field.
//
// optional
Data string `json:"data,omitempty"`
// GameShortName short name of a Game to be returned, serves as the unique identifier for the game.
//
// optional
GameShortName string `json:"game_short_name,omitempty"`
}
CallbackQuery represents an incoming callback query from a callback button in an inline keyboard. If the button that originated the query was attached to a message sent by the bot, the field message will be present. If the button was attached to a message sent via the bot (in inline mode), the field inline_message_id will be present. Exactly one of the fields data or game_short_name will be present.
type Chat ¶
type Chat struct {
// ID is a unique identifier for this chat
ID int64 `json:"id"`
// Type of chat, can be either “private”, “group”, “supergroup” or “channel”
Type string `json:"type"`
// Title for supergroups, channels and group chats
//
// optional
Title string `json:"title,omitempty"`
// UserName for private chats, supergroups and channels if available
//
// optional
UserName string `json:"username,omitempty"`
// FirstName of the other party in a private chat
//
// optional
FirstName string `json:"first_name,omitempty"`
// LastName of the other party in a private chat
//
// optional
LastName string `json:"last_name,omitempty"`
// IsForum is true, if the supergroup chat is a forum (has topics enabled)
//
// optional
IsForum bool `json:"is_forum,omitempty"`
// IsDirectMessages is true, if the chat is a supergroup that serves as
// a direct messages chat for a channel.
//
// optional
IsDirectMessages bool `json:"is_direct_messages,omitempty"`
}
Chat represents a chat.
func (Chat) ChatConfig ¶
func (c Chat) ChatConfig() ChatConfig
ChatConfig returns a ChatConfig struct for chat related methods.
func (Chat) IsSuperGroup ¶
IsSuperGroup returns if the Chat is a supergroup.
type ChatActionConfig ¶
ChatActionConfig contains information about a SendChatAction request.
func NewChatAction ¶
func NewChatAction(chatID int64, action string) ChatActionConfig
NewChatAction sets a chat action. Actions last for 5 seconds, or until your next action.
chatID is where to send it, action should be set via Chat constants.
type ChatAdministratorRights ¶
type ChatAdministratorRights struct {
IsAnonymous bool `json:"is_anonymous"`
CanManageChat bool `json:"can_manage_chat"`
CanDeleteMessages bool `json:"can_delete_messages"`
CanManageVideoChats bool `json:"can_manage_video_chats"`
CanRestrictMembers bool `json:"can_restrict_members"`
CanPromoteMembers bool `json:"can_promote_members"`
CanChangeInfo bool `json:"can_change_info"`
CanInviteUsers bool `json:"can_invite_users"`
CanPostMessages bool `json:"can_post_messages"`
CanEditMessages bool `json:"can_edit_messages"`
CanPinMessages bool `json:"can_pin_messages"`
CanPostStories bool `json:"can_post_stories"`
CanEditStories bool `json:"can_edit_stories"`
CanDeleteStories bool `json:"can_delete_stories"`
CanManageTopics bool `json:"can_manage_topics"`
CanManageDirectMessages bool `json:"can_manage_direct_messages"`
CanManageTags bool `json:"can_manage_tags"`
CanSendWelcomeMessages bool `json:"can_send_welcome_messages"`
}
type ChatAdministratorsConfig ¶
type ChatAdministratorsConfig struct {
ChatConfig
// ReturnBots, if true, additionally returns bots that are administrators
// of the chat. By default, bots other than the current bot are omitted.
ReturnBots bool
}
ChatAdministratorsConfig contains information about getting chat administrators.
type ChatBackground ¶
type ChatBackground struct {
// Type of the background.
Type BackgroundType `json:"type"`
}
ChatBackground represents a chat background.
type ChatBoost ¶
type ChatBoost struct {
// BoostID is the unique identifier of the boost.
BoostID string `json:"boost_id"`
// AddDate is the point in time (Unix timestamp) when the chat was boosted.
AddDate int `json:"add_date"`
// ExpirationDate is the point in time (Unix timestamp) when the boost
// will automatically expire, unless it's renewed by the premium subscriber.
ExpirationDate int `json:"expiration_date"`
// Source of the added boost.
Source ChatBoostSource `json:"source"`
}
ChatBoost contains information about a chat boost.
type ChatBoostAdded ¶
type ChatBoostAdded struct {
// BoostCount is the number of boosts added by the user.
BoostCount int `json:"boost_count"`
}
ChatBoostAdded represents a service message about a user boosting a chat.
type ChatBoostRemoved ¶
type ChatBoostRemoved struct {
// Chat which was boosted.
Chat Chat `json:"chat"`
// BoostID is the unique identifier of the boost.
BoostID string `json:"boost_id"`
// RemoveDate is the point in time (Unix timestamp) when the boost was removed.
RemoveDate int `json:"remove_date"`
// Source of the removed boost.
Source ChatBoostSource `json:"source"`
}
ChatBoostRemoved represents a boost removed from a chat.
type ChatBoostSource ¶
type ChatBoostSource struct {
// Source of the boost. One of "premium", "gift_code", "giveaway".
Source string `json:"source"`
// User that boosted the chat. Set for "premium" and "gift_code"; for
// "giveaway" set to the user that won the prize, if any.
//
// optional
User *User `json:"user,omitempty"`
// GiveawayMessageID is the identifier of the message with the giveaway in
// the chat. Set for "giveaway".
//
// optional
GiveawayMessageID int `json:"giveaway_message_id,omitempty"`
// IsUnclaimed is true if the giveaway was completed but no user won the
// prize. Set for "giveaway".
//
// optional
IsUnclaimed bool `json:"is_unclaimed,omitempty"`
// PrizeStarCount is the number of Telegram Stars to be split between
// giveaway winners. Set for "giveaway" and only for Telegram Star
// giveaways.
//
// optional
PrizeStarCount int `json:"prize_star_count,omitempty"`
}
ChatBoostSource describes the source of a chat boost. The Source field discriminates between concrete variants:
- "premium" → User is set (the user that boosted the chat)
- "gift_code" → User is set (the user for which the gift code was created)
- "giveaway" → GiveawayMessageID is set; User is set for the prize winner; IsUnclaimed is true if the giveaway prize wasn't claimed
type ChatBoostUpdated ¶
type ChatBoostUpdated struct {
// Chat which was boosted.
Chat Chat `json:"chat"`
// Boost is information about the chat boost.
Boost ChatBoost `json:"boost"`
}
ChatBoostUpdated represents a boost added to a chat or changed.
type ChatConfig ¶
ChatConfig contains information about getting information on a chat.
type ChatConfigWithUser ¶
ChatConfigWithUser contains information about a chat and a user.
type ChatFullInfo ¶
type ChatFullInfo struct {
Chat
// ActiveUsernames is a list of all active chat usernames; for private chats,
// supergroups and channels.
//
// optional
ActiveUsernames []string `json:"active_usernames,omitempty"`
// EmojiStatusCustomEmojiID is the custom emoji identifier of emoji status of
// the other party in a private chat.
//
// optional
EmojiStatusCustomEmojiID string `json:"emoji_status_custom_emoji_id,omitempty"`
// EmojiStatusExpirationDate is the expiration date of the emoji status of
// the other party in a private chat in Unix time, if any.
//
// optional
EmojiStatusExpirationDate int64 `json:"emoji_status_expiration_date,omitempty"`
// AccentColorID is the identifier of the accent color for the chat name
// and backgrounds of the chat photo, reply header, and link preview.
//
// optional
AccentColorID int `json:"accent_color_id,omitempty"`
// BackgroundCustomEmojiID is the custom emoji identifier of the emoji
// chosen by the chat for the reply header and link preview background.
//
// optional
BackgroundCustomEmojiID string `json:"background_custom_emoji_id,omitempty"`
// ProfileAccentColorID is the identifier of the accent color for the
// chat's profile background.
//
// optional
ProfileAccentColorID int `json:"profile_accent_color_id,omitempty"`
// ProfileBackgroundCustomEmojiID is the custom emoji identifier of the
// emoji chosen by the chat for its profile background.
//
// optional
ProfileBackgroundCustomEmojiID string `json:"profile_background_custom_emoji_id,omitempty"`
// HasVisibleHistory is true, if new chat members will have access to old
// messages; available only to chat administrators.
//
// optional
HasVisibleHistory bool `json:"has_visible_history,omitempty"`
// HasHiddenMembers is true, if non-administrators can only see bots and
// administrators in the chat.
//
// optional
HasHiddenMembers bool `json:"has_hidden_members,omitempty"`
// HasAggressiveAntiSpamEnabled is true, if aggressive anti-spam checks are
// enabled in the supergroup. Visible only to chat administrators. Returned
// only in getChat.
//
// optional
HasAggressiveAntiSpamEnabled bool `json:"has_aggressive_anti_spam_enabled,omitempty"`
// UnrestrictBoostCount is the minimum number of boosts that a non-administrator
// user needs to add to the chat in order to ignore slow mode and chat
// permissions.
//
// optional
UnrestrictBoostCount int `json:"unrestrict_boost_count,omitempty"`
// CustomEmojiStickerSetName is the name of the chat's custom emoji sticker
// set.
//
// optional
CustomEmojiStickerSetName string `json:"custom_emoji_sticker_set_name,omitempty"`
// Birthdate of the other party in a private chat.
//
// optional
Birthdate *Birthdate `json:"birthdate,omitempty"`
// BusinessIntro is the intro of the business account. Returned only in
// getChat for business accounts.
//
// optional
BusinessIntro *BusinessIntro `json:"business_intro,omitempty"`
// BusinessLocation is the location of the business account. Returned only
// in getChat for business accounts.
//
// optional
BusinessLocation *BusinessLocation `json:"business_location,omitempty"`
// BusinessOpeningHours is the opening hours of the business account.
// Returned only in getChat for business accounts.
//
// optional
BusinessOpeningHours *BusinessOpeningHours `json:"business_opening_hours,omitempty"`
// PersonalChat is the personal channel of the private chat's user.
// Returned only in getChat for private chats.
//
// optional
PersonalChat *Chat `json:"personal_chat,omitempty"`
// Photo is a chat photo
Photo *ChatPhoto `json:"photo,omitempty"`
// Bio is the bio of the other party in a private chat. Returned only in
// getChat
//
// optional
Bio string `json:"bio,omitempty"`
// HasPrivateForwards is true if privacy settings of the other party in the
// private chat allows to use tg://user?id=<user_id> links only in chats
// with the user.
//
// optional
HasPrivateForwards bool `json:"has_private_forwards,omitempty"`
// HasRestrictedVoiceAndVideoMessages is true, if the privacy settings of the
// other party restrict sending voice and video note messages in the private
// chat.
//
// optional
HasRestrictedVoiceAndVideoMessages bool `json:"has_restricted_voice_and_video_messages,omitempty"`
// Description for groups, supergroups and channel chats
//
// optional
Description string `json:"description,omitempty"`
// JoinToSendMessages is true, if users need to join the supergroup before
// they can send messages.
//
// optional
JoinToSendMessages bool `json:"join_to_send_messages,omitempty"`
// JoinByRequest is true, if all users directly joining the supergroup need
// to be approved by supergroup administrators.
//
// optional
JoinByRequest bool `json:"join_by_request,omitempty"`
// InviteLink is a chat invite link, for groups, supergroups and channel chats.
// Each administrator in a chat generates their own invite links,
// so the bot must first generate the link using exportChatInviteLink
//
// optional
InviteLink string `json:"invite_link,omitempty"`
// PinnedMessage is the pinned message, for groups, supergroups and channels
//
// optional
PinnedMessage *Message `json:"pinned_message,omitempty"`
// AvailableReactions is the list of available reactions allowed in the
// chat. If omitted, then all emoji reactions are allowed. Returned only
// in getChat.
//
// optional
AvailableReactions []ReactionType `json:"available_reactions,omitempty"`
// Permissions are default chat member permissions, for groups and
// supergroups.
//
// optional
Permissions *ChatPermissions `json:"permissions,omitempty"`
// SlowModeDelay is for supergroups, the minimum allowed delay between
// consecutive messages sent by each unprivileged user.
//
// optional
SlowModeDelay int `json:"slow_mode_delay,omitempty"`
// MessageAutoDeleteTime is the time after which all messages sent to the
// chat will be automatically deleted; in seconds.
//
// optional
MessageAutoDeleteTime int `json:"message_auto_delete_time,omitempty"`
// HasProtectedContent is true if messages from the chat can't be forwarded
// to other chats.
//
// optional
HasProtectedContent bool `json:"has_protected_content,omitempty"`
// StickerSetName is for supergroups, name of group sticker set.Returned
// only in getChat.
//
// optional
StickerSetName string `json:"sticker_set_name,omitempty"`
// CanSetStickerSet is true, if the bot can change the group sticker set.
//
// optional
CanSetStickerSet bool `json:"can_set_sticker_set,omitempty"`
// LinkedChatID is a unique identifier for the linked chat, i.e. the
// discussion group identifier for a channel and vice versa; for supergroups
// and channel chats.
//
// optional
LinkedChatID int64 `json:"linked_chat_id,omitempty"`
// Location is for supergroups, the location to which the supergroup is
// connected.
//
// optional
Location *ChatLocation `json:"location,omitempty"`
// MaxReactionCount is the maximum number of reactions that can be set
// on a message in the chat.
MaxReactionCount int `json:"max_reaction_count"`
// CanSendPaidMedia is true, if paid media messages can be sent or
// forwarded to the channel chat. Channel chats only.
//
// optional
CanSendPaidMedia bool `json:"can_send_paid_media,omitempty"`
// AcceptedGiftTypes are the types of gifts accepted by the chat.
AcceptedGiftTypes AcceptedGiftTypes `json:"accepted_gift_types"`
// ParentChat is the parent channel chat for a channel direct messages chat.
//
// optional
ParentChat *Chat `json:"parent_chat,omitempty"`
// Community is the community the chat belongs to.
//
// optional
Community *Community `json:"community,omitempty"`
// Rating is the rating of the user in a private chat.
//
// optional
Rating *UserRating `json:"rating,omitempty"`
// PaidMessageStarCount is the number of Telegram Stars that must be
// paid by non-administrator users of the supergroup chat for each sent
// message.
//
// optional
PaidMessageStarCount int `json:"paid_message_star_count,omitempty"`
// UniqueGiftColors defines the color scheme for the chat's name, replies
// to messages, and link previews based on a unique gift.
//
// optional
UniqueGiftColors *UniqueGiftColors `json:"unique_gift_colors,omitempty"`
// FirstProfileAudio is the first audio on the user profile.
//
// optional
FirstProfileAudio *Audio `json:"first_profile_audio,omitempty"`
// GuardBot is the bot that processes join request queries in the chat.
// The field is only available to chat administrators.
//
// optional
GuardBot *User `json:"guard_bot,omitempty"`
}
ChatFullInfo contains full information about a chat. This is the return type of getChat as of Bot API 7.3. It embeds Chat so all Chat fields are accessible via field promotion.
type ChatInfoConfig ¶
type ChatInfoConfig struct {
ChatConfig
}
ChatInfoConfig contains information about getting chat information.
type ChatInviteLink ¶
type ChatInviteLink struct {
// InviteLink is the invite link. If the link was created by another chat
// administrator, then the second part of the link will be replaced with “…”.
InviteLink string `json:"invite_link"`
// Creator of the link.
Creator User `json:"creator"`
// CreatesJoinRequest is true if users joining the chat via the link need to
// be approved by chat administrators.
//
// optional
CreatesJoinRequest bool `json:"creates_join_request,omitempty"`
// IsPrimary is true, if the link is primary.
IsPrimary bool `json:"is_primary"`
// IsRevoked is true, if the link is revoked.
IsRevoked bool `json:"is_revoked"`
// Name is the name of the invite link.
//
// optional
Name string `json:"name,omitempty"`
// ExpireDate is the point in time (Unix timestamp) when the link will
// expire or has been expired.
//
// optional
ExpireDate int `json:"expire_date,omitempty"`
// MemberLimit is the maximum number of users that can be members of the
// chat simultaneously after joining the chat via this invite link; 1-99999.
//
// optional
MemberLimit int `json:"member_limit,omitempty"`
// PendingJoinRequestCount is the number of pending join requests created
// using this link.
//
// optional
PendingJoinRequestCount int `json:"pending_join_request_count,omitempty"`
// SubscriptionPeriod is the number of seconds the subscription will be
// active for before the next payment.
//
// optional
SubscriptionPeriod int `json:"subscription_period,omitempty"`
// SubscriptionPrice is the amount of Telegram Stars a user must pay
// initially and after each subsequent subscription period to be a member
// of the chat using the link.
//
// optional
SubscriptionPrice int `json:"subscription_price,omitempty"`
}
ChatInviteLink represents an invite link for a chat.
type ChatInviteLinkConfig ¶
type ChatInviteLinkConfig struct {
ChatConfig
}
ChatInviteLinkConfig contains information about getting a chat link.
Note that generating a new link will revoke any previous links.
type ChatJoinRequest ¶
type ChatJoinRequest struct {
// Chat to which the request was sent.
Chat Chat `json:"chat"`
// User that sent the join request.
From User `json:"from"`
// UserChatID is the identifier of a private chat with the user who sent the
// join request. The bot can use this identifier for 5 minutes to send messages
// until the join request is processed, assuming no other administrator
// contacted the user.
UserChatID int64 `json:"user_chat_id"`
// Date the request was sent in Unix time.
Date int `json:"date"`
// Bio of the user.
//
// optional
Bio string `json:"bio,omitempty"`
// InviteLink is the link that was used by the user to send the join request.
//
// optional
InviteLink *ChatInviteLink `json:"invite_link,omitempty"`
// QueryID is the identifier of the join request query; for bots assigned
// to process join requests only. If present, then the bot must call
// sendChatJoinRequestWebApp or directly call answerChatJoinRequestQuery
// within 10 seconds.
//
// optional
QueryID string `json:"query_id,omitempty"`
}
ChatJoinRequest represents a join request sent to a chat.
type ChatLocation ¶
type ChatLocation struct {
// Location is the location to which the supergroup is connected. Can't be a
// live location.
Location Location `json:"location"`
// Address is the location address; 1-64 characters, as defined by the chat
// owner
Address string `json:"address"`
}
ChatLocation represents a location to which a chat is connected.
type ChatMember ¶
type ChatMember struct {
// User information about the user
User *User `json:"user"`
// Status the member's status in the chat.
// Can be
// “creator”,
// “administrator”,
// “member”,
// “restricted”,
// “left” or
// “kicked”
Status string `json:"status"`
// CustomTitle owner and administrators only. Custom title for this user
//
// optional
CustomTitle string `json:"custom_title,omitempty"`
// IsAnonymous owner and administrators only. True, if the user's presence
// in the chat is hidden
//
// optional
IsAnonymous bool `json:"is_anonymous,omitempty"`
// UntilDate restricted and kicked only.
// Date when restrictions will be lifted for this user;
// unix time.
//
// optional
UntilDate int64 `json:"until_date,omitempty"`
// CanBeEdited administrators only.
// True, if the bot is allowed to edit administrator privileges of that user.
//
// optional
CanBeEdited bool `json:"can_be_edited,omitempty"`
// CanManageChat administrators only.
// True, if the administrator can access the chat event log, chat
// statistics, message statistics in channels, see channel members, see
// anonymous administrators in supergroups and ignore slow mode. Implied by
// any other administrator privilege.
//
// optional
CanManageChat bool `json:"can_manage_chat,omitempty"`
// CanPostMessages administrators only.
// True, if the administrator can post in the channel;
// channels only.
//
// optional
CanPostMessages bool `json:"can_post_messages,omitempty"`
// CanEditMessages administrators only.
// True, if the administrator can edit messages of other users and can pin messages;
// channels only.
//
// optional
CanEditMessages bool `json:"can_edit_messages,omitempty"`
// CanDeleteMessages administrators only.
// True, if the administrator can delete messages of other users.
//
// optional
CanDeleteMessages bool `json:"can_delete_messages,omitempty"`
// CanManageVideoChats administrators only.
// True, if the administrator can manage video chats.
//
// optional
CanManageVideoChats bool `json:"can_manage_video_chats,omitempty"`
// CanRestrictMembers administrators only.
// True, if the administrator can restrict, ban or unban chat members.
//
// optional
CanRestrictMembers bool `json:"can_restrict_members,omitempty"`
// CanPromoteMembers administrators only.
// True, if the administrator can add new administrators
// with a subset of their own privileges or demote administrators that he has promoted,
// directly or indirectly (promoted by administrators that were appointed by the user).
//
// optional
CanPromoteMembers bool `json:"can_promote_members,omitempty"`
// CanChangeInfo administrators and restricted only.
// True, if the user is allowed to change the chat title, photo and other settings.
//
// optional
CanChangeInfo bool `json:"can_change_info,omitempty"`
// CanInviteUsers administrators and restricted only.
// True, if the user is allowed to invite new users to the chat.
//
// optional
CanInviteUsers bool `json:"can_invite_users,omitempty"`
// CanPinMessages administrators and restricted only.
// True, if the user is allowed to pin messages; groups and supergroups only
//
// optional
CanPinMessages bool `json:"can_pin_messages,omitempty"`
// CanPostStories administrators only.
// True, if the administrator can post stories to the chat.
//
// optional
CanPostStories bool `json:"can_post_stories,omitempty"`
// CanEditStories administrators only.
// True, if the administrator can edit stories posted by other users.
//
// optional
CanEditStories bool `json:"can_edit_stories,omitempty"`
// CanDeleteStories administrators only.
// True, if the administrator can delete stories posted by other users.
//
// optional
CanDeleteStories bool `json:"can_delete_stories,omitempty"`
// CanManageTopics administrators and restricted only.
// True, if the user is allowed to create, rename, close, and reopen
// forum topics; supergroups only.
//
// optional
CanManageTopics bool `json:"can_manage_topics,omitempty"`
// CanManageDirectMessages administrators only.
// True, if the administrator can manage direct messages within the
// channel and decline suggested posts; for channels only.
//
// optional
CanManageDirectMessages bool `json:"can_manage_direct_messages,omitempty"`
// CanManageTags administrators only.
// True, if the administrator can manage tags of chat members.
//
// optional
CanManageTags bool `json:"can_manage_tags,omitempty"`
// CanSendWelcomeMessages administrators only.
// True, if the administrator can manage chat welcome messages or directly
// send them in the case of bots.
//
// optional
CanSendWelcomeMessages bool `json:"can_send_welcome_messages,omitempty"`
// Tag is the member's custom tag in the chat, if any.
//
// optional
Tag string `json:"tag,omitempty"`
// CanEditTag is true, if the user is allowed to edit their own tag.
//
// optional
CanEditTag bool `json:"can_edit_tag,omitempty"`
// IsMember is true, if the user is a member of the chat at the moment of
// the request
IsMember bool `json:"is_member"`
// CanSendMessages restricted only.
// True, if the user is allowed to send text messages, contacts,
// invoices, locations and venues.
//
// optional
CanSendMessages bool `json:"can_send_messages,omitempty"`
// CanSendAudios restricted only. True, if the user is allowed to send audios.
//
// optional
CanSendAudios bool `json:"can_send_audios,omitempty"`
// CanSendDocuments restricted only. True, if the user is allowed to send documents.
//
// optional
CanSendDocuments bool `json:"can_send_documents,omitempty"`
// CanSendPhotos restricted only. True, if the user is allowed to send photos.
//
// optional
CanSendPhotos bool `json:"can_send_photos,omitempty"`
// CanSendVideos restricted only. True, if the user is allowed to send videos.
//
// optional
CanSendVideos bool `json:"can_send_videos,omitempty"`
// CanSendVideoNotes restricted only. True, if the user is allowed to send video notes.
//
// optional
CanSendVideoNotes bool `json:"can_send_video_notes,omitempty"`
// CanSendVoiceNotes restricted only. True, if the user is allowed to send voice notes.
//
// optional
CanSendVoiceNotes bool `json:"can_send_voice_notes,omitempty"`
// CanSendPolls restricted only.
// True, if the user is allowed to send polls
//
// optional
CanSendPolls bool `json:"can_send_polls,omitempty"`
// CanSendOtherMessages restricted only.
// True, if the user is allowed to send animations, games, stickers and use inline bots.
//
// optional
CanSendOtherMessages bool `json:"can_send_other_messages,omitempty"`
// CanAddWebPagePreviews restricted only.
// True, if the user is allowed to add web page previews to their messages.
//
// optional
CanAddWebPagePreviews bool `json:"can_add_web_page_previews,omitempty"`
// CanReactToMessages restricted only.
// True, if the user is allowed to react to messages.
//
// optional
CanReactToMessages bool `json:"can_react_to_messages,omitempty"`
}
ChatMember contains information about one member of a chat.
func (ChatMember) HasLeft ¶
func (chat ChatMember) HasLeft() bool
HasLeft returns if the ChatMember left the chat.
func (ChatMember) IsAdministrator ¶
func (chat ChatMember) IsAdministrator() bool
IsAdministrator returns if the ChatMember is a chat administrator.
func (ChatMember) IsCreator ¶
func (chat ChatMember) IsCreator() bool
IsCreator returns if the ChatMember was the creator of the chat.
func (ChatMember) WasKicked ¶
func (chat ChatMember) WasKicked() bool
WasKicked returns if the ChatMember was kicked from the chat.
type ChatMemberConfig ¶
type ChatMemberConfig struct {
ChatID int64
SuperGroupUsername string
ChannelUsername string
UserID int64
}
ChatMemberConfig contains information about a user in a chat for use with administrative functions such as kicking or unbanning a user.
type ChatMemberCountConfig ¶
type ChatMemberCountConfig struct {
ChatConfig
}
ChatMemberCountConfig contains information about getting the number of users in a chat.
type ChatMemberUpdated ¶
type ChatMemberUpdated struct {
// Chat the user belongs to.
Chat Chat `json:"chat"`
// From is the performer of the action, which resulted in the change.
From User `json:"from"`
// Date the change was done in Unix time.
Date int `json:"date"`
// Previous information about the chat member.
OldChatMember ChatMember `json:"old_chat_member"`
// New information about the chat member.
NewChatMember ChatMember `json:"new_chat_member"`
// InviteLink is the link which was used by the user to join the chat;
// for joining by invite link events only.
//
// optional
InviteLink *ChatInviteLink `json:"invite_link,omitempty"`
// ViaJoinRequest is true, if the user joined the chat after sending a
// direct join request without using an invite link and being approved
// by an administrator.
//
// optional
ViaJoinRequest bool `json:"via_join_request,omitempty"`
// ViaChatFolderInviteLink is true, if the user joined the chat via a chat
// folder invite link.
//
// optional
ViaChatFolderInviteLink bool `json:"via_chat_folder_invite_link,omitempty"`
}
ChatMemberUpdated represents changes in the status of a chat member.
type ChatOwnerChanged ¶
type ChatOwnerChanged struct {
// NewOwner is the new owner of the chat.
NewOwner User `json:"new_owner"`
}
ChatOwnerChanged represents a service message about a change of the chat owner.
type ChatOwnerLeft ¶
type ChatOwnerLeft struct {
// NewOwner is the user who will become the new owner of the chat if the
// previous owner does not return to the chat.
//
// optional
NewOwner *User `json:"new_owner,omitempty"`
}
ChatOwnerLeft represents a service message about the chat owner leaving the chat.
type ChatPermissions ¶
type ChatPermissions struct {
// CanSendMessages is true, if the user is allowed to send text messages,
// contacts, invoices, locations and venues
//
// optional
CanSendMessages bool `json:"can_send_messages,omitempty"`
// CanSendAudios is true, if the user is allowed to send audios.
//
// optional
CanSendAudios bool `json:"can_send_audios,omitempty"`
// CanSendDocuments is true, if the user is allowed to send documents.
//
// optional
CanSendDocuments bool `json:"can_send_documents,omitempty"`
// CanSendPhotos is true, if the user is allowed to send photos.
//
// optional
CanSendPhotos bool `json:"can_send_photos,omitempty"`
// CanSendVideos is true, if the user is allowed to send videos.
//
// optional
CanSendVideos bool `json:"can_send_videos,omitempty"`
// CanSendVideoNotes is true, if the user is allowed to send video notes.
//
// optional
CanSendVideoNotes bool `json:"can_send_video_notes,omitempty"`
// CanSendVoiceNotes is true, if the user is allowed to send voice notes.
//
// optional
CanSendVoiceNotes bool `json:"can_send_voice_notes,omitempty"`
// CanSendPolls is true, if the user is allowed to send polls.
//
// optional
CanSendPolls bool `json:"can_send_polls,omitempty"`
// CanSendOtherMessages is true, if the user is allowed to send animations,
// games, stickers and use inline bots.
//
// optional
CanSendOtherMessages bool `json:"can_send_other_messages,omitempty"`
// CanAddWebPagePreviews is true, if the user is allowed to add web page
// previews to their messages.
//
// optional
CanAddWebPagePreviews bool `json:"can_add_web_page_previews,omitempty"`
// CanReactToMessages is true, if the user is allowed to react to
// messages. If omitted, defaults to the value of CanSendMessages.
//
// optional
CanReactToMessages bool `json:"can_react_to_messages,omitempty"`
// CanChangeInfo is true, if the user is allowed to change the chat title,
// photo and other settings. Ignored in public supergroups
//
// optional
CanChangeInfo bool `json:"can_change_info,omitempty"`
// CanInviteUsers is true, if the user is allowed to invite new users to the
// chat
//
// optional
CanInviteUsers bool `json:"can_invite_users,omitempty"`
// CanPinMessages is true, if the user is allowed to pin messages. Ignored
// in public supergroups
//
// optional
CanPinMessages bool `json:"can_pin_messages,omitempty"`
// CanManageTopics is true, if the user is allowed to create forum topics.
// If omitted defaults to the value of can_pin_messages
//
// optional
CanManageTopics bool `json:"can_manage_topics,omitempty"`
// CanEditTag is true, if users are allowed to edit their own tag.
//
// optional
CanEditTag bool `json:"can_edit_tag,omitempty"`
}
ChatPermissions describes actions that a non-administrator user is allowed to take in a chat. All fields are optional.
type ChatPhoto ¶
type ChatPhoto struct {
// SmallFileID is a file identifier of small (160x160) chat photo.
// This file_id can be used only for photo download and
// only for as long as the photo is not changed.
SmallFileID string `json:"small_file_id"`
// SmallFileUniqueID is a unique file identifier of small (160x160) chat
// photo, which is supposed to be the same over time and for different bots.
// Can't be used to download or reuse the file.
SmallFileUniqueID string `json:"small_file_unique_id"`
// BigFileID is a file identifier of big (640x640) chat photo.
// This file_id can be used only for photo download and
// only for as long as the photo is not changed.
BigFileID string `json:"big_file_id"`
// BigFileUniqueID is a file identifier of big (640x640) chat photo, which
// is supposed to be the same over time and for different bots. Can't be
// used to download or reuse the file.
BigFileUniqueID string `json:"big_file_unique_id"`
}
ChatPhoto represents a chat photo.
type ChatShared ¶
type ChatShared struct {
RequestID int `json:"request_id"`
ChatID int64 `json:"chat_id"`
//
// optional
Title string `json:"title,omitempty"`
// available.
//
// optional
Username string `json:"username,omitempty"`
//
// optional
Photo []PhotoSize `json:"photo,omitempty"`
}
ChatShared contains information about the chat whose identifier was shared with the bot using a KeyboardButtonRequestChat button.
type Chattable ¶
type Chattable interface {
// contains filtered or unexported methods
}
Chattable is any config type that can be sent.
type Checklist ¶
type Checklist struct {
// Title is the title of the checklist.
Title string `json:"title"`
// TitleEntities are the special entities that appear in the title.
//
// optional
TitleEntities []MessageEntity `json:"title_entities,omitempty"`
// Tasks is the list of tasks in the checklist.
Tasks []ChecklistTask `json:"tasks"`
// OthersCanAddTasks is true, if users other than the creator can add
// tasks to the checklist.
//
// optional
OthersCanAddTasks bool `json:"others_can_add_tasks,omitempty"`
// OthersCanMarkTasksAsDone is true, if users other than the creator
// can mark tasks as done or not done.
//
// optional
OthersCanMarkTasksAsDone bool `json:"others_can_mark_tasks_as_done,omitempty"`
}
Checklist describes a checklist on a message.
type ChecklistTask ¶
type ChecklistTask struct {
// ID is the unique identifier of the task.
ID int `json:"id"`
// Text is the text of the task.
Text string `json:"text"`
// TextEntities are the special entities that appear in the task text.
//
// optional
TextEntities []MessageEntity `json:"text_entities,omitempty"`
// CompletedByUser is the user that completed the task; for tasks that
// were completed.
//
// optional
CompletedByUser *User `json:"completed_by_user,omitempty"`
// CompletedByChat is the chat that completed the task on behalf of
// an anonymous user.
//
// optional
CompletedByChat *Chat `json:"completed_by_chat,omitempty"`
// CompletionDate is the point in time (Unix timestamp) when the task
// was completed; 0 for tasks that weren't completed.
//
// optional
CompletionDate int `json:"completion_date,omitempty"`
}
ChecklistTask describes a task in a checklist.
type ChecklistTasksAdded ¶
type ChecklistTasksAdded struct {
// ChecklistMessage is the message containing the checklist to which
// the tasks were added.
//
// optional
ChecklistMessage *Message `json:"checklist_message,omitempty"`
// Tasks is the list of tasks added to the checklist.
Tasks []ChecklistTask `json:"tasks"`
}
ChecklistTasksAdded describes a service message about tasks added to a checklist.
type ChecklistTasksDone ¶
type ChecklistTasksDone struct {
// ChecklistMessage is the message containing the checklist whose tasks
// were marked as done or not done. Note that the Message object in this
// field will not contain the ReplyToMessage field even if it itself is
// a reply.
//
// optional
ChecklistMessage *Message `json:"checklist_message,omitempty"`
// MarkedAsDoneTaskIDs are the IDs of tasks that were marked as done.
//
// optional
MarkedAsDoneTaskIDs []int `json:"marked_as_done_task_ids,omitempty"`
// MarkedAsNotDoneTaskIDs are the IDs of tasks that were marked as not
// done.
//
// optional
MarkedAsNotDoneTaskIDs []int `json:"marked_as_not_done_task_ids,omitempty"`
}
ChecklistTasksDone describes a service message about tasks in a checklist being marked as done or not done.
type ChosenInlineResult ¶
type ChosenInlineResult struct {
// ResultID the unique identifier for the result that was chosen
ResultID string `json:"result_id"`
// From the user that chose the result
From *User `json:"from"`
// Location sender location, only for bots that require user location
//
// optional
Location *Location `json:"location,omitempty"`
// InlineMessageID identifier of the sent inline message.
// Available only if there is an inline keyboard attached to the message.
// Will be also received in callback queries and can be used to edit the message.
//
// optional
InlineMessageID string `json:"inline_message_id,omitempty"`
// Query the query that was used to obtain the result
Query string `json:"query"`
}
ChosenInlineResult is an inline query result chosen by a User
type CloseConfig ¶
type CloseConfig struct{}
CloseConfig is a request to close the bot instance on a local server.
Note that you may not close an instance for the first 10 minutes after the bot has started.
type CloseForumTopicConfig ¶
type CloseForumTopicConfig struct {
ChatID int64
SuperGroupUsername string
MessageThreadID int // required
}
CloseForumTopicConfig closes an open topic in a forum supergroup chat. The bot must have the can_manage_topics administrator rights, unless it is the creator of the topic.
type CloseGeneralForumTopicConfig ¶
CloseGeneralForumTopicConfig closes an open 'General' topic in a forum supergroup chat. The bot must have the can_manage_topics administrator rights.
type Community ¶
type Community struct {
// ID is the unique identifier for this community.
ID int64 `json:"id"`
// Name of the community.
Name string `json:"name"`
}
Community represents a community, a group of chats linked together around a shared topic or audience.
type CommunityChatAdded ¶
type CommunityChatAdded struct {
// Community is the new community to which the chat belongs.
Community Community `json:"community"`
}
CommunityChatAdded describes a service message about a chat being added to a community.
type CommunityChatJoined ¶
type CommunityChatJoined struct {
// Community is the community from which the chat was joined.
Community Community `json:"community"`
}
CommunityChatJoined describes a service message about a chat being joined by a user from a community.
type CommunityChatRemoved ¶
type CommunityChatRemoved struct{}
CommunityChatRemoved describes a service message about a chat being removed from a community. Currently holds no information.
type Contact ¶
type Contact struct {
// PhoneNumber contact's phone number
PhoneNumber string `json:"phone_number"`
// FirstName contact's first name
FirstName string `json:"first_name"`
// LastName contact's last name
//
// optional
LastName string `json:"last_name,omitempty"`
// UserID contact's user identifier in Telegram
//
// optional
UserID int64 `json:"user_id,omitempty"`
// VCard is additional data about the contact in the form of a vCard.
//
// optional
VCard string `json:"vcard,omitempty"`
}
Contact represents a phone contact.
Note that LastName and UserID may be empty.
type ContactConfig ¶
type ContactConfig struct {
BaseChat
EphemeralSendParams
PhoneNumber string
FirstName string
LastName string
VCard string
}
ContactConfig allows you to send a contact.
func NewContact ¶
func NewContact(chatID int64, phoneNumber, firstName string) ContactConfig
NewContact allows you to send a shared contact.
type ConvertGiftToStarsConfig ¶
ConvertGiftToStarsConfig converts a given regular gift to Telegram Stars.
type CopyMessageConfig ¶
type CopyMessageConfig struct {
BaseChat
FromChatID int64
FromChannelUsername string
MessageID int
VideoStartTimestamp int
Caption string
ParseMode string
CaptionEntities []MessageEntity
ShowCaptionAboveMedia bool
}
CopyMessageConfig contains information about a copyMessage request.
func NewCopyMessage ¶
func NewCopyMessage(chatID int64, fromChatID int64, messageID int) CopyMessageConfig
NewCopyMessage creates a new copy message.
chatID is where to send it, fromChatID is the source chat, and messageID is the ID of the original message.
type CopyMessagesConfig ¶
type CopyMessagesConfig struct {
ChatID int64
ChannelUsername string
MessageThreadID int
DirectMessagesTopicID int
FromChatID int64
FromChannelUsername string
MessageIDs []int // 1-100 message identifiers, must be in strictly increasing order
DisableNotification bool
ProtectContent bool
RemoveCaption bool
}
CopyMessagesConfig copies messages of any kind. If some of the specified messages can't be found or copied, they are skipped. Service messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. Album grouping is kept for copied messages.
type CopyTextButton ¶
type CopyTextButton struct {
// Text is the text to be copied to the clipboard; 1-256 characters.
Text string `json:"text"`
}
CopyTextButton represents an inline keyboard button that copies specified text to the clipboard when pressed.
type CreateChatInviteLinkConfig ¶
type CreateChatInviteLinkConfig struct {
ChatConfig
Name string
ExpireDate int
MemberLimit int
CreatesJoinRequest bool
}
CreateChatInviteLinkConfig allows you to create an additional invite link for a chat. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. The link can be revoked using the RevokeChatInviteLinkConfig.
type CreateChatSubscriptionInviteLinkConfig ¶
type CreateChatSubscriptionInviteLinkConfig struct {
ChatConfig
Name string
SubscriptionPeriod int // required, in seconds; currently must be 2592000 (30 days)
SubscriptionPrice int // required, 1-10000 Telegram Stars
}
CreateChatSubscriptionInviteLinkConfig creates a subscription invite link for a channel chat. The bot must have the can_invite_users administrator rights. The link can be edited using EditChatSubscriptionInviteLinkConfig or revoked using RevokeChatInviteLinkConfig.
type CreateForumTopicConfig ¶
type CreateForumTopicConfig struct {
ChatID int64
SuperGroupUsername string
Name string // required, 1-128 characters
IconColor int
IconCustomEmojiID string
}
CreateForumTopicConfig creates a topic in a forum supergroup chat. The bot must have the can_manage_topics administrator rights. Returns information about the created topic as a ForumTopic object.
type Credentials ¶
type Credentials struct {
Data SecureData `json:"secure_data"`
// Nonce the same nonce given in the request
Nonce string `json:"nonce"`
}
Credentials contains encrypted data.
type DataCredentials ¶
type DataCredentials struct {
// DataHash checksum of encrypted data
DataHash string `json:"data_hash"`
// Secret of encrypted data
Secret string `json:"secret"`
}
DataCredentials contains information required to decrypt data.
type DeclineChatJoinRequest ¶
type DeclineChatJoinRequest struct {
ChatConfig
UserID int64
}
DeclineChatJoinRequest allows you to decline a chat join request.
type DeclineSuggestedPostConfig ¶
DeclineSuggestedPostConfig declines a suggested post in a direct messages chat.
type DeleteAllMessageReactionsConfig ¶
type DeleteAllMessageReactionsConfig struct {
ChatID int64
ChannelUsername string
UserID int64
ActorChatID int64
}
DeleteAllMessageReactionsConfig removes up to 10000 recent reactions in a group or supergroup added by a given user or chat. The bot must have the can_delete_messages administrator right. Either UserID or ActorChatID identifies whose reactions are removed.
type DeleteBusinessMessagesConfig ¶
DeleteBusinessMessagesConfig deletes messages on behalf of a business account.
type DeleteChatPhotoConfig ¶
DeleteChatPhotoConfig allows you to delete a group, supergroup, or channel's photo.
func NewDeleteChatPhoto ¶
func NewDeleteChatPhoto(chatID int64) DeleteChatPhotoConfig
NewDeleteChatPhoto allows you to delete the photo for a chat.
type DeleteChatStickerSetConfig ¶
DeleteChatStickerSetConfig allows you to remove a supergroup's sticker set.
type DeleteEphemeralMessageConfig ¶
type DeleteEphemeralMessageConfig struct {
BaseEphemeralEdit
}
DeleteEphemeralMessageConfig allows you to delete an ephemeral message. Delivery of the deletion is not guaranteed, especially if the user is offline.
func NewDeleteEphemeralMessage ¶
func NewDeleteEphemeralMessage(chatID, receiverUserID int64, ephemeralMessageID int) DeleteEphemeralMessageConfig
NewDeleteEphemeralMessage allows you to delete an ephemeral message sent to receiverUserID in the given chat.
type DeleteForumTopicConfig ¶
type DeleteForumTopicConfig struct {
ChatID int64
SuperGroupUsername string
MessageThreadID int // required
}
DeleteForumTopicConfig deletes a forum topic along with all its messages in a forum supergroup chat. The bot must have the can_delete_messages administrator rights.
type DeleteMessageConfig ¶
DeleteMessageConfig contains information of a message in a chat to delete.
func NewDeleteMessage ¶
func NewDeleteMessage(chatID int64, messageID int) DeleteMessageConfig
NewDeleteMessage creates a request to delete a message.
type DeleteMessageReactionConfig ¶
type DeleteMessageReactionConfig struct {
ChatID int64
ChannelUsername string
MessageID int
UserID int64
ActorChatID int64
}
DeleteMessageReactionConfig removes a reaction from a message in a group or supergroup. The bot must have the can_delete_messages administrator right. Either UserID or ActorChatID identifies whose reaction is removed.
type DeleteMessagesConfig ¶
type DeleteMessagesConfig struct {
ChatID int64
ChannelUsername string
MessageIDs []int // 1-100 message identifiers
}
DeleteMessagesConfig deletes multiple messages simultaneously. If some of the specified messages can't be found, they are skipped.
type DeleteMyCommandsConfig ¶
type DeleteMyCommandsConfig struct {
Scope *BotCommandScope
LanguageCode string
}
func NewDeleteMyCommands ¶
func NewDeleteMyCommands() DeleteMyCommandsConfig
NewDeleteMyCommands allows you to delete the registered commands.
func NewDeleteMyCommandsWithScope ¶
func NewDeleteMyCommandsWithScope(scope BotCommandScope) DeleteMyCommandsConfig
NewDeleteMyCommandsWithScope allows you to delete the registered commands for a given scope.
func NewDeleteMyCommandsWithScopeAndLanguage ¶
func NewDeleteMyCommandsWithScopeAndLanguage(scope BotCommandScope, languageCode string) DeleteMyCommandsConfig
NewDeleteMyCommandsWithScopeAndLanguage allows you to delete the registered commands for a given scope and language code.
type DeleteStickerConfig ¶
type DeleteStickerConfig struct {
Sticker string
}
DeleteStickerConfig allows you to delete a sticker from a set.
type DeleteStickerSetConfig ¶
type DeleteStickerSetConfig struct {
Name string
}
DeleteStickerSetConfig deletes a sticker set created by the bot.
type DeleteStoryConfig ¶
DeleteStoryConfig deletes a story previously posted by the bot on behalf of a managed business account.
type DeleteWebhookConfig ¶
type DeleteWebhookConfig struct {
DropPendingUpdates bool
}
DeleteWebhookConfig is a helper to delete a webhook.
type Dice ¶
type Dice struct {
// Emoji on which the dice throw animation is based
Emoji string `json:"emoji"`
// Value of the dice
Value int `json:"value"`
}
Dice represents an animated emoji that displays a random value.
type DiceConfig ¶
type DiceConfig struct {
BaseChat
// 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
}
DiceConfig contains information about a sendDice request.
func NewDiceWithEmoji ¶
func NewDiceWithEmoji(chatID int64, emoji string) DiceConfig
NewDiceWithEmoji allows you to send a random roll of one of many types.
Emoji may be 🎲 (1-6), 🎯 (1-6), or 🏀 (1-5).
type DirectMessagePriceChanged ¶
type DirectMessagePriceChanged struct {
// AreDirectMessagesEnabled is true, if direct messages are enabled
// for the channel chat.
AreDirectMessagesEnabled bool `json:"are_direct_messages_enabled"`
// DirectMessageStarCount is the new number of Telegram Stars that
// must be paid to send each direct message.
//
// optional
DirectMessageStarCount int `json:"direct_message_star_count,omitempty"`
}
DirectMessagePriceChanged describes a service message about a change in the pricing of direct messages sent to a channel chat.
type DirectMessagesTopic ¶
type DirectMessagesTopic struct {
// TopicID is the unique identifier of the topic.
TopicID int `json:"topic_id"`
// User is the information about the user that created the topic.
// Currently, the user is always present for topics in direct messages
// chats of channel direct messages chats.
//
// optional
User *User `json:"user,omitempty"`
}
DirectMessagesTopic describes a topic of a direct messages chat.
type DisabledButton ¶
type DisabledButton struct{}
DisabledButton represents a disabled button which does nothing. Currently holds no information.
type Document ¶
type Document struct {
// FileID is an identifier for this file, which can be used to download or
// reuse the file
FileID string `json:"file_id"`
// FileUniqueID is the unique identifier for this file, which is supposed to
// be the same over time and for different bots. Can't be used to download
// or reuse the file.
FileUniqueID string `json:"file_unique_id"`
// Thumbnail document thumbnail as defined by sender
//
// optional
Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
// FileName original filename as defined by sender
//
// optional
FileName string `json:"file_name,omitempty"`
// MimeType of the file as defined by sender
//
// optional
MimeType string `json:"mime_type,omitempty"`
// FileSize file size
//
// optional
FileSize int64 `json:"file_size,omitempty"`
}
Document represents a general file.
type DocumentConfig ¶
type DocumentConfig struct {
BaseFile
EphemeralSendParams
Thumbnail RequestFileData
Caption string
ParseMode string
CaptionEntities []MessageEntity
DisableContentTypeDetection bool
}
DocumentConfig contains information about a SendDocument request.
func NewDocument ¶
func NewDocument(chatID int64, file RequestFileData) DocumentConfig
NewDocument creates a new sendDocument request.
type EditChatInviteLinkConfig ¶
type EditChatInviteLinkConfig struct {
ChatConfig
InviteLink string
Name string
ExpireDate int
MemberLimit int
CreatesJoinRequest bool
}
EditChatInviteLinkConfig allows you to edit a non-primary invite link created by the bot. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
type EditChatSubscriptionInviteLinkConfig ¶
type EditChatSubscriptionInviteLinkConfig struct {
ChatConfig
InviteLink string
Name string
}
EditChatSubscriptionInviteLinkConfig edits a subscription invite link created by the bot. Only the Name field can be edited.
type EditEphemeralMessageCaptionConfig ¶
type EditEphemeralMessageCaptionConfig struct {
BaseEphemeralEdit
// Caption is the new caption of the message, 0-1024 characters after
// entities parsing.
Caption string
// ParseMode is the mode for parsing entities in the message caption.
ParseMode string
// CaptionEntities is a list of special entities that appear in the
// caption, which can be specified instead of ParseMode.
CaptionEntities []MessageEntity
// ShowCaptionAboveMedia shows the caption above the message media.
// Supported only for animation, photo, and video messages.
ShowCaptionAboveMedia bool
// ReplyMarkup is the new inline keyboard for the message.
ReplyMarkup *InlineKeyboardMarkup
}
EditEphemeralMessageCaptionConfig allows you to edit the caption of an ephemeral message.
func NewEditEphemeralMessageCaption ¶
func NewEditEphemeralMessageCaption(chatID, receiverUserID int64, ephemeralMessageID int, caption string) EditEphemeralMessageCaptionConfig
NewEditEphemeralMessageCaption allows you to edit the caption of an ephemeral message sent to receiverUserID in the given chat.
type EditEphemeralMessageMediaConfig ¶
type EditEphemeralMessageMediaConfig struct {
BaseEphemeralEdit
// Media is the new media content of the message.
Media interface{}
// ReplyMarkup is the new inline keyboard for the message.
ReplyMarkup *InlineKeyboardMarkup
}
EditEphemeralMessageMediaConfig allows you to edit the media of an ephemeral message. A new file can be uploaded, or use a previously uploaded file via its file_id, or specify a URL.
func NewEditEphemeralMessageMedia ¶
func NewEditEphemeralMessageMedia(chatID, receiverUserID int64, ephemeralMessageID int, media interface{}) EditEphemeralMessageMediaConfig
NewEditEphemeralMessageMedia allows you to edit the media of an ephemeral message sent to receiverUserID in the given chat. A new file can't be uploaded; use a previously uploaded file via its file_id, or specify a URL.
type EditEphemeralMessageReplyMarkupConfig ¶
type EditEphemeralMessageReplyMarkupConfig struct {
BaseEphemeralEdit
// ReplyMarkup is the new inline keyboard for the message.
ReplyMarkup *InlineKeyboardMarkup
}
EditEphemeralMessageReplyMarkupConfig allows you to edit only the reply markup of an ephemeral message.
func NewEditEphemeralMessageReplyMarkup ¶
func NewEditEphemeralMessageReplyMarkup(chatID, receiverUserID int64, ephemeralMessageID int, replyMarkup InlineKeyboardMarkup) EditEphemeralMessageReplyMarkupConfig
NewEditEphemeralMessageReplyMarkup allows you to edit the reply markup of an ephemeral message sent to receiverUserID in the given chat.
type EditEphemeralMessageTextConfig ¶
type EditEphemeralMessageTextConfig struct {
BaseEphemeralEdit
// Text is the new text of the message, 1-4096 characters after entity
// parsing. Required if RichMessage is not set.
Text string
// RichMessage is the new rich content of the message. Required if Text is
// not set.
RichMessage *InputRichMessage
// ParseMode is the mode for parsing entities in the message text.
ParseMode string
// Entities is a list of special entities that appear in the message text,
// which can be specified instead of ParseMode.
Entities []MessageEntity
// LinkPreviewOptions are the link preview generation options.
LinkPreviewOptions *LinkPreviewOptions
// ReplyMarkup is the new inline keyboard for the message.
ReplyMarkup *InlineKeyboardMarkup
}
EditEphemeralMessageTextConfig allows you to edit the text of an ephemeral message. Delivery of the edit is not guaranteed, especially if the user is offline.
func NewEditEphemeralMessageText ¶
func NewEditEphemeralMessageText(chatID, receiverUserID int64, ephemeralMessageID int, text string) EditEphemeralMessageTextConfig
NewEditEphemeralMessageText allows you to edit the text of an ephemeral message sent to receiverUserID in the given chat.
type EditForumTopicConfig ¶
type EditForumTopicConfig struct {
ChatID int64
SuperGroupUsername string
MessageThreadID int // required
Name string
IconCustomEmojiID string
}
EditForumTopicConfig edits the name and icon of a topic in a forum supergroup chat. The bot must have the can_manage_topics administrator rights, unless it is the creator of the topic.
type EditGeneralForumTopicConfig ¶
type EditGeneralForumTopicConfig struct {
ChatID int64
SuperGroupUsername string
Name string // required, 1-128 characters
}
EditGeneralForumTopicConfig edits the name of the 'General' topic in a forum supergroup chat. The bot must have the can_manage_topics administrator rights.
type EditMessageCaptionConfig ¶
type EditMessageCaptionConfig struct {
BaseEdit
Caption string
ParseMode string
CaptionEntities []MessageEntity
ShowCaptionAboveMedia bool
}
EditMessageCaptionConfig allows you to modify the caption of a message.
func NewEditMessageCaption ¶
func NewEditMessageCaption(chatID int64, messageID int, caption string) EditMessageCaptionConfig
NewEditMessageCaption allows you to edit the caption of a message.
type EditMessageChecklistConfig ¶
type EditMessageChecklistConfig struct {
BusinessConnectionID string
ChatID int64
MessageID int
Checklist InputChecklist
ReplyMarkup *InlineKeyboardMarkup
}
EditMessageChecklistConfig edits a checklist previously sent by the bot.
type EditMessageLiveLocationConfig ¶
type EditMessageLiveLocationConfig struct {
BaseEdit
Latitude float64 // required
Longitude float64 // required
LivePeriod int // optional; pass 0x7FFFFFFF to keep live indefinitely
HorizontalAccuracy float64 // optional
Heading int // optional
ProximityAlertRadius int // optional
}
EditMessageLiveLocationConfig allows you to update a live location.
type EditMessageMediaConfig ¶
type EditMessageMediaConfig struct {
BaseEdit
Media interface{}
}
EditMessageMediaConfig allows you to make an editMessageMedia request.
func NewEditMessageMedia ¶
func NewEditMessageMedia(chatID int64, messageID int, media interface{}) EditMessageMediaConfig
NewEditMessageMedia allows you to replace the media of a message. Media must be one of InputMediaAnimation, InputMediaAudio, InputMediaDocument, InputMediaLivePhoto, InputMediaPhoto or InputMediaVideo.
type EditMessageReplyMarkupConfig ¶
type EditMessageReplyMarkupConfig struct {
BaseEdit
}
EditMessageReplyMarkupConfig allows you to modify the reply markup of a message.
func NewEditMessageReplyMarkup ¶
func NewEditMessageReplyMarkup(chatID int64, messageID int, replyMarkup InlineKeyboardMarkup) EditMessageReplyMarkupConfig
NewEditMessageReplyMarkup allows you to edit the inline keyboard markup.
type EditMessageTextConfig ¶
type EditMessageTextConfig struct {
BaseEdit
Text string
ParseMode string
Entities []MessageEntity
LinkPreviewOptions *LinkPreviewOptions
// RichMessage is the new rich content of the message. Required if Text
// is not specified.
RichMessage *InputRichMessage
}
EditMessageTextConfig allows you to modify the text in a message.
func NewEditMessageText ¶
func NewEditMessageText(chatID int64, messageID int, text string) EditMessageTextConfig
NewEditMessageText allows you to edit the text of a message.
func NewEditMessageTextAndMarkup ¶
func NewEditMessageTextAndMarkup(chatID int64, messageID int, text string, replyMarkup InlineKeyboardMarkup) EditMessageTextConfig
NewEditMessageTextAndMarkup allows you to edit the text and reply markup of a message.
type EditStoryConfig ¶
type EditStoryConfig struct {
BusinessConnectionID string
StoryID int
Content InputStoryContent
Caption string
ParseMode string
CaptionEntities []MessageEntity
Areas []StoryArea
}
EditStoryConfig edits a story previously posted by the bot on behalf of a managed business account.
type EditUserStarSubscriptionConfig ¶
type EditUserStarSubscriptionConfig struct {
UserID int64
TelegramPaymentChargeID string
IsCanceled bool
}
EditUserStarSubscriptionConfig cancels or reenables an active Telegram Star subscription.
type EncryptedCredentials ¶
type EncryptedCredentials struct {
// Base64-encoded encrypted JSON-serialized data with unique user's
// payload, data hashes and secrets required for EncryptedPassportElement
// decryption and authentication
Data string `json:"data"`
// Base64-encoded data hash for data authentication
Hash string `json:"hash"`
// Base64-encoded secret, encrypted with the bot's public RSA key,
// required for data decryption
Secret string `json:"secret"`
}
EncryptedCredentials contains data required for decrypting and authenticating EncryptedPassportElement. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes.
type EncryptedPassportElement ¶
type EncryptedPassportElement struct {
// Element type.
Type string `json:"type"`
// Base64-encoded encrypted Telegram Passport element data provided by
// the user, available for "personal_details", "passport",
// "driver_license", "identity_card", "identity_passport" and "address"
// types. Can be decrypted and verified using the accompanying
// EncryptedCredentials.
Data string `json:"data,omitempty"`
// User's verified phone number, available only for "phone_number" type
PhoneNumber string `json:"phone_number,omitempty"`
// User's verified email address, available only for "email" type
Email string `json:"email,omitempty"`
// Array of encrypted files with documents provided by the user,
// available for "utility_bill", "bank_statement", "rental_agreement",
// "passport_registration" and "temporary_registration" types. Files can
// be decrypted and verified using the accompanying EncryptedCredentials.
Files []PassportFile `json:"files,omitempty"`
// Encrypted file with the front side of the document, provided by the
// user. Available for "passport", "driver_license", "identity_card" and
// "internal_passport". The file can be decrypted and verified using the
// accompanying EncryptedCredentials.
FrontSide *PassportFile `json:"front_side,omitempty"`
// Encrypted file with the reverse side of the document, provided by the
// user. Available for "driver_license" and "identity_card". The file can
// be decrypted and verified using the accompanying EncryptedCredentials.
ReverseSide *PassportFile `json:"reverse_side,omitempty"`
// Encrypted file with the selfie of the user holding a document,
// provided by the user; available for "passport", "driver_license",
// "identity_card" and "internal_passport". The file can be decrypted
// and verified using the accompanying EncryptedCredentials.
Selfie *PassportFile `json:"selfie,omitempty"`
// Array of encrypted files with translated versions of documents
// provided by the user; available if requested for "passport",
// "driver_license", "identity_card", "internal_passport",
// "utility_bill", "bank_statement", "rental_agreement",
// "passport_registration" and "temporary_registration" types. Files
// can be decrypted and verified using the accompanying
// EncryptedCredentials.
Translation []PassportFile `json:"translation,omitempty"`
// Base64-encoded element hash for using in
// PassportElementErrorUnspecified
Hash string `json:"hash"`
}
EncryptedPassportElement contains information about documents or other Telegram Passport elements shared with the bot by the user.
type EphemeralMessageParameters ¶
type EphemeralMessageParameters struct {
// ReceiverUserID is the unique identifier of the user who will receive
// the ephemeral message; for group and supergroup chats only. Delivery is
// not guaranteed, especially if the user is offline.
ReceiverUserID int64 `json:"receiver_user_id"`
// CallbackQueryID is the identifier of the callback query which triggered
// the ephemeral message, if any.
//
// optional
CallbackQueryID string `json:"callback_query_id,omitempty"`
// ReplaceCallbackQueryMessage, if true, shows the ephemeral message in
// place of the original message. Must be false for callback queries from
// ephemeral messages, which must be edited with the editEphemeralMessage*
// methods.
//
// optional
ReplaceCallbackQueryMessage bool `json:"replace_callback_query_message,omitempty"`
}
EphemeralMessageParameters holds the parameters that make an outgoing message ephemeral, i.e. visible only to a single recipient and the bot. It is embedded (as EphemeralSendParams) by the send configs whose methods support ephemeral messages and is sent on the wire as the JSON-serialized ephemeral_message_parameters parameter.
Leaving ReceiverUserID zero sends an ordinary, non-ephemeral message.
type EphemeralSendParams ¶
type EphemeralSendParams = EphemeralMessageParameters
EphemeralSendParams is the embedded form of EphemeralMessageParameters kept for source compatibility with Bot API 10.2 code.
type Error ¶
type Error struct {
Code int
Message string
ResponseParameters
}
Error is an error containing extra information returned by the Telegram API.
type ExternalReplyInfo ¶
type ExternalReplyInfo struct {
// Origin is the origin of the message replied to by the given message.
Origin MessageOrigin `json:"origin"`
// Chat is the conversation the original message belongs to. Available
// only if the chat is a supergroup or a channel.
//
// optional
Chat *Chat `json:"chat,omitempty"`
// MessageID is the unique message identifier inside the original chat.
// Available only if the original chat is a supergroup or a channel.
//
// optional
MessageID int `json:"message_id,omitempty"`
// LinkPreviewOptions are options used for link preview generation for the
// original message, if it is a text message.
//
// optional
LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options,omitempty"`
// Animation is set if the message is an animation.
//
// optional
Animation *Animation `json:"animation,omitempty"`
// Audio is set if the message is an audio file.
//
// optional
Audio *Audio `json:"audio,omitempty"`
// Document is set if the message is a general file.
//
// optional
Document *Document `json:"document,omitempty"`
// Photo is set if the message is a photo.
//
// optional
Photo []PhotoSize `json:"photo,omitempty"`
// LivePhoto is set if the message is a live photo.
//
// optional
LivePhoto *LivePhoto `json:"live_photo,omitempty"`
// PaidMedia is set if the message contains paid media.
//
// optional
PaidMedia *PaidMediaInfo `json:"paid_media,omitempty"`
// Sticker is set if the message is a sticker.
//
// optional
Sticker *Sticker `json:"sticker,omitempty"`
// Story is set if the message is a forwarded story.
//
// optional
Story *Story `json:"story,omitempty"`
// Video is set if the message is a video.
//
// optional
Video *Video `json:"video,omitempty"`
// VideoNote is set if the message is a video note.
//
// optional
VideoNote *VideoNote `json:"video_note,omitempty"`
// Voice is set if the message is a voice message.
//
// optional
Voice *Voice `json:"voice,omitempty"`
// HasMediaSpoiler is true, if the message media is covered by a spoiler animation.
//
// optional
HasMediaSpoiler bool `json:"has_media_spoiler,omitempty"`
// Checklist is set if the message is a checklist.
//
// optional
Checklist *Checklist `json:"checklist,omitempty"`
// Contact is set if the message is a shared contact.
//
// optional
Contact *Contact `json:"contact,omitempty"`
// Dice is set if the message is a dice with random value.
//
// optional
Dice *Dice `json:"dice,omitempty"`
// Game is set if the message is a game.
//
// optional
Game *Game `json:"game,omitempty"`
// Giveaway is set if the message is a scheduled giveaway.
//
// optional
Giveaway *Giveaway `json:"giveaway,omitempty"`
// GiveawayWinners is set if the message is a giveaway with public winners.
//
// optional
GiveawayWinners *GiveawayWinners `json:"giveaway_winners,omitempty"`
// Invoice is set if the message is an invoice for a payment.
//
// optional
Invoice *Invoice `json:"invoice,omitempty"`
// Location is set if the message is a shared location.
//
// optional
Location *Location `json:"location,omitempty"`
// Poll is set if the message is a native poll.
//
// optional
Poll *Poll `json:"poll,omitempty"`
// Venue is set if the message is a venue.
//
// optional
Venue *Venue `json:"venue,omitempty"`
}
ExternalReplyInfo contains information about a message that is being replied to, which may come from another chat or forum topic.
type File ¶
type File struct {
// FileID identifier for this file, which can be used to download or reuse
// the file
FileID string `json:"file_id"`
// FileUniqueID is the unique identifier for this file, which is supposed to
// be the same over time and for different bots. Can't be used to download
// or reuse the file.
FileUniqueID string `json:"file_unique_id"`
// FileSize file size, if known
//
// optional
FileSize int64 `json:"file_size,omitempty"`
// FilePath file path
//
// optional
FilePath string `json:"file_path,omitempty"`
}
File contains information about a file to download from Telegram.
type FileBytes ¶
FileBytes contains information about a set of bytes to upload as a File.
func (FileBytes) NeedsUpload ¶
type FileConfig ¶
type FileConfig struct {
FileID string
}
FileConfig has information about a file hosted on Telegram.
type FileCredentials ¶
type FileCredentials struct {
// FileHash checksum of encrypted data
FileHash string `json:"file_hash"`
// Secret of encrypted data
Secret string `json:"secret"`
}
FileCredentials contains information required to decrypt files.
type FileID ¶
type FileID string
FileID is an ID of a file already uploaded to Telegram.
func (FileID) NeedsUpload ¶
type FilePath ¶
type FilePath string
FilePath is a path to a local file.
func (FilePath) NeedsUpload ¶
type FileReader ¶
FileReader contains information about a reader to upload as a File.
func (FileReader) NeedsUpload ¶
func (fr FileReader) NeedsUpload() bool
func (FileReader) SendData ¶
func (fr FileReader) SendData() string
func (FileReader) UploadData ¶
func (fr FileReader) UploadData() (string, io.Reader, error)
type FileURL ¶
type FileURL string
FileURL is a URL to use as a file for a request.
func (FileURL) NeedsUpload ¶
type Fileable ¶
type Fileable interface {
Chattable
// contains filtered or unexported methods
}
Fileable is any config type that can be sent that includes a file.
type ForceReply ¶
type ForceReply struct {
// ForceReply shows reply interface to the user,
// as if they manually selected the bot's message and tapped 'Reply'.
ForceReply bool `json:"force_reply"`
// InputFieldPlaceholder is the placeholder to be shown in the input field when
// the reply is active; 1-64 characters.
//
// optional
InputFieldPlaceholder string `json:"input_field_placeholder,omitempty"`
// Selective use this parameter if you want to force reply from specific users only.
// Targets:
// 1) users that are @mentioned in the text of the Message object;
// 2) if the bot's message is a reply (has Message.ReplyToMessage not nil), sender of the original message.
//
// optional
Selective bool `json:"selective,omitempty"`
}
ForceReply when receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the user has selected the bot's message and tapped 'Reply'). This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode.
type ForumTopic ¶
type ForumTopic struct {
// MessageThreadID is the unique identifier of the forum topic
MessageThreadID int `json:"message_thread_id"`
// Name of the topic
Name string `json:"name"`
// IsNameImplicit is true, if the name of the topic was implicitly
// derived from the content of the first message, e.g. for topics
// created automatically in private chats.
//
// optional
IsNameImplicit bool `json:"is_name_implicit,omitempty"`
// IconColor is the color of the topic icon in RGB format
IconColor int `json:"icon_color"`
// IconCustomEmojiID is the unique identifier of the custom emoji shown
// as the topic icon.
//
// optional
IconCustomEmojiID string `json:"icon_custom_emoji_id,omitempty"`
}
ForumTopic represents a forum topic.
type ForumTopicClosed ¶
type ForumTopicClosed struct{}
ForumTopicClosed represents a service message about a forum topic closed in the chat. Currently holds no information.
type ForumTopicCreated ¶
type ForumTopicCreated struct {
// Name of the topic
Name string `json:"name"`
// IsNameImplicit is true, if the name of the topic was implicitly
// derived from the content of the first message.
//
// optional
IsNameImplicit bool `json:"is_name_implicit,omitempty"`
// IconColor is the color of the topic icon in RGB format
IconColor int `json:"icon_color"`
// IconCustomEmojiID is the unique identifier of the custom emoji shown
// as the topic icon.
//
// optional
IconCustomEmojiID string `json:"icon_custom_emoji_id,omitempty"`
}
ForumTopicCreated represents a service message about a new forum topic created in the chat.
type ForumTopicEdited ¶
type ForumTopicEdited struct {
// Name is the new name of the topic, if it was edited.
//
// optional
Name string `json:"name,omitempty"`
// IconCustomEmojiID is the new identifier of the custom emoji shown as the
// topic icon, if it was edited; an empty string if the icon was removed.
//
// optional
IconCustomEmojiID string `json:"icon_custom_emoji_id,omitempty"`
}
ForumTopicEdited represents a service message about an edited forum topic.
type ForumTopicReopened ¶
type ForumTopicReopened struct{}
ForumTopicReopened represents a service message about a forum topic reopened in the chat. Currently holds no information.
type ForwardConfig ¶
type ForwardConfig struct {
BaseChat
FromChatID int64 // required
FromChannelUsername string
MessageID int // required
VideoStartTimestamp int
}
ForwardConfig contains information about a ForwardMessage request.
func NewForward ¶
func NewForward(chatID int64, fromChatID int64, messageID int) ForwardConfig
NewForward creates a new forward.
chatID is where to send it, fromChatID is the source chat, and messageID is the ID of the original message.
type ForwardMessagesConfig ¶
type ForwardMessagesConfig struct {
ChatID int64
ChannelUsername string
MessageThreadID int
DirectMessagesTopicID int
FromChatID int64
FromChannelUsername string
MessageIDs []int // 1-100 message identifiers, must be in strictly increasing order
DisableNotification bool
ProtectContent bool
}
ForwardMessagesConfig forwards multiple messages of any kind. If some of the specified messages can't be found or forwarded, they are skipped. Service messages and messages with protected content can't be forwarded. Album grouping is kept for forwarded messages.
type Game ¶
type Game struct {
// Title of the game
Title string `json:"title"`
// Description of the game
Description string `json:"description"`
// Photo that will be displayed in the game message in chats.
Photo []PhotoSize `json:"photo"`
// Text a brief description of the game or high scores included in the game message.
// Can be automatically edited to include current high scores for the game
// when the bot calls setGameScore, or manually edited using editMessageText. 0-4096 characters.
//
// optional
Text string `json:"text,omitempty"`
// TextEntities special entities that appear in text, such as usernames, URLs, bot commands, etc.
//
// optional
TextEntities []MessageEntity `json:"text_entities,omitempty"`
// Animation is an animation that will be displayed in the game message in chats.
// Upload via BotFather (https://t.me/botfather).
//
// optional
Animation Animation `json:"animation,omitempty"`
}
Game represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers.
type GameConfig ¶
GameConfig allows you to send a game.
type GameHighScore ¶
type GameHighScore struct {
// Position in high score table for the game
Position int `json:"position"`
// User user
User User `json:"user"`
// Score score
Score int `json:"score"`
}
GameHighScore is a user's score and position on the leaderboard.
type GeneralForumTopicHidden ¶
type GeneralForumTopicHidden struct{}
GeneralForumTopicHidden represents a service message about General forum topic hidden in the chat. Currently holds no information.
type GeneralForumTopicUnhidden ¶
type GeneralForumTopicUnhidden struct{}
GeneralForumTopicUnhidden represents a service message about General forum topic unhidden in the chat. Currently holds no information.
type GetAvailableGiftsConfig ¶
type GetAvailableGiftsConfig struct{}
GetAvailableGiftsConfig returns the list of gifts that can be sent by the bot to users.
type GetBusinessAccountGiftsConfig ¶
type GetBusinessAccountGiftsConfig struct {
BusinessConnectionID string
ExcludeUnsaved bool
ExcludeSaved bool
ExcludeUnlimited bool
ExcludeLimitedUpgradable bool
ExcludeLimitedNonUpgradable bool
ExcludeUnique bool
ExcludeFromBlockchain bool
SortByPrice bool
Offset string
Limit int
}
GetBusinessAccountGiftsConfig returns the gifts received and owned by a managed business account.
type GetBusinessAccountStarBalanceConfig ¶
type GetBusinessAccountStarBalanceConfig struct {
BusinessConnectionID string
}
GetBusinessAccountStarBalanceConfig returns the amount of Telegram Stars owned by a managed business account.
type GetBusinessConnectionConfig ¶
type GetBusinessConnectionConfig struct {
BusinessConnectionID string
}
GetBusinessConnectionConfig returns information about the connection of the bot with a business account.
type GetChatGiftsConfig ¶
type GetChatGiftsConfig struct {
ChatID int64
ChannelUsername string
ExcludeUnsaved bool
ExcludeSaved bool
ExcludeUnlimited bool
ExcludeLimitedUpgradable bool
ExcludeLimitedNonUpgradable bool
ExcludeFromBlockchain bool
ExcludeUnique bool
SortByPrice bool
Offset string
Limit int
}
GetChatGiftsConfig returns the list of gifts received and owned by a chat.
Provide the target chat via either ChatID (numeric identifier) or ChannelUsername ("@channelusername"); the first non-zero / non-empty value is used.
type GetChatMemberConfig ¶
type GetChatMemberConfig struct {
ChatConfigWithUser
}
GetChatMemberConfig is information about getting a specific member in a chat.
type GetChatMenuButtonConfig ¶
type GetCustomEmojiStickersConfig ¶
type GetCustomEmojiStickersConfig struct {
CustomEmojiIDs []string
}
GetCustomEmojiStickersConfig get information about custom emoji stickers by their identifiers.
type GetForumTopicIconStickersConfig ¶
type GetForumTopicIconStickersConfig struct{}
GetForumTopicIconStickersConfig gets custom emoji stickers, which can be used as a forum topic icon by any user. Requires no parameters. Returns an Array of Sticker objects.
type GetGameHighScoresConfig ¶
type GetGameHighScoresConfig struct {
UserID int64
ChatID int64
ChannelUsername string
MessageID int
InlineMessageID string
}
GetGameHighScoresConfig allows you to fetch the high scores for a game.
type GetManagedBotAccessSettingsConfig ¶
type GetManagedBotAccessSettingsConfig struct {
// UserID is the user identifier of the managed bot whose access
// settings will be returned.
UserID int64
}
GetManagedBotAccessSettingsConfig returns the access settings of a managed bot.
type GetManagedBotTokenConfig ¶
type GetManagedBotTokenConfig struct {
// UserID is the user identifier of the managed bot whose token will be returned.
UserID int64
}
prepareInputMediaParam evaluates a single InputMedia and determines if it needs to be modified for a successful upload. If it returns nil, then the value does not need to be included in the params. Otherwise, it will return the same type as was originally provided.
The idx is used to calculate the file field name. If you only have a single file, 0 may be used. It is formatted into "attach://file-%d" for the primary media and "attach://file-%d-thumb" for thumbnails.
It is expected to be used in conjunction with prepareInputMediaFile. GetManagedBotTokenConfig contains the parameters for the getManagedBotToken method.
type GetMyCommandsConfig ¶
type GetMyCommandsConfig struct {
Scope *BotCommandScope
LanguageCode string
}
GetMyCommandsConfig gets a list of the currently registered commands.
func NewGetMyCommandsWithScope ¶
func NewGetMyCommandsWithScope(scope BotCommandScope) GetMyCommandsConfig
NewGetMyCommandsWithScope allows you to set the registered commands for a given scope.
func NewGetMyCommandsWithScopeAndLanguage ¶
func NewGetMyCommandsWithScopeAndLanguage(scope BotCommandScope, languageCode string) GetMyCommandsConfig
NewGetMyCommandsWithScopeAndLanguage allows you to set the registered commands for a given scope and language code.
type GetMyDefaultAdministratorRightsConfig ¶
type GetMyDefaultAdministratorRightsConfig struct {
ForChannels bool
}
type GetMyDescriptionConfig ¶
type GetMyDescriptionConfig struct {
LanguageCode string
}
GetMyDescriptionConfig returns the current bot description for the given user language.
type GetMyNameConfig ¶
type GetMyNameConfig struct {
LanguageCode string
}
GetMyNameConfig returns the current bot name for the given user language.
type GetMyShortDescriptionConfig ¶
type GetMyShortDescriptionConfig struct {
LanguageCode string
}
GetMyShortDescriptionConfig returns the current bot short description for the given user language.
type GetMyStarBalanceConfig ¶
type GetMyStarBalanceConfig struct{}
GetMyStarBalanceConfig returns the current Telegram Stars balance of the bot.
type GetStarTransactionsConfig ¶
type GetStarTransactionsConfig struct {
// Offset is the number of transactions to skip in the response.
Offset int
// Limit is the maximum number of transactions to be retrieved; 1-100.
// Defaults to 100.
Limit int
}
GetStarTransactionsConfig returns the bot's Telegram Star transactions in chronological order.
type GetStickerSetConfig ¶
type GetStickerSetConfig struct {
Name string
}
GetStickerSetConfig allows you to get the stickers in a set.
type GetUserChatBoostsConfig ¶
GetUserChatBoostsConfig returns the list of boosts added to a chat by a user. The bot must be an administrator in the chat.
Provide the target chat via either ChatID (numeric identifier) or ChannelUsername ("@channelusername"); the first non-zero / non-empty value is used.
type GetUserGiftsConfig ¶
type GetUserGiftsConfig struct {
UserID int64
ExcludeUnlimited bool
ExcludeLimitedUpgradable bool
ExcludeLimitedNonUpgradable bool
ExcludeFromBlockchain bool
ExcludeUnique bool
SortByPrice bool
Offset string
Limit int
}
GetUserGiftsConfig returns the list of gifts received and owned by a user.
type GetUserPersonalChatMessagesConfig ¶
type GetUserPersonalChatMessagesConfig struct {
// UserID is the unique identifier of the target user.
UserID int64
// Limit is the maximum number of messages to return; 1-20.
Limit int
}
GetUserPersonalChatMessagesConfig returns the last messages from a user's personal chat.
type GetUserProfileAudiosConfig ¶
GetUserProfileAudiosConfig fetches a list of audios added to the profile of a user.
type Gift ¶
type Gift struct {
// ID is the unique identifier of the gift.
ID string `json:"id"`
// Sticker representing the gift.
Sticker Sticker `json:"sticker"`
// StarCount is the number of Telegram Stars that must be paid to send
// the sticker.
StarCount int `json:"star_count"`
// UpgradeStarCount is the number of Telegram Stars that must be paid
// to upgrade the gift to a unique one.
//
// optional
UpgradeStarCount int `json:"upgrade_star_count,omitempty"`
// TotalCount is the total number of the gifts of this type that can
// be sent; for limited gifts only.
//
// optional
TotalCount int `json:"total_count,omitempty"`
// RemainingCount is the number of remaining gifts of this type that
// can be sent; for limited gifts only.
//
// optional
RemainingCount int `json:"remaining_count,omitempty"`
// PersonalTotalCount is the total number of gifts of this type that
// can be sent by the bot to each user.
//
// optional
PersonalTotalCount int `json:"personal_total_count,omitempty"`
// PersonalRemainingCount is the number of remaining gifts of this type
// that can be sent by the bot to each user.
//
// optional
PersonalRemainingCount int `json:"personal_remaining_count,omitempty"`
// IsPremium is true, if the gift can only be sent by bots owned by
// users with an active Telegram Premium subscription.
//
// optional
IsPremium bool `json:"is_premium,omitempty"`
// HasColors is true, if the gift defines a color scheme.
//
// optional
HasColors bool `json:"has_colors,omitempty"`
// UniqueGiftVariantCount is the total number of variants of unique
// gifts that can be upgraded from the gift.
//
// optional
UniqueGiftVariantCount int `json:"unique_gift_variant_count,omitempty"`
// Background describing the gift background.
//
// optional
Background *GiftBackground `json:"background,omitempty"`
// PublisherChat is the chat that published the gift.
//
// optional
PublisherChat *Chat `json:"publisher_chat,omitempty"`
}
Gift represents a gift that can be sent by the bot.
type GiftBackground ¶
type GiftBackground struct {
// CenterColor is the center color of the background in RGB format.
CenterColor int `json:"center_color"`
// EdgeColor is the edge color of the background in RGB format.
EdgeColor int `json:"edge_color"`
// TextColor is the text color of the background in RGB format.
TextColor int `json:"text_color"`
}
GiftBackground describes the background of a gift.
type GiftInfo ¶
type GiftInfo struct {
// Gift is the information about the gift.
Gift Gift `json:"gift"`
// OwnedGiftID is the unique identifier of the received gift for the
// bot; only present for gifts received on behalf of business accounts.
//
// optional
OwnedGiftID string `json:"owned_gift_id,omitempty"`
// ConvertStarCount is the number of Telegram Stars that can be claimed
// by the receiver instead of the gift.
//
// optional
ConvertStarCount int `json:"convert_star_count,omitempty"`
// PrepaidUpgradeStarCount is the number of Telegram Stars that were
// prepaid by the sender for the ability to upgrade the gift.
//
// optional
PrepaidUpgradeStarCount int `json:"prepaid_upgrade_star_count,omitempty"`
// CanBeUpgraded is true, if the gift can be upgraded to a unique gift.
//
// optional
CanBeUpgraded bool `json:"can_be_upgraded,omitempty"`
// Text is the text of the message that was added to the gift.
//
// optional
Text string `json:"text,omitempty"`
// Entities are the special entities that appear in the text.
//
// optional
Entities []MessageEntity `json:"entities,omitempty"`
// IsPrivate is true, if the sender and gift text are shown only to the
// gift receiver; otherwise, everyone able to access the chat with the
// receiver will be able to see them.
//
// optional
IsPrivate bool `json:"is_private,omitempty"`
// IsUpgradeSeparate is true, if the gift upgrade to a unique gift can
// be requested separately by the receiver.
//
// optional
IsUpgradeSeparate bool `json:"is_upgrade_separate,omitempty"`
// UniqueGiftNumber is the sequential number of the unique gift among
// gifts upgraded from the same regular gift.
//
// optional
UniqueGiftNumber int `json:"unique_gift_number,omitempty"`
}
GiftInfo describes a service message about a regular gift that was sent or received.
type GiftPremiumSubscriptionConfig ¶
type GiftPremiumSubscriptionConfig struct {
UserID int64
MonthCount int
StarCount int
Text string
TextParseMode string
TextEntities []MessageEntity
}
GiftPremiumSubscriptionConfig gifts a Telegram Premium subscription to the given user.
type Gifts ¶
type Gifts struct {
// Gifts is the list of gifts.
Gifts []Gift `json:"gifts"`
}
Gifts represents a list of gifts.
type Giveaway ¶
type Giveaway struct {
// Chats is the list of chats which the user must join to participate in
// the giveaway.
Chats []Chat `json:"chats"`
// WinnersSelectionDate is the point in time (Unix timestamp) when winners
// of the giveaway will be selected.
WinnersSelectionDate int `json:"winners_selection_date"`
// WinnerCount is the number of users which are supposed to be selected
// as winners of the giveaway.
WinnerCount int `json:"winner_count"`
// OnlyNewMembers is true, if only users who join the chats after the
// giveaway started should be eligible to win.
//
// optional
OnlyNewMembers bool `json:"only_new_members,omitempty"`
// HasPublicWinners is true, if the list of giveaway winners will be
// visible to everyone.
//
// optional
HasPublicWinners bool `json:"has_public_winners,omitempty"`
// PrizeDescription is the description of additional giveaway prize.
//
// optional
PrizeDescription string `json:"prize_description,omitempty"`
// CountryCodes is a list of two-letter ISO 3166-1 alpha-2 country codes
// indicating the countries from which eligible users for the giveaway
// must come.
//
// optional
CountryCodes []string `json:"country_codes,omitempty"`
// PremiumSubscriptionMonthCount is the number of months the Telegram
// Premium subscription won from the giveaway will be active for.
//
// optional
PremiumSubscriptionMonthCount int `json:"premium_subscription_month_count,omitempty"`
// PrizeStarCount is the number of Telegram Stars to be split between
// giveaway winners. For Telegram Star giveaways only.
//
// optional
PrizeStarCount int `json:"prize_star_count,omitempty"`
}
Giveaway represents a message about a scheduled giveaway.
type GiveawayCompleted ¶
type GiveawayCompleted struct {
// WinnerCount is the number of winners in the giveaway.
WinnerCount int `json:"winner_count"`
// UnclaimedPrizeCount is the number of undistributed prizes.
//
// optional
UnclaimedPrizeCount int `json:"unclaimed_prize_count,omitempty"`
// GiveawayMessage is the message with the giveaway that was completed,
// if it wasn't deleted.
//
// optional
GiveawayMessage *Message `json:"giveaway_message,omitempty"`
// IsStarGiveaway is true, if the giveaway is a Telegram Star giveaway.
// Otherwise, currently, the giveaway is a Telegram Premium giveaway.
//
// optional
IsStarGiveaway bool `json:"is_star_giveaway,omitempty"`
}
GiveawayCompleted represents a service message about the completion of a giveaway without public winners.
type GiveawayCreated ¶
type GiveawayCreated struct {
// PrizeStarCount is the number of Telegram Stars to be split between
// giveaway winners. For Telegram Star giveaways only.
//
// optional
PrizeStarCount int `json:"prize_star_count,omitempty"`
}
GiveawayCreated represents a service message about the creation of a scheduled giveaway.
type GiveawayWinners ¶
type GiveawayWinners struct {
// Chat that created the giveaway.
Chat Chat `json:"chat"`
// GiveawayMessageID is the identifier of the message with the giveaway
// in the chat.
GiveawayMessageID int `json:"giveaway_message_id"`
// WinnersSelectionDate is the point in time (Unix timestamp) when winners
// of the giveaway were selected.
WinnersSelectionDate int `json:"winners_selection_date"`
// WinnerCount is the total number of winners in the giveaway.
WinnerCount int `json:"winner_count"`
// Winners is the list of up to 100 winners of the giveaway.
Winners []User `json:"winners"`
// AdditionalChatCount is the number of other chats the user had to join
// in order to be eligible for the giveaway.
//
// optional
AdditionalChatCount int `json:"additional_chat_count,omitempty"`
// PremiumSubscriptionMonthCount is the number of months the Telegram
// Premium subscription won from the giveaway will be active for.
//
// optional
PremiumSubscriptionMonthCount int `json:"premium_subscription_month_count,omitempty"`
// PrizeStarCount is the number of Telegram Stars that were split between
// giveaway winners. For Telegram Star giveaways only.
//
// optional
PrizeStarCount int `json:"prize_star_count,omitempty"`
// UnclaimedPrizeCount is the number of undistributed prizes.
//
// optional
UnclaimedPrizeCount int `json:"unclaimed_prize_count,omitempty"`
// OnlyNewMembers is true, if only users who joined the chats after the
// giveaway started were eligible to win.
//
// optional
OnlyNewMembers bool `json:"only_new_members,omitempty"`
// WasRefunded is true, if the giveaway was canceled because the payment
// for it was refunded.
//
// optional
WasRefunded bool `json:"was_refunded,omitempty"`
// PrizeDescription is the description of additional giveaway prize.
//
// optional
PrizeDescription string `json:"prize_description,omitempty"`
}
GiveawayWinners represents a message about the completion of a giveaway with public winners.
The PrizeStarCount field holds the number of Telegram Stars split between winners, if this was a Telegram Star giveaway.
type HTTPClient ¶
HTTPClient is the type needed for the bot to perform HTTP requests.
type HideGeneralForumTopicConfig ¶
HideGeneralForumTopicConfig hides the 'General' topic in a forum supergroup chat. The bot must have the can_manage_topics administrator rights. The topic will be automatically closed if it was open.
type IDDocumentData ¶
type IDDocumentData struct {
DocumentNumber string `json:"document_no"`
ExpiryDate string `json:"expiry_date"`
}
IDDocumentData https://core.telegram.org/passport#iddocumentdata
type InaccessibleMessage ¶
type InaccessibleMessage struct {
// Chat the message belonged to.
Chat Chat `json:"chat"`
// MessageID is the unique message identifier inside the chat.
MessageID int `json:"message_id"`
// Date is always 0. The field is present in order to mimic the Message
// type so that callers can distinguish accessible from inaccessible
// messages by checking Date == 0.
Date int `json:"date"`
}
InaccessibleMessage describes a message that was deleted or otherwise inaccessible to the bot.
type InlineConfig ¶
type InlineConfig struct {
InlineQueryID string `json:"inline_query_id"`
Results []interface{} `json:"results"`
CacheTime int `json:"cache_time"`
IsPersonal bool `json:"is_personal"`
NextOffset string `json:"next_offset"`
Button *InlineQueryResultsButton `json:"button,omitempty"`
}
InlineConfig contains information on making an InlineQuery response.
Example ¶
bot, err := NewBotAPI("MyAwesomeBotToken") // create new bot
if err != nil {
panic(err)
}
log.Printf("Authorized on account %s", bot.Self.UserName)
u := NewUpdate(0)
u.Timeout = 60
updates := bot.GetUpdatesChan(u)
for update := range updates {
if update.InlineQuery == nil { // if no inline query, ignore it
continue
}
article := NewInlineQueryResultArticle(update.InlineQuery.ID, "Echo", update.InlineQuery.Query)
article.Description = update.InlineQuery.Query
inlineConf := InlineConfig{
InlineQueryID: update.InlineQuery.ID,
IsPersonal: true,
CacheTime: 0,
Results: []interface{}{article},
}
if _, err := bot.Request(inlineConf); err != nil {
log.Println(err)
}
}
type InlineKeyboardButton ¶
type InlineKeyboardButton struct {
// Text label text on the button
Text string `json:"text"`
// URL HTTP or tg:// url to be opened when button is pressed.
//
// optional
URL *string `json:"url,omitempty"`
// LoginURL is an HTTP URL used to automatically authorize the user. Can be
// used as a replacement for the Telegram Login Widget
//
// optional
LoginURL *LoginURL `json:"login_url,omitempty"`
// CallbackData data to be sent in a callback query to the bot when button is pressed, 1-64 bytes.
//
// optional
CallbackData *string `json:"callback_data,omitempty"`
// WebApp is the Description of the Web App that will be launched when the user presses the button.
// The Web App will be able to send an arbitrary message on behalf of the user using the method
// answerWebAppQuery. Available only in private chats between a user and the bot.
//
// optional
WebApp *WebAppInfo `json:"web_app,omitempty"`
// SwitchInlineQuery if set, pressing the button will prompt the user to select one of their chats,
// open that chat and insert the bot's username and the specified inline query in the input field.
// Can be empty, in which case just the bot's username will be inserted.
//
// This offers an easy way for users to start using your bot
// in inline mode when they are currently in a private chat with it.
// Especially useful when combined with switch_pm… actions – in this case
// the user will be automatically returned to the chat they switched from,
// skipping the chat selection screen.
//
// optional
SwitchInlineQuery *string `json:"switch_inline_query,omitempty"`
// SwitchInlineQueryCurrentChat if set, pressing the button will insert the bot's username
// and the specified inline query in the current chat's input field.
// Can be empty, in which case only the bot's username will be inserted.
//
// This offers a quick way for the user to open your bot in inline mode
// in the same chat – good for selecting something from multiple options.
//
// optional
SwitchInlineQueryCurrentChat *string `json:"switch_inline_query_current_chat,omitempty"`
// SwitchInlineQueryChosenChat if set, pressing the button will prompt the
// user to select one of their chats of the specified type, open that chat
// and insert the bot's username and the specified inline query in the
// input field.
//
// optional
SwitchInlineQueryChosenChat *SwitchInlineQueryChosenChat `json:"switch_inline_query_chosen_chat,omitempty"`
// CopyText if set, pressing the button will copy the specified text to
// the clipboard.
//
// optional
CopyText *CopyTextButton `json:"copy_text,omitempty"`
// IconCustomEmojiID is the unique identifier of the custom emoji to be
// displayed on the button. Available only if the bot can use custom
// emoji in the message.
//
// optional
IconCustomEmojiID string `json:"icon_custom_emoji_id,omitempty"`
// Style of the button. Currently, one of "default", "primary",
// "destructive". Defaults to "default".
//
// optional
Style string `json:"style,omitempty"`
// CallbackGame description of the game that will be launched when the user presses the button.
//
// optional
CallbackGame *CallbackGame `json:"callback_game,omitempty"`
// Pay specify True, to send a Pay button.
//
// NOTE: This type of button must always be the first button in the first row.
//
// optional
Pay bool `json:"pay,omitempty"`
// Disabled if set, then the button is disabled and does nothing.
//
// optional
Disabled *DisabledButton `json:"disabled,omitempty"`
}
InlineKeyboardButton represents one button of an inline keyboard. You must use exactly one of the optional fields.
Note that some values are references as even an empty string will change behavior.
CallbackGame, if set, MUST be first button in first row.
func NewInlineKeyboardButtonData ¶
func NewInlineKeyboardButtonData(text, data string) InlineKeyboardButton
NewInlineKeyboardButtonData creates an inline keyboard button with text and data for a callback.
func NewInlineKeyboardButtonLoginURL ¶
func NewInlineKeyboardButtonLoginURL(text string, loginURL LoginURL) InlineKeyboardButton
NewInlineKeyboardButtonLoginURL creates an inline keyboard button with text which goes to a LoginURL.
func NewInlineKeyboardButtonSwitch ¶
func NewInlineKeyboardButtonSwitch(text, sw string) InlineKeyboardButton
NewInlineKeyboardButtonSwitch creates an inline keyboard button with text which allows the user to switch to a chat or return to a chat.
func NewInlineKeyboardButtonURL ¶
func NewInlineKeyboardButtonURL(text, url string) InlineKeyboardButton
NewInlineKeyboardButtonURL creates an inline keyboard button with text which goes to a URL.
func NewInlineKeyboardButtonWebApp ¶
func NewInlineKeyboardButtonWebApp(text string, webapp WebAppInfo) InlineKeyboardButton
NewInlineKeyboardButtonWebApp creates an inline keyboard button with text which goes to a WebApp.
func NewInlineKeyboardRow ¶
func NewInlineKeyboardRow(buttons ...InlineKeyboardButton) []InlineKeyboardButton
NewInlineKeyboardRow creates an inline keyboard row with buttons.
type InlineKeyboardMarkup ¶
type InlineKeyboardMarkup struct {
// InlineKeyboard array of button rows, each represented by an Array of
// InlineKeyboardButton objects
InlineKeyboard [][]InlineKeyboardButton `json:"inline_keyboard"`
// ForceReply requests clients to show the reply interface to the user, as
// if they had manually selected the bot's message and tapped 'Reply'. The
// value of the field can't be changed when the inline keyboard is edited.
//
// optional
ForceReply bool `json:"force_reply,omitempty"`
}
InlineKeyboardMarkup represents an inline keyboard that appears right next to the message it belongs to.
func NewInlineKeyboardMarkup ¶
func NewInlineKeyboardMarkup(rows ...[]InlineKeyboardButton) InlineKeyboardMarkup
NewInlineKeyboardMarkup creates a new inline keyboard.
type InlineQuery ¶
type InlineQuery struct {
// ID unique identifier for this query
ID string `json:"id"`
// From sender
From *User `json:"from"`
// Query text of the query (up to 256 characters).
Query string `json:"query"`
// Offset of the results to be returned, can be controlled by the bot.
Offset string `json:"offset"`
// Type of the chat, from which the inline query was sent. Can be either
// “sender” for a private chat with the inline query sender, “private”,
// “group”, “supergroup”, or “channel”. The chat type should be always known
// for requests sent from official clients and most third-party clients,
// unless the request was sent from a secret chat
//
// optional
ChatType string `json:"chat_type,omitempty"`
// Location sender location, only for bots that request user location.
//
// optional
Location *Location `json:"location,omitempty"`
}
InlineQuery is a Query from Telegram for an inline request.
type InlineQueryResultArticle ¶
type InlineQueryResultArticle struct {
// Type of the result, must be article.
Type string `json:"type"`
// ID unique identifier for this result, 1-64 Bytes.
ID string `json:"id"`
// Title of the result
Title string `json:"title"`
// InputMessageContent content of the message to be sent.
InputMessageContent interface{} `json:"input_message_content,omitempty"`
// ReplyMarkup Inline keyboard attached to the message.
//
// optional
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// URL of the result.
//
// optional
URL string `json:"url,omitempty"`
// Description short description of the result.
//
// optional
Description string `json:"description,omitempty"`
// ThumbURL url of the thumbnail for the result
//
// optional
ThumbnailURL string `json:"thumbnail_url,omitempty"`
// ThumbWidth thumbnail width
//
// optional
ThumbnailWidth int `json:"thumbnail_width,omitempty"`
// ThumbHeight thumbnail height
//
// optional
ThumbnailHeight int `json:"thumbnail_height,omitempty"`
}
InlineQueryResultArticle represents a link to an article or web page.
func NewInlineQueryResultArticle ¶
func NewInlineQueryResultArticle(id, title, messageText string) InlineQueryResultArticle
NewInlineQueryResultArticle creates a new inline query article.
func NewInlineQueryResultArticleHTML ¶
func NewInlineQueryResultArticleHTML(id, title, messageText string) InlineQueryResultArticle
NewInlineQueryResultArticleHTML creates a new inline query article with HTML parsing.
func NewInlineQueryResultArticleMarkdown ¶
func NewInlineQueryResultArticleMarkdown(id, title, messageText string) InlineQueryResultArticle
NewInlineQueryResultArticleMarkdown creates a new inline query article with Markdown parsing.
func NewInlineQueryResultArticleMarkdownV2 ¶
func NewInlineQueryResultArticleMarkdownV2(id, title, messageText string) InlineQueryResultArticle
NewInlineQueryResultArticleMarkdownV2 creates a new inline query article with MarkdownV2 parsing.
type InlineQueryResultAudio ¶
type InlineQueryResultAudio struct {
// Type of the result, must be audio
Type string `json:"type"`
// ID unique identifier for this result, 1-64 bytes
ID string `json:"id"`
// URL a valid url for the audio file
URL string `json:"audio_url"`
// Title is a title
Title string `json:"title"`
// Caption 0-1024 characters after entities parsing
//
// optional
Caption string `json:"caption,omitempty"`
// ParseMode mode for parsing entities in the video caption.
// See formatting options for more details
// (https://core.telegram.org/bots/api#formatting-options).
//
// optional
ParseMode string `json:"parse_mode,omitempty"`
// CaptionEntities is a list of special entities that appear in the caption,
// which can be specified instead of parse_mode
//
// optional
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
// Performer is a performer
//
// optional
Performer string `json:"performer,omitempty"`
// Duration audio duration in seconds
//
// optional
Duration int `json:"audio_duration,omitempty"`
// ReplyMarkup inline keyboard attached to the message
//
// optional
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// InputMessageContent content of the message to be sent instead of the audio
//
// optional
InputMessageContent interface{} `json:"input_message_content,omitempty"`
}
InlineQueryResultAudio is an inline query response audio.
func NewInlineQueryResultAudio ¶
func NewInlineQueryResultAudio(id, url, title string) InlineQueryResultAudio
NewInlineQueryResultAudio creates a new inline query audio.
type InlineQueryResultCachedAudio ¶
type InlineQueryResultCachedAudio struct {
// Type of the result, must be audio
Type string `json:"type"`
// ID unique identifier for this result, 1-64 bytes
ID string `json:"id"`
// AudioID a valid file identifier for the audio file
AudioID string `json:"audio_file_id"`
// Caption 0-1024 characters after entities parsing
//
// optional
Caption string `json:"caption,omitempty"`
// ParseMode mode for parsing entities in the video caption.
// See formatting options for more details
// (https://core.telegram.org/bots/api#formatting-options).
//
// optional
ParseMode string `json:"parse_mode,omitempty"`
// CaptionEntities is a list of special entities that appear in the caption,
// which can be specified instead of parse_mode
//
// optional
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
// ReplyMarkup inline keyboard attached to the message
//
// optional
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// InputMessageContent content of the message to be sent instead of the audio
//
// optional
InputMessageContent interface{} `json:"input_message_content,omitempty"`
}
InlineQueryResultCachedAudio is an inline query response with cached audio.
func NewInlineQueryResultCachedAudio ¶
func NewInlineQueryResultCachedAudio(id, audioID string) InlineQueryResultCachedAudio
NewInlineQueryResultCachedAudio create a new inline query with cached photo.
type InlineQueryResultCachedDocument ¶
type InlineQueryResultCachedDocument struct {
// Type of the result, must be a document
Type string `json:"type"`
// ID unique identifier for this result, 1-64 bytes
ID string `json:"id"`
// DocumentID a valid file identifier for the file
DocumentID string `json:"document_file_id"`
// Title for the result
//
// optional
Title string `json:"title,omitempty"`
// Caption of the document to be sent, 0-1024 characters after entities parsing
//
// optional
Caption string `json:"caption,omitempty"`
// Description short description of the result
//
// optional
Description string `json:"description,omitempty"`
// ParseMode mode for parsing entities in the video caption.
// // See formatting options for more details
// // (https://core.telegram.org/bots/api#formatting-options).
//
// optional
ParseMode string `json:"parse_mode,omitempty"`
// CaptionEntities is a list of special entities that appear in the caption,
// which can be specified instead of parse_mode
//
// optional
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
// ReplyMarkup inline keyboard attached to the message
//
// optional
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// InputMessageContent content of the message to be sent instead of the file
//
// optional
InputMessageContent interface{} `json:"input_message_content,omitempty"`
}
InlineQueryResultCachedDocument is an inline query response with cached document.
func NewInlineQueryResultCachedDocument ¶
func NewInlineQueryResultCachedDocument(id, documentID, title string) InlineQueryResultCachedDocument
NewInlineQueryResultCachedDocument create a new inline query with cached photo.
type InlineQueryResultCachedGIF ¶
type InlineQueryResultCachedGIF struct {
// Type of the result, must be gif.
Type string `json:"type"`
// ID unique identifier for this result, 1-64 bytes.
ID string `json:"id"`
// GifID a valid file identifier for the GIF file.
GIFID string `json:"gif_file_id"`
// Title for the result
//
// optional
Title string `json:"title,omitempty"`
// Caption of the GIF file to be sent, 0-1024 characters after entities parsing.
//
// optional
Caption string `json:"caption,omitempty"`
// ParseMode mode for parsing entities in the caption.
// See formatting options for more details
// (https://core.telegram.org/bots/api#formatting-options).
//
// optional
ParseMode string `json:"parse_mode,omitempty"`
// CaptionEntities is a list of special entities that appear in the caption,
// which can be specified instead of parse_mode
//
// optional
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
// ShowCaptionAboveMedia pass True if the caption must be shown above the
// message media.
//
// optional
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
// ReplyMarkup inline keyboard attached to the message.
//
// optional
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// InputMessageContent content of the message to be sent instead of the GIF animation.
//
// optional
InputMessageContent interface{} `json:"input_message_content,omitempty"`
}
InlineQueryResultCachedGIF is an inline query response with cached gif.
func NewInlineQueryResultCachedGIF ¶
func NewInlineQueryResultCachedGIF(id, gifID string) InlineQueryResultCachedGIF
NewInlineQueryResultCachedGIF create a new inline query with cached photo.
type InlineQueryResultCachedMPEG4GIF ¶
type InlineQueryResultCachedMPEG4GIF struct {
// Type of the result, must be mpeg4_gif
Type string `json:"type"`
// ID unique identifier for this result, 1-64 bytes
ID string `json:"id"`
// MPEG4FileID a valid file identifier for the MP4 file
MPEG4FileID string `json:"mpeg4_file_id"`
// Title for the result
//
// optional
Title string `json:"title,omitempty"`
// Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing.
//
// optional
Caption string `json:"caption,omitempty"`
// ParseMode mode for parsing entities in the caption.
// See formatting options for more details
// (https://core.telegram.org/bots/api#formatting-options).
//
// optional
ParseMode string `json:"parse_mode,omitempty"`
// ParseMode mode for parsing entities in the video caption.
// See formatting options for more details
// (https://core.telegram.org/bots/api#formatting-options).
//
// optional
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
// ShowCaptionAboveMedia pass True if the caption must be shown above the
// message media.
//
// optional
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
// ReplyMarkup inline keyboard attached to the message.
//
// optional
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// InputMessageContent content of the message to be sent instead of the video animation.
//
// optional
InputMessageContent interface{} `json:"input_message_content,omitempty"`
}
InlineQueryResultCachedMPEG4GIF is an inline query response with cached H.264/MPEG-4 AVC video without sound gif.
func NewInlineQueryResultCachedMPEG4GIF ¶
func NewInlineQueryResultCachedMPEG4GIF(id, MPEG4GIFID string) InlineQueryResultCachedMPEG4GIF
NewInlineQueryResultCachedMPEG4GIF create a new inline query with cached MPEG4 GIF.
type InlineQueryResultCachedPhoto ¶
type InlineQueryResultCachedPhoto struct {
// Type of the result, must be a photo.
Type string `json:"type"`
// ID unique identifier for this result, 1-64 bytes.
ID string `json:"id"`
// PhotoID a valid file identifier of the photo.
PhotoID string `json:"photo_file_id"`
// Title for the result.
//
// optional
Title string `json:"title,omitempty"`
// Description short description of the result.
//
// optional
Description string `json:"description,omitempty"`
// Caption of the photo to be sent, 0-1024 characters after entities parsing.
//
// optional
Caption string `json:"caption,omitempty"`
// ParseMode mode for parsing entities in the photo caption.
// See formatting options for more details
// (https://core.telegram.org/bots/api#formatting-options).
//
// optional
ParseMode string `json:"parse_mode,omitempty"`
// CaptionEntities is a list of special entities that appear in the caption,
// which can be specified instead of parse_mode
//
// optional
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
// ShowCaptionAboveMedia pass True if the caption must be shown above the
// message media.
//
// optional
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
// ReplyMarkup inline keyboard attached to the message.
//
// optional
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// InputMessageContent content of the message to be sent instead of the photo.
//
// optional
InputMessageContent interface{} `json:"input_message_content,omitempty"`
}
InlineQueryResultCachedPhoto is an inline query response with cached photo.
func NewInlineQueryResultCachedPhoto ¶
func NewInlineQueryResultCachedPhoto(id, photoID string) InlineQueryResultCachedPhoto
NewInlineQueryResultCachedPhoto create a new inline query with cached photo.
type InlineQueryResultCachedSticker ¶
type InlineQueryResultCachedSticker struct {
// Type of the result, must be a sticker
Type string `json:"type"`
// ID unique identifier for this result, 1-64 bytes
ID string `json:"id"`
// StickerID a valid file identifier of the sticker
StickerID string `json:"sticker_file_id"`
// Title is not a part of the Bot API for cached sticker results and is
// ignored by Telegram.
//
// Deprecated: Telegram does not support this field. It is kept only for
// source compatibility and will be removed in a future release.
Title string `json:"title,omitempty"`
// ReplyMarkup inline keyboard attached to the message
//
// optional
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// InputMessageContent content of the message to be sent instead of the sticker
//
// optional
InputMessageContent interface{} `json:"input_message_content,omitempty"`
}
InlineQueryResultCachedSticker is an inline query response with cached sticker.
func NewInlineQueryResultCachedSticker ¶
func NewInlineQueryResultCachedSticker(id, stickerID, title string) InlineQueryResultCachedSticker
NewInlineQueryResultCachedSticker create a new inline query with cached sticker.
type InlineQueryResultCachedVideo ¶
type InlineQueryResultCachedVideo struct {
// Type of the result, must be video
Type string `json:"type"`
// ID unique identifier for this result, 1-64 bytes
ID string `json:"id"`
// VideoID a valid file identifier for the video file
VideoID string `json:"video_file_id"`
// Title for the result
Title string `json:"title"`
// Description short description of the result
//
// optional
Description string `json:"description,omitempty"`
// Caption of the video to be sent, 0-1024 characters after entities parsing
//
// optional
Caption string `json:"caption,omitempty"`
// ParseMode mode for parsing entities in the video caption.
// See formatting options for more details
// (https://core.telegram.org/bots/api#formatting-options).
//
// optional
ParseMode string `json:"parse_mode,omitempty"`
// CaptionEntities is a list of special entities that appear in the caption,
// which can be specified instead of parse_mode
//
// optional
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
// ShowCaptionAboveMedia pass True if the caption must be shown above the
// message media.
//
// optional
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
// ReplyMarkup inline keyboard attached to the message
//
// optional
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// InputMessageContent content of the message to be sent instead of the video
//
// optional
InputMessageContent interface{} `json:"input_message_content,omitempty"`
}
InlineQueryResultCachedVideo is an inline query response with cached video.
func NewInlineQueryResultCachedVideo ¶
func NewInlineQueryResultCachedVideo(id, videoID, title string) InlineQueryResultCachedVideo
NewInlineQueryResultCachedVideo create a new inline query with cached video.
type InlineQueryResultCachedVoice ¶
type InlineQueryResultCachedVoice struct {
// Type of the result, must be voice
Type string `json:"type"`
// ID unique identifier for this result, 1-64 bytes
ID string `json:"id"`
// VoiceID a valid file identifier for the voice message
VoiceID string `json:"voice_file_id"`
// Title voice message title
Title string `json:"title"`
// Caption 0-1024 characters after entities parsing
//
// optional
Caption string `json:"caption,omitempty"`
// ParseMode mode for parsing entities in the video caption.
// See formatting options for more details
// (https://core.telegram.org/bots/api#formatting-options).
//
// optional
ParseMode string `json:"parse_mode,omitempty"`
// CaptionEntities is a list of special entities that appear in the caption,
// which can be specified instead of parse_mode
//
// optional
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
// ReplyMarkup inline keyboard attached to the message
//
// optional
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// InputMessageContent content of the message to be sent instead of the voice message
//
// optional
InputMessageContent interface{} `json:"input_message_content,omitempty"`
}
InlineQueryResultCachedVoice is an inline query response with cached voice.
func NewInlineQueryResultCachedVoice ¶
func NewInlineQueryResultCachedVoice(id, voiceID, title string) InlineQueryResultCachedVoice
NewInlineQueryResultCachedVoice create a new inline query with cached photo.
type InlineQueryResultContact ¶
type InlineQueryResultContact struct {
Type string `json:"type"` // required
ID string `json:"id"` // required
PhoneNumber string `json:"phone_number"` // required
FirstName string `json:"first_name"` // required
LastName string `json:"last_name"`
VCard string `json:"vcard"`
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
InputMessageContent interface{} `json:"input_message_content,omitempty"`
ThumbnailURL string `json:"thumbnail_url"`
ThumbnailWidth int `json:"thumbnail_width"`
ThumbnailHeight int `json:"thumbnail_height"`
}
InlineQueryResultContact is an inline query response contact.
type InlineQueryResultDocument ¶
type InlineQueryResultDocument struct {
// Type of the result, must be a document
Type string `json:"type"`
// ID unique identifier for this result, 1-64 bytes
ID string `json:"id"`
// Title for the result
Title string `json:"title"`
// Caption of the document to be sent, 0-1024 characters after entities parsing
//
// optional
Caption string `json:"caption,omitempty"`
// ParseMode mode for parsing entities in the document caption.
// See formatting options for more details
// (https://core.telegram.org/bots/api#formatting-options).
//
// optional
ParseMode string `json:"parse_mode,omitempty"`
// CaptionEntities is a list of special entities that appear in the caption,
// which can be specified instead of parse_mode
//
// optional
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
// URL a valid url for the file
URL string `json:"document_url"`
// MimeType of the content of the file, either “application/pdf” or “application/zip”
MimeType string `json:"mime_type"`
// Description short description of the result
//
// optional
Description string `json:"description,omitempty"`
// ReplyMarkup inline keyboard attached to the message
//
// optional
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// InputMessageContent content of the message to be sent instead of the file
//
// optional
InputMessageContent interface{} `json:"input_message_content,omitempty"`
// ThumbURL url of the thumbnail (jpeg only) for the file
//
// optional
ThumbnailURL string `json:"thumbnail_url,omitempty"`
// ThumbWidth thumbnail width
//
// optional
ThumbnailWidth int `json:"thumbnail_width,omitempty"`
// ThumbHeight thumbnail height
//
// optional
ThumbnailHeight int `json:"thumbnail_height,omitempty"`
}
InlineQueryResultDocument is an inline query response document.
func NewInlineQueryResultDocument ¶
func NewInlineQueryResultDocument(id, url, title, mimeType string) InlineQueryResultDocument
NewInlineQueryResultDocument creates a new inline query document.
type InlineQueryResultGIF ¶
type InlineQueryResultGIF struct {
// Type of the result, must be gif.
Type string `json:"type"`
// ID unique identifier for this result, 1-64 bytes.
ID string `json:"id"`
// URL a valid URL for the GIF file. File size must not exceed 1MB.
URL string `json:"gif_url"`
// ThumbnailURL is the URL of the static (JPEG or GIF) or animated (MPEG4)
// thumbnail for the result.
ThumbnailURL string `json:"thumbnail_url"`
// ThumbnailMimeType is the MIME type of the thumbnail. Must be one of
// "image/jpeg", "image/gif", or "video/mp4". Defaults to "image/jpeg".
//
// optional
ThumbnailMimeType string `json:"thumbnail_mime_type,omitempty"`
// Width of the GIF
//
// optional
Width int `json:"gif_width,omitempty"`
// Height of the GIF
//
// optional
Height int `json:"gif_height,omitempty"`
// Duration of the GIF
//
// optional
Duration int `json:"gif_duration,omitempty"`
// Title for the result
//
// optional
Title string `json:"title,omitempty"`
// Caption of the GIF file to be sent, 0-1024 characters after entities parsing.
//
// optional
Caption string `json:"caption,omitempty"`
// ParseMode mode for parsing entities in the video caption.
// See formatting options for more details
// (https://core.telegram.org/bots/api#formatting-options).
//
// optional
ParseMode string `json:"parse_mode,omitempty"`
// CaptionEntities is a list of special entities that appear in the caption,
// which can be specified instead of parse_mode
//
// optional
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
// ShowCaptionAboveMedia pass True if the caption must be shown above the
// message media.
//
// optional
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
// ReplyMarkup inline keyboard attached to the message
//
// optional
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// InputMessageContent content of the message to be sent instead of the GIF animation.
//
// optional
InputMessageContent interface{} `json:"input_message_content,omitempty"`
}
InlineQueryResultGIF is an inline query response GIF.
func NewInlineQueryResultGIF ¶
func NewInlineQueryResultGIF(id, url string) InlineQueryResultGIF
NewInlineQueryResultGIF creates a new inline query GIF.
type InlineQueryResultGame ¶
type InlineQueryResultGame struct {
// Type of the result, must be game
Type string `json:"type"`
// ID unique identifier for this result, 1-64 bytes
ID string `json:"id"`
// GameShortName short name of the game
GameShortName string `json:"game_short_name"`
// ReplyMarkup inline keyboard attached to the message
//
// optional
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}
InlineQueryResultGame is an inline query response game.
type InlineQueryResultLocation ¶
type InlineQueryResultLocation struct {
// Type of the result, must be location
Type string `json:"type"`
// ID unique identifier for this result, 1-64 Bytes
ID string `json:"id"`
// Latitude of the location in degrees
Latitude float64 `json:"latitude"`
// Longitude of the location in degrees
Longitude float64 `json:"longitude"`
// Title of the location
Title string `json:"title"`
// HorizontalAccuracy is the radius of uncertainty for the location,
// measured in meters; 0-1500
//
// optional
HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"`
// LivePeriod is the period in seconds for which the location can be
// updated, should be between 60 and 86400.
//
// optional
LivePeriod int `json:"live_period,omitempty"`
// Heading is for live locations, a direction in which the user is moving,
// in degrees. Must be between 1 and 360 if specified.
//
// optional
Heading int `json:"heading,omitempty"`
// ProximityAlertRadius is for live locations, a maximum distance for
// proximity alerts about approaching another chat member, in meters. Must
// be between 1 and 100000 if specified.
//
// optional
ProximityAlertRadius int `json:"proximity_alert_radius,omitempty"`
// ReplyMarkup inline keyboard attached to the message
//
// optional
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// InputMessageContent content of the message to be sent instead of the location
//
// optional
InputMessageContent interface{} `json:"input_message_content,omitempty"`
// ThumbURL url of the thumbnail for the result
//
// optional
ThumbnailURL string `json:"thumbnail_url,omitempty"`
// ThumbWidth thumbnail width
//
// optional
ThumbnailWidth int `json:"thumbnail_width,omitempty"`
// ThumbHeight thumbnail height
//
// optional
ThumbnailHeight int `json:"thumbnail_height,omitempty"`
}
InlineQueryResultLocation is an inline query response location.
func NewInlineQueryResultLocation ¶
func NewInlineQueryResultLocation(id, title string, latitude, longitude float64) InlineQueryResultLocation
NewInlineQueryResultLocation creates a new inline query location.
type InlineQueryResultMPEG4GIF ¶
type InlineQueryResultMPEG4GIF struct {
// Type of the result, must be mpeg4_gif
Type string `json:"type"`
// ID unique identifier for this result, 1-64 bytes
ID string `json:"id"`
// URL a valid URL for the MP4 file. File size must not exceed 1MB
URL string `json:"mpeg4_url"`
// Width video width
//
// optional
Width int `json:"mpeg4_width,omitempty"`
// Height vVideo height
//
// optional
Height int `json:"mpeg4_height,omitempty"`
// Duration video duration
//
// optional
Duration int `json:"mpeg4_duration,omitempty"`
// ThumbnailURL is the URL of the static (JPEG or GIF) or animated (MPEG4)
// thumbnail for the result.
ThumbnailURL string `json:"thumbnail_url"`
// ThumbnailMimeType is the MIME type of the thumbnail. Must be one of
// "image/jpeg", "image/gif", or "video/mp4". Defaults to "image/jpeg".
//
// optional
ThumbnailMimeType string `json:"thumbnail_mime_type,omitempty"`
// Title for the result
//
// optional
Title string `json:"title,omitempty"`
// Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing.
//
// optional
Caption string `json:"caption,omitempty"`
// ParseMode mode for parsing entities in the video caption.
// See formatting options for more details
// (https://core.telegram.org/bots/api#formatting-options).
//
// optional
ParseMode string `json:"parse_mode,omitempty"`
// CaptionEntities is a list of special entities that appear in the caption,
// which can be specified instead of parse_mode
//
// optional
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
// ShowCaptionAboveMedia pass True if the caption must be shown above the
// message media.
//
// optional
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
// ReplyMarkup inline keyboard attached to the message
//
// optional
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// InputMessageContent content of the message to be sent instead of the video animation
//
// optional
InputMessageContent interface{} `json:"input_message_content,omitempty"`
}
InlineQueryResultMPEG4GIF is an inline query response MPEG4 GIF.
func NewInlineQueryResultMPEG4GIF ¶
func NewInlineQueryResultMPEG4GIF(id, url string) InlineQueryResultMPEG4GIF
NewInlineQueryResultMPEG4GIF creates a new inline query MPEG4 GIF.
type InlineQueryResultPhoto ¶
type InlineQueryResultPhoto struct {
// Type of the result, must be article.
Type string `json:"type"`
// ID unique identifier for this result, 1-64 Bytes.
ID string `json:"id"`
// URL a valid URL of the photo. Photo must be in jpeg format.
// Photo size must not exceed 5MB.
URL string `json:"photo_url"`
// MimeType is not a part of the Bot API for photo results and is ignored
// by Telegram.
//
// Deprecated: Telegram does not support this field. It is kept only for
// source compatibility and will be removed in a future release.
MimeType string `json:"mime_type,omitempty"`
// Width of the photo
//
// optional
Width int `json:"photo_width,omitempty"`
// Height of the photo
//
// optional
Height int `json:"photo_height,omitempty"`
// ThumbURL url of the thumbnail for the photo.
//
// optional
ThumbnailURL string `json:"thumbnail_url,omitempty"`
// Title for the result
//
// optional
Title string `json:"title,omitempty"`
// Description short description of the result
//
// optional
Description string `json:"description,omitempty"`
// Caption of the photo to be sent, 0-1024 characters after entities parsing.
//
// optional
Caption string `json:"caption,omitempty"`
// ParseMode mode for parsing entities in the photo caption.
// See formatting options for more details
// (https://core.telegram.org/bots/api#formatting-options).
//
// optional
ParseMode string `json:"parse_mode,omitempty"`
// ReplyMarkup inline keyboard attached to the message.
//
// optional
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// CaptionEntities is a list of special entities that appear in the caption,
// which can be specified instead of parse_mode
//
// optional
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
// ShowCaptionAboveMedia pass True if the caption must be shown above the
// message media.
//
// optional
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
// InputMessageContent content of the message to be sent instead of the photo.
//
// optional
InputMessageContent interface{} `json:"input_message_content,omitempty"`
}
InlineQueryResultPhoto is an inline query response photo.
func NewInlineQueryResultPhoto ¶
func NewInlineQueryResultPhoto(id, url string) InlineQueryResultPhoto
NewInlineQueryResultPhoto creates a new inline query photo.
func NewInlineQueryResultPhotoWithThumbnail ¶
func NewInlineQueryResultPhotoWithThumbnail(id, url, thumbnail string) InlineQueryResultPhoto
NewInlineQueryResultPhotoWithThumbnail creates a new inline query photo.
type InlineQueryResultVenue ¶
type InlineQueryResultVenue struct {
// Type of the result, must be venue
Type string `json:"type"`
// ID unique identifier for this result, 1-64 Bytes
ID string `json:"id"`
// Latitude of the venue location in degrees
Latitude float64 `json:"latitude"`
// Longitude of the venue location in degrees
Longitude float64 `json:"longitude"`
// Title of the venue
Title string `json:"title"`
// Address of the venue
Address string `json:"address"`
// FoursquareID foursquare identifier of the venue if known
//
// optional
FoursquareID string `json:"foursquare_id,omitempty"`
// FoursquareType foursquare type of the venue, if known.
// (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)
//
// optional
FoursquareType string `json:"foursquare_type,omitempty"`
// GooglePlaceID is the Google Places identifier of the venue
//
// optional
GooglePlaceID string `json:"google_place_id,omitempty"`
// GooglePlaceType is the Google Places type of the venue
//
// optional
GooglePlaceType string `json:"google_place_type,omitempty"`
// ReplyMarkup inline keyboard attached to the message
//
// optional
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// InputMessageContent content of the message to be sent instead of the venue
//
// optional
InputMessageContent interface{} `json:"input_message_content,omitempty"`
// ThumbURL url of the thumbnail for the result
//
// optional
ThumbnailURL string `json:"thumbnail_url,omitempty"`
// ThumbWidth thumbnail width
//
// optional
ThumbnailWidth int `json:"thumbnail_width,omitempty"`
// ThumbHeight thumbnail height
//
// optional
ThumbnailHeight int `json:"thumbnail_height,omitempty"`
}
InlineQueryResultVenue is an inline query response venue.
func NewInlineQueryResultVenue ¶
func NewInlineQueryResultVenue(id, title, address string, latitude, longitude float64) InlineQueryResultVenue
NewInlineQueryResultVenue creates a new inline query venue.
type InlineQueryResultVideo ¶
type InlineQueryResultVideo struct {
// Type of the result, must be video
Type string `json:"type"`
// ID unique identifier for this result, 1-64 bytes
ID string `json:"id"`
// URL a valid url for the embedded video player or video file
URL string `json:"video_url"`
// MimeType of the content of video url, “text/html” or “video/mp4”
MimeType string `json:"mime_type"`
//
// ThumbURL url of the thumbnail (jpeg only) for the video
// optional
ThumbnailURL string `json:"thumbnail_url,omitempty"`
// Title for the result
Title string `json:"title"`
// Caption of the video to be sent, 0-1024 characters after entities parsing
//
// optional
Caption string `json:"caption,omitempty"`
// ParseMode mode for parsing entities in the video caption.
// See formatting options for more details
// (https://core.telegram.org/bots/api#formatting-options).
//
// optional
ParseMode string `json:"parse_mode,omitempty"`
// CaptionEntities is a list of special entities that appear in the caption,
// which can be specified instead of parse_mode
//
// optional
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
// ShowCaptionAboveMedia pass True if the caption must be shown above the
// message media.
//
// optional
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
// Width video width
//
// optional
Width int `json:"video_width,omitempty"`
// Height video height
//
// optional
Height int `json:"video_height,omitempty"`
// Duration video duration in seconds
//
// optional
Duration int `json:"video_duration,omitempty"`
// Description short description of the result
//
// optional
Description string `json:"description,omitempty"`
// ReplyMarkup inline keyboard attached to the message
//
// optional
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// InputMessageContent content of the message to be sent instead of the video.
// This field is required if InlineQueryResultVideo is used to send
// an HTML-page as a result (e.g., a YouTube video).
//
// optional
InputMessageContent interface{} `json:"input_message_content,omitempty"`
}
InlineQueryResultVideo is an inline query response video.
func NewInlineQueryResultVideo ¶
func NewInlineQueryResultVideo(id, url string) InlineQueryResultVideo
NewInlineQueryResultVideo creates a new inline query video.
type InlineQueryResultVoice ¶
type InlineQueryResultVoice struct {
// Type of the result, must be voice
Type string `json:"type"`
// ID unique identifier for this result, 1-64 bytes
ID string `json:"id"`
// URL a valid URL for the voice recording
URL string `json:"voice_url"`
// Title recording title
Title string `json:"title"`
// Caption 0-1024 characters after entities parsing
//
// optional
Caption string `json:"caption,omitempty"`
// ParseMode mode for parsing entities in the video caption.
// See formatting options for more details
// (https://core.telegram.org/bots/api#formatting-options).
//
// optional
ParseMode string `json:"parse_mode,omitempty"`
// CaptionEntities is a list of special entities that appear in the caption,
// which can be specified instead of parse_mode
//
// optional
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
// Duration recording duration in seconds
//
// optional
Duration int `json:"voice_duration,omitempty"`
// ReplyMarkup inline keyboard attached to the message
//
// optional
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
// InputMessageContent content of the message to be sent instead of the voice recording
//
// optional
InputMessageContent interface{} `json:"input_message_content,omitempty"`
}
InlineQueryResultVoice is an inline query response voice.
func NewInlineQueryResultVoice ¶
func NewInlineQueryResultVoice(id, url, title string) InlineQueryResultVoice
NewInlineQueryResultVoice creates a new inline query voice.
type InlineQueryResultsButton ¶
type InlineQueryResultsButton struct {
// Text label of the button.
Text string `json:"text"`
// WebApp is the description of the Web App that will be launched when the
// user presses the button.
//
// optional
WebApp *WebAppInfo `json:"web_app,omitempty"`
// StartParameter is the deep-linking parameter for the /start message
// sent to the bot when the user presses the button. 1-64 characters.
//
// optional
StartParameter string `json:"start_parameter,omitempty"`
}
InlineQueryResultsButton represents a button to be shown above inline query results. Exactly one of WebApp or StartParameter must be set.
type InputChecklist ¶
type InputChecklist struct {
// Title is the title of the checklist.
Title string `json:"title"`
// ParseMode is the mode for parsing entities in the title.
//
// optional
ParseMode string `json:"parse_mode,omitempty"`
// TitleEntities are the special entities that appear in the title.
//
// optional
TitleEntities []MessageEntity `json:"title_entities,omitempty"`
// Tasks is the list of 1-30 tasks in the checklist.
Tasks []InputChecklistTask `json:"tasks"`
// OthersCanAddTasks pass true if users other than the creator can add
// tasks to the checklist.
//
// optional
OthersCanAddTasks bool `json:"others_can_add_tasks,omitempty"`
// OthersCanMarkTasksAsDone pass true if users other than the creator
// can mark tasks as done or not done.
//
// optional
OthersCanMarkTasksAsDone bool `json:"others_can_mark_tasks_as_done,omitempty"`
}
InputChecklist describes a checklist to create.
type InputChecklistTask ¶
type InputChecklistTask struct {
// ID is the unique identifier of the task; must be positive and unique
// among all task identifiers in the checklist.
ID int `json:"id"`
// Text is the text of the task.
Text string `json:"text"`
// ParseMode is the mode for parsing entities in the text.
//
// optional
ParseMode string `json:"parse_mode,omitempty"`
// TextEntities are the special entities that appear in the text.
//
// optional
TextEntities []MessageEntity `json:"text_entities,omitempty"`
}
InputChecklistTask describes a task to be added to a checklist.
type InputContactMessageContent ¶
type InputContactMessageContent struct {
// PhoneNumber contact's phone number
PhoneNumber string `json:"phone_number"`
// FirstName contact's first name
FirstName string `json:"first_name"`
// LastName contact's last name
//
// optional
LastName string `json:"last_name,omitempty"`
// Additional data about the contact in the form of a vCard
//
// optional
VCard string `json:"vcard,omitempty"`
}
InputContactMessageContent contains a contact for displaying as an inline query result.
type InputInvoiceMessageContent ¶
type InputInvoiceMessageContent struct {
// Product name, 1-32 characters
Title string `json:"title"`
// Product description, 1-255 characters
Description string `json:"description"`
// Bot-defined invoice payload, 1-128 bytes. This will not be displayed to
// the user, use for your internal processes.
Payload string `json:"payload"`
// Payment provider token, obtained via Botfather. Omit for payments in
// Telegram Stars.
//
// optional
ProviderToken string `json:"provider_token,omitempty"`
// Three-letter ISO 4217 currency code
Currency string `json:"currency"`
// Price breakdown, a JSON-serialized list of components (e.g. product
// price, tax, discount, delivery cost, delivery tax, bonus, etc.)
Prices []LabeledPrice `json:"prices"`
// The maximum accepted amount for tips in the smallest units of the
// currency (integer, not float/double).
//
// optional
MaxTipAmount int `json:"max_tip_amount,omitempty"`
// An array of suggested amounts of tip in the smallest units of the
// currency (integer, not float/double). At most 4 suggested tip amounts can
// be specified. The suggested tip amounts must be positive, passed in a
// strictly increased order and must not exceed max_tip_amount.
//
// optional
SuggestedTipAmounts []int `json:"suggested_tip_amounts,omitempty"`
// A JSON-serialized object for data about the invoice, which will be shared
// with the payment provider. A detailed description of the required fields
// should be provided by the payment provider.
//
// optional
ProviderData string `json:"provider_data,omitempty"`
// URL of the product photo for the invoice. Can be a photo of the goods or
// a marketing image for a service. People like it better when they see what
// they are paying for.
//
// optional
PhotoURL string `json:"photo_url,omitempty"`
// Photo size
//
// optional
PhotoSize int `json:"photo_size,omitempty"`
// Photo width
//
// optional
PhotoWidth int `json:"photo_width,omitempty"`
// Photo height
//
// optional
PhotoHeight int `json:"photo_height,omitempty"`
// Pass True, if you require the user's full name to complete the order
//
// optional
NeedName bool `json:"need_name,omitempty"`
// Pass True, if you require the user's phone number to complete the order
//
// optional
NeedPhoneNumber bool `json:"need_phone_number,omitempty"`
// Pass True, if you require the user's email address to complete the order
//
// optional
NeedEmail bool `json:"need_email,omitempty"`
// Pass True, if you require the user's shipping address to complete the order
//
// optional
NeedShippingAddress bool `json:"need_shipping_address,omitempty"`
// Pass True, if user's phone number should be sent to provider
//
// optional
SendPhoneNumberToProvider bool `json:"send_phone_number_to_provider,omitempty"`
// Pass True, if user's email address should be sent to provider
//
// optional
SendEmailToProvider bool `json:"send_email_to_provider,omitempty"`
// Pass True, if the final price depends on the shipping method
//
// optional
IsFlexible bool `json:"is_flexible,omitempty"`
}
InputInvoiceMessageContent represents the content of an invoice message to be sent as the result of an inline query.
type InputLocationMessageContent ¶
type InputLocationMessageContent struct {
// Latitude of the location in degrees
Latitude float64 `json:"latitude"`
// Longitude of the location in degrees
Longitude float64 `json:"longitude"`
// HorizontalAccuracy is the radius of uncertainty for the location,
// measured in meters; 0-1500
//
// optional
HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"`
// LivePeriod is the period in seconds for which the location can be
// updated, should be between 60 and 86400
//
// optional
LivePeriod int `json:"live_period,omitempty"`
// Heading is for live locations, a direction in which the user is moving,
// in degrees. Must be between 1 and 360 if specified.
//
// optional
Heading int `json:"heading,omitempty"`
// ProximityAlertRadius is for live locations, a maximum distance for
// proximity alerts about approaching another chat member, in meters. Must
// be between 1 and 100000 if specified.
//
// optional
ProximityAlertRadius int `json:"proximity_alert_radius,omitempty"`
}
InputLocationMessageContent contains a location for displaying as an inline query result.
type InputMediaAnimation ¶
type InputMediaAnimation struct {
BaseInputMedia
// Thumbnail of the file sent; can be ignored if thumbnail generation for
// the file is supported server-side.
//
// optional
Thumbnail RequestFileData `json:"thumbnail,omitempty"`
// Width video width
//
// optional
Width int `json:"width,omitempty"`
// Height video height
//
// optional
Height int `json:"height,omitempty"`
// Duration video duration
//
// optional
Duration int `json:"duration,omitempty"`
}
InputMediaAnimation is an animation to send as part of a media group.
func NewInputMediaAnimation ¶
func NewInputMediaAnimation(media RequestFileData) InputMediaAnimation
NewInputMediaAnimation creates a new InputMediaAnimation.
type InputMediaAudio ¶
type InputMediaAudio struct {
BaseInputMedia
// Thumbnail of the file sent; can be ignored if thumbnail generation for
// the file is supported server-side.
//
// optional
Thumbnail RequestFileData `json:"thumbnail,omitempty"`
// Duration of the audio in seconds
//
// optional
Duration int `json:"duration,omitempty"`
// Performer of the audio
//
// optional
Performer string `json:"performer,omitempty"`
// Title of the audio
//
// optional
Title string `json:"title,omitempty"`
}
InputMediaAudio is an audio to send as part of a media group.
func NewInputMediaAudio ¶
func NewInputMediaAudio(media RequestFileData) InputMediaAudio
NewInputMediaAudio creates a new InputMediaAudio.
type InputMediaDocument ¶
type InputMediaDocument struct {
BaseInputMedia
// Thumbnail of the file sent; can be ignored if thumbnail generation for
// the file is supported server-side.
//
// optional
Thumbnail RequestFileData `json:"thumbnail,omitempty"`
// DisableContentTypeDetection disables automatic server-side content type
// detection for files uploaded using multipart/form-data. Always true, if
// the document is sent as part of an album
//
// optional
DisableContentTypeDetection bool `json:"disable_content_type_detection,omitempty"`
}
InputMediaDocument is a general file to send as part of a media group.
func NewInputMediaDocument ¶
func NewInputMediaDocument(media RequestFileData) InputMediaDocument
NewInputMediaDocument creates a new InputMediaDocument.
type InputMediaLink ¶
type InputMediaLink struct {
// Type of the media, must be "link".
Type string `json:"type"`
// URL is the HTTP URL of the link.
URL string `json:"url"`
}
InputMediaLink represents an HTTP link to be sent. It is one of the InputMedia* variants accepted by InputPollOption.Media.
func NewInputMediaLink ¶
func NewInputMediaLink(url string) InputMediaLink
NewInputMediaLink creates a new InputMediaLink, which can be used as the media of a poll option.
type InputMediaLivePhoto ¶
type InputMediaLivePhoto struct {
BaseInputMedia
// Photo is the static photo of the live photo. Pass a file_id to send
// a file that exists on the Telegram servers (recommended) or pass an
// upload via "attach://<file_attach_name>".
Photo RequestFileData `json:"photo"`
}
InputMediaLivePhoto represents a live photo to be sent as part of a media group, sendLivePhoto, or as media in a poll/option/explanation.
Sending live photos by URL is not currently supported; both Media and Photo must be either a file_id or a multipart upload.
func NewInputMediaLivePhoto ¶
func NewInputMediaLivePhoto(media, photo RequestFileData) InputMediaLivePhoto
NewInputMediaLivePhoto creates a new InputMediaLivePhoto. Media is the live photo video and photo is its static image.
type InputMediaLocation ¶
type InputMediaLocation struct {
// Type must be "location".
Type string `json:"type"`
// Latitude of the location.
Latitude float64 `json:"latitude"`
// Longitude of the location.
Longitude float64 `json:"longitude"`
// HorizontalAccuracy is the radius of uncertainty for the location,
// measured in meters; 0-1500.
//
// optional
HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"`
}
InputMediaLocation represents a shared location to be sent as media in a poll, poll option, or quiz explanation.
func NewInputMediaLocation ¶
func NewInputMediaLocation(latitude, longitude float64) InputMediaLocation
NewInputMediaLocation creates a new InputMediaLocation, which can be used as the media of a poll or a poll option.
type InputMediaPhoto ¶
type InputMediaPhoto struct {
BaseInputMedia
}
InputMediaPhoto is a photo to send as part of a media group.
func NewInputMediaPhoto ¶
func NewInputMediaPhoto(media RequestFileData) InputMediaPhoto
NewInputMediaPhoto creates a new InputMediaPhoto.
type InputMediaSticker ¶
type InputMediaSticker struct {
// Type must be "sticker".
Type string `json:"type"`
// Media is the file to send.
Media RequestFileData `json:"media"`
// Emoji associated with the sticker; only for just-uploaded stickers.
//
// optional
Emoji string `json:"emoji,omitempty"`
}
InputMediaSticker represents a sticker file to be sent. Currently used as poll-option media.
func NewInputMediaSticker ¶
func NewInputMediaSticker(media RequestFileData) InputMediaSticker
NewInputMediaSticker creates a new InputMediaSticker, which can be used as the media of a poll option.
type InputMediaVenue ¶
type InputMediaVenue struct {
// Type must be "venue".
Type string `json:"type"`
// Latitude of the venue.
Latitude float64 `json:"latitude"`
// Longitude of the venue.
Longitude float64 `json:"longitude"`
// Title is the name of the venue.
Title string `json:"title"`
// Address of the venue.
Address string `json:"address"`
// FoursquareID is the Foursquare identifier of the venue.
//
// optional
FoursquareID string `json:"foursquare_id,omitempty"`
// FoursquareType is the Foursquare type of the venue.
//
// optional
FoursquareType string `json:"foursquare_type,omitempty"`
// GooglePlaceID is the Google Places identifier of the venue.
//
// optional
GooglePlaceID string `json:"google_place_id,omitempty"`
// GooglePlaceType is the Google Places type of the venue.
//
// optional
GooglePlaceType string `json:"google_place_type,omitempty"`
}
InputMediaVenue represents a venue to be sent as media in a poll, poll option, or quiz explanation.
func NewInputMediaVenue ¶
func NewInputMediaVenue(latitude, longitude float64, title, address string) InputMediaVenue
NewInputMediaVenue creates a new InputMediaVenue, which can be used as the media of a poll or a poll option.
type InputMediaVideo ¶
type InputMediaVideo struct {
BaseInputMedia
// Thumbnail of the file sent; can be ignored if thumbnail generation for
// the file is supported server-side.
//
// optional
Thumbnail RequestFileData `json:"thumbnail,omitempty"`
// Cover for the video in the message.
//
// optional
Cover RequestFileData `json:"cover,omitempty"`
// StartTimestamp is the timestamp in seconds from which the video will
// play in the message.
//
// optional
StartTimestamp int `json:"start_timestamp,omitempty"`
// Width video width
//
// optional
Width int `json:"width,omitempty"`
// Height video height
//
// optional
Height int `json:"height,omitempty"`
// Duration video duration
//
// optional
Duration int `json:"duration,omitempty"`
// SupportsStreaming pass True, if the uploaded video is suitable for streaming.
//
// optional
SupportsStreaming bool `json:"supports_streaming,omitempty"`
}
InputMediaVideo is a video to send as part of a media group.
func NewInputMediaVideo ¶
func NewInputMediaVideo(media RequestFileData) InputMediaVideo
NewInputMediaVideo creates a new InputMediaVideo.
type InputMediaVoiceNote ¶
type InputMediaVoiceNote struct {
BaseInputMedia
// Duration of the voice message in seconds
//
// optional
Duration int `json:"duration,omitempty"`
}
InputMediaVoiceNote represents a voice message file to be sent. It is accepted as the media of an InputRichBlock "voice_note" block and by InputRichMessageMedia.
func NewInputMediaVoiceNote ¶
func NewInputMediaVoiceNote(media RequestFileData) InputMediaVoiceNote
NewInputMediaVoiceNote creates a new InputMediaVoiceNote.
type InputPaidMedia ¶
type InputPaidMedia struct {
// Type of the media. One of "photo", "video", "live_photo".
Type string `json:"type"`
// Media is the file to send. Pass a file_id or URL, or upload a new one
// via FilePath/FileBytes/FileReader. For live_photo, this is the video
// portion of the live photo.
Media RequestFileData `json:"media"`
// Photo is the static photo to send when Type is "live_photo".
//
// optional
Photo RequestFileData `json:"photo,omitempty"`
// Thumbnail of the file (video only).
//
// optional
Thumbnail RequestFileData `json:"thumbnail,omitempty"`
// Cover for the video in the message (video only).
//
// optional
Cover RequestFileData `json:"cover,omitempty"`
// StartTimestamp is the timestamp in seconds from which the video will
// play in the message (video only).
//
// optional
StartTimestamp int `json:"start_timestamp,omitempty"`
// Width of the video.
//
// optional
Width int `json:"width,omitempty"`
// Height of the video.
//
// optional
Height int `json:"height,omitempty"`
// Duration of the video in seconds.
//
// optional
Duration int `json:"duration,omitempty"`
// SupportsStreaming is true if the uploaded video is suitable for
// streaming. Video only.
//
// optional
SupportsStreaming bool `json:"supports_streaming,omitempty"`
}
InputPaidMedia describes the paid media to be sent. Flat polymorphic by Type:
- "photo" → Media is set
- "video" → Media, Thumbnail, Cover, StartTimestamp, Width, Height, Duration, SupportsStreaming
- "live_photo" → Media (the video portion of the live photo) and Photo (the static photo) are set; sending live photos by URL is not supported.
type InputPollOption ¶
type InputPollOption struct {
// Text is the option text, 1-100 characters.
Text string `json:"text"`
// TextParseMode is the mode for parsing entities in the text. Currently,
// only custom_emoji entities are allowed.
//
// optional
TextParseMode string `json:"text_parse_mode,omitempty"`
// TextEntities is a list of special entities that appear in the poll
// option text. It can be specified instead of TextParseMode.
//
// optional
TextEntities []MessageEntity `json:"text_entities,omitempty"`
// Media is the optional media attached to the poll option. The value
// must be one of the InputMedia* variants accepted by InputPollOption
// (InputMediaAnimation, InputMediaLink, InputMediaLivePhoto,
// InputMediaLocation, InputMediaPhoto, InputMediaSticker,
// InputMediaVenue, InputMediaVideo).
//
// optional
Media any `json:"media,omitempty"`
}
InputPollOption contains information about one answer option in a poll to be sent.
type InputProfilePhoto ¶
type InputProfilePhoto struct {
// Type of the photo. One of "static", "animated".
Type string `json:"type"`
// Photo is the static profile photo. Profile photos can't be reused and
// can only be uploaded as a new file. Set when Type is "static".
//
// optional
Photo RequestFileData `json:"photo,omitempty"`
// Animation is the animated profile photo. Set when Type is "animated".
//
// optional
Animation RequestFileData `json:"animation,omitempty"`
// MainFrameTimestamp is the timestamp in seconds of the frame that will
// be used as the static profile photo. Set when Type is "animated".
// Defaults to 0.0.
//
// optional
MainFrameTimestamp float64 `json:"main_frame_timestamp,omitempty"`
}
InputProfilePhoto describes a profile photo to be set. Flat polymorphic by Type:
- "static" → Photo is set
- "animated" → Animation is set, MainFrameTimestamp optional
type InputRichBlock ¶
type InputRichBlock struct {
// Type of the block, one of the RichBlockType* constants.
Type string `json:"type"`
// Text is the block text. Set for "paragraph", "heading", "pre",
// "footer", "expandable_blockquote", "pullquote", and "thinking" blocks.
//
// optional
Text *RichText `json:"text,omitempty"`
// Size is the relative font size of a "heading" block; 1-6, 1 is largest.
//
// optional
Size int `json:"size,omitempty"`
// Language is the programming language of a "pre" block.
//
// optional
Language string `json:"language,omitempty"`
// Expression is the LaTeX expression of a "mathematical_expression"
// block.
//
// optional
Expression string `json:"expression,omitempty"`
// Name is the anchor name of an "anchor" block.
//
// optional
Name string `json:"name,omitempty"`
// Items are the items of a "list" block.
//
// optional
Items []InputRichBlockListItem `json:"items,omitempty"`
// Blocks is the nested content of "blockquote", "collage", "slideshow",
// and "details" blocks.
//
// optional
Blocks []InputRichBlock `json:"blocks,omitempty"`
// Credit is the credit of "blockquote", "expandable_blockquote", and
// "pullquote" blocks.
//
// optional
Credit *RichText `json:"credit,omitempty"`
// Cells are the rows of cells of a "table" block.
//
// optional
Cells [][]RichBlockTableCell `json:"cells,omitempty"`
// IsBordered, if true, gives a "table" block borders.
//
// optional
IsBordered bool `json:"is_bordered,omitempty"`
// IsStriped, if true, makes a "table" block striped.
//
// optional
IsStriped bool `json:"is_striped,omitempty"`
// IsCompact, if true, gives the cells of a "table" block smaller indents.
//
// optional
IsCompact bool `json:"is_compact,omitempty"`
// Buttons is the list of 1-8 buttons of a "buttons" block, shown in one
// row.
//
// optional
Buttons []RichMessageButton `json:"buttons,omitempty"`
// Align is the horizontal alignment of the buttons of a "buttons" block;
// one of "left", "center", or "right".
//
// optional
Align string `json:"align,omitempty"`
// Summary is the always-shown summary of a "details" block.
//
// optional
Summary *RichText `json:"summary,omitempty"`
// IsOpen, if true, makes the content of a "details" block visible by
// default.
//
// optional
IsOpen bool `json:"is_open,omitempty"`
// Location is the center of a "map" block.
//
// optional
Location *Location `json:"location,omitempty"`
// Zoom is the zoom level of a "map" block; 0-24.
//
// optional
Zoom int `json:"zoom,omitempty"`
// Width is the width of a "map" block; 0-10000.
//
// optional
Width int `json:"width,omitempty"`
// Height is the height of a "map" block; 0-10000.
//
// optional
Height int `json:"height,omitempty"`
// Animation is the animation of an "animation" block. Its caption is
// ignored.
//
// optional
Animation *InputMediaAnimation `json:"animation,omitempty"`
// Audio is the audio of an "audio" block. Its caption is ignored.
//
// optional
Audio *InputMediaAudio `json:"audio,omitempty"`
// Document is the general file of a "document" block. Its caption is
// ignored.
//
// optional
Document *InputMediaDocument `json:"document,omitempty"`
// Photo is the photo of a "photo" block. Its caption is ignored.
//
// optional
Photo *InputMediaPhoto `json:"photo,omitempty"`
// Video is the video of a "video" block. Its caption is ignored.
//
// optional
Video *InputMediaVideo `json:"video,omitempty"`
// VoiceNote is the voice note of a "voice_note" block. Its caption is
// ignored.
//
// optional
VoiceNote *InputMediaVoiceNote `json:"voice_note,omitempty"`
// Caption is the caption of a media block ("collage", "slideshow", "map",
// "animation", "audio", "document", "photo", "video", "voice_note"). It
// shares the "caption" wire field with TableCaption.
//
// optional
Caption *RichBlockCaption `json:"-"`
// TableCaption is the caption of a "table" block. It shares the "caption"
// wire field with Caption.
//
// optional
TableCaption *RichText `json:"-"`
}
InputRichBlock represents a block in a rich formatted message to be sent. It is a flat polymorphic type keyed by Type; only the fields relevant to a given Type are set. Type takes the same values as RichBlock.Type, so the RichBlockType* constants apply here too.
The "caption" wire field is split into Caption (for media blocks) and TableCaption (for the "table" block), which have different shapes; at most one is ever set.
func (InputRichBlock) MarshalJSON ¶
func (b InputRichBlock) MarshalJSON() ([]byte, error)
MarshalJSON encodes an InputRichBlock, emitting Caption or TableCaption under the shared "caption" wire field.
func (*InputRichBlock) UnmarshalJSON ¶
func (b *InputRichBlock) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes an InputRichBlock, routing the polymorphic "caption" field to Caption or TableCaption based on Type.
type InputRichBlockListItem ¶
type InputRichBlockListItem struct {
// Blocks is the content of the item.
Blocks []InputRichBlock `json:"blocks"`
// HasCheckbox, if true, gives the item a checkbox.
//
// optional
HasCheckbox bool `json:"has_checkbox,omitempty"`
// IsChecked, if true, gives the item a checked checkbox.
//
// optional
IsChecked bool `json:"is_checked,omitempty"`
// Value is, for ordered lists, the numeric value of the item label.
//
// optional
Value int `json:"value,omitempty"`
// Type is, for ordered lists, the type of the item label; one of "a", "A",
// "i", "I", or "1".
//
// optional
Type string `json:"type,omitempty"`
}
InputRichBlockListItem is an item of a rich formatted list to be sent.
type InputRichMessage ¶
type InputRichMessage struct {
// Blocks is the content of the rich message described as a list of
// blocks. Exactly one of HTML, Markdown, or Blocks must be set.
//
// optional
Blocks []InputRichBlock `json:"blocks,omitempty"`
// HTML is the content of the rich message described using HTML
// formatting. Exactly one of HTML, Markdown, or Blocks must be set. Use
// Media to specify the media used in the message.
//
// optional
HTML string `json:"html,omitempty"`
// Markdown is the content of the rich message described using Markdown
// formatting. Exactly one of HTML, Markdown, or Blocks must be set. Use
// Media to specify the media used in the message.
//
// optional
Markdown string `json:"markdown,omitempty"`
// Media is the list of media referenced from the Markdown or HTML fields
// using tg://photo?id=, tg://video?id=, and tg://audio?id= links.
//
// optional
Media []InputRichMessageMedia `json:"media,omitempty"`
// IsRTL, if true, requests that the rich message be shown right-to-left.
//
// optional
IsRTL bool `json:"is_rtl,omitempty"`
// SkipEntityDetection, if true, skips automatic detection of entities
// (URLs, email addresses, username mentions, hashtags, cashtags, bot
// commands, or phone numbers) in the text.
//
// optional
SkipEntityDetection bool `json:"skip_entity_detection,omitempty"`
}
InputRichMessage describes a rich message to be sent. Exactly one of HTML, Markdown, or Blocks must be set. See the Telegram "rich message formatting options" documentation for the supported markup.
type InputRichMessageContent ¶
type InputRichMessageContent struct {
// RichMessage is the message to be sent.
RichMessage InputRichMessage `json:"rich_message"`
}
InputRichMessageContent represents the content of a rich message to be sent as the result of an inline query.
type InputRichMessageMedia ¶
type InputRichMessageMedia struct {
// ID is the unique identifier of the media used in a tg://photo?id=,
// tg://video?id=, tg://document?id=, or tg://audio?id= link. 1-64
// characters; only A-Z, a-z, 0-9, _ and - are allowed.
ID string `json:"id"`
// Media to be sent; one of InputMediaAnimation, InputMediaAudio,
// InputMediaDocument, InputMediaPhoto, InputMediaVideo, or
// InputMediaVoiceNote. Everything except the media itself and its
// properties is ignored.
Media interface{} `json:"media"`
}
InputRichMessageMedia describes a media element embedded in an outgoing rich message, referenced from InputRichMessage.HTML or InputRichMessage.Markdown.
type InputSticker ¶
type InputSticker struct {
// Sticker is the file to upload. May be a file ID, an HTTP URL, or
// new file data via FilePath/FileBytes/FileReader. Animated and video
// stickers can't be uploaded via HTTP URL.
Sticker RequestFileData `json:"sticker"`
// Format of the added sticker. One of StickerFormatStatic,
// StickerFormatAnimated, StickerFormatVideo.
Format string `json:"format"`
// EmojiList is the list of 1-20 emoji associated with the sticker.
EmojiList []string `json:"emoji_list"`
// MaskPosition for "mask" stickers, the position where the mask should
// be placed on faces.
//
// optional
MaskPosition *MaskPosition `json:"mask_position,omitempty"`
// Keywords is the list of 0-20 search keywords for the sticker.
//
// optional
Keywords []string `json:"keywords,omitempty"`
}
InputSticker describes a sticker to be added to a sticker set.
type InputStoryContent ¶
type InputStoryContent struct {
// Type of the content. One of "photo", "video".
Type string `json:"type"`
// Photo is the photo content. Set when Type is "photo".
//
// optional
Photo RequestFileData `json:"photo,omitempty"`
// Video is the video content. Set when Type is "video".
//
// optional
Video RequestFileData `json:"video,omitempty"`
// Duration is the precise duration of the video in seconds. 0-60.
// Video only.
//
// optional
Duration float64 `json:"duration,omitempty"`
// CoverFrameTimestamp is the timestamp in seconds of the frame that
// will be used as the static cover for the story. Defaults to 0.0.
// Video only.
//
// optional
CoverFrameTimestamp float64 `json:"cover_frame_timestamp,omitempty"`
// IsAnimation is true if the video has no sound. Video only.
//
// optional
IsAnimation bool `json:"is_animation,omitempty"`
}
InputStoryContent describes the content of a story to be posted. Flat polymorphic by Type:
- "photo" → Photo is set
- "video" → Video is set; Duration, CoverFrameTimestamp, IsAnimation optional
type InputTextMessageContent ¶
type InputTextMessageContent struct {
// Text of the message to be sent, 1-4096 characters
Text string `json:"message_text"`
// ParseMode mode for parsing entities in the message text.
// See formatting options for more details
// (https://core.telegram.org/bots/api#formatting-options).
//
// optional
ParseMode string `json:"parse_mode,omitempty"`
// Entities is a list of special entities that appear in message text, which
// can be specified instead of parse_mode
//
// optional
Entities []MessageEntity `json:"entities,omitempty"`
// LinkPreviewOptions are options used for link preview generation for the
// message.
//
// optional
LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options,omitempty"`
}
InputTextMessageContent contains text for displaying as an inline query result.
type InputVenueMessageContent ¶
type InputVenueMessageContent struct {
// Latitude of the venue in degrees
Latitude float64 `json:"latitude"`
// Longitude of the venue in degrees
Longitude float64 `json:"longitude"`
// Title name of the venue
Title string `json:"title"`
// Address of the venue
Address string `json:"address"`
// FoursquareID foursquare identifier of the venue, if known
//
// optional
FoursquareID string `json:"foursquare_id,omitempty"`
// FoursquareType Foursquare type of the venue, if known
//
// optional
FoursquareType string `json:"foursquare_type,omitempty"`
// GooglePlaceID is the Google Places identifier of the venue
//
// optional
GooglePlaceID string `json:"google_place_id,omitempty"`
// GooglePlaceType is the Google Places type of the venue
//
// optional
GooglePlaceType string `json:"google_place_type,omitempty"`
}
InputVenueMessageContent contains a venue for displaying as an inline query result.
type Invoice ¶
type Invoice struct {
// Title product name
Title string `json:"title"`
// Description product description
Description string `json:"description"`
// StartParameter unique bot deep-linking parameter that can be used to generate this invoice
StartParameter string `json:"start_parameter"`
// Currency three-letter ISO 4217 currency code
// (see https://core.telegram.org/bots/payments#supported-currencies)
Currency string `json:"currency"`
// TotalAmount total price in the smallest units of the currency (integer, not float/double).
// For example, for a price of US$ 1.45 pass amount = 145.
// See the exp parameter in currencies.json
// (https://core.telegram.org/bots/payments/currencies.json),
// it shows the number of digits past the decimal point
// for each currency (2 for the majority of currencies).
TotalAmount int `json:"total_amount"`
}
Invoice contains basic information about an invoice.
type InvoiceConfig ¶
type InvoiceConfig struct {
BaseChat
Title string // required
Description string // required
Payload string // required
ProviderToken string // omit for payments in Telegram Stars
Currency string // required ("XTR" for Telegram Stars)
Prices []LabeledPrice // required
MaxTipAmount int
SuggestedTipAmounts []int
StartParameter string
ProviderData json.RawMessage
PhotoURL string
PhotoSize int
PhotoWidth int
PhotoHeight int
NeedName bool
NeedPhoneNumber bool
NeedEmail bool
NeedShippingAddress bool
SendPhoneNumberToProvider bool
SendEmailToProvider bool
IsFlexible bool
}
InvoiceConfig contains information for sendInvoice request.
func NewInvoice ¶
func NewInvoice(chatID int64, title, description, payload, providerToken, startParameter, currency string, prices []LabeledPrice) InvoiceConfig
NewInvoice creates a new Invoice request to the user.
type InvoiceLinkConfig ¶
type InvoiceLinkConfig struct {
BusinessConnectionID string
Title string // required
Description string // required
Payload string // required
ProviderToken string // omit for payments in Telegram Stars
Currency string // required ("XTR" for Telegram Stars)
Prices []LabeledPrice // required
SubscriptionPeriod int // in seconds; currently must be 2592000 (30 days) if set
MaxTipAmount int
SuggestedTipAmounts []int
ProviderData json.RawMessage
PhotoURL string
PhotoSize int
PhotoWidth int
PhotoHeight int
NeedName bool
NeedPhoneNumber bool
NeedEmail bool
NeedShippingAddress bool
SendPhoneNumberToProvider bool
SendEmailToProvider bool
IsFlexible bool
}
InvoiceLinkConfig contains information for createInvoiceLink request.
type KeyboardButton ¶
type KeyboardButton struct {
// Text of the button. If none of the optional fields are used,
// it will be sent as a message when the button is pressed.
Text string `json:"text"`
// RequestUsers if specified, pressing the button will open a list of
// suitable users. Identifiers of the selected users will be shared with the
// bot in a "users_shared" service message. Available in private chats only.
//
// optional
RequestUsers *KeyboardButtonRequestUsers `json:"request_users,omitempty"`
// RequestChat if specified, pressing the button will open a list of
// suitable chats. Tapping on a chat will send its identifier to the bot in
// a "chat_shared" service message. Available in private chats only.
//
// optional
RequestChat *KeyboardButtonRequestChat `json:"request_chat,omitempty"`
// RequestContact if True, the user's phone number will be sent
// as a contact when the button is pressed.
// Available in private chats only.
//
// optional
RequestContact bool `json:"request_contact,omitempty"`
// RequestLocation if True, the user's current location will be sent when
// the button is pressed.
// Available in private chats only.
//
// optional
RequestLocation bool `json:"request_location,omitempty"`
// RequestPoll if specified, the user will be asked to create a poll and send it
// to the bot when the button is pressed. Available in private chats only
//
// optional
RequestPoll *KeyboardButtonPollType `json:"request_poll,omitempty"`
// WebApp if specified, the described Web App will be launched when the button
// is pressed. The Web App will be able to send a “web_app_data” service
// message. Available in private chats only.
//
// optional
WebApp *WebAppInfo `json:"web_app,omitempty"`
// RequestManagedBot if specified, pressing the button will ask the user
// to create and share a bot that will be managed by the current bot.
// Available in private chats only.
//
// optional
RequestManagedBot *KeyboardButtonRequestManagedBot `json:"request_managed_bot,omitempty"`
// IconCustomEmojiID is the unique identifier of the custom emoji to be
// displayed on the button. Available only if the bot can use custom
// emoji in the message.
//
// optional
IconCustomEmojiID string `json:"icon_custom_emoji_id,omitempty"`
// Style of the button. Currently, one of "default", "primary",
// "destructive". Defaults to "default".
//
// optional
Style string `json:"style,omitempty"`
}
KeyboardButton represents one button of the reply keyboard. For simple text buttons String can be used instead of this object to specify text of the button. Optional fields request_contact, request_location, and request_poll are mutually exclusive.
func NewKeyboardButton ¶
func NewKeyboardButton(text string) KeyboardButton
NewKeyboardButton creates a regular keyboard button.
func NewKeyboardButtonContact ¶
func NewKeyboardButtonContact(text string) KeyboardButton
NewKeyboardButtonContact creates a keyboard button that requests user contact information upon click.
func NewKeyboardButtonLocation ¶
func NewKeyboardButtonLocation(text string) KeyboardButton
NewKeyboardButtonLocation creates a keyboard button that requests user location information upon click.
func NewKeyboardButtonRow ¶
func NewKeyboardButtonRow(buttons ...KeyboardButton) []KeyboardButton
NewKeyboardButtonRow creates a row of keyboard buttons.
func NewKeyboardButtonWebApp ¶
func NewKeyboardButtonWebApp(text string, webapp WebAppInfo) KeyboardButton
NewKeyboardButtonWebApp creates a keyboard button with text which goes to a WebApp.
type KeyboardButtonPollType ¶
type KeyboardButtonPollType struct {
// Type is if quiz is passed, the user will be allowed to create only polls
// in the quiz mode. If regular is passed, only regular polls will be
// allowed. Otherwise, the user will be allowed to create a poll of any type.
Type string `json:"type"`
}
KeyboardButtonPollType represents type of poll, which is allowed to be created and sent when the corresponding button is pressed.
type KeyboardButtonRequestChat ¶
type KeyboardButtonRequestChat struct {
// RequestID is a signed 32-bit identifier of the request, which will be
// received back in the ChatShared object. Must be unique within the message.
RequestID int `json:"request_id"`
// ChatIsChannel pass True to request a channel chat, pass False to request
// a group or a supergroup chat.
ChatIsChannel bool `json:"chat_is_channel"`
// ChatIsForum pass True to request a forum supergroup, pass False to
// request a non-forum chat. If not specified, no additional restrictions
// are applied.
//
// optional
ChatIsForum *bool `json:"chat_is_forum,omitempty"`
// ChatHasUsername pass True to request a supergroup or a channel with a
// username, pass False to request a chat without a username. If not
// specified, no additional restrictions are applied.
//
// optional
ChatHasUsername *bool `json:"chat_has_username,omitempty"`
// ChatIsCreated pass True to request a chat owned by the user. Otherwise,
// no additional restrictions are applied.
//
// optional
ChatIsCreated bool `json:"chat_is_created,omitempty"`
// UserAdministratorRights is the required administrator rights of the
// user in the chat. If not specified, no additional restrictions are applied.
//
// optional
UserAdministratorRights *ChatAdministratorRights `json:"user_administrator_rights,omitempty"`
// BotAdministratorRights is the required administrator rights of the bot
// in the chat. The rights must be a subset of UserAdministratorRights.
// If not specified, no additional restrictions are applied.
//
// optional
BotAdministratorRights *ChatAdministratorRights `json:"bot_administrator_rights,omitempty"`
// BotIsMember pass True to request a chat with the bot as a member.
// Otherwise, no additional restrictions are applied.
//
// optional
BotIsMember bool `json:"bot_is_member,omitempty"`
// RequestTitle pass true to request the chat's title.
//
// optional
RequestTitle bool `json:"request_title,omitempty"`
// RequestUsername pass true to request the chat's username.
//
// optional
RequestUsername bool `json:"request_username,omitempty"`
// RequestPhoto pass true to request the chat's photo.
//
// optional
RequestPhoto bool `json:"request_photo,omitempty"`
}
KeyboardButtonRequestChat defines the criteria used to request a suitable chat. The identifier of the selected chat will be shared with the bot when the corresponding button is pressed.
type KeyboardButtonRequestManagedBot ¶
type KeyboardButtonRequestManagedBot struct {
// RequestID is a signed 32-bit identifier of the request.
// Must be unique within the message.
RequestID int `json:"request_id"`
// SuggestedName is the suggested name for the bot.
//
// optional
SuggestedName string `json:"suggested_name,omitempty"`
// SuggestedUsername is the suggested username for the bot.
//
// optional
SuggestedUsername string `json:"suggested_username,omitempty"`
}
KeyboardButtonRequestManagedBot defines the parameters for the creation of a managed bot. Information about the created bot will be shared with the bot using the update managed_bot and a Message with the field managed_bot_created.
type KeyboardButtonRequestUsers ¶
type KeyboardButtonRequestUsers struct {
// RequestID is a signed 32-bit identifier of the request, which will be
// received back in the UsersShared object. Must be unique within the message.
RequestID int `json:"request_id"`
// UserIsBot pass True to request bots, pass False to request regular
// users. If not specified, no additional restrictions are applied.
//
// optional
UserIsBot *bool `json:"user_is_bot,omitempty"`
// UserIsPremium pass True to request premium users, pass False to request
// non-premium users. If not specified, no additional restrictions are applied.
//
// optional
UserIsPremium *bool `json:"user_is_premium,omitempty"`
// MaxQuantity is the maximum number of users to be selected; 1-10. Defaults to 1.
//
// optional
MaxQuantity int `json:"max_quantity,omitempty"`
// RequestName pass true to request the users' first and last names.
//
// optional
RequestName bool `json:"request_name,omitempty"`
// RequestUsername pass true to request the users' usernames.
//
// optional
RequestUsername bool `json:"request_username,omitempty"`
// RequestPhoto pass true to request the users' photos.
//
// optional
RequestPhoto bool `json:"request_photo,omitempty"`
}
KeyboardButtonRequestUsers defines the criteria used to request suitable users. The identifiers of the selected users will be shared with the bot when the corresponding button is pressed.
type KickChatMemberConfig ¶
type KickChatMemberConfig = BanChatMemberConfig
KickChatMemberConfig contains extra fields to ban user.
This was renamed to BanChatMember in later versions of the Telegram Bot API.
type LabeledPrice ¶
type LabeledPrice struct {
// Label portion label
Label string `json:"label"`
// Amount price of the product in the smallest units of the currency (integer, not float/double).
// For example, for a price of US$ 1.45 pass amount = 145.
// See the exp parameter in currencies.json
// (https://core.telegram.org/bots/payments/currencies.json),
// it shows the number of digits past the decimal point
// for each currency (2 for the majority of currencies).
Amount int `json:"amount"`
}
LabeledPrice represents a portion of the price for goods or services.
type LeaveChatConfig ¶
LeaveChatConfig allows you to leave a chat.
type Link ¶
type Link struct {
// URL of the link.
URL string `json:"url"`
}
Link represents an HTTP link.
type LinkPreviewOptions ¶
type LinkPreviewOptions struct {
// IsDisabled is true, if the link preview is disabled.
//
// optional
IsDisabled bool `json:"is_disabled,omitempty"`
// URL to use for the link preview. If empty, then the first URL found in
// the message text will be used.
//
// optional
URL string `json:"url,omitempty"`
// PreferSmallMedia is true, if the media in the link preview is supposed
// to be shrunk; ignored if the URL isn't explicitly specified or media
// size change isn't supported for the preview.
//
// optional
PreferSmallMedia bool `json:"prefer_small_media,omitempty"`
// PreferLargeMedia is true, if the media in the link preview is supposed
// to be enlarged; ignored if the URL isn't explicitly specified or media
// size change isn't supported for the preview.
//
// optional
PreferLargeMedia bool `json:"prefer_large_media,omitempty"`
// ShowAboveText is true, if the link preview must be shown above the
// message text; otherwise, the link preview will be shown below the
// message text.
//
// optional
ShowAboveText bool `json:"show_above_text,omitempty"`
}
LinkPreviewOptions describes the options used for link preview generation.
type LivePhoto ¶
type LivePhoto struct {
// FileID is an identifier for the video file which can be used to
// download or reuse the file.
FileID string `json:"file_id"`
// FileUniqueID is the unique identifier for the video file which is
// supposed to be the same over time and for different bots. Can't be
// used to download or reuse the file.
FileUniqueID string `json:"file_unique_id"`
// Width is the video width as defined by the sender.
Width int `json:"width"`
// Height is the video height as defined by the sender.
Height int `json:"height"`
// Duration of the video in seconds as defined by the sender.
Duration int `json:"duration"`
// Photo are the available sizes of the corresponding static photo.
//
// optional
Photo []PhotoSize `json:"photo,omitempty"`
// MimeType is the MIME type of the file as defined by the sender.
//
// optional
MimeType string `json:"mime_type,omitempty"`
// FileSize is the file size in bytes.
//
// optional
FileSize int64 `json:"file_size,omitempty"`
}
LivePhoto represents a live photo (a photo with a short video).
type LivePhotoConfig ¶
type LivePhotoConfig struct {
BaseFile
EphemeralSendParams
Photo RequestFileData
Caption string
ParseMode string
CaptionEntities []MessageEntity
ShowCaptionAboveMedia bool
HasSpoiler bool
}
LivePhotoConfig contains information about a SendLivePhoto request.
File holds the live photo video (must be 10 seconds or less and 10 MB or less). Photo holds the static image. Sending live photos by URL is not currently supported.
func NewLivePhoto ¶
func NewLivePhoto(chatID int64, video, photo RequestFileData) LivePhotoConfig
NewLivePhoto creates a new sendLivePhoto request.
video is the live photo's video portion (≤10 s, ≤10 MB) and photo is the static image. Sending live photos by URL is not currently supported.
type Location ¶
type Location struct {
// Longitude as defined by sender
Longitude float64 `json:"longitude"`
// Latitude as defined by sender
Latitude float64 `json:"latitude"`
// HorizontalAccuracy is the radius of uncertainty for the location,
// measured in meters; 0-1500
//
// optional
HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"`
// LivePeriod is time relative to the message sending date, during which the
// location can be updated, in seconds. For active live locations only.
//
// optional
LivePeriod int `json:"live_period,omitempty"`
// Heading is the direction in which user is moving, in degrees; 1-360. For
// active live locations only.
//
// optional
Heading int `json:"heading,omitempty"`
// ProximityAlertRadius is the maximum distance for proximity alerts about
// approaching another chat member, in meters. For sent live locations only.
//
// optional
ProximityAlertRadius int `json:"proximity_alert_radius,omitempty"`
}
Location represents a point on the map.
type LocationAddress ¶
type LocationAddress struct {
// CountryCode is the two-letter ISO 3166-1 alpha-2 country code of the
// country where the location is located.
CountryCode string `json:"country_code"`
// State is the state of the location. Optional.
//
// optional
State string `json:"state,omitempty"`
// City is the city of the location. Optional.
//
// optional
City string `json:"city,omitempty"`
// Street is the street address of the location. Optional.
//
// optional
Street string `json:"street,omitempty"`
}
LocationAddress describes the physical address of a location.
type LocationConfig ¶
type LocationConfig struct {
BaseChat
EphemeralSendParams
Latitude float64 // required
Longitude float64 // required
HorizontalAccuracy float64 // optional
LivePeriod int // optional
Heading int // optional
ProximityAlertRadius int // optional
}
LocationConfig contains information about a SendLocation request.
func NewLocation ¶
func NewLocation(chatID int64, latitude float64, longitude float64) LocationConfig
NewLocation shares your location.
chatID is where to send it, latitude and longitude are coordinates.
type LogOutConfig ¶
type LogOutConfig struct{}
LogOutConfig is a request to log out of the cloud Bot API server.
Note that you may not log back in for at least 10 minutes.
type LoginURL ¶
type LoginURL struct {
// URL is an HTTP URL to be opened with user authorization data added to the
// query string when the button is pressed. If the user refuses to provide
// authorization data, the original URL without information about the user
// will be opened. The data added is the same as described in Receiving
// authorization data.
//
// NOTE: You must always check the hash of the received data to verify the
// authentication and the integrity of the data as described in Checking
// authorization.
URL string `json:"url"`
// ForwardText is the new text of the button in forwarded messages
//
// optional
ForwardText string `json:"forward_text,omitempty"`
// BotUsername is the username of a bot, which will be used for user
// authorization. See Setting up a bot for more details. If not specified,
// the current bot's username will be assumed. The url's domain must be the
// same as the domain linked with the bot. See Linking your domain to the
// bot for more details.
//
// optional
BotUsername string `json:"bot_username,omitempty"`
// RequestWriteAccess if true requests permission for your bot to send
// messages to the user
//
// optional
RequestWriteAccess bool `json:"request_write_access,omitempty"`
}
LoginURL represents a parameter of the inline keyboard button used to automatically authorize a user. Serves as a great replacement for the Telegram Login Widget when the user is coming from Telegram. All the user needs to do is tap/click a button and confirm that they want to log in.
type ManagedBotCreated ¶
type ManagedBotCreated struct {
// Bot is information about the bot. The bot's token can be fetched
// using the method getManagedBotToken.
Bot User `json:"bot"`
}
ManagedBotCreated contains information about the bot that was created to be managed by the current bot.
type ManagedBotUpdated ¶
type ManagedBotUpdated struct {
// User that created the bot.
User User `json:"user"`
// Bot is information about the bot. Token of the bot can be fetched
// using the method getManagedBotToken.
Bot User `json:"bot"`
}
ManagedBotUpdated contains information about the creation, token update, or owner update of a bot that is managed by the current bot.
type MaskPosition ¶
type MaskPosition struct {
// The part of the face relative to which the mask should be placed.
// One of “forehead”, “eyes”, “mouth”, or “chin”.
Point string `json:"point"`
// Shift by X-axis measured in widths of the mask scaled to the face size,
// from left to right. For example, choosing -1.0 will place mask just to
// the left of the default mask position.
XShift float64 `json:"x_shift"`
// Shift by Y-axis measured in heights of the mask scaled to the face size,
// from top to bottom. For example, 1.0 will place the mask just below the
// default mask position.
YShift float64 `json:"y_shift"`
// Mask scaling coefficient. For example, 2.0 means double size.
Scale float64 `json:"scale"`
}
MaskPosition describes the position on faces where a mask should be placed by default.
type MediaGroupConfig ¶
type MediaGroupConfig struct {
ChatID int64
ChannelUsername string
BusinessConnectionID string
MessageThreadID int
DirectMessagesTopicID int
MessageEffectID string
Media []interface{}
DisableNotification bool
ProtectContent bool
AllowPaidBroadcast bool
ReplyParameters *ReplyParameters
}
MediaGroupConfig allows you to send a group of media.
Media consist of InputMedia items (InputMediaPhoto, InputMediaVideo).
func NewMediaGroup ¶
func NewMediaGroup(chatID int64, files []interface{}) MediaGroupConfig
NewMediaGroup creates a new media group. Files should be an array of two to ten InputMediaPhoto or InputMediaVideo.
type MenuButton ¶
type MenuButton struct {
// Type is the type of menu button, must be one of:
// - `commands`
// - `web_app`
// - `default`
Type string `json:"type"`
// Text is the text on the button, for `web_app` type.
Text string `json:"text,omitempty"`
// WebApp is the description of the Web App that will be launched when the
// user presses the button for the `web_app` type.
WebApp *WebAppInfo `json:"web_app,omitempty"`
}
MenuButton describes the bot's menu button in a private chat.
type Message ¶
type Message struct {
// MessageID is a unique message identifier inside this chat.
//
// Note: starting December 1, 2024, video messages sent, copied or
// forwarded to groups and channels with a sufficiently large audience
// may be scheduled by the server until the video is reencoded. Such
// messages come back with MessageID == 0 and cannot be referenced
// (replied to, edited, forwarded) until Telegram finishes processing.
MessageID int `json:"message_id"`
// BusinessConnectionID is the unique identifier of the business
// connection from which the message was received. If non-empty, the
// message belongs to a chat of the corresponding business account that
// is independent from any potential bot chat which might share the same
// identifier.
//
// optional
BusinessConnectionID string `json:"business_connection_id,omitempty"`
// MessageThreadID is the unique identifier of a message thread to which
// the message belongs; for supergroups only.
//
// optional
MessageThreadID int `json:"message_thread_id,omitempty"`
// IsTopicMessage is true, if the message is sent to a forum topic.
//
// optional
IsTopicMessage bool `json:"is_topic_message,omitempty"`
// From is a sender, empty for messages sent to channels;
//
// optional
From *User `json:"from,omitempty"`
// SenderChat is the sender of the message, sent on behalf of a chat. The
// channel itself for channel messages. The supergroup itself for messages
// from anonymous group administrators. The linked channel for messages
// automatically forwarded to the discussion group
//
// optional
SenderChat *Chat `json:"sender_chat,omitempty"`
// Date of the message was sent in Unix time
Date int `json:"date"`
// Chat is the conversation the message belongs to
Chat *Chat `json:"chat"`
// ForwardOrigin is information about the original message for forwarded
// messages.
//
// optional
ForwardOrigin *MessageOrigin `json:"forward_origin,omitempty"`
// IsAutomaticForward is true if the message is a channel post that was
// automatically forwarded to the connected discussion group.
//
// optional
IsAutomaticForward bool `json:"is_automatic_forward,omitempty"`
// SenderBoostCount is the number of boosts added by the user, if the
// sender of the message boosted the chat.
//
// optional
SenderBoostCount int `json:"sender_boost_count,omitempty"`
// SenderTag is the custom tag assigned to the sender in the chat.
//
// optional
SenderTag string `json:"sender_tag,omitempty"`
// ReceiverUser is, for ephemeral messages, the user who received the
// message.
//
// optional
ReceiverUser *User `json:"receiver_user,omitempty"`
// EphemeralMessageID is, for ephemeral messages, the identifier of the
// ephemeral message inside this chat. The identifier may be reused for
// another ephemeral message after the message is deleted or expires.
//
// optional
EphemeralMessageID int `json:"ephemeral_message_id,omitempty"`
// SenderBusinessBot is the bot that actually sent the message on behalf
// of the business account. Available only for outgoing messages sent on
// behalf of the connected business account.
//
// optional
SenderBusinessBot *User `json:"sender_business_bot,omitempty"`
// IsFromOffline is true, if the message was sent by an implicit action,
// for example, as an away or a greeting business message, or as a
// scheduled message.
//
// optional
IsFromOffline bool `json:"is_from_offline,omitempty"`
// ReplyToMessage for replies, the original message.
// Note that the Message object in this field will not contain further ReplyToMessage fields
// even if it itself is a reply;
//
// optional
ReplyToMessage *Message `json:"reply_to_message,omitempty"`
// ExternalReply is information about the message that is being replied to,
// which may come from another chat or forum topic.
//
// optional
ExternalReply *ExternalReplyInfo `json:"external_reply,omitempty"`
// Quote is the part of the message that is actually quoted in the reply.
//
// optional
Quote *TextQuote `json:"quote,omitempty"`
// ReplyToStory is the story that this message is a reply to.
//
// optional
ReplyToStory *Story `json:"reply_to_story,omitempty"`
// ReplyToChecklistTaskID is the identifier of the specific checklist
// task that is being replied to.
//
// optional
ReplyToChecklistTaskID int `json:"reply_to_checklist_task_id,omitempty"`
// ViaBot through which the message was sent;
//
// optional
ViaBot *User `json:"via_bot,omitempty"`
// RichMessage is set if the message is a rich formatted message.
//
// optional
RichMessage *RichMessage `json:"rich_message,omitempty"`
// GuestQueryID is the unique identifier for the guest query. Use this
// identifier with the method answerGuestQuery to send a response
// message. If non-empty, the message belongs to the chat where the
// guest bot was summoned, which may not coincide with other existing
// bot chats sharing the same identifier.
//
// optional
GuestQueryID string `json:"guest_query_id,omitempty"`
// GuestBotCallerUser is, for a message sent by a guest bot, the user
// whose original message triggered the bot's response.
//
// optional
GuestBotCallerUser *User `json:"guest_bot_caller_user,omitempty"`
// GuestBotCallerChat is, for a message sent by a guest bot, the chat
// whose original message triggered the bot's response.
//
// optional
GuestBotCallerChat *Chat `json:"guest_bot_caller_chat,omitempty"`
// EditDate of the message was last edited in Unix time;
//
// optional
EditDate int `json:"edit_date,omitempty"`
// HasProtectedContent is true if the message can't be forwarded.
//
// optional
HasProtectedContent bool `json:"has_protected_content,omitempty"`
// MediaGroupID is the unique identifier of a media message group this message belongs to;
//
// optional
MediaGroupID string `json:"media_group_id,omitempty"`
// EffectID is the unique identifier of the message effect added to the message;
//
// optional
EffectID string `json:"effect_id,omitempty"`
// AuthorSignature is the signature of the post author for messages in channels;
//
// optional
AuthorSignature string `json:"author_signature,omitempty"`
// Text is for text messages, the actual UTF-8 text of the message, 0-4096 characters;
//
// optional
Text string `json:"text,omitempty"`
// Entities are for text messages, special entities like usernames,
// URLs, bot commands, etc. that appear in the text;
//
// optional
Entities []MessageEntity `json:"entities,omitempty"`
// LinkPreviewOptions are options used for link preview generation for the
// message, if it is a text message and link preview options were changed.
//
// optional
LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options,omitempty"`
// Animation message is an animation, information about the animation.
// For backward compatibility, when this field is set, the document field will also be set;
//
// optional
Animation *Animation `json:"animation,omitempty"`
// Audio message is an audio file, information about the file;
//
// optional
Audio *Audio `json:"audio,omitempty"`
// Document message is a general file, information about the file;
//
// optional
Document *Document `json:"document,omitempty"`
// Photo message is a photo, available sizes of the photo;
//
// optional
Photo []PhotoSize `json:"photo,omitempty"`
// LivePhoto message is a live photo, information about the live photo.
// For backward compatibility, when this field is set, the photo field
// will also be set.
//
// optional
LivePhoto *LivePhoto `json:"live_photo,omitempty"`
// PaidMedia is the paid media attached to the message.
//
// optional
PaidMedia *PaidMediaInfo `json:"paid_media,omitempty"`
// Sticker message is a sticker, information about the sticker;
//
// optional
Sticker *Sticker `json:"sticker,omitempty"`
// Video message is a video, information about the video;
//
// optional
Video *Video `json:"video,omitempty"`
// VideoNote message is a video note, information about the video message;
//
// optional
VideoNote *VideoNote `json:"video_note,omitempty"`
// Story is a forwarded story.
//
// optional
Story *Story `json:"story,omitempty"`
// Voice message is a voice message, information about the file;
//
// optional
Voice *Voice `json:"voice,omitempty"`
// Caption for the animation, audio, document, photo, video or voice, 0-1024 characters;
//
// optional
Caption string `json:"caption,omitempty"`
// ShowCaptionAboveMedia is true, if the caption must be shown above the
// message media.
//
// optional
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
// CaptionEntities;
//
// optional
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
// Contact message is a shared contact, information about the contact;
//
// optional
Contact *Contact `json:"contact,omitempty"`
// Dice is a dice with random value;
//
// optional
Dice *Dice `json:"dice,omitempty"`
// Game message is a game, information about the game;
//
// optional
Game *Game `json:"game,omitempty"`
// Poll is a native poll, information about the poll;
//
// optional
Poll *Poll `json:"poll,omitempty"`
// Venue message is a venue, information about the venue.
// For backward compatibility, when this field is set, the location field
// will also be set;
//
// optional
Venue *Venue `json:"venue,omitempty"`
// Location message is a shared location, information about the location;
//
// optional
Location *Location `json:"location,omitempty"`
// NewChatMembers that were added to the group or supergroup
// and information about them (the bot itself may be one of these members);
//
// optional
NewChatMembers []User `json:"new_chat_members,omitempty"`
// LeftChatMember is a member was removed from the group,
// information about them (this member may be the bot itself);
//
// optional
LeftChatMember *User `json:"left_chat_member,omitempty"`
// NewChatTitle is a chat title was changed to this value;
//
// optional
NewChatTitle string `json:"new_chat_title,omitempty"`
// NewChatPhoto is a chat photo was change to this value;
//
// optional
NewChatPhoto []PhotoSize `json:"new_chat_photo,omitempty"`
// DeleteChatPhoto is a service message: the chat photo was deleted;
//
// optional
DeleteChatPhoto bool `json:"delete_chat_photo,omitempty"`
// GroupChatCreated is a service message: the group has been created;
//
// optional
GroupChatCreated bool `json:"group_chat_created,omitempty"`
// SuperGroupChatCreated is a service message: the supergroup has been created.
// This field can't be received in a message coming through updates,
// because bot can't be a member of a supergroup when it is created.
// It can only be found in ReplyToMessage if someone replies to a very first message
// in a directly created supergroup;
//
// optional
SuperGroupChatCreated bool `json:"supergroup_chat_created,omitempty"`
// ChannelChatCreated is a service message: the channel has been created.
// This field can't be received in a message coming through updates,
// because bot can't be a member of a channel when it is created.
// It can only be found in ReplyToMessage
// if someone replies to a very first message in a channel;
//
// optional
ChannelChatCreated bool `json:"channel_chat_created,omitempty"`
// MessageAutoDeleteTimerChanged is a service message: auto-delete timer
// settings changed in the chat.
//
// optional
MessageAutoDeleteTimerChanged *MessageAutoDeleteTimerChanged `json:"message_auto_delete_timer_changed,omitempty"`
// MigrateToChatID is the group has been migrated to a supergroup with the specified identifier.
// This number may be greater than 32 bits and some programming languages
// may have difficulty/silent defects in interpreting it.
// But it is smaller than 52 bits, so a signed 64-bit integer
// or double-precision float type are safe for storing this identifier;
//
// optional
MigrateToChatID int64 `json:"migrate_to_chat_id,omitempty"`
// MigrateFromChatID is the supergroup has been migrated from a group with the specified identifier.
// This number may be greater than 32 bits and some programming languages
// may have difficulty/silent defects in interpreting it.
// But it is smaller than 52 bits, so a signed 64-bit integer
// or double-precision float type are safe for storing this identifier;
//
// optional
MigrateFromChatID int64 `json:"migrate_from_chat_id,omitempty"`
// PinnedMessage is a specified message was pinned.
// Note that the Message object in this field will not contain further ReplyToMessage
// fields even if it is itself a reply;
//
// optional
PinnedMessage *Message `json:"pinned_message,omitempty"`
// Invoice message is an invoice for a payment;
//
// optional
Invoice *Invoice `json:"invoice,omitempty"`
// SuccessfulPayment message is a service message about a successful payment,
// information about the payment;
//
// optional
SuccessfulPayment *SuccessfulPayment `json:"successful_payment,omitempty"`
// RefundedPayment is a service message about a refunded payment,
// information about the payment.
//
// optional
RefundedPayment *RefundedPayment `json:"refunded_payment,omitempty"`
// ConnectedWebsite is the domain name of the website on which the user has
// logged in;
//
// optional
ConnectedWebsite string `json:"connected_website,omitempty"`
// PassportData is a Telegram Passport data;
//
// optional
PassportData *PassportData `json:"passport_data,omitempty"`
// ProximityAlertTriggered is a service message. A user in the chat
// triggered another user's proximity alert while sharing Live Location
//
// optional
ProximityAlertTriggered *ProximityAlertTriggered `json:"proximity_alert_triggered,omitempty"`
// VideoChatScheduled is a service message: video chat scheduled.
//
// optional
VideoChatScheduled *VideoChatScheduled `json:"video_chat_scheduled,omitempty"`
// VideoChatStarted is a service message: video chat started.
//
// optional
VideoChatStarted *VideoChatStarted `json:"video_chat_started,omitempty"`
// VideoChatEnded is a service message: video chat ended.
//
// optional
VideoChatEnded *VideoChatEnded `json:"video_chat_ended,omitempty"`
// VideoChatParticipantsInvited is a service message: new participants
// invited to a video chat.
//
// optional
VideoChatParticipantsInvited *VideoChatParticipantsInvited `json:"video_chat_participants_invited,omitempty"`
// WebAppData is a service message: data sent by a Web App.
//
// optional
WebAppData *WebAppData `json:"web_app_data,omitempty"`
//
// optional
UsersShared *UsersShared `json:"users_shared,omitempty"`
//
// optional
ChatShared *ChatShared `json:"chat_shared,omitempty"`
// ForumTopicCreated is a service message: forum topic created
//
// optional
ForumTopicCreated *ForumTopicCreated `json:"forum_topic_created,omitempty"`
// ForumTopicEdited is a service message: forum topic edited
//
// optional
ForumTopicEdited *ForumTopicEdited `json:"forum_topic_edited,omitempty"`
// ForumTopicClosed is a service message: forum topic closed
//
// optional
ForumTopicClosed *ForumTopicClosed `json:"forum_topic_closed,omitempty"`
// ForumTopicReopened is a service message: forum topic reopened
//
// optional
ForumTopicReopened *ForumTopicReopened `json:"forum_topic_reopened,omitempty"`
// GeneralForumTopicHidden is a service message: the General forum topic hidden
//
// optional
GeneralForumTopicHidden *GeneralForumTopicHidden `json:"general_forum_topic_hidden,omitempty"`
//
// optional
GeneralForumTopicUnhidden *GeneralForumTopicUnhidden `json:"general_forum_topic_unhidden,omitempty"`
// WriteAccessAllowed is a service message: the user allowed the bot added to
// the attachment menu to write messages
//
// optional
WriteAccessAllowed *WriteAccessAllowed `json:"write_access_allowed,omitempty"`
// BoostAdded is a service message: a user boosted the chat.
//
// optional
BoostAdded *ChatBoostAdded `json:"boost_added,omitempty"`
// ChatBackgroundSet is a service message: chat background set.
//
// optional
ChatBackgroundSet *ChatBackground `json:"chat_background_set,omitempty"`
// Gift is a service message: a gift was sent or received.
//
// optional
Gift *GiftInfo `json:"gift,omitempty"`
// UniqueGift is a service message: a unique gift was sent or received.
//
// optional
UniqueGift *UniqueGiftInfo `json:"unique_gift,omitempty"`
// GiftUpgradeSent is a service message about a gift upgrade sent to
// another user.
//
// optional
GiftUpgradeSent *GiftInfo `json:"gift_upgrade_sent,omitempty"`
// ChatOwnerLeft is a service message about the owner leaving the chat.
//
// optional
ChatOwnerLeft *ChatOwnerLeft `json:"chat_owner_left,omitempty"`
// ChatOwnerChanged is a service message about a change of the chat
// owner.
//
// optional
ChatOwnerChanged *ChatOwnerChanged `json:"chat_owner_changed,omitempty"`
// PollOptionAdded is a service message about a poll option being added
// to a poll.
//
// optional
PollOptionAdded *PollOptionAdded `json:"poll_option_added,omitempty"`
// PollOptionDeleted is a service message about a poll option being
// deleted from a poll.
//
// optional
PollOptionDeleted *PollOptionDeleted `json:"poll_option_deleted,omitempty"`
// CommunityChatAdded is a service message about the chat being added to a
// community.
//
// optional
CommunityChatAdded *CommunityChatAdded `json:"community_chat_added,omitempty"`
// CommunityChatRemoved is a service message about the chat being removed
// from a community.
//
// optional
CommunityChatRemoved *CommunityChatRemoved `json:"community_chat_removed,omitempty"`
// CommunityChatJoined is a service message about the chat being joined by
// a user from a community.
//
// optional
CommunityChatJoined *CommunityChatJoined `json:"community_chat_joined,omitempty"`
// ReplyToPollOptionID is the persistent identifier of the poll option
// that this message is a reply to.
//
// optional
ReplyToPollOptionID string `json:"reply_to_poll_option_id,omitempty"`
// PaidMessagePriceChanged is a service message about a change in the
// price of paid messages within the chat.
//
// optional
PaidMessagePriceChanged *PaidMessagePriceChanged `json:"paid_message_price_changed,omitempty"`
// DirectMessagePriceChanged is a service message about a change in the
// pricing of direct messages sent to a channel chat.
//
// optional
DirectMessagePriceChanged *DirectMessagePriceChanged `json:"direct_message_price_changed,omitempty"`
// Checklist is the checklist that was sent, if the message contains a
// checklist.
//
// optional
Checklist *Checklist `json:"checklist,omitempty"`
// ChecklistTasksDone is a service message about tasks in a checklist
// being marked as done or not done.
//
// optional
ChecklistTasksDone *ChecklistTasksDone `json:"checklist_tasks_done,omitempty"`
// ChecklistTasksAdded is a service message about tasks added to a
// checklist.
//
// optional
ChecklistTasksAdded *ChecklistTasksAdded `json:"checklist_tasks_added,omitempty"`
// DirectMessagesTopic is the topic of a direct messages chat to which
// the message belongs.
//
// optional
DirectMessagesTopic *DirectMessagesTopic `json:"direct_messages_topic,omitempty"`
// IsPaidPost is true, if the message is a paid post. Note that such
// posts must not be deleted for 24 hours after the payment.
//
// optional
IsPaidPost bool `json:"is_paid_post,omitempty"`
// SuggestedPostInfo describes the suggested post if this message is a
// suggested post.
//
// optional
SuggestedPostInfo *SuggestedPostInfo `json:"suggested_post_info,omitempty"`
// SuggestedPostApproved is a service message about the approval of a
// suggested post.
//
// optional
SuggestedPostApproved *SuggestedPostApproved `json:"suggested_post_approved,omitempty"`
// SuggestedPostApprovalFailed is a service message about a failure to
// approve a suggested post.
//
// optional
SuggestedPostApprovalFailed *SuggestedPostApprovalFailed `json:"suggested_post_approval_failed,omitempty"`
// SuggestedPostDeclined is a service message about the rejection of a
// suggested post.
//
// optional
SuggestedPostDeclined *SuggestedPostDeclined `json:"suggested_post_declined,omitempty"`
// SuggestedPostPaid is a service message about a successful payment
// for a suggested post.
//
// optional
SuggestedPostPaid *SuggestedPostPaid `json:"suggested_post_paid,omitempty"`
// SuggestedPostRefunded is a service message about a payment refund
// for a suggested post.
//
// optional
SuggestedPostRefunded *SuggestedPostRefunded `json:"suggested_post_refunded,omitempty"`
// PaidStarCount is the number of Telegram Stars that were paid by the
// sender of the message to send it.
//
// optional
PaidStarCount int `json:"paid_star_count,omitempty"`
// GiveawayCreated is a service message: a scheduled giveaway was created.
//
// optional
GiveawayCreated *GiveawayCreated `json:"giveaway_created,omitempty"`
// Giveaway is a scheduled giveaway message.
//
// optional
Giveaway *Giveaway `json:"giveaway,omitempty"`
// GiveawayWinners is a giveaway with public winners that was completed.
//
// optional
GiveawayWinners *GiveawayWinners `json:"giveaway_winners,omitempty"`
// GiveawayCompleted is a service message about the completion of a
// giveaway without public winners.
//
// optional
GiveawayCompleted *GiveawayCompleted `json:"giveaway_completed,omitempty"`
// HasMediaSpoiler is true, if the message media is covered by a spoiler animation
//
// optional
HasMediaSpoiler bool `json:"has_media_spoiler,omitempty"`
// ManagedBotCreated is a service message: user created a bot
// that will be managed by the current bot.
//
// optional
ManagedBotCreated *ManagedBotCreated `json:"managed_bot_created,omitempty"`
// ReplyMarkup is the Inline keyboard attached to the message.
// login_url buttons are represented as ordinary url buttons.
//
// optional
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}
Message represents a message.
func (*Message) Command ¶
Command checks if the message was a command and if it was, returns the command. If the Message was not a command, it returns an empty string.
If the command contains the at name syntax, it is removed. Use CommandWithAt() if you do not want that.
func (*Message) CommandArguments ¶
CommandArguments checks if the message was a command and if it was, returns all text after the command name. If the Message was not a command, it returns an empty string.
Note: The first character after the command name is omitted: - "/foo bar baz" yields "bar baz", not " bar baz" - "/foo-bar baz" yields "bar baz", too Even though the latter is not a command conforming to the spec, the API marks "/foo" as command entity.
func (*Message) CommandWithAt ¶
CommandWithAt checks if the message was a command and if it was, returns the command. If the Message was not a command, it returns an empty string.
If the command contains the at name syntax, it is not removed. Use Command() if you want that.
type MessageAutoDeleteTimerChanged ¶
type MessageAutoDeleteTimerChanged struct {
// New auto-delete time for messages in the chat.
MessageAutoDeleteTime int `json:"message_auto_delete_time"`
}
MessageAutoDeleteTimerChanged represents a service message about a change in auto-delete timer settings.
type MessageConfig ¶
type MessageConfig struct {
BaseChat
EphemeralSendParams
Text string
ParseMode string
Entities []MessageEntity
LinkPreviewOptions *LinkPreviewOptions
}
MessageConfig contains information about a SendMessage request.
func NewMessage ¶
func NewMessage(chatID int64, text string) MessageConfig
NewMessage creates a new Message.
chatID is where to send it, text is the message text.
func NewMessageToChannel ¶
func NewMessageToChannel(username string, text string) MessageConfig
NewMessageToChannel creates a new Message that is sent to a channel by username.
username is the username of the channel, text is the message text, and the username should be in the form of `@username`.
type MessageEntity ¶
type MessageEntity struct {
// Type of the entity.
// Can be:
// “mention” (@username),
// “hashtag” (#hashtag),
// “cashtag” ($USD),
// “bot_command” (/start@jobs_bot),
// “url” (https://telegram.org),
// “email” (do-not-reply@telegram.org),
// “phone_number” (+1-212-555-0123),
// “bold” (bold text),
// “italic” (italic text),
// “underline” (underlined text),
// “strikethrough” (strikethrough text),
// "spoiler" (spoiler message),
// “blockquote” (block quotation),
// “expandable_blockquote” (collapsed-by-default block quotation),
// “code” (monowidth string),
// “pre” (monowidth block),
// “text_link” (for clickable text URLs),
// “text_mention” (for users without usernames),
// “custom_emoji” (for inline custom emoji stickers),
// “date_time” (for formatted date and time)
Type string `json:"type"`
// Offset in UTF-16 code units to the start of the entity
Offset int `json:"offset"`
// Length
Length int `json:"length"`
// URL for “text_link” only, url that will be opened after user taps on the text
//
// optional
URL string `json:"url,omitempty"`
// User for “text_mention” only, the mentioned user
//
// optional
User *User `json:"user,omitempty"`
// Language for “pre” only, the programming language of the entity text
//
// optional
Language string `json:"language,omitempty"`
// CustomEmojiID for "custom_emoji" only, unique identifier of the custom emoji.
// Use getCustomEmojiStickers to get full information about the sticker.
//
// optional
CustomEmojiID string `json:"custom_emoji_id,omitempty"`
// UnixTime for "date_time" only, the Unix time associated with the entity.
//
// optional
UnixTime int64 `json:"unix_time,omitempty"`
// DateTimeFormat for "date_time" only, the string that defines the
// formatting of the date and time. See date-time entity formatting for
// more details.
//
// optional
DateTimeFormat string `json:"date_time_format,omitempty"`
}
MessageEntity represents one special entity in a text message.
func (MessageEntity) IsBold ¶
func (e MessageEntity) IsBold() bool
IsBold returns true if the type of the message entity is "bold" (bold text).
func (MessageEntity) IsCode ¶
func (e MessageEntity) IsCode() bool
IsCode returns true if the type of the message entity is "code" (monowidth string).
func (MessageEntity) IsCommand ¶
func (e MessageEntity) IsCommand() bool
IsCommand returns true if the type of the message entity is "bot_command".
func (MessageEntity) IsEmail ¶
func (e MessageEntity) IsEmail() bool
IsEmail returns true if the type of the message entity is "email".
func (MessageEntity) IsHashtag ¶
func (e MessageEntity) IsHashtag() bool
IsHashtag returns true if the type of the message entity is "hashtag".
func (MessageEntity) IsItalic ¶
func (e MessageEntity) IsItalic() bool
IsItalic returns true if the type of the message entity is "italic" (italic text).
func (MessageEntity) IsMention ¶
func (e MessageEntity) IsMention() bool
IsMention returns true if the type of the message entity is "mention" (@username).
func (MessageEntity) IsPre ¶
func (e MessageEntity) IsPre() bool
IsPre returns true if the type of the message entity is "pre" (monowidth block).
func (MessageEntity) IsTextLink ¶
func (e MessageEntity) IsTextLink() bool
IsTextLink returns true if the type of the message entity is "text_link" (clickable text URL).
func (MessageEntity) IsTextMention ¶
func (e MessageEntity) IsTextMention() bool
IsTextMention returns true if the type of the message entity is "text_mention" (At this time, the user field exists, and occurs when tagging a member without a username)
func (MessageEntity) IsURL ¶
func (e MessageEntity) IsURL() bool
IsURL returns true if the type of the message entity is "url".
type MessageGenerationStopped ¶
type MessageGenerationStopped struct {
// Chat in which the message is generated.
Chat Chat `json:"chat"`
// MessageThreadID is the unique identifier of the message thread in which
// the message is generated.
//
// optional
MessageThreadID int `json:"message_thread_id,omitempty"`
// DraftID is the unique identifier of the message draft which was
// stopped.
DraftID int64 `json:"draft_id"`
}
MessageGenerationStopped describes an update about a user stopping message generation.
type MessageID ¶
type MessageID struct {
MessageID int `json:"message_id"`
}
MessageID represents a unique message identifier. Returned by forwardMessage(s), copyMessage(s), and sendMediaGroup.
Note: for video forwards/copies to large groups and channels, Telegram may schedule the message until the video finishes reencoding (since December 1, 2024). In that case MessageID == 0 and the message cannot be referenced until it is actually sent.
type MessageOrigin ¶
type MessageOrigin struct {
// Type of the message origin. One of "user", "hidden_user", "chat", "channel".
Type string `json:"type"`
// Date the message was sent originally in Unix time.
Date int `json:"date"`
// SenderUser is the user that sent the message originally. Set when Type
// is "user".
//
// optional
SenderUser *User `json:"sender_user,omitempty"`
// SenderUserName is the name of the user that sent the message originally.
// Set when Type is "hidden_user".
//
// optional
SenderUserName string `json:"sender_user_name,omitempty"`
// SenderChat is the chat that sent the message originally. Set when Type
// is "chat".
//
// optional
SenderChat *Chat `json:"sender_chat,omitempty"`
// AuthorSignature is the signature of the original message author or
// the post author for messages from a channel. Optional for "chat" and
// "channel".
//
// optional
AuthorSignature string `json:"author_signature,omitempty"`
// Chat is the channel chat to which the message was originally sent.
// Set when Type is "channel".
//
// optional
Chat *Chat `json:"chat,omitempty"`
// MessageID is the unique message identifier inside the chat. Set when
// Type is "channel".
//
// optional
MessageID int `json:"message_id,omitempty"`
}
MessageOrigin describes the origin of a message. The Type field discriminates between concrete variants:
- "user" → SenderUser is set
- "hidden_user" → SenderUserName is set
- "chat" → SenderChat is set; AuthorSignature optional
- "channel" → Chat and MessageID are set; AuthorSignature optional
type MessageReactionCountUpdated ¶
type MessageReactionCountUpdated struct {
// Chat containing the message.
Chat Chat `json:"chat"`
// MessageID is the unique identifier of the message inside the chat.
MessageID int `json:"message_id"`
// Date of the change in Unix time.
Date int `json:"date"`
// Reactions is the list of reactions that are present on the message.
Reactions []ReactionCount `json:"reactions"`
}
MessageReactionCountUpdated represents reaction changes on a message with anonymous reactions.
type MessageReactionUpdated ¶
type MessageReactionUpdated struct {
// Chat containing the message the user reacted to.
Chat Chat `json:"chat"`
// MessageID is the unique identifier of the message inside the chat.
MessageID int `json:"message_id"`
// User that changed the reaction, if the user isn't anonymous.
//
// optional
User *User `json:"user,omitempty"`
// ActorChat is the chat on behalf of which the reaction was changed,
// if the user is anonymous.
//
// optional
ActorChat *Chat `json:"actor_chat,omitempty"`
// Date of the change in Unix time.
Date int `json:"date"`
// OldReaction is the previous list of reaction types that were set by the user.
OldReaction []ReactionType `json:"old_reaction"`
// NewReaction is the new list of reaction types that have been set by the user.
NewReaction []ReactionType `json:"new_reaction"`
}
MessageReactionUpdated represents a change of a reaction on a message performed by a user.
type NewStickerSetConfig ¶
type NewStickerSetConfig struct {
UserID int64
Name string
Title string
Stickers []InputSticker
StickerType string // one of StickerTypeRegular, StickerTypeMask, StickerTypeCustomEmoji
NeedsRepainting bool
}
NewStickerSetConfig creates a new sticker set owned by a user.
Each sticker's format is specified on the InputSticker itself via its Format field, allowing mixed-format sticker packs.
type OrderInfo ¶
type OrderInfo struct {
// Name user name
//
// optional
Name string `json:"name,omitempty"`
// PhoneNumber user's phone number
//
// optional
PhoneNumber string `json:"phone_number,omitempty"`
// Email user email
//
// optional
Email string `json:"email,omitempty"`
// ShippingAddress user shipping address
//
// optional
ShippingAddress *ShippingAddress `json:"shipping_address,omitempty"`
}
OrderInfo represents information about an order.
type OwnedGift ¶
type OwnedGift struct {
// Type of the gift. One of "regular", "unique".
Type string `json:"type"`
// Gift is the regular gift, when Type is "regular". It shares the "gift"
// wire field with UniqueGift.
//
// optional
Gift *Gift `json:"-"`
// UniqueGift is the unique gift, when Type is "unique". It shares the
// "gift" wire field with Gift.
//
// optional
UniqueGift *UniqueGift `json:"-"`
// OwnedGiftID is the unique identifier of the gift for the bot; for
// gifts received on behalf of business accounts only.
//
// optional
OwnedGiftID string `json:"owned_gift_id,omitempty"`
// SenderUser is the sender of the gift, if it was sent by a user.
//
// optional
SenderUser *User `json:"sender_user,omitempty"`
// SendDate is the date the gift was sent in Unix time.
SendDate int `json:"send_date"`
// Text is the text of the message that was added to the gift.
//
// optional
Text string `json:"text,omitempty"`
// Entities are the special entities that appear in the text.
//
// optional
Entities []MessageEntity `json:"entities,omitempty"`
// IsPrivate is true, if the sender and gift text are shown only to the
// gift receiver.
//
// optional
IsPrivate bool `json:"is_private,omitempty"`
// IsSaved is true, if the gift is displayed on the account's profile
// page; for gifts received on behalf of business accounts only.
//
// optional
IsSaved bool `json:"is_saved,omitempty"`
// CanBeUpgraded is true, if the regular gift can be upgraded to a
// unique gift; for gifts received on behalf of business accounts only.
// Regular only.
//
// optional
CanBeUpgraded bool `json:"can_be_upgraded,omitempty"`
// WasRefunded is true, if the gift was refunded and isn't available
// anymore. Regular only.
//
// optional
WasRefunded bool `json:"was_refunded,omitempty"`
// ConvertStarCount is the number of Telegram Stars that can be claimed
// by the receiver instead of the gift. Regular only.
//
// optional
ConvertStarCount int `json:"convert_star_count,omitempty"`
// PrepaidUpgradeStarCount is the number of Telegram Stars that were
// paid by the sender for the ability to upgrade the gift. Regular only.
//
// optional
PrepaidUpgradeStarCount int `json:"prepaid_upgrade_star_count,omitempty"`
// IsUpgradeSeparate is true, if the gift upgrade to a unique gift can
// be requested separately by the receiver. Regular only.
//
// optional
IsUpgradeSeparate bool `json:"is_upgrade_separate,omitempty"`
// UniqueGiftNumber is the sequential number of the unique gift among
// gifts upgraded from the same regular gift. Regular only.
//
// optional
UniqueGiftNumber int `json:"unique_gift_number,omitempty"`
// CanBeTransferred is true, if the gift can be transferred to another
// owner; for gifts received on behalf of business accounts only.
// Unique only.
//
// optional
CanBeTransferred bool `json:"can_be_transferred,omitempty"`
// TransferStarCount is the number of Telegram Stars that must be paid
// to transfer the gift; omitted if the bot cannot transfer the gift.
// Unique only.
//
// optional
TransferStarCount int `json:"transfer_star_count,omitempty"`
// NextTransferDate is the point in time (Unix timestamp) when the gift
// can be transferred. If it is in the past, then the gift can be
// transferred now. Unique only.
//
// optional
NextTransferDate int `json:"next_transfer_date,omitempty"`
}
OwnedGift describes a gift received and owned by a user or chat. Flat polymorphic by Type:
- "regular" → Gift (Gift), fields: ConvertStarCount, CanBeUpgraded, etc.
- "unique" → Gift (UniqueGift), fields: CanBeTransferred, TransferStarCount
func (OwnedGift) MarshalJSON ¶
MarshalJSON encodes an OwnedGift, emitting Gift or UniqueGift under the shared "gift" wire field.
func (*OwnedGift) UnmarshalJSON ¶
UnmarshalJSON decodes an OwnedGift, routing the polymorphic "gift" field to Gift or UniqueGift based on Type.
type OwnedGifts ¶
type OwnedGifts struct {
// TotalCount is the total number of gifts owned by the user or chat.
TotalCount int `json:"total_count"`
// Gifts is the list of gifts.
Gifts []OwnedGift `json:"gifts"`
// NextOffset is the offset for the next request. Empty if there are no
// more results.
//
// optional
NextOffset string `json:"next_offset,omitempty"`
}
OwnedGifts contains the list of gifts received and owned by a user or chat.
type PaidMedia ¶
type PaidMedia struct {
// Type of the paid media. One of "preview", "photo", "video", "live_photo".
Type string `json:"type"`
// Width is the media width as defined by the sender. Set when Type is
// "preview".
//
// optional
Width int `json:"width,omitempty"`
// Height is the media height as defined by the sender. Set when Type is
// "preview".
//
// optional
Height int `json:"height,omitempty"`
// Duration is the duration of the media in seconds as defined by the
// sender. Set when Type is "preview".
//
// optional
Duration int `json:"duration,omitempty"`
// Photo is the photo media. Set when Type is "photo".
//
// optional
Photo []PhotoSize `json:"photo,omitempty"`
// Video is the video media. Set when Type is "video".
//
// optional
Video *Video `json:"video,omitempty"`
// LivePhoto is the live photo media. Set when Type is "live_photo".
//
// optional
LivePhoto *LivePhoto `json:"live_photo,omitempty"`
}
PaidMedia describes a media received in a paid message. Flat polymorphic by Type:
- "preview" → Width, Height, Duration (optional)
- "photo" → Photo is set
- "video" → Video is set
- "live_photo" → LivePhoto is set
type PaidMediaInfo ¶
type PaidMediaInfo struct {
// StarCount is the number of Telegram Stars that must be paid to buy
// access to the media.
StarCount int `json:"star_count"`
// PaidMedia is the information about the paid media.
PaidMedia []PaidMedia `json:"paid_media"`
}
PaidMediaInfo describes the paid media added to a message.
type PaidMediaPurchased ¶
type PaidMediaPurchased struct {
// From is the user who purchased the media.
From User `json:"from"`
// PaidMediaPayload is the bot-specified paid media payload.
PaidMediaPayload string `json:"paid_media_payload"`
}
PaidMediaPurchased is received when a user purchases paid media with a non-empty payload sent by the bot in a non-channel chat.
type PaidMessagePriceChanged ¶
type PaidMessagePriceChanged struct {
// PaidMessageStarCount is the new number of Telegram Stars that must
// be paid by non-administrator users of the supergroup chat for each
// sent message.
PaidMessageStarCount int `json:"paid_message_star_count"`
}
PaidMessagePriceChanged describes a service message about a change in the price of paid messages within a chat.
type Params ¶
Params represents a set of parameters that gets passed to a request.
func (Params) AddFirstValid ¶
AddFirstValid attempts to add the first item that is not a default value.
For example, AddFirstValid(0, "", "test") would add "test".
func (Params) AddInterface ¶
AddInterface adds an interface if it is not nil and can be JSON marshalled.
func (Params) AddNonEmpty ¶
AddNonEmpty adds a value if it not an empty string.
func (Params) AddNonZero ¶
AddNonZero adds a value if it is not zero.
func (Params) AddNonZero64 ¶
AddNonZero64 is the same as AddNonZero except uses an int64.
func (Params) AddNonZeroFloat ¶
AddNonZeroFloat adds a floating point value that is not zero.
type PassportData ¶
type PassportData struct {
// Array with information about documents and other Telegram Passport
// elements that was shared with the bot
Data []EncryptedPassportElement `json:"data"`
// Encrypted credentials required to decrypt the data
Credentials *EncryptedCredentials `json:"credentials"`
}
PassportData contains information about Telegram Passport data shared with the bot by the user.
type PassportElementError ¶
type PassportElementError interface{}
PassportElementError represents an error in the Telegram Passport element which was submitted that should be resolved by the user.
type PassportElementErrorDataField ¶
type PassportElementErrorDataField struct {
// Error source, must be data
Source string `json:"source"`
// The section of the user's Telegram Passport which has the error, one
// of "personal_details", "passport", "driver_license", "identity_card",
// "internal_passport", "address"
Type string `json:"type"`
// Name of the data field which has the error
FieldName string `json:"field_name"`
// Base64-encoded data hash
DataHash string `json:"data_hash"`
// Error message
Message string `json:"message"`
}
PassportElementErrorDataField represents an issue in one of the data fields that was provided by the user. The error is considered resolved when the field's value changes.
type PassportElementErrorFile ¶
type PassportElementErrorFile struct {
// Error source, must be a file
Source string `json:"source"`
// The section of the user's Telegram Passport which has the issue, one
// of "utility_bill", "bank_statement", "rental_agreement",
// "passport_registration", "temporary_registration"
Type string `json:"type"`
// Base64-encoded file hash
FileHash string `json:"file_hash"`
// Error message
Message string `json:"message"`
}
PassportElementErrorFile represents an issue with a document scan. The error is considered resolved when the file with the document scan changes.
type PassportElementErrorFiles ¶
type PassportElementErrorFiles struct {
// Error source, must be files
Source string `json:"source"`
// The section of the user's Telegram Passport which has the issue, one
// of "utility_bill", "bank_statement", "rental_agreement",
// "passport_registration", "temporary_registration"
Type string `json:"type"`
// List of base64-encoded file hashes
FileHashes []string `json:"file_hashes"`
// Error message
Message string `json:"message"`
}
PassportElementErrorFiles represents an issue with a list of scans. The error is considered resolved when the list of files containing the scans changes.
type PassportElementErrorFrontSide ¶
type PassportElementErrorFrontSide struct {
// Error source, must be front_side
Source string `json:"source"`
// The section of the user's Telegram Passport which has the issue, one
// of "passport", "driver_license", "identity_card", "internal_passport"
Type string `json:"type"`
// Base64-encoded hash of the file with the front side of the document
FileHash string `json:"file_hash"`
// Error message
Message string `json:"message"`
}
PassportElementErrorFrontSide represents an issue with the front side of a document. The error is considered resolved when the file with the front side of the document changes.
type PassportElementErrorReverseSide ¶
type PassportElementErrorReverseSide struct {
// Error source, must be reverse_side
Source string `json:"source"`
// The section of the user's Telegram Passport which has the issue, one
// of "driver_license", "identity_card"
Type string `json:"type"`
// Base64-encoded hash of the file with the reverse side of the document
FileHash string `json:"file_hash"`
// Error message
Message string `json:"message"`
}
PassportElementErrorReverseSide represents an issue with the reverse side of a document. The error is considered resolved when the file with reverse side of the document changes.
type PassportElementErrorSelfie ¶
type PassportElementErrorSelfie struct {
// Error source, must be selfie
Source string `json:"source"`
// The section of the user's Telegram Passport which has the issue, one
// of "passport", "driver_license", "identity_card", "internal_passport"
Type string `json:"type"`
// Base64-encoded hash of the file with the selfie
FileHash string `json:"file_hash"`
// Error message
Message string `json:"message"`
}
PassportElementErrorSelfie represents an issue with the selfie with a document. The error is considered resolved when the file with the selfie changes.
type PassportElementErrorTranslationFile ¶
type PassportElementErrorTranslationFile struct {
// Error source, must be translation_file
Source string `json:"source"`
// Type of element of the user's Telegram Passport which has the
// issue, one of "passport", "driver_license", "identity_card",
// "internal_passport", "utility_bill", "bank_statement",
// "rental_agreement", "passport_registration",
// "temporary_registration"
Type string `json:"type"`
// Base64-encoded file hash
FileHash string `json:"file_hash"`
// Error message
Message string `json:"message"`
}
PassportElementErrorTranslationFile represents an issue with one of the files that constitute the translation of a document. The error is considered resolved when the file changes.
type PassportElementErrorTranslationFiles ¶
type PassportElementErrorTranslationFiles struct {
// Error source, must be translation_files
Source string `json:"source"`
// Type of element of the user's Telegram Passport which has the
// issue, one of "passport", "driver_license", "identity_card",
// "internal_passport", "utility_bill", "bank_statement",
// "rental_agreement", "passport_registration",
// "temporary_registration"
Type string `json:"type"`
// List of base64-encoded file hashes
FileHashes []string `json:"file_hashes"`
// Error message
Message string `json:"message"`
}
PassportElementErrorTranslationFiles represents an issue with the translated version of a document. The error is considered resolved when a file with the document translation changes.
type PassportElementErrorUnspecified ¶
type PassportElementErrorUnspecified struct {
// Error source, must be unspecified
Source string `json:"source"`
// Type of element of the user's Telegram Passport which has the issue
Type string `json:"type"`
// Base64-encoded element hash
ElementHash string `json:"element_hash"`
// Error message
Message string `json:"message"`
}
PassportElementErrorUnspecified represents an issue in an unspecified place. The error is considered resolved when new data is added.
type PassportFile ¶
type PassportFile struct {
// Unique identifier for this file
FileID string `json:"file_id"`
FileUniqueID string `json:"file_unique_id"`
// File size
FileSize int `json:"file_size"`
// Unix time when the file was uploaded
FileDate int64 `json:"file_date"`
}
PassportFile represents a file uploaded to Telegram Passport. Currently, all Telegram Passport files are in JPEG format when decrypted and don't exceed 10MB.
type PassportRequestInfoConfig ¶
type PassportRequestInfoConfig struct {
BotID int `json:"bot_id"`
Scope *PassportScope `json:"scope"`
Nonce string `json:"nonce"`
PublicKey string `json:"public_key"`
}
PassportRequestInfoConfig allows you to request passport info
type PassportScope ¶
type PassportScope struct {
V int `json:"v"`
Data []PassportScopeElement `json:"data"`
}
PassportScope is the requested scopes of data.
type PassportScopeElement ¶
type PassportScopeElement interface {
ScopeType() string
}
PassportScopeElement supports using one or one of several elements.
type PassportScopeElementOne ¶
type PassportScopeElementOne struct {
Type string `json:"type"` // One of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”, “phone_number”, “email”
Selfie bool `json:"selfie"`
Translation bool `json:"translation"`
NativeNames bool `json:"native_name"`
}
PassportScopeElementOne requires the specified element be provided.
func (*PassportScopeElementOne) ScopeType ¶
func (eo *PassportScopeElementOne) ScopeType() string
ScopeType is the scope type.
type PassportScopeElementOneOfSeveral ¶
type PassportScopeElementOneOfSeveral struct {
}
PassportScopeElementOneOfSeveral allows you to request any one of the requested documents.
func (*PassportScopeElementOneOfSeveral) ScopeType ¶
func (eo *PassportScopeElementOneOfSeveral) ScopeType() string
ScopeType is the scope type.
type PersonalDetails ¶
type PersonalDetails struct {
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
MiddleName string `json:"middle_name"`
BirthDate string `json:"birth_date"`
Gender string `json:"gender"`
CountryCode string `json:"country_code"`
ResidenceCountryCode string `json:"residence_country_code"`
FirstNameNative string `json:"first_name_native"`
LastNameNative string `json:"last_name_native"`
MiddleNameNative string `json:"middle_name_native"`
}
PersonalDetails https://core.telegram.org/passport#personaldetails
type PhotoConfig ¶
type PhotoConfig struct {
BaseFile
EphemeralSendParams
Thumbnail RequestFileData
Caption string
ParseMode string
CaptionEntities []MessageEntity
ShowCaptionAboveMedia bool
HasSpoiler bool
}
PhotoConfig contains information about a SendPhoto request.
func NewPhoto ¶
func NewPhoto(chatID int64, file RequestFileData) PhotoConfig
NewPhoto creates a new sendPhoto request.
chatID is where to send it, file is a string path to the file, FileReader, or FileBytes.
Note that you must send animated GIFs as a document.
func NewPhotoToChannel ¶
func NewPhotoToChannel(username string, file RequestFileData) PhotoConfig
NewPhotoToChannel creates a new photo uploader to send a photo to a channel.
Note that you must send animated GIFs as a document.
type PhotoSize ¶
type PhotoSize struct {
// FileID identifier for this file, which can be used to download or reuse
// the file
FileID string `json:"file_id"`
// FileUniqueID is the unique identifier for this file, which is supposed to
// be the same over time and for different bots. Can't be used to download
// or reuse the file.
FileUniqueID string `json:"file_unique_id"`
// Width photo width
Width int `json:"width"`
// Height photo height
Height int `json:"height"`
// FileSize file size
//
// optional
FileSize int `json:"file_size,omitempty"`
}
PhotoSize represents one size of a photo or a file / sticker thumbnail.
type PinChatMessageConfig ¶
type PinChatMessageConfig struct {
BusinessConnectionID string
ChatID int64
ChannelUsername string
MessageID int
DisableNotification bool
}
PinChatMessageConfig contains information of a message in a chat to pin.
Provide the target chat via either ChatID (numeric identifier) or ChannelUsername ("@channelusername"); the first non-zero / non-empty value is used.
type Poll ¶
type Poll struct {
// ID is the unique poll identifier
ID string `json:"id"`
// Question is the poll question, 1-300 characters
Question string `json:"question"`
// QuestionEntities are the special entities that appear in the question.
// Currently, only custom_emoji entities are allowed in poll questions.
//
// optional
QuestionEntities []MessageEntity `json:"question_entities,omitempty"`
// Options is the list of poll options
Options []PollOption `json:"options"`
// TotalVoterCount is the total numbers of users who voted in the poll
TotalVoterCount int `json:"total_voter_count"`
// IsClosed is if the poll is closed
IsClosed bool `json:"is_closed"`
// IsAnonymous is if the poll is anonymous
IsAnonymous bool `json:"is_anonymous"`
// Type is the poll type, currently can be "regular" or "quiz"
Type string `json:"type"`
// AllowsMultipleAnswers is true, if the poll allows multiple answers
AllowsMultipleAnswers bool `json:"allows_multiple_answers"`
// CorrectOptionIDs lists the 0-based identifiers of the correct answer
// options. Available only for polls in quiz mode, which are closed, or
// was sent (not forwarded) by the bot or to the private chat with the
// bot. Multi-answer quizzes may have more than one correct option.
//
// optional
CorrectOptionIDs []int `json:"correct_option_ids,omitempty"`
// AllowsRevoting is true, if the poll allows users to change their vote.
//
// optional
AllowsRevoting bool `json:"allows_revoting,omitempty"`
// MembersOnly is true if voting is limited to users who have been
// members of the chat where the poll was originally sent for more than
// 24 hours.
//
// optional
MembersOnly bool `json:"members_only,omitempty"`
// CountryCodes is a list of two-letter ISO 3166-1 alpha-2 country codes
// indicating the countries from which users can vote in the poll. If
// empty, then users from any country can participate in the poll.
//
// optional
CountryCodes []string `json:"country_codes,omitempty"`
// Description is the text of the poll description; for polls inside
// the Message object only.
//
// optional
Description string `json:"description,omitempty"`
// DescriptionEntities are the special entities that appear in the
// description.
//
// optional
DescriptionEntities []MessageEntity `json:"description_entities,omitempty"`
// Media is the media attached to the poll description; for polls inside
// the Message object only.
//
// optional
Media *PollMedia `json:"media,omitempty"`
// Explanation is 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
//
// optional
Explanation string `json:"explanation,omitempty"`
// ExplanationEntities are special entities like usernames, URLs, bot
// commands, etc. that appear in the explanation
//
// optional
ExplanationEntities []MessageEntity `json:"explanation_entities,omitempty"`
// ExplanationMedia is the media attached to the quiz explanation.
//
// optional
ExplanationMedia *PollMedia `json:"explanation_media,omitempty"`
// OpenPeriod is the amount of time in seconds the poll will be active
// after creation
//
// optional
OpenPeriod int `json:"open_period,omitempty"`
// CloseDate is the point in time (unix timestamp) when the poll will be
// automatically closed
//
// optional
CloseDate int `json:"close_date,omitempty"`
}
Poll contains information about a poll.
type PollAnswer ¶
type PollAnswer struct {
// PollID is the unique poll identifier
PollID string `json:"poll_id"`
// VoterChat is the chat that changed the answer to the poll, if the voter
// is anonymous.
//
// optional
VoterChat *Chat `json:"voter_chat,omitempty"`
// User who changed the answer to the poll, if the voter isn't anonymous.
// For backward compatibility, the field user in such objects will contain
// the user 136817688 (@Channel_Bot).
User User `json:"user"`
// OptionIDs is the 0-based identifiers of poll options chosen by the user.
// May be empty if user retracted vote.
OptionIDs []int `json:"option_ids"`
// OptionPersistentIDs is the persistent identifiers of the poll options
// chosen by the user, matching PollOption.PersistentID.
//
// optional
OptionPersistentIDs []string `json:"option_persistent_ids,omitempty"`
}
PollAnswer represents an answer of a user in a non-anonymous poll.
type PollMedia ¶
type PollMedia struct {
// Animation is set if the media is an animation.
//
// optional
Animation *Animation `json:"animation,omitempty"`
// Audio is set if the media is an audio file. Currently, can't appear
// in a poll option.
//
// optional
Audio *Audio `json:"audio,omitempty"`
// Document is set if the media is a general file. Currently, can't
// appear in a poll option.
//
// optional
Document *Document `json:"document,omitempty"`
// Link is set if the media is an HTTP link. Currently, only valid for
// poll options.
//
// optional
Link *Link `json:"link,omitempty"`
// LivePhoto is set if the media is a live photo.
//
// optional
LivePhoto *LivePhoto `json:"live_photo,omitempty"`
// Location is set if the media is a shared location.
//
// optional
Location *Location `json:"location,omitempty"`
// Photo is set if the media is a photo.
//
// optional
Photo []PhotoSize `json:"photo,omitempty"`
// Sticker is set if the media is a sticker. Currently, only valid for
// poll options.
//
// optional
Sticker *Sticker `json:"sticker,omitempty"`
// Venue is set if the media is a venue.
//
// optional
Venue *Venue `json:"venue,omitempty"`
// Video is set if the media is a video.
//
// optional
Video *Video `json:"video,omitempty"`
}
PollMedia represents media attached to a poll, poll option, or quiz explanation. At most one of the optional fields can be present in a given PollMedia value.
type PollOption ¶
type PollOption struct {
// Text is the option text, 1-100 characters
Text string `json:"text"`
// TextEntities are the special entities that appear in the option text.
// Currently, only custom_emoji entities are allowed in poll option texts.
//
// optional
TextEntities []MessageEntity `json:"text_entities,omitempty"`
// Media is the optional media attached to the poll option.
//
// optional
Media *PollMedia `json:"media,omitempty"`
// VoterCount is the number of users that voted for this option
VoterCount int `json:"voter_count"`
// PersistentID is the persistent identifier of the poll option; stays
// the same even if the option is moved, renamed, added, or deleted.
//
// optional
PersistentID string `json:"persistent_id,omitempty"`
// AddedByUser is the user that added the option to the poll.
//
// optional
AddedByUser *User `json:"added_by_user,omitempty"`
// AddedByChat is the chat that added the option to the poll anonymously.
//
// optional
AddedByChat *Chat `json:"added_by_chat,omitempty"`
// AdditionDate is the point in time (Unix timestamp) when the option
// was added to the poll.
//
// optional
AdditionDate int `json:"addition_date,omitempty"`
}
PollOption contains information about one answer option in a poll.
type PollOptionAdded ¶
type PollOptionAdded struct {
// PollMessage is the message containing the poll.
//
// optional
PollMessage *Message `json:"poll_message,omitempty"`
// OptionPersistentID is the unique identifier of the added option.
OptionPersistentID string `json:"option_persistent_id"`
// OptionText is the option text.
OptionText string `json:"option_text"`
// OptionTextEntities are special entities that appear in the OptionText.
//
// optional
OptionTextEntities []MessageEntity `json:"option_text_entities,omitempty"`
}
PollOptionAdded describes a service message about a poll option being added to a poll.
type PollOptionDeleted ¶
type PollOptionDeleted struct {
// PollMessage is the message containing the poll.
//
// optional
PollMessage *Message `json:"poll_message,omitempty"`
// OptionPersistentID is the unique identifier of the deleted option.
OptionPersistentID string `json:"option_persistent_id"`
// OptionText is the option text.
OptionText string `json:"option_text"`
// OptionTextEntities are special entities that appear in the OptionText.
//
// optional
OptionTextEntities []MessageEntity `json:"option_text_entities,omitempty"`
}
PollOptionDeleted describes a service message about a poll option being deleted from a poll.
type PostStoryConfig ¶
type PostStoryConfig struct {
BusinessConnectionID string
Content InputStoryContent
ActivePeriod int
Caption string
ParseMode string
CaptionEntities []MessageEntity
Areas []StoryArea
PostToChatPage bool
ProtectContent bool
}
PostStoryConfig posts a story on behalf of a managed business account.
type PreCheckoutConfig ¶
type PreCheckoutConfig struct {
PreCheckoutQueryID string // required
OK bool // required
ErrorMessage string
}
PreCheckoutConfig contains information for answerPreCheckoutQuery request.
type PreCheckoutQuery ¶
type PreCheckoutQuery struct {
// ID unique query identifier
ID string `json:"id"`
// From user who sent the query
From *User `json:"from"`
// Currency three-letter ISO 4217 currency code
// // (see https://core.telegram.org/bots/payments#supported-currencies)
Currency string `json:"currency"`
// TotalAmount total price in the smallest units of the currency (integer, not float/double).
// // For example, for a price of US$ 1.45 pass amount = 145.
// // See the exp parameter in currencies.json,
// // (https://core.telegram.org/bots/payments/currencies.json)
// // it shows the number of digits past the decimal point
// // for each currency (2 for the majority of currencies).
TotalAmount int `json:"total_amount"`
// InvoicePayload bot specified invoice payload
InvoicePayload string `json:"invoice_payload"`
// ShippingOptionID identifier of the shipping option chosen by the user
//
// optional
ShippingOptionID string `json:"shipping_option_id,omitempty"`
// OrderInfo order info provided by the user
//
// optional
OrderInfo *OrderInfo `json:"order_info,omitempty"`
}
PreCheckoutQuery contains information about an incoming pre-checkout query.
type PreparedInlineMessage ¶
type PreparedInlineMessage struct {
// ID is the unique identifier of the prepared message.
ID string `json:"id"`
// ExpirationDate is the Unix timestamp at which the message can no
// longer be used.
ExpirationDate int `json:"expiration_date"`
}
PreparedInlineMessage describes an inline message to be sent by a user of a Mini App.
type PreparedKeyboardButton ¶
type PreparedKeyboardButton struct {
// ID is the unique identifier of the keyboard button.
ID string `json:"id"`
}
PreparedKeyboardButton describes a keyboard button to be used by a user of a Mini App.
type PromoteChatMemberConfig ¶
type PromoteChatMemberConfig struct {
ChatMemberConfig
IsAnonymous bool
CanManageChat bool
CanChangeInfo bool
CanPostMessages bool
CanEditMessages bool
CanDeleteMessages bool
CanManageVideoChats bool
CanInviteUsers bool
CanRestrictMembers bool
CanPinMessages bool
CanPromoteMembers bool
CanPostStories bool
CanEditStories bool
CanDeleteStories bool
CanManageTopics bool
CanManageDirectMessages bool
CanManageTags bool
CanSendWelcomeMessages bool
}
PromoteChatMemberConfig contains fields to promote members of chat
type ProximityAlertTriggered ¶
type ProximityAlertTriggered struct {
// Traveler is the user that triggered the alert
Traveler User `json:"traveler"`
// Watcher is the user that set the alert
Watcher User `json:"watcher"`
// Distance is the distance between the users
Distance int `json:"distance"`
}
ProximityAlertTriggered represents a service message sent when a user in the chat triggers a proximity alert sent by another user.
type ReactionCount ¶
type ReactionCount struct {
// Type of the reaction.
Type ReactionType `json:"type"`
// TotalCount is the number of times the reaction was added.
TotalCount int `json:"total_count"`
}
ReactionCount represents a reaction added to a message along with the number of times it was added.
type ReactionType ¶
type ReactionType struct {
// Type of the reaction. One of "emoji", "custom_emoji", "paid".
Type string `json:"type"`
// Emoji is set when Type == "emoji". One of the supported emoji.
//
// optional
Emoji string `json:"emoji,omitempty"`
// CustomEmojiID is set when Type == "custom_emoji".
//
// optional
CustomEmojiID string `json:"custom_emoji_id,omitempty"`
}
ReactionType describes the type of a reaction. The Type field discriminates between concrete variants:
- "emoji" → Emoji is set
- "custom_emoji" → CustomEmojiID is set
- "paid" → no extra fields
type ReadBusinessMessageConfig ¶
ReadBusinessMessageConfig marks an incoming message as read on behalf of a business account.
type RefundStarPaymentConfig ¶
RefundStarPaymentConfig refunds a successful payment in Telegram Stars.
type RefundedPayment ¶
type RefundedPayment struct {
// Currency is the three-letter ISO 4217 currency code, or "XTR" for
// payments in Telegram Stars. Currently, always "XTR".
Currency string `json:"currency"`
// TotalAmount is the total refunded price in the smallest units of the
// currency (integer, not float/double). For example, for a price of
// US$ 1.45, total_amount == 145.
TotalAmount int `json:"total_amount"`
// InvoicePayload is the bot-specified invoice payload.
InvoicePayload string `json:"invoice_payload"`
// TelegramPaymentChargeID is the Telegram payment identifier.
TelegramPaymentChargeID string `json:"telegram_payment_charge_id"`
// ProviderPaymentChargeID is the provider payment identifier.
//
// optional
ProviderPaymentChargeID string `json:"provider_payment_charge_id,omitempty"`
}
RefundedPayment contains information about a refunded payment.
type RemoveBusinessAccountProfilePhotoConfig ¶
RemoveBusinessAccountProfilePhotoConfig removes the current profile photo of a managed business account.
type RemoveChatVerificationConfig ¶
RemoveChatVerificationConfig removes verification from a chat that is currently verified on behalf of the organization represented by the bot.
Provide the target chat via either ChatID (numeric identifier) or ChannelUsername ("@channelusername"); the first non-zero / non-empty value is used.
type RemoveMyProfilePhotoConfig ¶
type RemoveMyProfilePhotoConfig struct{}
RemoveMyProfilePhotoConfig removes the current profile photo of the bot.
type RemoveUserVerificationConfig ¶
type RemoveUserVerificationConfig struct {
UserID int64
}
RemoveUserVerificationConfig removes verification from a user who is currently verified on behalf of the organization represented by the bot.
type ReopenForumTopicConfig ¶
type ReopenForumTopicConfig struct {
ChatID int64
SuperGroupUsername string
MessageThreadID int // required
}
ReopenForumTopicConfig reopens a closed topic in a forum supergroup chat. The bot must have the can_manage_topics administrator rights, unless it is the creator of the topic.
type ReopenGeneralForumTopicConfig ¶
ReopenGeneralForumTopicConfig reopens a closed 'General' topic in a forum supergroup chat. The bot must have the can_manage_topics administrator rights. The topic will be automatically unhidden if it was hidden.
type ReplaceManagedBotTokenConfig ¶
type ReplaceManagedBotTokenConfig struct {
// UserID is the user identifier of the managed bot whose token will be replaced.
UserID int64
}
ReplaceManagedBotTokenConfig contains the parameters for the replaceManagedBotToken method.
type ReplaceStickerInSetConfig ¶
type ReplaceStickerInSetConfig struct {
UserID int64
Name string
OldSticker string // file identifier of the replaced sticker
Sticker InputSticker
}
ReplaceStickerInSetConfig replaces an existing sticker in a sticker set with a new one. The sticker set must have been created by the bot.
type ReplyKeyboardMarkup ¶
type ReplyKeyboardMarkup struct {
// Keyboard is an array of button rows, each represented by an Array of KeyboardButton objects
Keyboard [][]KeyboardButton `json:"keyboard"`
// IsPersistent requests clients to always show the keyboard when the regular
// keyboard is hidden. Defaults to false, in which case the custom keyboard
// can be hidden and opened with a keyboard icon.
//
// optional
IsPersistent bool `json:"is_persistent,omitempty"`
// ResizeKeyboard requests clients to resize the keyboard vertically for optimal fit
// (e.g., make the keyboard smaller if there are just two rows of buttons).
// Defaults to false, in which case the custom keyboard
// is always of the same height as the app's standard keyboard.
//
// optional
ResizeKeyboard bool `json:"resize_keyboard,omitempty"`
// OneTimeKeyboard requests clients to hide the keyboard as soon as it's been used.
// The keyboard will still be available, but clients will automatically display
// the usual letter-keyboard in the chat – the user can press a special button
// in the input field to see the custom keyboard again.
// Defaults to false.
//
// optional
OneTimeKeyboard bool `json:"one_time_keyboard,omitempty"`
// InputFieldPlaceholder is the placeholder to be shown in the input field when
// the keyboard is active; 1-64 characters.
//
// optional
InputFieldPlaceholder string `json:"input_field_placeholder,omitempty"`
// Selective use this parameter if you want to show the keyboard to specific users only.
// Targets:
// 1) users that are @mentioned in the text of the Message object;
// 2) if the bot's message is a reply (has Message.ReplyToMessage not nil), sender of the original message.
//
// Example: A user requests to change the bot's language,
// bot replies to the request with a keyboard to select the new language.
// Other users in the group don't see the keyboard.
//
// optional
Selective bool `json:"selective,omitempty"`
// ForceReply requests clients to show the reply interface to the user, as
// if they had manually selected the bot's message and tapped 'Reply'.
//
// optional
ForceReply bool `json:"force_reply,omitempty"`
}
ReplyKeyboardMarkup represents a custom keyboard with reply options.
func NewOneTimeReplyKeyboard ¶
func NewOneTimeReplyKeyboard(rows ...[]KeyboardButton) ReplyKeyboardMarkup
NewOneTimeReplyKeyboard creates a new one time keyboard.
func NewReplyKeyboard ¶
func NewReplyKeyboard(rows ...[]KeyboardButton) ReplyKeyboardMarkup
NewReplyKeyboard creates a new regular keyboard with sane defaults.
type ReplyKeyboardRemove ¶
type ReplyKeyboardRemove struct {
// RemoveKeyboard requests clients to remove the custom keyboard
// (user will not be able to summon this keyboard;
// if you want to hide the keyboard from sight but keep it accessible,
// use one_time_keyboard in ReplyKeyboardMarkup).
RemoveKeyboard bool `json:"remove_keyboard"`
// Selective use this parameter if you want to remove the keyboard for specific users only.
// Targets:
// 1) users that are @mentioned in the text of the Message object;
// 2) if the bot's message is a reply (has Message.ReplyToMessage not nil), sender of the original message.
//
// Example: A user votes in a poll, bot returns confirmation message
// in reply to the vote and removes the keyboard for that user,
// while still showing the keyboard with poll options to users who haven't voted yet.
//
// optional
Selective bool `json:"selective,omitempty"`
}
ReplyKeyboardRemove Upon receiving a message with this object, Telegram clients will remove the current custom keyboard and display the default letter-keyboard. By default, custom keyboards are displayed until a new keyboard is sent by a bot. An exception is made for one-time keyboards that are hidden immediately after the user presses a button.
func NewRemoveKeyboard ¶
func NewRemoveKeyboard(selective bool) ReplyKeyboardRemove
NewRemoveKeyboard hides the keyboard, with the option for being selective or hiding for everyone.
type ReplyParameters ¶
type ReplyParameters struct {
// MessageID is the identifier of the message that will be replied to in
// the current chat, or in the chat ChatID if it is specified. Required if
// EphemeralMessageID is not specified.
//
// optional
MessageID int `json:"message_id,omitempty"`
// ChatID, if the message to be replied to is from a different chat, is
// the unique identifier for the chat or username of the channel
// (@channelusername). Pass int64 or string. Not supported for messages
// sent on behalf of a business account, messages from channel direct
// messages chats, and ephemeral messages.
//
// optional
ChatID any `json:"chat_id,omitempty"`
// EphemeralMessageID is the identifier of the incoming ephemeral message
// that will be replied to in the current chat. A reply to an ephemeral
// message must itself be an ephemeral message, and may only be sent
// within 15 seconds of the original. Required if MessageID is not
// specified.
//
// optional
EphemeralMessageID int `json:"ephemeral_message_id,omitempty"`
// AllowSendingWithoutReply is true if the message should be sent even if
// the specified message to be replied to is not found.
//
// optional
AllowSendingWithoutReply bool `json:"allow_sending_without_reply,omitempty"`
// Quote is the quoted part of the message to be replied to. Should be a
// substring of the original message, including bold, italic, underline,
// strikethrough, spoiler, and custom_emoji entities.
//
// optional
Quote string `json:"quote,omitempty"`
// QuoteParseMode is the mode for parsing entities in the quote.
//
// optional
QuoteParseMode string `json:"quote_parse_mode,omitempty"`
// QuoteEntities is a list of special entities that appear in the quote.
// It can be specified instead of QuoteParseMode.
//
// optional
QuoteEntities []MessageEntity `json:"quote_entities,omitempty"`
// QuotePosition is the position of the quote in the original message in
// UTF-16 code units.
//
// optional
QuotePosition int `json:"quote_position,omitempty"`
// ChecklistTaskID is the identifier of the specific checklist task to
// reply to. Required if replying to a task in a checklist.
//
// optional
ChecklistTaskID int `json:"checklist_task_id,omitempty"`
// PollOptionID is the persistent identifier of the specific poll
// option to reply to. Required if replying to a poll option.
//
// optional
PollOptionID string `json:"poll_option_id,omitempty"`
}
ReplyParameters describes reply parameters for the message that is being sent.
type RepostStoryConfig ¶
type RepostStoryConfig struct {
BusinessConnectionID string
// FromChatID is the unique identifier of the chat which posted the story
// that should be reposted.
FromChatID int64
// FromStoryID is the unique identifier of the story that should be
// reposted.
FromStoryID int
// ActivePeriod is the period after which the story is moved to the
// archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or
// 2 * 86400.
ActivePeriod int
PostToChatPage bool
ProtectContent bool
}
RepostStoryConfig reposts a story on behalf of a business account from another business account. Both business accounts must be managed by the same bot, and the story on the source account must have been posted (or reposted) by the bot. Requires the can_manage_stories business bot right for both business accounts.
type RequestFile ¶
type RequestFile struct {
// The file field name.
Name string
// The file data to include.
Data RequestFileData
}
RequestFile represents a file associated with a field name.
type RequestFileData ¶
type RequestFileData interface {
// NeedsUpload shows if the file needs to be uploaded.
NeedsUpload() bool
// UploadData gets the file name and an `io.Reader` for the file to be uploaded. This
// must only be called when the file needs to be uploaded.
UploadData() (string, io.Reader, error)
// SendData gets the file data to send when a file does not need to be uploaded. This
// must only be called when the file does not need to be uploaded.
SendData() string
}
RequestFileData represents the data to be used for a file.
type ResponseParameters ¶
type ResponseParameters struct {
// The group has been migrated to a supergroup with the specified identifier.
//
// optional
MigrateToChatID int64 `json:"migrate_to_chat_id,omitempty"`
// In case of exceeding flood control, the number of seconds left to wait
// before the request can be repeated.
//
// optional
RetryAfter int `json:"retry_after,omitempty"`
}
ResponseParameters are various errors that can be returned in APIResponse.
type RestrictChatMemberConfig ¶
type RestrictChatMemberConfig struct {
ChatMemberConfig
UntilDate int64
Permissions *ChatPermissions
UseIndependentChatPermissions bool
}
RestrictChatMemberConfig contains fields to restrict members of chat
type RevenueWithdrawalState ¶
type RevenueWithdrawalState struct {
// Type of the state. One of "pending", "succeeded", "failed".
Type string `json:"type"`
// Date of the withdrawal in Unix time. Set when Type is "succeeded".
//
// optional
Date int `json:"date,omitempty"`
// URL is an HTTPS URL where the withdrawal transaction can be seen.
// Set when Type is "succeeded".
//
// optional
URL string `json:"url,omitempty"`
}
RevenueWithdrawalState describes the state of a revenue withdrawal. Flat polymorphic by Type:
- "pending" → (no extra fields)
- "succeeded" → Date, URL
- "failed" → (no extra fields)
type RevokeChatInviteLinkConfig ¶
type RevokeChatInviteLinkConfig struct {
ChatConfig
InviteLink string
}
RevokeChatInviteLinkConfig allows you to revoke an invite link created by the bot. If the primary link is revoked, a new link is automatically generated. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
type RichBlock ¶
type RichBlock struct {
// Type of the block, one of the RichBlockType* constants.
Type string `json:"type"`
// Text is the block text. Set for "paragraph", "heading", "pre",
// "footer", "expandable_blockquote", "pullquote", and "thinking" blocks.
//
// optional
Text *RichText `json:"text,omitempty"`
// Size is the relative font size of a "heading" block; 1-6, 1 is largest.
//
// optional
Size int `json:"size,omitempty"`
// Language is the programming language of a "pre" block.
//
// optional
Language string `json:"language,omitempty"`
// Expression is the LaTeX expression of a "mathematical_expression"
// block.
//
// optional
Expression string `json:"expression,omitempty"`
// Name is the anchor name of an "anchor" block.
//
// optional
Name string `json:"name,omitempty"`
// Items are the items of a "list" block.
//
// optional
Items []RichBlockListItem `json:"items,omitempty"`
// Blocks is the nested content of "blockquote", "collage", "slideshow",
// and "details" blocks.
//
// optional
Blocks []RichBlock `json:"blocks,omitempty"`
// Credit is the credit of "blockquote", "expandable_blockquote", and
// "pullquote" blocks.
//
// optional
Credit *RichText `json:"credit,omitempty"`
// Cells are the rows of cells of a "table" block.
//
// optional
Cells [][]RichBlockTableCell `json:"cells,omitempty"`
// IsBordered is true if a "table" block has borders.
//
// optional
IsBordered bool `json:"is_bordered,omitempty"`
// IsStriped is true if a "table" block is striped.
//
// optional
IsStriped bool `json:"is_striped,omitempty"`
// IsCompact is true if the cells of a "table" block have smaller indents.
//
// optional
IsCompact bool `json:"is_compact,omitempty"`
// Buttons are the buttons of a "buttons" block, shown in one row.
//
// optional
Buttons []RichMessageButton `json:"buttons,omitempty"`
// Align is the horizontal alignment of the buttons of a "buttons" block;
// one of "left", "center", or "right".
//
// optional
Align string `json:"align,omitempty"`
// Summary is the always-shown summary of a "details" block.
//
// optional
Summary *RichText `json:"summary,omitempty"`
// IsOpen is true if a "details" block is visible by default.
//
// optional
IsOpen bool `json:"is_open,omitempty"`
// Location is the center of a "map" block.
//
// optional
Location *Location `json:"location,omitempty"`
// Zoom is the zoom level of a "map" block; 13-20.
//
// optional
Zoom int `json:"zoom,omitempty"`
// Width is the expected width of a "map" block.
//
// optional
Width int `json:"width,omitempty"`
// Height is the expected height of a "map" block.
//
// optional
Height int `json:"height,omitempty"`
// Animation is the animation of an "animation" block.
//
// optional
Animation *Animation `json:"animation,omitempty"`
// HasSpoiler is true if the preview of an "animation", "photo", or
// "video" block is covered by a spoiler.
//
// optional
HasSpoiler bool `json:"has_spoiler,omitempty"`
// Audio is the audio of an "audio" block.
//
// optional
Audio *Audio `json:"audio,omitempty"`
// Document is the general file of a "document" block.
//
// optional
Document *Document `json:"document,omitempty"`
// Photo are the available sizes of a "photo" block.
//
// optional
Photo []PhotoSize `json:"photo,omitempty"`
// Video is the video of a "video" block.
//
// optional
Video *Video `json:"video,omitempty"`
// VoiceNote is the voice note of a "voice_note" block.
//
// optional
VoiceNote *Voice `json:"voice_note,omitempty"`
// Caption is the caption of a media block ("collage", "slideshow", "map",
// "animation", "audio", "document", "photo", "video", "voice_note"). It
// shares the "caption" wire field with TableCaption.
//
// optional
Caption *RichBlockCaption `json:"-"`
// TableCaption is the caption of a "table" block. It shares the "caption"
// wire field with Caption.
//
// optional
TableCaption *RichText `json:"-"`
}
RichBlock represents a block in a rich formatted message. It is a flat polymorphic type keyed by Type; only the fields relevant to a given Type are set. The "caption" wire field is split into Caption (for media blocks) and TableCaption (for the "table" block), which have different shapes; at most one is ever set.
func (RichBlock) MarshalJSON ¶
MarshalJSON encodes a RichBlock, emitting Caption or TableCaption under the shared "caption" wire field.
func (*RichBlock) UnmarshalJSON ¶
UnmarshalJSON decodes a RichBlock, routing the polymorphic "caption" field to Caption or TableCaption based on Type.
type RichBlockCaption ¶
type RichBlockCaption struct {
// Text is the block caption.
Text RichText `json:"text"`
// Credit is the block credit, corresponding to the HTML tag <cite>.
//
// optional
Credit *RichText `json:"credit,omitempty"`
}
RichBlockCaption is the caption of a rich formatted block.
type RichBlockListItem ¶
type RichBlockListItem struct {
// Label of the item.
Label string `json:"label"`
// Blocks is the content of the item.
Blocks []RichBlock `json:"blocks"`
// HasCheckbox is true if the item has a checkbox.
//
// optional
HasCheckbox bool `json:"has_checkbox,omitempty"`
// IsChecked is true if the item has a checked checkbox.
//
// optional
IsChecked bool `json:"is_checked,omitempty"`
// Value is, for ordered lists, the numeric value of the item label.
//
// optional
Value int `json:"value,omitempty"`
// Type is, for ordered lists, the type of the item label; one of "a", "A",
// "i", "I", or "1".
//
// optional
Type string `json:"type,omitempty"`
}
RichBlockListItem is an item of a rich formatted list.
type RichBlockTableCell ¶
type RichBlockTableCell struct {
// Text in the cell. If omitted, the cell is invisible.
//
// optional
Text *RichText `json:"text,omitempty"`
// IsHeader is true if the cell is a header cell.
//
// optional
IsHeader bool `json:"is_header,omitempty"`
// Colspan is the number of columns the cell spans if it is bigger than 1.
//
// optional
Colspan int `json:"colspan,omitempty"`
// Rowspan is the number of rows the cell spans if it is bigger than 1.
//
// optional
Rowspan int `json:"rowspan,omitempty"`
// Align is the horizontal cell content alignment; one of "left",
// "center", or "right".
Align string `json:"align"`
// Valign is the vertical cell content alignment; one of "top", "middle",
// or "bottom".
Valign string `json:"valign"`
}
RichBlockTableCell is a cell in a rich formatted table.
type RichMessage ¶
type RichMessage struct {
// Blocks is the content of the message.
Blocks []RichBlock `json:"blocks"`
// IsRTL is true if the rich message must be shown right-to-left.
//
// optional
IsRTL bool `json:"is_rtl,omitempty"`
}
RichMessage represents a received rich formatted message, exposed via Message.RichMessage.
type RichMessageButton ¶
type RichMessageButton struct {
// Text of the button. May contain only plain text, "custom_emoji" and
// "date_time" entities.
Text RichText `json:"text"`
// Style of the button. One of "danger", "success", "primary", or "link"
// (the button is shown as a regular link without borders). Apps may use
// theme-specific colors for the button background and text based on the
// style. The style "link" is allowed only for callback buttons.
//
// optional
Style string `json:"style,omitempty"`
// URL is an HTTP or tg:// URL to be opened when the button is pressed.
// Links tg://user?id=<user_id> can be used to mention a user by their
// identifier without using a username, if this is allowed by their
// privacy settings.
//
// optional
URL string `json:"url,omitempty"`
// CallbackData is the data to be sent in a callback query to the bot when
// the button is pressed, 1-64 bytes.
//
// optional
CallbackData string `json:"callback_data,omitempty"`
// WebApp is the description of the Web App that will be launched when the
// user presses the button. The Web App will be able to send an arbitrary
// message on behalf of the user using the method answerWebAppQuery.
// Available only in private chats between a user and the bot. Not
// supported for messages sent on behalf of a business account.
//
// optional
WebApp *WebAppInfo `json:"web_app,omitempty"`
// LoginURL is an HTTPS URL used to automatically authorize the user. Can
// be used as a replacement for the Telegram Login Widget. Not supported
// for ephemeral messages.
//
// optional
LoginURL *LoginURL `json:"login_url,omitempty"`
// SwitchInlineQuery, if set, prompts the user to select one of their
// chats, open that chat and insert the bot's username and the specified
// inline query in the input field. May be empty, in which case just the
// bot's username will be inserted. Not supported for messages sent in
// channel direct messages chats and on behalf of a business account.
//
// optional
SwitchInlineQuery *string `json:"switch_inline_query,omitempty"`
// SwitchInlineQueryCurrentChat, if set, inserts the bot's username and
// the specified inline query in the current chat's input field. May be
// empty, in which case only the bot's username will be inserted. Not
// supported in channels and for messages sent in channel direct messages
// chats and on behalf of a business account.
//
// optional
SwitchInlineQueryCurrentChat *string `json:"switch_inline_query_current_chat,omitempty"`
// SwitchInlineQueryChosenChat, if set, prompts the user to select one of
// their chats of the specified type, open that chat and insert the bot's
// username and the specified inline query in the input field. Not
// supported for messages sent in channel direct messages chats and on
// behalf of a business account.
//
// optional
SwitchInlineQueryChosenChat *SwitchInlineQueryChosenChat `json:"switch_inline_query_chosen_chat,omitempty"`
// CopyText is a button that copies the specified text to the clipboard.
//
// optional
CopyText *CopyTextButton `json:"copy_text,omitempty"`
// Disabled if set, then the button is disabled and does nothing.
//
// optional
Disabled *DisabledButton `json:"disabled,omitempty"`
}
RichMessageButton represents a button in a rich message. Use exactly one of the fields other than Text and Style to specify the type of the button.
type RichText ¶
type RichText struct {
// PlainText holds the value when the rich text is a bare string.
//
// optional
PlainText string `json:"-"`
// IsPlain reports whether the value was a bare string, so that an empty
// PlainText can be distinguished from an unset value.
//
// optional
IsPlain bool `json:"-"`
// Parts holds the value when the rich text is an array of RichText.
//
// optional
Parts []RichText `json:"-"`
// Type is the styled-span discriminator (one of the RichTextType*
// constants) when the value is an object; empty for the string and array
// forms.
//
// optional
Type string `json:"type,omitempty"`
// Text is the nested content of the styled span. Present for most span
// types; absent for "anchor".
//
// optional
Text *RichText `json:"text,omitempty"`
// UnixTime is the Unix time associated with a "date_time" span.
//
// optional
UnixTime int64 `json:"unix_time,omitempty"`
// DateTimeFormat defines the formatting of a "date_time" span.
//
// optional
DateTimeFormat string `json:"date_time_format,omitempty"`
// User is the mentioned user of a "text_mention" span.
//
// optional
User *User `json:"user,omitempty"`
// CustomEmojiID is the identifier of the custom emoji of a "custom_emoji"
// span.
//
// optional
CustomEmojiID string `json:"custom_emoji_id,omitempty"`
// AlternativeText is the fallback emoji of a "custom_emoji" span.
//
// optional
AlternativeText string `json:"alternative_text,omitempty"`
// Expression is the LaTeX expression of a "mathematical_expression" span.
//
// optional
Expression string `json:"expression,omitempty"`
// URL is the link target of a "url" span.
//
// optional
URL string `json:"url,omitempty"`
// EmailAddress is the email address of an "email_address" span.
//
// optional
EmailAddress string `json:"email_address,omitempty"`
// PhoneNumber is the phone number of a "phone_number" span.
//
// optional
PhoneNumber string `json:"phone_number,omitempty"`
// BankCardNumber is the bank card number of a "bank_card_number" span.
//
// optional
BankCardNumber string `json:"bank_card_number,omitempty"`
// Username is the username of a "mention" span.
//
// optional
Username string `json:"username,omitempty"`
// Hashtag is the hashtag of a "hashtag" span.
//
// optional
Hashtag string `json:"hashtag,omitempty"`
// Cashtag is the cashtag of a "cashtag" span.
//
// optional
Cashtag string `json:"cashtag,omitempty"`
// BotCommand is the bot command of a "bot_command" span.
//
// optional
BotCommand string `json:"bot_command,omitempty"`
// Name is the anchor name of an "anchor" span or the reference name of a
// "reference" span.
//
// optional
Name string `json:"name,omitempty"`
// AnchorName is the target anchor name of an "anchor_link" span. If empty,
// the link points back to the top of the message.
//
// optional
AnchorName string `json:"anchor_name,omitempty"`
// ReferenceName is the target reference name of a "reference_link" span.
//
// optional
ReferenceName string `json:"reference_name,omitempty"`
// Button is the button of a "button" span.
//
// optional
Button *RichMessageButton `json:"button,omitempty"`
// Raw preserves the original JSON of the object form for forward
// compatibility with span types not yet modeled.
//
// optional
Raw json.RawMessage `json:"-"`
}
RichText represents a rich formatted text. It is polymorphic: on the wire it is one of
- a plain string (PlainText, with IsPlain set true),
- an array of RichText (Parts), or
- a styled span identified by Type, with nested Text and type-specific fields.
Use the field that matches the form of the value; RichText marshals back to whichever form is populated.
func (RichText) MarshalJSON ¶
MarshalJSON encodes a RichText in whichever form is populated.
func (*RichText) UnmarshalJSON ¶
UnmarshalJSON decodes a RichText from its string, array, or object form.
type SavePreparedInlineMessageConfig ¶
type SavePreparedInlineMessageConfig struct {
UserID int64
Result interface{} // InlineQueryResult
AllowUserChats bool
AllowBotChats bool
AllowGroupChats bool
AllowChannelChats bool
}
SavePreparedInlineMessageConfig stores a message that can be sent by a user of a Mini App.
type SavePreparedKeyboardButtonConfig ¶
type SavePreparedKeyboardButtonConfig struct {
// UserID is the unique identifier of the target user that can use the button.
UserID int64
// Button is a KeyboardButton describing the button to be saved.
// The button must be of the type request_users, request_chat, or request_managed_bot.
Button KeyboardButton
}
SavePreparedKeyboardButtonConfig contains the parameters for the savePreparedKeyboardButton method.
type SecureData ¶
type SecureData map[string]*SecureValue
SecureData is a map of the fields and their encrypted values.
type SecureValue ¶
type SecureValue struct {
Data *DataCredentials `json:"data"`
FrontSide *FileCredentials `json:"front_side"`
ReverseSide *FileCredentials `json:"reverse_side"`
Selfie *FileCredentials `json:"selfie"`
Translation []*FileCredentials `json:"translation"`
Files []*FileCredentials `json:"files"`
}
SecureValue contains encrypted values for a SecureData item.
type SendChatJoinRequestWebAppConfig ¶
type SendChatJoinRequestWebAppConfig struct {
// ChatJoinRequestQueryID is the unique identifier of the join request
// query. Required.
ChatJoinRequestQueryID string
// WebAppURL is the URL of the Mini App to be opened. Required.
WebAppURL string
}
SendChatJoinRequestWebAppConfig processes a received chat join request query by showing a Mini App to the user before deciding the outcome. Call AnswerChatJoinRequestQueryConfig afterwards to resolve the join request based on the user's interaction with the Mini App. Returns True on success, so use BotAPI.Request.
type SendChecklistConfig ¶
type SendChecklistConfig struct {
BusinessConnectionID string
ChatID int64
Checklist InputChecklist
DisableNotification bool
ProtectContent bool
MessageEffectID string
ReplyParameters *ReplyParameters
ReplyMarkup interface{}
}
SendChecklistConfig sends a checklist message on behalf of a connected business account.
type SendGiftConfig ¶
type SendGiftConfig struct {
UserID int64
ChatID int64
ChannelUsername string
GiftID string
PayForUpgrade bool
Text string
TextParseMode string
TextEntities []MessageEntity
}
SendGiftConfig sends a gift to a user or channel chat.
Provide the recipient via either UserID (for a user) or ChatID / ChannelUsername (for a channel chat); exactly one of UserID or the chat identifier should be set.
type SendMessageDraftConfig ¶
type SendMessageDraftConfig struct {
ChatID int64
MessageThreadID int
DraftID int64
Text string
ParseMode string
Entities []MessageEntity
// CanStop shows the user a button to stop further drafts. The bot
// receives an Update with StoppedMessageGeneration if the user presses
// the button.
CanStop bool
// KeepOnStop keeps the draft in the chat when the stop button is pressed.
// The draft still disappears after a short time or if the bot sends a
// message. To fully preserve the partial draft, send it as a new message.
KeepOnStop bool
}
SendMessageDraftConfig streams a partial text message to a user while the content is still being generated. The streamed draft is ephemeral and acts as a 30-second preview; to persist the message, call sendMessage with the finalized text. Pass an empty Text to show a "Thinking..." placeholder.
DraftID must be non-zero; updates with the same DraftID animate together.
type SendPaidMediaConfig ¶
type SendPaidMediaConfig struct {
BaseChat
// StarCount is the number of Telegram Stars that must be paid to buy
// access to the media; 1-2500.
StarCount int
// Media is the list of media to be sent; 1-10 items.
Media []InputPaidMedia
// Payload is the bot-defined paid media payload, 0-128 bytes. Received
// back in a PurchasedPaidMedia update and in TransactionPartner.
Payload string
// Caption of the media to be sent, 0-1024 characters after entities parsing.
Caption string
// ParseMode mode for parsing entities in the caption.
ParseMode string
// CaptionEntities is a list of special entities that appear in the caption.
CaptionEntities []MessageEntity
// ShowCaptionAboveMedia pass True if the caption must be shown above the message media.
ShowCaptionAboveMedia bool
}
SendPaidMediaConfig sends paid media to a channel or private chat.
type SendPollConfig ¶
type SendPollConfig struct {
BaseChat
Question string
QuestionParseMode string
QuestionEntities []MessageEntity
Description string
DescriptionParseMode string
DescriptionEntities []MessageEntity
Media any
Options []InputPollOption
IsAnonymous bool
Type string
AllowsMultipleAnswers bool
AllowsRevoting bool
ShuffleOptions bool
AllowAddingOptions bool
HideResultsUntilCloses bool
MembersOnly bool
CountryCodes []string
CorrectOptionIDs []int
Explanation string
ExplanationParseMode string
ExplanationEntities []MessageEntity
ExplanationMedia any
OpenPeriod int
CloseDate int
IsClosed bool
}
SendPollConfig allows you to send a poll.
Media and ExplanationMedia accept any of the InputMedia* variants allowed by InputPollMedia (InputMediaAnimation, InputMediaAudio, InputMediaDocument, InputMediaLivePhoto, InputMediaLocation, InputMediaPhoto, InputMediaVenue, InputMediaVideo).
type SendRichMessageConfig ¶
type SendRichMessageConfig struct {
BaseChat
EphemeralSendParams
// RichMessage is the message to be sent.
RichMessage *InputRichMessage
}
SendRichMessageConfig contains information about a sendRichMessage request. If the message contains a block with a media element, the bot must have the right to send that media to the chat. On success the sent Message is returned, so it can be passed to BotAPI.Send.
func NewRichMessage ¶
func NewRichMessage(chatID int64, message InputRichMessage) SendRichMessageConfig
NewRichMessage creates a new sendRichMessage request for the given chat. Exactly one of message.HTML, message.Markdown, or message.Blocks must be set.
type SendRichMessageDraftConfig ¶
type SendRichMessageDraftConfig struct {
// ChatID is the unique identifier for the target private chat. Required.
ChatID int64
// MessageThreadID is the unique identifier for the target message thread.
MessageThreadID int
// DraftID is the unique identifier of the message draft; must be
// non-zero. Changes to drafts with the same identifier are animated.
// Required.
DraftID int
// RichMessage is the partial message to be streamed. Required.
RichMessage *InputRichMessage
// CanStop shows the user a button to stop further drafts. The bot
// receives an Update with StoppedMessageGeneration if the user presses
// the button.
CanStop bool
// KeepOnStop keeps the draft in the chat when the stop button is pressed.
// The draft still disappears after a short time or if the bot sends a
// message. To fully preserve the partial draft, send it as a new message.
KeepOnStop bool
}
SendRichMessageDraftConfig streams a partial rich message to a user while the message is being generated. The streamed draft is ephemeral and acts as a temporary 30-second preview; once the output is finalized, sendRichMessage must be called with the complete message to persist it. Returns True on success, so use BotAPI.Request.
type SentGuestMessage ¶
type SentGuestMessage struct {
// InlineMessageID is the identifier of the sent inline message.
InlineMessageID string `json:"inline_message_id"`
}
SentGuestMessage describes an inline message sent by a guest bot in response to a guest query.
type SentWebAppMessage ¶
type SentWebAppMessage struct {
// Identifier of the sent inline message. Available only if there is an inline
// keyboard attached to the message.
//
// optional
InlineMessageID string `json:"inline_message_id,omitempty"`
}
SentWebAppMessage contains information about an inline message sent by a Web App on behalf of a user.
type SetBusinessAccountBioConfig ¶
SetBusinessAccountBioConfig changes the bio of a managed business account.
type SetBusinessAccountGiftSettingsConfig ¶
type SetBusinessAccountGiftSettingsConfig struct {
BusinessConnectionID string
ShowGiftButton bool
AcceptedGiftTypes AcceptedGiftTypes
}
SetBusinessAccountGiftSettingsConfig changes the privacy settings pertaining to incoming gifts in a managed business account.
type SetBusinessAccountNameConfig ¶
type SetBusinessAccountNameConfig struct {
BusinessConnectionID string
FirstName string
LastName string
}
SetBusinessAccountNameConfig changes the first and last name of a managed business account.
type SetBusinessAccountProfilePhotoConfig ¶
type SetBusinessAccountProfilePhotoConfig struct {
BusinessConnectionID string
Photo InputProfilePhoto
IsPublic bool
}
SetBusinessAccountProfilePhotoConfig changes the profile photo of a managed business account.
type SetBusinessAccountUsernameConfig ¶
SetBusinessAccountUsernameConfig changes the username of a managed business account.
type SetChatAdministratorCustomTitle ¶
type SetChatAdministratorCustomTitle struct {
ChatMemberConfig
CustomTitle string
}
SetChatAdministratorCustomTitle sets the title of an administrative user promoted by the bot for a chat.
type SetChatDescriptionConfig ¶
SetChatDescriptionConfig allows you to set the description of a supergroup or channel.
func NewChatDescription ¶
func NewChatDescription(chatID int64, description string) SetChatDescriptionConfig
NewChatDescription allows you to update the description of a chat.
type SetChatMemberTagConfig ¶
type SetChatMemberTagConfig struct {
ChatMemberConfig
Tag string
}
SetChatMemberTagConfig sets the custom tag for a chat member.
type SetChatMenuButtonConfig ¶
type SetChatMenuButtonConfig struct {
ChatID int64
ChannelUsername string
MenuButton *MenuButton
}
SetChatMenuButtonConfig changes the bot's menu button in a private chat, or the default menu button.
type SetChatPermissionsConfig ¶
type SetChatPermissionsConfig struct {
ChatConfig
Permissions *ChatPermissions
UseIndependentChatPermissions bool
}
SetChatPermissionsConfig allows you to set default permissions for the members in a group. The bot must be an administrator and have rights to restrict members.
type SetChatPhotoConfig ¶
type SetChatPhotoConfig struct {
BaseFile
}
SetChatPhotoConfig allows you to set a group, supergroup, or channel's photo.
func NewChatPhoto ¶
func NewChatPhoto(chatID int64, photo RequestFileData) SetChatPhotoConfig
NewChatPhoto allows you to update the photo for a chat.
type SetChatStickerSetConfig ¶
type SetChatStickerSetConfig struct {
ChatID int64
SuperGroupUsername string
StickerSetName string
}
SetChatStickerSetConfig allows you to set the sticker set for a supergroup.
type SetChatTitleConfig ¶
SetChatTitleConfig allows you to set the title of something other than a private chat.
func NewChatTitle ¶
func NewChatTitle(chatID int64, title string) SetChatTitleConfig
NewChatTitle allows you to update the title of a chat.
type SetCustomEmojiStickerSetThumbnailConfig ¶
type SetCustomEmojiStickerSetThumbnailConfig struct {
Name string
CustomEmojiID string // pass an empty string to drop the thumbnail
}
SetCustomEmojiStickerSetThumbnailConfig sets the thumbnail of a custom emoji sticker set. The bot must own the sticker set.
type SetGameScoreConfig ¶
type SetGameScoreConfig struct {
UserID int64
Score int
Force bool
DisableEditMessage bool
ChatID int64
ChannelUsername string
MessageID int
InlineMessageID string
}
SetGameScoreConfig allows you to update the game score in a chat.
type SetManagedBotAccessSettingsConfig ¶
type SetManagedBotAccessSettingsConfig struct {
UserID int64
IsAccessRestricted bool
AddedUserIDs []int64
}
SetManagedBotAccessSettingsConfig updates the access settings of a managed bot. AddedUserIDs is a list of up to 10 users that will gain access in addition to the bot's owner; it is ignored when IsAccessRestricted is false.
type SetMessageReactionConfig ¶
type SetMessageReactionConfig struct {
ChatID int64
ChannelUsername string
MessageID int
Reaction []ReactionType
IsBig bool
}
SetMessageReactionConfig sets the bot's reaction to a message. Pass an empty Reaction to remove all reactions from the message.
type SetMyCommandsConfig ¶
type SetMyCommandsConfig struct {
Commands []BotCommand
Scope *BotCommandScope
LanguageCode string
}
SetMyCommandsConfig sets a list of commands the bot understands.
func NewSetMyCommands ¶
func NewSetMyCommands(commands ...BotCommand) SetMyCommandsConfig
NewSetMyCommands allows you to set the registered commands.
func NewSetMyCommandsWithScope ¶
func NewSetMyCommandsWithScope(scope BotCommandScope, commands ...BotCommand) SetMyCommandsConfig
NewSetMyCommandsWithScope allows you to set the registered commands for a given scope.
func NewSetMyCommandsWithScopeAndLanguage ¶
func NewSetMyCommandsWithScopeAndLanguage(scope BotCommandScope, languageCode string, commands ...BotCommand) SetMyCommandsConfig
NewSetMyCommandsWithScopeAndLanguage allows you to set the registered commands for a given scope and language code.
type SetMyDefaultAdministratorRightsConfig ¶
type SetMyDefaultAdministratorRightsConfig struct {
Rights ChatAdministratorRights
ForChannels bool
}
type SetMyDescriptionConfig ¶
SetMyDescriptionConfig changes the bot's description, which is shown in the chat with the bot if the chat is empty.
type SetMyNameConfig ¶
SetMyNameConfig changes the bot's name. Different names can be set for different user languages.
type SetMyProfilePhotoConfig ¶
type SetMyProfilePhotoConfig struct {
Photo InputProfilePhoto
}
SetMyProfilePhotoConfig changes the profile photo of the bot.
type SetMyShortDescriptionConfig ¶
SetMyShortDescriptionConfig changes the bot's short description, which is shown on the bot's profile page and is sent together with the link when users share the bot.
type SetPassportDataErrorsConfig ¶
type SetPassportDataErrorsConfig struct {
// UserID is the user identifier.
UserID int64
// Errors is the list of errors describing what is wrong with the
// submitted Passport data.
Errors []PassportElementError
}
SetPassportDataErrorsConfig informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change).
Errors must hold PassportElementError* values, for example PassportElementErrorDataField or PassportElementErrorUnspecified.
type SetStickerEmojiListConfig ¶
type SetStickerEmojiListConfig struct {
Sticker string // file identifier of the sticker
EmojiList []string
}
SetStickerEmojiListConfig changes the list of emoji assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot.
type SetStickerKeywordsConfig ¶
type SetStickerKeywordsConfig struct {
Sticker string // file identifier of the sticker
Keywords []string
}
SetStickerKeywordsConfig changes the search keywords assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot.
type SetStickerMaskPositionConfig ¶
type SetStickerMaskPositionConfig struct {
Sticker string // file identifier of the sticker
MaskPosition *MaskPosition
}
SetStickerMaskPositionConfig changes the mask position of a mask sticker. The sticker must belong to a sticker set created by the bot.
type SetStickerPositionConfig ¶
SetStickerPositionConfig allows you to change the position of a sticker in a set.
type SetStickerSetThumbnailConfig ¶
type SetStickerSetThumbnailConfig struct {
Name string
UserID int64
Thumbnail RequestFileData
// Format of the thumbnail, must be one of StickerFormatStatic for a .WEBP
// or .PNG image, StickerFormatAnimated for a .TGS animation, or
// StickerFormatVideo for a .WEBM video.
Format string
}
SetStickerSetThumbnailConfig sets the thumbnail of a sticker set.
type SetStickerSetTitleConfig ¶
SetStickerSetTitleConfig sets the title of a sticker set created by the bot.
type SetUserEmojiStatusConfig ¶
type SetUserEmojiStatusConfig struct {
UserID int64
EmojiStatusCustomEmojiID string
EmojiStatusExpirationDate int
}
SetUserEmojiStatusConfig changes the emoji status for a given user that previously allowed the bot to manage their emoji status.
type SharedUser ¶
type SharedUser struct {
UserID int64 `json:"user_id"`
//
// optional
FirstName string `json:"first_name,omitempty"`
//
// optional
LastName string `json:"last_name,omitempty"`
//
// optional
Username string `json:"username,omitempty"`
//
// optional
Photo []PhotoSize `json:"photo,omitempty"`
}
SharedUser contains information about a user that was shared with the bot using a KeyboardButtonRequestUsers button.
type ShippingAddress ¶
type ShippingAddress struct {
// CountryCode ISO 3166-1 alpha-2 country code
CountryCode string `json:"country_code"`
// State if applicable
State string `json:"state"`
// City city
City string `json:"city"`
// StreetLine1 first line for the address
StreetLine1 string `json:"street_line1"`
// StreetLine2 second line for the address
StreetLine2 string `json:"street_line2"`
// PostCode address post code
PostCode string `json:"post_code"`
}
ShippingAddress represents a shipping address.
type ShippingConfig ¶
type ShippingConfig struct {
ShippingQueryID string // required
OK bool // required
ShippingOptions []ShippingOption
ErrorMessage string
}
ShippingConfig contains information for answerShippingQuery request.
type ShippingOption ¶
type ShippingOption struct {
// ID shipping option identifier
ID string `json:"id"`
// Title option title
Title string `json:"title"`
// Prices list of price portions
Prices []LabeledPrice `json:"prices"`
}
ShippingOption represents one shipping option.
type ShippingQuery ¶
type ShippingQuery struct {
// ID unique query identifier
ID string `json:"id"`
// From user who sent the query
From *User `json:"from"`
// InvoicePayload bot specified invoice payload
InvoicePayload string `json:"invoice_payload"`
// ShippingAddress user specified shipping address
ShippingAddress *ShippingAddress `json:"shipping_address"`
}
ShippingQuery contains information about an incoming shipping query.
type StarAmount ¶
type StarAmount struct {
// Amount is the integer amount of Telegram Stars, rounded to 0; can be negative.
Amount int `json:"amount"`
// NanostarAmount is the number of 1/1000000000 shares of Telegram Stars;
// from -999999999 to 999999999.
//
// optional
NanostarAmount int `json:"nanostar_amount,omitempty"`
}
StarAmount describes an amount of Telegram Stars.
type StarTransaction ¶
type StarTransaction struct {
// ID is the unique identifier of the transaction. Coincides with the
// identifier of the original transaction for refund transactions. Can
// be used to match transactions to refunds.
ID string `json:"id"`
// Amount of Telegram Stars transferred by the transaction.
Amount int `json:"amount"`
// NanostarAmount is the number of 1/1000000000 shares of Telegram Stars
// transferred by the transaction; from 0 to 999999999.
//
// optional
NanostarAmount int `json:"nanostar_amount,omitempty"`
// Date the transaction was created in Unix time.
Date int `json:"date"`
// Source of an incoming transaction (e.g. a user purchasing goods or
// services, Fragment refunding a failed withdrawal). Only for incoming
// transactions.
//
// optional
Source *TransactionPartner `json:"source,omitempty"`
// Receiver of an outgoing transaction (e.g. a user for a purchase
// refund, Fragment for a withdrawal). Only for outgoing transactions.
//
// optional
Receiver *TransactionPartner `json:"receiver,omitempty"`
}
StarTransaction describes a Telegram Star transaction.
type StarTransactions ¶
type StarTransactions struct {
// Transactions is the list of transactions.
Transactions []StarTransaction `json:"transactions"`
}
StarTransactions contains a list of Telegram Star transactions.
type Sticker ¶
type Sticker struct {
// FileID is an identifier for this file, which can be used to download or
// reuse the file
FileID string `json:"file_id"`
// FileUniqueID is a unique identifier for this file,
// which is supposed to be the same over time and for different bots.
// Can't be used to download or reuse the file.
FileUniqueID string `json:"file_unique_id"`
// Type of the sticker, currently one of "regular", "mask", "custom_emoji".
// The type of the sticker is independent from its format,
// which is determined by the fields IsAnimated and IsVideo.
Type string `json:"type"`
// Width sticker width
Width int `json:"width"`
// Height sticker height
Height int `json:"height"`
// IsAnimated true, if the sticker is animated
//
// optional
IsAnimated bool `json:"is_animated,omitempty"`
// IsVideo true, if the sticker is a video sticker
//
// optional
IsVideo bool `json:"is_video,omitempty"`
// Thumbnail sticker thumbnail in the .WEBP or .JPG format
//
// optional
Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
// Emoji associated with the sticker
//
// optional
Emoji string `json:"emoji,omitempty"`
// SetName of the sticker set to which the sticker belongs
//
// optional
SetName string `json:"set_name,omitempty"`
// PremiumAnimation for premium regular stickers, premium animation for the sticker
//
// optional
PremiumAnimation *File `json:"premium_animation,omitempty"`
// MaskPosition is for mask stickers, the position where the mask should be
// placed
//
// optional
MaskPosition *MaskPosition `json:"mask_position,omitempty"`
// CustomEmojiID for custom emoji stickers, unique identifier of the custom emoji
//
// optional
CustomEmojiID string `json:"custom_emoji_id,omitempty"`
// NeedsRepainting is true if the sticker must be repainted to a text color
// in messages, the color of the Telegram Premium badge in emoji status,
// white color on chat photos, or another appropriate color in other places.
//
// optional
NeedsRepainting bool `json:"needs_repainting,omitempty"`
// FileSize
//
// optional
FileSize int `json:"file_size,omitempty"`
}
Sticker represents a sticker.
type StickerConfig ¶
type StickerConfig struct {
BaseFile
EphemeralSendParams
// Emoji associated with the sticker; only for just uploaded stickers.
Emoji string
}
StickerConfig contains information about a SendSticker request.
func NewSticker ¶
func NewSticker(chatID int64, file RequestFileData) StickerConfig
NewSticker creates a new sendSticker request.
type StickerSet ¶
type StickerSet struct {
// Name sticker set name
Name string `json:"name"`
// Title sticker set title
Title string `json:"title"`
// StickerType of stickers in the set, currently one of “regular”, “mask”, “custom_emoji”
StickerType string `json:"sticker_type"`
// Stickers list of all set stickers
Stickers []Sticker `json:"stickers"`
// Thumb is the sticker set thumbnail in the .WEBP or .TGS format
Thumbnail *PhotoSize `json:"thumbnail"`
}
StickerSet represents a sticker set.
type StopMessageLiveLocationConfig ¶
type StopMessageLiveLocationConfig struct {
BaseEdit
}
StopMessageLiveLocationConfig stops updating a live location.
type StopPollConfig ¶
type StopPollConfig struct {
BaseEdit
}
StopPollConfig allows you to stop a poll sent by the bot.
func NewStopPoll ¶
func NewStopPoll(chatID int64, messageID int) StopPollConfig
NewStopPoll allows you to stop a poll.
type Story ¶
type Story struct {
// Chat that posted the story.
Chat Chat `json:"chat"`
// ID is the unique identifier of the story in the chat.
ID int `json:"id"`
}
Story represents a story.
type StoryArea ¶
type StoryArea struct {
// Position of the area.
Position StoryAreaPosition `json:"position"`
// Type of the area.
Type StoryAreaType `json:"type"`
}
StoryArea describes a clickable area on a story.
type StoryAreaPosition ¶
type StoryAreaPosition struct {
// XPercentage is the abscissa of the area's center, as a percentage of
// the media width.
XPercentage float64 `json:"x_percentage"`
// YPercentage is the ordinate of the area's center, as a percentage of
// the media height.
YPercentage float64 `json:"y_percentage"`
// WidthPercentage is the width of the area's rectangle, as a percentage
// of the media width.
WidthPercentage float64 `json:"width_percentage"`
// HeightPercentage is the height of the area's rectangle, as a percentage
// of the media height.
HeightPercentage float64 `json:"height_percentage"`
// RotationAngle is the clockwise rotation angle of the rectangle, in
// degrees; 0-360.
RotationAngle float64 `json:"rotation_angle"`
// CornerRadiusPercentage is the radius of the rectangle corner rounding,
// as a percentage of the media width.
CornerRadiusPercentage float64 `json:"corner_radius_percentage"`
}
StoryAreaPosition describes the position of a clickable area within a story.
type StoryAreaType ¶
type StoryAreaType struct {
// Type of the area. One of "location", "suggested_reaction", "link",
// "weather", "unique_gift".
Type string `json:"type"`
// Latitude in degrees. Set when Type is "location".
//
// optional
Latitude float64 `json:"latitude,omitempty"`
// Longitude in degrees. Set when Type is "location".
//
// optional
Longitude float64 `json:"longitude,omitempty"`
// Address of the location. Set when Type is "location".
//
// optional
Address *LocationAddress `json:"address,omitempty"`
// ReactionType is the type of the reaction. Set when Type is
// "suggested_reaction".
//
// optional
ReactionType *ReactionType `json:"reaction_type,omitempty"`
// IsDark is true, if the reaction area has a dark background. Set
// when Type is "suggested_reaction".
//
// optional
IsDark bool `json:"is_dark,omitempty"`
// IsFlipped is true, if reaction area corner is flipped. Set when
// Type is "suggested_reaction".
//
// optional
IsFlipped bool `json:"is_flipped,omitempty"`
// URL to be opened. Set when Type is "link".
//
// optional
URL string `json:"url,omitempty"`
// Temperature in degree Celsius. Set when Type is "weather".
//
// optional
Temperature float64 `json:"temperature,omitempty"`
// Emoji representing the weather. Set when Type is "weather".
//
// optional
Emoji string `json:"emoji,omitempty"`
// BackgroundColor is the color of the area background in the ARGB
// format. Set when Type is "weather".
//
// optional
BackgroundColor int `json:"background_color,omitempty"`
// Name of the unique gift. Set when Type is "unique_gift".
//
// optional
Name string `json:"name,omitempty"`
}
StoryAreaType describes the type of a clickable area on a story. Flat polymorphic by Type:
- "location" → Latitude, Longitude, Address
- "suggested_reaction" → ReactionType, IsDark, IsFlipped
- "link" → URL
- "weather" → Temperature, Emoji, BackgroundColor
- "unique_gift" → Name
type SuccessfulPayment ¶
type SuccessfulPayment struct {
// Currency three-letter ISO 4217 currency code
// (see https://core.telegram.org/bots/payments#supported-currencies)
Currency string `json:"currency"`
// TotalAmount total price in the smallest units of the currency (integer, not float/double).
// For example, for a price of US$ 1.45 pass amount = 145.
// See the exp parameter in currencies.json,
// (https://core.telegram.org/bots/payments/currencies.json)
// it shows the number of digits past the decimal point
// for each currency (2 for the majority of currencies).
TotalAmount int `json:"total_amount"`
// InvoicePayload bot specified invoice payload
InvoicePayload string `json:"invoice_payload"`
// SubscriptionExpirationDate is the expiration date of the subscription,
// in Unix time. For recurring payments only.
//
// optional
SubscriptionExpirationDate int `json:"subscription_expiration_date,omitempty"`
// IsRecurring is true, if the payment is a recurring payment for a
// subscription.
//
// optional
IsRecurring bool `json:"is_recurring,omitempty"`
// IsFirstRecurring is true, if the payment is the first payment for a
// subscription.
//
// optional
IsFirstRecurring bool `json:"is_first_recurring,omitempty"`
// ShippingOptionID identifier of the shipping option chosen by the user
//
// optional
ShippingOptionID string `json:"shipping_option_id,omitempty"`
// OrderInfo order info provided by the user
//
// optional
OrderInfo *OrderInfo `json:"order_info,omitempty"`
// TelegramPaymentChargeID telegram payment identifier
TelegramPaymentChargeID string `json:"telegram_payment_charge_id"`
// ProviderPaymentChargeID provider payment identifier
ProviderPaymentChargeID string `json:"provider_payment_charge_id"`
}
SuccessfulPayment contains basic information about a successful payment.
type SuggestedPostApprovalFailed ¶
type SuggestedPostApprovalFailed struct {
// SuggestedPostMessage is the message containing the suggested post
// whose approval has failed.
//
// optional
SuggestedPostMessage *Message `json:"suggested_post_message,omitempty"`
// Price at which the post would have been approved.
Price SuggestedPostPrice `json:"price"`
}
SuggestedPostApprovalFailed describes a service message about the failure to approve a suggested post due to insufficient funds at the time of payment.
type SuggestedPostApproved ¶
type SuggestedPostApproved struct {
// SuggestedPostMessage is the message containing the suggested post
// that was approved.
//
// optional
SuggestedPostMessage *Message `json:"suggested_post_message,omitempty"`
// Price at which the post was approved.
//
// optional
Price *SuggestedPostPrice `json:"price,omitempty"`
// SendDate is the Unix timestamp when the post will be published.
SendDate int `json:"send_date"`
}
SuggestedPostApproved describes a service message about the approval of a suggested post.
type SuggestedPostDeclined ¶
type SuggestedPostDeclined struct {
// SuggestedPostMessage is the message containing the suggested post
// that was declined.
//
// optional
SuggestedPostMessage *Message `json:"suggested_post_message,omitempty"`
// Comment with which the post was declined.
//
// optional
Comment string `json:"comment,omitempty"`
}
SuggestedPostDeclined describes a service message about the rejection of a suggested post.
type SuggestedPostInfo ¶
type SuggestedPostInfo struct {
// State of the suggested post. Currently, one of "pending", "approved",
// "declined".
State string `json:"state"`
// Price of the suggested post.
//
// optional
Price *SuggestedPostPrice `json:"price,omitempty"`
// SendDate is the Unix timestamp when the post is suggested to be
// published.
//
// optional
SendDate int `json:"send_date,omitempty"`
}
SuggestedPostInfo contains information about a suggested post.
type SuggestedPostPaid ¶
type SuggestedPostPaid struct {
// SuggestedPostMessage is the message containing the suggested post.
//
// optional
SuggestedPostMessage *Message `json:"suggested_post_message,omitempty"`
// Currency in which the payment was made. Currently, one of "XTR" or "TON".
Currency string `json:"currency"`
// Amount in the smallest units of the currency that was received by
// the channel in nanotoncoins; for payments in toncoins only.
//
// optional
Amount int `json:"amount,omitempty"`
// StarAmount is the amount of Telegram Stars that was received by the
// channel; for payments in Telegram Stars only.
//
// optional
StarAmount *StarAmount `json:"star_amount,omitempty"`
}
SuggestedPostPaid describes a service message about a successful payment for a suggested post.
type SuggestedPostParameters ¶
type SuggestedPostParameters struct {
// Price of the suggested post. If the field is omitted, then the post
// is unpaid.
//
// optional
Price *SuggestedPostPrice `json:"price,omitempty"`
// SendDate is the Unix timestamp when the post is suggested to be
// published. If specified, then the date must be between 300 and
// 2678400 seconds (30 days) in the future. If omitted, then the post
// can be published at any time within 30 days at the sole discretion
// of the administrator.
//
// optional
SendDate int `json:"send_date,omitempty"`
}
SuggestedPostParameters contains parameters of a post that is suggested by the bot.
type SuggestedPostPrice ¶
type SuggestedPostPrice struct {
// Currency is the currency in which the price is expressed. Currently,
// always "XTR" (Telegram Stars) or "TON" (Toncoin).
Currency string `json:"currency"`
// Amount is the amount of the currency to be paid for the post.
Amount int `json:"amount"`
}
SuggestedPostPrice describes the price of a suggested post.
type SuggestedPostRefunded ¶
type SuggestedPostRefunded struct {
// SuggestedPostMessage is the message containing the suggested post
// that was refunded.
//
// optional
SuggestedPostMessage *Message `json:"suggested_post_message,omitempty"`
// Reason for the refund. Currently, one of "post_deleted",
// "payment_refunded".
Reason string `json:"reason"`
}
SuggestedPostRefunded describes a service message about a payment refund for a suggested post.
type SwitchInlineQueryChosenChat ¶
type SwitchInlineQueryChosenChat struct {
// Query is the default inline query to be inserted in the input field.
// If left empty, only the bot's username will be inserted.
//
// optional
Query string `json:"query,omitempty"`
// AllowUserChats is true if private chats with users can be chosen.
//
// optional
AllowUserChats bool `json:"allow_user_chats,omitempty"`
// AllowBotChats is true if private chats with bots can be chosen.
//
// optional
AllowBotChats bool `json:"allow_bot_chats,omitempty"`
// AllowGroupChats is true if group and supergroup chats can be chosen.
//
// optional
AllowGroupChats bool `json:"allow_group_chats,omitempty"`
// AllowChannelChats is true if channel chats can be chosen.
//
// optional
AllowChannelChats bool `json:"allow_channel_chats,omitempty"`
}
SwitchInlineQueryChosenChat represents an inline button that switches the current user to inline mode in a chosen chat, with an optional default inline query.
type TextQuote ¶
type TextQuote struct {
// Text of the quoted part of the message that is replied to by the given
// message.
Text string `json:"text"`
// Entities are special entities that appear in the quote. Currently, only
// bold, italic, underline, strikethrough, spoiler, and custom_emoji
// entities are kept in quotes.
//
// optional
Entities []MessageEntity `json:"entities,omitempty"`
// Position is the approximate quote position in the original message in
// UTF-16 code units as specified by the sender.
Position int `json:"position"`
// IsManual is true, if the quote was chosen manually by the message
// sender. Otherwise, the quote was added automatically by the server.
//
// optional
IsManual bool `json:"is_manual,omitempty"`
}
TextQuote contains information about the quoted part of a message that is replied to by the given message.
type TransactionPartner ¶
type TransactionPartner struct {
// Type of the transaction partner. One of "user", "chat",
// "affiliate_program", "fragment", "telegram_ads", "telegram_api",
// "other".
Type string `json:"type"`
// Chat that the transaction involves. Set when Type is "chat".
//
// optional
Chat *Chat `json:"chat,omitempty"`
// RequestCount is the number of successful requests that caused the
// transaction. Set when Type is "telegram_api".
//
// optional
RequestCount int `json:"request_count,omitempty"`
// User that the transaction involves. Set when Type is "user".
//
// optional
User *User `json:"user,omitempty"`
// Affiliate information if the transaction involves an affiliate
// commission. Set when Type is "user".
//
// optional
Affiliate *AffiliateInfo `json:"affiliate,omitempty"`
// InvoicePayload is the bot-specified invoice payload. Set when Type is
// "user".
//
// optional
InvoicePayload string `json:"invoice_payload,omitempty"`
// SubscriptionPeriod is the number of seconds the subscription will be
// active for. Set when Type is "user" and the transaction is the
// payment for a subscription.
//
// optional
SubscriptionPeriod int `json:"subscription_period,omitempty"`
// PremiumSubscriptionDuration is the duration of a paid Telegram
// Premium subscription, in months. Set when Type is "user" and the
// transaction is a premium subscription gift.
//
// optional
PremiumSubscriptionDuration int `json:"premium_subscription_duration,omitempty"`
// TransactionType describes the type of the transaction. Set when
// Type is "user". Known values: "invoice_payment", "paid_media_payment",
// "gift_purchase", "premium_purchase", "business_account_transfer".
//
// optional
TransactionType string `json:"transaction_type,omitempty"`
// PaidMedia is the information about the paid media bought by the user.
// Set when Type is "user" and the transaction involves paid media.
//
// optional
PaidMedia []PaidMedia `json:"paid_media,omitempty"`
// PaidMediaPayload is the bot-specified paid media payload. Set when
// Type is "user" and TransactionType is "paid_media_payment".
//
// optional
PaidMediaPayload string `json:"paid_media_payload,omitempty"`
// Gift is the gift sent to the user by the bot. Set when Type is
// "user" and the transaction is a gift purchase.
//
// optional
Gift *Gift `json:"gift,omitempty"`
// SponsorUser is the bot owning the affiliate program. Set when Type
// is "affiliate_program".
//
// optional
SponsorUser *User `json:"sponsor_user,omitempty"`
// CommissionPerMille is the number of Telegram Stars received by the
// bot for each 1000 Telegram Stars received by the affiliate program
// sponsor from referred users. Set when Type is "affiliate_program".
//
// optional
CommissionPerMille int `json:"commission_per_mille,omitempty"`
// WithdrawalState is the state of the transaction if the transaction is
// outgoing. Set when Type is "fragment".
//
// optional
WithdrawalState *RevenueWithdrawalState `json:"withdrawal_state,omitempty"`
}
TransactionPartner describes the source or recipient of a StarTransaction. Flat polymorphic by Type:
- "user" → User is set; Affiliate / InvoicePayload / PaidMedia / Gift optionally set
- "chat" → Chat is set; Gift optionally set
- "affiliate_program" → SponsorUser, CommissionPerMille
- "fragment" → WithdrawalState is set
- "telegram_ads" → (no extra fields)
- "telegram_api" → RequestCount is set
- "other" → (no extra fields)
type TransferBusinessAccountStarsConfig ¶
TransferBusinessAccountStarsConfig transfers Telegram Stars from the business account balance to the bot's balance.
type TransferGiftConfig ¶
type TransferGiftConfig struct {
BusinessConnectionID string
OwnedGiftID string
NewOwnerChatID int64
StarCount int
}
TransferGiftConfig transfers an owned unique gift to another user.
type UnbanChatMemberConfig ¶
type UnbanChatMemberConfig struct {
ChatMemberConfig
OnlyIfBanned bool
}
UnbanChatMemberConfig allows you to unban a user.
type UnbanChatSenderChatConfig ¶
UnbanChatSenderChatConfig unbans a previously banned channel chat in a supergroup or channel. The bot must be an administrator for this to work and must have the appropriate administrator rights.
type UnhideGeneralForumTopicConfig ¶
UnhideGeneralForumTopicConfig unhides the 'General' topic in a forum supergroup chat. The bot must have the can_manage_topics administrator rights.
type UniqueGift ¶
type UniqueGift struct {
// BaseName is the human-readable name of the regular gift from which
// this unique gift was upgraded.
BaseName string `json:"base_name"`
// Name is the unique name of the gift.
Name string `json:"name"`
// Number is the unique number of the upgraded gift among gifts upgraded
// from the same regular gift.
Number int `json:"number"`
// GiftID is the identifier of the regular gift that was upgraded to
// this unique gift.
//
// optional
GiftID string `json:"gift_id,omitempty"`
// IsFromBlockchain is true, if the gift was assigned from the TON
// blockchain.
//
// optional
IsFromBlockchain bool `json:"is_from_blockchain,omitempty"`
// IsBurned is true, if the gift was burned by the owner.
//
// optional
IsBurned bool `json:"is_burned,omitempty"`
// IsPremium is true, if the gift can only be owned by users with an
// active Telegram Premium subscription.
//
// optional
IsPremium bool `json:"is_premium,omitempty"`
// Model of the unique gift.
Model UniqueGiftModel `json:"model"`
// Symbol of the unique gift.
Symbol UniqueGiftSymbol `json:"symbol"`
// Backdrop of the unique gift.
Backdrop UniqueGiftBackdrop `json:"backdrop"`
// Colors defines the color scheme based on this unique gift.
//
// optional
Colors *UniqueGiftColors `json:"colors,omitempty"`
// PublisherChat is the chat that published the underlying regular gift.
//
// optional
PublisherChat *Chat `json:"publisher_chat,omitempty"`
}
UniqueGift describes a unique gift that was upgraded from a regular gift.
type UniqueGiftBackdrop ¶
type UniqueGiftBackdrop struct {
// Name of the backdrop.
Name string `json:"name"`
// Colors of the backdrop.
Colors UniqueGiftBackdropColors `json:"colors"`
// RarityPerMille is the number of unique gifts that receive this backdrop
// for every 1000 gifts upgraded.
RarityPerMille int `json:"rarity_per_mille"`
}
UniqueGiftBackdrop describes the backdrop of a unique gift.
type UniqueGiftBackdropColors ¶
type UniqueGiftBackdropColors struct {
// CenterColor is the color in the center of the backdrop in RGB format.
CenterColor int `json:"center_color"`
// EdgeColor is the color on the edges of the backdrop in RGB format.
EdgeColor int `json:"edge_color"`
// SymbolColor is the color used to paint the symbol in RGB format.
SymbolColor int `json:"symbol_color"`
// TextColor is the color for the text on the backdrop in RGB format.
TextColor int `json:"text_color"`
}
UniqueGiftBackdropColors describes the colors of a unique gift backdrop.
type UniqueGiftColors ¶
type UniqueGiftColors struct {
// ModelCustomEmojiID is the custom emoji identifier of the unique gift's
// model.
ModelCustomEmojiID string `json:"model_custom_emoji_id"`
// SymbolCustomEmojiID is the custom emoji identifier of the unique
// gift's symbol.
SymbolCustomEmojiID string `json:"symbol_custom_emoji_id"`
// LightThemeMainColor is the main color used in light themes; RGB format.
LightThemeMainColor int `json:"light_theme_main_color"`
// LightThemeOtherColors is the list of 1-3 additional colors used in
// light themes; RGB format.
LightThemeOtherColors []int `json:"light_theme_other_colors"`
// DarkThemeMainColor is the main color used in dark themes; RGB format.
DarkThemeMainColor int `json:"dark_theme_main_color"`
// DarkThemeOtherColors is the list of 1-3 additional colors used in dark
// themes; RGB format.
DarkThemeOtherColors []int `json:"dark_theme_other_colors"`
}
UniqueGiftColors contains information about the color scheme for a user's name, message replies and link previews based on a unique gift.
type UniqueGiftInfo ¶
type UniqueGiftInfo struct {
// Gift is the information about the unique gift.
Gift UniqueGift `json:"gift"`
// Origin of the gift. One of "upgrade", "transfer", "resale",
// "gifted_upgrade", "offer".
Origin string `json:"origin"`
// Text of the message that was added to the gift.
//
// optional
Text string `json:"text,omitempty"`
// Entities are the special entities that appear in the text.
//
// optional
Entities []MessageEntity `json:"entities,omitempty"`
// IsPrivate is true, if the sender and gift text are shown only to the
// gift receiver; otherwise, everyone can see them.
//
// optional
IsPrivate bool `json:"is_private,omitempty"`
// LastResaleCurrency is the currency in which the gift was last resold
// on a resale market; for gifts with origin "resale" only.
//
// optional
LastResaleCurrency string `json:"last_resale_currency,omitempty"`
// LastResaleAmount is the amount in the smallest units of the currency
// for which the gift was last resold; for gifts with origin "resale" only.
//
// optional
LastResaleAmount int `json:"last_resale_amount,omitempty"`
// OwnedGiftID is the unique identifier of the received gift for the
// bot; only present for gifts received on behalf of business accounts.
//
// optional
OwnedGiftID string `json:"owned_gift_id,omitempty"`
// TransferStarCount is the number of Telegram Stars that must be paid
// to transfer the gift; omitted if the bot cannot transfer the gift.
//
// optional
TransferStarCount int `json:"transfer_star_count,omitempty"`
// NextTransferDate is the point in time (Unix timestamp) when the gift
// can be transferred. If it is in the past, the gift can be transferred
// now.
//
// optional
NextTransferDate int `json:"next_transfer_date,omitempty"`
}
UniqueGiftInfo describes a service message about a unique gift that was sent or received.
type UniqueGiftModel ¶
type UniqueGiftModel struct {
// Name of the model.
Name string `json:"name"`
// Sticker representing the model.
Sticker Sticker `json:"sticker"`
// RarityPerMille is the number of unique gifts that receive this model
// for every 1000 gifts upgraded.
RarityPerMille int `json:"rarity_per_mille"`
// Rarity is a human-readable name for the rarity of the model.
//
// optional
Rarity string `json:"rarity,omitempty"`
}
UniqueGiftModel describes the model of a unique gift.
type UniqueGiftSymbol ¶
type UniqueGiftSymbol struct {
// Name of the symbol.
Name string `json:"name"`
// Sticker representing the symbol.
Sticker Sticker `json:"sticker"`
// RarityPerMille is the number of unique gifts that receive this symbol
// for every 1000 gifts upgraded.
RarityPerMille int `json:"rarity_per_mille"`
}
UniqueGiftSymbol describes the symbol shown on the pattern of a unique gift.
type UnpinAllChatMessagesConfig ¶
UnpinAllChatMessagesConfig contains information of all messages to unpin in a chat.
type UnpinAllForumTopicMessagesConfig ¶
type UnpinAllForumTopicMessagesConfig struct {
ChatID int64
SuperGroupUsername string
MessageThreadID int // required
}
UnpinAllForumTopicMessagesConfig clears the list of pinned messages in a forum topic. The bot must have the can_pin_messages administrator right in the supergroup.
type UnpinAllGeneralForumTopicMessagesConfig ¶
UnpinAllGeneralForumTopicMessagesConfig clears the list of pinned messages in the General forum topic. The bot must be an administrator in the chat with the can_pin_messages administrator right in the supergroup.
type UnpinChatMessageConfig ¶
type UnpinChatMessageConfig struct {
BusinessConnectionID string
ChatID int64
ChannelUsername string
MessageID int
}
UnpinChatMessageConfig contains information of a chat message to unpin.
If MessageID is not specified, it will unpin the most recent pin.
Provide the target chat via either ChatID (numeric identifier) or ChannelUsername ("@channelusername"); the first non-zero / non-empty value is used.
type Update ¶
type Update struct {
// UpdateID is the update's unique identifier.
// Update identifiers start from a certain positive number and increase
// sequentially.
// This ID becomes especially handy if you're using Webhooks,
// since it allows you to ignore repeated updates or to restore
// the correct update sequence, should they get out of order.
// If there are no new updates for at least a week, then identifier
// of the next update will be chosen randomly instead of sequentially.
UpdateID int `json:"update_id"`
// Message new incoming message of any kind — text, photo, sticker, etc.
//
// optional
Message *Message `json:"message,omitempty"`
// EditedMessage new version of a message that is known to the bot and was
// edited
//
// optional
EditedMessage *Message `json:"edited_message,omitempty"`
// ChannelPost new version of a message that is known to the bot and was
// edited
//
// optional
ChannelPost *Message `json:"channel_post,omitempty"`
// EditedChannelPost new incoming channel post of any kind — text, photo,
// sticker, etc.
//
// optional
EditedChannelPost *Message `json:"edited_channel_post,omitempty"`
// InlineQuery new incoming inline query
//
// optional
InlineQuery *InlineQuery `json:"inline_query,omitempty"`
// ChosenInlineResult is the result of an inline query
// that was chosen by a user and sent to their chat partner.
// Please see our documentation on the feedback collecting
// for details on how to enable these updates for your bot.
//
// optional
ChosenInlineResult *ChosenInlineResult `json:"chosen_inline_result,omitempty"`
// CallbackQuery new incoming callback query
//
// optional
CallbackQuery *CallbackQuery `json:"callback_query,omitempty"`
// ShippingQuery new incoming shipping query. Only for invoices with
// flexible price
//
// optional
ShippingQuery *ShippingQuery `json:"shipping_query,omitempty"`
// PreCheckoutQuery new incoming pre-checkout query. Contains full
// information about checkout
//
// optional
PreCheckoutQuery *PreCheckoutQuery `json:"pre_checkout_query,omitempty"`
// Pool new poll state. Bots receive only updates about stopped polls and
// polls, which are sent by the bot
//
// optional
Poll *Poll `json:"poll,omitempty"`
// PollAnswer user changed their answer in a non-anonymous poll. Bots
// receive new votes only in polls that were sent by the bot itself.
//
// optional
PollAnswer *PollAnswer `json:"poll_answer,omitempty"`
// MessageReaction is a reaction to a message that was changed by a user.
// The bot must be an administrator in the chat and must explicitly specify
// "message_reaction" in the list of allowed_updates to receive these updates.
// The update isn't received for reactions set by bots.
//
// optional
MessageReaction *MessageReactionUpdated `json:"message_reaction,omitempty"`
// MessageReactionCount is reactions to a message with anonymous reactions
// were changed. The bot must be an administrator in the chat and must
// explicitly specify "message_reaction_count" in the list of allowed_updates.
//
// optional
MessageReactionCount *MessageReactionCountUpdated `json:"message_reaction_count,omitempty"`
// BusinessConnection is the bot was connected to or disconnected from a
// business account, or a user edited an existing connection with the bot.
//
// optional
BusinessConnection *BusinessConnection `json:"business_connection,omitempty"`
// BusinessMessage is a new message from a connected business account.
//
// optional
BusinessMessage *Message `json:"business_message,omitempty"`
// EditedBusinessMessage is a new version of a message from a connected
// business account that is known to the bot and was edited.
//
// optional
EditedBusinessMessage *Message `json:"edited_business_message,omitempty"`
// DeletedBusinessMessages are messages that were deleted from a connected
// business account.
//
// optional
DeletedBusinessMessages *BusinessMessagesDeleted `json:"deleted_business_messages,omitempty"`
// PurchasedPaidMedia is a user purchased paid media with a non-empty
// payload sent by the bot in a non-channel chat.
//
// optional
PurchasedPaidMedia *PaidMediaPurchased `json:"purchased_paid_media,omitempty"`
// ChatBoost is a boost added to a chat or changed. The bot must be an
// administrator in the chat to receive these updates.
//
// optional
ChatBoost *ChatBoostUpdated `json:"chat_boost,omitempty"`
// RemovedChatBoost is a boost removed from a chat. The bot must be an
// administrator in the chat to receive these updates.
//
// optional
RemovedChatBoost *ChatBoostRemoved `json:"removed_chat_boost,omitempty"`
// MyChatMember is the bot's chat member status was updated in a chat. For
// private chats, this update is received only when the bot is blocked or
// unblocked by the user.
//
// optional
MyChatMember *ChatMemberUpdated `json:"my_chat_member,omitempty"`
// ChatMember is a chat member's status was updated in a chat. The bot must
// be an administrator in the chat and must explicitly specify "chat_member"
// in the list of allowed_updates to receive these updates.
//
// optional
ChatMember *ChatMemberUpdated `json:"chat_member,omitempty"`
// ChatJoinRequest is a request to join the chat has been sent. The bot must
// have the can_invite_users administrator right in the chat to receive
// these updates.
//
// optional
ChatJoinRequest *ChatJoinRequest `json:"chat_join_request,omitempty"`
// ManagedBot is a new bot was created to be managed by the bot,
// or token or owner of a managed bot was changed.
//
// optional
ManagedBot *ManagedBotUpdated `json:"managed_bot,omitempty"`
// GuestMessage is a message received from a chat where the bot is not
// a member, delivered via guest mode. Reply with answerGuestQuery
// using Message.GuestQueryID.
//
// optional
GuestMessage *Message `json:"guest_message,omitempty"`
// Subscription is a change to a user payment subscription toward the
// bot.
//
// optional
Subscription *BotSubscriptionUpdated `json:"subscription,omitempty"`
// StoppedMessageGeneration means a user asked the bot to stop the
// generation of a message.
//
// optional
StoppedMessageGeneration *MessageGenerationStopped `json:"stopped_message_generation,omitempty"`
}
Update is an update response, from GetUpdates.
func (*Update) CallbackData ¶
CallbackData returns the callback query data, if it exists.
type UpdateConfig ¶
UpdateConfig contains information about a GetUpdates request.
func NewUpdate ¶
func NewUpdate(offset int) UpdateConfig
NewUpdate gets updates since the last Offset.
offset is the last Update ID to include. You likely want to set this to the last Update ID plus 1.
type UpdatesChannel ¶
type UpdatesChannel <-chan Update
UpdatesChannel is the channel for getting updates.
func (UpdatesChannel) Clear ¶
func (ch UpdatesChannel) Clear()
Clear discards all unprocessed incoming updates.
type UpgradeGiftConfig ¶
type UpgradeGiftConfig struct {
BusinessConnectionID string
OwnedGiftID string
KeepOriginalDetails bool
StarCount int
}
UpgradeGiftConfig upgrades a regular gift to a unique one.
type UploadStickerConfig ¶
type UploadStickerConfig struct {
UserID int64
Sticker RequestFileData // required
StickerFormat string // required, one of StickerFormatStatic, StickerFormatAnimated, StickerFormatVideo
}
UploadStickerConfig uploads a sticker file for later use in a sticker set.
type User ¶
type User struct {
// ID is a unique identifier for this user or bot
ID int64 `json:"id"`
// IsBot is true if this user is a bot.
IsBot bool `json:"is_bot,omitempty"`
// IsPremium true, if user has Telegram Premium
//
// optional
IsPremium bool `json:"is_premium,omitempty"`
// AddedToAttachmentMenu true, if this user added the bot to the attachment menu
//
// optional
AddedToAttachmentMenu bool `json:"added_to_attachment_menu,omitempty"`
// CanConnectToBusiness true, if the bot can be connected to a Telegram
// Business account to receive its messages. Returned only in getMe.
//
// optional
CanConnectToBusiness bool `json:"can_connect_to_business,omitempty"`
// HasMainWebApp true, if the bot has a main Web App. Returned only in getMe.
//
// optional
HasMainWebApp bool `json:"has_main_web_app,omitempty"`
// HasTopicsEnabled is true, if forum topic mode is enabled for the bot
// in private chats.
//
// optional
HasTopicsEnabled bool `json:"has_topics_enabled,omitempty"`
// AllowsUsersToCreateTopics is true, if users can create forum topics
// in the private chat with the bot.
//
// optional
AllowsUsersToCreateTopics bool `json:"allows_users_to_create_topics,omitempty"`
// FirstName user's or bot's first name
FirstName string `json:"first_name"`
// LastName user's or bot's last name
//
// optional
LastName string `json:"last_name,omitempty"`
// UserName user's or bot's username
//
// optional
UserName string `json:"username,omitempty"`
// LanguageCode IETF language tag of the user's language
// more info: https://en.wikipedia.org/wiki/IETF_language_tag
//
// optional
LanguageCode string `json:"language_code,omitempty"`
// CanJoinGroups is true, if the bot can be invited to groups.
// Returned only in getMe.
//
// optional
CanJoinGroups bool `json:"can_join_groups,omitempty"`
// CanReadAllGroupMessages is true, if privacy mode is disabled for the bot.
// Returned only in getMe.
//
// optional
CanReadAllGroupMessages bool `json:"can_read_all_group_messages,omitempty"`
// SupportsInlineQueries is true, if the bot supports inline queries.
// Returned only in getMe.
//
// optional
SupportsInlineQueries bool `json:"supports_inline_queries,omitempty"`
// SupportsGuestQueries is true, if the bot supports guest queries from
// chats it is not a member of. Returned only in getMe.
//
// optional
SupportsGuestQueries bool `json:"supports_guest_queries,omitempty"`
// CanManageBots is true, if other bots can be created to be controlled by the bot.
// Returned only in getMe.
//
// optional
CanManageBots bool `json:"can_manage_bots,omitempty"`
// SupportsJoinRequestQueries is true, if the bot supports join request
// queries and can be assigned to process them. Returned only in getMe.
//
// optional
SupportsJoinRequestQueries bool `json:"supports_join_request_queries,omitempty"`
}
User represents a Telegram user or bot.
type UserChatBoosts ¶
type UserChatBoosts struct {
// Boosts is the list of boosts added to the chat by the user.
Boosts []ChatBoost `json:"boosts"`
}
UserChatBoosts represents a list of boosts added to a chat by a user.
type UserProfileAudios ¶
type UserProfileAudios struct {
// TotalCount is the total number of profile audios for the target user.
TotalCount int `json:"total_count"`
// Audios are the requested profile audios.
Audios []Audio `json:"audios"`
}
UserProfileAudios represents the audios displayed on a user's profile.
type UserProfilePhotos ¶
type UserProfilePhotos struct {
// TotalCount total number of profile pictures the target user has
TotalCount int `json:"total_count"`
// Photos requested profile pictures (in up to 4 sizes each)
Photos [][]PhotoSize `json:"photos"`
}
UserProfilePhotos contains a set of user profile photos.
type UserProfilePhotosConfig ¶
UserProfilePhotosConfig contains information about a GetUserProfilePhotos request.
func NewUserProfilePhotos ¶
func NewUserProfilePhotos(userID int64) UserProfilePhotosConfig
NewUserProfilePhotos gets user profile photos.
userID is the ID of the user you wish to get profile photos from.
type UserRating ¶
type UserRating struct {
// Level is the current level of the user, indicating their reliability
// when purchasing digital goods and services. A higher level suggests a
// more trustworthy customer; a negative level is likely reason for
// concern.
Level int `json:"level"`
// Rating is the numerical value of the user's rating; the higher the
// rating, the better.
Rating int `json:"rating"`
// CurrentLevelRating is the rating value required to get the current
// level.
CurrentLevelRating int `json:"current_level_rating"`
// NextLevelRating is the rating value required to get to the next level;
// omitted if the maximum level was reached.
//
// optional
NextLevelRating int `json:"next_level_rating,omitempty"`
}
UserRating describes the rating of a user based on their Telegram Star spendings.
type UsersShared ¶
type UsersShared struct {
RequestID int `json:"request_id"`
Users []SharedUser `json:"users"`
}
UsersShared contains information about the users whose identifiers were shared with the bot using a KeyboardButtonRequestUsers button.
type Venue ¶
type Venue struct {
// Location is the venue location
Location Location `json:"location"`
// Title is the name of the venue
Title string `json:"title"`
// Address of the venue
Address string `json:"address"`
// FoursquareID is the foursquare identifier of the venue
//
// optional
FoursquareID string `json:"foursquare_id,omitempty"`
// FoursquareType is the foursquare type of the venue
//
// optional
FoursquareType string `json:"foursquare_type,omitempty"`
// GooglePlaceID is the Google Places identifier of the venue
//
// optional
GooglePlaceID string `json:"google_place_id,omitempty"`
// GooglePlaceType is the Google Places type of the venue
//
// optional
GooglePlaceType string `json:"google_place_type,omitempty"`
}
Venue represents a venue.
type VenueConfig ¶
type VenueConfig struct {
BaseChat
EphemeralSendParams
Latitude float64 // required
Longitude float64 // required
Title string // required
Address string // required
FoursquareID string
FoursquareType string
GooglePlaceID string
GooglePlaceType string
}
VenueConfig contains information about a SendVenue request.
type VerifyChatConfig ¶
VerifyChatConfig verifies a chat on behalf of the organization which is represented by the bot.
Provide the target chat via either ChatID (numeric identifier) or ChannelUsername ("@channelusername"); the first non-zero / non-empty value is used.
type VerifyUserConfig ¶
VerifyUserConfig verifies a user on behalf of the organization which is represented by the bot.
type Video ¶
type Video struct {
// FileID identifier for this file, which can be used to download or reuse
// the file
FileID string `json:"file_id"`
// FileUniqueID is the unique identifier for this file, which is supposed to
// be the same over time and for different bots. Can't be used to download
// or reuse the file.
FileUniqueID string `json:"file_unique_id"`
// Width video width as defined by sender
Width int `json:"width"`
// Height video height as defined by sender
Height int `json:"height"`
// Duration of the video in seconds as defined by sender
Duration int `json:"duration"`
// Thumbnail video thumbnail
//
// optional
Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
// Cover is the available sizes of the cover of the video in the message.
//
// optional
Cover []PhotoSize `json:"cover,omitempty"`
// StartTimestamp is the timestamp in seconds from which the video will
// play in the message.
//
// optional
StartTimestamp int `json:"start_timestamp,omitempty"`
// Qualities lists the other available qualities of this video.
//
// optional
Qualities []VideoQuality `json:"qualities,omitempty"`
// FileName is the original filename as defined by sender
//
// optional
FileName string `json:"file_name,omitempty"`
// MimeType of a file as defined by sender
//
// optional
MimeType string `json:"mime_type,omitempty"`
// FileSize file size
//
// optional
FileSize int64 `json:"file_size,omitempty"`
}
Video represents a video file.
type VideoChatEnded ¶
type VideoChatEnded struct {
// Voice chat duration; in seconds.
Duration int `json:"duration"`
}
VideoChatEnded represents a service message about a voice chat ended in the chat.
type VideoChatParticipantsInvited ¶
type VideoChatParticipantsInvited struct {
// New members that were invited to the voice chat.
//
// optional
Users []User `json:"users,omitempty"`
}
VideoChatParticipantsInvited represents a service message about new members invited to a voice chat.
type VideoChatScheduled ¶
type VideoChatScheduled struct {
// Point in time (Unix timestamp) when the voice chat is supposed to be
// started by a chat administrator
StartDate int `json:"start_date"`
}
VideoChatScheduled represents a service message about a voice chat scheduled in the chat.
func (*VideoChatScheduled) Time ¶
func (m *VideoChatScheduled) Time() time.Time
Time converts the scheduled start date into a Time.
type VideoChatStarted ¶
type VideoChatStarted struct{}
VideoChatStarted represents a service message about a voice chat started in the chat.
type VideoConfig ¶
type VideoConfig struct {
BaseFile
EphemeralSendParams
Thumbnail RequestFileData
Cover RequestFileData
StartTimestamp int
Duration int
Width int
Height int
Caption string
ParseMode string
CaptionEntities []MessageEntity
ShowCaptionAboveMedia bool
SupportsStreaming bool
HasSpoiler bool
}
VideoConfig contains information about a SendVideo request.
func NewVideo ¶
func NewVideo(chatID int64, file RequestFileData) VideoConfig
NewVideo creates a new sendVideo request.
type VideoNote ¶
type VideoNote struct {
// FileID identifier for this file, which can be used to download or reuse the file
FileID string `json:"file_id"`
// FileUniqueID is the unique identifier for this file, which is supposed to
// be the same over time and for different bots. Can't be used to download
// or reuse the file.
FileUniqueID string `json:"file_unique_id"`
// Length video width and height (diameter of the video message) as defined by sender
Length int `json:"length"`
// Duration of the video in seconds as defined by sender
Duration int `json:"duration"`
// Thumbnail video thumbnail
//
// optional
Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
// FileSize file size
//
// optional
FileSize int `json:"file_size,omitempty"`
}
VideoNote object represents a video message.
type VideoNoteConfig ¶
type VideoNoteConfig struct {
BaseFile
EphemeralSendParams
Thumbnail RequestFileData
Duration int
Length int
}
VideoNoteConfig contains information about a SendVideoNote request.
func NewVideoNote ¶
func NewVideoNote(chatID int64, length int, file RequestFileData) VideoNoteConfig
NewVideoNote creates a new sendVideoNote request.
chatID is where to send it, file is a string path to the file, FileReader, or FileBytes.
type VideoQuality ¶
type VideoQuality struct {
// FileID is the identifier for this file, which can be used to download
// or reuse the file.
FileID string `json:"file_id"`
// FileUniqueID is the unique identifier for this file, which is supposed
// to be the same over time and for different bots. Can't be used to
// download or reuse the file.
FileUniqueID string `json:"file_unique_id"`
// Width is the video width.
Width int `json:"width"`
// Height is the video height.
Height int `json:"height"`
// Codec is the codec that was used to encode the video, for example,
// "h264", "h265", or "av01".
Codec string `json:"codec"`
// FileSize is the file size in bytes.
//
// optional
FileSize int64 `json:"file_size,omitempty"`
}
VideoQuality represents a video file of a specific quality.
type Voice ¶
type Voice struct {
// FileID identifier for this file, which can be used to download or reuse the file
FileID string `json:"file_id"`
// FileUniqueID is the unique identifier for this file, which is supposed to
// be the same over time and for different bots. Can't be used to download
// or reuse the file.
FileUniqueID string `json:"file_unique_id"`
// Duration of the audio in seconds as defined by sender
Duration int `json:"duration"`
// MimeType of the file as defined by sender
//
// optional
MimeType string `json:"mime_type,omitempty"`
// FileSize file size
//
// optional
FileSize int64 `json:"file_size,omitempty"`
}
Voice represents a voice note.
type VoiceConfig ¶
type VoiceConfig struct {
BaseFile
EphemeralSendParams
Thumbnail RequestFileData
Caption string
ParseMode string
CaptionEntities []MessageEntity
Duration int
}
VoiceConfig contains information about a SendVoice request.
func NewVoice ¶
func NewVoice(chatID int64, file RequestFileData) VoiceConfig
NewVoice creates a new sendVoice request.
type WebAppData ¶
type WebAppData struct {
// Data is the data. Be aware that a bad client can send arbitrary data in this field.
Data string `json:"data"`
// ButtonText is the text of the web_app keyboard button, from which the Web App
// was opened. Be aware that a bad client can send arbitrary data in this field.
ButtonText string `json:"button_text"`
}
WebAppData Contains data sent from a Web App to the bot.
type WebAppInfo ¶
type WebAppInfo struct {
// URL is the HTTPS URL of a Web App to be opened with additional data as
// specified in Initializing Web Apps.
URL string `json:"url"`
}
WebAppInfo contains information about a Web App.
type WebhookConfig ¶
type WebhookConfig struct {
URL *url.URL
Certificate RequestFileData
IPAddress string
MaxConnections int
AllowedUpdates []string
DropPendingUpdates bool
SecretToken string
}
WebhookConfig contains information about a SetWebhook request.
func NewWebhook ¶
func NewWebhook(link string) (WebhookConfig, error)
NewWebhook creates a new webhook.
link is the url parsable link you wish to get the updates.
Example ¶
bot, err := NewBotAPI("MyAwesomeBotToken")
if err != nil {
panic(err)
}
bot.Debug = true
log.Printf("Authorized on account %s", bot.Self.UserName)
wh, err := NewWebhookWithCert("https://www.google.com:8443/"+bot.Token, FilePath("cert.pem"))
if err != nil {
panic(err)
}
_, err = bot.Request(wh)
if err != nil {
panic(err)
}
info, err := bot.GetWebhookInfo()
if err != nil {
panic(err)
}
if info.LastErrorDate != 0 {
log.Printf("failed to set webhook: %s", info.LastErrorMessage)
}
updates := bot.ListenForWebhook("/" + bot.Token)
go http.ListenAndServeTLS("0.0.0.0:8443", "cert.pem", "key.pem", nil)
for update := range updates {
log.Printf("%+v\n", update)
}
func NewWebhookWithCert ¶
func NewWebhookWithCert(link string, file RequestFileData) (WebhookConfig, error)
NewWebhookWithCert creates a new webhook with a certificate.
link is the url you wish to get webhooks, file contains a string to a file, FileReader, or FileBytes.
Example ¶
bot, err := NewBotAPI("MyAwesomeBotToken")
if err != nil {
panic(err)
}
bot.Debug = true
log.Printf("Authorized on account %s", bot.Self.UserName)
wh, err := NewWebhookWithCert("https://www.google.com:8443/"+bot.Token, FilePath("cert.pem"))
if err != nil {
panic(err)
}
_, err = bot.Request(wh)
if err != nil {
panic(err)
}
info, err := bot.GetWebhookInfo()
if err != nil {
panic(err)
}
if info.LastErrorDate != 0 {
log.Printf("[Telegram callback failed]%s", info.LastErrorMessage)
}
http.HandleFunc("/"+bot.Token, func(w http.ResponseWriter, r *http.Request) {
update, err := bot.HandleUpdate(r)
if err != nil {
log.Printf("%+v\n", err.Error())
} else {
log.Printf("%+v\n", *update)
}
})
go http.ListenAndServeTLS("0.0.0.0:8443", "cert.pem", "key.pem", nil)
type WebhookInfo ¶
type WebhookInfo struct {
// URL webhook URL, may be empty if webhook is not set up.
URL string `json:"url"`
// HasCustomCertificate true, if a custom certificate was provided for webhook certificate checks.
HasCustomCertificate bool `json:"has_custom_certificate"`
// PendingUpdateCount number of updates awaiting delivery.
PendingUpdateCount int `json:"pending_update_count"`
// IPAddress is the currently used webhook IP address
//
// optional
IPAddress string `json:"ip_address,omitempty"`
// LastErrorDate unix time for the most recent error
// that happened when trying to deliver an update via webhook.
//
// optional
LastErrorDate int `json:"last_error_date,omitempty"`
// LastErrorMessage error message in human-readable format for the most recent error
// that happened when trying to deliver an update via webhook.
//
// optional
LastErrorMessage string `json:"last_error_message,omitempty"`
// LastSynchronizationErrorDate is the unix time of the most recent error that
// happened when trying to synchronize available updates with Telegram datacenters.
LastSynchronizationErrorDate int `json:"last_synchronization_error_date,omitempty"`
// MaxConnections maximum allowed number of simultaneous
// HTTPS connections to the webhook for update delivery.
//
// optional
MaxConnections int `json:"max_connections,omitempty"`
// AllowedUpdates is a list of update types the bot is subscribed to.
// Defaults to all update types
//
// optional
AllowedUpdates []string `json:"allowed_updates,omitempty"`
}
WebhookInfo is information about a currently set webhook.
func (WebhookInfo) IsSet ¶
func (info WebhookInfo) IsSet() bool
IsSet returns true if a webhook is currently set.
type WriteAccessAllowed ¶
type WriteAccessAllowed struct {
// FromRequest is true if the access was granted after the user accepted
// an explicit request from a Web App sent by the method requestWriteAccess.
//
// optional
FromRequest bool `json:"from_request,omitempty"`
// WebAppName is the name of the Web App which was launched from a link.
//
// optional
WebAppName string `json:"web_app_name,omitempty"`
// FromAttachmentMenu is true if the access was granted when the bot was
// added to the attachment or side menu.
//
// optional
FromAttachmentMenu bool `json:"from_attachment_menu,omitempty"`
}
WriteAccessAllowed represents a service message about a user allowing a bot to write messages after adding it to the attachment menu, launching a Web App from a link, or accepting an explicit request.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
cmd/specdiff
command
Command specdiff compares this library with the machine-readable Telegram Bot API specification and reports types, fields, methods and parameters that are missing from the Go code.
|
Command specdiff compares this library with the machine-readable Telegram Bot API specification and reports types, fields, methods and parameters that are missing from the Go code. |