telegram

package module
v5.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2021 License: MIT Imports: 19 Imported by: 0

README

GoLang bindings for Telegram Bot API

All-in-one package with a huge range of additional helpers for designing your bot for Telegram. Login widget support included.

Install

go get -u gitlab.com/toby3d/telegram/v5

Use

import "gitlab.com/toby3d/telegram/v5"

  • MyPackBot: bot for collecting and reusing any Telegram-media;

Need help?

Documentation

Overview

Package telegram contains bindings for the Telegram Bot API

Index

Constants

View Source
const (
	ActionFindLocation    string = "find_location"
	ActionRecordVoice     string = "record_voice"
	ActionRecordVideo     string = "record_video"
	ActionRecordVideoNote string = "record_video_note"
	ActionTyping          string = "typing"
	ActionUploadVoice     string = "upload_voice"
	ActionUploadDocument  string = "upload_document"
	ActionUploadPhoto     string = "upload_photo"
	ActionUploadVideo     string = "upload_video"
	ActionUploadVideoNote string = "upload_video_note"
)

Action represents available and supported status actions of bot

View Source
const (
	ChatChannel    string = "channel"
	ChatGroup      string = "group"
	ChatPrivate    string = "private"
	ChatSuperGroup string = "supergroup"
)

Chat represents available and supported chat types

View Source
const (
	CommandHelp     string = "help"
	CommandSettings string = "settings"
	CommandStart    string = "start"
)

Command represents global commands which should be supported by any bot. You can user IsCommandEqual method of Message for checking.

See: https://core.telegram.org/bots#global-commands

View Source
const (
	EntityBold          string = "bold"
	EntityBotCommand    string = "bot_command"
	EntityCashtag       string = "cashtag"
	EntityCode          string = "code"
	EntityEmail         string = "email"
	EntityHashtag       string = "hashtag"
	EntityItalic        string = "italic"
	EntityMention       string = "mention"
	EntityPhoneNumber   string = "phone_number"
	EntityPre           string = "pre"
	EntityStrikethrough string = "strikethrough"
	EntityTextLink      string = "text_link"
	EntityTextMention   string = "text_mention"
	EntityUnderline     string = "underline"
	EntityURL           string = "url"
)

Entity represents available and supported entity types

View Source
const (
	MethodAddStickerToSet                 string = "addStickerToSet"
	MethodAnswerCallbackQuery             string = "answerCallbackQuery"
	MethodAnswerInlineQuery               string = "answerInlineQuery"
	MethodAnswerPreCheckoutQuery          string = "answerPreCheckoutQuery"
	MethodAnswerShippingQuery             string = "answerShippingQuery"
	MethodBanChatMember                   string = "banChatMember"
	MethodClose                           string = "close"
	MethodCopyMessage                     string = "copyMessage"
	MethodCreateChatInviteLink            string = "createChatInviteLink"
	MethodCreateNewStickerSet             string = "createNewStickerSet"
	MethodDeleteChatPhoto                 string = "deleteChatPhoto"
	MethodDeleteChatStickerSet            string = "deleteChatStickerSet"
	MethodDeleteMessage                   string = "deleteMessage"
	MethodDeleteMyCommands                string = "deleteMyCommands"
	MethodDeleteStickerFromSet            string = "deleteStickerFromSet"
	MethodDeleteWebhook                   string = "deleteWebhook"
	MethodEditChatInviteLink              string = "editChatInviteLink"
	MethodEditMessageCaption              string = "editMessageCaption"
	MethodEditMessageLiveLocation         string = "editMessageLiveLocation"
	MethodEditMessageMedia                string = "editMessageMedia"
	MethodEditMessageReplyMarkup          string = "editMessageReplyMarkup"
	MethodEditMessageText                 string = "editMessageText"
	MethodExportChatInviteLink            string = "exportChatInviteLink"
	MethodForwardMessage                  string = "forwardMessage"
	MethodGetChat                         string = "getChat"
	MethodGetChatAdministrators           string = "getChatAdministrators"
	MethodGetChatMember                   string = "getChatMember"
	MethodGetChatMemberCount              string = "getChatMemberCount"
	MethodGetFile                         string = "getFile"
	MethodGetGameHighScores               string = "getGameHighScores"
	MethodGetMe                           string = "getMe"
	MethodGetMyCommands                   string = "getMyCommands"
	MethodGetStickerSet                   string = "getStickerSet"
	MethodGetUpdates                      string = "getUpdates"
	MethodGetUserProfilePhotos            string = "getUserProfilePhotos"
	MethodGetWebhookInfo                  string = "getWebhookInfo"
	MethodLeaveChat                       string = "leaveChat"
	MethodLogOut                          string = "logOut"
	MethodPinChatMessage                  string = "pinChatMessage"
	MethodPromoteChatMember               string = "promoteChatMember"
	MethodRestrictChatMember              string = "restrictChatMember"
	MethodRevokeChatInviteLink            string = "revokeChatInviteLink"
	MethodSendAnimation                   string = "sendAnimation"
	MethodSendAudio                       string = "sendAudio"
	MethodSendChatAction                  string = "sendChatAction"
	MethodSendContact                     string = "sendContact"
	MethodSendDice                        string = "sendDice"
	MethodSendDocument                    string = "sendDocument"
	MethodSendGame                        string = "sendGame"
	MethodSendInvoice                     string = "sendInvoice"
	MethodSendLocation                    string = "sendLocation"
	MethodSendMediaGroup                  string = "sendMediaGroup"
	MethodSendMessage                     string = "sendMessage"
	MethodSendPhoto                       string = "sendPhoto"
	MethodSendPoll                        string = "sendPoll"
	MethodSendSticker                     string = "sendSticker"
	MethodSendVenue                       string = "sendVenue"
	MethodSendVideo                       string = "sendVideo"
	MethodSendVideoNote                   string = "sendVideoNote"
	MethodSendVoice                       string = "sendVoice"
	MethodSetChatAdministratorCustomTitle string = "setChatAdministratorCustomTitle"
	MethodSetChatDescription              string = "setChatDescription"
	MethodSetChatPermissions              string = "setChatPermissions"
	MethodSetChatPhoto                    string = "setChatPhoto"
	MethodSetChatStickerSet               string = "setChatStickerSet"
	MethodSetChatTitle                    string = "setChatTitle"
	MethodSetGameScore                    string = "setGameScore"
	MethodSetMyCommands                   string = "setMyCommands"
	MethodSetPassportDataErrors           string = "setPassportDataErrors"
	MethodSetStickerPositionInSet         string = "setStickerPositionInSet"
	MethodSetStickerSetThumb              string = "setStickerSetThumb"
	MethodSetWebhook                      string = "setWebhook"
	MethodStopMessageLiveLocation         string = "stopMessageLiveLocation"
	MethodStopPoll                        string = "stopPoll"
	MethodUnbanChatMember                 string = "unbanChatMember"
	MethodUnpinAllChatMessages            string = "unpinAllChatMessages"
	MethodUnpinChatMessage                string = "unpinChatMessage"
	MethodUploadStickerFile               string = "uploadStickerFile"
)

Method represents available and supported Telegram API methods

View Source
const (
	ParseModeHTML       string = "HTML"
	ParseModeMarkdown   string = "Markdown"
	ParseModeMarkdownV2 string = "MarkdownV2"
)

Mode represents available and supported parsing modes of messages

View Source
const (
	PointForehead string = "forehead"
	PointEyes     string = "eyes"
	PointMouth    string = "mouth"
	PointChin     string = "chin"
)

Point represent a type of point on face

View Source
const (
	MimeGIF  string = "image/gif"
	MimeHTML string = "text/html"
	MimeJPEG string = "image/jpeg"
	MimeMP4  string = "video/mp4"
	MimePDF  string = "application/pdf"
	MimeZIP  string = "application/zip"
)

Mime represents available and supported MIME types of data

View Source
const (
	SchemeAttach   string = "attach"
	SchemeTelegram string = "tg"
)

Scheme represents optional schemes for URLs

View Source
const (
	StatusAdministrator string = "administrator"
	StatusCreator       string = "creator"
	StatusKicked        string = "kicked"
	StatusLeft          string = "left"
	StatusMember        string = "member"
	StatusRestricted    string = "restricted"
)

Status represents available and supported statuses of ID

View Source
const (
	TypeAddress               string = "address"
	TypeArticle               string = "article"
	TypeAudio                 string = "audio"
	TypeBankStatement         string = "bank_statement"
	TypeContact               string = "contact"
	TypeDocument              string = "document"
	TypeDriverLicense         string = "driver_license"
	TypeEmail                 string = "email"
	TypeGame                  string = "game"
	TypeGIF                   string = "gif"
	TypeIdentityCard          string = "identity_card"
	TypeInternalPassport      string = "internal_passport"
	TypeLocation              string = "location"
	TypeMpeg4Gif              string = "mpeg4_gif"
	TypePassport              string = "passport"
	TypePassportRegistration  string = "passport_registration"
	TypePersonalDetails       string = "personal_details"
	TypePhoneNumber           string = "phone_number"
	TypePhoto                 string = "photo"
	TypeRentalAgreement       string = "rental_agreement"
	TypeSticker               string = "sticker"
	TypeTemporaryRegistration string = "temporary_registration"
	TypeUtilityBill           string = "utility_bill"
	TypeVenue                 string = "venue"
	TypeVideo                 string = "video"
	TypeVoice                 string = "voice"
)

Type represents available and supported types of data

View Source
const (
	UpdateCallbackQuery      string = "callback_query"
	UpdateChannelPost        string = "channel_post"
	UpdateChosenInlineResult string = "chosen_inline_result"
	UpdateEditedChannelPost  string = "edited_channel_post"
	UpdateEditedMessage      string = "edited_message"
	UpdateInlineQuery        string = "inline_query"
	UpdateMessage            string = "message"
	UpdatePoll               string = "poll"
	UpdatePreCheckoutQuery   string = "pre_checkout_query"
	UpdateShippingQuery      string = "shipping_query"
)

Update represents available and supported types of updates

View Source
const (
	DefaultAudioSeparator string = " – "
	DefaultAudioTitle     string = "[untitled]"
)

Default represents a default values for some helpers

View Source
const (
	PollQuiz    string = "quiz"
	PollRegular string = "regular"
)

Poll represents a poll types

View Source
const (
	EmojiBasketball  string = "🏀" // 1-5
	EmojiBowling     string = "🎳" // 1-6
	EmojiDart        string = "🎯" // 1-6
	EmojiGameDie     string = "🎲" // 1-6
	EmojiSlotMachine string = "🎰" // 1-64
	EmojiSoccer      string = "⚽" // 1-5
)

Emoji represents emoji supported by SendDice method

View Source
const (
	// FromAnonymous is a User ID for messages from anonymous group administrators.
	FromAnonymous int64 = 1087968824 // @GroupAnonymousBot
	// FromForwarder is a User ID for messages automatically forwarded to the discussion group.
	FromForwarder int64 = 777000
)
View Source
const Version string = "5.3.0"

Version represents current version of Telegram API supported by this package

Variables

View Source
var ErrNotEqual = errors.New("credentials hash and credentials data hash is not equal")

Functions

This section is empty.

Types

type AddStickerToSet

type AddStickerToSet struct {
	// User identifier of sticker set owner
	UserID int64 `json:"user_id"`

	// Sticker set name
	Name string `json:"name"`

	// 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 »
	PNGSticker *InputFile `json:"png_sticker"`

	// TGS animation with the sticker, uploaded using multipart/form-data.
	// See https://core.telegram.org/animated_stickers#technical-requirements for technical requirements
	TGSSticker *InputFile `json:"tgs_sticker,omitempty"`

	// One or more emoji corresponding to the sticker
	Emojis string `json:"emojis"`

	// A JSON-serialized object for position where the mask should be placed on faces
	MaskPosition *MaskPosition `json:"mask_position,omitempty"`
}

type AlbumMedia

type AlbumMedia interface {
	GetMedia() *InputFile
	// contains filtered or unexported methods
}

type Animation

type Animation struct {
	// Unique file identifier
	FileID string `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 string `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"`

	// Animation thumbnail as defined by sender
	Thumb *PhotoSize `json:"thumb,omitempty"`

	// Original animation filename as defined by sender
	FileName string `json:"file_name,omitempty"`

	// MIME type of the file as defined by sender
	MimeType string `json:"mime_type,omitempty"`

	// File size
	FileSize int `json:"file_size,omitempty"`
}

Animation provide an animation for your game so that it looks stylish in chats (check out Lumberjack for an example). This object represents an animation file to be displayed in the message containing a game.

func (Animation) File

func (a Animation) File() File

func (Animation) HasThumb

func (a Animation) HasThumb() bool

type AnswerCallbackQuery

type AnswerCallbackQuery struct {
	// Unique identifier for the query to be answered
	CallbackQueryID string `json:"callback_query_id"`

	// Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters
	Text string `json:"text,omitempty"`

	// 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.
	//
	// Otherwise, you may use links like t.me/your_bot?start=XXXX that open your bot with a parameter.
	URL string `json:"url,omitempty"`

	// 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"`

	// 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"`
}

AnswerCallbackQuery represents data for AnswerCallbackQuery method.

func NewAnswerCallback

func NewAnswerCallback(callbackQueryID string) AnswerCallbackQuery

type AnswerInlineQuery

type AnswerInlineQuery struct {
	// Unique identifier for the answered query
	InlineQueryID string `json:"inline_query_id"`

	// 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
	SwitchPrivateMessageText 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.
	SwitchPrivateMessageParameter string `json:"switch_pm_parameter,omitempty"`

	// 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"`
}

AnswerInlineQueryParameters represents data for AnswerInlineQuery method.

func NewAnswerInline

func NewAnswerInline(inlineQueryID string, results ...InlineQueryResult) AnswerInlineQuery

type AnswerPreCheckoutQuery

type AnswerPreCheckoutQuery struct {
	// Unique identifier for the query to be answered
	PreCheckoutQueryID string `json:"pre_checkout_query_id"`

	// 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"`

	// 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"`
}

AnswerPreCheckoutQueryParameters represents data for AnswerPreCheckoutQuery method.

func NewAnswerPreCheckout

func NewAnswerPreCheckout(preCheckoutQueryID string, ok bool) AnswerPreCheckoutQuery

type AnswerShippingQuery

type AnswerShippingQuery struct {
	// Unique identifier for the query to be answered
	ShippingQueryID string `json:"shipping_query_id"`

	// 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"`

	// 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"`

	// Required if ok is True. A JSON-serialized array of available shipping options.
	ShippingOptions []*ShippingOption `json:"shipping_options,omitempty"`
}

AnswerShippingQueryParameters represents data for AnswerShippingQuery method.

func NewAnswerShipping

func NewAnswerShipping(shippingQueryID string, ok bool) AnswerShippingQuery

type Audio

type Audio struct {
	// Identifier for this file, which can be used to download or reuse the file
	FileID string `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 string `json:"file_unique_id"`

	// Duration of the audio in seconds as defined by sender
	Duration int `json:"duration"`

	// Performer of the audio as defined by sender or by audio tags
	Performer string `json:"performer,omitempty"`

	// Title of the audio as defined by sender or by audio tags
	Title string `json:"title,omitempty"`

	// Original filename as defined by sender
	FileName string `json:"file_name,omitempty"`

	// MIME type of the file as defined by sender
	MimeType string `json:"mime_type,omitempty"`

	// File size
	FileSize int `json:"file_size,omitempty"`

	// Thumbnail of the album cover to which the music file belongs
	Thumb *PhotoSize `json:"thumb,omitempty"`
}

Audio represents an audio file to be treated as music by the Telegram clients.

func (Audio) File

func (a Audio) File() File

File returns File structure without FilePath parameter.

func (Audio) FullName

func (a Audio) FullName(separator string) (name string)

func (Audio) HasPerformer

func (a Audio) HasPerformer() bool

func (Audio) HasThumb

func (a Audio) HasThumb() bool

func (Audio) HasTitle

func (a Audio) HasTitle() bool

type Auth

type Auth struct {
	// Unique identifier for the b. You can get it from bot token. For example, for the bot token 1234567:4TT8bAc8GHUspu3ERYn-KGcvsvGB9u_n4ddy, the bot id is 1234567.
	BotID int64 `json:"bot_id"`

	// A JSON-serialized object describing the data you want to request
	Scope *PassportScope `json:"scope"`

	// Public key of the bot
	PublicKey string `json:"public_key"`

	// Bot-specified nonce.
	//
	// Important: For security purposes it should be a cryptographically secure unique identifier of the request. In particular, it should be long enough and it should be generated using a cryptographically secure pseudorandom number generator. You should never accept credentials with the same nonce twice.
	Nonce string `json:"nonce"`
}

AuthParameters represent a Telegram Passport auth parameters for SDK.

type BanChatMember added in v5.3.0

type BanChatMember struct {
	ChatID ChatID `json:"chat_id"`

	// Unique identifier of the target user
	UserID int64 `json:"user_id"`

	// 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
	UntilDate int64 `json:"until_date"`

	// 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"`
}

BanChatMember represents data for BanChatMember method.

func NewKick

func NewKick(chatID ChatID, userID int64) BanChatMember

type Bot

type Bot struct {
	*User
	AccessToken string
	Updates     UpdatesChannel
	// contains filtered or unexported fields
}

Bot represents a bot user with access token getted from @BotFather.

func New

func New(accessToken string) (b *Bot, err error)

New creates a new default Bot structure based on the input access token.

func (*Bot) AddStickerToSet

func (b *Bot) AddStickerToSet(p AddStickerToSet) (ok bool, err error)

AddStickerToSet add a new sticker to a set created by the b. Returns True on success.

func (Bot) AnswerCallbackQuery

func (b Bot) AnswerCallbackQuery(p AnswerCallbackQuery) (ok bool, err error)

AnswerCallbackQuery 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.

func (Bot) AnswerInlineQuery

func (b Bot) AnswerInlineQuery(p AnswerInlineQuery) (ok bool, err error)

AnswerInlineQuery send answers to an inline query. On success, True is returned.

No more than 50 results per query are allowed.

func (Bot) AnswerPreCheckoutQuery

func (b Bot) AnswerPreCheckoutQuery(p AnswerShippingQuery) (ok bool, err error)

AnswerPreCheckoutQuery respond to such pre-checkout queries.

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.

func (Bot) AnswerShippingQuery

func (b Bot) AnswerShippingQuery(p AnswerShippingQuery) (ok bool, err error)

AnswerShippingQuery reply to shipping queries.

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 b. On success, True is returned.

func (Bot) BanChatMember added in v5.3.0

func (b Bot) BanChatMember(p BanChatMember) (ok bool, err error)

BanChatMember kick a user from a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the group 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 admin rights. Returns True on success.

Note: In regular groups (non-supergroups), this method will only work if the 'All Members Are Admins' setting is off in the target group. Otherwise members may only be removed by the group's creator or by the member that added them.

func (Bot) Close

func (b Bot) Close() (ok bool, err error)

Close 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 (Bot) CopyMessage

func (b Bot) CopyMessage(p CopyMessage) (*MessageID, error)

CopyMessage copy messages of any kind. The method is analogous to the method forwardMessages, but the copied message doesn't have a link to the original message. Returns the MessageId of the sent message on success.

func (b Bot) CreateChatInviteLink(p CreateChatInviteLink) (*ChatInviteLink, error)

CreateChatInviteLink create an additional invite link for a chat. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. The link can be revoked using the method revokeChatInviteLink. Returns the new invite link as ChatInviteLink object.

func (*Bot) CreateNewStickerSet

func (b *Bot) CreateNewStickerSet(p CreateNewStickerSet) (ok bool, err error)

CreateNewStickerSet create new sticker set owned by a user. The bot will be able to edit the created sticker set. Returns True on success.

func (Bot) DeleteChatPhoto

func (b Bot) DeleteChatPhoto(p DeleteChatPhoto) (ok bool, err error)

DeleteChatPhoto 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 admin rights. Returns True on success.

func (Bot) DeleteChatStickerSet

func (b Bot) DeleteChatStickerSet(p DeleteChatStickerSet) (ok bool, err error)

DeleteChatStickerSet 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 admin 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.

func (Bot) DeleteMessage

func (b Bot) DeleteMessage(p DeleteMessage) (ok bool, err error)

DeleteMessage 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. - 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 (Bot) DeleteMyCommands added in v5.3.0

func (b Bot) DeleteMyCommands(p DeleteMyCommands) (ok bool, err error)

DeleteMyCommands 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.

func (*Bot) DeleteStickerFromSet

func (b *Bot) DeleteStickerFromSet(sticker string) (ok bool, err error)

DeleteStickerFromSet delete a sticker from a set created by the b. Returns True on success.

func (Bot) DeleteWebhook

func (b Bot) DeleteWebhook(p DeleteWebhook) (ok bool, err error)

DeleteWebhook remove webhook integration if you decide to switch back to getUpdates. Returns True on success. Requires no parameters.

func (Bot) Do

func (b Bot) Do(method string, payload interface{}) ([]byte, error)
func (b Bot) EditChatInviteLink(p EditChatInviteLink) (*ChatInviteLink, error)

EditChatInviteLink 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 admin rights. Returns the edited invite link as a ChatInviteLink object.

func (Bot) EditMessageCaption

func (b Bot) EditMessageCaption(p EditMessageCaption) (*Message, error)

EditMessageCaption edit captions of messages sent by the bot or via the bot (for inline bots). On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.

func (Bot) EditMessageLiveLocation

func (b Bot) EditMessageLiveLocation(p EditMessageLiveLocation) (*Message, error)

EditMessageLiveLocation 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 was sent by the bot, the edited Message is returned, otherwise True is returned.

