Documentation ¶
Index ¶
- Constants
- func DefaultHttpDoRequest(method string, url string, headers map[string]string, body []byte) (respBody []byte, err error)
- func NewAPI(token string) (*API, *User, error)
- func StartReceivingUpdates(api *API, receiver func(update *Update, err error)) (stop func())
- func StartReceivingUpdatesWithParams(api *API, params GetUpdatesParams, receiver func(update *Update, err error)) (stop func())
- type API
- func (api *API) AddStickerToSet(params *AddStickerToSetParams) error
- func (api *API) AnswerCallbackQuery(params *AnswerCallbackQueryParams) error
- func (api *API) AnswerInlineQuery(params *AnswerInlineQueryParams) error
- func (api *API) AnswerPreCheckoutQuery(params *AnswerPreCheckoutQueryParams) error
- func (api *API) AnswerShippingQuery(params *AnswerShippingQueryParams) error
- func (api *API) AnswerWebAppQuery(params *AnswerWebAppQueryParams) (*SentWebAppMessage, error)
- func (api *API) ApproveChatJoinRequest(params *ApproveChatJoinRequestParams) error
- func (api *API) BanChatMember(params *BanChatMemberParams) error
- func (api *API) BanChatSenderChat(params *BanChatSenderChatParams) error
- func (api *API) Close() error
- func (api *API) CopyMessage(params *CopyMessageParams) (*MessageIDObject, error)
- func (api *API) CreateChatInviteLink(params *CreateChatInviteLinkParams) (*ChatInviteLink, error)
- func (api *API) CreateInvoiceLink(params *CreateInvoiceLinkParams) (string, error)
- func (api *API) CreateNewStickerSet(params *CreateNewStickerSetParams) error
- func (api *API) DeclineChatJoinRequest(params *DeclineChatJoinRequestParams) error
- func (api *API) DeleteChatPhoto(params *DeleteChatPhotoParams) error
- func (api *API) DeleteChatStickerSet(params *DeleteChatStickerSetParams) error
- func (api *API) DeleteMessage(params *DeleteMessageParams) error
- func (api *API) DeleteMyCommands(params *DeleteMyCommandsParams) error
- func (api *API) DeleteStickerFromSet(params *DeleteStickerFromSetParams) error
- func (api *API) DeleteWebhook(params *DeleteWebhookParams) error
- func (api *API) EditChatInviteLink(params *EditChatInviteLinkParams) (*ChatInviteLink, error)
- func (api *API) EditMessageCaption(params *EditMessageCaptionParams) (*Message, error)
- func (api *API) EditMessageLiveLocation(params *EditMessageLiveLocationParams) (*Message, error)
- func (api *API) EditMessageMedia(params *EditMessageMediaParams) (*Message, error)
- func (api *API) EditMessageReplyMarkup(params *EditMessageReplyMarkupParams) (*Message, error)
- func (api *API) EditMessageText(params *EditMessageTextParams) (*Message, error)
- func (api *API) ExportChatInviteLink(params *ExportChatInviteLinkParams) (string, error)
- func (api *API) ForwardMessage(params *ForwardMessageParams) (*Message, error)
- func (api *API) GetChat(params *GetChatParams) (*UserProfilePhotos, error)
- func (api *API) GetChatAdministrators(params *GetChatAdministratorsParams) ([]*ChatMember, error)
- func (api *API) GetChatMember(params *GetChatMemberParams) (*ChatMember, error)
- func (api *API) GetChatMemberCount(params *GetChatMemberCountParams) (int, error)
- func (api *API) GetChatMenuButton(params *GetChatMenuButtonParams) (*MenuButton, error)
- func (api *API) GetCustomEmojiStickers(params *GetCustomEmojiStickersParams) ([]*Sticker, error)
- func (api *API) GetFile(params *GetFileParams) (*File, error)
- func (api *API) GetGameHighScores(params *GetGameHighScoresParams) ([]*GameHighScore, error)
- func (api *API) GetMe() (*User, error)
- func (api *API) GetMyCommands(params *GetMyCommandsParams) ([]*BotCommand, error)
- func (api *API) GetMyDefaultAdministratorRights(params *GetMyDefaultAdministratorRightsParams) (*ChatAdministratorRights, error)
- func (api *API) GetStickerSet(params *GetStickerSetParams) (*StickerSet, error)
- func (api *API) GetUpdates(params *GetUpdatesParams) ([]*Update, error)
- func (api *API) GetUserProfilePhotos(params *GetUserProfilePhotosParams) (*UserProfilePhotos, error)
- func (api *API) GetWebhookInfo() (*WebhookInfo, error)
- func (api *API) LeaveChat(params *LeaveChatParams) error
- func (api *API) LogOut() error
- func (api *API) PinChatMessage(params *PinChatMessageParams) error
- func (api *API) PromoteChatMember(params *PromoteChatMemberParams) error
- func (api *API) RestrictChatMember(params *RestrictChatMemberParams) error
- func (api *API) RevokeChatInviteLink(params *RevokeChatInviteLinkParams) (*ChatInviteLink, error)
- func (api *API) SendAnimation(params *SendAnimationParams) (*Message, error)
- func (api *API) SendAudio(params *SendAudioParams) (*Message, error)
- func (api *API) SendChatAction(params *SendChatActionParams) error
- func (api *API) SendContact(params *SendContactParams) (*Message, error)
- func (api *API) SendDice(params *SendDiceParams) (*Message, error)
- func (api *API) SendDocument(params *SendDocumentParams) (*Message, error)
- func (api *API) SendGame(params *SendGameParams) (*Message, error)
- func (api *API) SendInvoice(params *SendInvoiceParams) (*Message, error)
- func (api *API) SendLocation(params *SendLocationParams) (*Message, error)
- func (api *API) SendMediaGroup(params *SendMediaGroupParams) ([]*Message, error)
- func (api *API) SendMessage(params *SendMessageParams) (*Message, error)
- func (api *API) SendPhoto(params *SendPhotoParams) (*Message, error)
- func (api *API) SendPoll(params *SendPollParams) (*Message, error)
- func (api *API) SendSticker(params *SendStickerParams) (*Message, error)
- func (api *API) SendVenue(params *SendVenueParams) (*Message, error)
- func (api *API) SendVideo(params *SendVideoParams) (*Message, error)
- func (api *API) SendVideoNote(params *SendVideoNoteParams) (*Message, error)
- func (api *API) SendVoice(params *SendVoiceParams) (*Message, error)
- func (api *API) SetChatAdministratorCustomTitle(params *SetChatAdministratorCustomTitleParams) error
- func (api *API) SetChatDescription(params *SetChatDescriptionParams) error
- func (api *API) SetChatMenuButton(params *SetChatMenuButtonParams) error
- func (api *API) SetChatPermissions(params *SetChatPermissionsParams) error
- func (api *API) SetChatPhoto(params *SetChatPhotoParams) error
- func (api *API) SetChatStickerSet(params *SetChatStickerSetParams) error
- func (api *API) SetChatTitle(params *SetChatTitleParams) error
- func (api *API) SetGameScore(params *SetGameScoreParams) (*Message, error)
- func (api *API) SetMyCommands(params *SetMyCommandsParams) error
- func (api *API) SetMyDefaultAdministratorRights(params *SetMyDefaultAdministratorRightsParams) error
- func (api *API) SetPassportDataErrors(params *SetPassportDataErrorsParams) error
- func (api *API) SetStickerPositionInSet(params *SetStickerPositionInSetParams) error
- func (api *API) SetStickerSetThumb(params *SetStickerSetThumbParams) error
- func (api *API) SetWebhook(params *SetWebhookParams) error
- func (api *API) StopMessageLiveLocation(params *StopMessageLiveLocationParams) (*Message, error)
- func (api *API) StopPoll(params *StopPollParams) (*Poll, error)
- func (api *API) UnbanChatMember(params *UnbanChatMemberParams) error
- func (api *API) UnbanChatSenderChat(params *UnbanChatSenderChatParams) error
- func (api *API) UnpinAllChatMessages(params *UnpinAllChatMessagesParams) error
- func (api *API) UnpinChatMessage(params *UnpinChatMessageParams) error
- func (api *API) UploadStickerFile(params *UploadStickerFileParams) (*File, error)
- type AddStickerToSetParams
- type Animation
- type AnswerCallbackQueryParams
- type AnswerInlineQueryParams
- type AnswerPreCheckoutQueryParams
- type AnswerShippingQueryParams
- type AnswerWebAppQueryParams
- type ApproveChatJoinRequestParams
- type Audio
- type BanChatMemberParams
- type BanChatSenderChatParams
- type BotCommand
- type BotCommandScope
- type BotCommandScopeType
- type CallbackGame
- type CallbackQuery
- type CallbackQueryID
- type Chat
- type ChatAction
- type ChatAdministratorRights
- type ChatID
- type ChatIDOrUsername
- type ChatInstance
- type ChatInviteLink
- type ChatJoinRequest
- type ChatLocation
- type ChatMember
- type ChatMemberStatus
- type ChatMemberUpdated
- type ChatPermissions
- type ChatPhoto
- type ChatType
- type ChosenInlineResult
- type Contact
- type CopyMessageParams
- type CreateChatInviteLinkParams
- type CreateInvoiceLinkParams
- type CreateNewStickerSetParams
- type CustomEmojiID
- type DeclineChatJoinRequestParams
- type DeleteChatPhotoParams
- type DeleteChatStickerSetParams
- type DeleteMessageParams
- type DeleteMyCommandsParams
- type DeleteStickerFromSetParams
- type DeleteWebhookParams
- type Dice
- type DiceEmoji
- type Document
- type EditChatInviteLinkParams
- type EditMessageCaptionParams
- type EditMessageLiveLocationParams
- type EditMessageMediaParams
- type EditMessageReplyMarkupParams
- type EditMessageTextParams
- type EncryptedCredentials
- type EncryptedPassportElement
- type ExportChatInviteLinkParams
- type File
- type FileID
- type FileReader
- type FileURL
- type FileUniqueID
- type ForceReply
- type ForwardMessageParams
- type Game
- type GameHighScore
- type GameShortName
- type GetChatAdministratorsParams
- type GetChatMemberCountParams
- type GetChatMemberParams
- type GetChatMenuButtonParams
- type GetChatParams
- type GetCustomEmojiStickersParams
- type GetFileParams
- type GetGameHighScoresParams
- type GetMyCommandsParams
- type GetMyDefaultAdministratorRightsParams
- type GetStickerSetParams
- type GetUpdatesParams
- type GetUserProfilePhotosParams
- type InlineKeyboardButton
- type InlineKeyboardMarkup
- type InlineMessageID
- type InlineQuery
- type InlineQueryChatType
- type InlineQueryID
- type InlineQueryResult
- type InlineQueryResultID
- type InlineQueryResultType
- type InputFile
- type InputMedia
- type InputMediaType
- type InputMessageContent
- type Invoice
- type KeyboardButton
- type KeyboardButtonPollType
- type LabeledPrice
- type LanguageCode
- type LeaveChatParams
- type Location
- type LoginURL
- type MaskPosition
- type MaskPositionPoint
- type MenuButton
- type MenuButtonType
- type Message
- type MessageAutoDeleteTimerChanged
- type MessageEntity
- type MessageEntityType
- type MessageID
- type MessageIDObject
- type OrderInfo
- type ParseMode
- type PassportData
- type PassportElementError
- type PassportElementErrorSource
- type PassportElementType
- type PassportFile
- type PhotoSize
- type PinChatMessageParams
- type Poll
- type PollAnswer
- type PollID
- type PollOption
- type PollType
- type PreCheckoutQuery
- type PreCheckoutQueryID
- type PromoteChatMemberParams
- type ProximityAlertTriggered
- type ReplyKeyboardMarkup
- type ReplyKeyboardRemove
- type ReplyMarkup
- type Response
- type ResponseParameters
- type RestrictChatMemberParams
- type RevokeChatInviteLinkParams
- type SendAnimationParams
- type SendAudioParams
- type SendChatActionParams
- type SendContactParams
- type SendDiceParams
- type SendDocumentParams
- type SendGameParams
- type SendInvoiceParams
- type SendLocationParams
- type SendMediaGroupParams
- type SendMessageParams
- type SendPhotoParams
- type SendPollParams
- type SendStickerParams
- type SendVenueParams
- type SendVideoNoteParams
- type SendVideoParams
- type SendVoiceParams
- type SentWebAppMessage
- type SetChatAdministratorCustomTitleParams
- type SetChatDescriptionParams
- type SetChatMenuButtonParams
- type SetChatPermissionsParams
- type SetChatPhotoParams
- type SetChatStickerSetParams
- type SetChatTitleParams
- type SetGameScoreParams
- type SetMyCommandsParams
- type SetMyDefaultAdministratorRightsParams
- type SetPassportDataErrorsParams
- type SetStickerPositionInSetParams
- type SetStickerSetThumbParams
- type SetWebhookParams
- type ShippingAddress
- type ShippingOption
- type ShippingOptionID
- type ShippingQuery
- type ShippingQueryID
- type Sticker
- type StickerSet
- type StickerSetName
- type StickerType
- type StopMessageLiveLocationParams
- type StopPollParams
- type SuccessfulPayment
- type UnbanChatMemberParams
- type UnbanChatSenderChatParams
- type UnpinAllChatMessagesParams
- type UnpinChatMessageParams
- type Update
- type UpdateID
- type UpdateType
- type UploadStickerFileParams
- type User
- type UserID
- type UserProfilePhotos
- type Username
- type Venue
- type Video
- type VideoChatEnded
- type VideoChatParticipantsInvited
- type VideoChatScheduled
- type VideoChatStarted
- type VideoNote
- type Voice
- type WebAppData
- type WebAppInfo
- type WebAppQueryID
- type WebhookInfo
Constants ¶
const DefaultAPIEndpointURL = "https://api.telegram.org/bot"
URL of official Telegram Bot API endpoint
Variables ¶
This section is empty.
Functions ¶
func DefaultHttpDoRequest ¶
func DefaultHttpDoRequest(method string, url string, headers map[string]string, body []byte) (respBody []byte, err error)
Default function for performing http requests by API
func NewAPI ¶
Creates Telegram Bot API interface instance. If you want to customize http requests behavior or api endpoint url (e.x. use local instance), then instance API struct directly
func StartReceivingUpdates ¶ added in v1.0.1
Starts receiving all possible updates from Telegram
func StartReceivingUpdatesWithParams ¶ added in v1.0.1
func StartReceivingUpdatesWithParams(api *API, params GetUpdatesParams, receiver func(update *Update, err error)) (stop func())
Starts receiving updates from Telegram with custom parameters. You should not pass offset field in params.
Types ¶
type API ¶
type API struct { Token string EndpointURL string HttpDoRequest func(method string, url string, headers map[string]string, body []byte) (respBody []byte, err error) }
Main object in this library, for performing Telegram Bot API requests
func (*API) AddStickerToSet ¶
func (api *API) AddStickerToSet(params *AddStickerToSetParams) error
Use this method to add a new sticker to a set created by the bot. You *must* use exactly one of the fields png_sticker, tgs_sticker, or webm_sticker. Animated stickers can be added to animated sticker sets and only to them. Animated sticker sets can have up to 50 stickers. Static sticker sets can have up to 120 stickers. Returns True on success.
func (*API) AnswerCallbackQuery ¶
func (api *API) AnswerCallbackQuery(params *AnswerCallbackQueryParams) error
Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned. https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
Alternatively, the user can be redirected to the specified Game URL. For this option to work, you must first create a game for your bot via @Botfather and accept the terms. Otherwise, you may use links like `t.me/your_bot?start=XXXX` that open your bot with a parameter. https://t.me/botfather
func (*API) AnswerInlineQuery ¶
func (api *API) AnswerInlineQuery(params *AnswerInlineQueryParams) error
Use this method to send answers to an inline query. On success, True is returned. No more than *50* results per query are allowed.
func (*API) AnswerPreCheckoutQuery ¶
func (api *API) AnswerPreCheckoutQuery(params *AnswerPreCheckoutQueryParams) error
Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query. Use this method to respond to such pre-checkout queries. On success, True is returned. *Note*: The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent. https://core.telegram.org/bots/api#update
func (*API) AnswerShippingQuery ¶
func (api *API) AnswerShippingQuery(params *AnswerShippingQueryParams) error
If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot. Use this method to reply to shipping queries. On success, True is returned. https://core.telegram.org/bots/api#update
func (*API) AnswerWebAppQuery ¶
func (api *API) AnswerWebAppQuery(params *AnswerWebAppQueryParams) (*SentWebAppMessage, error)
Use this method 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. On success, a SentWebAppMessage object is returned. https://core.telegram.org/bots/webapps https://core.telegram.org/bots/api#sentwebappmessage
func (*API) ApproveChatJoinRequest ¶
func (api *API) ApproveChatJoinRequest(params *ApproveChatJoinRequestParams) error
Use this method to approve a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right. Returns True on success.
func (*API) BanChatMember ¶
func (api *API) BanChatMember(params *BanChatMemberParams) error
Use this method to ban a user in a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success. https://core.telegram.org/bots/api#unbanchatmember
func (*API) BanChatSenderChat ¶
func (api *API) BanChatSenderChat(params *BanChatSenderChatParams) error
Use this method to ban a channel chat in a supergroup or a channel. Until the chat is unbanned, the owner of the banned chat won't be able to send messages on behalf of any of their channels. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights. Returns True on success. https://core.telegram.org/bots/api#unbanchatsenderchat
func (*API) Close ¶
Use this method to close the bot instance before moving it from one local server to another. You need to delete the webhook before calling this method to ensure that the bot isn't launched again after server restart. The method will return error 429 in the first 10 minutes after the bot is launched. Returns True on success. Requires no parameters.
func (*API) CopyMessage ¶
func (api *API) CopyMessage(params *CopyMessageParams) (*MessageIDObject, error)
Use this method to copy messages of any kind. Service messages and invoice messages can't be copied. 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. https://core.telegram.org/bots/api#forwardmessage https://core.telegram.org/bots/api#messageid
func (*API) CreateChatInviteLink ¶
func (api *API) CreateChatInviteLink(params *CreateChatInviteLinkParams) (*ChatInviteLink, error)
Use this method 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 administrator rights. The link can be revoked using the method revokeChatInviteLink. Returns the new invite link as ChatInviteLink object. https://core.telegram.org/bots/api#revokechatinvitelink https://core.telegram.org/bots/api#chatinvitelink
func (*API) CreateInvoiceLink ¶
func (api *API) CreateInvoiceLink(params *CreateInvoiceLinkParams) (string, error)
Use this method to create a link for an invoice. Returns the created invoice link as String on success.
func (*API) CreateNewStickerSet ¶
func (api *API) CreateNewStickerSet(params *CreateNewStickerSetParams) error
Use this method to create a new sticker set owned by a user. The bot will be able to edit the sticker set thus created. You must use exactly one of the fields png_sticker, tgs_sticker, or webm_sticker. Returns True on success.
func (*API) DeclineChatJoinRequest ¶
func (api *API) DeclineChatJoinRequest(params *DeclineChatJoinRequestParams) error
Use this method to decline a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right. Returns True on success.
func (*API) DeleteChatPhoto ¶
func (api *API) DeleteChatPhoto(params *DeleteChatPhotoParams) error
Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.
func (*API) DeleteChatStickerSet ¶
func (api *API) DeleteChatStickerSet(params *DeleteChatStickerSetParams) error
Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success. https://core.telegram.org/bots/api#getchat
func (*API) DeleteMessage ¶
func (api *API) DeleteMessage(params *DeleteMessageParams) error
Use this method to delete a message, including service messages, with the following limitations:
- A message can only be deleted if it was sent less than 48 hours ago.
- A dice message in a private chat can only be deleted if it was sent more than 24 hours ago.
- Bots can delete outgoing messages in private chats, groups, and supergroups.
- Bots can delete incoming messages in private chats.
- Bots granted can_post_messages permissions can delete outgoing messages in channels.
- If the bot is an administrator of a group, it can delete any message there.
- If the bot has can_delete_messages permission in a supergroup or a channel, it can delete any message there.
Returns True on success.
func (*API) DeleteMyCommands ¶
func (api *API) DeleteMyCommands(params *DeleteMyCommandsParams) error
Use this method to delete the list of the bot's commands for the given scope and user language. After deletion, higher level commands will be shown to affected users. Returns True on success. https://core.telegram.org/bots/api#determining-list-of-commands
func (*API) DeleteStickerFromSet ¶
func (api *API) DeleteStickerFromSet(params *DeleteStickerFromSetParams) error
Use this method to delete a sticker from a set created by the bot. Returns True on success.
func (*API) DeleteWebhook ¶
func (api *API) DeleteWebhook(params *DeleteWebhookParams) error
Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success. https://core.telegram.org/bots/api#getupdates
func (*API) EditChatInviteLink ¶
func (api *API) EditChatInviteLink(params *EditChatInviteLinkParams) (*ChatInviteLink, error)
Use this method 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 administrator rights. Returns the edited invite link as a ChatInviteLink object. https://core.telegram.org/bots/api#chatinvitelink
func (*API) EditMessageCaption ¶
func (api *API) EditMessageCaption(params *EditMessageCaptionParams) (*Message, error)
Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. https://core.telegram.org/bots/api#message
func (*API) EditMessageLiveLocation ¶
func (api *API) EditMessageLiveLocation(params *EditMessageLiveLocationParams) (*Message, error)
Use this method to edit live location messages. A location can be edited until its live_period expires or editing is explicitly disabled by a call to stopMessageLiveLocation. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. https://core.telegram.org/bots/api#stopmessagelivelocation https://core.telegram.org/bots/api#message
func (*API) EditMessageMedia ¶
func (api *API) EditMessageMedia(params *EditMessageMediaParams) (*Message, error)
Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. https://core.telegram.org/bots/api#message
func (*API) EditMessageReplyMarkup ¶
func (api *API) EditMessageReplyMarkup(params *EditMessageReplyMarkupParams) (*Message, error)
Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. https://core.telegram.org/bots/api#message
func (*API) EditMessageText ¶
func (api *API) EditMessageText(params *EditMessageTextParams) (*Message, error)
Use this method to edit text and game messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. https://core.telegram.org/bots/api#games https://core.telegram.org/bots/api#message
func (*API) ExportChatInviteLink ¶
func (api *API) ExportChatInviteLink(params *ExportChatInviteLinkParams) (string, error)
Use this method to generate a new primary invite link for a chat; any previously generated primary link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the new invite link as String on success.
Note: Each administrator in a chat generates their own invite links. Bots can't use invite links generated by other administrators. If you want your bot to work with invite links, it will need to generate its own link using exportChatInviteLink or by calling the getChat method. If your bot needs to generate a new primary invite link replacing its previous one, use exportChatInviteLink again. https://core.telegram.org/bots/api#exportchatinvitelink https://core.telegram.org/bots/api#getchat
func (*API) ForwardMessage ¶
func (api *API) ForwardMessage(params *ForwardMessageParams) (*Message, error)
Use this method to forward messages of any kind. Service messages can't be forwarded. On success, the sent Message is returned. https://core.telegram.org/bots/api#message
func (*API) GetChat ¶
func (api *API) GetChat(params *GetChatParams) (*UserProfilePhotos, error)
Use this method to get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.). Returns a Chat object on success. https://core.telegram.org/bots/api#chat
func (*API) GetChatAdministrators ¶
func (api *API) GetChatAdministrators(params *GetChatAdministratorsParams) ([]*ChatMember, error)
Use this method to get a list of administrators in a chat. On success, returns an Array of ChatMember objects that contains information about all chat administrators except other bots. If the chat is a group or a supergroup and no administrators were appointed, only the creator will be returned. https://core.telegram.org/bots/api#chatmember
func (*API) GetChatMember ¶
func (api *API) GetChatMember(params *GetChatMemberParams) (*ChatMember, error)
Use this method to get information about a member of a chat. Returns a ChatMember object on success.
func (*API) GetChatMemberCount ¶
func (api *API) GetChatMemberCount(params *GetChatMemberCountParams) (int, error)
Use this method to get the number of members in a chat. Returns Int on success.
func (*API) GetChatMenuButton ¶
func (api *API) GetChatMenuButton(params *GetChatMenuButtonParams) (*MenuButton, error)
Use this method to get the current value of the bot's menu button in a private chat, or the default menu button. Returns MenuButton on success. https://core.telegram.org/bots/api#menubutton
func (*API) GetCustomEmojiStickers ¶ added in v1.2.0
func (api *API) GetCustomEmojiStickers(params *GetCustomEmojiStickersParams) ([]*Sticker, error)
Use this method to get information about custom emoji stickers by their identifiers. Returns an Array of Sticker objects. https://core.telegram.org/bots/api#sticker
func (*API) GetFile ¶
func (api *API) GetFile(params *GetFileParams) (*File, error)
Use this method to get basic information about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>, where <file_path> is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again. https://core.telegram.org/bots/api#file
Note: This function may not preserve the original file name and MIME type. You should save the file's MIME type and name (if available) when the File object is received.
func (*API) GetGameHighScores ¶
func (api *API) GetGameHighScores(params *GetGameHighScoresParams) ([]*GameHighScore, error)
Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game. On success, returns an Array of GameHighScore objects. https://core.telegram.org/bots/api#gamehighscore
This method will currently return scores for the target user, plus two of their closest neighbors on each side. Will also return the top three users if the user and his neighbors are not among them. Please note that this behavior is subject to change.
func (*API) GetMe ¶
A simple method for testing your bot's authentication token. Requires no parameters. Returns basic information about the bot in form of a User object. https://core.telegram.org/bots/api#user
func (*API) GetMyCommands ¶
func (api *API) GetMyCommands(params *GetMyCommandsParams) ([]*BotCommand, error)
Use this method to get the current list of the bot's commands for the given scope and user language. Returns Array of BotCommand on success. If commands aren't set, an empty list is returned. https://core.telegram.org/bots/api#botcommand
func (*API) GetMyDefaultAdministratorRights ¶
func (api *API) GetMyDefaultAdministratorRights(params *GetMyDefaultAdministratorRightsParams) (*ChatAdministratorRights, error)
Use this method to get the current default administrator rights of the bot. Returns ChatAdministratorRights on success. https://core.telegram.org/bots/api#chatadministratorrights
https://core.telegram.org/bots/api#getmydefaultadministratorrights
func (*API) GetStickerSet ¶
func (api *API) GetStickerSet(params *GetStickerSetParams) (*StickerSet, error)
Use this method to get a sticker set. On success, a StickerSet object is returned. https://core.telegram.org/bots/api#stickerset
func (*API) GetUpdates ¶
func (api *API) GetUpdates(params *GetUpdatesParams) ([]*Update, error)
Use this method to receive incoming updates using long polling (wiki). An Array of Update objects is returned. https://en.wikipedia.org/wiki/Push_technology#Long_polling https://core.telegram.org/bots/api#update
Notes
- This method will not work if an outgoing webhook is set up.
- In order to avoid getting duplicate updates, recalculate offset after each server response.
func (*API) GetUserProfilePhotos ¶
func (api *API) GetUserProfilePhotos(params *GetUserProfilePhotosParams) (*UserProfilePhotos, error)
Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object. https://core.telegram.org/bots/api#userprofilephotos
func (*API) GetWebhookInfo ¶
func (api *API) GetWebhookInfo() (*WebhookInfo, error)
Use this method to get current webhook status. Requires no parameters. On success, returns a WebhookInfo object. If the bot is using getUpdates, will return an object with the url field empty. https://core.telegram.org/bots/api#webhookinfo https://core.telegram.org/bots/api#getupdates
func (*API) LeaveChat ¶
func (api *API) LeaveChat(params *LeaveChatParams) error
Use this method for your bot to leave a group, supergroup or channel. Returns True on success.
func (*API) LogOut ¶
Use this method to log out from the cloud Bot API server before launching the bot locally. You must log out the bot before running it locally, otherwise there is no guarantee that the bot will receive updates. After a successful call, you can immediately log in on a local server, but will not be able to log in back to the cloud Bot API server for 10 minutes. Returns True on success. Requires no parameters.
func (*API) PinChatMessage ¶
func (api *API) PinChatMessage(params *PinChatMessageParams) error
Use this method to add a message to the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns True on success.
func (*API) PromoteChatMember ¶
func (api *API) PromoteChatMember(params *PromoteChatMemberParams) error
Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Pass False for all boolean parameters to demote a user. Returns True on success.
func (*API) RestrictChatMember ¶
func (api *API) RestrictChatMember(params *RestrictChatMemberParams) error
Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate administrator rights. Pass True for all permissions to lift restrictions from a user. Returns True on success.
func (*API) RevokeChatInviteLink ¶
func (api *API) RevokeChatInviteLink(params *RevokeChatInviteLinkParams) (*ChatInviteLink, error)
Use this method 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 administrator rights. Returns the revoked invite link as ChatInviteLink object. https://core.telegram.org/bots/api#chatinvitelink
func (*API) SendAnimation ¶
func (api *API) SendAnimation(params *SendAnimationParams) (*Message, error)
Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent Message is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future. https://core.telegram.org/bots/api#message
func (*API) SendAudio ¶
func (api *API) SendAudio(params *SendAudioParams) (*Message, error)
Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future.
For sending voice messages, use the sendVoice method instead. https://core.telegram.org/bots/api#sendvoice https://core.telegram.org/bots/api#message
func (*API) SendChatAction ¶
func (api *API) SendChatAction(params *SendChatActionParams) error
Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns True on success.
Example: The ImageBot needs some time to process a request and upload the image. Instead of sending a text message along the lines of “Retrieving image, please wait…”, the bot may use sendChatAction with action = upload_photo. The user will see a “sending photo” status for the bot. https://t.me/imagebot https://core.telegram.org/bots/api#sendchataction
We only recommend using this method when a response from the bot will take a *noticeable* amount of time to arrive.
func (*API) SendContact ¶
func (api *API) SendContact(params *SendContactParams) (*Message, error)
Use this method to send phone contacts. On success, the sent Message is returned. https://core.telegram.org/bots/api#message
func (*API) SendDice ¶
func (api *API) SendDice(params *SendDiceParams) (*Message, error)
Use this method to send an animated emoji that will display a random value. On success, the sent Message is returned. https://core.telegram.org/bots/api#message
func (*API) SendDocument ¶
func (api *API) SendDocument(params *SendDocumentParams) (*Message, error)
Use this method to send general files. On success, the sent Message is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future. https://core.telegram.org/bots/api#message
func (*API) SendGame ¶
func (api *API) SendGame(params *SendGameParams) (*Message, error)
Use this method to send a game. On success, the sent Message is returned. https://core.telegram.org/bots/api#message
func (*API) SendInvoice ¶
func (api *API) SendInvoice(params *SendInvoiceParams) (*Message, error)
Use this method to send invoices. On success, the sent Message is returned. https://core.telegram.org/bots/api#message
func (*API) SendLocation ¶
func (api *API) SendLocation(params *SendLocationParams) (*Message, error)
Use this method to send point on the map. On success, the sent Message is returned. https://core.telegram.org/bots/api#message
func (*API) SendMediaGroup ¶
func (api *API) SendMediaGroup(params *SendMediaGroupParams) ([]*Message, error)
Use this method to send a group of photos, videos, documents or audios as an album. Documents and audio files can be only grouped in an album with messages of the same type. On success, an array of Messages that were sent is returned. https://core.telegram.org/bots/api#message
func (*API) SendMessage ¶
func (api *API) SendMessage(params *SendMessageParams) (*Message, error)
Use this method to send text messages. On success, the sent Message is returned. https://core.telegram.org/bots/api#message
func (*API) SendPhoto ¶
func (api *API) SendPhoto(params *SendPhotoParams) (*Message, error)
Use this method to send photos. On success, the sent Message is returned. https://core.telegram.org/bots/api#message
func (*API) SendPoll ¶
func (api *API) SendPoll(params *SendPollParams) (*Message, error)
Use this method to send a native poll. On success, the sent Message is returned. https://core.telegram.org/bots/api#message
func (*API) SendSticker ¶
func (api *API) SendSticker(params *SendStickerParams) (*Message, error)
Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers. On success, the sent Message is returned. https://telegram.org/blog/animated-stickers https://telegram.org/blog/video-stickers-better-reactions https://core.telegram.org/bots/api#message
func (*API) SendVenue ¶
func (api *API) SendVenue(params *SendVenueParams) (*Message, error)
Use this method to send information about a venue. On success, the sent Message is returned. https://core.telegram.org/bots/api#message
func (*API) SendVideo ¶
func (api *API) SendVideo(params *SendVideoParams) (*Message, error)
Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document). On success, the sent Message is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future. https://core.telegram.org/bots/api#document https://core.telegram.org/bots/api#message
func (*API) SendVideoNote ¶
func (api *API) SendVideoNote(params *SendVideoNoteParams) (*Message, error)
As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent Message is returned. https://telegram.org/blog/video-messages-and-telescope https://core.telegram.org/bots/api#message
func (*API) SendVoice ¶
func (api *API) SendVoice(params *SendVoiceParams) (*Message, error)
Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future. https://core.telegram.org/bots/api#audio https://core.telegram.org/bots/api#document https://core.telegram.org/bots/api#message
func (*API) SetChatAdministratorCustomTitle ¶
func (api *API) SetChatAdministratorCustomTitle(params *SetChatAdministratorCustomTitleParams) error
Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns True on success.
https://core.telegram.org/bots/api#setchatadministratorcustomtitle
func (*API) SetChatDescription ¶
func (api *API) SetChatDescription(params *SetChatDescriptionParams) error
Use this method to change the description of a group, a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.
func (*API) SetChatMenuButton ¶
func (api *API) SetChatMenuButton(params *SetChatMenuButtonParams) error
Use this method to change the bot's menu button in a private chat, or the default menu button. Returns True on success.
func (*API) SetChatPermissions ¶
func (api *API) SetChatPermissions(params *SetChatPermissionsParams) error
Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members administrator rights. Returns True on success.
func (*API) SetChatPhoto ¶
func (api *API) SetChatPhoto(params *SetChatPhotoParams) error
Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.
func (*API) SetChatStickerSet ¶
func (api *API) SetChatStickerSet(params *SetChatStickerSetParams) error
Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success. https://core.telegram.org/bots/api#getchat
func (*API) SetChatTitle ¶
func (api *API) SetChatTitle(params *SetChatTitleParams) error
Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.
func (*API) SetGameScore ¶
func (api *API) SetGameScore(params *SetGameScoreParams) (*Message, error)
Use this method to set the score of the specified user in a game message. On success, if the message is not an inline message, the Message is returned, otherwise True is returned. Returns an error, if the new score is not greater than the user's current score in the chat and force is False. https://core.telegram.org/bots/api#message
func (*API) SetMyCommands ¶
func (api *API) SetMyCommands(params *SetMyCommandsParams) error
Use this method to change the list of the bot's commands. See https://core.telegram.org/bots#commands for more details about bot commands. Returns True on success.
func (*API) SetMyDefaultAdministratorRights ¶
func (api *API) SetMyDefaultAdministratorRights(params *SetMyDefaultAdministratorRightsParams) error
Use this method to change the default administrator rights requested by the bot when it's added as an administrator to groups or channels. These rights will be suggested to users, but they are are free to modify the list before adding the bot. Returns True on success.
https://core.telegram.org/bots/api#setmydefaultadministratorrights
func (*API) SetPassportDataErrors ¶
func (api *API) SetPassportDataErrors(params *SetPassportDataErrorsParams) error
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). Returns True on success.
Use this if the data submitted by the user doesn't satisfy the standards your service requires for any reason. For example, if a birthday date seems invalid, a submitted document is blurry, a scan shows evidence of tampering, etc. Supply some details in the error message to make sure the user knows how to correct the issues.
func (*API) SetStickerPositionInSet ¶
func (api *API) SetStickerPositionInSet(params *SetStickerPositionInSetParams) error
Use this method to move a sticker in a set created by the bot to a specific position. Returns True on success.
func (*API) SetStickerSetThumb ¶
func (api *API) SetStickerSetThumb(params *SetStickerSetThumbParams) error
Use this method to set the thumbnail of a sticker set. Animated thumbnails can be set for animated sticker sets only. Video thumbnails can be set only for video sticker sets only. Returns True on success.
func (*API) SetWebhook ¶
func (api *API) SetWebhook(params *SetWebhookParams) error
Use this method to specify a url and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns True on success. https://core.telegram.org/bots/api#update
If you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter secret_token. If specified, the request will contain a header “X-Telegram-Bot-Api-Secret-Token” with the secret token as content.
Notes
- You will not be able to receive updates using getUpdates for as long as an outgoing webhook is set up.
- To use a self-signed certificate, you need to upload your public key certificate using certificate parameter. Please upload as InputFile, sending a String will not work.
- Ports currently supported for webhooks: 443, 80, 88, 8443.
https://core.telegram.org/bots/api#getupdates https://core.telegram.org/bots/self-signed
If you're having any trouble setting up webhooks, please check out this amazing guide to webhooks. https://core.telegram.org/bots/webhooks
func (*API) StopMessageLiveLocation ¶
func (api *API) StopMessageLiveLocation(params *StopMessageLiveLocationParams) (*Message, error)
Use this method to stop updating a live location message before live_period expires. On success, if the message is not an inline message, the edited Message is returned, otherwise True is returned. https://core.telegram.org/bots/api#message
func (*API) StopPoll ¶
func (api *API) StopPoll(params *StopPollParams) (*Poll, error)
Use this method to stop a poll which was sent by the bot. On success, the stopped Poll is returned. https://core.telegram.org/bots/api#poll
func (*API) UnbanChatMember ¶
func (api *API) UnbanChatMember(params *UnbanChatMemberParams) error
Use this method to unban a previously banned user in a supergroup or channel. The user will not return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. By default, this method guarantees that after the call the user is not a member of the chat, but will be able to join it. So if the user is a member of the chat they will also be removed from the chat. If you don't want this, use the parameter only_if_banned. Returns True on success. https://core.telegram.org/bots/api#unbanchatmember
func (*API) UnbanChatSenderChat ¶
func (api *API) UnbanChatSenderChat(params *UnbanChatSenderChatParams) error
Use this method to unban 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. Returns True on success.
func (*API) UnpinAllChatMessages ¶
func (api *API) UnpinAllChatMessages(params *UnpinAllChatMessagesParams) error
Use this method to clear the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns True on success.
func (*API) UnpinChatMessage ¶
func (api *API) UnpinChatMessage(params *UnpinChatMessageParams) error
Use this method to remove a message from the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns True on success.
func (*API) UploadStickerFile ¶
func (api *API) UploadStickerFile(params *UploadStickerFileParams) (*File, error)
Use this method to upload a .PNG file with a sticker for later use in createNewStickerSet and addStickerToSet methods (can be used multiple times). Returns the uploaded File on success. https://core.telegram.org/bots/api#file
type AddStickerToSetParams ¶
type AddStickerToSetParams struct { // User identifier of sticker set owner UserID UserID `json:"user_id"` // Sticker set name Name StickerSetName `json:"name"` // Optional. *PNG* image with the sticker, must be up to 512 kilobytes in // size, dimensions must not exceed 512px, and either width or height must // be exactly 512px. Pass a file_id as a String to send a file that already // exists on the Telegram servers, pass an HTTP URL as a String for Telegram // to get a file from the Internet, or upload a new one using // multipart/form-data. More info on Sending Files » // https://core.telegram.org/bots/api#sending-files PNGSticker InputFile `json:"png_sticker,omitempty"` // Optional. *TGS* animation with the sticker, uploaded using // multipart/form-data. See // https://core.telegram.org/stickers#animated-sticker-requirements for // technical requirements TGSSticker InputFile `json:"tgs_sticker,omitempty"` // Optional. *WEBM* video with the sticker, uploaded using // multipart/form-data. See // https://core.telegram.org/stickers#video-sticker-requirements for // technical requirements WEBMSticker InputFile `json:"webm_sticker,omitempty"` // One or more emoji corresponding to the sticker Emojis string `json:"emojis"` // Optional. A JSON-serialized object for position where the mask should be // placed on faces MaskPosition *MaskPosition `json:"mask_position,omitempty"` }
type Animation ¶
type Animation struct { // Identifier for this file, which can be used to download or reuse the file FileID FileID `json:"file_id"` // 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 FileUniqueID `json:"file_unique_id"` // Video width as defined by sender Width int `json:"width"` // Video height as defined by sender Height int `json:"height"` // Duration of the video in seconds as defined by sender Duration int `json:"duration"` // Optional. Animation thumbnail as defined by sender Thumb *PhotoSize `json:"thumb,omitempty"` // Optional. Original animation filename as defined by sender FileName string `json:"file_name,omitempty"` // Optional. MIME type of the file as defined by sender MimeType string `json:"mime_type,omitempty"` // Optional. File size in bytes FileSize int64 `json:"file_size,omitempty"` }
This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound).
type AnswerCallbackQueryParams ¶
type AnswerCallbackQueryParams struct { // Unique identifier for the query to be answered CallbackQueryID CallbackQueryID `json:"callback_query_id"` // Optional. Text of the notification. If not specified, nothing will be // shown to the user, 0-200 characters Text string `json:"text,omitempty"` // Optional. If True, an alert will be shown by the client instead of a // notification at the top of the chat screen. Defaults to false. ShowAlert bool `json:"show_alert,omitempty"` // Optional. URL that will be opened by the user's client. If you have // created a Game and accepted the conditions via @Botfather, specify the // URL that opens your game — note that this will only work if the query // comes from a callback_game button. // https://core.telegram.org/bots/api#game https://t.me/botfather // https://core.telegram.org/bots/api#inlinekeyboardbutton // // Otherwise, you may use links like t.me/your_bot?start=XXXX that open your // bot with a parameter. URL string `json:"url,omitempty"` // Optional. The maximum amount of time in seconds that the result of the // callback query may be cached client-side. Telegram apps will support // caching starting in version 3.14. Defaults to 0. CacheTime int `json:"cache_time,omitempty"` }
type AnswerInlineQueryParams ¶
type AnswerInlineQueryParams struct { // Unique identifier for the answered query InlineQueryID InlineQueryID `json:"inline_query_id"` // A JSON-serialized array of results for the inline query Results []*InlineQueryResult `json:"results"` // The maximum amount of time in seconds that the result of the inline query // may be cached on the server. Defaults to 300. CacheTime int `json:"cache_time,omitempty"` // Pass True, if results may be cached on the server side only for the user // that sent the query. By default, results may be returned to any user who // sends the same query IsPersonal bool `json:"is_personal,omitempty"` // Pass the offset that a client should send in the next query with the same // text to receive more results. Pass an empty string if there are no more // results or if you don't support pagination. Offset length can't exceed 64 // bytes. NextOffset string `json:"next_offset,omitempty"` // If passed, clients will display a button with specified text that // switches the user to a private chat with the bot and sends the bot a // start message with the parameter switch_pm_parameter SwitchPMText string `json:"switch_pm_text,omitempty"` // Deep-linking parameter for the /start message sent to the bot when user // presses the switch button. 1-64 characters, only `A-Z`, `a-z`, `0-9`, `_` // and `-` are allowed. https://core.telegram.org/bots#deep-linking // https://core.telegram.org/bots/api#inlinekeyboardmarkup SwitchPMParameter string `json:"switch_pm_parameter,omitempty"` }
type AnswerPreCheckoutQueryParams ¶
type AnswerPreCheckoutQueryParams struct { // Unique identifier for the query to be answered PreCheckoutQueryID PreCheckoutQueryID `json:"pre_checkout_query_id"` // Specify True if everything is alright (goods are available, etc.) and the // bot is ready to proceed with the order. Use False if there are any // problems. OK bool `json:"ok"` // Optional. Required if ok is False. Error message in human readable form // that explains the reason for failure to proceed with the checkout (e.g. // "Sorry, somebody just bought the last of our amazing black T-shirts while // you were busy filling out your payment details. Please choose a different // color or garment!"). Telegram will display this message to the user. ErrorMessage string `json:"error_message,omitempty"` }
type AnswerShippingQueryParams ¶
type AnswerShippingQueryParams struct { // Unique identifier for the query to be answered ShippingQueryID ShippingQueryID `json:"shipping_query_id"` // Specify True if delivery to the specified address is possible and False // if there are any problems (for example, if delivery to the specified // address is not possible) OK bool `json:"ok"` // Optional. Required if ok is True. A JSON-serialized array of available // shipping options. ShippingOptions []*ShippingOption `json:"shipping_options,omitempty"` // Optional. Required if ok is False. Error message in human readable form // that explains why it is impossible to complete the order (e.g. "Sorry, // delivery to your desired address is unavailable'). Telegram will display // this message to the user. ErrorMessage string `json:"error_message,omitempty"` }
type AnswerWebAppQueryParams ¶
type AnswerWebAppQueryParams struct { // Unique identifier for the query to be answered WebAppQueryID WebAppQueryID `json:"web_app_query_id"` // A JSON-serialized object describing the message to be sent Result *InlineQueryResult `json:"result"` }
type ApproveChatJoinRequestParams ¶
type ApproveChatJoinRequestParams struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // Unique identifier of the target user UserID UserID `json:"user_id"` }
type Audio ¶
type Audio struct { // Identifier for this file, which can be used to download or reuse the file FileID FileID `json:"file_id"` // 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 FileUniqueID `json:"file_unique_id"` // Duration of the audio in seconds as defined by sender Duration int `json:"duration"` // Optional. Performer of the audio as defined by sender or by audio tags Performer string `json:"performer,omitempty"` // Optional. Title of the audio as defined by sender or by audio tags Title string `json:"title,omitempty"` // Optional. Original filename as defined by sender FileName string `json:"file_name,omitempty"` // Optional. MIME type of the file as defined by sender MimeType string `json:"mime_type,omitempty"` // Optional. File size in bytes FileSize int64 `json:"file_size,omitempty"` // Optional. Thumbnail of the album cover to which the music file belongs Thumb *PhotoSize `json:"thumb,omitempty"` }
This object represents an audio file to be treated as music by the Telegram clients. https://core.telegram.org/bots/api#photosize https://core.telegram.org/bots/api#voice https://core.telegram.org/bots/api#audio
type BanChatMemberParams ¶
type BanChatMemberParams struct { // Unique identifier for the target group or username of the target // supergroup or channel (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // Unique identifier of the target user UserID UserID `json:"user_id"` // Optional. Date when the user will be unbanned, unix time. If user is // banned for more than 366 days or less than 30 seconds from the current // time they are considered to be banned forever. Applied for supergroups // and channels only. UntilDate int64 `json:"until_date,omitempty"` // Optional. Pass True to delete all messages from the chat for the user // that is being removed. If False, the user will be able to see messages in // the group that were sent before the user was removed. Always True for // supergroups and channels. RevokeMessages bool `json:"revoke_messages,omitempty"` }
type BanChatSenderChatParams ¶
type BanChatSenderChatParams struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // Unique identifier of the target sender chat SenderChatID ChatID `json:"sender_chat_id"` }
type BotCommand ¶
type BotCommand struct { // Text of the command; 1-32 characters. Can contain only lowercase English // letters, digits and underscores. Command string `json:"command"` // Description of the command; 1-256 characters. Description string `json:"description"` }
This object represents a bot command.
type BotCommandScope ¶
type BotCommandScope struct { // Scope type // BotCommandScopeDefault - must be default // BotCommandScopeAllPrivateChats - must be all_private_chats // BotCommandScopeAllGroupChats - must be all_group_chats // BotCommandScopeAllChatAdministrators - must be all_chat_administrators // BotCommandScopeChat - must be chat // BotCommandScopeChatAdministrators - must be chat_administrators // BotCommandScopeChatMember - must be chat_member Type BotCommandScopeType `json:"type"` // Unique identifier for the target chat or username of the target // supergroup (in the format @supergroupusername) ChatID ChatIDOrUsername `json:"chat_id,omitempty"` // Unique identifier of the target user UserID UserID `json:"user_id,omitempty"` }
This object represents the scope to which bot commands are applied.
Currently, the following 7 scopes are supported:
BotCommandScopeDefault - Represents the default scope of bot commands. Default commands are used if no commands with a narrower scope are specified for the user. BotCommandScopeAllPrivateChats - Represents the scope of bot commands, covering all private chats. BotCommandScopeAllGroupChats - Represents the scope of bot commands, covering all group and supergroup chats. BotCommandScopeAllChatAdministrators - Represents the scope of bot commands, covering all group and supergroup chat administrators. BotCommandScopeChat - Represents the scope of bot commands, covering a specific chat. BotCommandScopeChatAdministrators - Represents the scope of bot commands, covering all administrators of a specific group or supergroup chat. BotCommandScopeChatMember - Represents the scope of bot commands, covering a specific member of a group or supergroup chat.
Determining list of commands ¶
The following algorithm is used to determine the list of commands for a particular user viewing the bot menu. The first list of commands which is set is returned: Commands in the chat with the bot:
botCommandScopeChat + language_code botCommandScopeChat botCommandScopeAllPrivateChats + language_code botCommandScopeAllPrivateChats botCommandScopeDefault + language_code botCommandScopeDefault
Commands in group and supergroup chats:
botCommandScopeChatMember + language_code botCommandScopeChatMember botCommandScopeChatAdministrators + language_code (administrators only) botCommandScopeChatAdministrators (administrators only) botCommandScopeChat + language_code botCommandScopeChat botCommandScopeAllChatAdministrators + language_code (administrators only) botCommandScopeAllChatAdministrators (administrators only) botCommandScopeAllGroupChats + language_code botCommandScopeAllGroupChats botCommandScopeDefault + language_code botCommandScopeDefault
https://core.telegram.org/bots/api#botcommandscope https://core.telegram.org/bots/api#botcommandscopedefault https://core.telegram.org/bots/api#botcommandscopeallprivatechats https://core.telegram.org/bots/api#botcommandscopeallgroupchats https://core.telegram.org/bots/api#botcommandscopeallchatadministrators https://core.telegram.org/bots/api#botcommandscopechat https://core.telegram.org/bots/api#botcommandscopechatadministrators https://core.telegram.org/bots/api#botcommandscopechatmember
type BotCommandScopeType ¶
type BotCommandScopeType string
const ( BotCommandScopeTypeDefault BotCommandScopeType = "default" BotCommandScopeTypeAllPrivateChats BotCommandScopeType = "all_private_chats" BotCommandScopeTypeAllGroupChats BotCommandScopeType = "all_group_chats" BotCommandScopeTypeAllChatAdministrators BotCommandScopeType = "all_chat_administrators" BotCommandScopeTypeChat BotCommandScopeType = "chat" BotCommandScopeTypeChatAdministrator BotCommandScopeType = "chat_administrators" BotCommandScopeTypeChatMember BotCommandScopeType = "chat_member" )
type CallbackGame ¶
type CallbackGame struct{}
A placeholder, currently holds no information. Use BotFather to set up your game. https://t.me/botfather
type CallbackQuery ¶
type CallbackQuery struct { // Unique identifier for this query ID CallbackQueryID `json:"id"` // Sender From *User `json:"from"` // Optional. Message with the callback button that originated the query. // Note that message content and message date will not be available if the // message is too old Message *Message `json:"message,omitempty"` // Optional. Identifier of the message sent via the bot in inline mode, that // originated the query. InlineMessageID InlineMessageID `json:"inline_message_id,omitempty"` // Global identifier, uniquely corresponding to the chat to which the // message with the callback button was sent. Useful for high scores in // games. https://core.telegram.org/bots/api#games ChatInstance ChatInstance `json:"chat_instance"` // Optional. Data associated with the callback button. Be aware that a bad // client can send arbitrary data in this field. Data string `json:"data,omitempty"` // Optional. Short name of a Game to be returned, serves as the unique // identifier for the game https://core.telegram.org/bots/api#games GameShortName GameShortName `json:"game_short_name,omitempty"` }
This object 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.
*NOTE*: After the user presses a callback button, Telegram clients will display a progress bar until you call answerCallbackQuery. It is, therefore, necessary to react by calling answerCallbackQuery even if no notification to the user is needed (e.g., without specifying any of the optional parameters). https://core.telegram.org/bots/api#answercallbackquery
type Chat ¶
type Chat struct { // Unique identifier for this chat. ID ChatID `json:"id"` // Type of chat, can be either “private”, “group”, “supergroup” or “channel” Type ChatType `json:"type"` // Optional. Title, for supergroups, channels and group chats Title string `json:"title,omitempty"` // Optional. Username, for private chats, supergroups and channels if // available Username Username `json:"username,omitempty"` // Optional. First name of the other party in a private chat FirstName string `json:"first_name,omitempty"` // Optional. Last name of the other party in a private chat LastName string `json:"last_name,omitempty"` // Optional. Chat photo. Returned only in getChat. // https://core.telegram.org/bots/api#getchat Photo *ChatPhoto `json:"photo,omitempty"` // Optional. Bio of the other party in a private chat. Returned only in // getChat. https://core.telegram.org/bots/api#getchat Bio string `json:"bio,omitempty"` // Optional. 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. Returned only in getChat. // https://core.telegram.org/bots/api#getchat HasPrivateForwards bool `json:"has_private_forwards,omitempty"` // Optional. True, if the privacy settings of the other party restrict // sending voice and video note messages in the private chat. Returned only // in getChat. https://core.telegram.org/bots/api#getchat HasRestrictedVoiceAndVideoMessages bool `json:"has_restricted_voice_and_video_messages,omitempty"` // Optional. True, if users need to join the supergroup before they can send // messages. Returned only in getChat. // https://core.telegram.org/bots/api#getchat JoinToSendMessages bool `json:"join_to_send_messages,omitempty"` // Optional. True, if all users directly joining the supergroup need to be // approved by supergroup administrators. Returned only in getChat. // https://core.telegram.org/bots/api#getchat JoinByRequest bool `json:"join_by_request,omitempty"` // Optional. Description, for groups, supergroups and channel chats. // Returned only in getChat. https://core.telegram.org/bots/api#getchat Description string `json:"description,omitempty"` // Optional. Primary invite link, for groups, supergroups and channel chats. // Returned only in getChat. https://core.telegram.org/bots/api#getchat InviteLink string `json:"invite_link,omitempty"` // Optional. The most recent pinned message (by sending date). Returned only // in getChat. https://core.telegram.org/bots/api#getchat PinnedMessage *Message `json:"pinned_message,omitempty"` // Optional. Default chat member permissions, for groups and supergroups. // Returned only in getChat. https://core.telegram.org/bots/api#getchat Permissions *ChatPermissions `json:"permissions,omitempty"` // Optional. For supergroups, the minimum allowed delay between consecutive // messages sent by each unpriviledged user; in seconds. Returned only in // getChat. https://core.telegram.org/bots/api#getchat SlowModeDelay int `json:"slow_mode_delay,omitempty"` // Optional. The time after which all messages sent to the chat will be // automatically deleted; in seconds. Returned only in getChat. // https://core.telegram.org/bots/api#getchat MessageAutoDeleteTime int `json:"message_auto_delete_time,omitempty"` // Optional. True, if messages from the chat can't be forwarded to other // chats. Returned only in getChat. // https://core.telegram.org/bots/api#getchat HasProtectedContent bool `json:"has_protected_content,omitempty"` // Optional. For supergroups, name of group sticker set. Returned only in // getChat. https://core.telegram.org/bots/api#getchat StickerSetName string `json:"sticker_set_name,omitempty"` // Optional. True, if the bot can change the group sticker set. Returned // only in getChat. https://core.telegram.org/bots/api#getchat CanSetStickerSet bool `json:"can_set_sticker_set,omitempty"` // Optional. Unique identifier for the linked chat, i.e. the discussion // group identifier for a channel and vice versa; for supergroups and // channel chats. Returned only in getChat. // https://core.telegram.org/bots/api#getchat LinkedChatID ChatID `json:"linked_chat_id,omitempty"` // Optional. For supergroups, the location to which the supergroup is // connected. Returned only in getChat. // https://core.telegram.org/bots/api#getchat Location *ChatLocation `json:"location,omitempty"` }
This object represents a chat.
type ChatAction ¶
type ChatAction string
const ( // https://core.telegram.org/bots/api#sendmessage ChatActionTyping ChatAction = "typing" // https://core.telegram.org/bots/api#sendphoto ChatActionUploadPhoto ChatAction = "upload_photo" // https://core.telegram.org/bots/api#sendvideo ChatActionRecordVideo ChatAction = "record_video" // https://core.telegram.org/bots/api#sendvideo ChatActionUploadVideo ChatAction = "upload_video" // https://core.telegram.org/bots/api#sendvoice ChatActionRecordVoice ChatAction = "record_voice" // https://core.telegram.org/bots/api#sendvoice ChatActionUploadVoice ChatAction = "upload_voice" // https://core.telegram.org/bots/api#senddocument ChatActionUploadDocument ChatAction = "upload_document" // https://core.telegram.org/bots/api#sendsticker ChatActionChooseSticker ChatAction = "choose_sticker" // https://core.telegram.org/bots/api#sendlocation ChatActionFindLocation ChatAction = "find_location" // https://core.telegram.org/bots/api#sendvideonote ChatActionRecordVideoNote ChatAction = "record_video_note" // https://core.telegram.org/bots/api#sendvideonote ChatActionUploadVideoNote ChatAction = "upload_video_note" )
type ChatAdministratorRights ¶
type ChatAdministratorRights struct { // True, if the user's presence in the chat is hidden IsAnonymous bool `json:"is_anonymous,omitempty"` // 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 CanManageChat bool `json:"can_manage_chat,omitempty"` // True, if the administrator can delete messages of other users CanDeleteMessages bool `json:"can_delete_messages,omitempty"` // True, if the administrator can manage video chats CanManageVideoChats bool `json:"can_manage_video_chats,omitempty"` // True, if the administrator can restrict, ban or unban chat members CanRestrictMembers bool `json:"can_restrict_members,omitempty"` // 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) CanPromoteMembers bool `json:"can_promote_members,omitempty"` // True, if the user is allowed to change the chat title, photo and other // settings CanChangeInfo bool `json:"can_change_info,omitempty"` // True, if the user is allowed to invite new users to the chat CanInviteUsers bool `json:"can_invite_users,omitempty"` // Optional. True, if the administrator can post in the channel; channels // only CanPostMessages bool `json:"can_post_messages,omitempty"` // Optional. True, if the administrator can edit messages of other users and // can pin messages; channels only CanEditMessages bool `json:"can_edit_messages,omitempty"` // Optional. True, if the user is allowed to pin messages; groups and // supergroups only CanPinMessages bool `json:"can_pin_messages,omitempty"` }
Represents the rights of an administrator in a chat.
type ChatIDOrUsername ¶
type ChatIDOrUsername interface {
// contains filtered or unexported methods
}
Literally ChatID or Username typed value
type ChatInstance ¶
type ChatInstance string
Global identifier, uniquely corresponding to the chat to which a message with the callback button was sent. Useful for high scores in games. https://core.telegram.org/bots/api#games
type ChatInviteLink ¶
type ChatInviteLink struct { // 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"` // True, if users joining the chat via the link need to be approved by chat // administrators CreatesJoinRequest bool `json:"creates_join_request"` // True, if the link is primary IsPrimary bool `json:"is_primary"` // True, if the link is revoked IsRevoked bool `json:"is_revoked"` // Optional. Invite link name Name string `json:"name,omitempty"` // Optional. Point in time (Unix timestamp) when the link will expire or has // been expired ExpireDate int64 `json:"expire_date,omitempty"` // Optional. Maximum number of users that can be members of the chat // simultaneously after joining the chat via this invite link; 1-99999 MemberLimit int `json:"member_limit,omitempty"` // Optional. Number of pending join requests created using this link PendingJoinRequestCount int `json:"pending_join_request_count,omitempty"` }
Represents an invite link for a chat.
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"` // Date the request was sent in Unix time Date int64 `json:"date"` // Optional. Bio of the user. Bio string `json:"bio,omitempty"` // Optional. Chat invite link that was used by the user to send the join // request InviteLink *ChatInviteLink `json:"invite_link,omitempty"` }
Represents a join request sent to a chat.
type ChatLocation ¶
type ChatLocation struct { // The location to which the supergroup is connected. Can't be a live // location. Location *Location `json:"location"` // Location address; 1-64 characters, as defined by the chat owner Address string `json:"address"` }
Represents a location to which a chat is connected.
type ChatMember ¶
type ChatMember struct { // The member's status in the chat // ChatMemberOwner - always "creator" // ChatMemberAdministrator - always "administrator" // ChatMemberMember - always "member" // ChatMemberRestricted - always "restricted" // ChatMemberLeft - always "left" // ChatMemberBanned - always "kicked" Status ChatMemberStatus `json:"status"` // Information about the user User *User `json:"user"` // True, if the user's presence in the chat is hidden IsAnonymous bool `json:"is_anonymous,omitempty"` // Optional. Custom title for this user CustomTitle string `json:"custom_title,omitempty"` // True, if the bot is allowed to edit administrator privileges of that user CanBeEdited bool `json:"can_be_edited,omitempty"` // 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 CanManageChat bool `json:"can_manage_chat,omitempty"` // True, if the administrator can delete messages of other users CanDeleteMessages bool `json:"can_delete_messages,omitempty"` // True, if the administrator can manage video chats CanManageVideoChats bool `json:"can_manage_video_chats,omitempty"` // True, if the administrator can restrict, ban or unban chat members CanRestrictMembers bool `json:"can_restrict_members,omitempty"` // 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) CanPromoteMembers bool `json:"can_promote_members,omitempty"` // Optional. True, if the administrator can post in the channel; channels // only CanPostMessages bool `json:"can_post_messages,omitempty"` // Optional. True, if the administrator can edit messages of other users and // can pin messages; channels only CanEditMessages bool `json:"can_edit_messages,omitempty"` // True, if the user is allowed to change the chat title, photo and other // settings CanChangeInfo bool `json:"can_change_info,omitempty"` // True, if the user is allowed to invite new users to the chat CanInviteUsers bool `json:"can_invite_users,omitempty"` // Optional. True, if the user is allowed to pin messages; groups and // supergroups only CanPinMessages bool `json:"can_pin_messages,omitempty"` // True, if the user is a member of the chat at the moment of the request IsMember bool `json:"is_member,omitempty"` // True, if the user is allowed to send text messages, contacts, locations // and venues CanSendMessages bool `json:"can_send_messages,omitempty"` // True, if the user is allowed to send audios, documents, photos, videos, // video notes and voice notes CanSendMediaMessages bool `json:"can_send_media_messages,omitempty"` // True, if the user is allowed to send polls CanSendPolls bool `json:"can_send_polls,omitempty"` // True, if the user is allowed to send animations, games, stickers and use // inline bots CanSendOtherMessages bool `json:"can_send_other_messages,omitempty"` // True, if the user is allowed to add web page previews to their messages CanAddWebPagePreviews bool `json:"can_add_web_page_previews,omitempty"` // Date when restrictions will be lifted for this user; unix time. If 0, // then the user is restricted forever UntilDate int64 `json:"until_date,omitempty"` }
This object contains information about one member of a chat. Currently, the following 6 types of chat members are supported:
ChatMemberOwner - Represents a chat member that owns the chat and has all administrator privileges. ChatMemberAdministrator - Represents a chat member that has some additional privileges. ChatMemberMember - Represents a chat member that has no additional privileges or restrictions. ChatMemberRestricted - Represents a chat member that is under certain restrictions in the chat. Supergroups only. ChatMemberLeft - Represents a chat member that isn't currently a member of the chat, but may join it themselves. ChatMemberBanned - Represents a chat member that was banned in the chat and can't return to the chat or view chat messages.
https://core.telegram.org/bots/api#chatmember https://core.telegram.org/bots/api#chatmemberowner https://core.telegram.org/bots/api#chatmemberadministrator https://core.telegram.org/bots/api#chatmembermember https://core.telegram.org/bots/api#chatmemberrestricted https://core.telegram.org/bots/api#chatmemberleft https://core.telegram.org/bots/api#chatmemberbanned
type ChatMemberStatus ¶
type ChatMemberStatus string
The member's status in a chat
const ( ChatMemberStatusCreator ChatMemberStatus = "creator" ChatMemberStatusAdministrator ChatMemberStatus = "administrator" ChatMemberStatusMember ChatMemberStatus = "member" ChatMemberStatusRestricted ChatMemberStatus = "restricted" ChatMemberStatusLeft ChatMemberStatus = "left" ChatMemberStatusKicked ChatMemberStatus = "kicked" )
type ChatMemberUpdated ¶
type ChatMemberUpdated struct { // Chat the user belongs to Chat *Chat `json:"chat"` // Performer of the action, which resulted in the change From *User `json:"from"` // Date the change was done in Unix time Date int64 `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"` // Optional. Chat invite link, which was used by the user to join the chat; // for joining by invite link events only. InviteLink *ChatInviteLink `json:"invite_link,omitempty"` }
This object represents changes in the status of a chat member.
type ChatPermissions ¶
type ChatPermissions struct { // Optional. True, if the user is allowed to send text messages, contacts, // locations and venues CanSendMessages bool `json:"can_send_messages,omitempty"` // Optional. True, if the user is allowed to send audios, documents, photos, // videos, video notes and voice notes, implies can_send_messages CanSendMediaMessages bool `json:"can_send_media_messages,omitempty"` // Optional. True, if the user is allowed to send polls, implies // can_send_messages CanSendPolls bool `json:"can_send_polls,omitempty"` // Optional. True, if the user is allowed to send animations, games, // stickers and use inline bots, implies can_send_media_messages CanSendOtherMessages bool `json:"can_send_other_messages,omitempty"` // Optional. True, if the user is allowed to add web page previews to their // messages, implies can_send_media_messages CanAddWebPagePreviews bool `json:"can_add_web_page_previews,omitempty"` // Optional. True, if the user is allowed to change the chat title, photo // and other settings. Ignored in public supergroups CanChangeInfo bool `json:"can_change_info,omitempty"` // Optional. True, if the user is allowed to invite new users to the chat CanInviteUsers bool `json:"can_invite_users,omitempty"` // Optional. True, if the user is allowed to pin messages. Ignored in public // supergroups CanPinMessages bool `json:"can_pin_messages,omitempty"` }
Describes actions that a non-administrator user is allowed to take in a chat.
type ChatPhoto ¶
type ChatPhoto struct { // 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 FileID `json:"small_file_id"` // 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 FileUniqueID `json:"small_file_unique_id"` // 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 FileID `json:"big_file_id"` // Unique 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 FileUniqueID `json:"big_file_unique_id"` }
This object represents a chat photo.
type ChatType ¶
type ChatType string
Type of the chat. Can be either “sender” for a private chat with the inline query sender, “private”, “group”, “supergroup”, or “channel”.
type ChosenInlineResult ¶
type ChosenInlineResult struct { // The unique identifier for the result that was chosen ResultID InlineQueryResultID `json:"result_id"` // The user that chose the result From *User `json:"from"` // Optional. Sender location, only for bots that require user location Location *Location `json:"location,omitempty"` // Optional. 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. // https://core.telegram.org/bots/api#inlinekeyboardmarkup // https://core.telegram.org/bots/api#callbackquery // https://core.telegram.org/bots/api#updating-messages InlineMessageID InlineMessageID `json:"inline_message_id,omitempty"` // The query that was used to obtain the result Query string `json:"query"` }
Represents a result of an inline query that was chosen by the user and sent to their chat partner. https://core.telegram.org/bots/api#inlinequeryresult
Note: It is necessary to enable inline feedback via @BotFather in order to receive these objects in updates. https://core.telegram.org/bots/inline#collecting-feedback https://t.me/botfather
type Contact ¶
type Contact struct { // Contact's phone number PhoneNumber string `json:"phone_number"` // Contact's first name FirstName string `json:"first_name"` // Optional. Contact's last name LastName string `json:"last_name,omitempty"` // Optional. Contact's user identifier in Telegram. UserID UserID `json:"user_id,omitempty"` // Optional. Additional data about the contact in the form of a vCard // https://en.wikipedia.org/wiki/VCard VCard string `json:"vcard,omitempty"` }
This object represents a phone contact.
type CopyMessageParams ¶
type CopyMessageParams struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // Unique identifier for the chat where the original message was sent (or // channel username in the format @channelusername) FromChatID ChatIDOrUsername `json:"from_chat_id"` // Message identifier in the chat specified in from_chat_id MessageID MessageID `json:"message_id"` // Optional. New caption for media, 0-1024 characters after entities // parsing. If not specified, the original caption is kept Caption string `json:"caption,omitempty"` // Optional. Mode for parsing entities in the new caption. See formatting // options for more details. // https://core.telegram.org/bots/api#formatting-options ParseMode ParseMode `json:"parse_mode,omitempty"` // Optional. A JSON-serialized list of special entities that appear in the // new caption, which can be specified instead of parse_mode CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"` // Optional. Sends the message silently. Users will receive a notification // with no sound. https://telegram.org/blog/channels-2-0#silent-messages DisableNotification bool `json:"disable_notification,omitempty"` // Optional. Protects the contents of the sent message from forwarding and // saving ProtectContent bool `json:"protect_content,omitempty"` // Optional. If the message is a reply, ID of the original message ReplyToMessageID bool `json:"reply_to_message_id,omitempty"` // Optional. Pass True, if the message should be sent even if the specified // replied-to message is not found AllowSendingWithoutReply bool `json:"allow_sending_without_reply,omitempty"` // Optional. Additional interface options. A JSON-serialized object for an // inline keyboard, custom reply keyboard, instructions to remove reply // keyboard or to force a reply from the user. // https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating // https://core.telegram.org/bots#keyboards ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"` }
type CreateChatInviteLinkParams ¶
type CreateChatInviteLinkParams struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // Optional. Invite link name; 0-32 characters Name string `json:"name,omitempty"` // Optional. Point in time (Unix timestamp) when the link will expire ExpireDate int64 `json:"expire_date,omitempty"` // Optional. Maximum number of users that can be members of the chat // simultaneously after joining the chat via this invite link; 1-99999 MemberLimit int `json:"member_limit,omitempty"` // Optional. True, if users joining the chat via the link need to be // approved by chat administrators. If True, member_limit can't be specified CreatesJoinRequest bool `json:"creates_join_request,omitempty"` }
type CreateInvoiceLinkParams ¶
type CreateInvoiceLinkParams 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"` // Payments provider token, obtained via Botfather https://t.me/botfather ProviderToken string `json:"provider_token"` // Three-letter ISO 4217 currency code, see more on currencies // https://core.telegram.org/bots/payments#supported-currencies 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"` // Optional. The maximum accepted amount for tips in the smallest units of // the currency (integer, not float/double). For example, for a maximum tip // of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in // currencies.json, it shows the number of digits past the decimal point for // each currency (2 for the majority of currencies). Defaults to 0 // https://core.telegram.org/bots/payments/currencies.json MaxTipAmount int `json:"max_tip_amount,omitempty"` // Optional. A JSON-serialized array of suggested amounts of tips 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. SuggestedTipAmounts []int `json:"suggested_tip_amounts,omitempty"` // Optional. A JSON-serialized data about the invoice, which will be shared // with the payment provider. A detailed description of required fields // should be provided by the payment provider. ProviderData string `json:"provider_data,omitempty"` // Optional. 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. PhotoURL string `json:"photo_url,omitempty"` // Optional. Photo size PhotoSize int `json:"photo_size,omitempty"` // Optional. Photo width PhotoWidth int `json:"photo_width,omitempty"` // Optional. Photo height PhotoHeight int `json:"photo_height,omitempty"` // Optional. Pass True, if you require the user's full name to complete the // order NeedName bool `json:"need_name,omitempty"` // Optional. Pass True, if you require the user's phone number to complete // the order NeedPhoneNumber bool `json:"need_phone_number,omitempty"` // Optional. Pass True, if you require the user's email address to complete // the order NeedEmail bool `json:"need_email,omitempty"` // Optional. Pass True, if you require the user's shipping address to // complete the order NeedShippingAddress bool `json:"need_shipping_address,omitempty"` // Optional. Pass True, if user's phone number should be sent to provider SendPhoneNumberToProvider bool `json:"send_phone_number_to_provider,omitempty"` // Optional. Pass True, if user's email address should be sent to provider SendEmailToProvider bool `json:"send_email_to_provider,omitempty"` // Optional. Pass True, if the final price depends on the shipping method IsFlexible bool `json:"is_flexible,omitempty"` }
type CreateNewStickerSetParams ¶
type CreateNewStickerSetParams struct { // User identifier of created sticker set owner UserID UserID `json:"user_id"` // Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., // animals). Can contain only English letters, digits and underscores. Must // begin with a letter, can't contain consecutive underscores and must end // in "_by_<bot_username>". <bot_username> is case insensitive. 1-64 // characters. Name StickerSetName `json:"name"` // Sticker set title, 1-64 characters Title string `json:"title"` // Optional. *PNG* image with the sticker, must be up to 512 kilobytes in // size, dimensions must not exceed 512px, and either width or height must // be exactly 512px. Pass a file_id as a String to send a file that already // exists on the Telegram servers, pass an HTTP URL as a String for Telegram // to get a file from the Internet, or upload a new one using // multipart/form-data. More info on Sending Files » // https://core.telegram.org/bots/api#sending-files PNGSticker InputFile `json:"png_sticker,omitempty"` // Optional. *TGS* animation with the sticker, uploaded using // multipart/form-data. See // https://core.telegram.org/stickers#animated-sticker-requirements for // technical requirements TGSSticker InputFile `json:"tgs_sticker,omitempty"` // Optional. *WEBM* video with the sticker, uploaded using // multipart/form-data. See // https://core.telegram.org/stickers#video-sticker-requirements for // technical requirements WEBMSticker InputFile `json:"webm_sticker,omitempty"` // Optional. Type of stickers in the set, pass “regular” or “mask”. Custom // emoji sticker sets can't be created via the Bot API at the moment. By // default, a regular sticker set is created. StickerType StickerType `json:"sticker_type,omitempty"` // One or more emoji corresponding to the sticker Emojis string `json:"emojis"` // Optional. A JSON-serialized object for position where the mask should be // placed on faces MaskPosition *MaskPosition `json:"mask_position,omitempty"` }
type CustomEmojiID ¶ added in v1.2.0
type CustomEmojiID string
type DeclineChatJoinRequestParams ¶
type DeclineChatJoinRequestParams struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // Unique identifier of the target user UserID UserID `json:"user_id"` }
type DeleteChatPhotoParams ¶
type DeleteChatPhotoParams struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` }
type DeleteChatStickerSetParams ¶
type DeleteChatStickerSetParams struct { // Unique identifier for the target chat or username of the target // supergroup or channel (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` }
type DeleteMessageParams ¶
type DeleteMessageParams struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // Identifier of the message to delete MessageID MessageID `json:"message_id"` }
type DeleteMyCommandsParams ¶
type DeleteMyCommandsParams struct { // Optional. A JSON-serialized object, describing scope of users for which // the commands are relevant. Defaults to BotCommandScopeDefault. // https://core.telegram.org/bots/api#botcommandscopedefault Scope *BotCommandScope `json:"scope,omitempty"` // Optional. A two-letter ISO 639-1 language code. If empty, commands will // be applied to all users from the given scope, for whose language there // are no dedicated commands LanguageCode LanguageCode `json:"language_code,omitempty"` }
type DeleteStickerFromSetParams ¶
type DeleteStickerFromSetParams struct { // File identifier of the sticker Sticker FileID `json:"sticker"` }
type DeleteWebhookParams ¶
type DeleteWebhookParams struct { // Optional. Pass True to drop all pending updates DropPendingUpdates bool `json:"drop_pending_updates,omitempty"` }
type Dice ¶
type Dice struct { // Emoji on which the dice throw animation is based Emoji string `json:"emoji"` // Value of the dice, 1-6 for “🎲”, “🎯” and “🎳” base emoji, 1-5 for “🏀” // and “⚽” base emoji, 1-64 for “🎰” base emoji Value int `json:"value"` }
This object represents an animated emoji that displays a random value.
type Document ¶
type Document struct { // Identifier for this file, which can be used to download or reuse the file FileID FileID `json:"file_id"` // 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 FileUniqueID `json:"file_unique_id"` // Optional. Document thumbnail as defined by sender Thumb *PhotoSize `json:"thumb,omitempty"` // Optional. Original filename as defined by sender FileName string `json:"file_name,omitempty"` // Optional. MIME type of the file as defined by sender MimeType string `json:"mime_type,omitempty"` // Optional. File size in bytes FileSize int64 `json:"file_size,omitempty"` }
This object represents a general file (as opposed to photos, voice messages and audio files).
type EditChatInviteLinkParams ¶
type EditChatInviteLinkParams struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // The invite link to edit InviteLink string `json:"invite_link"` // Optional. Invite link name; 0-32 characters Name string `json:"name,omitempty"` // Optional. Point in time (Unix timestamp) when the link will expire ExpireDate int64 `json:"expire_date,omitempty"` // Optional. Maximum number of users that can be members of the chat // simultaneously after joining the chat via this invite link; 1-99999 MemberLimit int `json:"member_limit,omitempty"` // Optional. True, if users joining the chat via the link need to be // approved by chat administrators. If True, member_limit can't be specified CreatesJoinRequest bool `json:"creates_join_request,omitempty"` }
type EditMessageCaptionParams ¶
type EditMessageCaptionParams struct { // Optional. Required if inline_message_id is not specified. Unique // identifier for the target chat or username of the target channel (in the // format @channelusername) ChatID ChatIDOrUsername `json:"chat_id,omitempty"` // Optional. Required if inline_message_id is not specified. Identifier of // the message to edit MessageID MessageID `json:"message_id,omitempty"` // Optional. Required if chat_id and message_id are not specified. // Identifier of the inline message InlineMessageID InlineMessageID `json:"inline_message_id,omitempty"` // Optional. New caption of the message, 0-1024 characters after entities // parsing Caption string `json:"caption,omitempty"` // Optional. Mode for parsing entities in the message caption. See // formatting options for more details. // https://core.telegram.org/bots/api#formatting-options ParseMode ParseMode `json:"parse_mode,omitempty"` // Optional. A JSON-serialized list of special entities that appear in the // caption, which can be specified instead of parse_mode CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"` // Optional. A JSON-serialized object for an inline keyboard. // https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` }
type EditMessageLiveLocationParams ¶
type EditMessageLiveLocationParams struct { // Optional. Required if inline_message_id is not specified. Unique // identifier for the target chat or username of the target channel (in the // format @channelusername) ChatID ChatIDOrUsername `json:"chat_id,omitempty"` // Optional. Required if inline_message_id is not specified. Identifier of // the message to edit MessageID MessageID `json:"message_id,omitempty"` // Optional. Required if chat_id and message_id are not specified. // Identifier of the inline message InlineMessageID InlineMessageID `json:"inline_message_id,omitempty"` // Latitude of new location Latitude float64 `json:"latitude"` // Longitude of new location Longitude float64 `json:"longitude"` // Optional. The radius of uncertainty for the location, measured in meters; // 0-1500 HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"` // Optional. Direction in which the user is moving, in degrees. Must be // between 1 and 360 if specified. Heading int `json:"heading,omitempty"` // Optional. Maximum distance for proximity alerts about approaching another // chat member, in meters. Must be between 1 and 100000 if specified. ProximityAlertRadius int `json:"proximity_alert_radius,omitempty"` // Optional. A JSON-serialized object for a new inline keyboard. // https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` }
type EditMessageMediaParams ¶
type EditMessageMediaParams struct { // Optional. Required if inline_message_id is not specified. Unique // identifier for the target chat or username of the target channel (in the // format @channelusername) ChatID ChatIDOrUsername `json:"chat_id,omitempty"` // Optional. Required if inline_message_id is not specified. Identifier of // the message to edit MessageID MessageID `json:"message_id,omitempty"` // Optional. Required if chat_id and message_id are not specified. // Identifier of the inline message InlineMessageID InlineMessageID `json:"inline_message_id,omitempty"` // A JSON-serialized object for a new media content of the message Media *InputMedia `json:"media"` // Optional. A JSON-serialized object for a new inline keyboard. // https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` }
type EditMessageReplyMarkupParams ¶
type EditMessageReplyMarkupParams struct { // Optional. Required if inline_message_id is not specified. Unique // identifier for the target chat or username of the target channel (in the // format @channelusername) ChatID ChatIDOrUsername `json:"chat_id,omitempty"` // Optional. Required if inline_message_id is not specified. Identifier of // the message to edit MessageID MessageID `json:"message_id,omitempty"` // Optional. Required if chat_id and message_id are not specified. // Identifier of the inline message InlineMessageID InlineMessageID `json:"inline_message_id,omitempty"` // Optional. A JSON-serialized object for an inline keyboard. // https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` }
type EditMessageTextParams ¶
type EditMessageTextParams struct { // Optional. Required if inline_message_id is not specified. Unique // identifier for the target chat or username of the target channel (in the // format @channelusername) ChatID ChatIDOrUsername `json:"chat_id,omitempty"` // Optional. Required if inline_message_id is not specified. Identifier of // the message to edit MessageID MessageID `json:"message_id,omitempty"` // Optional. Required if chat_id and message_id are not specified. // Identifier of the inline message InlineMessageID InlineMessageID `json:"inline_message_id,omitempty"` // New text of the message, 1-4096 characters after entities parsing Text string `json:"text"` // Optional. Mode for parsing entities in the message text. See formatting // options for more details. ParseMode ParseMode `json:"parse_mode,omitempty"` // Optional. A JSON-serialized list of special entities that appear in // message text, which can be specified instead of parse_mode Entities []*MessageEntity `json:"entities,omitempty"` // Optional. Disables link previews for links in this message DisableWebPagePreview bool `json:"disable_web_page_preview,omitempty"` // Optional. A JSON-serialized object for an inline keyboard. ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` }
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 // https://core.telegram.org/bots/api#encryptedpassportelement 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"` }
Contains data required for decrypting and authenticating EncryptedPassportElement. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes. https://core.telegram.org/bots/api#encryptedpassportelement https://core.telegram.org/passport#receiving-information
type EncryptedPassportElement ¶
type EncryptedPassportElement struct { // Element 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". Type PassportElementType `json:"type"` // Optional. Base64-encoded encrypted Telegram Passport element data // provided by the user, available for "personal_details", "passport", // "driver_license", "identity_card", "internal_passport" and "address" // types. Can be decrypted and verified using the accompanying // EncryptedCredentials. // https://core.telegram.org/bots/api#encryptedcredentials Data string `json:"name,omitempty"` // Optional. User's verified phone number, available only for "phone_number" // type PhoneNumber string `json:"phone_number,omitempty"` // Optional. User's verified email address, available only for "email" type Email string `json:"email,omitempty"` // Optional. 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. // https://core.telegram.org/bots/api#encryptedcredentials Files []*PassportFile `json:"files,omitempty"` // Optional. 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"` // Optional. 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. // https://core.telegram.org/bots/api#encryptedcredentials ReverseSide *PassportFile `json:"reverse_side,omitempty"` // Optional. 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. // https://core.telegram.org/bots/api#encryptedcredentials Selfie *PassportFile `json:"selfie,omitempty"` // Optional. 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. // https://core.telegram.org/bots/api#encryptedcredentials Translation []*PassportFile `json:"translation,omitempty"` // Base64-encoded element hash for using in PassportElementErrorUnspecified // https://core.telegram.org/bots/api#passportelementerrorunspecified Hash string `json:"hash"` }
Contains information about documents or other Telegram Passport elements shared with the bot by the user.
type ExportChatInviteLinkParams ¶
type ExportChatInviteLinkParams struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` }
type File ¶
type File struct { // Identifier for this file, which can be used to download or reuse the file FileID FileID `json:"file_id"` // 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 FileUniqueID `json:"file_unique_id"` // Optional. File size in bytes, if known FileSize int64 `json:"file_size,omitempty"` // Optional. File path. Use // `https://api.telegram.org/file/bot<token>/<file_path>` to get the file. FilePath string `json:"file_path,omitempty"` }
This object represents a file ready to be downloaded. The file can be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile. https://core.telegram.org/bots/api#getfile
The maximum file size to download is 20 MB ¶
type FileID ¶
type FileID string
Identifier for a file, which can be used to download or reuse the file And file id for InputFile fields
type FileReader ¶
type FileReader struct { // Name of the file Name string Reader io.Reader // contains filtered or unexported fields }
File reader for InputFile fields
https://core.telegram.org/bots/api#sending-files
func (*FileReader) MarshalJSON ¶
func (fr *FileReader) MarshalJSON() ([]byte, error)
type FileUniqueID ¶
type FileUniqueID string
Unique identifier for file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
type ForceReply ¶
type ForceReply struct { // Shows reply interface to the user, as if they manually selected the bot's // message and tapped 'Reply' ForceReply bool `json:"force_reply"` // Optional. The placeholder to be shown in the input field when the reply // is active; 1-64 characters InputFieldPlaceholder string `json:"input_field_placeholder,omitempty"` // Optional. 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 // reply_to_message_id), sender of the original message. Selective bool `json:"selective,omitempty"` }
Upon 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. https://core.telegram.org/bots#privacy-mode
Example: A poll bot for groups runs in privacy mode (only receives commands, replies to its messages and mentions). There could be two ways to create a new poll: - Explain the user how to send a command with parameters (e.g. /newpoll question answer1 answer2). May be appealing for hardcore users but lacks modern day polish. - Guide the user through a step-by-step process. 'Please send me your question', 'Cool, now let's add the first answer option', 'Great. Keep adding answer options, then send /done when you're ready'. The last option is definitely more attractive. And if you use ForceReply in your bot's questions, it will receive the user's answers even if it only receives replies, commands and mentions — without any extra work for the user.
type ForwardMessageParams ¶
type ForwardMessageParams struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // Unique identifier for the chat where the original message was sent (or // channel username in the format @channelusername) FromChatID ChatIDOrUsername `json:"from_chat_id"` // Optional. Sends the message silently. Users will receive a notification // with no sound. https://telegram.org/blog/channels-2-0#silent-messages DisableNotification bool `json:"disable_notification,omitempty"` // Optional. Protects the contents of the forwarded message from forwarding // and saving ProtectContent bool `json:"protect_content,omitempty"` // Message identifier in the chat specified in from_chat_id MessageID MessageID `json:"message_id"` }
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"` // Optional. 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. // https://core.telegram.org/bots/api#setgamescore // https://core.telegram.org/bots/api#editmessagetext Text string `json:"text,omitempty"` // Optional. Special entities that appear in text, such as usernames, URLs, // bot commands, etc. RTxtEntities []*MessageEntity `json:"text_entities,omitempty"` // Optional. Animation that will be displayed in the game message in chats. // Upload via BotFather https://t.me/botfather Animation *Animation `json:"animation,omitempty"` }
This object represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers.
type GameHighScore ¶
type GameHighScore struct { // Position in high score table for the game Position int `json:"position"` // User User *User `json:"user"` // Score Score int `json:"score"` }
This object represents one row of the high scores table for a game.
type GameShortName ¶
type GameShortName string
Short name of a Game, serves as the unique identifier for the game https://core.telegram.org/bots/api#games
type GetChatAdministratorsParams ¶
type GetChatAdministratorsParams struct { // Unique identifier for the target chat or username of the target // supergroup or channel (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` }
type GetChatMemberCountParams ¶
type GetChatMemberCountParams struct { // Unique identifier for the target chat or username of the target // supergroup or channel (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` }
type GetChatMemberParams ¶
type GetChatMemberParams struct { // Unique identifier for the target chat or username of the target // supergroup or channel (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // Unique identifier of the target user UserID UserID `json:"user_id"` }
type GetChatMenuButtonParams ¶
type GetChatMenuButtonParams struct { // Optional. Unique identifier for the target private chat. If not // specified, default bot's menu button will be returned ChatID ChatID `json:"chat_id,omitempty"` }
type GetChatParams ¶
type GetChatParams struct { // Unique identifier for the target chat or username of the target // supergroup or channel (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` }
type GetCustomEmojiStickersParams ¶ added in v1.2.0
type GetCustomEmojiStickersParams struct { // List of custom emoji identifiers. At most 200 custom emoji identifiers // can be specified. CustomEmojiIDs []CustomEmojiID `json:"custom_emoji_ids"` }
type GetFileParams ¶
type GetFileParams struct { // File identifier to get info about FileID FileID `json:"file_id"` }
type GetGameHighScoresParams ¶
type GetGameHighScoresParams struct { // Target user id UserID UserID `json:"user_id"` // Optional. Required if inline_message_id is not specified. Unique // identifier for the target chat ChatID ChatID `json:"chat_id,omitempty"` // Optional. Required if inline_message_id is not specified. Identifier of // the sent message MessageID MessageID `json:"message_id,omitempty"` // Optional. Required if chat_id and message_id are not specified. // Identifier of the inline message InlineMessageID InlineMessageID `json:"inline_message_id,omitempty"` }
type GetMyCommandsParams ¶
type GetMyCommandsParams struct { // Optional. A JSON-serialized object, describing scope of users. Defaults // to BotCommandScopeDefault. // https://core.telegram.org/bots/api#botcommandscopedefault Scope *BotCommandScope `json:"scope,omitempty"` // Optional. A two-letter ISO 639-1 language code or an empty string LanguageCode LanguageCode `json:"language_code,omitempty"` }
type GetMyDefaultAdministratorRightsParams ¶
type GetMyDefaultAdministratorRightsParams struct { // Optional. Pass True to change the default administrator rights of the bot // in channels. Otherwise, the default administrator rights of the bot for // groups and supergroups will be changed. ForChannels bool `json:"for_channels,omitempty"` }
type GetStickerSetParams ¶
type GetStickerSetParams struct { // Name of the sticker set Name StickerSetName `json:"name"` }
type GetUpdatesParams ¶
type GetUpdatesParams struct { // Optional. Identifier of the first update to be returned. Must be greater // by one than the highest among the identifiers of previously received // updates. By default, updates starting with the earliest unconfirmed // update are returned. An update is considered confirmed as soon as // getUpdates is called with an offset higher than its update_id. The // negative offset can be specified to retrieve updates starting from // -offset update from the end of the updates queue. All previous updates // will forgotten. https://core.telegram.org/bots/api#getupdates Offset UpdateID `json:"offset,omitempty"` // Optional. Limits the number of updates to be retrieved. Values between // 1-100 are accepted. Defaults to 100. Limit int `json:"limit,omitempty"` // Optional. Timeout in seconds for long polling. Defaults to 0, i.e. usual // short polling. Should be positive, short polling should be used for // testing purposes only. Timeout int `json:"timeout,omitempty"` // Optional. A JSON-serialized list of the update types you want your bot to // receive. For example, specify [“message”, “edited_channel_post”, // “callback_query”] to only receive updates of these types. See Update for // a complete list of available update types. Specify an empty list to // receive all update types except chat_member (default). If not specified, // the previous setting will be used. // https://core.telegram.org/bots/api#update // // Please note that this parameter doesn't affect updates created before the // call to the getUpdates, so unwanted updates may be received for a short // period of time. AllowedUpdates []UpdateType `json:"allowed_updates,omitempty"` }
type GetUserProfilePhotosParams ¶
type GetUserProfilePhotosParams struct { // Unique identifier of the target user UserID UserID `json:"user_id"` // Optional. Sequential number of the first photo to be returned. By // default, all photos are returned. Offset int `json:"offset,omitempty"` // Optional. Limits the number of photos to be retrieved. Values between // 1-100 are accepted. Defaults to 100. Limit int `json:"limit,omitempty"` }
type InlineKeyboardButton ¶
type InlineKeyboardButton struct { // Label text on the button Text string `json:"text"` // Optional. 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 ID // without using a username, if this is allowed by their privacy settings. URL string `json:"url,omitempty"` // Optional. Data to be sent in a callback query to the bot when button is // pressed, 1-64 bytes https://core.telegram.org/bots/api#callbackquery CallbackData string `json:"callback_data,omitempty"` // Optional. 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. // https://core.telegram.org/bots/webapps // https://core.telegram.org/bots/api#answerwebappquery WebApp *WebAppInfo `json:"web_app,omitempty"` // Optional. An HTTP URL used to automatically authorize the user. Can be // used as a replacement for the Telegram Login Widget. // https://core.telegram.org/widgets/login LoginURL *LoginURL `json:"login_url,omitempty"` // Optional. 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. // // Note: 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. // // https://core.telegram.org/bots/inline // https://core.telegram.org/bots/api#answerinlinequery SwitchInlineQuery string `json:"switch_inline_query,omitempty"` // Optional. 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. SwitchInlineQueryCurrentChat string `json:"switch_inline_query_current_chat,omitempty"` // Optional. Description of the game that will be launched when the user // presses the button. *NOTE*: This type of button *must* always be the // first button in the first row. CallbackGame *CallbackGame `json:"callback_game,omitempty"` // Optional. Specify True, to send a Pay button. *NOTE*: This type of button // *must* always be the first button in the first row and can only be used // in invoice messages. Pay bool `json:"pay,omitempty"` }
This object represents one button of an inline keyboard. You *must* use exactly one of the optional fields.
type InlineKeyboardMarkup ¶
type InlineKeyboardMarkup struct { // Array of button rows, each represented by an Array of // InlineKeyboardButton objects // https://core.telegram.org/bots/api#inlinekeyboardbutton InlineKeyboard [][]*InlineKeyboardButton `json:"inline_keyboard"` }
This object represents an inline keyboard that appears right next to the message it belongs to. https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will display unsupported message.
type InlineMessageID ¶
type InlineMessageID string
type InlineQuery ¶
type InlineQuery struct { // Unique identifier for this query ID InlineQueryID `json:"id"` // Sender From *User `json:"from"` // 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"` // Optional. 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 ChatType InlineQueryChatType `json:"chat_type,omitempty"` // Optional. Sender location, only for bots that request user location Location *Location `json:"location,omitempty"` }
This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results.
type InlineQueryChatType ¶
type InlineQueryChatType ChatType
const ( InlineQueryChatTypeSender InlineQueryChatType = "sender" InlineQueryChatTypePrivate InlineQueryChatType = InlineQueryChatType(ChatTypePrivate) InlineQueryChatTypeGroup InlineQueryChatType = InlineQueryChatType(ChatTypeGroup) InlineQueryChatTypeSupergroup InlineQueryChatType = InlineQueryChatType(ChatTypeSupergroup) InlineQueryChatTypeChannel InlineQueryChatType = InlineQueryChatType(ChatTypeChannel) )
type InlineQueryResult ¶
type InlineQueryResult struct { // Type of the result // InlineQueryResultArticle - must be article // InlineQueryResultPhoto - must be photo // InlineQueryResultGif - must be gif // InlineQueryResultMpeg4Gif - must be mpeg4_gif // InlineQueryResultVideo - must be video // InlineQueryResultAudio - must be audio // InlineQueryResultVoice - must be voice // InlineQueryResultDocument - must be document // InlineQueryResultLocation - must be location // InlineQueryResultVenue - must be venue // InlineQueryResultContact - must be contact // InlineQueryResultGame - must be game // InlineQueryResultCachedPhoto - must be photo // InlineQueryResultCachedGif - must be gif // InlineQueryResultCachedMpeg4Gif - must be mpeg4_gif // InlineQueryResultCachedSticker - must be sticker // InlineQueryResultCachedDocument - must be document // InlineQueryResultCachedVideo - must be video // InlineQueryResultCachedVoice - must be voice // InlineQueryResultCachedAudio - must be audio Type InlineQueryResultType `json:"type"` // Unique identifier for this result, 1-64 Bytes ID InlineQueryResultID `json:"id"` // Title of the result Title string `json:"title,omitempty"` // Content of the message to be sent InputMessageContent *InputMessageContent `json:"input_message_content,omitempty"` // Optional. Inline keyboard attached to the message ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` // Optional. Short description of the result Description string `json:"description,omitempty"` // Optional. Url of the thumbnail for the result ThumbURL string `json:"thumb_url,omitempty"` // Optional. Thumbnail width ThumbWidth int `json:"thumb_width,omitempty"` // Optional. Thumbnail height ThumbHeight int `json:"thumb_height,omitempty"` // Optional. Caption of the result to be sent, 0-1024 characters after // entities parsing Caption string `json:"caption,omitempty"` // Optional. Mode for parsing entities in the result caption. See formatting // options for more details. // https://core.telegram.org/bots/api#formatting-options ParseMode ParseMode `json:"parse_mode,omitempty"` // Optional. List of special entities that appear in the caption, which can // be specified instead of parse_mode CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"` // Optional. URL of the result URL string `json:"url,omitempty"` // Optional. Pass True, if you don't want the URL to be shown in the message HideURL bool `json:"hide_url,omitempty"` // A valid URL of the photo. Photo must be in JPEG format. Photo size must // not exceed 5MB PhotoURL string `json:"photo_url,omitempty"` // A valid URL for the GIF file. File size must not exceed 1MB GifURL string `json:"gif_url,omitempty"` // Optional. Width of the GIF GifWidth int `json:"gif_width,omitempty"` // Optional. Height of the GIF GifHeight int `json:"gif_height,omitempty"` // Optional. Duration of the GIF in seconds GifDuration int `json:"gif_duration,omitempty"` // Optional. MIME type of the thumbnail ThumbMimeType string `json:"thumb_mime_type,omitempty"` // A valid URL for the MP4 file. File size must not exceed 1MB Mpeg4URL string `json:"mpeg4_url,omitempty"` // Optional. Video width Mpeg4Width int `json:"mpeg4_width,omitempty"` // Optional. Video height Mpeg4Height int `json:"mpeg4_height,omitempty"` // Optional. Video duration in seconds Mpeg4Duration int `json:"mpeg4_duration,omitempty"` // Mime type of the content of result url MimeType string `json:"mime_type,omitempty"` // A valid URL for the embedded video player or video file VideoURL string `json:"video_url,omitempty"` // Optional. Video width VideoWidth int `json:"video_width,omitempty"` // Optional. Video height VideoHeight int `json:"video_height,omitempty"` // Optional. Video duration in seconds VideoDuration int `json:"video_duration,omitempty"` // A valid URL for the audio file AudioURL string `json:"audio_url,omitempty"` // Optional. Performer Performer string `json:"performer,omitempty"` // Optional. Audio duration in seconds AudioDuration int `json:"audio_duration,omitempty"` // A valid URL for the voice recording VoiceURL string `json:"voice_url,omitempty"` // A valid URL for the file DocumentURL string `json:"document_url,omitempty"` // Location latitude in degrees Latitude float64 `json:"latitude,omitempty"` // Location longitude in degrees Longitude float64 `json:"longitude,omitempty"` // Optional. The radius of uncertainty for the location, measured in meters; // 0-1500 HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"` // Optional. Period in seconds for which the location can be updated, should // be between 60 and 86400. LivePeriod int `json:"live_period,omitempty"` // Optional. For live locations, a direction in which the user is moving, in // degrees. Must be between 1 and 360 if specified. Heading int `json:"heading,omitempty"` // Optional. For live locations, a maximum distance for proximity alerts // about approaching another chat member, in meters. Must be between 1 and // 100000 if specified. ProximityAlertRadius int `json:"proximity_alert_radius,omitempty"` // Address of the venue Address string `json:"address,omitempty"` // Optional. Foursquare identifier of the venue if known FoursquareID string `json:"foursquare_id,omitempty"` // Optional. Foursquare type of the venue, if known. (For example, // "arts_entertainment/default", "arts_entertainment/aquarium" or // "food/icecream".) FoursquareType string `json:"foursquare_type,omitempty"` // Optional. Google Places identifier of the venue GooglePlaceID string `json:"google_place_id,omitempty"` // Optional. Google Places type of the venue. (See supported types.) // https://developers.google.com/places/web-service/supported_types GooglePlaceType string `json:"google_place_type,omitempty"` // Contact's phone number PhoneNumber string `json:"phone_number,omitempty"` // Contact's first name FirstName string `json:"first_name,omitempty"` // Optional. Contact's last name LastName string `json:"last_name,omitempty"` // Optional. Additional data about the contact in the form of a vCard, // 0-2048 bytes https://en.wikipedia.org/wiki/VCard VCard string `json:"vcard,omitempty"` // Short name of the game GameShortName GameShortName `json:"game_short_name,omitempty"` // A valid file identifier of the photo PhotoFileID FileID `json:"photo_file_id,omitempty"` // A valid file identifier for the GIF file GifFileID FileID `json:"gif_file_id,omitempty"` // A valid file identifier for the MP4 file Mpeg4FileID FileID `json:"mpeg4_file_id,omitempty"` // A valid file identifier of the sticker StickerFileID FileID `json:"sticker_file_id,omitempty"` // A valid file identifier for the file DocumentFileID FileID `json:"document_file_id,omitempty"` // A valid file identifier for the video file VideoFileID FileID `json:"video_file_id,omitempty"` // A valid file identifier for the voice message VoiceFileID FileID `json:"voice_file_id,omitempty"` // A valid file identifier for the audio file AudioFileID FileID `json:"audio_file_id,omitempty"` }
This object represents one result of an inline query. Telegram clients currently support results of the following 20 types:
InlineQueryResultCachedAudio - Represents a link to an MP3 audio file stored on the Telegram servers. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio. InlineQueryResultCachedDocument - Represents a link to a file stored on the Telegram servers. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file. InlineQueryResultCachedGif - Represents a link to an animated GIF file stored on the Telegram servers. By default, this animated GIF file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with specified content instead of the animation. InlineQueryResultCachedMpeg4Gif - Represents a link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the Telegram servers. By default, this animated MPEG-4 file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation. InlineQueryResultCachedPhoto - Represents a link to a photo stored on the Telegram servers. By default, this photo will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo. InlineQueryResultCachedSticker - Represents a link to a sticker stored on the Telegram servers. By default, this sticker will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the sticker. InlineQueryResultCachedVideo - Represents a link to a video file stored on the Telegram servers. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video. InlineQueryResultCachedVoice - Represents a link to a voice message stored on the Telegram servers. By default, this voice message will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the voice message. InlineQueryResultArticle - Represents a link to an article or web page. InlineQueryResultAudio - Represents a link to an MP3 audio file. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio. InlineQueryResultContact - Represents a contact with a phone number. By default, this contact will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the contact. InlineQueryResultGame - Represents a Game. https://core.telegram.org/bots/api#games InlineQueryResultDocument - Represents a link to a file. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file. Currently, only *.PDF* and *.ZIP* files can be sent using this method. InlineQueryResultGif - Represents a link to an animated GIF file. By default, this animated GIF file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation. InlineQueryResultLocation - Represents a location on a map. By default, the location will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the location. InlineQueryResultMpeg4Gif - Represents a link to a video animation (H.264/MPEG-4 AVC video without sound). By default, this animated MPEG-4 file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation. InlineQueryResultPhoto - Represents a link to a photo. By default, this photo will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo. InlineQueryResultVenue - Represents a venue. By default, the venue will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the venue. InlineQueryResultVideo - Represents a link to a page containing an embedded video player or a video file. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video. (If an InlineQueryResultVideo message contains an embedded video (e.g., YouTube), you *must* replace its content using input_message_content.) InlineQueryResultVoice - Represents a link to a voice recording in an .OGG container encoded with OPUS. By default, this voice recording will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the the voice message.
Note: All URLs passed in inline query results will be available to end users and therefore must be assumed to be *public*.
https://core.telegram.org/bots/api#inlinequeryresult https://core.telegram.org/bots/api#inlinequeryresultcachedaudio https://core.telegram.org/bots/api#inlinequeryresultcacheddocument https://core.telegram.org/bots/api#inlinequeryresultcachedgif https://core.telegram.org/bots/api#inlinequeryresultcachedmpeg4gif https://core.telegram.org/bots/api#inlinequeryresultcachedphoto https://core.telegram.org/bots/api#inlinequeryresultcachedsticker https://core.telegram.org/bots/api#inlinequeryresultcachedvideo https://core.telegram.org/bots/api#inlinequeryresultcachedvoice https://core.telegram.org/bots/api#inlinequeryresultarticle https://core.telegram.org/bots/api#inlinequeryresultaudio https://core.telegram.org/bots/api#inlinequeryresultcontact https://core.telegram.org/bots/api#inlinequeryresultgame https://core.telegram.org/bots/api#inlinequeryresultdocument https://core.telegram.org/bots/api#inlinequeryresultgif https://core.telegram.org/bots/api#inlinequeryresultlocation https://core.telegram.org/bots/api#inlinequeryresultmpeg4gif https://core.telegram.org/bots/api#inlinequeryresultphoto https://core.telegram.org/bots/api#inlinequeryresultvenue https://core.telegram.org/bots/api#inlinequeryresultvideo https://core.telegram.org/bots/api#inlinequeryresultvoice
type InlineQueryResultID ¶
type InlineQueryResultID string
type InlineQueryResultType ¶
type InlineQueryResultType string
Type of an inline query result
const ( InlineQueryResultTypeArticle InlineQueryResultType = "article" InlineQueryResultTypePhoto InlineQueryResultType = "photo" InlineQueryResultTypeGif InlineQueryResultType = "gif" InlineQueryResultTypeMpeg4Gif InlineQueryResultType = "mpeg4_gif" InlineQueryResultTypeVideo InlineQueryResultType = "video" InlineQueryResultTypeAudio InlineQueryResultType = "audio" InlineQueryResultTypeVoice InlineQueryResultType = "voice" InlineQueryResultTypeDocument InlineQueryResultType = "document" InlineQueryResultTypeLocation InlineQueryResultType = "location" InlineQueryResultTypeVenue InlineQueryResultType = "venue" InlineQueryResultTypeContact InlineQueryResultType = "contact" InlineQueryResultTypeGame InlineQueryResultType = "game" InlineQueryResultTypeSticker InlineQueryResultType = "sticker" )
type InputFile ¶
type InputFile interface {
// contains filtered or unexported methods
}
This object represents the contents of a file to be uploaded. Must be posted using multipart/form-data in the usual way that files are uploaded via the browser.
*NOTE FROM THIS LIBRARY DEVELOPER*: InputFile can be either FileID, FileURL, or FileReader. If you want to upload large files, use self-hosted telegram bot api server, and upload using FileURL with the file URL scheme https://github.com/tdlib/telegram-bot-api https://hub.docker.com/r/rmuhamedgaliev/telegram-bot-api https://github.com/rmuhamedgaliev/telegram-bot-api https://en.wikipedia.org/wiki/File_URI_scheme
https://core.telegram.org/bots/api#inputfile https://core.telegram.org/bots/api#sending-files
type InputMedia ¶
type InputMedia struct { // Type of the result // InputMediaPhoto - must be photo // InputMediaVideo - must be video // InputMediaAnimation - must be animation // InputMediaAudio - must be audio // InputMediaDocument - must be document Type InputMediaType `json:"type"` // File to send Media InputFile `json:"media"` // Optional. Caption of the file to be sent, 0-1024 characters after // entities parsing Caption string `json:"caption,omitempty"` // Optional. Mode for parsing entities in the animation caption. See // formatting options for more details. // https://core.telegram.org/bots/api#formatting-options ParseMode ParseMode `json:"parse_mode,omitempty"` // Optional. List of special entities that appear in the caption, which can // be specified instead of parse_mode CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"` // Optional. Thumbnail of the file sent; can be ignored if thumbnail // generation for the file is supported server-side. The thumbnail should be // in JPEG format and less than 200 kB in size. A thumbnail's width and // height should not exceed 320. Thumb InputFile `json:"thumb,omitempty"` // Optional. Video or Animation width Width int `json:"width,omitempty"` // Optional. Video or Animation height Height int `json:"height,omitempty"` // Optional. Video, animation or audio duration in seconds Duration int `json:"duration,omitempty"` // Optional. Pass True, if the uploaded video is suitable for streaming SupportsStreaming bool `json:"supports_streaming,omitempty"` // Optional. Performer of the audio Performer int `json:"performer,omitempty"` // Optional. Title of the audio Title int `json:"title,omitempty"` // Optional. 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. DisableContentTypeDetection bool `json:"disable_content_type_detection,omitempty"` }
This object represents the content of a media message to be sent. It should be one of
InputMediaAnimation - Represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent. InputMediaDocument - Represents a general file to be sent. InputMediaAudio - Represents an audio file to be treated as music to be sent. InputMediaPhoto - Represents a photo to be sent. InputMediaVideo - Represents a video to be sent.
https://core.telegram.org/bots/api#inputmedia https://core.telegram.org/bots/api#inputmediaanimation https://core.telegram.org/bots/api#inputmediadocument https://core.telegram.org/bots/api#inputmediaaudio https://core.telegram.org/bots/api#inputmediaphoto https://core.telegram.org/bots/api#inputmediavideo
type InputMediaType ¶
type InputMediaType string
const ( InputMediaTypePhoto InputMediaType = "photo" InputMediaTypeVideo InputMediaType = "video" InputMediaTypeAnimation InputMediaType = "animation" InputMediaTypeAudio InputMediaType = "audio" InputMediaTypeDocument InputMediaType = "document" )
type InputMessageContent ¶
type InputMessageContent struct { // Text of the message to be sent, 1-4096 characters MessageText string `json:"message_text,omitempty"` // Optional. Mode for parsing entities in the message text. See formatting // options for more details. // https://core.telegram.org/bots/api#formatting-options ParseMode ParseMode `json:"parse_mode,omitempty"` // Optional. List of special entities that appear in message text, which can // be specified instead of parse_mode Entities []*MessageEntity `json:"entities,omitempty"` // Optional. Disables link previews for links in the sent message DisableWebPagePreview bool `json:"disable_web_page_preview,omitempty"` // Latitude of the location in degrees Latitude float64 `json:"latitude,omitempty"` // Longitude of the location in degrees Longitude float64 `json:"longitude,omitempty"` // Optional. The radius of uncertainty for the location, measured in meters; // 0-1500 HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"` // Optional. Period in seconds for which the location can be updated, should // be between 60 and 86400. LivePeriod int `json:"live_period,omitempty"` // Optional. For live locations, a direction in which the user is moving, in // degrees. Must be between 1 and 360 if specified. Heading int `json:"heading,omitempty"` // Optional. For live locations, a maximum distance for proximity alerts // about approaching another chat member, in meters. Must be between 1 and // 100000 if specified. ProximityAlertRadius int `json:"proximity_alert_radius,omitempty"` // Name of the venue / Product name, 1-32 characters Title string `json:"title,omitempty"` // Address of the venue Address string `json:"address,omitempty"` // Optional. Foursquare identifier of the venue, if known FoursquareID string `json:"foursquare_id,omitempty"` // Optional. Foursquare type of the venue, if known. (For example, // "arts_entertainment/default", "arts_entertainment/aquarium" or // "food/icecream".) FoursquareType string `json:"foursquare_type,omitempty"` // Optional. Google Places identifier of the venue GooglePlaceID string `json:"google_place_id,omitempty"` // Optional. Google Places type of the venue. (See supported types.) // https://developers.google.com/places/web-service/supported_types GooglePlaceType string `json:"google_place_type,omitempty"` // Contact's phone number PhoneNumber string `json:"phone_number,omitempty"` // Contact's first name FirstName string `json:"first_name,omitempty"` // Optional. Contact's last name LastName string `json:"last_name,omitempty"` // Optional. Additional data about the contact in the form of a vCard, // 0-2048 bytes https://en.wikipedia.org/wiki/VCard VCard string `json:"vcard,omitempty"` // Product description, 1-255 characters Description string `json:"description,omitempty"` // Bot-defined invoice payload, 1-128 bytes. This will not be displayed to // the user, use for your internal processes. Payload string `json:"payload,omitempty"` // Payments provider token, obtained via Botfather https://t.me/botfather ProviderToken string `json:"provider_token,omitempty"` // Three-letter ISO 4217 currency code, see more on currencies // https://core.telegram.org/bots/payments#supported-currencies Currency string `json:"currency,omitempty"` // Price breakdown, a JSON-serialized list of components (e.g. product // price, tax, discount, delivery cost, delivery tax, bonus, etc.) Prices []*LabeledPrice `json:"prices,omitempty"` // Optional. The maximum accepted amount for tips in the smallest units of // the currency (integer, not float/double). For example, for a maximum tip // of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in // currencies.json, it shows the number of digits past the decimal point for // each currency (2 for the majority of currencies). Defaults to 0 // https://core.telegram.org/bots/payments/currencies.json MaxTipAmount int `json:"max_tip_amount,omitempty"` // Optional. A JSON-serialized 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. SuggestedTipAmounts []int `json:"suggested_tip_amounts,omitempty"` // Optional. 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. ProviderData string `json:"provider_data,omitempty"` // Optional. 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. PhotoURL string `json:"photo_url,omitempty"` // Optional. Photo size PhotoSize int `json:"photo_size,omitempty"` // Optional. Photo width PhotoWidth int `json:"photo_width,omitempty"` // Optional. Photo height PhotoHeight int `json:"photo_height,omitempty"` // Optional. Pass True, if you require the user's full name to complete the // order NeedName bool `json:"need_name,omitempty"` // Optional. Pass True, if you require the user's phone number to complete // the order NeedPhoneNumber bool `json:"need_phone_number,omitempty"` // Optional. Pass True, if you require the user's email address to complete // the order NeedEmail bool `json:"need_email,omitempty"` // Optional. Pass True, if you require the user's shipping address to // complete the order NeedShippingAddress bool `json:"need_shipping_address,omitempty"` // Optional. Pass True, if user's phone number should be sent to provider SendPhoneNumberToProvider bool `json:"send_phone_number_to_provider,omitempty"` // Optional. Pass True, if user's email address should be sent to provider SendEmailToProvider bool `json:"send_email_to_provider,omitempty"` // Optional. Pass True, if the final price depends on the shipping method IsFlexible bool `json:"is_flexible,omitempty"` }
This object represents the content of a message to be sent as a result of an inline query. Telegram clients currently support the following 5 types:
InputTextMessageContent - Represents the content of a text message to be sent as the result of an inline query. InputLocationMessageContent - Represents the content of a location message to be sent as the result of an inline query. InputVenueMessageContent - Represents the content of a venue message to be sent as the result of an inline query. InputContactMessageContent - Represents the content of a contact message to be sent as the result of an inline query. InputInvoiceMessageContent - Represents the content of an invoice message to be sent as the result of an inline query.
https://core.telegram.org/bots/api#inputmessagecontent https://core.telegram.org/bots/api#inputtextmessagecontent https://core.telegram.org/bots/api#inputlocationmessagecontent https://core.telegram.org/bots/api#inputvenuemessagecontent https://core.telegram.org/bots/api#inputcontactmessagecontent https://core.telegram.org/bots/api#inputinvoicemessagecontent
type Invoice ¶
type Invoice struct { // Product name Title string `json:"title"` // Product description Description string `json:"description"` // Unique bot deep-linking parameter that can be used to generate this // invoice StartParameter string `json:"start_parameter"` // Three-letter ISO 4217 currency code // https://core.telegram.org/bots/payments#supported-currencies Currency string `json:"currency"` // 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, it shows the number of digits // past the decimal point for each currency (2 for the majority of // currencies). https://core.telegram.org/bots/payments/currencies.json // https://core.telegram.org/bots/payments/currencies.json TotalAmount int `json:"total_amount"` }
This object contains basic information about an invoice.
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"` // Optional. If True, the user's phone number will be sent as a contact when // the button is pressed. Available in private chats only RequestContact bool `json:"request_contact,omitempty"` // Optional. If True, the user's current location will be sent when the // button is pressed. Available in private chats only RequestLocation bool `json:"request_location,omitempty"` // Optional. 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 RequestPoll *KeyboardButtonPollType `json:"request_poll,omitempty"` // Optional. 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. // https://core.telegram.org/bots/webapps WebApp *WebAppInfo `json:"web_app,omitempty"` }
This object 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 web_app, request_contact, request_location, and request_poll are mutually exclusive.
Note: request_contact and request_location options will only work in Telegram versions released after 9 April, 2016. Older clients will display unsupported message. Note: request_poll option will only work in Telegram versions released after 23 January, 2020. Older clients will display unsupported message. Note: web_app option will only work in Telegram versions released after 16 April, 2022. Older clients will display unsupported message.
type KeyboardButtonPollType ¶
type KeyboardButtonPollType struct { // Optional. 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 PollType `json:"type,omitempty"` }
This object represents type of a poll, which is allowed to be created and sent when the corresponding button is pressed.
type LabeledPrice ¶
type LabeledPrice struct { // Portion label Label string `json:"label"` // 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, it shows the number of digits // past the decimal point for each currency (2 for the majority of // currencies). Amount int `json:"amount"` }
This object represents a portion of the price for goods or services.
type LanguageCode ¶
type LanguageCode string
A two-letter ISO 639-1 language code.
const ( LanguageCodeRussian LanguageCode = "ru" LanguageCodeEnglish LanguageCode = "en" LanguageCodeBelarusian LanguageCode = "be" LanguageCodeUkrainian LanguageCode = "uk" LanguageCodeKorean LanguageCode = "ko" LanguageCodeCatalan LanguageCode = "ca" LanguageCodeDutch LanguageCode = "nl" LanguageCodeFrench LanguageCode = "fr" LanguageCodeGerman LanguageCode = "de" LanguageCodeItalian LanguageCode = "it" LanguageCodeMalay LanguageCode = "ms" LanguageCodePolish LanguageCode = "pl" LanguageCodePortuguese LanguageCode = "pt" LanguageCodeSpanish LanguageCode = "es" LanguageCodeTurkish LanguageCode = "tr" )
type LeaveChatParams ¶
type LeaveChatParams struct { // Unique identifier for the target chat or username of the target // supergroup or channel (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` }
type Location ¶
type Location struct { // Longitude as defined by sender Longitude float64 `json:"longitude"` // Latitude as defined by sender Latitude float64 `json:"latitude"` // Optional. The radius of uncertainty for the location, measured in meters; // 0-1500 HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"` // Optional. Time relative to the message sending date, during which the // location can be updated; in seconds. For active live locations only. LivePeriod int `json:"live_period,omitempty"` // Optional. The direction in which user is moving, in degrees; 1-360. For // active live locations only. Heading int `json:"heading,omitempty"` // Optional. Maximum distance for proximity alerts about approaching another // chat member, in meters. For sent live locations only. ProximityAlertRadius int `json:"proximity_alert_radius,omitempty"` }
This object represents a point on the map.
type LoginURL ¶
type LoginURL struct { // 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. // https://core.telegram.org/widgets/login#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. // https://core.telegram.org/widgets/login#checking-authorization URL string `json:"url"` // Optional. New text of the button in forwarded messages. ForwardText string `json:"forward_text,omitempty"` // Optional. 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. https://core.telegram.org/widgets/login#setting-up-a-bot // https://core.telegram.org/widgets/login#linking-your-domain-to-the-bot BotUsername Username `json:"bot_username,omitempty"` // Optional. Pass True to request the permission for your bot to send // messages to the user. RequestWriteAccess bool `json:"request_write_access,omitempty"` }
This object 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: https://core.telegram.org/file/811140015/1734/8VZFkwWXalM.97872/6127fa62d8a0bf2b3c https://core.telegram.org/widgets/login
Telegram apps support these buttons as of version 5.7. https://telegram.org/blog/privacy-discussions-web-bots#meet-seamless-web-bots
Sample bot: @discussbot
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 MaskPositionPoint `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"` }
This object describes the position on faces where a mask should be placed by default.
type MaskPositionPoint ¶
type MaskPositionPoint string
const ( MaskPositionPointForehead MaskPositionPoint = "forehead" MaskPositionPointEyes MaskPositionPoint = "eyes" MaskPositionPointMouth MaskPositionPoint = "mouth" MaskPositionPointChin MaskPositionPoint = "chin" )
type MenuButton ¶
type MenuButton struct { // Type of the button // MenuButtonCommands - must be commands // MenuButtonWebApp - must be web_app // MenuButtonDefault - must be default Type MenuButtonType `json:"type"` // Text on the button Text string `json:"text,omitempty"` // 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. // https://core.telegram.org/bots/api#answerwebappquery WebApp *WebAppInfo `json:"web_app,omitempty"` }
This object describes the bot's menu button in a private chat. It should be one of
MenuButtonCommands - Represents a menu button, which opens the bot's list of commands. MenuButtonWebApp - Represents a menu button, which launches a Web App. https://core.telegram.org/bots/webapps MenuButtonDefault - Describes that no specific value for the menu button was set.
If a menu button other than MenuButtonDefault is set for a private chat, then it is applied in the chat. Otherwise the default menu button is applied. By default, the menu button opens the list of bot commands. https://core.telegram.org/bots/api#menubuttondefault
https://core.telegram.org/bots/api#menubutton https://core.telegram.org/bots/api#menubuttoncommands https://core.telegram.org/bots/api#menubuttonwebapp https://core.telegram.org/bots/api#menubuttondefault
type MenuButtonType ¶
type MenuButtonType string
const ( MenuButtonTypeCommands MenuButtonType = "commands" MenuButtonTypeWebApp MenuButtonType = "web_app" MenuButtonTypeDefault MenuButtonType = "default" )
type Message ¶
type Message struct { // Unique message identifier inside this chat MessageID MessageID `json:"message_id"` // Optional. Sender of the message; empty for messages sent to channels. For // backward compatibility, the field contains a fake sender user in // non-channel chats, if the message was sent on behalf of a chat. From *User `json:"from,omitempty"` // Optional. Sender of the message, sent on behalf of a chat. For example, // the channel itself for channel posts, the supergroup itself for messages // from anonymous group administrators, the linked channel for messages // automatically forwarded to the discussion group. For backward // compatibility, the field from contains a fake sender user in non-channel // chats, if the message was sent on behalf of a chat. SenderChat *Chat `json:"sender_chat,omitempty"` // Date the message was sent in Unix time Date int64 `json:"date"` // Conversation the message belongs to Chat *Chat `json:"chat"` // Optional. For forwarded messages, sender of the original message ForwardFrom *User `json:"forward_from,omitempty"` // Optional. For messages forwarded from channels or from anonymous // administrators, information about the original sender chat ForwardFromChat *Chat `json:"forward_from_chat,omitempty"` // Optional. For messages forwarded from channels, identifier of the // original message in the channel ForwardFromMessageID MessageID `json:"forward_from_message_id,omitempty"` // Optional. For forwarded messages that were originally sent in channels or // by an anonymous chat administrator, signature of the message sender if // present ForwardSignature string `json:"forward_signature,omitempty"` // Optional. Sender's name for messages forwarded from users who disallow // adding a link to their account in forwarded messages ForwardSenderName string `json:"forward_sender_name,omitempty"` // Optional. For forwarded messages, date the original message was sent in // Unix time ForwardDate int64 `json:"forward_date,omitempty"` // Optional. True, if the message is a channel post that was automatically // forwarded to the connected discussion group IsAutomaticForward bool `json:"is_automatic_forward,omitempty"` // Optional. For replies, the original message. Note that the Message object // in this field will not contain further reply_to_message fields even if it // itself is a reply. ReplyToMessage *Message `json:"reply_to_message,omitempty"` // Optional. Bot through which the message was sent ViaBot *User `json:"via_bot,omitempty"` // Optional. Date the message was last edited in Unix time EditDate int64 `json:"edit_date,omitempty"` // Optional. True, if the message can't be forwarded HasProtectedContent bool `json:"has_protected_content,omitempty"` // Optional. The unique identifier of a media message group this message // belongs to MediaGroupID string `json:"media_group_id,omitempty"` // Optional. Signature of the post author for messages in channels, or the // custom title of an anonymous group administrator AuthorSignature string `json:"author_signature,omitempty"` // Optional. For text messages, the actual UTF-8 text of the message, 0-4096 // characters Text string `json:"text,omitempty"` // Optional. For text messages, special entities like usernames, URLs, bot // commands, etc. that appear in the text Entities []*MessageEntity `json:"entities,omitempty"` // Optional. Message is an animation, information about the animation. For // backward compatibility, when this field is set, the document field will // also be set Animation *Animation `json:"animation,omitempty"` // Optional. Message is an audio file, information about the file Audio *Audio `json:"audio,omitempty"` // Optional. Message is a general file, information about the file Document *Document `json:"document,omitempty"` // Optional. Message is a photo, available sizes of the photo Photo []*PhotoSize `json:"photo,omitempty"` // Optional. Message is a sticker, information about the sticker Sticker *Sticker `json:"sticker,omitempty"` // Optional. Message is a video, information about the video Video *Video `json:"video,omitempty"` // Optional. Message is a video note, information about the video message // https://telegram.org/blog/video-messages-and-telescope VideoNote *VideoNote `json:"video_note,omitempty"` // Optional. Message is a voice message, information about the file Voice *Voice `json:"voice,omitempty"` // Optional. Caption for the animation, audio, document, photo, video or // voice, 0-1024 characters Caption string `json:"caption,omitempty"` // Optional. For messages with a caption, special entities like usernames, // URLs, bot commands, etc. that appear in the caption CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"` // Optional. Message is a shared contact, information about the contact Contact *Contact `json:"contact,omitempty"` // Optional. Message is a dice with random value Dice *Dice `json:"dice,omitempty"` // Optional. Message is a game, information about the game. // https://core.telegram.org/bots/api#games Game *Game `json:"game,omitempty"` // Optional. Message is a native poll, information about the poll Poll *Poll `json:"poll,omitempty"` // Optional. Message is a venue, information about the venue. For backward // compatibility, when this field is set, the location field will also be // set Venue *Venue `json:"venue,omitempty"` // Optional. Message is a shared location, information about the location Location *Location `json:"location,omitempty"` // Optional. New members that were added to the group or supergroup and // information about them (the bot itself may be one of these members) NewChatMembers []*User `json:"new_chat_members,omitempty"` // Optional. A member was removed from the group, information about them // (this member may be the bot itself) LeftChatMember *User `json:"left_chat_member,omitempty"` // Optional. A chat title was changed to this value NewChatTitle string `json:"new_chat_title,omitempty"` // Optional. A chat photo was change to this value NewChatPhoto []*PhotoSize `json:"new_chat_photo,omitempty"` // Optional. Service message: the chat photo was deleted DeleteChatPhoto bool `json:"delete_chat_photo,omitempty"` // Optional. Service message: the group has been created GroupChatCreated bool `json:"group_chat_created,omitempty"` // Optional. 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 // reply_to_message if someone replies to a very first message in a directly // created supergroup. SupergroupChatCreated bool `json:"supergroup_chat_created,omitempty"` // Optional. 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 // reply_to_message if someone replies to a very first message in a channel. ChannelChatCreated bool `json:"channel_chat_created,omitempty"` // Optional. Service message: auto-delete timer settings changed in the chat MessageAutoDeleteTimerChanged *MessageAutoDeleteTimerChanged `json:"message_auto_delete_timer_changed,omitempty"` // Optional. The group has been migrated to a supergroup with the specified // identifier. This number may have more than 32 significant bits and some // programming languages may have difficulty/silent defects in interpreting // it. But it has at most 52 significant bits, so a signed 64-bit integer or // double-precision float type are safe for storing this identifier. MigrateToChatID ChatID `json:"migrate_to_chat_id,omitempty"` // Optional. The supergroup has been migrated from a group with the // specified identifier. This number may have more than 32 significant bits // and some programming languages may have difficulty/silent defects in // interpreting it. But it has at most 52 significant bits, so a signed // 64-bit integer or double-precision float type are safe for storing this // identifier. MigrateFromChatID ChatID `json:"migrate_from_chat_id,omitempty"` // Optional. Specified message was pinned. Note that the Message object in // this field will not contain further reply_to_message fields even if it is // itself a reply. PinnedMessage *Message `json:"pinned_message,omitempty"` // Optional. Message is an invoice for a payment, information about the // invoice. https://core.telegram.org/bots/api#payments Invoice *Invoice `json:"invoice,omitempty"` // Optional. Message is a service message about a successful payment, // information about the payment. // https://core.telegram.org/bots/api#payments SuccessfulPayment *SuccessfulPayment `json:"successful_payment,omitempty"` // Optional. The domain name of the website on which the user has logged in. // https://core.telegram.org/widgets/login ConnectedWebsite string `json:"connected_website,omitempty"` // Optional. Telegram Passport data PassportData *PassportData `json:"passport_data,omitempty"` // Optional. Service message. A user in the chat triggered another user's // proximity alert while sharing Live Location. ProximityAlertTriggered *ProximityAlertTriggered `json:"proximity_alert_triggered,omitempty"` // Optional. Service message: video chat scheduled VideoChatScheduled *VideoChatScheduled `json:"video_chat_scheduled,omitempty"` // Optional. Service message: video chat started VideoChatStarted *VideoChatStarted `json:"video_chat_started,omitempty"` // Optional. Service message: video chat ended VideoChatEnded *VideoChatEnded `json:"video_chat_ended,omitempty"` // Optional. Service message: new participants invited to a video chat VideoChatParticipantsInvited *VideoChatParticipantsInvited `json:"video_chat_participants_invited,omitempty"` // Optional. Service message: data sent by a Web App WebAppData *WebAppData `json:"web_app_data,omitempty"` // Optional. Inline keyboard attached to the message. `login_url` buttons // are represented as ordinary `url` buttons. ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` }
This object represents a message.
type MessageAutoDeleteTimerChanged ¶
type MessageAutoDeleteTimerChanged struct { // New auto-delete time for messages in the chat; in seconds MessageAutoDeleteTime int `json:"message_auto_delete_time"` }
This object represents a service message about a change in auto-delete timer settings.
https://core.telegram.org/bots/api#messageautodeletetimerchanged
type MessageEntity ¶
type MessageEntity struct { // Type of the entity. Currently, 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), “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) https://telegram.org/blog/edit#new-mentions Type MessageEntityType `json:"type"` // Offset in UTF-16 code units to the start of the entity Offset int `json:"offset"` // Length of the entity in UTF-16 code units Length int `json:"length"` // Optional. For “text_link” only, url that will be opened after user taps // on the text URL string `json:"url,omitempty"` // Optional. For “text_mention” only, the mentioned user User *User `json:"user,omitempty"` // Optional. For “pre” only, the programming language of the entity text Language string `json:"language,omitempty"` // Optional. For “custom_emoji” only, unique identifier of the custom emoji. // Use getCustomEmojiStickers to get full information about the sticker // https://core.telegram.org/bots/api#getcustomemojistickers CustomEmojiID CustomEmojiID `json:"custom_emoji_id,omitempty"` }
This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc.
type MessageEntityType ¶
type MessageEntityType string
Type of the entity.
const ( // @username MessageEntityTypeMention MessageEntityType = "mention" // #hashtag MessageEntityTypeHashtag MessageEntityType = "hashtag" // $USD MessageEntityTypeCashtag MessageEntityType = "cashtag" // /start@jobs_bot MessageEntityTypeBotCommand MessageEntityType = "bot_command" // https://telegram.org MessageEntityTypeURL MessageEntityType = "url" // do-not-reply@telegram.org MessageEntityTypeEmail MessageEntityType = "email" // +1-212-555-0123 MessageEntityTypePhoneNumber MessageEntityType = "phone_number" // bold text MessageEntityTypeBold MessageEntityType = "bold" // italic text MessageEntityTypeItalic MessageEntityType = "italic" // underlined text MessageEntityTypeUnderline MessageEntityType = "underline" // strikethrough text MessageEntityTypeStrikethrough MessageEntityType = "strikethrough" // spoiler message MessageEntityTypeSpoiler MessageEntityType = "spoiler" // monowidth string MessageEntityTypeCode MessageEntityType = "code" // monowidth block MessageEntityTypePre MessageEntityType = "pre" // for clickable text URLs MessageEntityTypeTextLink MessageEntityType = "text_link" // for users without usernames https://telegram.org/blog/edit#new-mentions MessageEntityTypeTextMention MessageEntityType = "text_mention" // for inline custom emoji stickers MessageEntityTypeCustomEmoji MessageEntityType = "custom_emoji" )
type MessageIDObject ¶
type MessageIDObject struct { // Unique message identifier MessageID MessageID `json:"message_id"` }
This object represents a unique message identifier.
type OrderInfo ¶
type OrderInfo struct { // Optional. User name Name string `json:"name,omitempty"` // Optional. User's phone number PhoneNumber string `json:"phone_number,omitempty"` // Optional. User email Email string `json:"email,omitempty"` // Optional. User shipping address ShippingAddress *ShippingAddress `json:"shipping_address,omitempty"` }
This object represents information about an order.
type ParseMode ¶
type ParseMode string
https://core.telegram.org/bots/api#formatting-options
const ( // https://core.telegram.org/bots/api#markdownv2-style ParseModeMarkdownV2 ParseMode = "MarkdownV2" // https://core.telegram.org/bots/api#html-style ParseModeHTML ParseMode = "HTML" // https://core.telegram.org/bots/api#markdown-style ParseModeMarkdown ParseMode = "Markdown" )
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"` }
Contains information about Telegram Passport data shared with the bot by the user.
type PassportElementError ¶
type PassportElementError struct { // Error source // PassportElementErrorDataField - must be data // PassportElementErrorFrontSide - must be front_side // PassportElementErrorReverseSide - must be reverse_side // PassportElementErrorSelfie - must be selfie // PassportElementErrorFile - must be file // PassportElementErrorFiles - must be files // PassportElementErrorTranslationFile - must be translation_file // PassportElementErrorTranslationFiles - must be translation_files // PassportElementErrorUnspecified - must be unspecified Source PassportElementErrorSource `json:"source"` // Error message Message string `json:"message"` // The section of the user's Telegram Passport which has the error // PassportElementErrorDataField - one of "personal_details", "passport", "driver_license", "identity_card", "internal_passport", "address" // PassportElementErrorFrontSide - one of "passport", "driver_license", "identity_card", "internal_passport" // PassportElementErrorReverseSide - one of "driver_license", "identity_card" // PassportElementErrorSelfie - one of "passport", "driver_license", "identity_card", "internal_passport" // PassportElementErrorFile - one of "utility_bill", "bank_statement", "rental_agreement", "passport_registration", "temporary_registration" // PassportElementErrorFiles - one of "utility_bill", "bank_statement", "rental_agreement", "passport_registration", "temporary_registration" // PassportElementErrorTranslationFile - one of "passport", "driver_license", "identity_card", "internal_passport", "utility_bill", "bank_statement", "rental_agreement", "passport_registration", "temporary_registration" // PassportElementErrorTranslationFiles - one of "passport", "driver_license", "identity_card", "internal_passport", "utility_bill", "bank_statement", "rental_agreement", "passport_registration", "temporary_registration" Type PassportElementType `json:"type"` // Name of the data field which has the error FieldName string `json:"field_name,omitempty"` // Base64-encoded data hash DataHash string `json:"data_hash,omitempty"` // Base64-encoded file hash FileHash string `json:"file_hash,omitempty"` // List of base64-encoded file hashes FileHashes []string `json:"file_hashes,omitempty"` // Base64-encoded element hash ElementHash string `json:"element_hash,omitempty"` }
This object represents an error in the Telegram Passport element which was submitted that should be resolved by the user. It should be one of:
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. 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. 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. PassportElementErrorSelfie - Represents an issue with the selfie with a document. The error is considered resolved when the file with the selfie changes. PassportElementErrorFile - Represents an issue with a document scan. The error is considered resolved when the file with the document scan changes. PassportElementErrorFiles - Represents an issue with a list of scans. The error is considered resolved when the list of files containing the scans changes. 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. PassportElementErrorTranslationFiles - Represents an issue with the translated version of a document. The error is considered resolved when a file with the document translation change. PassportElementErrorUnspecified - Represents an issue in an unspecified place. The error is considered resolved when new data is added.
https://core.telegram.org/bots/api#passportelementerror https://core.telegram.org/bots/api#passportelementerrordatafield https://core.telegram.org/bots/api#passportelementerrorfrontside https://core.telegram.org/bots/api#passportelementerrorreverseside https://core.telegram.org/bots/api#passportelementerrorselfie https://core.telegram.org/bots/api#passportelementerrorfile https://core.telegram.org/bots/api#passportelementerrorfiles https://core.telegram.org/bots/api#passportelementerrortranslationfile https://core.telegram.org/bots/api#passportelementerrortranslationfiles https://core.telegram.org/bots/api#passportelementerrorunspecified
type PassportElementErrorSource ¶
type PassportElementErrorSource string
const ( PassportElementErrorSourceData PassportElementErrorSource = "data" PassportElementErrorSourceFrontSide PassportElementErrorSource = "front_side" PassportElementErrorSourceReverseSide PassportElementErrorSource = "reverse_side" PassportElementErrorSourceSelfie PassportElementErrorSource = "selfie" PassportElementErrorSourceFile PassportElementErrorSource = "file" PassportElementErrorSourceFiles PassportElementErrorSource = "files" PassportElementErrorSourceTranslationFile PassportElementErrorSource = "translation_file" PassportElementErrorSourceTranslationFiles PassportElementErrorSource = "translation_files" PassportElementErrorSourceUnspecified PassportElementErrorSource = "unspecified" )
type PassportElementType ¶
type PassportElementType string
const ( PassportElementTypePersonalDetails PassportElementType = "personal_details" PassportElementTypePassport PassportElementType = "passport" PassportElementTypeDriverLicense PassportElementType = "driver_license" PassportElementTypeIdentityCard PassportElementType = "identity_card" PassportElementTypeInternalPassport PassportElementType = "internal_passport" PassportElementTypeAddress PassportElementType = "address" PassportElementTypeUtilityBill PassportElementType = "utility_bill" PassportElementTypeBankStatement PassportElementType = "bank_statement" PassportElementTypeRentalAgreement PassportElementType = "rental_agreement" PassportElementTypePassportRegistration PassportElementType = "passport_registration" PassportElementTypeTemporaryRegistration PassportElementType = "temporary_registration" PassportElementTypePhoneNumber PassportElementType = "phone_number" PassportElementTypeEmail PassportElementType = "email" )
type PassportFile ¶
type PassportFile struct { // Identifier for this file, which can be used to download or reuse the file FileID FileID `json:"file_id"` // 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 FileUniqueID `json:"file_unique_id"` // File size in bytes FileSize int64 `json:"file_size"` // Unix time when the file was uploaded FileDate int64 `json:"file_date"` }
This object represents a file uploaded to Telegram Passport. Currently all Telegram Passport files are in JPEG format when decrypted and don't exceed 10MB.
type PhotoSize ¶
type PhotoSize struct { // Identifier for this file, which can be used to download or reuse the file FileID FileID `json:"file_id"` // 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 FileUniqueID `json:"file_unique_id"` // Photo width Width int `json:"width"` // Photo height Height int `json:"height"` // Optional. File size in bytes FileSize int64 `json:"file_size,omitempty"` }
This object represents one size of a photo or a file / sticker thumbnail. https://core.telegram.org/bots/api#document https://core.telegram.org/bots/api#sticker
type PinChatMessageParams ¶
type PinChatMessageParams struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // Identifier of a message to pin MessageID MessageID `json:"message_id"` // Optional. Pass True, if it is not necessary to send a notification to all // chat members about the new pinned message. Notifications are always // disabled in channels and private chats. DisableNotification bool `json:"disable_notification,omitempty"` }
type Poll ¶
type Poll struct { // Unique poll identifier ID PollID `json:"id"` // Poll question, 1-300 characters Question string `json:"question"` // List of poll options Options []*PollOption `json:"options"` // Total number of users that voted in the poll TotalVoterCount int `json:"total_voter_count"` // True, if the poll is closed IsClosed bool `json:"is_closed"` // True, if the poll is anonymous IsAnonymous bool `json:"is_anonymous"` // Poll type, currently can be “regular” or “quiz” Type PollType `json:"type"` // True, if the poll allows multiple answers AllowsMultipleAnswers bool `json:"allows_multiple_answers"` // Optional. 0-based identifier of the correct answer option. Available only // for polls in the quiz mode, which are closed, or was sent (not forwarded) // by the bot or to the private chat with the bot. CorrectOptionID int `json:"correct_option_id,omitempty"` // Optional. Text that is shown when a user chooses an incorrect answer or // taps on the lamp icon in a quiz-style poll, 0-200 characters Explanation string `json:"explanation,omitempty"` // Optional. Special entities like usernames, URLs, bot commands, etc. that // appear in the explanation ExplanationEntities []*MessageEntity `json:"explanation_entities,omitempty"` // Optional. Amount of time in seconds the poll will be active after // creation OpenPeriod int `json:"open_period,omitempty"` // Optional. Point in time (Unix timestamp) when the poll will be // automatically closed CloseDate int64 `json:"close_date,omitempty"` }
This object contains information about a poll.
type PollAnswer ¶
type PollAnswer struct { // Unique poll identifier PollID PollID `json:"poll_id"` // The user, who changed the answer to the poll User *User `json:"user"` // 0-based identifiers of answer options, chosen by the user. May be empty // if the user retracted their vote. OptionIDs []int `json:"option_ids"` }
This object represents an answer of a user in a non-anonymous poll.
type PollOption ¶
type PollOption struct { // Option text, 1-100 characters Text string `json:"text"` // Number of users that voted for this option VoterCount int `json:"voter_count"` }
This object contains information about one answer option in a poll.
type PreCheckoutQuery ¶
type PreCheckoutQuery struct { // Unique query identifier ID PreCheckoutQueryID `json:"id"` // User who sent the query From *User `json:"from"` // Three-letter ISO 4217 currency code // https://core.telegram.org/bots/payments#supported-currencies Currency string `json:"currency"` // 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, it shows the number of digits // past the decimal point for each currency (2 for the majority of // currencies). https://core.telegram.org/bots/payments/currencies.json TotalAmount int `json:"total_amount"` // Bot specified invoice payload InvoicePayload string `json:"invoice_payload"` // Optional. Identifier of the shipping option chosen by the user ShippingOptionID ShippingOptionID `json:"shipping_option_id,omitempty"` // Optional. Order info provided by the user OrderInfo *OrderInfo `json:"order_info,omitempty"` }
This object contains information about an incoming pre-checkout query.
type PreCheckoutQueryID ¶
type PreCheckoutQueryID string
type PromoteChatMemberParams ¶
type PromoteChatMemberParams struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // Unique identifier of the target user UserID UserID `json:"user_id"` // Optional. Pass True, if the administrator's presence in the chat is // hidden IsAnonymous bool `json:"is_anonymous,omitempty"` // Optional. Pass 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 CanManageChat bool `json:"can_manage_chat,omitempty"` // Optional. Pass True, if the administrator can create channel posts, // channels only CanPostMessages bool `json:"can_post_messages,omitempty"` // Optional. Pass True, if the administrator can edit messages of other // users and can pin messages, channels only CanEditMessages bool `json:"can_edit_messages,omitempty"` // Optional. Pass True, if the administrator can delete messages of other // users CanDeleteMessages bool `json:"can_delete_messages,omitempty"` // Optional. Pass True, if the administrator can manage video chats CanManageVideoChats bool `json:"can_manage_video_chats,omitempty"` // Optional. Pass True, if the administrator can restrict, ban or unban chat // members CanRestrictMembers bool `json:"can_restrict_members,omitempty"` // Optional. Pass 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 him) CanPromoteMembers bool `json:"can_promote_members,omitempty"` // Optional. Pass True, if the administrator can change chat title, photo // and other settings CanChangeInfo bool `json:"can_change_info,omitempty"` // Optional. Pass True, if the administrator can invite new users to the // chat CanInviteUsers bool `json:"can_invite_users,omitempty"` // Optional. Pass True, if the administrator can pin messages, supergroups // only CanPinMessages bool `json:"can_pin_messages,omitempty"` }
type ProximityAlertTriggered ¶
type ProximityAlertTriggered struct { // User that triggered the alert Traveler *User `json:"traveler"` // User that set the alert Watcher *User `json:"watcher"` // The distance between the users Distance int `json:"distance"` }
This object represents the content of a service message, sent whenever a user in the chat triggers a proximity alert set by another user.
type ReplyKeyboardMarkup ¶
type ReplyKeyboardMarkup struct { // Array of button rows, each represented by an Array of KeyboardButton // objects Keyboard [][]*KeyboardButton `json:"keyboard"` // Optional. 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. ResizeKeyboard bool `json:"resize_keyboard,omitempty"` // Optional. 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. OneTimeKeyboard bool `json:"one_time_keyboard,omitempty"` // Optional. The placeholder to be shown in the input field when the // keyboard is active; 1-64 characters InputFieldPlaceholder string `json:"input_field_placeholder,omitempty"` // Optional. 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 // reply_to_message_id), 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. Selective bool `json:"selective,omitempty"` }
This object represents a custom keyboard with reply options (see Introduction to bots for details and examples). https://core.telegram.org/bots#keyboards
type ReplyKeyboardRemove ¶
type ReplyKeyboardRemove struct { // 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"` // Optional. 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 // reply_to_message_id), 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. Selective bool `json:"selective,omitempty"` }
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 (see ReplyKeyboardMarkup). https://core.telegram.org/bots/api#replykeyboardmarkup
type ReplyMarkup ¶
type ReplyMarkup interface {
// contains filtered or unexported methods
}
type Response ¶ added in v1.1.0
type Response struct { OK bool `json:"ok"` ErrorCode int `json:"error_code,omitempty"` Description string `json:"description,omitempty"` Parameters *ResponseParameters `json:"parameters,omitempty"` Result any `json:"result,omitempty"` }
Response on API request. Used internally by this library.
type ResponseParameters ¶
type ResponseParameters struct { // Optional. The group has been migrated to a supergroup with the specified // identifier. MigrateToChatID ChatID `json:"migrate_to_chat_id,omitempty"` // Optional. In case of exceeding flood control, the number of seconds left // to wait before the request can be repeated RetryAfter int `json:"retry_after,omitempty"` }
Describes why a request was unsuccessful.
*Used internally by this library* https://core.telegram.org/bots/api#responseparameters
type RestrictChatMemberParams ¶
type RestrictChatMemberParams struct { // Unique identifier for the target chat or username of the target // supergroup (in the format @supergroupusername) ChatID ChatIDOrUsername `json:"chat_id"` // Unique identifier of the target user UserID UserID `json:"user_id"` // A JSON-serialized object for new user permissions Permissions *ChatPermissions `json:"permissions"` // Optional. Date when restrictions will be lifted for the user, unix time. // If user is restricted for more than 366 days or less than 30 seconds from // the current time, they are considered to be restricted forever UntilDate int64 `json:"until_date,omitempty"` }
type RevokeChatInviteLinkParams ¶
type RevokeChatInviteLinkParams struct { // Unique identifier of the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // The invite link to revoke InviteLink string `json:"invite_link"` }
type SendAnimationParams ¶
type SendAnimationParams struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // Animation to send. Pass a file_id as String to send an animation that // exists on the Telegram servers (recommended), pass an HTTP URL as a // String for Telegram to get an animation from the Internet, or upload a // new animation using multipart/form-data. More info on Sending Files » // https://core.telegram.org/bots/api#sending-files Animation InputFile `json:"animation"` //Optional. Duration of sent animation in seconds Duration int `json:"duration,omitempty"` // Optional. Animation width Width int `json:"width,omitempty"` // Optional. Animation height Height int `json:"height,omitempty"` // Thumbnail of the file sent; can be ignored if thumbnail generation for // the file is supported server-side. The thumbnail should be in JPEG format // and less than 200 kB in size. A thumbnail's width and height should not // exceed 320. Ignored if the file is not uploaded using // multipart/form-data. Thumbnails can't be reused and can be only uploaded // as a new file, so you can pass “attach://<file_attach_name>” if the // thumbnail was uploaded using multipart/form-data under // <file_attach_name>. More info on Sending Files » // https://core.telegram.org/bots/api#sending-files Thumb InputFile `json:"thumb,omitempty"` // Optional. Animation caption (may also be used when resending animation by // file_id), 0-1024 characters after entities parsing Caption string `json:"caption,omitempty"` // Optional. Mode for parsing entities in the new caption. See formatting // options for more details. // https://core.telegram.org/bots/api#formatting-options ParseMode ParseMode `json:"parse_mode,omitempty"` // Optional. A JSON-serialized list of special entities that appear in the // new caption, which can be specified instead of parse_mode CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"` // Disables automatic server-side content type detection for files uploaded // using multipart/form-data DisableContentTypeDetection bool `json:"disable_content_type_detection,omitempty"` // Optional. Sends the message silently. Users will receive a notification // with no sound. https://telegram.org/blog/channels-2-0#silent-messages DisableNotification bool `json:"disable_notification,omitempty"` // Optional. Protects the contents of the sent message from forwarding and // saving ProtectContent bool `json:"protect_content,omitempty"` // Optional. If the message is a reply, ID of the original message ReplyToMessageID bool `json:"reply_to_message_id,omitempty"` // Optional. Pass True, if the message should be sent even if the specified // replied-to message is not found AllowSendingWithoutReply bool `json:"allow_sending_without_reply,omitempty"` // Optional. Additional interface options. A JSON-serialized object for an // inline keyboard, custom reply keyboard, instructions to remove reply // keyboard or to force a reply from the user. // https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating // https://core.telegram.org/bots#keyboards ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"` }
type SendAudioParams ¶
type SendAudioParams struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // Audio file to send. Pass a file_id as String to send an audio file that // exists on the Telegram servers (recommended), pass an HTTP URL as a // String for Telegram to get an audio file from the Internet, or upload a // new one using multipart/form-data. More info on Sending Files » // https://core.telegram.org/bots/api#sending-files Audio InputFile `json:"audio"` // Optional. Audio caption, 0-1024 characters after entities parsing Caption string `json:"caption,omitempty"` // Optional. Mode for parsing entities in the new caption. See formatting // options for more details. // https://core.telegram.org/bots/api#formatting-options ParseMode ParseMode `json:"parse_mode,omitempty"` // Optional. A JSON-serialized list of special entities that appear in the // new caption, which can be specified instead of parse_mode CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"` // Optional. Duration of the audio in seconds Duration int `json:"duration,omitempty"` // Optional. Performer Performer string `json:"performer,omitempty"` // Track name Title string `json:"title,omitempty"` // Optional. Thumbnail of the file sent; can be ignored if thumbnail // generation for the file is supported server-side. The thumbnail should be // in JPEG format and less than 200 kB in size. A thumbnail's width and // height should not exceed 320. Ignored if the file is not uploaded using // multipart/form-data. Thumbnails can't be reused and can be only uploaded // as a new file, so you can pass "attach://<file_attach_name>" if the // thumbnail was uploaded using multipart/form-data under // <file_attach_name>. More info on Sending Files » // https://core.telegram.org/bots/api#sending-files Thumb InputFile `json:"thumb,omitempty"` // Optional. Sends the message silently. Users will receive a notification // with no sound. https://telegram.org/blog/channels-2-0#silent-messages DisableNotification bool `json:"disable_notification,omitempty"` // Optional. Protects the contents of the sent message from forwarding and // saving ProtectContent bool `json:"protect_content,omitempty"` // Optional. If the message is a reply, ID of the original message ReplyToMessageID bool `json:"reply_to_message_id,omitempty"` // Optional. Pass True, if the message should be sent even if the specified // replied-to message is not found AllowSendingWithoutReply bool `json:"allow_sending_without_reply,omitempty"` // Optional. Additional interface options. A JSON-serialized object for an // inline keyboard, custom reply keyboard, instructions to remove reply // keyboard or to force a reply from the user. // https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating // https://core.telegram.org/bots#keyboards ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"` }
type SendChatActionParams ¶
type SendChatActionParams struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // Type of action to broadcast. Choose one, depending on what the user is // about to receive: typing for text messages, upload_photo for photos, // record_video or upload_video for videos, record_voice or upload_voice for // voice notes, upload_document for general files, choose_sticker for // stickers, find_location for location data, record_video_note or // upload_video_note for video notes. // https://core.telegram.org/bots/api#sendmessage // https://core.telegram.org/bots/api#sendphoto // https://core.telegram.org/bots/api#sendvideo // https://core.telegram.org/bots/api#sendvoice // https://core.telegram.org/bots/api#senddocument // https://core.telegram.org/bots/api#sendsticker // https://core.telegram.org/bots/api#sendlocation // https://core.telegram.org/bots/api#sendvideonote Action ChatAction `json:"action"` }
type SendContactParams ¶
type SendContactParams struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // Contact's phone number PhoneNumber string `json:"phone_number"` // Contact's first name FirstName string `json:"first_name"` // Optional. Contact's last name LastName string `json:"last_name,omitempty"` // Optional. Additional data about the contact in the form of a vCard, // 0-2048 bytes https://en.wikipedia.org/wiki/VCard VCard string `json:"vcard,omitempty"` // Optional. Sends the message silently. Users will receive a notification // with no sound. https://telegram.org/blog/channels-2-0#silent-messages DisableNotification bool `json:"disable_notification,omitempty"` // Optional. Protects the contents of the sent message from forwarding and // saving ProtectContent bool `json:"protect_content,omitempty"` // Optional. If the message is a reply, ID of the original message ReplyToMessageID bool `json:"reply_to_message_id,omitempty"` // Optional. Pass True, if the message should be sent even if the specified // replied-to message is not found AllowSendingWithoutReply bool `json:"allow_sending_without_reply,omitempty"` // Optional. Additional interface options. A JSON-serialized object for an // inline keyboard, custom reply keyboard, instructions to remove reply // keyboard or to force a reply from the user. // https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating // https://core.telegram.org/bots#keyboards ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"` }
type SendDiceParams ¶
type SendDiceParams struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // Optional. Emoji on which the dice throw animation is based. Currently, // must be one of “🎲”, “🎯”, “🏀”, “⚽”, “🎳”, or “🎰”. Dice can have values // 1-6 for “🎲”, “🎯” and “🎳”, values 1-5 for “🏀” and “⚽”, and values 1-64 // for “🎰”. Defaults to “🎲” Emoji DiceEmoji `json:"emoji,omitempty"` // Optional. Sends the message silently. Users will receive a notification // with no sound. https://telegram.org/blog/channels-2-0#silent-messages DisableNotification bool `json:"disable_notification,omitempty"` // Optional. Protects the contents of the sent message from forwarding and // saving ProtectContent bool `json:"protect_content,omitempty"` // Optional. If the message is a reply, ID of the original message ReplyToMessageID bool `json:"reply_to_message_id,omitempty"` // Optional. Pass True, if the message should be sent even if the specified // replied-to message is not found AllowSendingWithoutReply bool `json:"allow_sending_without_reply,omitempty"` // Optional. Additional interface options. A JSON-serialized object for an // inline keyboard, custom reply keyboard, instructions to remove reply // keyboard or to force a reply from the user. // https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating // https://core.telegram.org/bots#keyboards ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"` }
type SendDocumentParams ¶
type SendDocumentParams struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // File to send. Pass a file_id as String to send a file that exists on the // Telegram servers (recommended), pass an HTTP URL as a String for Telegram // to get a file from the Internet, or upload a new one using // multipart/form-data. More info on Sending Files » // // https://core.telegram.org/bots/api#sending-files Document InputFile `json:"document"` // Optional. Thumbnail of the file sent; can be ignored if thumbnail // generation for the file is supported server-side. The thumbnail should be // in JPEG format and less than 200 kB in size. A thumbnail's width and // height should not exceed 320. Ignored if the file is not uploaded using // multipart/form-data. Thumbnails can't be reused and can be only uploaded // as a new file, so you can pass "attach://<file_attach_name>" if the // thumbnail was uploaded using multipart/form-data under // <file_attach_name>. More info on Sending Files » // https://core.telegram.org/bots/api#sending-files Thumb InputFile `json:"thumb,omitempty"` // Optional. Document caption (may also be used when resending documents by // file_id), 0-1024 characters after entities parsing Caption string `json:"caption,omitempty"` // Optional. Mode for parsing entities in the new caption. See formatting // options for more details. // https://core.telegram.org/bots/api#formatting-options ParseMode ParseMode `json:"parse_mode,omitempty"` // Optional. A JSON-serialized list of special entities that appear in the // new caption, which can be specified instead of parse_mode CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"` // Disables automatic server-side content type detection for files uploaded // using multipart/form-data DisableContentTypeDetection bool `json:"disable_content_type_detection,omitempty"` // Optional. Sends the message silently. Users will receive a notification // with no sound. https://telegram.org/blog/channels-2-0#silent-messages DisableNotification bool `json:"disable_notification,omitempty"` // Optional. Protects the contents of the sent message from forwarding and // saving ProtectContent bool `json:"protect_content,omitempty"` // Optional. If the message is a reply, ID of the original message ReplyToMessageID bool `json:"reply_to_message_id,omitempty"` // Optional. Pass True, if the message should be sent even if the specified // replied-to message is not found AllowSendingWithoutReply bool `json:"allow_sending_without_reply,omitempty"` // Optional. Additional interface options. A JSON-serialized object for an // inline keyboard, custom reply keyboard, instructions to remove reply // keyboard or to force a reply from the user. // https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating // https://core.telegram.org/bots#keyboards ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"` }
type SendGameParams ¶
type SendGameParams struct { // Unique identifier for the target chat ChatID ChatID `json:"chat_id"` // Short name of the game, serves as the unique identifier for the game. Set // up your games via Botfather. https://t.me/botfather GameShortName GameShortName `json:"game_short_name"` // Optional. Sends the message silently. Users will receive a notification // with no sound. https://telegram.org/blog/channels-2-0#silent-messages DisableNotification bool `json:"disable_notification,omitempty"` // Optional. Protects the contents of the sent message from forwarding and // saving ProtectContent bool `json:"protect_content,omitempty"` // Optional. If the message is a reply, ID of the original message ReplyToMessageID MessageID `json:"reply_to_message_id,omitempty"` // Optional. Pass True, if the message should be sent even if the specified // replied-to message is not found AllowSendingWithoutReply bool `json:"allow_sending_without_reply,omitempty"` // Optional. A JSON-serialized object for an inline keyboard. If empty, one // 'Play game_title' button will be shown. If not empty, the first button // must launch the game. // https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` }
type SendInvoiceParams ¶
type SendInvoiceParams struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // 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"` // Payments provider token, obtained via Botfather https://t.me/botfather ProviderToken string `json:"provider_token"` // Three-letter ISO 4217 currency code, see more on currencies // https://core.telegram.org/bots/payments#supported-currencies 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"` // Optional. The maximum accepted amount for tips in the smallest units of // the currency (integer, not float/double). For example, for a maximum tip // of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in // currencies.json, it shows the number of digits past the decimal point for // each currency (2 for the majority of currencies). Defaults to 0 // https://core.telegram.org/bots/payments/currencies.json MaxTipAmount int `json:"max_tip_amount,omitempty"` // Optional. A JSON-serialized array of suggested amounts of tips 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. SuggestedTipAmounts []int `json:"suggested_tip_amounts,omitempty"` // Optional. Unique deep-linking parameter. If left empty, forwarded copies // of the sent message will have a Pay button, allowing multiple users to // pay directly from the forwarded message, using the same invoice. If // non-empty, forwarded copies of the sent message will have a URL button // with a deep link to the bot (instead of a Pay button), with the value // used as the start parameter StartParameter string `json:"start_parameter,omitempty"` // Optional. A JSON-serialized data about the invoice, which will be shared // with the payment provider. A detailed description of required fields // should be provided by the payment provider. ProviderData string `json:"provider_data,omitempty"` // Optional. 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. PhotoURL string `json:"photo_url,omitempty"` // Optional. Photo size PhotoSize int `json:"photo_size,omitempty"` // Optional. Photo width PhotoWidth int `json:"photo_width,omitempty"` // Optional. Photo height PhotoHeight int `json:"photo_height,omitempty"` // Optional. Pass True, if you require the user's full name to complete the // order NeedName bool `json:"need_name,omitempty"` // Optional. Pass True, if you require the user's phone number to complete // the order NeedPhoneNumber bool `json:"need_phone_number,omitempty"` // Optional. Pass True, if you require the user's email address to complete // the order NeedEmail bool `json:"need_email,omitempty"` // Optional. Pass True, if you require the user's shipping address to // complete the order NeedShippingAddress bool `json:"need_shipping_address,omitempty"` // Optional. Pass True, if user's phone number should be sent to provider SendPhoneNumberToProvider bool `json:"send_phone_number_to_provider,omitempty"` // Optional. Pass True, if user's email address should be sent to provider SendEmailToProvider bool `json:"send_email_to_provider,omitempty"` // Optional. Pass True, if the final price depends on the shipping method IsFlexible bool `json:"is_flexible,omitempty"` // Optional. Sends the message silently. Users will receive a notification // with no sound. https://telegram.org/blog/channels-2-0#silent-messages DisableNotification bool `json:"disable_notification,omitempty"` // Optional. Protects the contents of the sent message from forwarding and // saving ProtectContent bool `json:"protect_content,omitempty"` // If the message is a reply, ID of the original message ReplyToMessageID MessageID `json:"reply_to_message_id,omitempty"` // Optional. Pass True, if the message should be sent even if the specified // replied-to message is not found AllowSendingWithoutReply bool `json:"allow_sending_without_reply,omitempty"` // Optional. A JSON-serialized object for an inline keyboard. If empty, one // 'Pay `total price`' button will be shown. If not empty, the first button // must be a Pay button. // https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` }
type SendLocationParams ¶
type SendLocationParams struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // Latitude of the location Latitude float64 `json:"latitude"` // Longitude of the location Longitude float64 `json:"longitude"` // Optional. The radius of uncertainty for the location, measured in meters; // 0-1500 HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"` // Optional. Period in seconds for which the location will be updated (see // Live Locations, should be between 60 and 86400. // https://telegram.org/blog/live-locations LivePeriod int `json:"live_period,omitempty"` // Optional. For live locations, a direction in which the user is moving, in // degrees. Must be between 1 and 360 if specified. Heading int `json:"heading,omitempty"` // Optional. For live locations, a maximum distance for proximity alerts // about approaching another chat member, in meters. Must be between 1 and // 100000 if specified. ProximityAlertRadius int `json:"proximity_alert_radius,omitempty"` // Optional. Sends the message silently. Users will receive a notification // with no sound. https://telegram.org/blog/channels-2-0#silent-messages DisableNotification bool `json:"disable_notification,omitempty"` // Optional. Protects the contents of the sent message from forwarding and // saving ProtectContent bool `json:"protect_content,omitempty"` // Optional. If the message is a reply, ID of the original message ReplyToMessageID bool `json:"reply_to_message_id,omitempty"` // Optional. Pass True, if the message should be sent even if the specified // replied-to message is not found AllowSendingWithoutReply bool `json:"allow_sending_without_reply,omitempty"` // Optional. Additional interface options. A JSON-serialized object for an // inline keyboard, custom reply keyboard, instructions to remove reply // keyboard or to force a reply from the user. // https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating // https://core.telegram.org/bots#keyboards ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"` }
type SendMediaGroupParams ¶
type SendMediaGroupParams struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // A JSON-serialized array describing messages to be sent, must include 2-10 // items Media []*InputMedia `json:"media"` // Optional. Sends messages silently. Users will receive a notification with // no sound. https://telegram.org/blog/channels-2-0#silent-messages DisableNotification bool `json:"disable_notification,omitempty"` // Optional. Protects the contents of the sent message from forwarding and // saving ProtectContent bool `json:"protect_content,omitempty"` // Optional. If the message is a reply, ID of the original message ReplyToMessageID bool `json:"reply_to_message_id,omitempty"` // Optional. Pass True, if the message should be sent even if the specified // replied-to message is not found AllowSendingWithoutReply bool `json:"allow_sending_without_reply,omitempty"` }
type SendMessageParams ¶
type SendMessageParams struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // Text of the message to be sent, 1-4096 characters after entities parsing Text string `json:"text"` // Optional. Mode for parsing entities in the message text. See formatting // options for more details. ParseMode ParseMode `json:"parse_mode,omitempty"` // Optional. A JSON-serialized list of special entities that appear in // message text, which can be specified instead of parse_mode Entities []*MessageEntity `json:"entities,omitempty"` // Optional. Disables link previews for links in this message DisableWebPagePreview bool `json:"disable_web_page_preview,omitempty"` // Optional. Sends the message silently. Users will receive a notification // with no sound. https://telegram.org/blog/channels-2-0#silent-messages DisableNotification bool `json:"disable_notification,omitempty"` // Optional. Protects the contents of the sent message from forwarding and // saving ProtectContent bool `json:"protect_content,omitempty"` // Optional. If the message is a reply, ID of the original message ReplyToMessageID MessageID `json:"reply_to_message_id,omitempty"` // Optional. Pass True, if the message should be sent even if the specified // replied-to message is not found AllowSendingWithoutReply bool `json:"allow_sending_without_reply,omitempty"` // Optional. Additional interface options. A JSON-serialized object for an // inline keyboard, custom reply keyboard, instructions to remove reply // keyboard or to force a reply from the user. // https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating // https://core.telegram.org/bots#keyboards ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"` }
type SendPhotoParams ¶
type SendPhotoParams struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // Photo to send. Pass a file_id as String to send a photo that exists on // the Telegram servers (recommended), pass an HTTP URL as a String for // Telegram to get a photo from the Internet, or upload a new photo using // multipart/form-data. The photo must be at most 10 MB in size. The photo's // width and height must not exceed 10000 in total. Width and height ratio // must be at most 20. More info on Sending Files » // https://core.telegram.org/bots/api#sending-files Photo InputFile `json:"photo"` // Optional. Photo caption (may also be used when resending photos by // file_id), 0-1024 characters after entities parsing Caption string `json:"caption,omitempty"` // Optional. Mode for parsing entities in the new caption. See formatting // options for more details. // https://core.telegram.org/bots/api#formatting-options ParseMode ParseMode `json:"parse_mode,omitempty"` // Optional. A JSON-serialized list of special entities that appear in the // new caption, which can be specified instead of parse_mode CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"` // Optional. Sends the message silently. Users will receive a notification // with no sound. https://telegram.org/blog/channels-2-0#silent-messages DisableNotification bool `json:"disable_notification,omitempty"` // Optional. Protects the contents of the sent message from forwarding and // saving ProtectContent bool `json:"protect_content,omitempty"` // Optional. If the message is a reply, ID of the original message ReplyToMessageID bool `json:"reply_to_message_id,omitempty"` // Optional. Pass True, if the message should be sent even if the specified // replied-to message is not found AllowSendingWithoutReply bool `json:"allow_sending_without_reply,omitempty"` // Optional. Additional interface options. A JSON-serialized object for an // inline keyboard, custom reply keyboard, instructions to remove reply // keyboard or to force a reply from the user. // https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating // https://core.telegram.org/bots#keyboards ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"` }
type SendPollParams ¶
type SendPollParams struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // Poll question, 1-300 characters Question string `json:"question"` // A JSON-serialized list of answer options, 2-10 strings 1-100 characters // each Options []string `json:"options"` // Optional. True, if the poll needs to be anonymous, defaults to True IsAnonymous bool `json:"is_anonymous,omitempty"` // Optional. Poll type, “quiz” or “regular”, defaults to “regular” Type PollType `json:"type,omitempty"` // Optional. True, if the poll allows multiple answers, ignored for polls in // quiz mode, defaults to False AllowsMultipleAnswers bool `json:"allows_multiple_answers,omitempty"` // Optional. 0-based identifier of the correct answer option, required for // polls in quiz mode CorrectOptionID int `json:"correct_option_id,omitempty"` // Optional. Text that is shown when a user chooses an incorrect answer or // taps on the lamp icon in a quiz-style poll, 0-200 characters with at most // 2 line feeds after entities parsing Explanation string `json:"explanation,omitempty"` // Optional. Mode for parsing entities in the explanation. See formatting // options for more details. // https://core.telegram.org/bots/api#formatting-options ExplanationParseMode ParseMode `json:"explanation_parse_mode,omitempty"` // Optional. A JSON-serialized list of special entities that appear in the // poll explanation, which can be specified instead of parse_mode ExplanationEntities []*MessageEntity `json:"explanation_entities,omitempty"` // Optional. Amount of time in seconds the poll will be active after // creation, 5-600. Can't be used together with close_date. OpenPeriod int `json:"open_period,omitempty"` // Optional. Point in time (Unix timestamp) when the poll will be // automatically closed. Must be at least 5 and no more than 600 seconds in // the future. Can't be used together with open_period. CloseDate int64 `json:"close_date,omitempty"` // Optional. Pass True, if the poll needs to be immediately closed. This can // be useful for poll preview. IsClosed bool `json:"is_closed,omitempty"` // Optional. Sends the message silently. Users will receive a notification // with no sound. https://telegram.org/blog/channels-2-0#silent-messages DisableNotification bool `json:"disable_notification,omitempty"` // Optional. Protects the contents of the sent message from forwarding and // saving ProtectContent bool `json:"protect_content,omitempty"` // Optional. If the message is a reply, ID of the original message ReplyToMessageID bool `json:"reply_to_message_id,omitempty"` // Optional. Pass True, if the message should be sent even if the specified // replied-to message is not found AllowSendingWithoutReply bool `json:"allow_sending_without_reply,omitempty"` // Optional. Additional interface options. A JSON-serialized object for an // inline keyboard, custom reply keyboard, instructions to remove reply // keyboard or to force a reply from the user. // https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating // https://core.telegram.org/bots#keyboards ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"` }
type SendStickerParams ¶
type SendStickerParams struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // Sticker to send. Pass a file_id as String to send a file that exists on // the Telegram servers (recommended), pass an HTTP URL as a String for // Telegram to get a .WEBP file from the Internet, or upload a new one using // multipart/form-data. More info on Sending Files » // https://core.telegram.org/bots/api#sending-files Sticker InputFile `json:"sticker"` // Optional. Sends the message silently. Users will receive a notification // with no sound. https://telegram.org/blog/channels-2-0#silent-messages DisableNotification bool `json:"disable_notification,omitempty"` // Optional. Protects the contents of the sent message from forwarding and // saving ProtectContent bool `json:"protect_content,omitempty"` // Optional. If the message is a reply, ID of the original message ReplyToMessageID MessageID `json:"reply_to_message_id,omitempty"` // Optional. Pass True, if the message should be sent even if the specified // replied-to message is not found AllowSendingWithoutReply bool `json:"allow_sending_without_reply,omitempty"` // Optional. Additional interface options. A JSON-serialized object for an // inline keyboard, custom reply keyboard, instructions to remove reply // keyboard or to force a reply from the user. // https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating // https://core.telegram.org/bots#keyboards ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"` }
type SendVenueParams ¶
type SendVenueParams struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // Latitude of the venue Latitude float64 `json:"latitude"` // Longitude of the venue Longitude float64 `json:"longitude"` // Name of the venue Title string `json:"title"` // Address of the venue Address string `json:"address"` // Optional. Foursquare identifier of the venue FoursquareID string `json:"foursquare_id,omitempty"` // Optional. Foursquare type of the venue, if known. (For example, // “arts_entertainment/default”, “arts_entertainment/aquarium” or // “food/icecream”.) FoursquareType string `json:"foursquare_type,omitempty"` // Optional. Google Places identifier of the venue GooglePlaceID string `json:"google_place_id,omitempty"` // Optional. Google Places type of the venue. (See supported types.) // https://developers.google.com/places/web-service/supported_types GooglePlaceType string `json:"google_place_type,omitempty"` // Optional. Sends the message silently. Users will receive a notification // with no sound. https://telegram.org/blog/channels-2-0#silent-messages DisableNotification bool `json:"disable_notification,omitempty"` // Optional. Protects the contents of the sent message from forwarding and // saving ProtectContent bool `json:"protect_content,omitempty"` // Optional. If the message is a reply, ID of the original message ReplyToMessageID bool `json:"reply_to_message_id,omitempty"` // Optional. Pass True, if the message should be sent even if the specified // replied-to message is not found AllowSendingWithoutReply bool `json:"allow_sending_without_reply,omitempty"` // Optional. Additional interface options. A JSON-serialized object for an // inline keyboard, custom reply keyboard, instructions to remove reply // keyboard or to force a reply from the user. // https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating // https://core.telegram.org/bots#keyboards ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"` }
type SendVideoNoteParams ¶
type SendVideoNoteParams struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // Video note to send. Pass a file_id as String to send a video note that // exists on the Telegram servers (recommended) or upload a new video using // multipart/form-data. More info on Sending Files ». Sending video notes by // a URL is currently unsupported // https://core.telegram.org/bots/api#sending-files VideoNote InputFile `json:"video_note"` // Optional. Duration of sent video in seconds Duration int `json:"duration,omitempty"` // Optional. Video width and height, i.e. diameter of the video message Length int `json:"length,omitempty"` // Thumbnail of the file sent; can be ignored if thumbnail generation for // the file is supported server-side. The thumbnail should be in JPEG format // and less than 200 kB in size. A thumbnail's width and height should not // exceed 320. Ignored if the file is not uploaded using // multipart/form-data. Thumbnails can't be reused and can be only uploaded // as a new file, so you can pass “attach://<file_attach_name>” if the // thumbnail was uploaded using multipart/form-data under // <file_attach_name>. More info on Sending Files » // https://core.telegram.org/bots/api#sending-files Thumb InputFile `json:"thumb,omitempty"` // Optional. Animation caption (may also be used when resending animation by // file_id), 0-1024 characters after entities parsing Caption string `json:"caption,omitempty"` // Optional. Mode for parsing entities in the new caption. See formatting // options for more details. // https://core.telegram.org/bots/api#formatting-options ParseMode ParseMode `json:"parse_mode,omitempty"` // Optional. A JSON-serialized list of special entities that appear in the // new caption, which can be specified instead of parse_mode CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"` // Disables automatic server-side content type detection for files uploaded // using multipart/form-data DisableContentTypeDetection bool `json:"disable_content_type_detection,omitempty"` // Optional. Sends the message silently. Users will receive a notification // with no sound. https://telegram.org/blog/channels-2-0#silent-messages DisableNotification bool `json:"disable_notification,omitempty"` // Optional. Protects the contents of the sent message from forwarding and // saving ProtectContent bool `json:"protect_content,omitempty"` // Optional. If the message is a reply, ID of the original message ReplyToMessageID bool `json:"reply_to_message_id,omitempty"` // Optional. Pass True, if the message should be sent even if the specified // replied-to message is not found AllowSendingWithoutReply bool `json:"allow_sending_without_reply,omitempty"` // Optional. Additional interface options. A JSON-serialized object for an // inline keyboard, custom reply keyboard, instructions to remove reply // keyboard or to force a reply from the user. // https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating // https://core.telegram.org/bots#keyboards ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"` }
type SendVideoParams ¶
type SendVideoParams struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // Video to send. Pass a file_id as String to send a video that exists on // the Telegram servers (recommended), pass an HTTP URL as a String for // Telegram to get a video from the Internet, or upload a new video using // multipart/form-data. More info on Sending Files » // https://core.telegram.org/bots/api#sending-files Video InputFile `json:"video"` //Optional. Duration of sent video in seconds Duration int `json:"duration,omitempty"` // Optional. Video width Width int `json:"width,omitempty"` // Optional. Video height Height int `json:"height,omitempty"` // Optional. Thumbnail of the file sent; can be ignored if thumbnail // generation for the file is supported server-side. The thumbnail should be // in JPEG format and less than 200 kB in size. A thumbnail's width and // height should not exceed 320. Ignored if the file is not uploaded using // multipart/form-data. Thumbnails can't be reused and can be only uploaded // as a new file, so you can pass "attach://<file_attach_name>" if the // thumbnail was uploaded using multipart/form-data under // <file_attach_name>. More info on Sending Files » // https://core.telegram.org/bots/api#sending-files Thumb InputFile `json:"thumb,omitempty"` // Optional. Video caption (may also be used when resending videos by // file_id), 0-1024 characters after entities parsing Caption string `json:"caption,omitempty"` // Optional. Mode for parsing entities in the new caption. See formatting // options for more details. // https://core.telegram.org/bots/api#formatting-options ParseMode ParseMode `json:"parse_mode,omitempty"` // Optional. A JSON-serialized list of special entities that appear in the // new caption, which can be specified instead of parse_mode CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"` // Disables automatic server-side content type detection for files uploaded // using multipart/form-data DisableContentTypeDetection bool `json:"disable_content_type_detection,omitempty"` // Optional. Sends the message silently. Users will receive a notification // with no sound. https://telegram.org/blog/channels-2-0#silent-messages DisableNotification bool `json:"disable_notification,omitempty"` // Optional. Protects the contents of the sent message from forwarding and // saving ProtectContent bool `json:"protect_content,omitempty"` // Optional. If the message is a reply, ID of the original message ReplyToMessageID bool `json:"reply_to_message_id,omitempty"` // Optional. Pass True, if the message should be sent even if the specified // replied-to message is not found AllowSendingWithoutReply bool `json:"allow_sending_without_reply,omitempty"` // Optional. Additional interface options. A JSON-serialized object for an // inline keyboard, custom reply keyboard, instructions to remove reply // keyboard or to force a reply from the user. // https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating // https://core.telegram.org/bots#keyboards ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"` }
type SendVoiceParams ¶
type SendVoiceParams struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // Audio file to send. Pass a file_id as String to send a file that exists // on the Telegram servers (recommended), pass an HTTP URL as a String for // Telegram to get a file from the Internet, or upload a new one using // multipart/form-data. More info on Sending Files » // https://core.telegram.org/bots/api#sending-files Voice InputFile `json:"voice"` // Optional. Voice message caption, 0-1024 characters after entities parsing Caption string `json:"caption,omitempty"` // Optional. Mode for parsing entities in the new caption. See formatting // options for more details. // https://core.telegram.org/bots/api#formatting-options ParseMode ParseMode `json:"parse_mode,omitempty"` // Optional. Duration of the voice message in seconds Duration int `json:"duration,omitempty"` // Optional. A JSON-serialized list of special entities that appear in the // new caption, which can be specified instead of parse_mode CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"` // Disables automatic server-side content type detection for files uploaded // using multipart/form-data DisableContentTypeDetection bool `json:"disable_content_type_detection,omitempty"` // Optional. Sends the message silently. Users will receive a notification // with no sound. https://telegram.org/blog/channels-2-0#silent-messages DisableNotification bool `json:"disable_notification,omitempty"` // Optional. Protects the contents of the sent message from forwarding and // saving ProtectContent bool `json:"protect_content,omitempty"` // Optional. If the message is a reply, ID of the original message ReplyToMessageID bool `json:"reply_to_message_id,omitempty"` // Optional. Pass True, if the message should be sent even if the specified // replied-to message is not found AllowSendingWithoutReply bool `json:"allow_sending_without_reply,omitempty"` // Optional. Additional interface options. A JSON-serialized object for an // inline keyboard, custom reply keyboard, instructions to remove reply // keyboard or to force a reply from the user. // https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating // https://core.telegram.org/bots#keyboards ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"` }
type SentWebAppMessage ¶
type SentWebAppMessage struct { // Optional. Identifier of the sent inline message. Available only if there // is an inline keyboard attached to the message. // https://core.telegram.org/bots/api#inlinekeyboardmarkup InlineMessageID InlineMessageID `json:"inline_message_id,omitempty"` }
Contains information about an inline message sent by a Web App on behalf of a user. https://core.telegram.org/bots/webapps
type SetChatAdministratorCustomTitleParams ¶
type SetChatAdministratorCustomTitleParams struct { // Unique identifier for the target chat or username of the target // supergroup (in the format @supergroupusername) ChatID ChatIDOrUsername `json:"chat_id"` // Unique identifier of the target user UserID UserID `json:"user_id"` // New custom title for the administrator; 0-16 characters, emoji are not // allowed CustomTitle string `json:"custom_title"` }
type SetChatDescriptionParams ¶
type SetChatDescriptionParams struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // Optional. New chat description, 0-255 characters Description string `json:"description,omitempty"` }
type SetChatMenuButtonParams ¶
type SetChatMenuButtonParams struct { // Optional. Unique identifier for the target private chat. If not // specified, default bot's menu button will be changed ChatID ChatID `json:"chat_id,omitempty"` // Optional. A JSON-serialized object for the new bot's menu button. // Defaults to MenuButtonDefault // https://core.telegram.org/bots/api#menubuttondefault MenuButton *MenuButton `json:"menu_button,omitempty"` }
type SetChatPermissionsParams ¶
type SetChatPermissionsParams struct { // Unique identifier for the target chat or username of the target // supergroup (in the format @supergroupusername) ChatID ChatIDOrUsername `json:"chat_id"` // A JSON-serialized object for new default chat permissions Permissions *ChatPermissions `json:"permissions"` }
type SetChatPhotoParams ¶
type SetChatPhotoParams struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // New chat photo, uploaded using multipart/form-data Photo InputFile `json:"user_id"` }
type SetChatStickerSetParams ¶
type SetChatStickerSetParams struct { // Unique identifier for the target chat or username of the target // supergroup or channel (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // Name of the sticker set to be set as the group sticker set StickerSetName StickerSetName `json:"sticker_set_name"` }
type SetChatTitleParams ¶
type SetChatTitleParams struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // New chat title, 1-255 characters Title string `json:"title"` }
type SetGameScoreParams ¶
type SetGameScoreParams struct { // User identifier UserID UserID `json:"user_id"` // New score, must be non-negative Score int `json:"score"` // Optional. Pass True, if the high score is allowed to decrease. This can // be useful when fixing mistakes or banning cheaters Force bool `json:"force,omitempty"` // Optional. Pass True, if the game message should not be automatically // edited to include the current scoreboard DisableEditMessage bool `json:"disable_edit_message,omitempty"` // Optional. Required if inline_message_id is not specified. Unique // identifier for the target chat ChatID ChatID `json:"chat_id,omitempty"` // Optional. Required if inline_message_id is not specified. Identifier of // the sent message MessageID MessageID `json:"message_id,omitempty"` // Optional. Required if chat_id and message_id are not specified. // Identifier of the inline message InlineMessageID InlineMessageID `json:"inline_message_id,omitempty"` }
type SetMyCommandsParams ¶
type SetMyCommandsParams struct { // A JSON-serialized list of bot commands to be set as the list of the bot's // commands. At most 100 commands can be specified. Commands []*BotCommand `json:"commands"` // Optional. A JSON-serialized object, describing scope of users for which // the commands are relevant. Defaults to BotCommandScopeDefault. // https://core.telegram.org/bots/api#botcommandscopedefault Scope *BotCommandScope `json:"scope,omitempty"` // Optional. A two-letter ISO 639-1 language code. If empty, commands will // be applied to all users from the given scope, for whose language there // are no dedicated commands LanguageCode LanguageCode `json:"language_code,omitempty"` }
type SetMyDefaultAdministratorRightsParams ¶
type SetMyDefaultAdministratorRightsParams struct { // Optional. A JSON-serialized object describing new default administrator // rights. If not specified, the default administrator rights will be // cleared. Rights *ChatAdministratorRights `json:"rights,omitempty"` // Optional. Pass True to change the default administrator rights of the bot // in channels. Otherwise, the default administrator rights of the bot for // groups and supergroups will be changed. ForChannels bool `json:"for_channels,omitempty"` }
type SetPassportDataErrorsParams ¶
type SetPassportDataErrorsParams struct { // User identifier UserID UserID `json:"user_id"` // A JSON-serialized array describing the errors Errors []*PassportElementError `json:"errors"` }
type SetStickerSetThumbParams ¶
type SetStickerSetThumbParams struct { // Sticker set name Name StickerSetName `json:"name"` // User identifier of the sticker set owner UserID UserID `json:"user_id"` // Optional. A PNG image with the thumbnail, must be up to 128 kilobytes in // size and have width and height exactly 100px, or a TGS animation with the // thumbnail up to 32 kilobytes in size; see // https://core.telegram.org/stickers#animated-sticker-requirements for // animated sticker technical requirements, or a WEBM video with the // thumbnail up to 32 kilobytes in size; see // https://core.telegram.org/stickers#video-sticker-requirements for video // sticker technical requirements. Pass a file_id as a String to send a file // that already exists on the Telegram servers, pass an HTTP URL as a String // for Telegram to get a file from the Internet, or upload a new one using // multipart/form-data. More info on Sending Files ». Animated sticker set // thumbnails can't be uploaded via HTTP URL. // https://core.telegram.org/bots/api#sending-files Thumb InputFile `json:"thumb,omitempty"` }
type SetWebhookParams ¶
type SetWebhookParams struct { // HTTPS url to send updates to. Use an empty string to remove webhook // integration URL string `json:"url"` // Optional. Upload your public key certificate so that the root certificate // in use can be checked. See our self-signed guide for details. // https://core.telegram.org/bots/self-signed Certificate InputFile `json:"certificate,omitempty"` // Optional. The fixed IP address which will be used to send webhook // requests instead of the IP address resolved through DNS IPAddress string `json:"ip_address,omitempty"` // Optional. Maximum allowed number of simultaneous HTTPS connections to the // webhook for update delivery, 1-100. Defaults to 40. Use lower values to // limit the load on your bot's server, and higher values to increase your // bot's throughput. MaxConnections int `json:"max_connections,omitempty"` // Optional. A JSON-serialized list of the update types you want your bot to // receive. For example, specify [“message”, “edited_channel_post”, // “callback_query”] to only receive updates of these types. See Update for // a complete list of available update types. Specify an empty list to // receive all update types except chat_member (default). If not specified, // the previous setting will be used. // https://core.telegram.org/bots/api#update Please note that this parameter // doesn't affect updates created before the call to the setWebhook, so // unwanted updates may be received for a short period of time. AllowedUpdates []UpdateType `json:"allowed_updates,omitempty"` // Optional. Pass True to drop all pending updates DropPendingUpdates bool `json:"drop_pending_updates,omitempty"` // Optional. A secret token to be sent in a header // “X-Telegram-Bot-Api-Secret-Token” in every webhook request, 1-256 // characters. Only characters `A-Z`, `a-z`, `0-9`, `_` and `-` are allowed. // The header is useful to ensure that the request comes from a webhook set // by you. SecretToken string `json:"secret_token,omitempty"` }
type ShippingAddress ¶
type ShippingAddress struct { // ISO 3166-1 alpha-2 country code Country_code string `json:"country_code"` // State, if applicable State string `json:"state"` // City City string `json:"city"` // First line for the address StreetLine1 string `json:"street_line1"` // Second line for the address StreetLine2 string `json:"street_line2"` // Address PostCode string `json:"post_code"` }
This object represents a shipping address.
type ShippingOption ¶
type ShippingOption struct { // Shipping option identifier ID ShippingOptionID `json:"id"` // Option title Title string `json:"title"` // List of price portions Prices []*LabeledPrice `json:"prices"` }
This object represents one shipping option.
type ShippingOptionID ¶
type ShippingOptionID string
type ShippingQuery ¶
type ShippingQuery struct { // Unique query identifier ID ShippingQueryID `json:"id"` // User who sent the query From *User `json:"from"` // Bot specified invoice payload InvoicePayload string `json:"invoice_payload"` // User specified shipping address ShippingAddress *ShippingAddress `json:"shipping_address"` }
This object contains information about an incoming shipping query.
type ShippingQueryID ¶
type ShippingQueryID string
type Sticker ¶
type Sticker struct { // Identifier for this file, which can be used to download or reuse the file FileID FileID `json:"file_id"` // 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 FileUniqueID `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 is_animated and is_video. Type StickerType `json:"type"` // Sticker width Width int `json:"width"` // Sticker height Height int `json:"height"` // True, if the sticker is animated // https://telegram.org/blog/animated-stickers IsAnimated bool `json:"is_animated"` // True, if the sticker is a video sticker // https://telegram.org/blog/video-stickers-better-reactions IsVideo bool `json:"is_video"` // Optional. Sticker thumbnail in the .WEBP or .JPG format Thumb *PhotoSize `json:"thumb,omitempty"` // Optional. Emoji associated with the sticker Emoji string `json:"emoji,omitempty"` // Optional. Name of the sticker set to which the sticker belongs SetName StickerSetName `json:"set_name,omitempty"` // Optional. For premium regular stickers, premium animation for the sticker PremiumAnimation *File `json:"premium_animation,omitempty"` // Optional. For mask stickers, the position where the mask should be placed MaskPosition *MaskPosition `json:"mask_position,omitempty"` // Optional. For custom emoji stickers, unique identifier of the custom // emoji CustomEmojiID CustomEmojiID `json:"custom_emoji_id,omitempty"` // Optional. File size in bytes FileSize int64 `json:"file_size,omitempty"` }
This object represents a sticker.
type StickerSet ¶
type StickerSet struct { // Sticker set name Name StickerSetName `json:"name"` // Sticker set title Title string `json:"title"` // Type of stickers in the set, currently one of “regular”, “mask”, // “custom_emoji” StickerType StickerType `json:"sticker_type"` // True, if the sticker set contains animated stickers // https://telegram.org/blog/animated-stickers IsAnimated bool `json:"is_animated"` // True, if the sticker set contains video stickers // https://telegram.org/blog/video-stickers-better-reactions IsVideo bool `json:"is_video"` // List of all set stickers Stickers []*Sticker `json:"stickers"` // Optional. Sticker set thumbnail in the .WEBP, .TGS, or .WEBM format Thumb *PhotoSize `json:"thumb,omitempty"` }
This object represents a sticker set.
type StickerSetName ¶
type StickerSetName string
type StickerType ¶ added in v1.2.0
type StickerType string
const ( StickerTypeRegular StickerType = "regular" StickerTypeMask StickerType = "mask" StickerTypeCustomEmoji StickerType = "custom_emoji" )
type StopMessageLiveLocationParams ¶
type StopMessageLiveLocationParams struct { // Optional. Required if inline_message_id is not specified. Unique // identifier for the target chat or username of the target channel (in the // format @channelusername) ChatID ChatIDOrUsername `json:"chat_id,omitempty"` // Optional. Required if inline_message_id is not specified. Identifier of // the message with live location to stop MessageID MessageID `json:"message_id,omitempty"` // Optional. Required if chat_id and message_id are not specified. // Identifier of the inline message InlineMessageID InlineMessageID `json:"inline_message_id,omitempty"` // Optional. A JSON-serialized object for a new inline keyboard. // https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` }
type StopPollParams ¶
type StopPollParams struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // Identifier of the original message with the poll MessageID MessageID `json:"message_id"` // Optional. A JSON-serialized object for a new message inline keyboard. // https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"` }
type SuccessfulPayment ¶
type SuccessfulPayment struct { // Three-letter ISO 4217 currency code // https://core.telegram.org/bots/payments#supported-currencies Currency string `json:"currency"` // 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, it shows the number of digits // past the decimal point for each currency (2 for the majority of // currencies). https://core.telegram.org/bots/payments/currencies.json TotalAmount int `json:"total_amount"` // Bot specified invoice payload InvoicePayload string `json:"invoice_payload"` // Optional. Identifier of the shipping option chosen by the user ShippingOptionID ShippingOptionID `json:"shipping_option_id,omitempty"` // Optional. Order info provided by the user OrderInfo *OrderInfo `json:"order_info,omitempty"` // Telegram payment identifier TelegramPaymentChargeID string `json:"telegram_payment_charge_id"` // Provider payment identifier ProviderPaymentChargeID string `json:"provider_payment_charge_id"` }
This object contains basic information about a successful payment.
type UnbanChatMemberParams ¶
type UnbanChatMemberParams struct { // Unique identifier for the target group or username of the target // supergroup or channel (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // Unique identifier of the target user UserID UserID `json:"user_id"` // Optional. Do nothing if the user is not banned OnlyIfBanned bool `json:"only_if_banned,omitempty"` }
type UnbanChatSenderChatParams ¶
type UnbanChatSenderChatParams struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // Unique identifier of the target sender chat SenderChatID ChatID `json:"sender_chat_id"` }
type UnpinAllChatMessagesParams ¶
type UnpinAllChatMessagesParams struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` }
type UnpinChatMessageParams ¶
type UnpinChatMessageParams struct { // Unique identifier for the target chat or username of the target channel // (in the format @channelusername) ChatID ChatIDOrUsername `json:"chat_id"` // Optional. Identifier of a message to unpin. If not specified, the most // recent pinned message (by sending date) will be unpinned. MessageID MessageID `json:"message_id,omitempty"` }
type Update ¶
type Update struct { // 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. // https://core.telegram.org/bots/api#setwebhook UpdateID UpdateID `json:"update_id"` // Optional. New incoming message of any kind — text, photo, sticker, etc. Message *Message `json:"message,omitempty"` // Optional. New version of a message that is known to the bot and was // edited EditedMessage *Message `json:"edited_message,omitempty"` // Optional. New incoming channel post of any kind — text, photo, sticker, // etc. ChannelPost *Message `json:"channel_post,omitempty"` // Optional. New version of a channel post that is known to the bot and was // edited EditedChannelPost *Message `json:"edited_channel_post,omitempty"` // Optional. New incoming inline query // https://core.telegram.org/bots/api#inline-mode InlineQuery *InlineQuery `json:"inline_query,omitempty"` // Optional. 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. // https://core.telegram.org/bots/api#inline-mode // https://core.telegram.org/bots/inline#collecting-feedback ChosenInlineResult *ChosenInlineResult `json:"chosen_inline_result,omitempty"` // Optional. New incoming callback query CallbackQuery *CallbackQuery `json:"callback_query,omitempty"` // Optional. New incoming shipping query. Only for invoices with flexible // price ShippingQuery *ShippingQuery `json:"shipping_query,omitempty"` // Optional. New incoming pre-checkout query. Contains full information // about checkout PreCheckoutQuery *PreCheckoutQuery `json:"pre_checkout_query,omitempty"` // Optional. New poll state. Bots receive only updates about stopped polls // and polls, which are sent by the bot Poll *Poll `json:"poll,omitempty"` // Optional. A user changed their answer in a non-anonymous poll. Bots // receive new votes only in polls that were sent by the bot itself. PollAnswer *PollAnswer `json:"poll_answer,omitempty"` // Optional. 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. MyChatMember *ChatMemberUpdated `json:"my_chat_member,omitempty"` // Optional. 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. ChatMember *ChatMemberUpdated `json:"chat_member,omitempty"` // Optional. 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. ChatJoinRequest *ChatJoinRequest `json:"chat_join_request,omitempty"` }
This object represents an incoming update. At most one of the optional parameters can be present in any given update. https://core.telegram.org/bots/api#available-types
https://core.telegram.org/bots/api#update
func ParseWebhookUpdate ¶ added in v1.1.0
Use to parse body from Webhook request, used to receive updates
func SortUpdates ¶
Used internally by StartReceivingUpdates. You can use it in custom update receivers, to sort updates by their UpdateID
type UpdateType ¶
type UpdateType string
const ( UpdateTypeMessage UpdateType = "message" UpdateTypeEditedMessage UpdateType = "edited_message" UpdateTypeChannelPost UpdateType = "channel_post" UpdateTypeEditedChannelPost UpdateType = "edited_channel_post" UpdateTypeInlineQuery UpdateType = "inline_query" UpdateTypeChosenInlineResult UpdateType = "chosen_inline_result" UpdateTypeCallbackQuery UpdateType = "callback_query" UpdateTypeShippingQuery UpdateType = "shipping_query" UpdateTypePreCheckoutQuery UpdateType = "pre_checkout_query" UpdateTypePoll UpdateType = "poll" UpdateTypePollAnswer UpdateType = "poll_answer" UpdateTypeMyChatMember UpdateType = "my_chat_member" UpdateTypeChatMember UpdateType = "chat_member" UpdateTypeChatJoinRequest UpdateType = "chat_join_request" )
type UploadStickerFileParams ¶
type UploadStickerFileParams struct { // User identifier of sticker file owner UserID UserID `json:"user_id"` // PNG image with the sticker, must be up to 512 kilobytes in size, // dimensions must not exceed 512px, and either width or height must be // exactly 512px. More info on Sending Files » // https://core.telegram.org/bots/api#sending-files PNGSticker InputFile `json:"png_sticker"` }
type User ¶
type User struct { // Unique identifier for this user or bot. ID UserID `json:"id"` // True, if this user is a bot IsBot bool `json:"is_bot"` // User's or bot's first name FirstName string `json:"first_name"` // Optional. User's or bot's last name LastName string `json:"last_name,omitempty"` // Optional. User's or bot's username Username Username `json:"username,omitempty"` // Optional. IETF language tag of the user's language // https://en.wikipedia.org/wiki/IETF_language_tag LanguageCode LanguageCode `json:"language_code,omitempty"` // Optional. True, if this user is a Telegram Premium user IsPremium bool `json:"is_premium,omitempty"` // Optional. True, if this user added the bot to the attachment menu AddedToAttachmentMenu bool `json:"added_to_attachment_menu,omitempty"` // Optional. True, if the bot can be invited to groups. Returned only in // getMe. https://core.telegram.org/bots/api#getme CanJoinGroups bool `json:"can_join_groups,omitempty"` // Optional. True, if privacy mode is disabled for the bot. Returned only in // getMe. https://core.telegram.org/bots#privacy-mode // https://core.telegram.org/bots/api#getme CanReadAllGroupMessages bool `json:"can_read_all_group_messages,omitempty"` // Optional. True, if the bot supports inline queries. Returned only in // getMe. https://core.telegram.org/bots/api#getme SupportsInlineQueries bool `json:"supports_inline_queries,omitempty"` }
This object represents a Telegram user or bot.
type UserProfilePhotos ¶
type UserProfilePhotos struct { // Total number of profile pictures the target user has TotalCount int `json:"total_count"` // Requested profile pictures (in up to 4 sizes each) Photos [][]*PhotoSize `json:"photos"` }
This object represent a user's profile pictures.
type Venue ¶
type Venue struct { // Venue location. Can't be a live location Location *Location `json:"location"` // Name of the venue Title string `json:"title"` // Address of the venue Address string `json:"address"` // Optional. Foursquare identifier of the venue Foursquare_id string `json:"foursquare_id,omitempty"` // Optional. Foursquare type of the venue. (For example, // “arts_entertainment/default”, “arts_entertainment/aquarium” or // “food/icecream”.) Foursquare_type string `json:"foursquare_type,omitempty"` // Optional. Google Places identifier of the venue GooglePlaceID string `json:"google_place_id,omitempty"` // Optional. Google Places type of the venue. (See supported types.) // https://developers.google.com/maps/documentation/places/web-service/supported_types GooglePlaceType string `json:"google_place_type,omitempty"` }
This object represents a venue.
type Video ¶
type Video struct { // Identifier for this file, which can be used to download or reuse the file FileID FileID `json:"file_id"` // 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 FileUniqueID `json:"file_unique_id"` // Video width as defined by sender Width int `json:"width"` // Video height as defined by sender Height int `json:"height"` // Duration of the video in seconds as defined by sender Duration int `json:"duration"` // Optional. Video thumbnail Thumb *PhotoSize `json:"thumb,omitempty"` // Optional. Original filename as defined by sender FileName string `json:"file_name,omitempty"` // Optional. Mime type of a file as defined by sender MimeType string `json:"mime_type,omitempty"` // Optional. File size in bytes FileSize int64 `json:"file_size,omitempty"` }
This object represents a video file.
type VideoChatEnded ¶
type VideoChatEnded struct { // Video chat duration in seconds Duration int `json:"duration"` }
This object represents a service message about a video chat ended in the chat.
type VideoChatParticipantsInvited ¶
type VideoChatParticipantsInvited struct { // New members that were invited to the video chat Users []*User `json:"users,omitempty"` }
This object represents a service message about new members invited to a video chat.
https://core.telegram.org/bots/api#videochatparticipantsinvited
type VideoChatScheduled ¶
type VideoChatScheduled struct { // Point in time (Unix timestamp) when the video chat is supposed to be // started by a chat administrator StartDate int64 `json:"start_date"` }
This object represents a service message about a video chat scheduled in the chat.
type VideoChatStarted ¶
type VideoChatStarted struct{}
This object represents a service message about a voice chat started in the chat. Currently holds no information.
type VideoNote ¶
type VideoNote struct { // Identifier for this file, which can be used to download or reuse the file FileID FileID `json:"file_id"` // 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 FileUniqueID `json:"file_unique_id"` // 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"` // Optional. Video thumbnail Thumb *PhotoSize `json:"thumb,omitempty"` // Optional. File size in bytes FileSize int64 `json:"file_size,omitempty"` }
This object represents a video message (available in Telegram apps as of v.4.0). https://telegram.org/blog/video-messages-and-telescope
type Voice ¶
type Voice struct { // Identifier for this file, which can be used to download or reuse the file FileID FileID `json:"file_id"` // 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 FileUniqueID `json:"file_unique_id"` // Duration of the audio in seconds as defined by sender Duration int `json:"duration"` // Optional. MIME type of the file as defined by sender MimeType string `json:"mime_type,omitempty"` // Optional. File size in bytes FileSize int64 `json:"file_size,omitempty"` }
This object represents a voice note.
type WebAppData ¶
type WebAppData struct { // The data. Be aware that a bad client can send arbitrary data in this // field. Data string `json:"data"` // 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"` }
Contains data sent from a Web App to the bot. https://core.telegram.org/bots/webapps
type WebAppInfo ¶
type WebAppInfo struct { // An HTTPS URL of a Web App to be opened with additional data as specified // in Initializing Web Apps // https://core.telegram.org/bots/webapps#initializing-web-apps URL string `json:"url"` }
Contains information about a Web App. https://core.telegram.org/bots/webapps
type WebAppQueryID ¶
type WebAppQueryID string
type WebhookInfo ¶
type WebhookInfo struct { // Webhook URL, may be empty if webhook is not set up URL string `json:"url"` // True, if a custom certificate was provided for webhook certificate checks HasCustomCertificate bool `json:"has_custom_certificate"` // Number of updates awaiting delivery PendingUpdateCount int `json:"pending_update_count"` // Optional. Currently used webhook IP address IPAddress string `json:"ip_address,omitempty"` // Optional. Unix time for the most recent error that happened when trying // to deliver an update via webhook LastErrorDate int64 `json:"last_error_date,omitempty"` // Optional. Error message in human-readable format for the most recent // error that happened when trying to deliver an update via webhook LastErrorMessage string `json:"last_error_message,omitempty"` // Optional. Unix time of the most recent error that happened when trying to // synchronize available updates with Telegram datacenters LastSynchronizationErrorDate int64 `json:"last_synchronization_error_date,omitempty"` // Optional. Maximum allowed number of simultaneous HTTPS connections to the // webhook for update delivery MaxConnections int `json:"max_connections,omitempty"` // Optional. A list of update types the bot is subscribed to. Defaults to // all update types except chat_member AllowedUpdates []UpdateType `json:"allowed_updates,omitempty"` }
Contains information about the current status of a webhook.