func (Bot) EditMessageMedia

func (b Bot) EditMessageMedia(p EditMessageMedia) (*Message, error)

EditMessageMedia edit audio, document, photo, or video messages. If a message is a part of a message album, then it can be edited only to a photo or a video. Otherwise, message type can be changed arbitrarily. When inline message is edited, new file can't be uploaded. Use previously uploaded file via its file_id or specify a URL. On success, if the edited message was sent by the bot, the edited Message is returned, otherwise True is returned.

func (Bot) EditMessageReplyMarkup

func (b Bot) EditMessageReplyMarkup(p EditMessageReplyMarkup) (*Message, error)

EditMessageReplyMarkup edit only the reply markup of messages sent by the bot or via the bot (for inline bots). On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.

func (Bot) EditMessageText

func (b Bot) EditMessageText(p EditMessageText) (*Message, error)

EditMessageText edit text and game messages sent by the bot or via the bot (for inline bots). On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.

func (b Bot) ExportChatInviteLink(p ExportChatInviteLink) (string, error)

ExportChatInviteLink export an invite link to a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns exported invite link as String on success.

func (Bot) ForwardMessage

func (b Bot) ForwardMessage(p ForwardMessage) (*Message, error)

ForwardMessage forward messages of any kind. On success, the sent Message is returned.

func (Bot) GetChat

func (b Bot) GetChat(p GetChat) (*Chat, error)

GetChat 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.

func (Bot) GetChatAdministrators

func (b Bot) GetChatAdministrators(p GetChatAdministrators) ([]*ChatMember, error)

GetChatAdministrators 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.

func (Bot) GetChatMember

func (b Bot) GetChatMember(p GetChatMember) (*ChatMember, error)

GetChatMember get information about a member of a chat. Returns a ChatMember object on success.

func (Bot) GetChatMemberCount added in v5.3.0

func (b Bot) GetChatMemberCount(p GetChatMemberCount) (int, error)

GetChatMemberCount get the number of members in a chat. Returns Int on success.

func (Bot) GetFile

func (b Bot) GetFile(fid string) (*File, error)

GetFile get basic info 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.

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 (Bot) GetGameHighScores

func (b Bot) GetGameHighScores(p GetGameHighScores) ([]*GameHighScore, error)

GetGameHighScores get data for high score tables. Will return the score of the specified user and several of his neighbors in a game. On success, returns an Array of GameHighScore objects.

func (Bot) GetMe

func (b Bot) GetMe() (*User, error)

GetMe testing your bot's auth token. Returns basic information about the bot in form of a User object.

func (Bot) GetMyCommands

func (b Bot) GetMyCommands(p GetMyCommands) ([]*BotCommand, error)

GetMyCommands get the current list of the bot's commands. Requires no parameters. Returns Array of BotCommand on success.

func (Bot) GetStickerSet

func (b Bot) GetStickerSet(name string) (*StickerSet, error)

GetStickerSet get a sticker set. On success, a StickerSet object is returned.

func (Bot) GetUpdates

func (b Bot) GetUpdates(p *GetUpdates) ([]*Update, error)

GetUpdates receive incoming updates using long polling. An Array of Update objects is returned.

func (Bot) GetUserProfilePhotos

func (b Bot) GetUserProfilePhotos(p GetUserProfilePhotos) (*UserProfilePhotos, error)

GetUserProfilePhotos get a list of profile pictures for a user. Returns a UserProfilePhotos object.

func (Bot) GetWebhookInfo

func (b Bot) GetWebhookInfo() (*WebhookInfo, error)

GetWebhookInfo 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.

func (Bot) IsCommandToMe

func (b Bot) IsCommandToMe(m Message) bool

IsCommandToMe checks that the input message is a command for the current bot.

func (Bot) IsForwardFromMe

func (b Bot) IsForwardFromMe(m Message) bool

IsForwardFromMe checks that the input message is a forwarded message from the current bot.

func (Bot) IsForwardMentionsMe

func (b Bot) IsForwardMentionsMe(m Message) bool

IsForwardMentionsMe checks that the input forwarded message mentions the current bot.

func (Bot) IsMessageFromMe

func (b Bot) IsMessageFromMe(m Message) bool

IsMessageFromMe checks that the input message is a message from the current bot.

func (Bot) IsMessageMentionsMe

func (b Bot) IsMessageMentionsMe(m Message) bool

IsMessageMentionsMe checks that the input message mentions the current bot.

func (Bot) IsMessageToMe

func (b Bot) IsMessageToMe(m Message) bool

IsMessageToMe checks that the input message is addressed to the current b.

func (Bot) IsReplyMentionsMe

func (b Bot) IsReplyMentionsMe(m Message) bool

IsReplyMentionsMe checks that the input message mentions the current b.

func (Bot) IsReplyToMe

func (b Bot) IsReplyToMe(m Message) bool

IsReplyToMe checks that the input message is a reply to the current bot.

func (Bot) LeaveChat

func (b Bot) LeaveChat(p LeaveChat) (ok bool, err error)

LeaveChat leave a group, supergroup or channel. Returns True on success.

func (Bot) LogOut

func (b Bot) LogOut() (ok bool, err error)

LogOut 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 will not be able to log in again using the same token for 10 minutes. Returns True on success. Requires no parameters.

func (Bot) NewFileURL

func (b Bot) NewFileURL(filePath string) *http.URI

NewFileURL creates a fasthttp.URI to file with path getted from GetFile method.

func (*Bot) NewLongPollingChannel

func (b *Bot) NewLongPollingChannel(params *GetUpdates) UpdatesChannel

NewLongPollingChannel creates channel for receive incoming updates using long polling.

func (Bot) NewRedirectURL

func (b Bot) NewRedirectURL(param string, group bool) *http.URI

NewRedirectURL creates new fasthttp.URI for redirecting from one chat to another.

func (*Bot) NewWebhookChannel

func (b *Bot) NewWebhookChannel(u *http.URI, p SetWebhook, ln net.Listener, crt ...string) (UpdatesChannel,
	func() error)

NewWebhookChannel creates channel for receive incoming updates via an outgoing webhook. Returns updates channel and shutdown func.

If cert argument is provided by two strings (["path/to/cert.file", "path/to/cert.key"]), then TLS server will be created by this filepaths.

func (Bot) PinChatMessage

func (b Bot) PinChatMessage(p PinChatMessage) (ok bool, err error)

PinChatMessage pin a message in a group, a supergroup, or a channel. The bot must be an administrator in the chat for this to work and must have the ‘can_pin_messages’ admin right in the supergroup or ‘can_edit_messages’ admin right in the channel. Returns True on success.

func (Bot) PromoteChatMember

func (b Bot) PromoteChatMember(p PromoteChatMember) (ok bool, err error)

PromoteChatMember 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 admin rights. Pass False for all boolean to demote a user. Returns True on success.

func (Bot) RestrictChatMember

func (b Bot) RestrictChatMember(p RestrictChatMember) (ok bool, err error)

restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate admin rights. Pass True for all permissions to lift restrictions from a user. Returns True on success.

func (b Bot) RevokeChatInviteLink(p RevokeChatInviteLink) (*ChatInviteLink, error)

RevokeChatInviteLink 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 admin rights. Returns the revoked invite link as ChatInviteLink object.

func (Bot) SendAnimation

func (b Bot) SendAnimation(p SendAnimation) (*Message, error)

SendAnimation 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.

func (Bot) SendAudio

func (b Bot) SendAudio(p SendAudio) (*Message, error)

SendAudio 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.

func (Bot) SendChatAction

func (b Bot) SendChatAction(p SendChatAction) (ok bool, err error)

SendChatAction 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.

We only recommend using this method when a response from the bot will take a noticeable amount of time to arrive.

func (Bot) SendContact

func (b Bot) SendContact(p SendContact) (*Message, error)

SendContact send phone contacts. On success, the sent Message is returned.

func (Bot) SendDice

func (b Bot) SendDice(p SendDice) (*Message, error)

SendDice send a dice, which will have a random value from 1 to 6. On success, the sent Message is returned. (Yes, we're aware of the “proper” singular of die. But it's awkward, and we decided to help it change. One dice at a time!)

func (Bot) SendDocument

func (b Bot) SendDocument(p SendDocument) (*Message, error)

SendDocument 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.

func (Bot) SendGame

func (b Bot) SendGame(p SendGame) (*Message, error)

SendGame send a game. On success, the sent Message is returned.

func (Bot) SendInvoice

func (b Bot) SendInvoice(p SendInvoice) (*Message, error)

SendInvoice send invoices. On success, the sent Message is returned.

func (Bot) SendLocation

func (b Bot) SendLocation(p SendLocation) (*Message, error)

SendLocation send point on the map. On success, the sent Message is returned.

func (Bot) SendMediaGroup

func (b Bot) SendMediaGroup(p SendMediaGroup) ([]*Message, error)

SendMediaGroup send a group of photos or videos as an album. On success, an array of the sent Messages is returned.

func (Bot) SendMessage

func (b Bot) SendMessage(p SendMessage) (*Message, error)

SendMessage send text messages. On success, the sent Message is returned.

func (Bot) SendPhoto

func (b Bot) SendPhoto(p SendPhoto) (*Message, error)

SendPhoto send photos. On success, the sent Message is returned.

func (Bot) SendPoll

func (b Bot) SendPoll(p SendPoll) (*Message, error)

SendPoll send a native poll. A native poll can't be sent to a private chat. On success, the sent Message is returned.

func (Bot) SendSticker

func (b Bot) SendSticker(p SendSticker) (*Message, error)

SendSticker send .webp stickers. On success, the sent Message is returned.

func (Bot) SendVenue

func (b Bot) SendVenue(p SendVenue) (*Message, error)

SendVenue send information about a venue. On success, the sent Message is returned.

func (Bot) SendVideo

func (b Bot) SendVideo(p SendVideo) (*Message, error)

SendVideo 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.

func (Bot) SendVideoNote

func (b Bot) SendVideoNote(p SendVideoNote) (*Message, error)

SendVideoNote send video messages. On success, the sent Message is returned.

func (Bot) SendVoice

func (b Bot) SendVoice(p SendVoice) (*Message, error)

SendVoice 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.

func (Bot) SetChatAdministratorCustomTitle

func (b Bot) SetChatAdministratorCustomTitle(p SetChatAdministratorCustomTitle) (ok bool, err error)

SetChatAdministratorCustomTitle method to set a custom title for an administrator in a supergroup promoted by the b. Returns True on success.

func (Bot) SetChatDescription

func (b Bot) SetChatDescription(p SetChatDescription) (ok bool, err error)

SetChatDescription 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 admin rights. Returns True on success.

func (Bot) SetChatPermissions

func (b Bot) SetChatPermissions(p SetChatPermissions) (ok bool, err error)

SetChatPermissions 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 admin rights. Returns True on success.

func (Bot) SetChatPhoto

func (b Bot) SetChatPhoto(cid int64, photo *InputFile) (ok bool, err error)

SetChatPhoto 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 admin rights. Returns True on success.

func (Bot) SetChatStickerSet

func (b Bot) SetChatStickerSet(p SetChatStickerSet) (ok bool, err error)

SetChatStickerSet 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 admin 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.

func (Bot) SetChatTitle

func (b Bot) SetChatTitle(p SetChatTitle) (ok bool, err error)

SetChatTitle 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 admin rights. Returns True on success.

func (*Bot) SetClient

func (b *Bot) SetClient(newClient *http.Client)

SetClient allow set custom fasthttp.Client (for proxy traffic, for example).

func (Bot) SetGameScore

func (b Bot) SetGameScore(p SetGameScore) (*Message, error)

SetGameScore set the score of the specified user in a game. On success, if the message was sent by the bot, returns the edited Message, otherwise returns True. Returns an error, if the new score is not greater than the user's current score in the chat and force is False.

func (Bot) SetMyCommands

func (b Bot) SetMyCommands(p SetMyCommands) (ok bool, err error)

SetMyCommands change the list of the bot's commands. Returns True on success.

func (Bot) SetPassportDataErrors

func (b Bot) SetPassportDataErrors(uid int64, errors ...PassportElementError) (ok bool, err error)

SetPassportDataErrors 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 (*Bot) SetStickerPositionInSet

func (b *Bot) SetStickerPositionInSet(sticker string, position int) (ok bool, err error)

SetStickerPositionInSet move a sticker in a set created by the bot to a specific position. Returns True on success.

func (*Bot) SetStickerSetThumb

func (b *Bot) SetStickerSetThumb(p SetStickerSetThumb) (ok bool, err error)

SetStickerSetThumb set the thumbnail of a sticker set. Animated thumbnails can be set for animated sticker sets only. Returns True on success.

func (Bot) SetWebhook

func (b Bot) SetWebhook(p SetWebhook) (ok bool, err error)

SetWebhook 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.

If you'd like to make sure that the Webhook request comes from Telegram, we recommend using a secret path in the URL, e.g. https://www.example.com/<token>. Since nobody else knows your bot‘s token, you can be pretty sure it’s us.

func (Bot) StopMessageLiveLocation

func (b Bot) StopMessageLiveLocation(p StopMessageLiveLocation) (*Message, error)

StopMessageLiveLocation stop updating a live location message before live_period expires. On success, if the message was sent by the bot, the sent Message is returned, otherwise True is returned.

func (Bot) StopPoll

func (b Bot) StopPoll(p StopPoll) (*Poll, error)

StopPoll stop a poll which was sent by the bot. On success, the stopped Poll with the final results is returned.

func (Bot) UnbanChatMember

func (b Bot) UnbanChatMember(p UnbanChatMember) (ok bool, err error)

UnbanChatMember unban a previously kicked 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. Returns True on success.

func (Bot) UnpinAllChatMessages

func (b Bot) UnpinAllChatMessages(p UnpinAllChatMessages) (ok bool, err error)

UnpinChatMessage 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' admin right in a supergroup or 'can_edit_messages' admin right in a channel. Returns True on success.

func (Bot) UnpinChatMessage

func (b Bot) UnpinChatMessage(p UnpinChatMessage) (ok bool, err error)

UnpinChatMessage unpin a message in a group, a supergroup, or a channel. The bot must be an administrator in the chat for this to work and must have the ‘can_pin_messages’ admin right in the supergroup or ‘can_edit_messages’ admin right in the channel. Returns True on success.

func (Bot) Upload

func (b Bot) Upload(method string, payload map[string]string, files ...*InputFile) ([]byte, error)

func (Bot) UploadStickerFile

func (b Bot) UploadStickerFile(uid int, sticker *InputFile) (*File, error)

UploadStickerFile 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.

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, 3-256 characters.
	Description string `json:"description"`
}

BotCommand represents a bot command.

type BotCommandScope added in v5.3.0

type BotCommandScope interface {
	// contains filtered or unexported methods
}

BotCommandScope represents the scope to which bot commands are applied.

type BotCommandScopeAllChatAdministrators added in v5.3.0

type BotCommandScopeAllChatAdministrators struct {
	// Scope type, must be all_chat_administrators
	Type string `json:"type"`
}

BotCommandScopeAllChatAdministrators represents the scope of bot commands, covering all group and supergroup chat administrators.

type BotCommandScopeAllGroupChats added in v5.3.0

type BotCommandScopeAllGroupChats struct {
	// Scope type, must be all_group_chats
	Type string `json:"type"`
}

BotCommandScopeAllGroupChats represents the scope of bot commands, covering all group and supergroup chats.

type BotCommandScopeAllPrivateChats added in v5.3.0

type BotCommandScopeAllPrivateChats struct {
	// Scope type, must be all_private_chats
	Type string `json:"type"`
}

BotCommandScopeAllPrivateChats represents the scope of bot commands, covering all private chats.

type BotCommandScopeChat added in v5.3.0

type BotCommandScopeChat struct {
	// Scope type, must be chat
	Type string `json:"type"`

	// Unique identifier for the target chat or username of the target supergroup (in the format
	// @supergroupusername)
	ChatID ChatID `json:"chat_id"`
}

BotCommandScopeChat represents the scope of bot commands, covering a specific chat.

type BotCommandScopeChatAdministrators added in v5.3.0

type BotCommandScopeChatAdministrators struct {
	// Scope type, must be chat_administrators
	Type string `json:"type"`

	// Unique identifier for the target chat or username of the target supergroup (in the format
	// @supergroupusername)
	ChatID ChatID `json:"chat_id"`
}

BotCommandScopeChatAdministrators represents the scope of bot commands, covering all administrators of a specific group or supergroup chat.

type BotCommandScopeChatMember added in v5.3.0

type BotCommandScopeChatMember struct {
	// Scope type, must be chat_member
	Type string `json:"type"`

	// Unique identifier for the target chat or username of the target supergroup (in the format
	// @supergroupusername)
	ChatID ChatID `json:"chat_id"`

	// Unique identifier of the target user
	UserID int64 `json:"user_id"`
}

BotCommandScopeChatMember represents the scope of bot commands, covering a specific member of a group or supergroup chat.

type BotCommandScopeDefault added in v5.3.0

type BotCommandScopeDefault struct {
	// Scope type, must be default
	Type string `json:"type"`
}

BotCommandScopeDefault represents the default scope of bot commands. Default commands are used if no commands with a narrower scope are specified for the user.

type CallbackGame

type CallbackGame struct{}

CallbackGame a placeholder, currently holds no information. Use BotFather to set up your game.

type CallbackQuery

type CallbackQuery struct {
	// Unique identifier for this query
	ID string `json:"id"`

	// Identifier of the message sent via the bot in inline mode, that originated the query.
	InlineMessageID string `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.
	ChatInstance string `json:"chat_instance"`

	// Data associated with the callback button. Be aware that a bad client can send arbitrary data in this field.
	Data string `json:"data,omitempty"`

	// Short name of a Game to be returned, serves as the unique identifier for the game
	GameShortName string `json:"game_short_name,omitempty"`

	// Sender
	From *User `json:"from"`

	// 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"`
}

CallbackQuery represents an incoming callback query from a callback button in an inline keyboard. If the button that originated the query was attached to a message sent by the bot, the field message will be present. If the button was attached to a message sent via the bot (in inline mode), the field inline_message_id will be present. Exactly one of the fields data or game_short_name will be present.

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 ).

type Chat

type Chat struct {
	// Unique identifier for this chat.
	ID int64 `json:"id"`

	// Type of chat, can be either "private", "group", "supergroup" or "channel"
	Type string `json:"type"`

	// Title, for supergroups, channels and group chats
	Title string `json:"title,omitempty"`

	// Username, for private chats, supergroups and channels if available
	Username string `json:"username,omitempty"`

	// First name of the other party in a private chat
	FirstName string `json:"first_name,omitempty"`

	// Last name of the other party in a private chat
	LastName string `json:"last_name,omitempty"`

	// Chat photo. Returned only in getChat.
	Photo *ChatPhoto `json:"photo,omitempty"`

	// Description, for groups, supergroups and channel chats. Returned only in getChat.
	Description string `json:"description,omitempty"`

	// Chat invite link, for supergroups and channel chats. Returned only in getChat.
	InviteLink string `json:"invite_link,omitempty"`

	// Pinned message, for groups, supergroups and channels. Returned only in getChat.
	PinnedMessage *Message `json:"pinned_message,omitempty"`

	// Default chat member permissions, for groups and supergroups. Returned only in getChat.
	Permissions *ChatPermissions `json:"permissions,omitempty"`

	// For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user. Returned only in getChat.
	SlowModeDelay int `json:"slow_mode_delay,omitempty"`

	// For supergroups, name of Group sticker set. Returned only in getChat.
	StickerSetName string `json:"sticker_set_name,omitempty"`

	// True, if the bot can change group the sticker set. Returned only in getChat.
	CanSetStickerSet bool `json:"can_set_sticker_set,omitempty"`
}

Chat represents a chat.

func (Chat) FullName

func (c Chat) FullName() string

FullName returns the full name of chat or FirstName if LastName is not available.

func (Chat) HasDescription

func (c Chat) HasDescription() bool
func (c Chat) HasInviteLink() bool

func (Chat) HasLastName

func (c Chat) HasLastName() bool

HaveLastName checks what the current user has a LastName.

func (Chat) HasPinnedMessage

func (c Chat) HasPinnedMessage() bool

HasPinnedMessage checks that the current chat has a pinned message.

func (Chat) HasStickerSet

func (c Chat) HasStickerSet() bool

HasStickerSet checks that the current chat has a sticker set.

func (Chat) HasUsername

func (c Chat) HasUsername() bool

HaveUsername checks what the current user has a username.

func (Chat) IsChannel

func (c Chat) IsChannel() bool

IsChannel checks that the current chat is a channel.

func (Chat) IsGroup

func (c Chat) IsGroup() bool

IsGroup checks that the current chat is a group.

func (Chat) IsPrivate

func (c Chat) IsPrivate() bool

IsPrivate checks that the current chat is a private chat with single user.

func (Chat) IsSuperGroup

func (c Chat) IsSuperGroup() bool

IsSuperGroup checks that the current chat is a supergroup.

type ChatID

type ChatID struct {
	ID       int64  `json:"-"`
	Username string `json:"-"` // @channelUsername
}

ChatID is a unique identifier for the target chat or username of the target channel

func (ChatID) MarshalJSON

func (c ChatID) MarshalJSON() ([]byte, error)

MarshalJSON marshals ChatID into single JSON value.

func (ChatID) String

func (c ChatID) String() string
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 the link is primary
	IsPrimary bool `json:"is_primary"`

	// True, if the link is revoked
	IsRevoked bool `json:"is_revoked"`

	// Point in time (Unix timestamp) when the link will expire or has been expired
	ExpireDate int64 `json:"expire_date,omitempty"`

	// 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"`
}

ChatInviteLink represents an invite link for 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"`
}

ChatLocation represents a location to which a chat is connected.

type ChatMember

type ChatMember interface {
	// contains filtered or unexported methods
}

ChatMember contains information about one member of a chat.

type ChatMemberAdministrator added in v5.3.0

type ChatMemberAdministrator struct {
	// The member's status in the chat, always “administrator”
	Status string `json:"status"`

	// Information about the user
	User *User `json:"user"`

	// True, if the bot is allowed to edit administrator privileges of that user
	CanBeEdited bool `json:"can_be_edited"`

	// True, if the user's presence in the chat is hidden
	IsAnonymous bool `json:"is_anonymous"`

	// 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"`

	// True, if the administrator can delete messages of other users
	CanDeleteMessages bool `json:"can_delete_messages"`

	// True, if the administrator can manage voice chats
	CanManageVoiceChats bool `json:"can_manage_voice_chats"`

	// True, if the administrator can restrict, ban or unban chat members
	CanRestrictMembers bool `json:"can_restrict_members"`

	// 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"`

	// True, if the user is allowed to change the chat title, photo and other settings
	CanChangeInfo bool `json:"can_change_info"`

	// True, if the user is allowed to invite new users to the chat
	CanInviteUsers bool `json:"can_invite_users"`

	// True, if the administrator can post in the channel; channels only
	CanPostMessages bool `json:"can_post_messages,omitempty"`

	// 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 pin messages; groups and supergroups only
	CanPinMessages bool `json:"can_pin_messages,omitempty"`

	// Custom title for this user
	CustomTitle string `json:"custom_title,omitempty"`
}

ChatMemberAdministrator represents a chat member that has some additional privileges.

type ChatMemberBanned added in v5.3.0

type ChatMemberBanned struct {
	// The member's status in the chat, always “kicked”
	Status string `json:"status"`

	// Information about the user
	User *User `json:"user"`

	// Date when restrictions will be lifted for this user; unix time. If 0, then the user is banned forever
	UntilDate int64 `json:"until_date"`
}

ChatMemberBanned represents a chat member that was banned in the chat and can't return to the chat or view chat messages.

type ChatMemberLeft added in v5.3.0

type ChatMemberLeft struct {
	// The member's status in the chat, always “left”
	Status string `json:"status"`

	// Information about the user
	User *User `json:"user"`
}

ChatMemberLeft represents a chat member that isn't currently a member of the chat, but may join it themselves.

type ChatMemberMember added in v5.3.0

type ChatMemberMember struct {
	// The member's status in the chat, always “member”
	Status string `json:"status"`

	// Information about the user
	User *User `json:"user"`
}

ChatMemberMember represents a chat member that has no additional privileges or restrictions.

type ChatMemberOwner added in v5.3.0

type ChatMemberOwner struct {
	// The member's status in the chat, always “creator”
	Status string `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"`

	// Custom title for this user
	CustomTitle string `json:"custom_title,omitempty"`
}

ChatMemberOwner represents a chat member that owns the chat and has all administrator privileges.

type ChatMemberRestricted added in v5.3.0

type ChatMemberRestricted struct {
	// The member's status in the chat, always “restricted”
	Status string `json:"status"`

	// Information about the user
	User *User `json:"user"`

	// True, if the user is a member of the chat at the moment of the request
	IsMember bool `json:"is_member"`

	// True, if the user is allowed to change the chat title, photo and other settings
	CanChangeInfo bool `json:"can_change_info"`

	// True, if the user is allowed to invite new users to the chat
	CanInviteUsers bool `json:"can_invite_users"`

	// True, if the user is allowed to pin messages
	CanPinMessages bool `json:"can_pin_messages"`

	// True, if the user is allowed to send text messages, contacts, locations and venues
	CanSendMessages bool `json:"can_send_messages"`

	// True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes
	CanSendMediaMessages bool `json:"can_send_media_messages"`

	// True, if the user is allowed to send polls
	CanSendPolls bool `json:"can_send_polls"`

	// True, if the user is allowed to send animations, games, stickers and use inline bots
	CanSendOtherMessages bool `json:"can_send_other_messages"`

	// True, if the user is allowed to add web page previews to their messages
	CanAddWebPagePreviews bool `json:"can_add_web_page_previews"`

	// Date when restrictions will be lifted for this user; unix time. If 0, then the user is restricted
	// forever
	UntilDate int64 `json:"until_date"`
}

ChatMemberRestricted represents a chat member that is under certain restrictions in the chat. Supergroups only.

type ChatMemberUpdated added in v5.1.0

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"`

	// 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"`
}

ChatMemberUpdated represents changes in the status of a chat member.

type ChatPermissions

type ChatPermissions struct {
	// 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, implies can_send_messages
	CanSendMediaMessages bool `json:"can_send_media_messages,omitempty"`

	// True, if the user is allowed to send polls, implies can_send_messages
	CanSendPolls bool `json:"can_send_polls,omitempty"`

	// 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"`

	// 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"`

	// 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"`

	// True, if the user is allowed to invite new users to the chat
	CanInviteUsers bool `json:"can_invite_users,omitempty"`

	// True, if the user is allowed to pin messages. Ignored in public supergroups
	CanPinMessages bool `json:"can_pin_messages,omitempty"`
}

ChatPermissions 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 string `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 string `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 string `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 string `json:"big_file_unique_id"`
}

ChatPhoto represents a chat photo.

func (ChatPhoto) BigFile

func (p ChatPhoto) BigFile() File

func (ChatPhoto) SmallFile

func (p ChatPhoto) SmallFile() File

type ChosenInlineResult

type ChosenInlineResult struct {
	// The unique identifier for the result that was chosen
	ResultID string `json:"result_id"`

	// 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.
	InlineMessageID string `json:"inline_message_id,omitempty"`

	// The query that was used to obtain the result
	Query string `json:"query"`

	// The user that chose the result
	From *User `json:"from"`

	// Sender location, only for bots that require user location
	Location *Location `json:"location,omitempty"`
}

ChosenInlineResult represents a result of an inline query that was chosen by the user and sent to their chat partner.

func (ChosenInlineResult) HasLocation

func (cir ChosenInlineResult) HasLocation() bool

type Contact

type Contact struct {
	// Contact's phone number
	PhoneNumber string `json:"phone_number"`

	// Contact's first name
	FirstName string `json:"first_name"`

	// Contact's last name
	LastName string `json:"last_name,omitempty"`

	// Contact's user identifier in Telegram
	UserID int64 `json:"user_id,omitempty"`

	// Additional data about the contact in the form of a vCard
	VCard string `json:"vcard,omitempty"`
}

Contact represents a phone contact.

func (Contact) FullName

func (c Contact) FullName() string

FullName returns the full name of contact or FirstName if LastName is not available.

func (Contact) HasLastName

func (c Contact) HasLastName() bool

HaveLastName checks what the current contact has a LastName.

func (Contact) HasVCard

func (c Contact) HasVCard() bool

func (Contact) InTelegram

func (c Contact) InTelegram() bool

type CopyMessage

type CopyMessage struct {
	ChatID ChatID `json:"chat_id"`

	// Unique identifier for the chat where the original message was sent
	FromChatID ChatID `json:"from_chat_id"`

	// Message identifier in the chat specified in from_chat_id
	MessageID int64 `json:"message_id"`

	// New caption for media, 0-1024 characters after entities parsing. If not specified, the original
	// caption is kept
	Caption string `json:"caption,omitempty"`

	// Mode for parsing entities in the new caption. See formatting options for more details.
	ParseMode string `json:"parse_mode,omitempty"`

	// List of special entities that appear in the new caption, which can be specified instead of
	// parse_mode
	CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`

	// Sends the message silently. Users will receive a notification with no sound.
	DisableNotification bool `json:"disable_notification,omitempty"`

	// If the message is a reply, ID of the original message
	ReplyToMessageID int64 `json:"reply_to_message_id,omitempty"`

	// 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"`

	// 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.
	ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"`
}

CopyMessage represents data for CopyMessage method.

type CreateChatInviteLink struct {
	ChatID ChatID `json:"chat_id"`

	// Point in time (Unix timestamp) when the link will expire
	ExpireDate int64 `json:"expire_date,omitempty"`

	// 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"`
}

CreateChatInviteLink represents data for CreateChatInviteLink method.

type CreateNewStickerSet

type CreateNewStickerSet struct {
	// User identifier of created sticker set owner
	UserID int64 `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 string `json:"name"`

	// Sticker set title, 1-64 characters
	Title string `json:"title"`

	// 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.
	PNGSticker *InputFile `json:"png_sticker,omitempty"`

	// TGS animation with the sticker, uploaded using multipart/form-data.
	// See https://core.telegram.org/animated_stickers#technical-requirements for technical requirements
	TGSSticker *InputFile `json:"tgs_sticker,omitempty"`

	// One or more emoji corresponding to the sticker
	Emojis string `json:"emojis"`

	// Pass True, if a set of mask stickers should be created
	ContainsMasks bool `json:"contains_masks,omitempty"`

	// A JSON-serialized object for position where the mask should be placed on faces
	MaskPosition *MaskPosition `json:"mask_position,omitempty"`
}

func NewStickerSet

func NewStickerSet(userID int64, name, title string, pngSticker *InputFile, emojis ...string) CreateNewStickerSet

type Credentials

type Credentials struct {
	// Credentials for encrypted data
	SecureData *SecureData `json:"secure_data"`

	// Bot-specified nonce
	Nonce string `json:"nonce"`
}

Credentials is a JSON-serialized object.

type DataCredentials

type DataCredentials struct {
	// Checksum of encrypted data
	DataHash string `json:"data_hash"`

	// Secret of encrypted data
	Secret string `json:"secret"`
}

DataCredentials can be used to decrypt encrypted data from the data field in EncryptedPassportElement.

type DeleteChatPhoto

type DeleteChatPhoto struct {
	ChatID ChatID `json:"chat_id"`
}

DeleteChatPhoto represents data for DeleteChatPhoto method.

type DeleteChatStickerSet

type DeleteChatStickerSet struct {
	ChatID ChatID `json:"chat_id"`
}

DeleteChatStickerSet represents data for DeleteChatStickerSet method.

type DeleteMessage

type DeleteMessage struct {
	ChatID ChatID `json:"chat_id"`

	// Identifier of the message to delete
	MessageID int64 `json:"message_id"`
}

DeleteMessageParameters represents data for DeleteMessage method.

type DeleteMyCommands added in v5.3.0

type DeleteMyCommands struct {
	// A JSON-serialized object, describing scope of users for which the commands are relevant. Defaults to
	// BotCommandScopeDefault.
	Scope BotCommandScope `json:"scope,omitempty"`

	// 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 string `json:"language_code,omitempty"`
}

DeleteMyCommands represents data for DeleteMyCommands method.

type DeleteStickerFromSet

type DeleteStickerFromSet struct {
	// File identifier of the sticker
	Sticker string `json:"sticker"`
}

DeleteStickerFromSetParameters represents data for DeleteStickerFromSet method.

type DeleteWebhook

type DeleteWebhook struct {
	// 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"`
}

Dice 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 string `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 string `json:"file_unique_id"`

	// Document thumbnail as defined by sender
	Thumb *PhotoSize `json:"thumb,omitempty"`

	// Original filename as defined by sender
	FileName string `json:"file_name,omitempty"`

	// MIME type of the file as defined by sender
	MimeType string `json:"mime_type,omitempty"`

	// File size
	FileSize int `json:"file_size,omitempty"`
}

Document represents a general file (as opposed to photos, voice messages and audio files).

func (Document) File

func (d Document) File() File

func (Document) HasThumb

func (d Document) HasThumb() bool
type EditChatInviteLink struct {
	ChatID ChatID `json:"chat_id"`

	// The invite link to edit
	InviteLink string `json:"invite_link"`

	// Point in time (Unix timestamp) when the link will expire
	ExpireDate int64 `json:"expire_date,omitempty"`

	// 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"`
}

EditChatInviteLink represents data for EditChatInviteLink method.

type EditMessageCaption

type EditMessageCaption struct {
	ChatID ChatID `json:"chat_id,omitempty"`

	// Required if inline_message_id is not specified. Identifier of the sent message
	MessageID int64 `json:"message_id,omitempty"`

	// Required if chat_id and message_id are not specified. Identifier of the inline message
	InlineMessageID string `json:"inline_message_id,omitempty"`

	// New caption of the message
	Caption string `json:"caption,omitempty"`

	// Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
	ParseMode string `json:"parse_mode,omitempty"`

	// List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`

	// A JSON-serialized object for an inline keyboard.
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}

EditMessageCaptionParameters represents data for EditMessageCaption method.

type EditMessageLiveLocation

type EditMessageLiveLocation struct {
	ChatID ChatID `json:"chat_id,omitempty"`

	// Required if inline_message_id is not specified. Identifier of the sent message
	MessageID int64 `json:"message_id,omitempty"`

	// Required if chat_id and message_id are not specified. Identifier of the inline message
	InlineMessageID string `json:"inline_message_id,omitempty"`

	// Latitude of new location
	Latitude float64 `json:"latitude"`

	// Longitude of new location
	Longitude float64 `json:"longitude"`

	// The radius of uncertainty for the location, measured in meters; 0-1500
	HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"`

	// Direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.
	Heading int `json:"heading,omitempty"`

	// 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"`

	// A JSON-serialized object for a new inline keyboard.
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}

EditMessageLiveLocation represents data for EditMessageLiveLocation method.

func NewLiveLocation

func NewLiveLocation(latitude, longitude float64) EditMessageLiveLocation

type EditMessageMedia

type EditMessageMedia struct {
	ChatID ChatID `json:"chat_id,omitempty"`

	// Required if inline_message_id is not specified. Identifier of the sent message
	MessageID int64 `json:"message_id,omitempty"`

	// Required if chat_id and message_id are not specified. Identifier of the inline message
	InlineMessageID string `json:"inline_message_id,omitempty"`

	// A JSON-serialized object for a new media content of the message
	Media InputMedia `json:"media"`

	// A JSON-serialized object for a new inline keyboard.
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}

EditMessageMediaParameters represents data for EditMessageMedia method.

func NewEditMedia

func NewEditMedia(media InputMedia) EditMessageMedia

type EditMessageReplyMarkup

type EditMessageReplyMarkup struct {
	ChatID ChatID `json:"chat_id,omitempty"`

	// Required if inline_message_id is not specified. Identifier of the sent message
	MessageID int64 `json:"message_id,omitempty"`

	// Required if chat_id and message_id are not specified. Identifier of the inline message
	InlineMessageID string `json:"inline_message_id,omitempty"`

	// A JSON-serialized object for an inline keyboard.
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}

EditMessageReplyMarkupParameters represents data for EditMessageReplyMarkup method.

type EditMessageText

type EditMessageText struct {
	ChatID ChatID `json:"chat_id,omitempty"`

	// Required if inline_message_id is not specified. Identifier of the sent message
	MessageID int64 `json:"message_id,omitempty"`

	// Required if chat_id and message_id are not specified. Identifier of the inline message
	InlineMessageID string `json:"inline_message_id,omitempty"`

	// New text of the message
	Text string `json:"text"`

	// Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.
	ParseMode string `json:"parse_mode,omitempty"`

	// List of special entities that appear in the caption, which can be specified instead of parse_mode
	Entities []*MessageEntity `json:"entities,omitempty"`

	// Disables link previews for links in this message
	DisableWebPagePreview bool `json:"disable_web_page_preview,omitempty"`

	// A JSON-serialized object for an inline keyboard.
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}

EditMessageTextParameters represents data for EditMessageText method.

func NewEditText

func NewEditText(text string) EditMessageText

type EncryptedCredentials

type EncryptedCredentials struct {
	// Base64-encoded encrypted JSON-serialized data with unique user's payload, data hashes and secrets required for EncryptedPassportElement decryption and authentication
	Data string `json:"data"`

	// Base64-encoded data hash for data authentication
	Hash string `json:"hash"`

	// Base64-encoded secret, encrypted with the bot's public RSA key, required for data decryption
	Secret string `json:"secret"`
}

EncryptedCredentials contains data required for decrypting and authenticating EncryptedPassportElement. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes.

type EncryptedPassportElement

type EncryptedPassportElement struct {
	// Element type.
	Type string `json:"type"`

	// Base64-encoded encrypted Telegram Passport element data provided by the user, available for "personal_details", "passport", "driver_license", "identity_card", "identity_passport" and "address" types. Can be decrypted and verified using the accompanying EncryptedCredentials.
	Data string `json:"data,omitempty"`

	// User's verified phone number, available only for "phone_number" type
	PhoneNumber string `json:"phone_number,omitempty"`

	// User's verified email address, available only for "email" type
	Email string `json:"email,omitempty"`

	// Array of encrypted files with documents provided by the user, available for "utility_bill", "bank_statement", "rental_agreement", "passport_registration" and "temporary_registration" types. Files can be decrypted and verified using the accompanying EncryptedCredentials.
	Files []*PassportFile `json:"files,omitempty"`

	// Encrypted file with the front side of the document, provided by the user. Available for "passport", "driver_license", "identity_card" and "internal_passport". The file can be decrypted and verified using the accompanying EncryptedCredentials.
	FrontSide *PassportFile `json:"front_side,omitempty"`

	// Encrypted file with the reverse side of the document, provided by the user. Available for "driver_license" and "identity_card". The file can be decrypted and verified using the accompanying EncryptedCredentials.
	ReverseSide *PassportFile `json:"reverse_side,omitempty"`

	// Encrypted file with the selfie of the user holding a document, provided by the user; available for "passport", "driver_license", "identity_card" and "internal_passport". The file can be decrypted and verified using the accompanying EncryptedCredentials.
	Selfie *PassportFile `json:"selfie,omitempty"`

	// Array of encrypted files with translated versions of documents provided by the user. Available if requested for “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials.
	Translation []*PassportFile `json:"translation,omitempty"`

	// Base64-encoded element hash for using in PassportElementErrorUnspecified
	Hash string `json:"hash"`
}

EncryptedPassportElement contains information about documents or other Telegram Passport elements shared with the bot by the user.

type Error

type Error struct {
	Code        int                   `json:"error_code"`
	Description string                `json:"description"`
	Parameters  []*ResponseParameters `json:"parameters,omitempty"`
	// contains filtered or unexported fields
}

func (Error) Error

func (e Error) Error() string

func (Error) Format

func (e Error) Format(s fmt.State, r rune)

func (Error) FormatError

func (e Error) FormatError(p xerrors.Printer) error
type ExportChatInviteLink struct {
	ChatID ChatID `json:"chat_id"`
}

ExportChatInviteLink represents data for ExportChatInviteLink method.

type File

type File struct {
	// Identifier for this file, which can be used to download or reuse the file
	FileID string `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 string `json:"file_unique_id"`

	// File size, if known
	FileSize int `json:"file_size,omitempty"`

	// File path. Use https://api.telegram.org/file/bot<token>/<file_path> to get the file.
	FilePath string `json:"file_path,omitempty"`
}

File 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.

Maximum file size to download is 20 MB

type FileCredentials

type FileCredentials struct {
	// Checksum of encrypted file
	FileHash string `json:"file_hash"`

	// Secret of encrypted file
	Secret string `json:"secret"`
}

FileCredentials can be used to decrypt encrypted files from the front_side, reverse_side, selfie, files and translation fields in EncryptedPassportElement.

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"`

	// The placeholder to be shown in the input field when the reply is active; 1-64 characters
	InputFieldPlaceholder string `json:"input_field_placeholder,omitempty"`

	// 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"`
}

ForceReply display a reply interface to the user (act as if the user has selected the bot‘s message and tapped ’Reply'). This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode.

type ForwardMessage

type ForwardMessage struct {
	ChatID ChatID `json:"chat_id"`

	// Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)
	FromChatID ChatID `json:"from_chat_id"`

	// Sends the message silently. Users will receive a notification with no sound.
	DisableNotification bool `json:"disable_notification,omitempty"`

	// Message identifier in the chat specified in from_chat_id
	MessageID int64 `json:"message_id"`
}

ForwardMessage represents data for ForwardMessage method.

func NewForward

func NewForward(fromChatID, toChatID ChatID, messageID int64) ForwardMessage

type Game

type Game struct {
	// Title of the game
	Title string `json:"title"`

	// Description of the game
	Description string `json:"description"`

	// 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.
	Text string `json:"text,omitempty"`

	// Photo that will be displayed in the game message in chats.
	Photo Photo `json:"photo"`

	// Special entities that appear in text, such as usernames, URLs, bot commands, etc.
	TextEntities []*MessageEntity `json:"text_entities,omitempty"`

	// Animation that will be displayed in the game message in chats. Upload via BotFather
	Animation *Animation `json:"animation,omitempty"`
}

Game represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers.

type GameHighScore

type GameHighScore struct {
	// Position in high score table for the game
	Position int `json:"position"`

	// Score
	Score int `json:"score"`

	// User
	User *User `json:"user"`
}

GameHighScore represents one row of the high scores table for a game.

type GetChat

type GetChat struct {
	ChatID ChatID `json:"chat_id"`
}

GetChat represents data for GetChat method.

type GetChatAdministrators

type GetChatAdministrators struct {
	ChatID ChatID `json:"chat_id"`
}

GetChatAdministrators represents data for GetChatAdministrators method.

type GetChatMember

type GetChatMember struct {
	ChatID ChatID `json:"chat_id"`

	// Unique identifier of the target user
	UserID int64 `json:"user_id"`
}

GetChatMember represents data for GetChatMember method.

type GetChatMemberCount added in v5.3.0

type GetChatMemberCount struct {
	ChatID ChatID `json:"chat_id"`
}

GetChatMemberCount represents data for GetChatMemberCount method.

type GetFile

type GetFile struct {
	// File identifier to get info about
	FileID string `json:"file_id"`
}

GetFile represents data for GetFile method.

type GetGameHighScores

type GetGameHighScores struct {
	// Target user id
	UserID int64 `json:"user_id"`

	// Required if inline_message_id is not specified. Identifier of the sent message
	MessageID int64 `json:"message_id,omitempty"`

	// Required if inline_message_id is not specified. Unique identifier for the target chat
	ChatID int64 `json:"chat_id,omitempty"`

	// Required if chat_id and message_id are not specified. Identifier of the inline message
	InlineMessageID string `json:"inline_message_id,omitempty"`
}

GetGameHighScoresParameters represents data for GetGameHighScores method.

type GetMyCommands added in v5.3.0

type GetMyCommands struct {
	// A JSON-serialized object, describing scope of users. Defaults to BotCommandScopeDefault.
	Scope BotCommandScope `json:"scope,omitempty"`

	// A two-letter ISO 639-1 language code or an empty string
	LanguageCode string `json:"language_code,omitempty"`
}

GetMyCommands represents data for GetMyCommands method.

type GetStickerSet

type GetStickerSet struct {
	// Name of the sticker set
	Name string `json:"name"`
}

GetStickerSetParameters represents data for GetStickerSet method.

type GetUpdates

type GetUpdates struct {
	// 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.
	Offset int64 `json:"offset,omitempty"`

	// Limits the number of updates to be retrieved. Values between 1—100 are accepted. Defaults to 100.
	Limit int `json:"limit,omitempty"`

	// 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"`

	// List the types of updates 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 updates regardless of type (default). If not specified, the previous setting will be used.
	//
	// 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 []string `json:"allowed_updates,omitempty"`
}

GetUpdatesParameters represents data for GetUpdates method.

type GetUserProfilePhotos

type GetUserProfilePhotos struct {
	// Unique identifier of the target user
	UserID int64 `json:"user_id"`

	// Sequential number of the first photo to be returned. By default, all photos are returned.
	Offset int `json:"offset,omitempty"`

	// Limits the number of photos to be retrieved. Values between 1—100 are accepted. Defaults to 100.
	Limit int `json:"limit,omitempty"`
}

GetUserProfilePhotos represents data for GetUserProfilePhotos method.

type IDDocumentData

type IDDocumentData struct {
	// Document number
	DocumentNo string `json:"document_no"`

	// Date of expiry, in DD.MM.YYYY format
	ExpiryDate string `json:"expiry_date,omitempty"`
}

IDDocumentData represents the data of an identity document.

type InlineKeyboardButton

type InlineKeyboardButton struct {
	// Label text on the button
	Text string `json:"text"`

	// HTTP url to be opened when button is pressed
	URL string `json:"url,omitempty"`

	// An HTTP URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget.
	LoginURL *LoginURL `json:"login_url,omitempty"`

	// Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes
	CallbackData string `json:"callback_data,omitempty"`

	// 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.
	SwitchInlineQuery string `json:"switch_inline_query,omitempty"`

	// 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"`

	// 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"`

	// Specify True, to send a Pay button.
	//
	// NOTE: This type of button must always be the first button in the first row.
	Pay bool `json:"pay,omitempty"`
}

InlineKeyboardButton represents one button of an inline keyboard. You must use exactly one of the optional fields.

func NewInlineKeyboardButton

func NewInlineKeyboardButton(text, data string) *InlineKeyboardButton

func NewInlineKeyboardButtonSwitch

func NewInlineKeyboardButtonSwitch(text, sw string) *InlineKeyboardButton

func NewInlineKeyboardButtonSwitchSelf

func NewInlineKeyboardButtonSwitchSelf(text, sw string) *InlineKeyboardButton

func NewInlineKeyboardButtonURL

func NewInlineKeyboardButtonURL(text, url string) *InlineKeyboardButton

func NewInlineKeyboardRow

func NewInlineKeyboardRow(buttons ...*InlineKeyboardButton) []*InlineKeyboardButton

type InlineKeyboardMarkup

type InlineKeyboardMarkup struct {
	// Array of button rows, each represented by an Array of InlineKeyboardButton objects
	InlineKeyboard [][]*InlineKeyboardButton `json:"inline_keyboard"`
}

InlineKeyboardMarkup represents an inline keyboard that appears right next to the message it belongs to.

func NewInlineKeyboardMarkup

func NewInlineKeyboardMarkup(rows ...[]*InlineKeyboardButton) InlineKeyboardMarkup

type InlineQuery

type InlineQuery struct {
	// Unique identifier for this query
	ID string `json:"id"`

	// Text of the query (up to 512 characters)
	Query string `json:"query"`

	// Offset of the results to be returned, can be controlled by the bot
	Offset string `json:"offset"`

	// Sender
	From *User `json:"from"`

	// 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 string `json:"chat_type,omitempty"`

	// Sender location, only for bots that request user location
	Location *Location `json:"location,omitempty"`
}

InlineQuery represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results.

func (InlineQuery) HasLocation

func (iq InlineQuery) HasLocation() bool

func (InlineQuery) HasOffset

func (iq InlineQuery) HasOffset() bool

func (InlineQuery) HasQuery

func (iq InlineQuery) HasQuery() bool

type InlineQueryResult

type InlineQueryResult interface {
	IsCached() bool
}

InlineQueryResult represents one result of an inline query.

type InlineQueryResultArticle

type InlineQueryResultArticle struct {
	// Type of the result, must be article
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 Bytes
	ID string `json:"id"`

	// Title of the result
	Title string `json:"title"`

	// URL of the result
	URL string `json:"url,omitempty"`

	// Short description of the result
	Description string `json:"description,omitempty"`

	// Url of the thumbnail for the result
	ThumbURL string `json:"thumb_url,omitempty"`

	// Content of the message to be sent
	InputMessageContent InputMessageContent `json:"input_message_content"`

	// Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

	// Pass True, if you don't want the URL to be shown in the message
	HideURL bool `json:"hide_url,omitempty"`

	// Thumbnail width
	ThumbWidth int `json:"thumb_width,omitempty"`

	// Thumbnail height
	ThumbHeight int `json:"thumb_height,omitempty"`
}

InlineQueryResultArticle represents a link to an article or web page.

func NewInlineQueryResultArticle

func NewInlineQueryResultArticle(id, title string, content InputMessageContent) InlineQueryResultArticle

func (InlineQueryResultArticle) IsCached

func (InlineQueryResultArticle) IsCached() bool

type InlineQueryResultAudio

type InlineQueryResultAudio struct {
	// Type of the result, must be audio
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 bytes
	ID string `json:"id"`

	// A valid URL for the audio file
	AudioURL string `json:"audio_url"`

	// Title
	Title string `json:"title"`

	// Caption, 0-200 characters
	Caption string `json:"caption,omitempty"`

	// Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline
	// URLs in the media caption.
	ParseMode string `json:"parse_mode,omitempty"`

	// List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`

	// Performer
	Performer string `json:"performer,omitempty"`

	// Audio duration in seconds
	AudioDuration int `json:"audio_duration,omitempty"`

	// Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

	// Content of the message to be sent instead of the audio
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}

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.

func NewInlineQueryResultAudio

func NewInlineQueryResultAudio(id, title, audio string) InlineQueryResultAudio

func (InlineQueryResultAudio) IsCached

func (InlineQueryResultAudio) IsCached() bool

type InlineQueryResultCachedAudio

type InlineQueryResultCachedAudio struct {
	// Type of the result, must be audio
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 bytes
	ID string `json:"id"`

	// A valid file identifier for the audio file
	AudioFileID string `json:"audio_file_id"`

	// Caption, 0-200 characters
	Caption string `json:"caption,omitempty"`

	// Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline
	// URLs in the media caption.
	ParseMode string `json:"parse_mode,omitempty"`

	// List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`

	// Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

	// Content of the message to be sent instead of the audio
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}

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.

func NewInlineQueryResultCachedAudio

func NewInlineQueryResultCachedAudio(id, file string) InlineQueryResultCachedAudio

func (InlineQueryResultCachedAudio) IsCached

type InlineQueryResultCachedDocument

type InlineQueryResultCachedDocument struct {
	// Type of the result, must be document
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 bytes
	ID string `json:"id"`

	// Title for the result
	Title string `json:"title"`

	// A valid file identifier for the file
	DocumentFileID string `json:"document_file_id"`

	// Short description of the result
	Description string `json:"description,omitempty"`

	// Caption of the document to be sent, 0-200 characters
	Caption string `json:"caption,omitempty"`

	// Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline
	// URLs in the media caption.
	ParseMode string `json:"parse_mode,omitempty"`

	// List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`

	// Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

	// Content of the message to be sent instead of the file
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}

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.

func NewInlineQueryResultCachedDocument

func NewInlineQueryResultCachedDocument(id, title, file string) InlineQueryResultCachedDocument

func (InlineQueryResultCachedDocument) IsCached

type InlineQueryResultCachedGif

type InlineQueryResultCachedGif struct {
	// Type of the result, must be gif
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 bytes
	ID string `json:"id"`

	// A valid file identifier for the GIF file
	GifFileID string `json:"gif_file_id"`

	// Title for the result
	Title string `json:"title,omitempty"`

	// Caption of the GIF file to be sent, 0-200 characters
	Caption string `json:"caption,omitempty"`

	// Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline
	// URLs in the media caption.
	ParseMode string `json:"parse_mode,omitempty"`

	// List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`

	// Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

	// Content of the message to be sent instead of the GIF animation
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}

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.

func NewInlineQueryResultCachedGif

func NewInlineQueryResultCachedGif(id, file string) InlineQueryResultCachedGif

func (InlineQueryResultCachedGif) IsCached

func (InlineQueryResultCachedGif) IsCached() bool

type InlineQueryResultCachedMpeg4Gif

type InlineQueryResultCachedMpeg4Gif struct {
	// Type of the result, must be mpeg4_gif
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 bytes
	ID string `json:"id"`

	// A valid file identifier for the MP4 file
	Mpeg4FileID string `json:"mpeg4_file_id"`

	// Title for the result
	Title string `json:"title,omitempty"`

	// Caption of the MPEG-4 file to be sent, 0-200 characters
	Caption string `json:"caption,omitempty"`

	// Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline
	// URLs in the media caption.
	ParseMode string `json:"parse_mode,omitempty"`

	// List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`

	// Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

	// Content of the message to be sent instead of the video animation
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}

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.

func NewInlineQueryResultCachedMpeg4Gif

func NewInlineQueryResultCachedMpeg4Gif(id, file string) InlineQueryResultCachedMpeg4Gif

func (InlineQueryResultCachedMpeg4Gif) IsCached

type InlineQueryResultCachedPhoto

type InlineQueryResultCachedPhoto struct {
	// Type of the result, must be photo
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 bytes
	ID string `json:"id"`

	// A valid file identifier of the photo
	PhotoFileID string `json:"photo_file_id"`

	// Title for the result
	Title string `json:"title,omitempty"`

	// Short description of the result
	Description string `json:"description,omitempty"`

	// Caption of the photo to be sent, 0-200 characters
	Caption string `json:"caption,omitempty"`

	// Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline
	// URLs in the media caption.
	ParseMode string `json:"parse_mode,omitempty"`

	// List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`

	// Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

	// Content of the message to be sent instead of the photo
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}

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.

func NewInlineQueryResultCachedPhoto

func NewInlineQueryResultCachedPhoto(id, file string) InlineQueryResultCachedPhoto

func (InlineQueryResultCachedPhoto) IsCached

type InlineQueryResultCachedSticker

type InlineQueryResultCachedSticker struct {
	// Type of the result, must be sticker
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 bytes
	ID string `json:"id"`

	// A valid file identifier of the sticker
	StickerFileID string `json:"sticker_file_id"`

	// Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

	// Content of the message to be sent instead of the sticker
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}

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.

func NewInlineQueryResultCachedSticker

func NewInlineQueryResultCachedSticker(id, file string) InlineQueryResultCachedSticker

func (InlineQueryResultCachedSticker) IsCached

type InlineQueryResultCachedVideo

type InlineQueryResultCachedVideo struct {
	// Type of the result, must be video
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 bytes
	ID string `json:"id"`

	// A valid file identifier for the video file
	VideoFileID string `json:"video_file_id"`

	// Title for the result
	Title string `json:"title"`

	// Short description of the result
	Description string `json:"description,omitempty"`

	// Caption of the video to be sent, 0-200 characters
	Caption string `json:"caption,omitempty"`

	// Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline
	// URLs in the media caption.
	ParseMode string `json:"parse_mode,omitempty"`

	// List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`

	// Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

	// Content of the message to be sent instead of the video
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}

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.

func NewInlineQueryResultCachedVideo

func NewInlineQueryResultCachedVideo(id, title, file string) InlineQueryResultCachedVideo

func (InlineQueryResultCachedVideo) IsCached

type InlineQueryResultCachedVoice

type InlineQueryResultCachedVoice struct {
	// Type of the result, must be voice
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 bytes
	ID string `json:"id"`

	// A valid file identifier for the voice message
	VoiceFileID string `json:"voice_file_id"`

	// Voice message title
	Title string `json:"title"`

	// Caption, 0-200 characters
	Caption string `json:"caption,omitempty"`

	// Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline
	// URLs in the media caption.
	ParseMode string `json:"parse_mode,omitempty"`

	// List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`

	// Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

	// Content of the message to be sent instead of the voice message
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}

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.

func NewInlineQueryResultCachedVoice

func NewInlineQueryResultCachedVoice(id, title, file string) InlineQueryResultCachedVoice

func (InlineQueryResultCachedVoice) IsCached

type InlineQueryResultContact

type InlineQueryResultContact struct {
	// Type of the result, must be contact
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 Bytes
	ID string `json:"id"`

	// Contact's phone number
	PhoneNumber string `json:"phone_number"`

	// Contact's first name
	FirstName string `json:"first_name"`

	// Contact's last name
	LastName string `json:"last_name,omitempty"`

	// Additional data about the contact in the form of a vCard, 0-2048 bytes
	VCard string `json:"vcard,omitempty"`

	// Url of the thumbnail for the result
	ThumbURL string `json:"thumb_url,omitempty"`

	// Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

	// Content of the message to be sent instead of the contact
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`

	// Thumbnail width
	ThumbWidth int `json:"thumb_width,omitempty"`

	// Thumbnail height
	ThumbHeight int `json:"thumb_height,omitempty"`
}

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.

func NewInlineQueryResultContact

func NewInlineQueryResultContact(id, phone, name string) InlineQueryResultContact

func (InlineQueryResultContact) IsCached

func (InlineQueryResultContact) IsCached() bool

type InlineQueryResultDocument

type InlineQueryResultDocument struct {
	// Type of the result, must be document
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 bytes
	ID string `json:"id"`

	// Title for the result
	Title string `json:"title"`

	// Caption of the document to be sent, 0-200 characters
	Caption string `json:"caption,omitempty"`

	// Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline
	// URLs in the media caption.
	ParseMode string `json:"parse_mode,omitempty"`

	// List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`

	// A valid URL for the file
	DocumentURL string `json:"document_url"`

	// Mime type of the content of the file, either "application/pdf" or "application/zip"
	MimeType string `json:"mime_type"`

	// Short description of the result
	Description string `json:"description,omitempty"`

	// URL of the thumbnail (jpeg only) for the file
	ThumbURL string `json:"thumb_url,omitempty"`

	// Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

	// Content of the message to be sent instead of the file
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`

	// Thumbnail width
	ThumbWidth int `json:"thumb_width,omitempty"`

	// Thumbnail height
	ThumbHeight int `json:"thumb_height,omitempty"`
}

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.

func NewInlineQueryResultDocument

func NewInlineQueryResultDocument(id, title, mime, document string) InlineQueryResultDocument

func (InlineQueryResultDocument) IsCached

func (InlineQueryResultDocument) IsCached() bool

type InlineQueryResultGame

type InlineQueryResultGame struct {
	// Type of the result, must be game
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 bytes
	ID string `json:"id"`

	// Short name of the game
	GameShortName string `json:"game_short_name"`

	// Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}

InlineQueryResultGame represents a Game.

func NewInlineQueryResultGame

func NewInlineQueryResultGame(id, shortName string) InlineQueryResultGame

func (InlineQueryResultGame) IsCached

func (InlineQueryResultGame) IsCached() bool

type InlineQueryResultGif

type InlineQueryResultGif struct {
	// Type of the result, must be gif
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 bytes
	ID string `json:"id"`

	// A valid URL for the GIF file. File size must not exceed 1MB
	GifURL string `json:"gif_url"`

	// Width of the GIF
	GifWidth int `json:"gif_width,omitempty"`

	// Height of the GIF
	GifHeight int `json:"gif_height,omitempty"`

	// Duration of the GIF
	GifDuration int `json:"gif_duration,omitempty"`

	// URL of the static thumbnail for the result (jpeg or gif)
	ThumbURL string `json:"thumb_url"`

	// MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to
	// “image/jpeg”
	ThumbMimeType string `json:"thumb_mime_type,omitempty"`

	// Title for the result
	Title string `json:"title,omitempty"`

	// Caption of the GIF file to be sent, 0-200 characters
	Caption string `json:"caption,omitempty"`

	// Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline
	// URLs in the media caption.
	ParseMode string `json:"parse_mode,omitempty"`

	// List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`

	// Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

	// Content of the message to be sent instead of the GIF animation
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}

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.

func NewInlineQueryResultGif

func NewInlineQueryResultGif(id, gif, thumb string) InlineQueryResultGif

func (InlineQueryResultGif) IsCached

func (InlineQueryResultGif) IsCached() bool

type InlineQueryResultLocation

type InlineQueryResultLocation struct {
	// Type of the result, must be location
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 Bytes
	ID string `json:"id"`

	// Location latitude in degrees
	Latitude float64 `json:"latitude"`

	// Location longitude in degrees
	Longitude float64 `json:"longitude"`

	// Location title
	Title string `json:"title"`

	// The radius of uncertainty for the location, measured in meters; 0-1500
	HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"`

	// Period in seconds for which the location can be updated, should be between 60 and 86400.
	LivePeriod int `json:"live_period,omitempty"`

	// 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"`

	// 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"`

	// Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

	// Content of the message to be sent instead of the location
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`

	// Url of the thumbnail for the result
	ThumbURL string `json:"thumb_url,omitempty"`

	// Thumbnail width
	ThumbWidth int `json:"thumb_width,omitempty"`

	// Thumbnail height
	ThumbHeight int `json:"thumb_height,omitempty"`
}

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.

func NewInlineQueryResultLocation

func NewInlineQueryResultLocation(id, title string, lat, long float64) InlineQueryResultLocation

func (InlineQueryResultLocation) IsCached

func (InlineQueryResultLocation) IsCached() bool

type InlineQueryResultMpeg4Gif

type InlineQueryResultMpeg4Gif struct {
	// Type of the result, must be mpeg4_gif
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 bytes
	ID string `json:"id"`

	// A valid URL for the MP4 file. File size must not exceed 1MB
	Mpeg4URL string `json:"mpeg4_url"`

	// Video width
	Mpeg4Width int `json:"mpeg4_width,omitempty"`

	// Video height
	Mpeg4Height int `json:"mpeg4_height,omitempty"`

	// Video duration
	Mpeg4Duration int `json:"mpeg4_duration,omitempty"`

	// URL of the static thumbnail (jpeg or gif) for the result
	ThumbURL string `json:"thumb_url"`

	// MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to
	// “image/jpeg”
	ThumbMimeType string `json:"thumb_mime_type,omitempty"`

	// Title for the result
	Title string `json:"title,omitempty"`

	// Caption of the MPEG-4 file to be sent, 0-200 characters
	Caption string `json:"caption,omitempty"`

	// Mode for parsing entities in the caption. See formatting options for more details.
	ParseMode string `json:"parse_mode,omitempty"`

	// List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`

	// Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

	// Content of the message to be sent instead of the video animation
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}

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.

func NewInlineQueryResultMpeg4Gif

func NewInlineQueryResultMpeg4Gif(id, mpeg4, thumb string) InlineQueryResultMpeg4Gif

func (InlineQueryResultMpeg4Gif) IsCached

func (InlineQueryResultMpeg4Gif) IsCached() bool

type InlineQueryResultPhoto

type InlineQueryResultPhoto struct {
	// Type of the result, must be photo
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 bytes
	ID string `json:"id"`

	// A valid URL of the photo. Photo must be in jpeg format. Photo size must not exceed 5MB
	PhotoURL string `json:"photo_url"`

	// URL of the thumbnail for the photo
	ThumbURL string `json:"thumb_url"`

	// Width of the photo
	PhotoWidth int `json:"photo_width,omitempty"`

	// Height of the photo
	PhotoHeight int `json:"photo_height,omitempty"`

	// Title for the result
	Title string `json:"title,omitempty"`

	// Short description of the result
	Description string `json:"description,omitempty"`

	// Caption of the photo to be sent, 0-200 characters
	Caption string `json:"caption,omitempty"`

	// Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline
	// URLs in the media caption.
	ParseMode string `json:"parse_mode,omitempty"`

	// List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`

	// Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

	// Content of the message to be sent instead of the photo
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}

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.

func NewInlineQueryResultPhoto

func NewInlineQueryResultPhoto(id, photo, thumb string) InlineQueryResultPhoto

func (InlineQueryResultPhoto) IsCached

func (InlineQueryResultPhoto) IsCached() bool

type InlineQueryResultVenue

type InlineQueryResultVenue struct {
	// Type of the result, must be venue
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 Bytes
	ID string `json:"id"`

	// Latitude of the venue location in degrees
	Latitude float64 `json:"latitude"`

	// Longitude of the venue location in degrees
	Longitude float64 `json:"longitude"`

	// Title of the venue
	Title string `json:"title"`

	// Address of the venue
	Address string `json:"address"`

	// Foursquare identifier of the venue if known
	FoursquareID string `json:"foursquare_id,omitempty"`

	// Foursquare type of the venue, if known. (For example, "arts_entertainment/default",
	// "arts_entertainment/aquarium" or "food/icecream".)
	FoursquareType string `json:"foursquare_type,omitempty"`

	// Google Places identifier of the venue
	GooglePlaceID string `json:"google_place_id,omitempty"`

	// Google Places type of the venue.
	GooglePlaceType string `json:"google_place_type,omitempty"`

	// Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

	// Content of the message to be sent instead of the venue
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`

	// Url of the thumbnail for the result
	ThumbURL string `json:"thumb_url,omitempty"`

	// Thumbnail width
	ThumbWidth int `json:"thumb_width,omitempty"`

	// Thumbnail height
	ThumbHeight int `json:"thumb_height,omitempty"`
}

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.

func NewInlineQueryResultVenue

func NewInlineQueryResultVenue(id, title, addr string, lat, long float64) InlineQueryResultVenue

func (InlineQueryResultVenue) IsCached

func (InlineQueryResultVenue) IsCached() bool

type InlineQueryResultVideo

type InlineQueryResultVideo struct {
	// Type of the result, must be video
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 bytes
	ID string `json:"id"`

	// A valid URL for the embedded video player or video file
	VideoURL string `json:"video_url"`

	// Mime type of the content of video url, "text/html" or "video/mp4"
	MimeType string `json:"mime_type"`

	// URL of the thumbnail (jpeg only) for the video
	ThumbURL string `json:"thumb_url"`

	// Title for the result
	Title string `json:"title"`

	// Caption of the video to be sent, 0-200 characters
	Caption string `json:"caption,omitempty"`

	// Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline
	// URLs in the media caption.
	ParseMode string `json:"parse_mode,omitempty"`

	// List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`

	// Video width
	VideoWidth int `json:"video_width,omitempty"`

	// Video height
	VideoHeight int `json:"video_height,omitempty"`

	// Video duration in seconds
	VideoDuration int `json:"video_duration,omitempty"`

	// Short description of the result
	Description string `json:"description,omitempty"`

	// Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

	// Content of the message to be sent instead of the video. This field is required if
	// InlineQueryResultVideo is used to send an HTML-page as a result (e.g., a YouTube video).
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}

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.

func NewInlineQueryResultVideo

func NewInlineQueryResultVideo(id, title, mime, video, thumb string) InlineQueryResultVideo

func (InlineQueryResultVideo) IsCached

func (InlineQueryResultVideo) IsCached() bool

type InlineQueryResultVoice

type InlineQueryResultVoice struct {
	// Type of the result, must be voice
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 bytes
	ID string `json:"id"`

	// A valid URL for the voice recording
	VoiceURL string `json:"voice_url"`

	// Recording title
	Title string `json:"title"`

	// Caption, 0-200 characters
	Caption string `json:"caption,omitempty"`

	// Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline
	// URLs in the media caption.
	ParseMode string `json:"parse_mode,omitempty"`

	// List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`

	// Recording duration in seconds
	VoiceDuration int `json:"voice_duration,omitempty"`

	// Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

	// Content of the message to be sent instead of the voice recording
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}

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.

func NewInlineQueryResultVoice

func NewInlineQueryResultVoice(id, title, voice string) InlineQueryResultVoice

func (InlineQueryResultVoice) IsCached

func (InlineQueryResultVoice) IsCached() bool

type InputContactMessageContent

type InputContactMessageContent struct {
	// Contact's phone number
	PhoneNumber string `json:"phone_number"`

	// Contact's first name
	FirstName string `json:"first_name"`

	// Contact's last name
	LastName string `json:"last_name,omitempty"`

	// Additional data about the contact in the form of a vCard, 0-2048 bytes
	VCard string `json:"vcard,omitempty"`
}

InputContactMessageContent represents the content of a contact message to be sent as the result of an inline query.

type InputFile

type InputFile struct {
	ID         string    `json:"-"`
	URI        *http.URI `json:"-"`
	Attachment *os.File  `json:"-"`
}

InputFile represents the contents of a file to be uploaded. Must be poste using multipart/form-data in the usual way that files are uploaded via the browser.

func (InputFile) IsAttachment

func (f InputFile) IsAttachment() bool

func (InputFile) IsFileID

func (f InputFile) IsFileID() bool

func (InputFile) IsURI

func (f InputFile) IsURI() bool

func (InputFile) MarshalJSON

func (f InputFile) MarshalJSON() ([]byte, error)

MarshalJSON marshals InputFile into single JSON value.

type InputInvoiceMessageContent added in v5.2.0

type InputInvoiceMessageContent struct {
	// Product name, 1-32 characters
	Title string `json:"title"`

	// Product description, 1-255 characters
	Description string `json:"description"`

	// Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your
	// internal processes.
	Payload string `json:"payload"`

	// Payment provider token, obtained via Botfather
	ProviderToken string `json:"provider_token"`

	// Three-letter ISO 4217 currency code
	Currency string `json:"currency"`

	// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery
	// cost, delivery tax, bonus, etc.)
	Prices []*LabeledPrice `json:"prices,omitempty"`

	// 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
	MaxTipAmount int `json:"max_tip_amount,omitempty"`

	// 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"`

	// 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"`

	// 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"`

	// Photo size
	PhotoSize int `json:"photo_size,omitempty"`

	// Photo width
	PhotoWidth int `json:"photo_width,omitempty"`

	// Photo height
	PhotoHeight int `json:"photo_height,omitempty"`

	// Pass True, if you require the user's full name to complete the order
	NeedName bool `json:"need_name,omitempty"`

	// Pass True, if you require the user's phone number to complete the order
	NeedPhoneNumber bool `json:"need_phone_number,omitempty"`

	// Pass True, if you require the user's email address to complete the order
	NeedEmail bool `json:"need_email,omitempty"`

	// Pass True, if you require the user's shipping address to complete the order
	NeedShippingAddress bool `json:"need_shipping_address,omitempty"`

	// Pass True, if user's phone number should be sent to provider
	SendPhoneNumberToProvider bool `json:"send_phone_number_to_provider,omitempty"`

	// Pass True, if user's email address should be sent to provider
	SendEmailToProvider bool `json:"send_email_to_provider,omitempty"`

	// Pass True, if the final price depends on the shipping method
	IsFlexible bool `json:"is_flexible,omitempty"`
}

InputInvoiceMessageContent represents the content of an invoice message to be sent as the result of an inline query.

type InputLocationMessageContent

type InputLocationMessageContent struct {
	// Latitude of the location in degrees
	Latitude float64 `json:"latitude"`

	// Longitude of the location in degrees
	Longitude float64 `json:"longitude"`

	// The radius of uncertainty for the location, measured in meters; 0-1500
	HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"`

	// Period in seconds for which the location can be updated, should be between 60 and 86400.
	LivePeriod int `json:"live_period,omitempty"`

	// 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"`

	// 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"`
}

InputLocationMessageContent represents the content of a location message to be sent as the result of an inline query.

type InputMedia

type InputMedia interface {
	GetMedia() *InputFile
}

InputMedia represents the content of a media message to be sent.

type InputMediaAnimation

type InputMediaAnimation struct {
	// Type of the result, must be animation
	Type string `json:"type"`

	// File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass "attach://<file_attach_name>" to upload a new one using multipart/form-data under <file_attach_name name.
	Media *InputFile `json:"media"`

	// Thumbnail of the file sent. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 90. 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>.
	Thumb *InputFile `json:"thumb,omitempty"`

	// Caption of the animation to be sent, 0-200 characters
	Caption string `json:"caption,omitempty"`

	// Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
	ParseMode string `json:"parse_mode,omitempty"`

	// List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`

	// Animation width
	Width int `json:"width,omitempty"`

	// Animation height
	Height int `json:"height,omitempty"`

	// Animation duration
	Duration int `json:"duration,omitempty"`
}

InputMediaAnimation represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent.

func (*InputMediaAnimation) GetMedia

func (m *InputMediaAnimation) GetMedia() *InputFile

type InputMediaAudio

type InputMediaAudio struct {
	// Type of the result, must be audio
	Type string `json:"type"`

	// File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass "attach://<file_attach_name>" to upload a new one using multipart/form-data under <file_attach_name> name.
	Media *InputFile `json:"media"`

	// Thumbnail of the file sent. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 90. 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>.
	Thumb *InputFile `json:"thumb,omitempty"`

	// Caption of the audio to be sent, 0-200 characters
	Caption string `json:"caption,omitempty"`

	// Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
	ParseMode string `json:"parse_mode,omitempty"`

	// List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`

	// Duration of the audio in seconds
	Duration int `json:"duration,omitempty"`

	// Performer of the audio
	Performer string `json:"performer,omitempty"`

	// Title of the audio
	Title string `json:"title,omitempty"`
}

InputMediaAudio represents an audio file to be treated as music to be sent.

func (*InputMediaAudio) GetMedia

func (m *InputMediaAudio) GetMedia() *InputFile

type InputMediaDocument

type InputMediaDocument struct {
	// Type of the result, must be document
	Type string `json:"type"`

	// File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass "attach://<file_attach_name>" to upload a new one using multipart/form-data under <file_attach_name> name.
	Media *InputFile `json:"media"`

	// Thumbnail of the file sent. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 90. 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>.
	Thumb *InputFile `json:"thumb,omitempty"`

	// Caption of the document to be sent, 0-200 characters
	Caption string `json:"caption,omitempty"`

	// Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
	ParseMode string `json:"parse_mode,omitempty"`

	// List of special entities that appear in the 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.
	// Always true, if the document is sent as part of an album.
	DisableContentTypeDetection bool `json:"disable_content_type_detection,omitempty"`
}

InputMediaDocument represents a general file to be sent.

func (*InputMediaDocument) GetMedia

func (m *InputMediaDocument) GetMedia() *InputFile

type InputMediaPhoto

type InputMediaPhoto struct {
	// Type of the result, must be photo
	Type string `json:"type"`

	// File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass "attach://<file_attach_name>" to upload a new one using multipart/form-data under <file_attach_name> name.
	Media *InputFile `json:"media"`

	// Caption of the photo to be sent, 0-200 characters
	Caption string `json:"caption,omitempty"`

	// Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
	ParseMode string `json:"parse_mode,omitempty"`

	// List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`
}

InputMediaPhoto represents a photo to be sent.

func (*InputMediaPhoto) GetMedia

func (m *InputMediaPhoto) GetMedia() *InputFile

type InputMediaVideo

type InputMediaVideo struct {
	// Type of the result, must be video
	Type string `json:"type"`

	// File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass "attach://<file_attach_name>" to upload a new one using multipart/form-data under <file_attach_name> name.
	Media *InputFile `json:"media"`

	// 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>.
	Thumb InputFile `json:"thumb,omitempty"`

	// Caption of the video to be sent, 0-200 characters
	Caption string `json:"caption,omitempty"`

	// Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
	ParseMode string `json:"parse_mode,omitempty"`

	// List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`

	// Video width
	Width int `json:"width,omitempty"`

	// Video height
	Height int `json:"height,omitempty"`

	// Video duration
	Duration int `json:"duration,omitempty"`

	// Pass true, if the uploaded video is suitable for streaming
	SupportsStreaming bool `json:"supports_streaming,omitempty"`
}

InputMediaVideo represents a video to be sent.

func (*InputMediaVideo) GetMedia

func (m *InputMediaVideo) GetMedia() *InputFile

type InputMessageContent

type InputMessageContent interface {
	// contains filtered or unexported methods
}

InputMessageContent represents the content of a message to be sent as a result of an inline query.

type InputTextMessageContent

type InputTextMessageContent struct {
	// Text of the message to be sent, 1-4096 characters
	MessageText string `json:"message_text"`

	// Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline
	// URLs in your bot's message.
	ParseMode string `json:"parse_mode,omitempty"`

	// List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`

	// Disables link previews for links in the sent message
	DisableWebPagePreview bool `json:"disable_web_page_preview,omitempty"`
}

InputTextMessageContent represents the content of a text message to be sent as the result of an inline query.

type InputVenueMessageContent

type InputVenueMessageContent struct {
	// Latitude of the location in degrees
	Latitude float64 `json:"latitude"`

	// Longitude of the location in degrees
	Longitude float64 `json:"longitude"`

	// Name of the venue
	Title string `json:"title"`

	// Address of the venue
	Address string `json:"address"`

	// Foursquare identifier of the venue, if known
	FoursquareID string `json:"foursquare_id,omitempty"`

	// Foursquare type of the venue, if known. (For example, "arts_entertainment/default",
	// "arts_entertainment/aquarium" or "food/icecream".)
	FoursquareType string `json:"foursquare_type,omitempty"`

	// Google Places identifier of the venue
	GooglePlaceId string `json:"google_place_id,omitempty"`

	// Google Places type of the venue.
	GooglePlaceType string `json:"google_place_type,omitempty"`
}

InputVenueMessageContent represents the content of a venue message to be sent as the result of an inline query.

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
	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).
	TotalAmount int `json:"total_amount"`
}

Invoice 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 to the bot as a message when the button is pressed
	Text string `json:"text"`

	// 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"`

	// 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"`

	// 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"`
}

KeyboardButton represents one button of the reply keyboard. For simple text buttons String can be used instead of this object to specify text of the button. Optional fields are mutually exclusive.

type KeyboardButtonPollType

type KeyboardButtonPollType struct {
	// If quiz is passed, the user will be allowed to create only polls in the quiz mode. If regular is
	// passed, only regular polls will be allowed. Otherwise, the user will be allowed to create a poll of
	// any type.
	Type string `json:"type,omitempty"`
}

KeyboardButtonPollType 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"`
}

LabeledPrice represents a portion of the price for goods or services.

type LeaveChat

type LeaveChat struct {
	ChatID ChatID `json:"chat_id"`
}

LeaveChat represents data for LeaveChat method.

type Location

type Location struct {
	// Longitude as defined by sender
	Longitude float64 `json:"longitude"`

	// Latitude as defined by sender
	Latitude float64 `json:"latitude"`

	// The radius of uncertainty for the location, measured in meters; 0-1500
	HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"`

	// 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"` // TODO(toby3d): change to time.Duration?

	// The direction in which user is moving, in degrees; 1-360. For active live locations only.
	Heading int `json:"heading,omitempty"`

	// Maximum distance for proximity alerts about approaching another chat member, in meters. For sent
	// live locations only.
	ProximityAlertRadius int `json:"proximity_alert_radius,omitempty"`
}

Location 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.
	//
	// NOTE: You must always check the hash of the received data to verify the authentication and the integrity of the data as described in Checking authorization.
	URL string `json:"url"`

	// New text of the button in forwarded messages.
	ForwardText string `json:"forward_text,omitempty"`

	// 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 b. See Linking your domain to the bot for more details.
	BotUsername string `json:"bot_username,omitempty"`

	// Pass true to request the permission for your bot to send messages to the user.
	RequestWriteAccess bool `json:"request_write_access,omitempty"`
}

LoginURL represents a parameter of the inline keyboard button used to automatically authorize a user.

type MaskPosition

type MaskPosition struct {
	// The part of the face relative to which the mask should be placed. One of "forehead", "eyes", "mouth", or "chin".
	Point string `json:"point"`

	// Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. For example, choosing -1.0 will place mask just to the left of the default mask position.
	XShift float64 `json:"x_shift"`

	// Shift by Y-axis measured in heights of the mask scaled to the face size, from top to bottom. For example, 1.0 will place the mask just below the default mask position.
	YShift float64 `json:"y_shift"`

	// Mask scaling coefficient. For example, 2.0 means double size.
	Scale float64 `json:"scale"`
}

MaskPosition describes the position on faces where a mask should be placed by default.

type Message

type Message struct {
	// Unique message identifier inside this chat
	ID int64 `json:"message_id"`

	// Sender, empty for messages sent to channels
	From *User `json:"from,omitempty"`

	// Sender of the message, sent on behalf of a chat. The channel itself for channel messages. The
	// supergroup itself for messages from anonymous group administrators. The linked channel for messages
	// automatically forwarded to the discussion group
	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"`

	// For forwarded messages, sender of the original message
	ForwardFrom *User `json:"forward_from,omitempty"`

	// For messages forwarded from channels, information about the original channel
	ForwardFromChat *Chat `json:"forward_from_chat,omitempty"`

	// For messages forwarded from channels, identifier of the original message in the channel
	ForwardFromMessageID int64 `json:"forward_from_message_id,omitempty"`

	// For messages forwarded from channels, signature of the post author if present
	ForwardSignature string `json:"forward_signature,omitempty"`

	// 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"`

	// For forwarded messages, date the original message was sent in Unix time
	ForwardDate int64 `json:"forward_date,omitempty"`

	// 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"`

	// Bot through which the message was sent
	ViaBot *User `json:"via_bot,omitempty"`

	// Date the message was last edited in Unix time
	EditDate int64 `json:"edit_date,omitempty"`

	// The unique identifier of a media message group this message belongs to
	MediaGroupID string `json:"media_group_id,omitempty"`

	// Signature of the post author for messages in channels
	AuthorSignature string `json:"author_signature,omitempty"`

	// For text messages, the actual UTF-8 text of the message, 0-4096 characters.
	Text string `json:"text,omitempty"`

	// For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text
	Entities []*MessageEntity `json:"entities,omitempty"`

	// 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"`

	// Message is an audio file, information about the file
	Audio *Audio `json:"audio,omitempty"`

	// Message is a general file, information about the file
	Document *Document `json:"document,omitempty"`

	// Message is a photo, available sizes of the photo
	Photo Photo `json:"photo,omitempty"`

	// Message is a sticker, information about the sticker
	Sticker *Sticker `json:"sticker,omitempty"`

	// Message is a video, information about the video
	Video *Video `json:"video,omitempty"`

	// Message is a video note, information about the video message
	VideoNote *VideoNote `json:"video_note,omitempty"`

	// Message is a voice message, information about the file
	Voice *Voice `json:"voice,omitempty"`

	// Caption for the document, photo or video, 0-200 characters
	Caption string `json:"caption,omitempty"`

	// For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear
	// in the caption
	CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`

	// Message is a shared contact, information about the contact
	Contact *Contact `json:"contact,omitempty"`

	// Message is a dice with random value from 1 to 6
	Dice *Dice `json:"dice,omitempty"`

	// Message is a game, information about the game.
	Game *Game `json:"game,omitempty"`

	// Message is a native poll, information about the poll
	Poll *Poll `json:"poll,omitempty"`

	// Message is a venue, information about the venue
	Venue *Venue `json:"venue,omitempty"`

	// Message is a shared location, information about the location
	Location *Location `json:"location,omitempty"`

	// 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"`

	// A member was removed from the group, information about them (this member may be the bot itself)
	LeftChatMember *User `json:"left_chat_member,omitempty"`

	// A chat title was changed to this value
	NewChatTitle string `json:"new_chat_title,omitempty"`

	// A chat photo was change to this value
	NewChatPhoto Photo `json:"new_chat_photo,omitempty"`

	// Service message: the chat photo was deleted
	DeleteChatPhoto bool `json:"delete_chat_photo,omitempty"`

	// Service message: the group has been created
	GroupChatCreated bool `json:"group_chat_created,omitempty"`

	// 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"`

	// 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"`

	// Service message: auto-delete timer settings changed in the chat
	MessageAutoDeleteTimerChanged *MessageAutoDeleteTimerChanged `json:"message_auto_delete_timer_changed,omitempty"`

	// The group has been migrated to a supergroup with the specified identifier.
	MigrateToChatID int64 `json:"migrate_to_chat_id,omitempty"`

	// The supergroup has been migrated from a group with the specified identifier.
	MigrateFromChatID int64 `json:"migrate_from_chat_id,omitempty"`

	// 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"`

	// Message is an invoice for a payment, information about the invoice.
	Invoice *Invoice `json:"invoice,omitempty"`

	// Message is a service message about a successful payment, information about the payment.
	SuccessfulPayment *SuccessfulPayment `json:"successful_payment,omitempty"`

	// The domain name of the website on which the user has logged in.
	ConnectedWebsite string `json:"connected_website,omitempty"`

	// Telegram Passport data
	PassportData *PassportData `json:"passport_data,omitempty"`

	// Service message. A user in the chat triggered another user's proximity alert while sharing Live
	// Location.
	ProximityAlertTriggered *ProximityAlertTriggered `json:"proximity_alert_triggered,omitempty"`

	// Service message: voice chat scheduled
	VoiceChatScheduled *VoiceChatScheduled `json:"voice_chat_scheduled,omitempty"`

	// Service message: voice chat started
	VoiceChatStarted *VoiceChatStarted `json:"voice_chat_started,omitempty"`

	// Service message: voice chat ended
	VoiceChatEnded *VoiceChatEnded `json:"voice_chat_ended,omitempty"`

	// Service message: new participants invited to a voice chat
	VoiceChatParticipantsInvited *VoiceChatParticipantsInvited `json:"voice_chat_participants_invited,omitempty"`

	// Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons.
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}

Message represents a message.

func (Message) Command

func (m Message) Command() string

Command returns identifier of the bot command without bot username, if it was available

func (Message) CommandArgument

func (m Message) CommandArgument() string

CommandArgument returns raw command argument.

func (Message) EditTime

func (m Message) EditTime() time.Time

EditTime parse current message EditDate and returns time.Time.

func (Message) ForwardTime

func (m Message) ForwardTime() time.Time

ForwardTime parse current message ForwardDate and returns time.Time.

func (Message) HasAuthorSignature

func (m Message) HasAuthorSignature() bool

HasAuthorSignature checks that the current channel post has author signature.

func (Message) HasBeenEdited

func (m Message) HasBeenEdited() bool

HasBeenEdited checks that the current message has been edited.

func (Message) HasCaption

func (m Message) HasCaption() bool

HasCaption checks that the current media has caption.

func (Message) HasCaptionEntities

func (m Message) HasCaptionEntities() bool

HasCaptionEntities checks that the current media contains entities in caption.

func (Message) HasCaptionMentions

func (m Message) HasCaptionMentions() bool

HasCaptionMentions checks that the current media contains mentions in caption.

func (Message) HasCommandArgument

func (m Message) HasCommandArgument() bool

HasCommandArgument checks that the current command message contains argument.

func (Message) HasEntities

func (m Message) HasEntities() bool

HasEntities checks that the current message contains entities.

func (Message) HasMentions

func (m Message) HasMentions() bool

HasMentions checks that the current message contains mentions.

func (Message) IsAnimation

func (m Message) IsAnimation() bool

IsAnimation checks that the current message is a animation.

func (Message) IsAudio

func (m Message) IsAudio() bool

IsAudio checks that the current message is a audio.

func (Message) IsChannelChatCreatedEvent

func (m Message) IsChannelChatCreatedEvent() bool

IsChannelChatCreatedEvent checks that the current message is a event of creating a new channel.

func (Message) IsCommand

func (m Message) IsCommand() bool

IsCommand checks that the current message is a bot command.

func (Message) IsCommandEqual

func (m Message) IsCommandEqual(command string) bool

IsCommandEqual checks that the current message is a specific bot command.

func (Message) IsContact

func (m Message) IsContact() bool

IsContact checks that the current message is a contact.

func (Message) IsDeleteChatPhotoEvent

func (m Message) IsDeleteChatPhotoEvent() bool

IsDeleteChatPhotoEvent checks that the current message is a event of deleting a chat avatar.

func (Message) IsDice

func (m Message) IsDice() bool

IsDice checks what current message is a dice.

func (Message) IsDocument

func (m Message) IsDocument() bool

IsDocument checks that the current message is a document.

func (Message) IsEvent

func (m Message) IsEvent() bool

IsEvent checks what current message is a any chat event.

func (Message) IsForward

func (m Message) IsForward() bool

IsForward checks that the current message is a forward of other message.

func (Message) IsGame

func (m Message) IsGame() bool

IsGame checks that the current message is a game.

func (Message) IsGroupChatCreatedEvent

func (m Message) IsGroupChatCreatedEvent() bool

IsGroupChatCreatedEvent checks that the current message is a event of creating a new group.

func (Message) IsInvoice

func (m Message) IsInvoice() bool

IsInvoice checks that the current message is a invoice.

func (Message) IsLeftChatMemberEvent

func (m Message) IsLeftChatMemberEvent() bool

IsLeftChatMemberEvent checks that the current message is a event of members exit.

func (Message) IsLocation

func (m Message) IsLocation() bool

IsLocation checks that the current message is a location.

func (Message) IsNewChatMembersEvent

func (m Message) IsNewChatMembersEvent() bool

IsNewChatMembersEvent checks that the current message is a event of entry of new members.

func (Message) IsNewChatPhotoEvent

func (m Message) IsNewChatPhotoEvent() bool

IsNewChatPhotoEvent checks that the current message is a event of setting a new chat avatar.

func (Message) IsNewChatTitleEvent

func (m Message) IsNewChatTitleEvent() bool

IsNewChatTitleEvent checks that the current message is a event of setting a new chat title.

func (Message) IsPhoto

func (m Message) IsPhoto() bool

IsPhoto checks that the current message is a photo.

func (Message) IsPinnedMessage

func (m Message) IsPinnedMessage() bool

IsPinnedMessage checks that the current message is a event of pinning another message.

func (Message) IsPoll

func (m Message) IsPoll() bool

IsPoll checks that the current message is a poll.

func (Message) IsReply

func (m Message) IsReply() bool

IsReply checks that the current message is a reply on other message.

func (Message) IsSticker

func (m Message) IsSticker() bool

IsSticker checks that the current message is a sticker.

func (Message) IsSuccessfulPayment

func (m Message) IsSuccessfulPayment() bool

IsSuccessfulPayment checks that the current message is a event of successful payment.

func (Message) IsSupergroupChatCreatedEvent

func (m Message) IsSupergroupChatCreatedEvent() bool

IsSupergroupChatCreatedEvent checks that the current message is a event of creating a new supergroup.

func (Message) IsText

func (m Message) IsText() bool

IsText checks that the current message is just a text message.

func (Message) IsVenue

func (m Message) IsVenue() bool

IsVenue checks that the current message is a venue.

func (Message) IsVideo

func (m Message) IsVideo() bool

IsVideo checks that the current message is a video.

func (Message) IsVideoNote

func (m Message) IsVideoNote() bool

IsVideoNote checks that the current message is a video note.

func (Message) IsVoice

func (m Message) IsVoice() bool

IsVoice checks that the current message is a voice.

func (Message) RawCommand

func (m Message) RawCommand() string

RawCommand returns identifier of the bot command with bot username, if it was available

func (Message) Time

func (m Message) Time() time.Time

Time parse current message Date and returns time.Time.

type MessageAutoDeleteTimerChanged added in v5.1.0

type MessageAutoDeleteTimerChanged struct {
	// New auto-delete time for messages in the chat
	MessageAutoDeleteTime int `json:"message_auto_delete_time"`
}

MessageAutoDeleteTimerChanged represents a service message about a change in auto-delete timer settings.

type MessageEntity

type MessageEntity struct {
	// Type of the entity. Can be mention (@username), hashtag, bot_command, url, email, bold (bold text), italic (italic text), code (monowidth string), pre (monowidth block), text_link (for clickable text URLs), text_mention (for users without usernames)
	Type string `json:"type"`

	// For "text_link" only, url that will be opened after user taps on the text
	URL string `json:"url,omitempty"`

	// 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"`

	// For "text_mention" only, the mentioned user
	User *User `json:"user,omitempty"`

	// For “pre” only, the programming language of the entity text
	Language string `json:"language"`
}

MessageEntity represents one special entity in a text message. For example, hashtags, usernames, URLs, etc.

func (MessageEntity) IsBold

func (e MessageEntity) IsBold() bool

IsBold checks that the current entity is a bold tag.

func (MessageEntity) IsBotCommand

func (e MessageEntity) IsBotCommand() bool

IsBotCommand checks that the current entity is a bot command.

func (MessageEntity) IsCashtag

func (e MessageEntity) IsCashtag() bool

IsCashtag checks that the current entity is a cashtag.

func (MessageEntity) IsCode

func (e MessageEntity) IsCode() bool

IsCode checks that the current entity is a code tag.

func (MessageEntity) IsEmail

func (e MessageEntity) IsEmail() bool

IsEmail checks that the current entity is a email.

func (MessageEntity) IsHashtag

func (e MessageEntity) IsHashtag() bool

IsHashtag checks that the current entity is a hashtag.

func (MessageEntity) IsItalic

func (e MessageEntity) IsItalic() bool

IsItalic checks that the current entity is a italic tag.

func (MessageEntity) IsMention

func (e MessageEntity) IsMention() bool

IsMention checks that the current entity is a username mention.

func (MessageEntity) IsPhoneNumber

func (e MessageEntity) IsPhoneNumber() bool

IsMPhoneNumberchecks that the current entity is a phone number.

func (MessageEntity) IsPre

func (e MessageEntity) IsPre() bool

IsPre checks that the current entity is a pre tag.

func (MessageEntity) IsStrikethrough

func (e MessageEntity) IsStrikethrough() bool

IsPre checks that the current entity is a pre tag.

func (e MessageEntity) IsTextLink() bool

IsTextLink checks that the current entity is a text link.

func (MessageEntity) IsTextMention

func (e MessageEntity) IsTextMention() bool

IsTextMention checks that the current entity is a mention without username.

func (MessageEntity) IsURL

func (e MessageEntity) IsURL() bool

IsURL checks that the current entity is a URL.

func (MessageEntity) IsUnderline

func (e MessageEntity) IsUnderline() bool

IsUnderline checks that the current entity is a underline.

func (MessageEntity) ParseURL

func (e MessageEntity) ParseURL(text string) *http.URI

ParseURL selects URL from message text/caption and parse it as fasthttp.URI.

func (e MessageEntity) TextLink() *http.URI

TextLink parse current text link entity as fasthttp.URI.

type MessageID

type MessageID struct {
	// Unique message identifier
	MessageID int64 `json:"message_id"`
}

MessageID represents a unique message identifier.

type OrderInfo

type OrderInfo struct {
	// User name
	Name string `json:"name,omitempty"`

	// User's phone number
	PhoneNumber string `json:"phone_number,omitempty"`

	// User email
	Email string `json:"email,omitempty"`

	// User shipping address
	ShippingAddress *ShippingAddress `json:"shipping_address,omitempty"`
}

OrderInfo represents information about an order.

type Passport

type Passport struct {
	// Personal Details
	PersonalDetails struct {
		Data *PersonalDetails `json:"data"`
	} `json:"personal_details"`

	// Passport
	Passport struct {
		Data        *IDDocumentData `json:"data"`
		FrontSide   *PassportFile   `json:"front_side"`
		Selfie      *PassportFile   `json:"selfie,omitempty"`
		Translation []*PassportFile `json:"translation,omitempty"`
	} `json:"passport"`

	// Internal Passport
	InternalPassport struct {
		Data        *IDDocumentData `json:"data"`
		FrontSide   *PassportFile   `json:"front_side"`
		Selfie      *PassportFile   `json:"selfie,omitempty"`
		Translation []*PassportFile `json:"translation,omitempty"`
	} `json:"internal_passport"`

	// Driver License
	DriverLicense struct {
		Data        *IDDocumentData `json:"data"`
		FrontSide   *PassportFile   `json:"front_side"`
		ReverseSide *PassportFile   `json:"reverse_side"`
		Selfie      *PassportFile   `json:"selfie,omitempty"`
		Translation []*PassportFile `json:"translation,omitempty"`
	} `json:"driver_license"`

	// Identity Card
	IdentityCard struct {
		Data        *IDDocumentData `json:"data"`
		FrontSide   *PassportFile   `json:"front_side"`
		ReverseSide *PassportFile   `json:"reverse_side"`
		Selfie      *PassportFile   `json:"selfie,omitempty"`
		Translation []*PassportFile `json:"translation,omitempty"`
	} `json:"identity_card"`

	// Address
	Address struct {
		Data *ResidentialAddress `json:"data"`
	} `json:"address"`

	// Utility Bill
	UtilityBill struct {
		Files       []*PassportFile `json:"files"`
		Translation []*PassportFile `json:"translation,omitempty"`
	} `json:"utility_bill"`

	// Bank Statement
	BankStatement struct {
		Files       []*PassportFile `json:"files"`
		Translation []*PassportFile `json:"translation,omitempty"`
	} `json:"bank_statement"`

	// Rental Agreement
	RentalAgreement struct {
		Files       []*PassportFile `json:"files"`
		Translation []*PassportFile `json:"translation,omitempty"`
	} `json:"rental_agreement"`

	// Registration Page in the Internal Passport
	PassportRegistration struct {
		Files       []*PassportFile `json:"files"`
		Translation []*PassportFile `json:"translation,omitempty"`
	} `json:"passport_registration"`

	// Temporary Registration
	TemporaryRegistration struct {
		Files       []*PassportFile `json:"files"`
		Translation []*PassportFile `json:"translation,omitempty"`
	} `json:"temporary_registration"`

	// Phone number
	PhoneNumber string `json:"phone_number"`

	// Email
	Email string `json:"email"`
}

type PassportData

type PassportData struct {
	// Array with information about documents and other Telegram Passport elements that was shared with the bot
	Data []*EncryptedPassportElement `json:"data"`

	// Encrypted credentials required to decrypt the data
	Credentials *EncryptedCredentials `json:"credentials"`
}

PassportData contains information about Telegram Passport data shared with the bot by the user.

type PassportElementError

type PassportElementError interface {
	PassportElementErrorMessage() string
	PassportElementErrorSource() string
	PassportElementErrorType() string
}

PassportElementError represents an error in the Telegram Passport element which was submitted that should be resolved by the user.

type PassportElementErrorDataField

type PassportElementErrorDataField struct {
	// Error source, must be data
	Source string `json:"source"`

	// The section of the user's Telegram Passport which has the error, one of "personal_details", "passport", "driver_license", "identity_card", "internal_passport", "address"
	Type string `json:"type"`

	// Name of the data field which has the error
	FieldName string `json:"field_name"`

	// Base64-encoded data hash
	DataHash string `json:"data_hash"`

	// Error message
	Message string `json:"message"`
}

PassportElementErrorDataField represents an issue in one of the data fields that was provided by the user. The error is considered resolved when the field's value changes.

type PassportElementErrorFile

type PassportElementErrorFile struct {
	// Error source, must be file
	Source string `json:"source"`

	// The section of the user's Telegram Passport which has the issue, one of "utility_bill", "bank_statement", "rental_agreement", "passport_registration", "temporary_registration"
	Type string `json:"type"`

	// Base64-encoded file hash
	FileHash string `json:"file_hash"`

	// Error message
	Message string `json:"message"`
}

PassportElementErrorFile represents an issue with a document scan. The error is considered resolved when the file with the document scan changes.

type PassportElementErrorFiles

type PassportElementErrorFiles struct {
	// Error source, must be files
	Source string `json:"source"`

	// The section of the user's Telegram Passport which has the issue, one of "utility_bill", "bank_statement", "rental_agreement", "passport_registration", "temporary_registration"
	Type string `json:"type"`

	// List of base64-encoded file hashes
	FileHashes []string `json:"file_hashes"`

	// Error message
	Message string `json:"message"`
}

PassportElementErrorFiles represents an issue with a list of scans. The error is considered resolved when the list of files containing the scans changes.

type PassportElementErrorFrontSide

type PassportElementErrorFrontSide struct {
	// Error source, must be front_side
	Source string `json:"source"`

	// The section of the user's Telegram Passport which has the issue, one of "passport", "driver_license", "identity_card", "internal_passport"
	Type string `json:"type"`

	// Base64-encoded hash of the file with the front side of the document
	FileHash string `json:"file_hash"`

	// Error message
	Message string `json:"message"`
}

PassportElementErrorFrontSide represents an issue with the front side of a document. The error is considered resolved when the file with the front side of the document changes.

type PassportElementErrorReverseSide

type PassportElementErrorReverseSide struct {
	// Error source, must be reverse_side
	Source string `json:"source"`

	// The section of the user's Telegram Passport which has the issue, one of "driver_license", "identity_card"
	Type string `json:"type"`

	// Base64-encoded hash of the file with the reverse side of the document
	FileHash string `json:"file_hash"`

	// Error message
	Message string `json:"message"`
}

PassportElementErrorReverseSide represents an issue with the reverse side of a document. The error is considered resolved when the file with reverse side of the document changes.

type PassportElementErrorSelfie

type PassportElementErrorSelfie struct {
	// Error source, must be selfie
	Source string `json:"source"`

	// The section of the user's Telegram Passport which has the issue, one of "passport", "driver_license", "identity_card", "internal_passport"
	Type string `json:"type"`

	// Base64-encoded hash of the file with the selfie
	FileHash string `json:"file_hash"`

	// Error message
	Message string `json:"message"`
}

PassportElementErrorSelfie represents an issue with the selfie with a document. The error is considered resolved when the file with the selfie changes.

type PassportElementErrorTranslationFile

type PassportElementErrorTranslationFile struct {
	// Error source, must be translation_file
	Source string `json:"source"`

	// Type of element of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”
	Type string `json:"type"`

	// Base64-encoded file hash
	FileHash string `json:"file_hash"`

	// Error message
	Message string `json:"message"`
}

PassportElementErrorTranslationFile represents an issue with one of the files that constitute the translation of a document. The error is considered resolved when the file changes.

type PassportElementErrorTranslationFiles

type PassportElementErrorTranslationFiles struct {
	// Error source, must be translation_files
	Source string `json:"source"`

	// Type of element of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”
	Type string `json:"type"`

	// List of base64-encoded file hashes
	FileHashes []string `json:"file_hashes"`

	// Error message
	Message string `json:"message"`
}

PassportElementErrorTranslationFiles represents an issue with the translated version of a document. The error is considered resolved when a file with the document translation change.

type PassportElementErrorUnspecified

type PassportElementErrorUnspecified struct {
	// Error source, must be unspecified
	Source string `json:"source"`

	// Type of element of the user's Telegram Passport which has the issue
	Type string `json:"type"`

	// Base64-encoded element hash
	ElementHash string `json:"element_hash"`

	// Error message
	Message string `json:"message"`
}

PassportElementErrorUnspecified represents an issue in an unspecified place. The error is considered resolved when new data is added.

type PassportFile

type PassportFile struct {
	// Identifier for this file, which can be used to download or reuse the file
	FileID string `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 string `json:"file_unique_id"`

	// File size
	FileSize int `json:"file_size"`

	// Unix time when the file was uploaded
	FileDate int `json:"file_date"`
}

PassportFile represents a file uploaded to Telegram Passport. Currently all Telegram Passport files are in JPEG format when decrypted and don't exceed 10MB.

type PassportScope

type PassportScope struct {
	// List of requested elements, each type may be used only once in the entire array of PassportScopeElement objects
	Data []*PassportScopeElement `json:"data"`

	// Scope version, must be 1
	V int `json:"v"`
}

PassportScope represents the data to be requested.

type PassportScopeElement

type PassportScopeElement interface {
	PassportScopeElementTranslation() bool
	PassportScopeElementSelfie() bool
}

PassportScopeElement represents a requested element.

type PassportScopeElementOne

type PassportScopeElementOne struct {
	// Element type.
	Type string `json:"type"`

	// Use this parameter if you want to request a selfie with the document as well.
	Selfie bool `json:"selfie,omitempty"`

	//  Use this parameter if you want to request a translation of the document as well.
	Translation bool `json:"translation,omitempty"`

	// Use this parameter to request the first, last and middle name of the user in the language of the user's country of residence.
	NativeNames bool `json:"native_names,omitempty"`
}

PassportScopeElementOne represents one particular element that must be provided. If no options are needed, String can be used instead of this object to specify the type of the element.

type PassportScopeElementOneOfSeveral

type PassportScopeElementOneOfSeveral struct {
	// List of elements one of which must be provided;
	OneOf []*PassportScopeElementOne `json:"one_of"`

	// Use this parameter if you want to request a selfie with the document from this list that the user chooses to upload.
	Selfie bool `json:"selfie,omitempty"`

	// Use this parameter if you want to request a translation of the document from this list that the user chooses to upload. Note: We suggest to only request translations after you have received a valid document that requires one.
	Translation bool `json:"translation,omitempty"`
}

PassportScopeElementOneOfSeveral represents several elements one of which must be provided.

type PersonalDetails

type PersonalDetails struct {
	// First Name
	FirstName string `json:"first_name"`

	// Last Name
	LastName string `json:"last_name"`

	// Middle Name
	MiddleName string `json:"middle_name,omitempty"`

	// Date of birth in DD.MM.YYYY format
	BirthDate string `json:"birth_date"`

	// Gender, male or female
	Gender string `json:"gender"`

	// Citizenship (ISO 3166-1 alpha-2 country code)
	CountryCode string `json:"country_code"`

	// Country of residence (ISO 3166-1 alpha-2 country code)
	ResidenceCountryCode string `json:"residence_country_code"`

	// First Name in the language of the user's country of residence
	FirstNameNative string `json:"first_name_native"`

	// Last Name in the language of the user's country of residence
	LastNameNative string `json:"last_name_native"`

	// Middle Name in the language of the user's country of residence
	MiddleNameNative string `json:"middle_name_native,omitempty"`
}

PersonalDetails represents personal details.

type Photo

type Photo []*PhotoSize

type PhotoSize

type PhotoSize struct {
	// Identifier for this file, which can be used to download or reuse the file
	FileID string `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 string `json:"file_unique_id"`

	// Photo width
	Width int `json:"width"`

	// Photo height
	Height int `json:"height"`

	// File size
	FileSize int `json:"file_size,omitempty"`
}

PhotoSize represents one size of a photo or a file / sticker thumbnail.

type PinChatMessage

type PinChatMessage struct {
	ChatID ChatID `json:"chat_id"`

	// Identifier of a message to pin
	MessageID int64 `json:"message_id"`

	// 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.
	DisableNotification bool `json:"disable_notification"`
}

PinChatMessage represents data for PinChatMessage method.

func NewPin

func NewPin(chatID ChatID, messageID int64) PinChatMessage

type Poll

type Poll struct {
	// Unique poll identifier
	ID string `json:"id"`

	// Poll question, 1-255 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 string `json:"type"`

	// True, if the poll allows multiple answers
	AllowsMultipleAnswers bool `json:"allows_multiple_answers"`

	// 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 int64 `json:"correct_option_id,omitempty"`

	// 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"`

	// Special entities like usernames, URLs, bot commands, etc. that appear in the explanation
	ExplanationEntities []*MessageEntity `json:"explanation_entities,omitempty"`

	// Amount of time in seconds the poll will be active after creation
	OpenPeriod int `json:"open_period,omitempty"`

	// 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.

func (Poll) CloseTime

func (p Poll) CloseTime() time.Time

CloseTime parse CloseDate and returns time.Time.

func (Poll) VotesCount

func (p Poll) VotesCount() int

VotesCount returns the total number of votes.

type PollAnswer

type PollAnswer struct {
	// Unique poll identifier
	PollID string `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"`
}

PollAnswer represents an answer of a user in a non-anonymous poll.

type PollOption

type PollOption struct {
	// Option text, 1-300 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 string `json:"id"`

	// Three-letter ISO 4217 currency code
	Currency string `json:"currency"`

	// Bot specified invoice payload
	InvoicePayload string `json:"invoice_payload"`

	// Identifier of the shipping option chosen by the user
	ShippingOptionID string `json:"shipping_option_id,omitempty"`

	// User who sent the query
	From *User `json:"from"`

	// 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).
	TotalAmount int `json:"total_amount"`

	// Order info provided by the user
	OrderInfo *OrderInfo `json:"order_info,omitempty"`
}

PreCheckoutQuery contains information about an incoming pre-checkout query.

type PromoteChatMember

type PromoteChatMember struct {
	ChatID ChatID `json:"chat_id"`

	// Unique identifier of the target user
	UserID int64 `json:"user_id"`

	// Pass True, if the administrator's presence in the chat is hidden
	IsAnonymous bool `json:"is_anonymous,omitempty"`

	// Pass True, if the administrator can access the chat event log, chat statistics, message statistics
	// in channels, see channel members, see anonymous administrators in supergoups and ignore slow mode.
	// Implied by any other administrator privilege
	CanManageChat bool `json:"can_manage_chat,omitempty"`

	// Pass True, if the administrator can change chat title, photo and other settings
	CanChangeInfo bool `json:"can_change_info,omitempty"`

	// Pass True, if the administrator can create channel posts, channels only
	CanPostMessages bool `json:"can_post_messages,omitempty"`

	// Pass True, if the administrator can edit messages of other users and can pin messages, channels only
	CanEditMessages bool `json:"can_edit_messages,omitempty"`

	// Pass True, if the administrator can delete messages of other users
	CanDeleteMessages bool `json:"can_delete_messages,omitempty"`

	// Pass True, if the administrator can manage voice chats, supergroups only
	CanManageVoiceChats bool `json:"can_manage_voice_chats,omitempty"`

	// Pass True, if the administrator can invite new users to the chat
	CanInviteUsers bool `json:"can_invite_users,omitempty"`

	// Pass True, if the administrator can restrict, ban or unban chat members
	CanRestrictMembers bool `json:"can_restrict_members,omitempty"`

	// Pass True, if the administrator can pin messages, supergroups only
	CanPinMessages bool `json:"can_pin_messages,omitempty"`

	// Pass True, if the administrator can add new administrators with a subset of his 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"`
}

PromoteChatMember represents data for PromoteChatMember method.

func NewPromote

func NewPromote(chatID ChatID, userID int64) PromoteChatMember

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"`
}

ProximityAlertTriggered 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"`

	// 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"`

	// 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"`

	// The placeholder to be shown in the input field when the keyboard is active; 1-64 characters
	InputFieldPlaceholder string `json:"input_field_placeholder,omitempty"`

	// 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"`
}

ReplyKeyboardMarkup represents a custom keyboard with reply options (see Introduction to bots for details and examples).

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"`

	// 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"`
}

ReplyKeyboardRemove 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 b. An exception is made for one-time keyboards that are hidden immediately after the user presses a button (see ReplyKeyboardMarkup).

func NewReplyKeyboardRemove

func NewReplyKeyboardRemove(selective bool) ReplyKeyboardRemove

type ReplyMarkup

type ReplyMarkup interface {
	// contains filtered or unexported methods
}

type ResidentialAddress

type ResidentialAddress struct {
	// First line for the address
	StreetLine1 string `json:"street_line1"`

	// Second line for the address
	StreetLine2 string `json:"street_line2,omitempty"`

	// City
	City string `json:"city"`

	// State
	State string `json:"state,omitempty"`

	// ISO 3166-1 alpha-2 country code
	CountryCode string `json:"country_code"`

	// Address post code
	PostCode string `json:"post_code"`
}

ResidentialAddress represents a residential address.

type Response

type Response struct {
	Description string                `json:"description,omitempty"`
	ErrorCode   int                   `json:"error_code,omitempty"`
	Ok          bool                  `json:"ok"`
	Parameters  []*ResponseParameters `json:"parameters,omitempty"`
	Result      json.RawMessage       `json:"result,omitempty"`
}

Response represents a response from the Telegram API with the result stored raw. If ok equals true, the request was successful, and the result of the query can be found in the result field. In case of an unsuccessful request, ok equals false, and the error is explained in the error field.

type ResponseParameters

type ResponseParameters struct {
	// The group has been migrated to a supergroup with the specified identifier.
	MigrateToChatID int64 `json:"migrate_to_chat_id,omitempty"`

	// In case of exceeding flood control, the number of seconds left to wait before the request can be repeated
	RetryAfter int `json:"retry_after,omitempty"`
}

ResponseParameters contains information about why a request was unsuccessful.

type RestrictChatMember

type RestrictChatMember struct {
	ChatID ChatID `json:"chat_id"`

	// Unique identifier of the target user
	UserID int64 `json:"user_id"`

	// New user permissions
	Permissions *ChatPermissions `json:"permissions"`

	// 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"`
}

RestrictChatMember represents data for RestrictChatMember method.

func NewRestrict

func NewRestrict(chatID ChatID, userID int64, permissions ChatPermissions) RestrictChatMember
type RevokeChatInviteLink struct {
	ChatID ChatID `json:"chat_id"`

	// The invite link to revoke
	InviteLink string `json:"invite_link"`
}

RevokeChatInviteLink represents data for RevokeChatInviteLink method.

type SecureData

type SecureData struct {
	// Credentials for encrypted personal details
	PersonalDetails *SecureValue `json:"personal_details,omitempty"`

	// Credentials for encrypted passport
	Passport *SecureValue `json:"passport,omitempty"`

	// Credentials for encrypted internal passport
	InternalPassport *SecureValue `json:"internal_passport,omitempty"`

	// Credentials for encrypted driver license
	DriverLicense *SecureValue `json:"driver_license,omitempty"`

	// Credentials for encrypted ID card
	IdentityCard *SecureValue `json:"identity_card,omitempty"`

	// Credentials for encrypted residential address
	Address *SecureValue `json:"address,omitempty"`

	// Credentials for encrypted utility bill
	UtilityBill *SecureValue `json:"utility_bill,omitempty"`

	// Credentials for encrypted bank statement
	BankStatement *SecureValue `json:"bank_statement,omitempty"`

	// Credentials for encrypted rental agreement
	RentalAgreement *SecureValue `json:"rental_agreement,omitempty"`

	// Credentials for encrypted registration from internal passport
	PassportRegistration *SecureValue `json:"passport_registration,omitempty"`

	// Credentials for encrypted temporary registration
	TemporaryRegistration *SecureValue `json:"temporary_registration,omitempty"`
}

SecureData represents the credentials required to decrypt encrypted data. All fields are optional and depend on fields that were requested.

type SecureValue

type SecureValue struct {
	// Credentials for encrypted Telegram Passport data.
	Data *DataCredentials `json:"data,omitempty"`

	// Credentials for an encrypted document's front side.
	FrontSide *FileCredentials `json:"front_side,omitempty"`

	// Credentials for an encrypted document's reverse side.
	ReverseSide *FileCredentials `json:"reverse_side,omitempty"`

	// Credentials for an encrypted selfie of the user with a document.
	Selfie *FileCredentials `json:"selfie,omitempty"`

	// Credentials for an encrypted translation of the document.
	Translation []*FileCredentials `json:"translation,omitempty"`

	// Credentials for encrypted files.
	Files []*FileCredentials `json:"files,omitempty"`
}

SecureValue represents the credentials required to decrypt encrypted values. All fields are optional and depend on the type of fields that were requested.

type SendAnimation

type SendAnimation struct {
	ChatID ChatID `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.
	Animation *InputFile `json:"animation"`

	// Duration of sent animation in seconds
	Duration int `json:"duration,omitempty"`

	// Animation width
	Width int `json:"width,omitempty"`

	// Animation height
	Height int `json:"height,omitempty"`

	// Thumbnail of the file sent. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 90. 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>.
	Thumb *InputFile `json:"thumb,omitempty"`

	// Animation caption (may also be used when resending animation by file_id), 0-200 characters
	Caption string `json:"caption,omitempty"`

	// Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
	ParseMode string `json:"parse_mode,omitempty"`

	// List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`

	// Sends the message silently. Users will receive a notification with no sound.
	DisableNotification bool `json:"disable_notification,omitempty"`

	// If the message is a reply, ID of the original message
	ReplyToMessageID int64 `json:"reply_to_message_id,omitempty"`

	// 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"`

	// 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.
	ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"`
}

SendAnimation represents data for SendAnimation method.

func NewAnimation

func NewAnimation(chatID ChatID, animation *InputFile) SendAnimation

type SendAudio

type SendAudio struct {
	ChatID ChatID `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.
	Audio *InputFile `json:"audio"`

	// Audio caption, 0-1024 characters
	Caption string `json:"caption,omitempty"`

	// Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
	ParseMode string `json:"parse_mode,omitempty"`

	// List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`

	// Duration of the audio in seconds
	Duration int `json:"duration,omitempty"`

	// Performer
	Performer string `json:"performer,omitempty"`

	// Track name
	Title string `json:"title,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>.
	Thumb *InputFile `json:"thumb,omitempty"`

	// Sends the message silently. Users will receive a notification with no sound.
	DisableNotification bool `json:"disable_notification,omitempty"`

	// If the message is a reply, ID of the original message
	ReplyToMessageID int64 `json:"reply_to_message_id,omitempty"`

	// 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"`

	// 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.
	ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"`
}

SendAudio represents data for SendAudio method.

func NewAudio

func NewAudio(chatID ChatID, audio *InputFile) SendAudio

type SendChatAction

type SendChatAction struct {
	ChatID ChatID `json:"chat_id"`

	// Type of action to broadcast
	Action string `json:"action"`
}

SendChatAction represents data for SendChatAction method.

type SendContact

type SendContact struct {
	ChatID ChatID `json:"chat_id"`

	// Contact's phone number
	PhoneNumber string `json:"phone_number"`

	// Contact's first name
	FirstName string `json:"first_name"`

	// Contact's last name
	LastName string `json:"last_name"`

	// Additional data about the contact in the form of a vCard, 0-2048 bytes
	VCard string `json:"vcard,omitempty"`

	// Sends the message silently. Users will receive a notification with no sound.
	DisableNotification bool `json:"disable_notification,omitempty"`

	// If the message is a reply, ID of the original message
	ReplyToMessageID int64 `json:"reply_to_message_id,omitempty"`

	// 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"`

	// 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.
	ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"`
}

SendContact represents data for SendContact method.

func NewContact

func NewContact(chatID ChatID, phoneNumber, firstName string) SendContact

type SendDice

type SendDice struct {
	ChatID ChatID `json:"chat_id"`

	// Emoji on which the dice throw animation is based. Currently, must be one of “🎲”, “🎯”, “🏀”,
	// “⚽”, or “🎰”. Dice can have values 1-6 for “🎲” and “🎯”, values 1-5 for “🏀” and “⚽”, and values
	// 1-64 for “🎰”. Defaults to “🎲”
	Emoji string `json:"emoji,omitempty"`

	// Sends the message silently. Users will receive a notification with no sound.
	DisableNotification bool `json:"disable_notification,omitempty"`

	// If the message is a reply, ID of the original message
	ReplyToMessageID int64 `json:"reply_to_message_id,omitempty"`

	// 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"`

	// 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.
	ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"`
}

SendDice represents data for SendDice method.

type SendDocument

type SendDocument struct {
	ChatID ChatID `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.
	Document *InputFile `json:"document"`

	// 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>.
	Thumb *InputFile `json:"thumb,omitempty"`

	// Document caption (may also be used when resending documents by file_id), 0-200 characters
	Caption string `json:"caption,omitempty"`

	// Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
	ParseMode string `json:"parse_mode,omitempty"`

	// List of special entities that appear in the 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"`

	// Sends the message silently. Users will receive a notification with no sound.
	DisableNotification bool `json:"disable_notification,omitempty"`

	// If the message is a reply, ID of the original message
	ReplyToMessageID int64 `json:"reply_to_message_id,omitempty"`

	// 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"`

	// 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.
	ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"`
}

SendDocument represents data for SendDocument method.

func NewDocument

func NewDocument(chatID ChatID, document *InputFile) SendDocument

type SendGame

type SendGame struct {
	// Unique identifier for the target chat
	ChatID int64 `json:"chat_id"`

	// Short name of the game, serves as the unique identifier for the game. Set up your games via
	// BotFather.
	GameShortName string `json:"game_short_name"`

	// Sends the message silently. Users will receive a notification with no sound.
	DisableNotification bool `json:"disable_notification,omitempty"`

	// If the message is a reply, ID of the original message.
	ReplyToMessageID int64 `json:"reply_to_message_id,omitempty"`

	// 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"`

	// 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.
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}

SendGameParameters represents data for SendGame method.

func NewGame

func NewGame(chatID int64, gameShortName string) SendGame

type SendInvoice

type SendInvoice struct {
	// Unique identifier for the target private chat
	ChatID int64 `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
	ProviderToken string `json:"provider_token"`

	// Unique deep-linking parameter that can be used to generate this invoice when used as a start parameter
	StartParameter string `json:"start_parameter,omitempty"`

	// Three-letter ISO 4217 currency code, see more on currencies
	Currency string `json:"currency"`

	// JSON-encoded 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"`

	// 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"`

	// Price breakdown, a list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.)
	Prices []*LabeledPrice `json:"prices"`

	// The maximum accepted amount for tips in the smallest units of the currency (integer, not
	// float/double). 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
	MaxTipAmount int `json:"max_tip_amount,omitempty"`

	// 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"`

	// Photo size
	PhotoSize int `json:"photo_size,omitempty"`

	// Photo width
	PhotoWidth int `json:"photo_width,omitempty"`

	// Photo height
	PhotoHeight int `json:"photo_height,omitempty"`

	// If the message is a reply, ID of the original message
	ReplyToMessageID int64 `json:"reply_to_message_id,omitempty"`

	// Pass True, if you require the user's full name to complete the order
	NeedName bool `json:"need_name,omitempty"`

	// Pass True, if you require the user's phone number to complete the order
	NeedPhoneNumber bool `json:"need_phone_number,omitempty"`

	// Pass True, if you require the user's email to complete the order
	NeedEmail bool `json:"need_email,omitempty"`

	// Pass True, if you require the user's shipping address to complete the order
	NeedShippingAddress bool `json:"need_shipping_address,omitempty"`

	// Pass True, if the final price depends on the shipping method
	IsFlexible bool `json:"is_flexible,omitempty"`

	// Sends the message silently. Users will receive a notification with no sound.
	DisableNotification bool `json:"disable_notification,omitempty"`

	// 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"`

	// 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.
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}

SendInvoiceParameters represents data for SendInvoice method.

func NewInvoice

func NewInvoice(chatID int64, title, description, payload, providerToken, startParameter, currency string,
	prices ...*LabeledPrice) SendInvoice

type SendLocation

type SendLocation struct {
	ChatID ChatID `json:"chat_id"`

	// Latitude of the location
	Latitude float64 `json:"latitude"`

	// Longitude of the location
	Longitude float64 `json:"longitude"`

	// The radius of uncertainty for the location, measured in meters; 0-1500
	HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"`

	// Period in seconds for which the location will be updated (see Live Locations), should be between 60
	// and 86400.
	LivePeriod int `json:"live_period,omitempty"`

	// 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"`

	// 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"`

	// Sends the message silently. Users will receive a notification with no sound.
	DisableNotification bool `json:"disable_notification,omitempty"`

	// If the message is a reply, ID of the original message
	ReplyToMessageID int64 `json:"reply_to_message_id,omitempty"`

	// 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"`

	// 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.
	ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"`
}

SendLocation represents data for SendLocation method.

func NewLocation

func NewLocation(chatID ChatID, latitude, longitude float64) SendLocation

type SendMediaGroup

type SendMediaGroup struct {
	ChatID ChatID `json:"chat_id" form:"chat_id"`

	// A JSON-serialized array describing photos and videos to be sent, must include 2–10 items
	Media []AlbumMedia `json:"media" form:"media"`

	// Sends the messages silently. Users will receive a notification with no sound.
	DisableNotification bool `json:"disable_notification,omitempty" form:"disable_notification"`

	// If the messages are a reply, ID of the original message
	ReplyToMessageID int64 `json:"reply_to_message_id,omitempty" form:"reply_to_message_id"`

	// 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" form:"reply_to_message_id"`
}

SendMediaGroup represents data for SendMediaGroup method.

func NewMediaGroup

func NewMediaGroup(chatID ChatID, media ...AlbumMedia) SendMediaGroup

type SendMessage

type SendMessage struct {
	ChatID ChatID `json:"chat_id"`

	// Text of the message to be sent
	Text string `json:"text"`

	// Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.
	ParseMode string `json:"parse_mode,omitempty"`

	// List of special entities that appear in the caption, which can be specified instead of parse_mode
	Entities []*MessageEntity `json:"entities,omitempty"`

	// Disables link previews for links in this message
	DisableWebPagePreview bool `json:"disable_web_page_preview,omitempty"`

	// Sends the message silently. Users will receive a notification with no sound.
	DisableNotification bool `json:"disable_notification,omitempty"`

	// If the message is a reply, ID of the original message
	ReplyToMessageID int64 `json:"reply_to_message_id,omitempty"`

	// 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"`

	// 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.
	ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"`
}

SendMessage represents data for SendMessage method.

func NewMessage

func NewMessage(chatID ChatID, text string) SendMessage

type SendPhoto

type SendPhoto struct {
	ChatID ChatID `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.
	Photo *InputFile `json:"photo"`

	// Photo caption (may also be used when resending photos by file_id), 0-200 characters
	Caption string `json:"caption,omitempty"`

	// Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
	ParseMode string `json:"parse_mode,omitempty"`

	// List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`

	// Sends the message silently. Users will receive a notification with no sound.
	DisableNotification bool `json:"disable_notification,omitempty"`

	// If the message is a reply, ID of the original message
	ReplyToMessageID int64 `json:"reply_to_message_id,omitempty"`

	// 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"`

	// 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.
	ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"`
}

SendPhoto represents data for SendPhoto method.

func NewPhoto

func NewPhoto(chatID ChatID, photo *InputFile) SendPhoto

type SendPoll

type SendPoll struct {
	ChatID ChatID `json:"chat_id"`

	// Poll question, 1-300 characters
	Question string `json:"question"`

	// List of answer options, 2-10 strings 1-100 characters each
	Options []string `json:"options"`

	// True, if the poll needs to be anonymous, defaults to True
	IsAnonymous bool `json:"is_anonymous,omitempty"`

	// Poll type, “quiz” or “regular”, defaults to “regular”
	Type string `json:"type,omitempty"`

	// True, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to False
	AllowsMultipleAnswers bool `json:"allows_multiple_answers,omitempty"`

	// 0-based identifier of the correct answer option, required for polls in quiz mode
	CorrectOptionID int64 `json:"correct_option_id,omitempty"`

	// 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"`

	// Mode for parsing entities in the explanation. See formatting options for more details.
	ExplanationParseMode string `json:"explanation_parse_mode,omitempty"`

	// List of special entities that appear in the caption, which can be specified instead of parse_mode
	ExplanationEntities []*MessageEntity `json:"explanation_entities,omitempty"`

	// 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"`

	// 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"`

	// Pass True, if the poll needs to be immediately closed
	IsClosed bool `json:"is_closed,omitempty"`

	// Sends the message silently. Users will receive a notification with no sound.
	DisableNotification bool `json:"disable_notification,omitempty"`

	// If the message is a reply, ID of the original message
	ReplyToMessageID int64 `json:"reply_to_message_id,omitempty"`

	// 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"`

	// 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.
	ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"`
}

SendPoll represents data for SendPoll method.

func NewPoll

func NewPoll(chatID ChatID, question string, options ...string) SendPoll

type SendSticker

type SendSticker struct {
	ChatID ChatID `json:"chat_id"`

	// Sticker to send
	Sticker *InputFile `json:"sticker"`

	// Sends the message silently. Users will receive a notification with no sound
	DisableNotification bool `json:"disable_notification,omitempty"`

	// If the message is a reply, ID of the original message
	ReplyToMessageID int64 `json:"reply_to_message_id,omitempty"`

	// 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"`

	// 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.
	ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"`
}

SendStickerParameters represents data for SetSticker method.

func NewSticker

func NewSticker(chatID ChatID, sticker *InputFile) SendSticker

type SendVenue

type SendVenue struct {
	ChatID ChatID `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"`

	// Foursquare identifier of the venue
	FoursquareID string `json:"foursquare_id,omitempty"`

	// Foursquare type of the venue, if known. (For example, "arts_entertainment/default",
	// "arts_entertainment/aquarium" or "food/icecream".)
	FoursquareType string `json:"foursquare_type,omitempty"`

	// Google Places identifier of the venue
	GooglePlaceID string `json:"google_place_id,omitempty"`

	// Google Places type of the venue.
	GooglePlaceType string `json:"google_place_type,omitempty"`

	// Sends the message silently. Users will receive a notification with no sound.
	DisableNotification bool `json:"disable_notification,omitempty"`

	// If the message is a reply, ID of the original message
	ReplyToMessageID int64 `json:"reply_to_message_id,omitempty"`

	// 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"`

	// 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.
	ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"`
}

SendVenue represents data for SendVenue method.

func NewVenue

func NewVenue(chatID ChatID, lat, long float64, title, address string) SendVenue

type SendVideo

type SendVideo struct {
	ChatID ChatID `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.
	Video *InputFile `json:"video"`

	// Duration of sent video in seconds
	Duration int `json:"duration,omitempty"`

	// Video width
	Width int `json:"width,omitempty"`

	// Video 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>.
	Thumb *InputFile `json:"thumb,omitempty"`

	// Video caption (may also be used when resending videos by file_id), 0-1024 characters
	Caption string `json:"caption,omitempty"`

	// Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
	ParseMode string `json:"parse_mode,omitempty"`

	// List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`

	// Pass True, if the uploaded video is suitable for streaming
	SupportsStreaming bool `json:"supports_streaming,omitempty"`

	// Sends the message silently. Users will receive a notification with no sound.
	DisableNotification bool `json:"disable_notification,omitempty"`

	// If the message is a reply, ID of the original message
	ReplyToMessageID int64 `json:"reply_to_message_id,omitempty"`

	// 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"`

	// 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.
	ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"`
}

SendDocument represents data for SendVideo method.

func NewVideo

func NewVideo(chatID ChatID, video *InputFile) SendVideo

type SendVideoNote

type SendVideoNote struct {
	ChatID ChatID `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.. Sending video notes by a URL is currently unsupported
	VideoNote *InputFile `json:"video_note"`

	// Duration of sent video in seconds
	Duration int `json:"duration,omitempty"`

	// 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>.
	Thumb *InputFile `json:"thumb,omitempty"`

	// Sends the message silently. Users will receive a notification with no sound.
	DisableNotification bool `json:"disable_notification,omitempty"`

	// If the message is a reply, ID of the original message
	ReplyToMessageID int64 `json:"reply_to_message_id,omitempty"`

	// 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"`

	// 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.
	ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"`
}

SendVideoNote represents data for SendVideoNote method.

func NewVideoNote

func NewVideoNote(chatID ChatID, videoNote *InputFile) SendVideoNote

type SendVoice

type SendVoice struct {
	ChatID ChatID `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.
	Voice *InputFile `json:"voice"`

	// Voice message caption, 0-1024 characters
	Caption string `json:"caption,omitempty"`

	// Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
	ParseMode string `json:"parse_mode,omitempty"`

	// List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`

	// Duration of the voice message in seconds
	Duration int `json:"duration,omitempty"`

	// Sends the message silently. Users will receive a notification with no sound.
	DisableNotification bool `json:"disable_notification,omitempty"`

	// If the message is a reply, ID of the original message
	ReplyToMessageID int64 `json:"reply_to_message_id,omitempty"`

	// 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"`

	// 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.
	ReplyMarkup ReplyMarkup `json:"reply_markup,omitempty"`
}

SendVoice represents data for SendVoice method.

func NewVoice

func NewVoice(chatID ChatID, voice *InputFile) SendVoice

type SetChatAdministratorCustomTitle

type SetChatAdministratorCustomTitle struct {
	ChatID ChatID `json:"chat_id"`

	// Unique identifier of the target user
	UserID int64 `json:"user_id"`

	// New custom title for the administrator; 0-16 characters, emoji are not allowed
	CustomTitle string `json:"custom_title"`
}

SetChatAdministratorCustomTitle represents data for SetChatAdministratorCustomTitle method.

type SetChatDescription

type SetChatDescription struct {
	ChatID ChatID `json:"chat_id"`

	// New chat description, 0-255 characters
	Description string `json:"description"`
}

SetChatDescription represents data for SetChatDescription method.

type SetChatPermissions

type SetChatPermissions struct {
	ChatID ChatID `json:"chat_id"`

	// New default chat permissions
	Permissions ChatPermissions `json:"permissions"`
}

SetChatPermissions represents data for SetChatPermissions method.

type SetChatPhoto

type SetChatPhoto struct {
	ChatID ChatID `json:"chat_id"`

	// New chat photo, uploaded using multipart/form-data
	ChatPhoto InputFile `json:"chat_photo"`
}

SetChatPhoto represents data for SetChatPhoto method.

type SetChatStickerSet

type SetChatStickerSet struct {
	ChatID ChatID `json:"chat_id"`

	// Name of the sticker set to be set as the group sticker set
	StickerSetName string `json:"sticker_set_name"`
}

SetChatStickerSet represents data for SetChatStickerSet method.

type SetChatTitle

type SetChatTitle struct {
	ChatID ChatID `json:"chat_id"`

	// New chat title, 1-255 characters
	Title string `json:"title"`
}

SetChatTitle represents data for SetChatTitle method.

type SetGameScore

type SetGameScore struct {
	// User identifier
	UserID int64 `json:"user_id"`

	// New score, must be non-negative
	Score int `json:"score"`

	// Required if inline_message_id is not specified. Identifier of the sent message
	MessageID int64 `json:"message_id,omitempty"`

	// 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"`

	// Pass True, if the game message should not be automatically edited to include the current scoreboard
	DisableEditMessage bool `json:"disable_edit_message,omitempty"`

	// Required if inline_message_id is not specified. Unique identifier for the target chat
	ChatID int64 `json:"chat_id,omitempty"`

	// Required if chat_id and message_id are not specified. Identifier of the inline message
	InlineMessageID string `json:"inline_message_id,omitempty"`
}

SetGameScoreParameters represents data for SetGameScore method.

func NewGameScore

func NewGameScore(userID int64, score int) SetGameScore

type SetMyCommands

type SetMyCommands 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"`

	// A JSON-serialized object, describing scope of users for which the commands are relevant. Defaults to
	// BotCommandScopeDefault.
	Scope BotCommandScope `json:"scope,omitempty"`

	// 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 string `json:"language_code,omitempty"`
}

SetMyCommands represents data for SetMyCommands method.

type SetPassportDataErrors

type SetPassportDataErrors struct {
	// User identifier
	UserID int64 `json:"user_id"`

	// A JSON-serialized array describing the errors
	Errors []PassportElementError `json:"errors"`
}

type SetStickerPositionInSet

type SetStickerPositionInSet struct {
	// File identifier of the sticker
	Sticker string `json:"sticker"`

	// New sticker position in the set, zero-based
	Position int `json:"position"`
}

SetStickerPositionInSetParameters represents data for SetStickerPositionInSet method.

type SetStickerSetThumb

type SetStickerSetThumb struct {
	// Sticker set name
	Name string `json:"name"`

	// User identifier of the sticker set owner
	UserID int64 `json:"user_id"`

	// 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/animated_stickers#technical-requirements for animated 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
	// thumbnail can't be uploaded via HTTP URL.
	Thumb *InputFile `json:"thumb,omitempty"`
}

SetStickerSetThumb represents data for SetStickerSetThumb method.

type SetWebhook

type SetWebhook struct {
	// HTTPS url to send updates to. Use an empty string to remove webhook integration
	URL string `json:"url"`

	// Upload your public key certificate so that the root certificate in use can be checked. See our self-signed guide for details.
	Certificate InputFile `json:"certificate,omitempty"`

	// The fixed IP address which will be used to send webhook requests instead of the IP address resolved
	// through DNS
	IpAddress net.IP `json:"ip_address,omitempty"`

	// 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"`

	// List the types of updates 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 updates regardless of type (default). If not specified, the previous setting will be used.
	//
	// 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 []string `json:"allowed_updates,omitempty"`

	// Pass True to drop all pending updates
	DropPendingUpdates bool `json:"drop_pending_updates,omitempty"`
}

SetWebhookParameters represents data for SetWebhook method.

type ShippingAddress

type ShippingAddress struct {
	// ISO 3166-1 alpha-2 country code
	CountryCode 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 post code
	PostCode string `json:"post_code"`
}

ShippingAddress represents a shipping address.

type ShippingOption

type ShippingOption struct {
	// Shipping option identifier
	ID string `json:"id"`

	// Option title
	Title string `json:"title"`

	// List of price portions
	Prices []*LabeledPrice `json:"prices"`
}

ShippingOption represents one shipping option.

type ShippingQuery

type ShippingQuery struct {
	// Unique query identifier
	ID string `json:"id"`

	// Bot specified invoice payload
	InvoicePayload string `json:"invoice_payload"`

	// User who sent the query
	From *User `json:"from"`

	// User specified shipping address
	ShippingAddress *ShippingAddress `json:"shipping_address"`
}

ShippingQuery contains information about an incoming shipping query.

type Sticker

type Sticker struct {
	// Identifier for this file, which can be used to download or reuse the file
	FileID string `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 string `json:"file_unique_id"`

	// Sticker width
	Width int `json:"width"`

	// Sticker height
	Height int `json:"height"`

	// true, if the sticker is animated
	IsAnimated bool `json:"is_animated"`

	// Sticker thumbnail in the .webp or .jpg format
	Thumb *PhotoSize `json:"thumb,omitempty"`

	// Emoji associated with the sticker
	Emoji string `json:"emoji,omitempty"`

	// Name of the sticker set to which the sticker belongs
	SetName string `json:"set_name,omitempty"`

	// For mask stickers, the position where the mask should be placed
	MaskPosition *MaskPosition `json:"mask_position,omitempty"`

	// File size
	FileSize int `json:"file_size,omitempty"`
}

Sticker represents a sticker.

func (Sticker) File

func (s Sticker) File() File

func (Sticker) HasThumb

func (s Sticker) HasThumb() bool

func (Sticker) InSet

func (s Sticker) InSet() bool

InSet checks that the current sticker in the stickers set.

func (Sticker) IsMask

func (s Sticker) IsMask() bool

type StickerSet

type StickerSet struct {
	// Sticker set name
	Name string `json:"name"`

	// Sticker set title
	Title string `json:"title"`

	// List of all set stickers
	Stickers []*Sticker `json:"stickers"`

	// True, if the sticker set contains masks
	ContainsMasks bool `json:"contains_masks"`

	// true, if the sticker set contains animated stickers
	IsAnimated bool `json:"is_animated"`

	// Sticker set thumbnail in the .WEBP or .TGS format
	Thumb *PhotoSize `json:"thumb,omitempty"`
}

StickerSet represents a sticker set.

type StopMessageLiveLocation

type StopMessageLiveLocation struct {
	ChatID ChatID `json:"chat_id,omitempty"`

	// Required if inline_message_id is not specified. Identifier of the message with live location to stop
	MessageID int64 `json:"message_id,omitempty"`

	// Required if chat_id and message_id are not specified. Identifier of the inline message
	InlineMessageID string `json:"inline_message_id,omitempty"`

	// A JSON-serialized object for a new inline keyboard.
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}

StopMessageLiveLocation represents data for StopMessageLiveLocation method.

type StopPoll

type StopPoll struct {
	ChatID ChatID `json:"chat_id"`

	// Identifier of the original message with the poll
	MessageID int64 `json:"message_id"`

	// A JSON-serialized object for a new message inline keyboard.
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}

func NewStopPoll

func NewStopPoll(chatID ChatID, messageID int64) StopPoll

type SuccessfulPayment

type SuccessfulPayment struct {
	// Three-letter ISO 4217 currency code
	Currency string `json:"currency"`

	// Bot specified invoice payload
	InvoicePayload string `json:"invoice_payload"`

	// Identifier of the shipping option chosen by the user
	ShippingOptionID string `json:"shipping_option_id,omitempty"`

	// Telegram payment identifier
	TelegramPaymentChargeID string `json:"telegram_payment_charge_id"`

	// Provider payment identifier
	ProviderPaymentChargeID string `json:"provider_payment_charge_id"`

	// 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).
	TotalAmount int `json:"total_amount"`

	// Order info provided by the user
	OrderInfo *OrderInfo `json:"order_info,omitempty"`
}

SuccessfulPayment contains basic information about a successful payment.

type UnbanChatMember

type UnbanChatMember struct {
	ChatID ChatID `json:"chat_id"`

	// Unique identifier of the target user
	UserID int64 `json:"user_id"`

	// Do nothing if the user is not banned
	OnlyIfBanned bool `json:"only_if_banned,omitempty"`
}

UnbanChatMember represents data for UnbanChatMember method.

type UnpinAllChatMessages

type UnpinAllChatMessages struct {
	ChatID ChatID `json:"chat_id"`
}

UnpinAllChatMessages represents data for UnpinAllChatMessages method.

type UnpinChatMessage

type UnpinChatMessage struct {
	ChatID ChatID `json:"chat_id"`

	// Identifier of a message to unpin. If not specified, the most recent pinned message (by sending
	// date) will be unpinned.
	MessageID int64 `json:"messge_id,omitempty"`
}

UnpinChatMessage represents data for UnpinChatMessage method.

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.
	ID int64 `json:"update_id"`

	// New incoming message of any kind — text, photo, sticker, etc.
	Message *Message `json:"message,omitempty"`

	// New version of a message that is known to the bot and was edited
	EditedMessage *Message `json:"edited_message,omitempty"`

	// New incoming channel post of any kind — text, photo, sticker, etc.
	ChannelPost *Message `json:"channel_post,omitempty"`

	// New version of a channel post that is known to the bot and was edited
	EditedChannelPost *Message `json:"adited_channel_post,omitempty"`

	// New incoming inline query
	InlineQuery *InlineQuery `json:"inline_query,omitempty"`

	// The result of an inline query that was chosen by a user and sent to their chat partner.
	ChosenInlineResult *ChosenInlineResult `json:"chosen_inline_result,omitempty"`

	// New incoming callback query
	CallbackQuery *CallbackQuery `json:"callback_query,omitempty"`

	// New incoming shipping query. Only for invoices with flexible price
	ShippingQuery *ShippingQuery `json:"shipping_query,omitempty"`

	// New incoming pre-checkout query. Contains full information about checkout
	PreCheckoutQuery *PreCheckoutQuery `json:"pre_checkout_query,omitempty"`

	// New poll state. Bots receive only updates about polls, which are sent or stopped by the bot
	Poll *Poll `json:"poll,omitempty"`

	// 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"`

	// 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"`

	// 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"`
}

Update represents an incoming update.

At most one of the optional parameters can be present in any given update.

func (Update) IsCallbackQuery

func (u Update) IsCallbackQuery() bool

IsCallbackQuery checks that the current update is a callback query update.

func (Update) IsChannelPost

func (u Update) IsChannelPost() bool

IsChannelPost checks that the current update is a post channel creation event.

func (Update) IsChosenInlineResult

func (u Update) IsChosenInlineResult() bool

IsChosenInlineResult checks that the current update is a chosen inline result update.

func (Update) IsEditedChannelPost

func (u Update) IsEditedChannelPost() bool

IsEditedChannelPost checks that the current update is a editing post channel event.

func (Update) IsEditedMessage

func (u Update) IsEditedMessage() bool

IsEditedMessage checks that the current update is a editing message event.

func (Update) IsInlineQuery

func (u Update) IsInlineQuery() bool

IsInlineQuery checks that the current update is a inline query update.

func (Update) IsMessage

func (u Update) IsMessage() bool

IsMessage checks that the current update is a message creation event.

func (Update) IsPoll

func (u Update) IsPoll() bool

IsPoll checks that the current update is a poll update.

func (Update) IsPreCheckoutQuery

func (u Update) IsPreCheckoutQuery() bool

IsPreCheckoutQuery checks that the current update is a pre checkout query update.

func (Update) IsShippingQuery

func (u Update) IsShippingQuery() bool

IsShippingQuery checks that the current update is a shipping query update.

func (Update) Type

func (u Update) Type() string

Type return update type for current update.

type UpdatesChannel

type UpdatesChannel chan *Update

UpdatesChannel represents channel for incoming updates.

type UploadStickerFile

type UploadStickerFile struct {
	// User identifier of sticker file owner
	UserID int64 `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.
	PNGSticker *InputFile `json:"png_sticker"`
}

type User

type User struct {
	// Unique identifier for this user or bot
	ID int64 `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"`

	// User‘s or bot’s last name
	LastName string `json:"last_name,omitempty"`

	// User‘s or bot’s username
	Username string `json:"username,omitempty"`

	// IETF language tag of the user's language
	LanguageCode string `json:"language_code,omitempty"`

	// True, if the bot can be invited to groups. Returned only in getMe.
	CanJoinGroups bool `json:"can_join_groups,omitempty"`

	// True, if privacy mode is disabled for the bot. Returned only in getMe.
	CanReadAllGroupMessages bool `json:"can_read_all_group_messages,omitempty"`

	// True, if the bot supports inline queries. Returned only in getMe.
	SupportsInlineQueries bool `json:"supports_inline_queries,omitempty"`
}

User represents a Telegram user or bot.

func (User) FullName

func (u User) FullName() string

FullName returns the full name of user or FirstName if LastName is not available.

func (User) HasLastName

func (u User) HasLastName() bool

HaveLastName checks what the current user has a LastName.

func (User) HasUsername

func (u User) HasUsername() bool

HaveUsername checks what the current user has a username.

func (User) IsAnonymous

func (u User) IsAnonymous() bool

IsAnonymous checks what the current user is a anonymous group admin.

func (User) IsForwarder

func (u User) IsForwarder() bool

IsChannel checks what the current user is a channel, which message is automatically forwarded to a discussion group.

func (User) Language

func (u User) Language() language.Tag

Language parse LanguageCode of current user and returns language.Tag.

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 []Photo `json:"photos"`
}

UserProfilePhotos represent a user's profile pictures.

type Venue

type Venue struct {
	// Venue location
	Location *Location `json:"location"`

	// Name of the venue
	Title string `json:"title"`

	// Address of the venue
	Address string `json:"address"`

	// Foursquare identifier of the venue
	FoursquareID string `json:"foursquare_id,omitempty"`

	// Foursquare type of the venue. (For example, "arts_entertainment/default", "arts_entertainment/aquarium" or "food/icecream".)
	FoursquareType string `json:"foursquare_type,omitempty"`

	// Google Places identifier of the venue
	GooglePlaceID string `json:"google_place_id,omitempty"`

	// Google Places type of the venue.
	GooglePlaceType string `json:"google_place_type,omitempty"`
}

Venue represents a venue.

type Video

type Video struct {
	// Identifier for this file, which can be used to download or reuse the file
	FileID string `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 string `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"`

	// Video thumbnail
	Thumb *PhotoSize `json:"thumb,omitempty"`

	// Original filename as defined by sender
	FileName string `json:"file_name,omitempty"`

	// Mime type of a file as defined by sender
	MimeType string `json:"mime_type,omitempty"`

	// File size
	FileSize int `json:"file_size,omitempty"`
}

Video represents a video file.

func (Video) File

func (v Video) File() File

func (Video) HasThumb

func (v Video) HasThumb() bool

type VideoNote

type VideoNote struct {
	// Identifier for this file, which can be used to download or reuse the file
	FileID string `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 string `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"`

	// Video thumbnail
	Thumb *PhotoSize `json:"thumb,omitempty"`

	// File size
	FileSize int `json:"file_size,omitempty"`
}

VideoNote represents a video message (available in Telegram apps as of v.4.0).

func (VideoNote) File

func (vn VideoNote) File() File

func (VideoNote) HasThumb

func (vn VideoNote) HasThumb() bool

type Voice

type Voice struct {
	// Identifier for this file, which can be used to download or reuse the file
	FileID string `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 string `json:"file_unique_id"`

	// Duration of the audio in seconds as defined by sender
	Duration int `json:"duration"`

	// MIME type of the file as defined by sender
	MimeType string `json:"mime_type,omitempty"`

	// File size
	FileSize int `json:"file_size,omitempty"`
}

Voice represents a voice note.

func (Voice) File

func (v Voice) File() File

type VoiceChatEnded added in v5.1.0

type VoiceChatEnded struct {
	// Voice chat duration; in seconds
	Duration int64 `json:"duration"`
}

VoiceChatEnded represents a service message about a voice chat ended in the chat.

type VoiceChatParticipantsInvited added in v5.1.0

type VoiceChatParticipantsInvited struct {
	// New members that were invited to the voice chat
	Users []*User `json:"users,omitempty"`
}

VoiceChatParticipantsInvited represents a service message about new members invited to a voice chat.

type VoiceChatScheduled added in v5.2.0

type VoiceChatScheduled struct {
	// Point in time (Unix timestamp) when the voice chat is supposed to be started by a chat administrator
	StartDate int64 `json:"start_date"`
}

VoiceChatScheduled represents a service message about a voice chat scheduled in the chat.

type VoiceChatStarted added in v5.1.0

type VoiceChatStarted struct{}

VoiceChatStarted represents a service message about a voice chat started in the chat. Currently holds no information.

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"`

	// Currently used webhook IP address
	IpAddress net.IP `json:"ip_address,omitempty"`

	// 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"`

	// Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery
	MaxConnections int `json:"max_connections,omitempty"`

	// Unix time for the most recent error that happened when trying to deliver an update via webhook
	LastErrorDate int64 `json:"last_error_date,omitempty"`

	// A list of update types the bot is subscribed to. Defaults to all update types
	AllowedUpdates []string `json:"allowed_updates,omitempty"`
}

WebhookInfo contains information about the current status of a webhook.

func (WebhookInfo) HasURL

func (w WebhookInfo) HasURL() bool

func (WebhookInfo) LastErrorTime

func (w WebhookInfo) LastErrorTime() time.Time

func (WebhookInfo) URI

func (w WebhookInfo) URI() *http.URI

Directories

Path Synopsis
Package login contains methods for obtaining structure of the user data and its validation.
Package login contains methods for obtaining structure of the user data and its validation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL