gotgbot

package module
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2024 License: MIT Imports: 14 Imported by: 0

README

Golang Telegram Bot library

Heavily inspired by the python-telegram-bot library, this package is a code-generated wrapper for the telegram bot api. We also provide an extensions package which defines an updater/dispatcher pattern to provide update processing out of the box.

All the telegram types and methods are generated from a bot api spec. These are generated in the gen_*.go files.

If you have any questions, come find us in our telegram support chat!

Features:

  • All telegram API types and methods are generated from the bot api docs, which makes this library:
    • Guaranteed to match the docs
    • Easy to update
    • Self-documenting (Re-uses pre-existing telegram docs)
  • Type safe; no weird interface{} logic, all types match the bot API docs.
  • No third party library bloat; only uses standard library.
  • Updates are each processed in their own go routine, encouraging concurrent processing, and keeping your bot responsive.
  • Code panics are automatically recovered from and logged, avoiding unexpected downtime.

Getting started

Download the library with the standard go get command:

go get github.com/PaulSonOfLars/gotgbot/v2
Example bots

Sample bots can be found in the samples directory.

Some recommended bots to look at:

Docs

Docs can be found here.

Contributing

Contributions are welcome! More information on contributing can be found here.

Regenerating the generated code.

If you've made changes to the code generation, you will probably need to regenerate the library code. This can be done simply by running go generate from the repo root. Running this will generate the code from the specification repo at the commit pinned in the spec_commit file.

To upgrade the commit in spec_commit and regenerate your code, simply run GOTGBOT_UPGRADE=true go generate. This will fetch the latest commit sha, and regenerate the library against that, giving you the latest version available.

Documentation

Index

Constants

View Source
const (
	UpdateTypeMessage                 = "message"
	UpdateTypeEditedMessage           = "edited_message"
	UpdateTypeChannelPost             = "channel_post"
	UpdateTypeEditedChannelPost       = "edited_channel_post"
	UpdateTypeBusinessConnection      = "business_connection"
	UpdateTypeBusinessMessage         = "business_message"
	UpdateTypeEditedBusinessMessage   = "edited_business_message"
	UpdateTypeDeletedBusinessMessages = "deleted_business_messages"
	UpdateTypeMessageReaction         = "message_reaction"
	UpdateTypeMessageReactionCount    = "message_reaction_count"
	UpdateTypeInlineQuery             = "inline_query"
	UpdateTypeChosenInlineResult      = "chosen_inline_result"
	UpdateTypeCallbackQuery           = "callback_query"
	UpdateTypeShippingQuery           = "shipping_query"
	UpdateTypePreCheckoutQuery        = "pre_checkout_query"
	UpdateTypePoll                    = "poll"
	UpdateTypePollAnswer              = "poll_answer"
	UpdateTypeMyChatMember            = "my_chat_member"
	UpdateTypeChatMember              = "chat_member"
	UpdateTypeChatJoinRequest         = "chat_join_request"
	UpdateTypeChatBoost               = "chat_boost"
	UpdateTypeRemovedChatBoost        = "removed_chat_boost"
)

The consts listed below represent all the update types that can be requested from telegram.

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

The consts listed below represent all the parse_mode options that can be sent to telegram.

View Source
const (
	ChatActionTyping          = "typing"
	ChatActionUploadPhoto     = "upload_photo"
	ChatActionRecordVideo     = "record_video"
	ChatActionUploadVideo     = "upload_video"
	ChatActionRecordVoice     = "record_voice"
	ChatActionUploadVoice     = "upload_voice"
	ChatActionUploadDocument  = "upload_document"
	ChatActionChooseSticker   = "choose_sticker"
	ChatActionFindLocation    = "find_location"
	ChatActionRecordVideoNote = "record_video_note"
	ChatActionUploadVideoNote = "upload_video_note"
)

The consts listed below represent all the chat action options that can be sent to telegram.

View Source
const (
	StickerTypeRegular     = "regular"
	StickerTypeMask        = "mask"
	StickerTypeCustomEmoji = "custom_emoji"
)

The consts listed below represent all the sticker types that can be obtained from telegram.

View Source
const (
	ChatTypePrivate    = "private"
	ChatTypeGroup      = "group"
	ChatTypeSupergroup = "supergroup"
	ChatTypeChannel    = "channel"
)

The consts listed below represent all the chat types that can be obtained from telegram.

View Source
const (
	// DefaultAPIURL is the default telegram API URL.
	DefaultAPIURL = "https://api.telegram.org"
	// DefaultTimeout is the default timeout to be set for all requests.
	DefaultTimeout = time.Second * 5
)

Variables

View Source
var ErrAttachmentKeyAlreadyExists = errors.New("key already exists")
View Source
var ErrNilBotClient = errors.New("nil BotClient")

Functions

This section is empty.

Types

type AddStickerToSetOpts

type AddStickerToSetOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

AddStickerToSetOpts is the set of optional fields for Bot.AddStickerToSet.

type Animation

type Animation 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 the sender
	Width int64 `json:"width"`
	// Video height as defined by the sender
	Height int64 `json:"height"`
	// Duration of the video in seconds as defined by the sender
	Duration int64 `json:"duration"`
	// Optional. Animation thumbnail as defined by the sender
	Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
	// Optional. Original animation filename as defined by the sender
	FileName string `json:"file_name,omitempty"`
	// Optional. MIME type of the file as defined by the sender
	MimeType string `json:"mime_type,omitempty"`
	// Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.
	FileSize int64 `json:"file_size,omitempty"`
}

Animation (https://core.telegram.org/bots/api#animation)

This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound).

type AnswerCallbackQueryOpts

type AnswerCallbackQueryOpts struct {
	// Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters
	Text string
	// 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
	// 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
	// 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 int64
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

AnswerCallbackQueryOpts is the set of optional fields for Bot.AnswerCallbackQuery.

type AnswerInlineQueryOpts

type AnswerInlineQueryOpts struct {
	// The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300.
	CacheTime int64
	// 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
	// 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
	// A JSON-serialized object describing a button to be shown above inline query results
	Button *InlineQueryResultsButton
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

AnswerInlineQueryOpts is the set of optional fields for Bot.AnswerInlineQuery.

type AnswerPreCheckoutQueryOpts

type AnswerPreCheckoutQueryOpts struct {
	// 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
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

AnswerPreCheckoutQueryOpts is the set of optional fields for Bot.AnswerPreCheckoutQuery.

type AnswerShippingQueryOpts

type AnswerShippingQueryOpts struct {
	// Required if ok is True. A JSON-serialized array of available shipping options.
	ShippingOptions []ShippingOption
	// 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
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

AnswerShippingQueryOpts is the set of optional fields for Bot.AnswerShippingQuery.

type AnswerWebAppQueryOpts

type AnswerWebAppQueryOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

AnswerWebAppQueryOpts is the set of optional fields for Bot.AnswerWebAppQuery.

type ApproveChatJoinRequestOpts

type ApproveChatJoinRequestOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

ApproveChatJoinRequestOpts is the set of optional fields for Bot.ApproveChatJoinRequest.

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 the sender
	Duration int64 `json:"duration"`
	// Optional. Performer of the audio as defined by the sender or by audio tags
	Performer string `json:"performer,omitempty"`
	// Optional. Title of the audio as defined by the sender or by audio tags
	Title string `json:"title,omitempty"`
	// Optional. Original filename as defined by the sender
	FileName string `json:"file_name,omitempty"`
	// Optional. MIME type of the file as defined by the sender
	MimeType string `json:"mime_type,omitempty"`
	// Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.
	FileSize int64 `json:"file_size,omitempty"`
	// Optional. Thumbnail of the album cover to which the music file belongs
	Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
}

Audio (https://core.telegram.org/bots/api#audio)

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

type BackgroundFill added in v2.1.0

type BackgroundFill interface {
	GetType() string
	// MergeBackgroundFill returns a MergedBackgroundFill struct to simplify working with complex telegram types in a non-generic world.
	MergeBackgroundFill() MergedBackgroundFill
	// contains filtered or unexported methods
}

BackgroundFill (https://core.telegram.org/bots/api#backgroundfill)

This object describes the way a background is filled based on the selected colors. Currently, it can be one of

  • BackgroundFillSolid
  • BackgroundFillGradient
  • BackgroundFillFreeformGradient

type BackgroundFillFreeformGradient added in v2.1.0

type BackgroundFillFreeformGradient struct {
	// A list of the 3 or 4 base colors that are used to generate the freeform gradient in the RGB24 format
	Colors []int64 `json:"colors,omitempty"`
}

BackgroundFillFreeformGradient (https://core.telegram.org/bots/api#backgroundfillfreeformgradient)

The background is a freeform gradient that rotates after every message in the chat.

func (BackgroundFillFreeformGradient) GetType added in v2.1.0

GetType is a helper method to easily access the common fields of an interface.

func (BackgroundFillFreeformGradient) MarshalJSON added in v2.1.0

func (v BackgroundFillFreeformGradient) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (BackgroundFillFreeformGradient) MergeBackgroundFill added in v2.1.0

func (v BackgroundFillFreeformGradient) MergeBackgroundFill() MergedBackgroundFill

MergeBackgroundFill returns a MergedBackgroundFill struct to simplify working with types in a non-generic world.

type BackgroundFillGradient added in v2.1.0

type BackgroundFillGradient struct {
	// Top color of the gradient in the RGB24 format
	TopColor int64 `json:"top_color"`
	// Bottom color of the gradient in the RGB24 format
	BottomColor int64 `json:"bottom_color"`
	// Clockwise rotation angle of the background fill in degrees; 0-359
	RotationAngle int64 `json:"rotation_angle"`
}

BackgroundFillGradient (https://core.telegram.org/bots/api#backgroundfillgradient)

The background is a gradient fill.

func (BackgroundFillGradient) GetType added in v2.1.0

func (v BackgroundFillGradient) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (BackgroundFillGradient) MarshalJSON added in v2.1.0

func (v BackgroundFillGradient) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (BackgroundFillGradient) MergeBackgroundFill added in v2.1.0

func (v BackgroundFillGradient) MergeBackgroundFill() MergedBackgroundFill

MergeBackgroundFill returns a MergedBackgroundFill struct to simplify working with types in a non-generic world.

type BackgroundFillSolid added in v2.1.0

type BackgroundFillSolid struct {
	// The color of the background fill in the RGB24 format
	Color int64 `json:"color"`
}

BackgroundFillSolid (https://core.telegram.org/bots/api#backgroundfillsolid)

The background is filled using the selected color.

func (BackgroundFillSolid) GetType added in v2.1.0

func (v BackgroundFillSolid) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (BackgroundFillSolid) MarshalJSON added in v2.1.0

func (v BackgroundFillSolid) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (BackgroundFillSolid) MergeBackgroundFill added in v2.1.0

func (v BackgroundFillSolid) MergeBackgroundFill() MergedBackgroundFill

MergeBackgroundFill returns a MergedBackgroundFill struct to simplify working with types in a non-generic world.

type BackgroundType added in v2.1.0

type BackgroundType interface {
	GetType() string
	// MergeBackgroundType returns a MergedBackgroundType struct to simplify working with complex telegram types in a non-generic world.
	MergeBackgroundType() MergedBackgroundType
	// contains filtered or unexported methods
}

BackgroundType (https://core.telegram.org/bots/api#backgroundtype)

This object describes the type of a background. Currently, it can be one of

  • BackgroundTypeFill
  • BackgroundTypeWallpaper
  • BackgroundTypePattern
  • BackgroundTypeChatTheme

type BackgroundTypeChatTheme added in v2.1.0

type BackgroundTypeChatTheme struct {
	// Name of the chat theme, which is usually an emoji
	ThemeName string `json:"theme_name"`
}

BackgroundTypeChatTheme (https://core.telegram.org/bots/api#backgroundtypechattheme)

The background is taken directly from a built-in chat theme.

func (BackgroundTypeChatTheme) GetType added in v2.1.0

func (v BackgroundTypeChatTheme) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (BackgroundTypeChatTheme) MarshalJSON added in v2.1.0

func (v BackgroundTypeChatTheme) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (BackgroundTypeChatTheme) MergeBackgroundType added in v2.1.0

func (v BackgroundTypeChatTheme) MergeBackgroundType() MergedBackgroundType

MergeBackgroundType returns a MergedBackgroundType struct to simplify working with types in a non-generic world.

type BackgroundTypeFill added in v2.1.0

type BackgroundTypeFill struct {
	// The background fill
	Fill BackgroundFill `json:"fill"`
	// Dimming of the background in dark themes, as a percentage; 0-100
	DarkThemeDimming int64 `json:"dark_theme_dimming"`
}

BackgroundTypeFill (https://core.telegram.org/bots/api#backgroundtypefill)

The background is automatically filled based on the selected colors.

func (BackgroundTypeFill) GetType added in v2.1.0

func (v BackgroundTypeFill) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (BackgroundTypeFill) MarshalJSON added in v2.1.0

func (v BackgroundTypeFill) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (BackgroundTypeFill) MergeBackgroundType added in v2.1.0

func (v BackgroundTypeFill) MergeBackgroundType() MergedBackgroundType

MergeBackgroundType returns a MergedBackgroundType struct to simplify working with types in a non-generic world.

func (*BackgroundTypeFill) UnmarshalJSON added in v2.1.0

func (v *BackgroundTypeFill) UnmarshalJSON(b []byte) error

UnmarshalJSON is a custom JSON unmarshaller to use the helpers which allow for unmarshalling structs into interfaces.

type BackgroundTypePattern added in v2.1.0

type BackgroundTypePattern struct {
	// Document with the pattern
	Document Document `json:"document"`
	// The background fill that is combined with the pattern
	Fill BackgroundFill `json:"fill"`
	// Intensity of the pattern when it is shown above the filled background; 0-100
	Intensity int64 `json:"intensity"`
	// Optional. True, if the background fill must be applied only to the pattern itself. All other pixels are black in this case. For dark themes only
	IsInverted bool `json:"is_inverted,omitempty"`
	// Optional. True, if the background moves slightly when the device is tilted
	IsMoving bool `json:"is_moving,omitempty"`
}

BackgroundTypePattern (https://core.telegram.org/bots/api#backgroundtypepattern)

The background is a PNG or TGV (gzipped subset of SVG with MIME type "application/x-tgwallpattern") pattern to be combined with the background fill chosen by the user.

func (BackgroundTypePattern) GetType added in v2.1.0

func (v BackgroundTypePattern) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (BackgroundTypePattern) MarshalJSON added in v2.1.0

func (v BackgroundTypePattern) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (BackgroundTypePattern) MergeBackgroundType added in v2.1.0

func (v BackgroundTypePattern) MergeBackgroundType() MergedBackgroundType

MergeBackgroundType returns a MergedBackgroundType struct to simplify working with types in a non-generic world.

func (*BackgroundTypePattern) UnmarshalJSON added in v2.1.0

func (v *BackgroundTypePattern) UnmarshalJSON(b []byte) error

UnmarshalJSON is a custom JSON unmarshaller to use the helpers which allow for unmarshalling structs into interfaces.

type BackgroundTypeWallpaper added in v2.1.0

type BackgroundTypeWallpaper struct {
	// Document with the wallpaper
	Document Document `json:"document"`
	// Dimming of the background in dark themes, as a percentage; 0-100
	DarkThemeDimming int64 `json:"dark_theme_dimming"`
	// Optional. True, if the wallpaper is downscaled to fit in a 450x450 square and then box-blurred with radius 12
	IsBlurred bool `json:"is_blurred,omitempty"`
	// Optional. True, if the background moves slightly when the device is tilted
	IsMoving bool `json:"is_moving,omitempty"`
}

BackgroundTypeWallpaper (https://core.telegram.org/bots/api#backgroundtypewallpaper)

The background is a wallpaper in the JPEG format.

func (BackgroundTypeWallpaper) GetType added in v2.1.0

func (v BackgroundTypeWallpaper) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (BackgroundTypeWallpaper) MarshalJSON added in v2.1.0

func (v BackgroundTypeWallpaper) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (BackgroundTypeWallpaper) MergeBackgroundType added in v2.1.0

func (v BackgroundTypeWallpaper) MergeBackgroundType() MergedBackgroundType

MergeBackgroundType returns a MergedBackgroundType struct to simplify working with types in a non-generic world.

type BanChatMemberOpts

type BanChatMemberOpts struct {
	// Date when the user will be unbanned; Unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever. Applied for supergroups and channels only.
	UntilDate int64
	// 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
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

BanChatMemberOpts is the set of optional fields for Bot.BanChatMember.

type BanChatSenderChatOpts

type BanChatSenderChatOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

BanChatSenderChatOpts is the set of optional fields for Bot.BanChatSenderChat.

type BaseBotClient

type BaseBotClient struct {
	// Client is the HTTP Client used for all HTTP requests made for this bot.
	Client http.Client
	// UseTestEnvironment defines whether this bot was created to run on telegram's test environment.
	// Enabling this uses a slightly different API path.
	// See https://core.telegram.org/bots/webapps#using-bots-in-the-test-environment for more details.
	UseTestEnvironment bool
	// Default opts to use for all requests, when no other request opts are specified.
	DefaultRequestOpts *RequestOpts
}

func (*BaseBotClient) FileURL

func (bot *BaseBotClient) FileURL(token string, tgFilePath string, opts *RequestOpts) string

func (*BaseBotClient) GetAPIURL

func (bot *BaseBotClient) GetAPIURL(opts *RequestOpts) string

GetAPIURL returns the currently used API endpoint.

func (*BaseBotClient) RequestWithContext

func (bot *BaseBotClient) RequestWithContext(ctx context.Context, token string, method string, params map[string]string, data map[string]FileReader, opts *RequestOpts) (json.RawMessage, error)

RequestWithContext allows sending a POST request to the telegram bot API with an existing context.

  • ctx: the timeout contexts to be used.
  • method: the telegram API method to call.
  • params: map of parameters to be sending to the telegram API. eg: chat_id, user_id, etc.
  • data: map of any files to be sending to the telegram API.
  • opts: request opts to use. Note: Timeout opts are ignored when used in RequestWithContext. Timeout handling is the responsibility of the caller/context owner.

func (*BaseBotClient) TimeoutContext

func (bot *BaseBotClient) TimeoutContext(opts *RequestOpts) (context.Context, context.CancelFunc)

TimeoutContext returns the appropriate context for the current settings.

type Birthdate added in v2.1.0

type Birthdate struct {
	// Day of the user's birth; 1-31
	Day int64 `json:"day"`
	// Month of the user's birth; 1-12
	Month int64 `json:"month"`
	// Optional. Year of the user's birth
	Year int64 `json:"year,omitempty"`
}

Birthdate (https://core.telegram.org/bots/api#birthdate)

Describes the birthdate of a user.

type Bot

type Bot struct {
	// Token stores the bot's secret token obtained from t.me/BotFather, and used to interact with telegram's API.
	Token string

	// The bot's User info, as returned by Bot.GetMe. Populated when created through the NewBot method.
	User
	// The bot client to use to make requests
	BotClient
}

Bot is the default Bot struct used to send and receive messages to the telegram API.

func NewBot

func NewBot(token string, opts *BotOpts) (*Bot, error)

NewBot returns a new Bot struct populated with the necessary defaults.

func (*Bot) AddStickerToSet

func (bot *Bot) AddStickerToSet(userId int64, name string, sticker InputSticker, opts *AddStickerToSetOpts) (bool, error)

AddStickerToSet (https://core.telegram.org/bots/api#addstickertoset)

Use this method to add a new sticker to a set created by the bot. Emoji sticker sets can have up to 200 stickers. Other sticker sets can have up to 120 stickers. Returns True on success.

  • userId (type int64): User identifier of sticker set owner
  • name (type string): Sticker set name
  • sticker (type InputSticker): A JSON-serialized object with information about the added sticker. If exactly the same sticker had already been added to the set, then the set isn't changed.
  • opts (type AddStickerToSetOpts): All optional parameters.

func (*Bot) AnswerCallbackQuery

func (bot *Bot) AnswerCallbackQuery(callbackQueryId string, opts *AnswerCallbackQueryOpts) (bool, error)

AnswerCallbackQuery (https://core.telegram.org/bots/api#answercallbackquery)

Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned.

  • callbackQueryId (type string): Unique identifier for the query to be answered
  • opts (type AnswerCallbackQueryOpts): All optional parameters.

func (*Bot) AnswerInlineQuery

func (bot *Bot) AnswerInlineQuery(inlineQueryId string, results []InlineQueryResult, opts *AnswerInlineQueryOpts) (bool, error)

AnswerInlineQuery (https://core.telegram.org/bots/api#answerinlinequery)

Use this method to send answers to an inline query. On success, True is returned. No more than 50 results per query are allowed.

  • inlineQueryId (type string): Unique identifier for the answered query
  • results (type []InlineQueryResult): A JSON-serialized array of results for the inline query
  • opts (type AnswerInlineQueryOpts): All optional parameters.

func (*Bot) AnswerPreCheckoutQuery

func (bot *Bot) AnswerPreCheckoutQuery(preCheckoutQueryId string, ok bool, opts *AnswerPreCheckoutQueryOpts) (bool, error)

AnswerPreCheckoutQuery (https://core.telegram.org/bots/api#answerprecheckoutquery)

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.

  • preCheckoutQueryId (type string): Unique identifier for the query to be answered
  • ok (type bool): 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.
  • opts (type AnswerPreCheckoutQueryOpts): All optional parameters.

func (*Bot) AnswerShippingQuery

func (bot *Bot) AnswerShippingQuery(shippingQueryId string, ok bool, opts *AnswerShippingQueryOpts) (bool, error)

AnswerShippingQuery (https://core.telegram.org/bots/api#answershippingquery)

If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot. Use this method to reply to shipping queries. On success, True is returned.

  • shippingQueryId (type string): Unique identifier for the query to be answered
  • ok (type bool): Pass 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)
  • opts (type AnswerShippingQueryOpts): All optional parameters.

func (*Bot) AnswerWebAppQuery

func (bot *Bot) AnswerWebAppQuery(webAppQueryId string, result InlineQueryResult, opts *AnswerWebAppQueryOpts) (*SentWebAppMessage, error)

AnswerWebAppQuery (https://core.telegram.org/bots/api#answerwebappquery)

Use this method to set the result of an interaction with a Web App and send a corresponding message on behalf of the user to the chat from which the query originated. On success, a SentWebAppMessage object is returned.

  • webAppQueryId (type string): Unique identifier for the query to be answered
  • result (type InlineQueryResult): A JSON-serialized object describing the message to be sent
  • opts (type AnswerWebAppQueryOpts): All optional parameters.

func (*Bot) ApproveChatJoinRequest

func (bot *Bot) ApproveChatJoinRequest(chatId int64, userId int64, opts *ApproveChatJoinRequestOpts) (bool, error)

ApproveChatJoinRequest (https://core.telegram.org/bots/api#approvechatjoinrequest)

Use this method to approve a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right. Returns True on success.

  • chatId (type int64): Unique identifier for the target chat
  • userId (type int64): Unique identifier of the target user
  • opts (type ApproveChatJoinRequestOpts): All optional parameters.

func (*Bot) BanChatMember

func (bot *Bot) BanChatMember(chatId int64, userId int64, opts *BanChatMemberOpts) (bool, error)

BanChatMember (https://core.telegram.org/bots/api#banchatmember)

Use this method to ban a user in a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.

  • chatId (type int64): Unique identifier for the target group
  • userId (type int64): Unique identifier of the target user
  • opts (type BanChatMemberOpts): All optional parameters.

func (*Bot) BanChatSenderChat

func (bot *Bot) BanChatSenderChat(chatId int64, senderChatId int64, opts *BanChatSenderChatOpts) (bool, error)

BanChatSenderChat (https://core.telegram.org/bots/api#banchatsenderchat)

Use this method to ban a channel chat in a supergroup or a channel. Until the chat is unbanned, the owner of the banned chat won't be able to send messages on behalf of any of their channels. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights. Returns True on success.

  • chatId (type int64): Unique identifier for the target chat
  • senderChatId (type int64): Unique identifier of the target sender chat
  • opts (type BanChatSenderChatOpts): All optional parameters.

func (*Bot) Close

func (bot *Bot) Close(opts *CloseOpts) (bool, error)

Close (https://core.telegram.org/bots/api#close)

Use this method to close the bot instance before moving it from one local server to another. You need to delete the webhook before calling this method to ensure that the bot isn't launched again after server restart. The method will return error 429 in the first 10 minutes after the bot is launched. Returns True on success. Requires no parameters.

  • opts (type CloseOpts): All optional parameters.

func (*Bot) CloseForumTopic

func (bot *Bot) CloseForumTopic(chatId int64, messageThreadId int64, opts *CloseForumTopicOpts) (bool, error)

CloseForumTopic (https://core.telegram.org/bots/api#closeforumtopic)

Use this method to close an open topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success.

  • chatId (type int64): Unique identifier for the target chat
  • messageThreadId (type int64): Unique identifier for the target message thread of the forum topic
  • opts (type CloseForumTopicOpts): All optional parameters.

func (*Bot) CloseGeneralForumTopic

func (bot *Bot) CloseGeneralForumTopic(chatId int64, opts *CloseGeneralForumTopicOpts) (bool, error)

CloseGeneralForumTopic (https://core.telegram.org/bots/api#closegeneralforumtopic)

Use this method to close an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.

  • chatId (type int64): Unique identifier for the target chat
  • opts (type CloseGeneralForumTopicOpts): All optional parameters.

func (*Bot) CopyMessage

func (bot *Bot) CopyMessage(chatId int64, fromChatId int64, messageId int64, opts *CopyMessageOpts) (*MessageId, error)

CopyMessage (https://core.telegram.org/bots/api#copymessage)

Use this method to copy messages of any kind. Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessage, but the copied message doesn't have a link to the original message. Returns the MessageId of the sent message on success.

  • chatId (type int64): Unique identifier for the target chat
  • fromChatId (type int64): Unique identifier for the chat where the original message was sent
  • messageId (type int64): Message identifier in the chat specified in from_chat_id
  • opts (type CopyMessageOpts): All optional parameters.

func (*Bot) CopyMessages added in v2.1.0

func (bot *Bot) CopyMessages(chatId int64, fromChatId int64, messageIds []int64, opts *CopyMessagesOpts) ([]MessageId, error)

CopyMessages (https://core.telegram.org/bots/api#copymessages)

Use this method to copy messages of any kind. If some of the specified messages can't be found or copied, they are skipped. Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessages, but the copied messages don't have a link to the original message. Album grouping is kept for copied messages. On success, an array of MessageId of the sent messages is returned.

  • chatId (type int64): Unique identifier for the target chat
  • fromChatId (type int64): Unique identifier for the chat where the original messages were sent
  • messageIds (type []int64): A JSON-serialized list of 1-100 identifiers of messages in the chat from_chat_id to copy. The identifiers must be specified in a strictly increasing order.
  • opts (type CopyMessagesOpts): All optional parameters.
func (bot *Bot) CreateChatInviteLink(chatId int64, opts *CreateChatInviteLinkOpts) (*ChatInviteLink, error)

CreateChatInviteLink (https://core.telegram.org/bots/api#createchatinvitelink)

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

  • chatId (type int64): Unique identifier for the target chat
  • opts (type CreateChatInviteLinkOpts): All optional parameters.
func (bot *Bot) CreateChatSubscriptionInviteLink(chatId int64, subscriptionPeriod int64, subscriptionPrice int64, opts *CreateChatSubscriptionInviteLinkOpts) (*ChatInviteLink, error)

CreateChatSubscriptionInviteLink (https://core.telegram.org/bots/api#createchatsubscriptioninvitelink)

Use this method to create a subscription invite link for a channel chat. The bot must have the can_invite_users administrator rights. The link can be edited using the method editChatSubscriptionInviteLink or revoked using the method revokeChatInviteLink. Returns the new invite link as a ChatInviteLink object.

  • chatId (type int64): Unique identifier for the target channel chat
  • subscriptionPeriod (type int64): The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days).
  • subscriptionPrice (type int64): The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat; 1-2500
  • opts (type CreateChatSubscriptionInviteLinkOpts): All optional parameters.

func (*Bot) CreateForumTopic

func (bot *Bot) CreateForumTopic(chatId int64, name string, opts *CreateForumTopicOpts) (*ForumTopic, error)

CreateForumTopic (https://core.telegram.org/bots/api#createforumtopic)

Use this method to create a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns information about the created topic as a ForumTopic object.

  • chatId (type int64): Unique identifier for the target chat
  • name (type string): Topic name, 1-128 characters
  • opts (type CreateForumTopicOpts): All optional parameters.
func (bot *Bot) CreateInvoiceLink(title string, description string, payload string, currency string, prices []LabeledPrice, opts *CreateInvoiceLinkOpts) (string, error)

CreateInvoiceLink (https://core.telegram.org/bots/api#createinvoicelink)

Use this method to create a link for an invoice. Returns the created invoice link as String on success.

  • title (type string): Product name, 1-32 characters
  • description (type string): Product description, 1-255 characters
  • payload (type string): Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes.
  • currency (type string): Three-letter ISO 4217 currency code, see more on currencies. Pass "XTR" for payments in Telegram Stars.
  • prices (type []LabeledPrice): Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars.
  • opts (type CreateInvoiceLinkOpts): All optional parameters.

func (*Bot) CreateNewStickerSet

func (bot *Bot) CreateNewStickerSet(userId int64, name string, title string, stickers []InputSticker, opts *CreateNewStickerSetOpts) (bool, error)

CreateNewStickerSet (https://core.telegram.org/bots/api#createnewstickerset)

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

  • userId (type int64): User identifier of created sticker set owner
  • name (type string): 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.
  • title (type string): Sticker set title, 1-64 characters
  • stickers (type []InputSticker): A JSON-serialized list of 1-50 initial stickers to be added to the sticker set
  • opts (type CreateNewStickerSetOpts): All optional parameters.

func (*Bot) DeclineChatJoinRequest

func (bot *Bot) DeclineChatJoinRequest(chatId int64, userId int64, opts *DeclineChatJoinRequestOpts) (bool, error)

DeclineChatJoinRequest (https://core.telegram.org/bots/api#declinechatjoinrequest)

Use this method to decline a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right. Returns True on success.

  • chatId (type int64): Unique identifier for the target chat
  • userId (type int64): Unique identifier of the target user
  • opts (type DeclineChatJoinRequestOpts): All optional parameters.

func (*Bot) DeleteChatPhoto

func (bot *Bot) DeleteChatPhoto(chatId int64, opts *DeleteChatPhotoOpts) (bool, error)

DeleteChatPhoto (https://core.telegram.org/bots/api#deletechatphoto)

Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.

  • chatId (type int64): Unique identifier for the target chat
  • opts (type DeleteChatPhotoOpts): All optional parameters.

func (*Bot) DeleteChatStickerSet

func (bot *Bot) DeleteChatStickerSet(chatId int64, opts *DeleteChatStickerSetOpts) (bool, error)

DeleteChatStickerSet (https://core.telegram.org/bots/api#deletechatstickerset)

Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success.

  • chatId (type int64): Unique identifier for the target chat
  • opts (type DeleteChatStickerSetOpts): All optional parameters.

func (*Bot) DeleteForumTopic

func (bot *Bot) DeleteForumTopic(chatId int64, messageThreadId int64, opts *DeleteForumTopicOpts) (bool, error)

DeleteForumTopic (https://core.telegram.org/bots/api#deleteforumtopic)

Use this method to delete a forum topic along with all its messages in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_delete_messages administrator rights. Returns True on success.

  • chatId (type int64): Unique identifier for the target chat
  • messageThreadId (type int64): Unique identifier for the target message thread of the forum topic
  • opts (type DeleteForumTopicOpts): All optional parameters.

func (*Bot) DeleteMessage

func (bot *Bot) DeleteMessage(chatId int64, messageId int64, opts *DeleteMessageOpts) (bool, error)

DeleteMessage (https://core.telegram.org/bots/api#deletemessage)

Use this method to delete a message, including service messages, with the following limitations:

  • A message can only be deleted if it was sent less than 48 hours ago.
  • Service messages about a supergroup, channel, or forum topic creation can't be deleted.
  • A dice message in a private chat can only be deleted if it was sent more than 24 hours ago.
  • Bots can delete outgoing messages in private chats, groups, and supergroups.
  • Bots can delete incoming messages in private chats.
  • Bots granted can_post_messages permissions can delete outgoing messages in channels.
  • If the bot is an administrator of a group, it can delete any message there.
  • If the bot has can_delete_messages permission in a supergroup or a channel, it can delete any message there.

Returns True on success.

  • chatId (type int64): Unique identifier for the target chat
  • messageId (type int64): Identifier of the message to delete
  • opts (type DeleteMessageOpts): All optional parameters.

func (*Bot) DeleteMessages added in v2.1.0

func (bot *Bot) DeleteMessages(chatId int64, messageIds []int64, opts *DeleteMessagesOpts) (bool, error)

DeleteMessages (https://core.telegram.org/bots/api#deletemessages)

Use this method to delete multiple messages simultaneously. If some of the specified messages can't be found, they are skipped. Returns True on success.

  • chatId (type int64): Unique identifier for the target chat
  • messageIds (type []int64): A JSON-serialized list of 1-100 identifiers of messages to delete. See deleteMessage for limitations on which messages can be deleted
  • opts (type DeleteMessagesOpts): All optional parameters.

func (*Bot) DeleteMyCommands

func (bot *Bot) DeleteMyCommands(opts *DeleteMyCommandsOpts) (bool, error)

DeleteMyCommands (https://core.telegram.org/bots/api#deletemycommands)

Use this method to delete the list of the bot's commands for the given scope and user language. After deletion, higher level commands will be shown to affected users. Returns True on success.

  • opts (type DeleteMyCommandsOpts): All optional parameters.

func (*Bot) DeleteStickerFromSet

func (bot *Bot) DeleteStickerFromSet(sticker string, opts *DeleteStickerFromSetOpts) (bool, error)

DeleteStickerFromSet (https://core.telegram.org/bots/api#deletestickerfromset)

Use this method to delete a sticker from a set created by the bot. Returns True on success.

  • sticker (type string): File identifier of the sticker
  • opts (type DeleteStickerFromSetOpts): All optional parameters.

func (*Bot) DeleteStickerSet

func (bot *Bot) DeleteStickerSet(name string, opts *DeleteStickerSetOpts) (bool, error)

DeleteStickerSet (https://core.telegram.org/bots/api#deletestickerset)

Use this method to delete a sticker set that was created by the bot. Returns True on success.

  • name (type string): Sticker set name
  • opts (type DeleteStickerSetOpts): All optional parameters.

func (*Bot) DeleteWebhook

func (bot *Bot) DeleteWebhook(opts *DeleteWebhookOpts) (bool, error)

DeleteWebhook (https://core.telegram.org/bots/api#deletewebhook)

Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success.

  • opts (type DeleteWebhookOpts): All optional parameters.
func (bot *Bot) EditChatInviteLink(chatId int64, inviteLink string, opts *EditChatInviteLinkOpts) (*ChatInviteLink, error)

EditChatInviteLink (https://core.telegram.org/bots/api#editchatinvitelink)

Use this method to edit a non-primary invite link created by the bot. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the edited invite link as a ChatInviteLink object.

  • chatId (type int64): Unique identifier for the target chat
  • inviteLink (type string): The invite link to edit
  • opts (type EditChatInviteLinkOpts): All optional parameters.
func (bot *Bot) EditChatSubscriptionInviteLink(chatId int64, inviteLink string, opts *EditChatSubscriptionInviteLinkOpts) (*ChatInviteLink, error)

EditChatSubscriptionInviteLink (https://core.telegram.org/bots/api#editchatsubscriptioninvitelink)

Use this method to edit a subscription invite link created by the bot. The bot must have the can_invite_users administrator rights. Returns the edited invite link as a ChatInviteLink object.

  • chatId (type int64): Unique identifier for the target chat
  • inviteLink (type string): The invite link to edit
  • opts (type EditChatSubscriptionInviteLinkOpts): All optional parameters.

func (*Bot) EditForumTopic

func (bot *Bot) EditForumTopic(chatId int64, messageThreadId int64, opts *EditForumTopicOpts) (bool, error)

EditForumTopic (https://core.telegram.org/bots/api#editforumtopic)

Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success.

  • chatId (type int64): Unique identifier for the target chat
  • messageThreadId (type int64): Unique identifier for the target message thread of the forum topic
  • opts (type EditForumTopicOpts): All optional parameters.

func (*Bot) EditGeneralForumTopic

func (bot *Bot) EditGeneralForumTopic(chatId int64, name string, opts *EditGeneralForumTopicOpts) (bool, error)

EditGeneralForumTopic (https://core.telegram.org/bots/api#editgeneralforumtopic)

Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.

  • chatId (type int64): Unique identifier for the target chat
  • name (type string): New topic name, 1-128 characters
  • opts (type EditGeneralForumTopicOpts): All optional parameters.

func (*Bot) EditMessageCaption

func (bot *Bot) EditMessageCaption(opts *EditMessageCaptionOpts) (*Message, bool, error)

EditMessageCaption (https://core.telegram.org/bots/api#editmessagecaption)

Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.

  • opts (type EditMessageCaptionOpts): All optional parameters.

func (*Bot) EditMessageLiveLocation

func (bot *Bot) EditMessageLiveLocation(latitude float64, longitude float64, opts *EditMessageLiveLocationOpts) (*Message, bool, error)

EditMessageLiveLocation (https://core.telegram.org/bots/api#editmessagelivelocation)

Use this method to edit live location messages. A location can be edited until its live_period expires or editing is explicitly disabled by a call to stopMessageLiveLocation. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.

  • latitude (type float64): Latitude of new location
  • longitude (type float64): Longitude of new location
  • opts (type EditMessageLiveLocationOpts): All optional parameters.

func (*Bot) EditMessageMedia

func (bot *Bot) EditMessageMedia(media InputMedia, opts *EditMessageMediaOpts) (*Message, bool, error)

EditMessageMedia (https://core.telegram.org/bots/api#editmessagemedia)

Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.

  • media (type InputMedia): A JSON-serialized object for a new media content of the message
  • opts (type EditMessageMediaOpts): All optional parameters.

func (*Bot) EditMessageReplyMarkup

func (bot *Bot) EditMessageReplyMarkup(opts *EditMessageReplyMarkupOpts) (*Message, bool, error)

EditMessageReplyMarkup (https://core.telegram.org/bots/api#editmessagereplymarkup)

Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.

  • opts (type EditMessageReplyMarkupOpts): All optional parameters.

func (*Bot) EditMessageText

func (bot *Bot) EditMessageText(text string, opts *EditMessageTextOpts) (*Message, bool, error)

EditMessageText (https://core.telegram.org/bots/api#editmessagetext)

Use this method to edit text and game messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.

  • text (type string): New text of the message, 1-4096 characters after entities parsing
  • opts (type EditMessageTextOpts): All optional parameters.
func (bot *Bot) ExportChatInviteLink(chatId int64, opts *ExportChatInviteLinkOpts) (string, error)

ExportChatInviteLink (https://core.telegram.org/bots/api#exportchatinvitelink)

Use this method to generate a new primary invite link for a chat; any previously generated primary link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the new invite link as String on success.

  • chatId (type int64): Unique identifier for the target chat
  • opts (type ExportChatInviteLinkOpts): All optional parameters.

func (*Bot) ForwardMessage

func (bot *Bot) ForwardMessage(chatId int64, fromChatId int64, messageId int64, opts *ForwardMessageOpts) (*Message, error)

ForwardMessage (https://core.telegram.org/bots/api#forwardmessage)

Use this method to forward messages of any kind. Service messages and messages with protected content can't be forwarded. On success, the sent Message is returned.

  • chatId (type int64): Unique identifier for the target chat
  • fromChatId (type int64): Unique identifier for the chat where the original message was sent
  • messageId (type int64): Message identifier in the chat specified in from_chat_id
  • opts (type ForwardMessageOpts): All optional parameters.

func (*Bot) ForwardMessages added in v2.1.0

func (bot *Bot) ForwardMessages(chatId int64, fromChatId int64, messageIds []int64, opts *ForwardMessagesOpts) ([]MessageId, error)

ForwardMessages (https://core.telegram.org/bots/api#forwardmessages)

Use this method to forward multiple messages of any kind. If some of the specified messages can't be found or forwarded, they are skipped. Service messages and messages with protected content can't be forwarded. Album grouping is kept for forwarded messages. On success, an array of MessageId of the sent messages is returned.

  • chatId (type int64): Unique identifier for the target chat
  • fromChatId (type int64): Unique identifier for the chat where the original messages were sent
  • messageIds (type []int64): A JSON-serialized list of 1-100 identifiers of messages in the chat from_chat_id to forward. The identifiers must be specified in a strictly increasing order.
  • opts (type ForwardMessagesOpts): All optional parameters.

func (*Bot) GetBusinessConnection added in v2.1.0

func (bot *Bot) GetBusinessConnection(businessConnectionId string, opts *GetBusinessConnectionOpts) (*BusinessConnection, error)

GetBusinessConnection (https://core.telegram.org/bots/api#getbusinessconnection)

Use this method to get information about the connection of the bot with a business account. Returns a BusinessConnection object on success.

  • businessConnectionId (type string): Unique identifier of the business connection
  • opts (type GetBusinessConnectionOpts): All optional parameters.

func (*Bot) GetChat

func (bot *Bot) GetChat(chatId int64, opts *GetChatOpts) (*ChatFullInfo, error)

GetChat (https://core.telegram.org/bots/api#getchat)

Use this method to get up-to-date information about the chat. Returns a ChatFullInfo object on success.

  • chatId (type int64): Unique identifier for the target chat
  • opts (type GetChatOpts): All optional parameters.

func (*Bot) GetChatAdministrators

func (bot *Bot) GetChatAdministrators(chatId int64, opts *GetChatAdministratorsOpts) ([]ChatMember, error)

GetChatAdministrators (https://core.telegram.org/bots/api#getchatadministrators)

Use this method to get a list of administrators in a chat, which aren't bots. Returns an Array of ChatMember objects.

  • chatId (type int64): Unique identifier for the target chat
  • opts (type GetChatAdministratorsOpts): All optional parameters.

func (*Bot) GetChatMember

func (bot *Bot) GetChatMember(chatId int64, userId int64, opts *GetChatMemberOpts) (ChatMember, error)

GetChatMember (https://core.telegram.org/bots/api#getchatmember)

Use this method to get information about a member of a chat. The method is only guaranteed to work for other users if the bot is an administrator in the chat. Returns a ChatMember object on success.

  • chatId (type int64): Unique identifier for the target chat
  • userId (type int64): Unique identifier of the target user
  • opts (type GetChatMemberOpts): All optional parameters.

func (*Bot) GetChatMemberCount

func (bot *Bot) GetChatMemberCount(chatId int64, opts *GetChatMemberCountOpts) (int64, error)

GetChatMemberCount (https://core.telegram.org/bots/api#getchatmembercount)

Use this method to get the number of members in a chat. Returns Int on success.

  • chatId (type int64): Unique identifier for the target chat
  • opts (type GetChatMemberCountOpts): All optional parameters.

func (*Bot) GetChatMenuButton

func (bot *Bot) GetChatMenuButton(opts *GetChatMenuButtonOpts) (MenuButton, error)

GetChatMenuButton (https://core.telegram.org/bots/api#getchatmenubutton)

Use this method to get the current value of the bot's menu button in a private chat, or the default menu button. Returns MenuButton on success.

  • opts (type GetChatMenuButtonOpts): All optional parameters.

func (*Bot) GetCustomEmojiStickers

func (bot *Bot) GetCustomEmojiStickers(customEmojiIds []string, opts *GetCustomEmojiStickersOpts) ([]Sticker, error)

GetCustomEmojiStickers (https://core.telegram.org/bots/api#getcustomemojistickers)

Use this method to get information about custom emoji stickers by their identifiers. Returns an Array of Sticker objects.

  • customEmojiIds (type []string): A JSON-serialized list of custom emoji identifiers. At most 200 custom emoji identifiers can be specified.
  • opts (type GetCustomEmojiStickersOpts): All optional parameters.

func (*Bot) GetFile

func (bot *Bot) GetFile(fileId string, opts *GetFileOpts) (*File, error)

GetFile (https://core.telegram.org/bots/api#getfile)

Use this method to get basic information about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>, where <file_path> is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again. 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.

  • fileId (type string): File identifier to get information about
  • opts (type GetFileOpts): All optional parameters.

func (*Bot) GetForumTopicIconStickers

func (bot *Bot) GetForumTopicIconStickers(opts *GetForumTopicIconStickersOpts) ([]Sticker, error)

GetForumTopicIconStickers (https://core.telegram.org/bots/api#getforumtopiciconstickers)

Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user. Requires no parameters. Returns an Array of Sticker objects.

  • opts (type GetForumTopicIconStickersOpts): All optional parameters.

func (*Bot) GetGameHighScores

func (bot *Bot) GetGameHighScores(userId int64, opts *GetGameHighScoresOpts) ([]GameHighScore, error)

GetGameHighScores (https://core.telegram.org/bots/api#getgamehighscores)

Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game. Returns an Array of GameHighScore objects.

  • userId (type int64): Target user id
  • opts (type GetGameHighScoresOpts): All optional parameters.

func (*Bot) GetMe

func (bot *Bot) GetMe(opts *GetMeOpts) (*User, error)

GetMe (https://core.telegram.org/bots/api#getme)

A simple method for testing your bot's authentication token. Requires no parameters. Returns basic information about the bot in form of a User object.

  • opts (type GetMeOpts): All optional parameters.

func (*Bot) GetMyCommands

func (bot *Bot) GetMyCommands(opts *GetMyCommandsOpts) ([]BotCommand, error)

GetMyCommands (https://core.telegram.org/bots/api#getmycommands)

Use this method to get the current list of the bot's commands for the given scope and user language. Returns an Array of BotCommand objects. If commands aren't set, an empty list is returned.

  • opts (type GetMyCommandsOpts): All optional parameters.

func (*Bot) GetMyDefaultAdministratorRights

func (bot *Bot) GetMyDefaultAdministratorRights(opts *GetMyDefaultAdministratorRightsOpts) (*ChatAdministratorRights, error)

GetMyDefaultAdministratorRights (https://core.telegram.org/bots/api#getmydefaultadministratorrights)

Use this method to get the current default administrator rights of the bot. Returns ChatAdministratorRights on success.

  • opts (type GetMyDefaultAdministratorRightsOpts): All optional parameters.

func (*Bot) GetMyDescription

func (bot *Bot) GetMyDescription(opts *GetMyDescriptionOpts) (*BotDescription, error)

GetMyDescription (https://core.telegram.org/bots/api#getmydescription)

Use this method to get the current bot description for the given user language. Returns BotDescription on success.

  • opts (type GetMyDescriptionOpts): All optional parameters.

func (*Bot) GetMyName

func (bot *Bot) GetMyName(opts *GetMyNameOpts) (*BotName, error)

GetMyName (https://core.telegram.org/bots/api#getmyname)

Use this method to get the current bot name for the given user language. Returns BotName on success.

  • opts (type GetMyNameOpts): All optional parameters.

func (*Bot) GetMyShortDescription

func (bot *Bot) GetMyShortDescription(opts *GetMyShortDescriptionOpts) (*BotShortDescription, error)

GetMyShortDescription (https://core.telegram.org/bots/api#getmyshortdescription)

Use this method to get the current bot short description for the given user language. Returns BotShortDescription on success.

  • opts (type GetMyShortDescriptionOpts): All optional parameters.

func (*Bot) GetStarTransactions added in v2.1.0

func (bot *Bot) GetStarTransactions(opts *GetStarTransactionsOpts) (*StarTransactions, error)

GetStarTransactions (https://core.telegram.org/bots/api#getstartransactions)

Returns the bot's Telegram Star transactions in chronological order. On success, returns a StarTransactions object.

  • opts (type GetStarTransactionsOpts): All optional parameters.

func (*Bot) GetStickerSet

func (bot *Bot) GetStickerSet(name string, opts *GetStickerSetOpts) (*StickerSet, error)

GetStickerSet (https://core.telegram.org/bots/api#getstickerset)

Use this method to get a sticker set. On success, a StickerSet object is returned.

  • name (type string): Name of the sticker set
  • opts (type GetStickerSetOpts): All optional parameters.

func (*Bot) GetUpdates

func (bot *Bot) GetUpdates(opts *GetUpdatesOpts) ([]Update, error)

GetUpdates (https://core.telegram.org/bots/api#getupdates)

Use this method to receive incoming updates using long polling (wiki). Returns an Array of Update objects.

  • opts (type GetUpdatesOpts): All optional parameters.

func (*Bot) GetUserChatBoosts added in v2.1.0

func (bot *Bot) GetUserChatBoosts(chatId int64, userId int64, opts *GetUserChatBoostsOpts) (*UserChatBoosts, error)

GetUserChatBoosts (https://core.telegram.org/bots/api#getuserchatboosts)

Use this method to get the list of boosts added to a chat by a user. Requires administrator rights in the chat. Returns a UserChatBoosts object.

  • chatId (type int64): Unique identifier for the chat
  • userId (type int64): Unique identifier of the target user
  • opts (type GetUserChatBoostsOpts): All optional parameters.

func (*Bot) GetUserProfilePhotos

func (bot *Bot) GetUserProfilePhotos(userId int64, opts *GetUserProfilePhotosOpts) (*UserProfilePhotos, error)

GetUserProfilePhotos (https://core.telegram.org/bots/api#getuserprofilephotos)

Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object.

  • userId (type int64): Unique identifier of the target user
  • opts (type GetUserProfilePhotosOpts): All optional parameters.

func (*Bot) GetWebhookInfo

func (bot *Bot) GetWebhookInfo(opts *GetWebhookInfoOpts) (*WebhookInfo, error)

GetWebhookInfo (https://core.telegram.org/bots/api#getwebhookinfo)

Use this method to get current webhook status. Requires no parameters. On success, returns a WebhookInfo object. If the bot is using getUpdates, will return an object with the url field empty.

  • opts (type GetWebhookInfoOpts): All optional parameters.

func (*Bot) HideGeneralForumTopic

func (bot *Bot) HideGeneralForumTopic(chatId int64, opts *HideGeneralForumTopicOpts) (bool, error)

HideGeneralForumTopic (https://core.telegram.org/bots/api#hidegeneralforumtopic)

Use this method to hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically closed if it was open. Returns True on success.

  • chatId (type int64): Unique identifier for the target chat
  • opts (type HideGeneralForumTopicOpts): All optional parameters.

func (*Bot) LeaveChat

func (bot *Bot) LeaveChat(chatId int64, opts *LeaveChatOpts) (bool, error)

LeaveChat (https://core.telegram.org/bots/api#leavechat)

Use this method for your bot to leave a group, supergroup or channel. Returns True on success.

  • chatId (type int64): Unique identifier for the target chat
  • opts (type LeaveChatOpts): All optional parameters.

func (*Bot) LogOut

func (bot *Bot) LogOut(opts *LogOutOpts) (bool, error)

LogOut (https://core.telegram.org/bots/api#logout)

Use this method to log out from the cloud Bot API server before launching the bot locally. You must log out the bot before running it locally, otherwise there is no guarantee that the bot will receive updates. After a successful call, you can immediately log in on a local server, but will not be able to log in back to the cloud Bot API server for 10 minutes. Returns True on success. Requires no parameters.

  • opts (type LogOutOpts): All optional parameters.

func (*Bot) PinChatMessage

func (bot *Bot) PinChatMessage(chatId int64, messageId int64, opts *PinChatMessageOpts) (bool, error)

PinChatMessage (https://core.telegram.org/bots/api#pinchatmessage)

Use this method to add a message to the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns True on success.

  • chatId (type int64): Unique identifier for the target chat
  • messageId (type int64): Identifier of a message to pin
  • opts (type PinChatMessageOpts): All optional parameters.

func (*Bot) PromoteChatMember

func (bot *Bot) PromoteChatMember(chatId int64, userId int64, opts *PromoteChatMemberOpts) (bool, error)

PromoteChatMember (https://core.telegram.org/bots/api#promotechatmember)

Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Pass False for all boolean parameters to demote a user. Returns True on success.

  • chatId (type int64): Unique identifier for the target chat
  • userId (type int64): Unique identifier of the target user
  • opts (type PromoteChatMemberOpts): All optional parameters.

func (*Bot) RefundStarPayment added in v2.1.0

func (bot *Bot) RefundStarPayment(userId int64, telegramPaymentChargeId string, opts *RefundStarPaymentOpts) (bool, error)

RefundStarPayment (https://core.telegram.org/bots/api#refundstarpayment)

Refunds a successful payment in Telegram Stars. Returns True on success.

  • userId (type int64): Identifier of the user whose payment will be refunded
  • telegramPaymentChargeId (type string): Telegram payment identifier
  • opts (type RefundStarPaymentOpts): All optional parameters.

func (*Bot) ReopenForumTopic

func (bot *Bot) ReopenForumTopic(chatId int64, messageThreadId int64, opts *ReopenForumTopicOpts) (bool, error)

ReopenForumTopic (https://core.telegram.org/bots/api#reopenforumtopic)

Use this method to reopen a closed topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success.

  • chatId (type int64): Unique identifier for the target chat
  • messageThreadId (type int64): Unique identifier for the target message thread of the forum topic
  • opts (type ReopenForumTopicOpts): All optional parameters.

func (*Bot) ReopenGeneralForumTopic

func (bot *Bot) ReopenGeneralForumTopic(chatId int64, opts *ReopenGeneralForumTopicOpts) (bool, error)

ReopenGeneralForumTopic (https://core.telegram.org/bots/api#reopengeneralforumtopic)

Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically unhidden if it was hidden. Returns True on success.

  • chatId (type int64): Unique identifier for the target chat
  • opts (type ReopenGeneralForumTopicOpts): All optional parameters.

func (*Bot) ReplaceStickerInSet added in v2.1.0

func (bot *Bot) ReplaceStickerInSet(userId int64, name string, oldSticker string, sticker InputSticker, opts *ReplaceStickerInSetOpts) (bool, error)

ReplaceStickerInSet (https://core.telegram.org/bots/api#replacestickerinset)

Use this method to replace an existing sticker in a sticker set with a new one. The method is equivalent to calling deleteStickerFromSet, then addStickerToSet, then setStickerPositionInSet. Returns True on success.

  • userId (type int64): User identifier of the sticker set owner
  • name (type string): Sticker set name
  • oldSticker (type string): File identifier of the replaced sticker
  • sticker (type InputSticker): A JSON-serialized object with information about the added sticker. If exactly the same sticker had already been added to the set, then the set remains unchanged.
  • opts (type ReplaceStickerInSetOpts): All optional parameters.

func (*Bot) Request

func (bot *Bot) Request(method string, params map[string]string, data map[string]FileReader, opts *RequestOpts) (json.RawMessage, error)

func (*Bot) RestrictChatMember

func (bot *Bot) RestrictChatMember(chatId int64, userId int64, permissions ChatPermissions, opts *RestrictChatMemberOpts) (bool, error)

RestrictChatMember (https://core.telegram.org/bots/api#restrictchatmember)

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

  • chatId (type int64): Unique identifier for the target chat
  • userId (type int64): Unique identifier of the target user
  • permissions (type ChatPermissions): A JSON-serialized object for new user permissions
  • opts (type RestrictChatMemberOpts): All optional parameters.
func (bot *Bot) RevokeChatInviteLink(chatId int64, inviteLink string, opts *RevokeChatInviteLinkOpts) (*ChatInviteLink, error)

RevokeChatInviteLink (https://core.telegram.org/bots/api#revokechatinvitelink)

Use this method to revoke an invite link created by the bot. If the primary link is revoked, a new link is automatically generated. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the revoked invite link as ChatInviteLink object.

  • chatId (type int64): Unique identifier of the target chat
  • inviteLink (type string): The invite link to revoke
  • opts (type RevokeChatInviteLinkOpts): All optional parameters.

func (*Bot) SendAnimation

func (bot *Bot) SendAnimation(chatId int64, animation InputFileOrString, opts *SendAnimationOpts) (*Message, error)

SendAnimation (https://core.telegram.org/bots/api#sendanimation)

Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent Message is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.

  • chatId (type int64): Unique identifier for the target chat
  • animation (type InputFileOrString): Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the Internet, or upload a new animation using multipart/form-data. More information on Sending Files: https://core.telegram.org/bots/api#sending-files
  • opts (type SendAnimationOpts): All optional parameters.

func (*Bot) SendAudio

func (bot *Bot) SendAudio(chatId int64, audio InputFileOrString, opts *SendAudioOpts) (*Message, error)

SendAudio (https://core.telegram.org/bots/api#sendaudio)

Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future. For sending voice messages, use the sendVoice method instead.

  • chatId (type int64): Unique identifier for the target chat
  • audio (type InputFileOrString): Audio file to send. Pass a file_id as String to send an audio file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files: https://core.telegram.org/bots/api#sending-files
  • opts (type SendAudioOpts): All optional parameters.

func (*Bot) SendChatAction

func (bot *Bot) SendChatAction(chatId int64, action string, opts *SendChatActionOpts) (bool, error)

SendChatAction (https://core.telegram.org/bots/api#sendchataction)

Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns True on success. We only recommend using this method when a response from the bot will take a noticeable amount of time to arrive.

  • chatId (type int64): Unique identifier for the target chat
  • action (type string): Type of action to broadcast. Choose one, depending on what the user is about to receive: typing for text messages, upload_photo for photos, record_video or upload_video for videos, record_voice or upload_voice for voice notes, upload_document for general files, choose_sticker for stickers, find_location for location data, record_video_note or upload_video_note for video notes.
  • opts (type SendChatActionOpts): All optional parameters.

func (*Bot) SendContact

func (bot *Bot) SendContact(chatId int64, phoneNumber string, firstName string, opts *SendContactOpts) (*Message, error)

SendContact (https://core.telegram.org/bots/api#sendcontact)

Use this method to send phone contacts. On success, the sent Message is returned.

  • chatId (type int64): Unique identifier for the target chat
  • phoneNumber (type string): Contact's phone number
  • firstName (type string): Contact's first name
  • opts (type SendContactOpts): All optional parameters.

func (*Bot) SendDice

func (bot *Bot) SendDice(chatId int64, opts *SendDiceOpts) (*Message, error)

SendDice (https://core.telegram.org/bots/api#senddice)

Use this method to send an animated emoji that will display a random value. On success, the sent Message is returned.

  • chatId (type int64): Unique identifier for the target chat
  • opts (type SendDiceOpts): All optional parameters.

func (*Bot) SendDocument

func (bot *Bot) SendDocument(chatId int64, document InputFileOrString, opts *SendDocumentOpts) (*Message, error)

SendDocument (https://core.telegram.org/bots/api#senddocument)

Use this method to send general files. On success, the sent Message is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.

  • chatId (type int64): Unique identifier for the target chat
  • document (type InputFileOrString): File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files: https://core.telegram.org/bots/api#sending-files
  • opts (type SendDocumentOpts): All optional parameters.

func (*Bot) SendGame

func (bot *Bot) SendGame(chatId int64, gameShortName string, opts *SendGameOpts) (*Message, error)

SendGame (https://core.telegram.org/bots/api#sendgame)

Use this method to send a game. On success, the sent Message is returned.

  • chatId (type int64): Unique identifier for the target chat
  • gameShortName (type string): Short name of the game, serves as the unique identifier for the game. Set up your games via @BotFather.
  • opts (type SendGameOpts): All optional parameters.

func (*Bot) SendInvoice

func (bot *Bot) SendInvoice(chatId int64, title string, description string, payload string, currency string, prices []LabeledPrice, opts *SendInvoiceOpts) (*Message, error)

SendInvoice (https://core.telegram.org/bots/api#sendinvoice)

Use this method to send invoices. On success, the sent Message is returned.

  • chatId (type int64): Unique identifier for the target chat
  • title (type string): Product name, 1-32 characters
  • description (type string): Product description, 1-255 characters
  • payload (type string): Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes.
  • currency (type string): Three-letter ISO 4217 currency code, see more on currencies. Pass "XTR" for payments in Telegram Stars.
  • prices (type []LabeledPrice): Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars.
  • opts (type SendInvoiceOpts): All optional parameters.

func (*Bot) SendLocation

func (bot *Bot) SendLocation(chatId int64, latitude float64, longitude float64, opts *SendLocationOpts) (*Message, error)

SendLocation (https://core.telegram.org/bots/api#sendlocation)

Use this method to send point on the map. On success, the sent Message is returned.

  • chatId (type int64): Unique identifier for the target chat
  • latitude (type float64): Latitude of the location
  • longitude (type float64): Longitude of the location
  • opts (type SendLocationOpts): All optional parameters.

func (*Bot) SendMediaGroup

func (bot *Bot) SendMediaGroup(chatId int64, media []InputMedia, opts *SendMediaGroupOpts) ([]Message, error)

SendMediaGroup (https://core.telegram.org/bots/api#sendmediagroup)

Use this method to send a group of photos, videos, documents or audios as an album. Documents and audio files can be only grouped in an album with messages of the same type. On success, an array of Messages that were sent is returned.

  • chatId (type int64): Unique identifier for the target chat
  • media (type []InputMedia): A JSON-serialized array describing messages to be sent, must include 2-10 items
  • opts (type SendMediaGroupOpts): All optional parameters.

func (*Bot) SendMessage

func (bot *Bot) SendMessage(chatId int64, text string, opts *SendMessageOpts) (*Message, error)

SendMessage (https://core.telegram.org/bots/api#sendmessage)

Use this method to send text messages. On success, the sent Message is returned.

  • chatId (type int64): Unique identifier for the target chat
  • text (type string): Text of the message to be sent, 1-4096 characters after entities parsing
  • opts (type SendMessageOpts): All optional parameters.

func (*Bot) SendPaidMedia added in v2.1.0

func (bot *Bot) SendPaidMedia(chatId int64, starCount int64, media []InputPaidMedia, opts *SendPaidMediaOpts) (*Message, error)

SendPaidMedia (https://core.telegram.org/bots/api#sendpaidmedia)

Use this method to send paid media. On success, the sent Message is returned.

  • chatId (type int64): Unique identifier for the target chat. If the chat is a channel, all Telegram Star proceeds from this media will be credited to the chat's balance. Otherwise, they will be credited to the bot's balance.
  • starCount (type int64): The number of Telegram Stars that must be paid to buy access to the media
  • media (type []InputPaidMedia): A JSON-serialized array describing the media to be sent; up to 10 items
  • opts (type SendPaidMediaOpts): All optional parameters.

func (*Bot) SendPhoto

func (bot *Bot) SendPhoto(chatId int64, photo InputFileOrString, opts *SendPhotoOpts) (*Message, error)

SendPhoto (https://core.telegram.org/bots/api#sendphoto)

Use this method to send photos. On success, the sent Message is returned.

  • chatId (type int64): Unique identifier for the target chat
  • photo (type InputFileOrString): Photo to send. Pass a file_id as String to send a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, or upload a new photo using multipart/form-data. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20. More information on Sending Files: https://core.telegram.org/bots/api#sending-files
  • opts (type SendPhotoOpts): All optional parameters.

func (*Bot) SendPoll

func (bot *Bot) SendPoll(chatId int64, question string, options []InputPollOption, opts *SendPollOpts) (*Message, error)

SendPoll (https://core.telegram.org/bots/api#sendpoll)

Use this method to send a native poll. On success, the sent Message is returned.

  • chatId (type int64): Unique identifier for the target chat
  • question (type string): Poll question, 1-300 characters
  • options (type []InputPollOption): A JSON-serialized list of 2-10 answer options
  • opts (type SendPollOpts): All optional parameters.

func (*Bot) SendSticker

func (bot *Bot) SendSticker(chatId int64, sticker InputFileOrString, opts *SendStickerOpts) (*Message, error)

SendSticker (https://core.telegram.org/bots/api#sendsticker)

Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers. On success, the sent Message is returned.

  • chatId (type int64): Unique identifier for the target chat
  • sticker (type InputFileOrString): Sticker to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a .WEBP sticker from the Internet, or upload a new .WEBP, .TGS, or .WEBM sticker using multipart/form-data. More information on Sending Files: https://core.telegram.org/bots/api#sending-files. Video and animated stickers can't be sent via an HTTP URL.
  • opts (type SendStickerOpts): All optional parameters.

func (*Bot) SendVenue

func (bot *Bot) SendVenue(chatId int64, latitude float64, longitude float64, title string, address string, opts *SendVenueOpts) (*Message, error)

SendVenue (https://core.telegram.org/bots/api#sendvenue)

Use this method to send information about a venue. On success, the sent Message is returned.

  • chatId (type int64): Unique identifier for the target chat
  • latitude (type float64): Latitude of the venue
  • longitude (type float64): Longitude of the venue
  • title (type string): Name of the venue
  • address (type string): Address of the venue
  • opts (type SendVenueOpts): All optional parameters.

func (*Bot) SendVideo

func (bot *Bot) SendVideo(chatId int64, video InputFileOrString, opts *SendVideoOpts) (*Message, error)

SendVideo (https://core.telegram.org/bots/api#sendvideo)

Use this method to send video files, Telegram clients support MPEG4 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.

  • chatId (type int64): Unique identifier for the target chat
  • video (type InputFileOrString): Video to send. Pass a file_id as String to send a video that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a video from the Internet, or upload a new video using multipart/form-data. More information on Sending Files: https://core.telegram.org/bots/api#sending-files
  • opts (type SendVideoOpts): All optional parameters.

func (*Bot) SendVideoNote

func (bot *Bot) SendVideoNote(chatId int64, videoNote InputFileOrString, opts *SendVideoNoteOpts) (*Message, error)

SendVideoNote (https://core.telegram.org/bots/api#sendvideonote)

As of v.4.0, Telegram clients support rounded square MPEG4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent Message is returned.

  • chatId (type int64): Unique identifier for the target chat
  • videoNote (type InputFileOrString): Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data. More information on Sending Files: https://core.telegram.org/bots/api#sending-files. Sending video notes by a URL is currently unsupported
  • opts (type SendVideoNoteOpts): All optional parameters.

func (*Bot) SendVoice

func (bot *Bot) SendVoice(chatId int64, voice InputFileOrString, opts *SendVoiceOpts) (*Message, error)

SendVoice (https://core.telegram.org/bots/api#sendvoice)

Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS, or in .MP3 format, or in .M4A format (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.

  • chatId (type int64): Unique identifier for the target chat
  • voice (type InputFileOrString): Audio file to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files: https://core.telegram.org/bots/api#sending-files
  • opts (type SendVoiceOpts): All optional parameters.

func (*Bot) SetChatAdministratorCustomTitle

func (bot *Bot) SetChatAdministratorCustomTitle(chatId int64, userId int64, customTitle string, opts *SetChatAdministratorCustomTitleOpts) (bool, error)

SetChatAdministratorCustomTitle (https://core.telegram.org/bots/api#setchatadministratorcustomtitle)

Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns True on success.

  • chatId (type int64): Unique identifier for the target chat
  • userId (type int64): Unique identifier of the target user
  • customTitle (type string): New custom title for the administrator; 0-16 characters, emoji are not allowed
  • opts (type SetChatAdministratorCustomTitleOpts): All optional parameters.

func (*Bot) SetChatDescription

func (bot *Bot) SetChatDescription(chatId int64, opts *SetChatDescriptionOpts) (bool, error)

SetChatDescription (https://core.telegram.org/bots/api#setchatdescription)

Use this method to change the description of a group, a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.

  • chatId (type int64): Unique identifier for the target chat
  • opts (type SetChatDescriptionOpts): All optional parameters.

func (*Bot) SetChatMenuButton

func (bot *Bot) SetChatMenuButton(opts *SetChatMenuButtonOpts) (bool, error)

SetChatMenuButton (https://core.telegram.org/bots/api#setchatmenubutton)

Use this method to change the bot's menu button in a private chat, or the default menu button. Returns True on success.

  • opts (type SetChatMenuButtonOpts): All optional parameters.

func (*Bot) SetChatPermissions

func (bot *Bot) SetChatPermissions(chatId int64, permissions ChatPermissions, opts *SetChatPermissionsOpts) (bool, error)

SetChatPermissions (https://core.telegram.org/bots/api#setchatpermissions)

Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members administrator rights. Returns True on success.

  • chatId (type int64): Unique identifier for the target chat
  • permissions (type ChatPermissions): A JSON-serialized object for new default chat permissions
  • opts (type SetChatPermissionsOpts): All optional parameters.

func (*Bot) SetChatPhoto

func (bot *Bot) SetChatPhoto(chatId int64, photo InputFile, opts *SetChatPhotoOpts) (bool, error)

SetChatPhoto (https://core.telegram.org/bots/api#setchatphoto)

Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.

  • chatId (type int64): Unique identifier for the target chat
  • photo (type InputFile): New chat photo, uploaded using multipart/form-data
  • opts (type SetChatPhotoOpts): All optional parameters.

func (*Bot) SetChatStickerSet

func (bot *Bot) SetChatStickerSet(chatId int64, stickerSetName string, opts *SetChatStickerSetOpts) (bool, error)

SetChatStickerSet (https://core.telegram.org/bots/api#setchatstickerset)

Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success.

  • chatId (type int64): Unique identifier for the target chat
  • stickerSetName (type string): Name of the sticker set to be set as the group sticker set
  • opts (type SetChatStickerSetOpts): All optional parameters.

func (*Bot) SetChatTitle

func (bot *Bot) SetChatTitle(chatId int64, title string, opts *SetChatTitleOpts) (bool, error)

SetChatTitle (https://core.telegram.org/bots/api#setchattitle)

Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.

  • chatId (type int64): Unique identifier for the target chat
  • title (type string): New chat title, 1-128 characters
  • opts (type SetChatTitleOpts): All optional parameters.

func (*Bot) SetCustomEmojiStickerSetThumbnail

func (bot *Bot) SetCustomEmojiStickerSetThumbnail(name string, opts *SetCustomEmojiStickerSetThumbnailOpts) (bool, error)

SetCustomEmojiStickerSetThumbnail (https://core.telegram.org/bots/api#setcustomemojistickersetthumbnail)

Use this method to set the thumbnail of a custom emoji sticker set. Returns True on success.

  • name (type string): Sticker set name
  • opts (type SetCustomEmojiStickerSetThumbnailOpts): All optional parameters.

func (*Bot) SetGameScore

func (bot *Bot) SetGameScore(userId int64, score int64, opts *SetGameScoreOpts) (*Message, bool, error)

SetGameScore (https://core.telegram.org/bots/api#setgamescore)

Use this method to set the score of the specified user in a game message. On success, if the message is not an inline message, the Message is returned, otherwise True is returned. Returns an error, if the new score is not greater than the user's current score in the chat and force is False.

  • userId (type int64): User identifier
  • score (type int64): New score, must be non-negative
  • opts (type SetGameScoreOpts): All optional parameters.

func (*Bot) SetMessageReaction added in v2.1.0

func (bot *Bot) SetMessageReaction(chatId int64, messageId int64, opts *SetMessageReactionOpts) (bool, error)

SetMessageReaction (https://core.telegram.org/bots/api#setmessagereaction)

Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can't use paid reactions. Returns True on success.

  • chatId (type int64): Unique identifier for the target chat
  • messageId (type int64): Identifier of the target message. If the message belongs to a media group, the reaction is set to the first non-deleted message in the group instead.
  • opts (type SetMessageReactionOpts): All optional parameters.

func (*Bot) SetMyCommands

func (bot *Bot) SetMyCommands(commands []BotCommand, opts *SetMyCommandsOpts) (bool, error)

SetMyCommands (https://core.telegram.org/bots/api#setmycommands)

Use this method to change the list of the bot's commands. See this manual for more details about bot commands. Returns True on success.

  • commands (type []BotCommand): 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.
  • opts (type SetMyCommandsOpts): All optional parameters.

func (*Bot) SetMyDefaultAdministratorRights

func (bot *Bot) SetMyDefaultAdministratorRights(opts *SetMyDefaultAdministratorRightsOpts) (bool, error)

SetMyDefaultAdministratorRights (https://core.telegram.org/bots/api#setmydefaultadministratorrights)

Use this method to change the default administrator rights requested by the bot when it's added as an administrator to groups or channels. These rights will be suggested to users, but they are free to modify the list before adding the bot. Returns True on success.

  • opts (type SetMyDefaultAdministratorRightsOpts): All optional parameters.

func (*Bot) SetMyDescription

func (bot *Bot) SetMyDescription(opts *SetMyDescriptionOpts) (bool, error)

SetMyDescription (https://core.telegram.org/bots/api#setmydescription)

Use this method to change the bot's description, which is shown in the chat with the bot if the chat is empty. Returns True on success.

  • opts (type SetMyDescriptionOpts): All optional parameters.

func (*Bot) SetMyName

func (bot *Bot) SetMyName(opts *SetMyNameOpts) (bool, error)

SetMyName (https://core.telegram.org/bots/api#setmyname)

Use this method to change the bot's name. Returns True on success.

  • opts (type SetMyNameOpts): All optional parameters.

func (*Bot) SetMyShortDescription

func (bot *Bot) SetMyShortDescription(opts *SetMyShortDescriptionOpts) (bool, error)

SetMyShortDescription (https://core.telegram.org/bots/api#setmyshortdescription)

Use this method to change the bot's short description, which is shown on the bot's profile page and is sent together with the link when users share the bot. Returns True on success.

  • opts (type SetMyShortDescriptionOpts): All optional parameters.

func (*Bot) SetPassportDataErrors

func (bot *Bot) SetPassportDataErrors(userId int64, errors []PassportElementError, opts *SetPassportDataErrorsOpts) (bool, error)

SetPassportDataErrors (https://core.telegram.org/bots/api#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.

  • userId (type int64): User identifier
  • errors (type []PassportElementError): A JSON-serialized array describing the errors
  • opts (type SetPassportDataErrorsOpts): All optional parameters.

func (*Bot) SetStickerEmojiList

func (bot *Bot) SetStickerEmojiList(sticker string, emojiList []string, opts *SetStickerEmojiListOpts) (bool, error)

SetStickerEmojiList (https://core.telegram.org/bots/api#setstickeremojilist)

Use this method to change the list of emoji assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns True on success.

  • sticker (type string): File identifier of the sticker
  • emojiList (type []string): A JSON-serialized list of 1-20 emoji associated with the sticker
  • opts (type SetStickerEmojiListOpts): All optional parameters.

func (*Bot) SetStickerKeywords

func (bot *Bot) SetStickerKeywords(sticker string, opts *SetStickerKeywordsOpts) (bool, error)

SetStickerKeywords (https://core.telegram.org/bots/api#setstickerkeywords)

Use this method to change search keywords assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns True on success.

  • sticker (type string): File identifier of the sticker
  • opts (type SetStickerKeywordsOpts): All optional parameters.

func (*Bot) SetStickerMaskPosition

func (bot *Bot) SetStickerMaskPosition(sticker string, opts *SetStickerMaskPositionOpts) (bool, error)

SetStickerMaskPosition (https://core.telegram.org/bots/api#setstickermaskposition)

Use this method to change the mask position of a mask sticker. The sticker must belong to a sticker set that was created by the bot. Returns True on success.

  • sticker (type string): File identifier of the sticker
  • opts (type SetStickerMaskPositionOpts): All optional parameters.

func (*Bot) SetStickerPositionInSet

func (bot *Bot) SetStickerPositionInSet(sticker string, position int64, opts *SetStickerPositionInSetOpts) (bool, error)

SetStickerPositionInSet (https://core.telegram.org/bots/api#setstickerpositioninset)

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

  • sticker (type string): File identifier of the sticker
  • position (type int64): New sticker position in the set, zero-based
  • opts (type SetStickerPositionInSetOpts): All optional parameters.

func (*Bot) SetStickerSetThumbnail

func (bot *Bot) SetStickerSetThumbnail(name string, userId int64, format string, opts *SetStickerSetThumbnailOpts) (bool, error)

SetStickerSetThumbnail (https://core.telegram.org/bots/api#setstickersetthumbnail)

Use this method to set the thumbnail of a regular or mask sticker set. The format of the thumbnail file must match the format of the stickers in the set. Returns True on success.

  • name (type string): Sticker set name
  • userId (type int64): User identifier of the sticker set owner
  • format (type string): Format of the thumbnail, must be one of "static" for a .WEBP or .PNG image, "animated" for a .TGS animation, or "video" for a WEBM video
  • opts (type SetStickerSetThumbnailOpts): All optional parameters.

func (*Bot) SetStickerSetTitle

func (bot *Bot) SetStickerSetTitle(name string, title string, opts *SetStickerSetTitleOpts) (bool, error)

SetStickerSetTitle (https://core.telegram.org/bots/api#setstickersettitle)

Use this method to set the title of a created sticker set. Returns True on success.

  • name (type string): Sticker set name
  • title (type string): Sticker set title, 1-64 characters
  • opts (type SetStickerSetTitleOpts): All optional parameters.

func (*Bot) SetWebhook

func (bot *Bot) SetWebhook(url string, opts *SetWebhookOpts) (bool, error)

SetWebhook (https://core.telegram.org/bots/api#setwebhook)

Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns True on success. If you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter secret_token. If specified, the request will contain a header "X-Telegram-Bot-Api-Secret-Token" with the secret token as content.

  • url (type string): HTTPS URL to send updates to. Use an empty string to remove webhook integration
  • opts (type SetWebhookOpts): All optional parameters.

func (*Bot) StopMessageLiveLocation

func (bot *Bot) StopMessageLiveLocation(opts *StopMessageLiveLocationOpts) (*Message, bool, error)

StopMessageLiveLocation (https://core.telegram.org/bots/api#stopmessagelivelocation)

Use this method to stop updating a live location message before live_period expires. On success, if the message is not an inline message, the edited Message is returned, otherwise True is returned.

  • opts (type StopMessageLiveLocationOpts): All optional parameters.

func (*Bot) StopPoll

func (bot *Bot) StopPoll(chatId int64, messageId int64, opts *StopPollOpts) (*Poll, error)

StopPoll (https://core.telegram.org/bots/api#stoppoll)

Use this method to stop a poll which was sent by the bot. On success, the stopped Poll is returned.

  • chatId (type int64): Unique identifier for the target chat
  • messageId (type int64): Identifier of the original message with the poll
  • opts (type StopPollOpts): All optional parameters.

func (*Bot) UnbanChatMember

func (bot *Bot) UnbanChatMember(chatId int64, userId int64, opts *UnbanChatMemberOpts) (bool, error)

UnbanChatMember (https://core.telegram.org/bots/api#unbanchatmember)

Use this method to unban a previously banned user in a supergroup or channel. The user will not return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. By default, this method guarantees that after the call the user is not a member of the chat, but will be able to join it. So if the user is a member of the chat they will also be removed from the chat. If you don't want this, use the parameter only_if_banned. Returns True on success.

  • chatId (type int64): Unique identifier for the target group
  • userId (type int64): Unique identifier of the target user
  • opts (type UnbanChatMemberOpts): All optional parameters.

func (*Bot) UnbanChatSenderChat

func (bot *Bot) UnbanChatSenderChat(chatId int64, senderChatId int64, opts *UnbanChatSenderChatOpts) (bool, error)

UnbanChatSenderChat (https://core.telegram.org/bots/api#unbanchatsenderchat)

Use this method to unban a previously banned channel chat in a supergroup or channel. The bot must be an administrator for this to work and must have the appropriate administrator rights. Returns True on success.

  • chatId (type int64): Unique identifier for the target chat
  • senderChatId (type int64): Unique identifier of the target sender chat
  • opts (type UnbanChatSenderChatOpts): All optional parameters.

func (*Bot) UnhideGeneralForumTopic

func (bot *Bot) UnhideGeneralForumTopic(chatId int64, opts *UnhideGeneralForumTopicOpts) (bool, error)

UnhideGeneralForumTopic (https://core.telegram.org/bots/api#unhidegeneralforumtopic)

Use this method to unhide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.

  • chatId (type int64): Unique identifier for the target chat
  • opts (type UnhideGeneralForumTopicOpts): All optional parameters.

func (*Bot) UnpinAllChatMessages

func (bot *Bot) UnpinAllChatMessages(chatId int64, opts *UnpinAllChatMessagesOpts) (bool, error)

UnpinAllChatMessages (https://core.telegram.org/bots/api#unpinallchatmessages)

Use this method to clear the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns True on success.

  • chatId (type int64): Unique identifier for the target chat
  • opts (type UnpinAllChatMessagesOpts): All optional parameters.

func (*Bot) UnpinAllForumTopicMessages

func (bot *Bot) UnpinAllForumTopicMessages(chatId int64, messageThreadId int64, opts *UnpinAllForumTopicMessagesOpts) (bool, error)

UnpinAllForumTopicMessages (https://core.telegram.org/bots/api#unpinallforumtopicmessages)

Use this method to clear the list of pinned messages in a forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success.

  • chatId (type int64): Unique identifier for the target chat
  • messageThreadId (type int64): Unique identifier for the target message thread of the forum topic
  • opts (type UnpinAllForumTopicMessagesOpts): All optional parameters.

func (*Bot) UnpinAllGeneralForumTopicMessages

func (bot *Bot) UnpinAllGeneralForumTopicMessages(chatId int64, opts *UnpinAllGeneralForumTopicMessagesOpts) (bool, error)

UnpinAllGeneralForumTopicMessages (https://core.telegram.org/bots/api#unpinallgeneralforumtopicmessages)

Use this method to clear the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success.

  • chatId (type int64): Unique identifier for the target chat
  • opts (type UnpinAllGeneralForumTopicMessagesOpts): All optional parameters.

func (*Bot) UnpinChatMessage

func (bot *Bot) UnpinChatMessage(chatId int64, opts *UnpinChatMessageOpts) (bool, error)

UnpinChatMessage (https://core.telegram.org/bots/api#unpinchatmessage)

Use this method to remove a message from the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns True on success.

  • chatId (type int64): Unique identifier for the target chat
  • opts (type UnpinChatMessageOpts): All optional parameters.

func (*Bot) UploadStickerFile

func (bot *Bot) UploadStickerFile(userId int64, sticker InputFile, stickerFormat string, opts *UploadStickerFileOpts) (*File, error)

UploadStickerFile (https://core.telegram.org/bots/api#uploadstickerfile)

Use this method to upload a file with a sticker for later use in the createNewStickerSet, addStickerToSet, or replaceStickerInSet methods (the file can be used multiple times). Returns the uploaded File on success.

  • userId (type int64): User identifier of sticker file owner
  • sticker (type InputFile): A file with the sticker in .WEBP, .PNG, .TGS, or .WEBM format. See https://core.telegram.org/stickers for technical requirements. More information on Sending Files: https://core.telegram.org/bots/api#sending-files
  • stickerFormat (type string): Format of the sticker, must be one of "static", "animated", "video"
  • opts (type UploadStickerFileOpts): All optional parameters.

func (*Bot) UseMiddleware deprecated

func (bot *Bot) UseMiddleware(mw func(client BotClient) BotClient) *Bot

UseMiddleware allows you to wrap the existing bot client to enhance functionality

Deprecated: Instead of using middlewares, consider implementing the BotClient interface.

type BotClient

type BotClient interface {
	// RequestWithContext submits a POST HTTP request a bot API instance.
	RequestWithContext(ctx context.Context, token string, method string, params map[string]string, data map[string]FileReader, opts *RequestOpts) (json.RawMessage, error)
	// TimeoutContext calculates the required timeout contect required given the passed RequestOpts, and any default opts defined by the BotClient.
	TimeoutContext(opts *RequestOpts) (context.Context, context.CancelFunc)
	// GetAPIURL gets the URL of the API either in use by the bot or defined in the request opts.
	GetAPIURL(opts *RequestOpts) string
	// FileURL gets the URL of a file at the API address that the bot is interacting with.
	FileURL(token string, tgFilePath string, opts *RequestOpts) string
}

type BotCommand

type BotCommand struct {
	// Text of the command; 1-32 characters. Can contain only lowercase English letters, digits and underscores.
	Command string `json:"command"`
	// Description of the command; 1-256 characters.
	Description string `json:"description"`
}

BotCommand (https://core.telegram.org/bots/api#botcommand)

This object represents a bot command.

type BotCommandScope

type BotCommandScope interface {
	GetType() string
	// MergeBotCommandScope returns a MergedBotCommandScope struct to simplify working with complex telegram types in a non-generic world.
	MergeBotCommandScope() MergedBotCommandScope
	// contains filtered or unexported methods
}

BotCommandScope (https://core.telegram.org/bots/api#botcommandscope)

This object represents the scope to which bot commands are applied. Currently, the following 7 scopes are supported:

  • BotCommandScopeDefault
  • BotCommandScopeAllPrivateChats
  • BotCommandScopeAllGroupChats
  • BotCommandScopeAllChatAdministrators
  • BotCommandScopeChat
  • BotCommandScopeChatAdministrators
  • BotCommandScopeChatMember

type BotCommandScopeAllChatAdministrators

type BotCommandScopeAllChatAdministrators struct{}

BotCommandScopeAllChatAdministrators (https://core.telegram.org/bots/api#botcommandscopeallchatadministrators)

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

func (BotCommandScopeAllChatAdministrators) GetType

GetType is a helper method to easily access the common fields of an interface.

func (BotCommandScopeAllChatAdministrators) MarshalJSON

func (v BotCommandScopeAllChatAdministrators) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (BotCommandScopeAllChatAdministrators) MergeBotCommandScope

MergeBotCommandScope returns a MergedBotCommandScope struct to simplify working with types in a non-generic world.

type BotCommandScopeAllGroupChats

type BotCommandScopeAllGroupChats struct{}

BotCommandScopeAllGroupChats (https://core.telegram.org/bots/api#botcommandscopeallgroupchats)

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

func (BotCommandScopeAllGroupChats) GetType

GetType is a helper method to easily access the common fields of an interface.

func (BotCommandScopeAllGroupChats) MarshalJSON

func (v BotCommandScopeAllGroupChats) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (BotCommandScopeAllGroupChats) MergeBotCommandScope

func (v BotCommandScopeAllGroupChats) MergeBotCommandScope() MergedBotCommandScope

MergeBotCommandScope returns a MergedBotCommandScope struct to simplify working with types in a non-generic world.

type BotCommandScopeAllPrivateChats

type BotCommandScopeAllPrivateChats struct{}

BotCommandScopeAllPrivateChats (https://core.telegram.org/bots/api#botcommandscopeallprivatechats)

Represents the scope of bot commands, covering all private chats.

func (BotCommandScopeAllPrivateChats) GetType

GetType is a helper method to easily access the common fields of an interface.

func (BotCommandScopeAllPrivateChats) MarshalJSON

func (v BotCommandScopeAllPrivateChats) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (BotCommandScopeAllPrivateChats) MergeBotCommandScope

func (v BotCommandScopeAllPrivateChats) MergeBotCommandScope() MergedBotCommandScope

MergeBotCommandScope returns a MergedBotCommandScope struct to simplify working with types in a non-generic world.

type BotCommandScopeChat

type BotCommandScopeChat struct {
	// Unique identifier for the target chat
	ChatId int64 `json:"chat_id"`
}

BotCommandScopeChat (https://core.telegram.org/bots/api#botcommandscopechat)

Represents the scope of bot commands, covering a specific chat.

func (BotCommandScopeChat) GetType

func (v BotCommandScopeChat) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (BotCommandScopeChat) MarshalJSON

func (v BotCommandScopeChat) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (BotCommandScopeChat) MergeBotCommandScope

func (v BotCommandScopeChat) MergeBotCommandScope() MergedBotCommandScope

MergeBotCommandScope returns a MergedBotCommandScope struct to simplify working with types in a non-generic world.

type BotCommandScopeChatAdministrators

type BotCommandScopeChatAdministrators struct {
	// Unique identifier for the target chat
	ChatId int64 `json:"chat_id"`
}

BotCommandScopeChatAdministrators (https://core.telegram.org/bots/api#botcommandscopechatadministrators)

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

func (BotCommandScopeChatAdministrators) GetType

GetType is a helper method to easily access the common fields of an interface.

func (BotCommandScopeChatAdministrators) MarshalJSON

func (v BotCommandScopeChatAdministrators) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (BotCommandScopeChatAdministrators) MergeBotCommandScope

MergeBotCommandScope returns a MergedBotCommandScope struct to simplify working with types in a non-generic world.

type BotCommandScopeChatMember

type BotCommandScopeChatMember struct {
	// Unique identifier for the target chat
	ChatId int64 `json:"chat_id"`
	// Unique identifier of the target user
	UserId int64 `json:"user_id"`
}

BotCommandScopeChatMember (https://core.telegram.org/bots/api#botcommandscopechatmember)

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

func (BotCommandScopeChatMember) GetType

func (v BotCommandScopeChatMember) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (BotCommandScopeChatMember) MarshalJSON

func (v BotCommandScopeChatMember) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (BotCommandScopeChatMember) MergeBotCommandScope

func (v BotCommandScopeChatMember) MergeBotCommandScope() MergedBotCommandScope

MergeBotCommandScope returns a MergedBotCommandScope struct to simplify working with types in a non-generic world.

type BotCommandScopeDefault

type BotCommandScopeDefault struct{}

BotCommandScopeDefault (https://core.telegram.org/bots/api#botcommandscopedefault)

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

func (BotCommandScopeDefault) GetType

func (v BotCommandScopeDefault) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (BotCommandScopeDefault) MarshalJSON

func (v BotCommandScopeDefault) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (BotCommandScopeDefault) MergeBotCommandScope

func (v BotCommandScopeDefault) MergeBotCommandScope() MergedBotCommandScope

MergeBotCommandScope returns a MergedBotCommandScope struct to simplify working with types in a non-generic world.

type BotDescription

type BotDescription struct {
	// The bot's description
	Description string `json:"description"`
}

BotDescription (https://core.telegram.org/bots/api#botdescription)

This object represents the bot's description.

type BotName

type BotName struct {
	// The bot's name
	Name string `json:"name"`
}

BotName (https://core.telegram.org/bots/api#botname)

This object represents the bot's name.

type BotOpts

type BotOpts struct {
	// BotClient allows for passing in custom configurations of BotClient, such as handling extra errors or providing
	// metrics.
	BotClient BotClient
	// DisableTokenCheck can be used to disable the token validity check.
	// Useful when running in time-constrained environments where the startup time should be minimised, and where the
	// token can be assumed to be valid (eg lambdas).
	// Warning: Disabling the token check will mean that the Bot.User struct will no longer be populated.
	DisableTokenCheck bool
	// Request opts to use for checking token validity with Bot.GetMe. Can be slow - a high timeout (eg 10s) is
	// recommended.
	RequestOpts *RequestOpts
}

BotOpts declares all optional parameters for the NewBot function.

type BotShortDescription

type BotShortDescription struct {
	// The bot's short description
	ShortDescription string `json:"short_description"`
}

BotShortDescription (https://core.telegram.org/bots/api#botshortdescription)

This object represents the bot's short description.

type BusinessConnection added in v2.1.0

type BusinessConnection struct {
	// Unique identifier of the business connection
	Id string `json:"id"`
	// Business account user that created the business connection
	User User `json:"user"`
	// Identifier of a private chat with the user who created the business connection. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier.
	UserChatId int64 `json:"user_chat_id"`
	// Date the connection was established in Unix time
	Date int64 `json:"date"`
	// True, if the bot can act on behalf of the business account in chats that were active in the last 24 hours
	CanReply bool `json:"can_reply"`
	// True, if the connection is active
	IsEnabled bool `json:"is_enabled"`
}

BusinessConnection (https://core.telegram.org/bots/api#businessconnection)

Describes the connection of the bot with a business account.

func (BusinessConnection) Get added in v2.1.0

Get Helper method for Bot.GetBusinessConnection.

type BusinessIntro added in v2.1.0

type BusinessIntro struct {
	// Optional. Title text of the business intro
	Title string `json:"title,omitempty"`
	// Optional. Message text of the business intro
	Message string `json:"message,omitempty"`
	// Optional. Sticker of the business intro
	Sticker *Sticker `json:"sticker,omitempty"`
}

BusinessIntro (https://core.telegram.org/bots/api#businessintro)

Contains information about the start page settings of a Telegram Business account.

type BusinessLocation added in v2.1.0

type BusinessLocation struct {
	// Address of the business
	Address string `json:"address"`
	// Optional. Location of the business
	Location *Location `json:"location,omitempty"`
}

BusinessLocation (https://core.telegram.org/bots/api#businesslocation)

Contains information about the location of a Telegram Business account.

type BusinessMessagesDeleted added in v2.1.0

type BusinessMessagesDeleted struct {
	// Unique identifier of the business connection
	BusinessConnectionId string `json:"business_connection_id"`
	// Information about a chat in the business account. The bot may not have access to the chat or the corresponding user.
	Chat Chat `json:"chat"`
	// The list of identifiers of deleted messages in the chat of the business account
	MessageIds []int64 `json:"message_ids,omitempty"`
}

BusinessMessagesDeleted (https://core.telegram.org/bots/api#businessmessagesdeleted)

This object is received when messages are deleted from a connected business account.

type BusinessOpeningHours added in v2.1.0

type BusinessOpeningHours struct {
	// Unique name of the time zone for which the opening hours are defined
	TimeZoneName string `json:"time_zone_name"`
	// List of time intervals describing business opening hours
	OpeningHours []BusinessOpeningHoursInterval `json:"opening_hours,omitempty"`
}

BusinessOpeningHours (https://core.telegram.org/bots/api#businessopeninghours)

Describes the opening hours of a business.

type BusinessOpeningHoursInterval added in v2.1.0

type BusinessOpeningHoursInterval struct {
	// The minute's sequence number in a week, starting on Monday, marking the start of the time interval during which the business is open; 0 - 7 * 24 * 60
	OpeningMinute int64 `json:"opening_minute"`
	// The minute's sequence number in a week, starting on Monday, marking the end of the time interval during which the business is open; 0 - 8 * 24 * 60
	ClosingMinute int64 `json:"closing_minute"`
}

BusinessOpeningHoursInterval (https://core.telegram.org/bots/api#businessopeninghoursinterval)

Describes an interval of time during which a business is open.

type CallbackGame

type CallbackGame struct{}

CallbackGame (https://core.telegram.org/bots/api#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"`
	// Sender
	From User `json:"from"`
	// Optional. Message sent by the bot with the callback button that originated the query
	Message MaybeInaccessibleMessage `json:"message,omitempty"`
	// Optional. 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"`
	// Optional. Data associated with the callback button. Be aware that the message originated the query can contain no callback buttons with this data.
	Data string `json:"data,omitempty"`
	// Optional. Short name of a Game to be returned, serves as the unique identifier for the game
	GameShortName string `json:"game_short_name,omitempty"`
}

CallbackQuery (https://core.telegram.org/bots/api#callbackquery)

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

func (CallbackQuery) Answer

func (cq CallbackQuery) Answer(b *Bot, opts *AnswerCallbackQueryOpts) (bool, error)

Answer Helper method for Bot.AnswerCallbackQuery.

func (*CallbackQuery) UnmarshalJSON added in v2.1.0

func (v *CallbackQuery) UnmarshalJSON(b []byte) error

UnmarshalJSON is a custom JSON unmarshaller to use the helpers which allow for unmarshalling structs into interfaces.

type Chat

type Chat struct {
	// Unique identifier for this chat. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.
	Id int64 `json:"id"`
	// Type of the chat, can be either "private", "group", "supergroup" or "channel"
	Type string `json:"type"`
	// Optional. Title, for supergroups, channels and group chats
	Title string `json:"title,omitempty"`
	// Optional. Username, for private chats, supergroups and channels if available
	Username string `json:"username,omitempty"`
	// Optional. First name of the other party in a private chat
	FirstName string `json:"first_name,omitempty"`
	// Optional. Last name of the other party in a private chat
	LastName string `json:"last_name,omitempty"`
	// Optional. True, if the supergroup chat is a forum (has topics enabled)
	IsForum bool `json:"is_forum,omitempty"`
}

Chat (https://core.telegram.org/bots/api#chat)

This object represents a chat.

func (Chat) ApproveJoinRequest

func (c Chat) ApproveJoinRequest(b *Bot, userId int64, opts *ApproveChatJoinRequestOpts) (bool, error)

ApproveJoinRequest Helper method for Bot.ApproveChatJoinRequest.

func (Chat) BanMember

func (c Chat) BanMember(b *Bot, userId int64, opts *BanChatMemberOpts) (bool, error)

BanMember Helper method for Bot.BanChatMember.

func (Chat) BanSenderChat

func (c Chat) BanSenderChat(b *Bot, senderChatId int64, opts *BanChatSenderChatOpts) (bool, error)

BanSenderChat Helper method for Bot.BanChatSenderChat.

func (c Chat) CreateInviteLink(b *Bot, opts *CreateChatInviteLinkOpts) (*ChatInviteLink, error)

CreateInviteLink Helper method for Bot.CreateChatInviteLink.

func (c Chat) CreateSubscriptionInviteLink(b *Bot, subscriptionPeriod int64, subscriptionPrice int64, opts *CreateChatSubscriptionInviteLinkOpts) (*ChatInviteLink, error)

CreateSubscriptionInviteLink Helper method for Bot.CreateChatSubscriptionInviteLink.

func (Chat) DeclineJoinRequest

func (c Chat) DeclineJoinRequest(b *Bot, userId int64, opts *DeclineChatJoinRequestOpts) (bool, error)

DeclineJoinRequest Helper method for Bot.DeclineChatJoinRequest.

func (Chat) DeletePhoto

func (c Chat) DeletePhoto(b *Bot, opts *DeleteChatPhotoOpts) (bool, error)

DeletePhoto Helper method for Bot.DeleteChatPhoto.

func (Chat) DeleteStickerSet

func (c Chat) DeleteStickerSet(b *Bot, opts *DeleteChatStickerSetOpts) (bool, error)

DeleteStickerSet Helper method for Bot.DeleteChatStickerSet.

func (c Chat) EditInviteLink(b *Bot, inviteLink string, opts *EditChatInviteLinkOpts) (*ChatInviteLink, error)

EditInviteLink Helper method for Bot.EditChatInviteLink.

func (c Chat) EditSubscriptionInviteLink(b *Bot, inviteLink string, opts *EditChatSubscriptionInviteLinkOpts) (*ChatInviteLink, error)

EditSubscriptionInviteLink Helper method for Bot.EditChatSubscriptionInviteLink.

func (c Chat) ExportInviteLink(b *Bot, opts *ExportChatInviteLinkOpts) (string, error)

ExportInviteLink Helper method for Bot.ExportChatInviteLink.

func (Chat) Get

func (c Chat) Get(b *Bot, opts *GetChatOpts) (*ChatFullInfo, error)

Get Helper method for Bot.GetChat.

func (Chat) GetAdministrators

func (c Chat) GetAdministrators(b *Bot, opts *GetChatAdministratorsOpts) ([]ChatMember, error)

GetAdministrators Helper method for Bot.GetChatAdministrators.

func (Chat) GetMember

func (c Chat) GetMember(b *Bot, userId int64, opts *GetChatMemberOpts) (ChatMember, error)

GetMember Helper method for Bot.GetChatMember.

func (Chat) GetMemberCount

func (c Chat) GetMemberCount(b *Bot, opts *GetChatMemberCountOpts) (int64, error)

GetMemberCount Helper method for Bot.GetChatMemberCount.

func (Chat) GetMenuButton

func (c Chat) GetMenuButton(b *Bot, opts *GetChatMenuButtonOpts) (MenuButton, error)

GetMenuButton Helper method for Bot.GetChatMenuButton.

func (Chat) GetUserBoosts added in v2.1.0

func (c Chat) GetUserBoosts(b *Bot, userId int64, opts *GetUserChatBoostsOpts) (*UserChatBoosts, error)

GetUserBoosts Helper method for Bot.GetUserChatBoosts.

func (Chat) Leave

func (c Chat) Leave(b *Bot, opts *LeaveChatOpts) (bool, error)

Leave Helper method for Bot.LeaveChat.

func (Chat) PinMessage

func (c Chat) PinMessage(b *Bot, messageId int64, opts *PinChatMessageOpts) (bool, error)

PinMessage Helper method for Bot.PinChatMessage.

func (Chat) Promote

func (c Chat) Promote(b *Bot, userId int64, opts *PromoteChatMemberOpts) (bool, error)

Promote is a helper function to easily call Bot.PromoteChatMember in a chat.

func (Chat) PromoteMember

func (c Chat) PromoteMember(b *Bot, userId int64, opts *PromoteChatMemberOpts) (bool, error)

PromoteMember Helper method for Bot.PromoteChatMember.

func (Chat) RestrictMember

func (c Chat) RestrictMember(b *Bot, userId int64, permissions ChatPermissions, opts *RestrictChatMemberOpts) (bool, error)

RestrictMember Helper method for Bot.RestrictChatMember.

func (c Chat) RevokeInviteLink(b *Bot, inviteLink string, opts *RevokeChatInviteLinkOpts) (*ChatInviteLink, error)

RevokeInviteLink Helper method for Bot.RevokeChatInviteLink.

func (Chat) SendAction

func (c Chat) SendAction(b *Bot, action string, opts *SendChatActionOpts) (bool, error)

SendAction Helper method for Bot.SendChatAction.

func (Chat) SendMessage

func (c Chat) SendMessage(b *Bot, text string, opts *SendMessageOpts) (*Message, error)

SendMessage is a helper function to easily call Bot.SendMessage in a chat.

func (Chat) SetAdministratorCustomTitle

func (c Chat) SetAdministratorCustomTitle(b *Bot, userId int64, customTitle string, opts *SetChatAdministratorCustomTitleOpts) (bool, error)

SetAdministratorCustomTitle Helper method for Bot.SetChatAdministratorCustomTitle.

func (Chat) SetDescription

func (c Chat) SetDescription(b *Bot, opts *SetChatDescriptionOpts) (bool, error)

SetDescription Helper method for Bot.SetChatDescription.

func (Chat) SetMenuButton

func (c Chat) SetMenuButton(b *Bot, opts *SetChatMenuButtonOpts) (bool, error)

SetMenuButton Helper method for Bot.SetChatMenuButton.

func (Chat) SetPermissions

func (c Chat) SetPermissions(b *Bot, permissions ChatPermissions, opts *SetChatPermissionsOpts) (bool, error)

SetPermissions Helper method for Bot.SetChatPermissions.

func (Chat) SetPhoto

func (c Chat) SetPhoto(b *Bot, photo InputFile, opts *SetChatPhotoOpts) (bool, error)

SetPhoto Helper method for Bot.SetChatPhoto.

func (Chat) SetStickerSet

func (c Chat) SetStickerSet(b *Bot, stickerSetName string, opts *SetChatStickerSetOpts) (bool, error)

SetStickerSet Helper method for Bot.SetChatStickerSet.

func (Chat) SetTitle

func (c Chat) SetTitle(b *Bot, title string, opts *SetChatTitleOpts) (bool, error)

SetTitle Helper method for Bot.SetChatTitle.

func (Chat) Unban

func (c Chat) Unban(b *Bot, userId int64, opts *UnbanChatMemberOpts) (bool, error)

Unban is a helper function to easily call Bot.UnbanChatMember in a chat.

func (Chat) UnbanMember

func (c Chat) UnbanMember(b *Bot, userId int64, opts *UnbanChatMemberOpts) (bool, error)

UnbanMember Helper method for Bot.UnbanChatMember.

func (Chat) UnbanSenderChat

func (c Chat) UnbanSenderChat(b *Bot, senderChatId int64, opts *UnbanChatSenderChatOpts) (bool, error)

UnbanSenderChat Helper method for Bot.UnbanChatSenderChat.

func (Chat) UnpinAllMessages

func (c Chat) UnpinAllMessages(b *Bot, opts *UnpinAllChatMessagesOpts) (bool, error)

UnpinAllMessages Helper method for Bot.UnpinAllChatMessages.

func (Chat) UnpinMessage

func (c Chat) UnpinMessage(b *Bot, opts *UnpinChatMessageOpts) (bool, error)

UnpinMessage Helper method for Bot.UnpinChatMessage.

type ChatAdministratorRights

type ChatAdministratorRights struct {
	// 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, get boost list, see hidden supergroup and channel members, report spam messages 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 video chats
	CanManageVideoChats bool `json:"can_manage_video_chats"`
	// True, if the administrator can restrict, ban or unban chat members, or access supergroup statistics
	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 they have 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 stories to the chat
	CanPostStories bool `json:"can_post_stories"`
	// True, if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access the chat's story archive
	CanEditStories bool `json:"can_edit_stories"`
	// True, if the administrator can delete stories posted by other users
	CanDeleteStories bool `json:"can_delete_stories"`
	// Optional. True, if the administrator can post messages in the channel, or access channel statistics; for channels only
	CanPostMessages bool `json:"can_post_messages,omitempty"`
	// Optional. True, if the administrator can edit messages of other users and can pin messages; for channels only
	CanEditMessages bool `json:"can_edit_messages,omitempty"`
	// Optional. True, if the user is allowed to pin messages; for groups and supergroups only
	CanPinMessages bool `json:"can_pin_messages,omitempty"`
	// Optional. True, if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only
	CanManageTopics bool `json:"can_manage_topics,omitempty"`
}

ChatAdministratorRights (https://core.telegram.org/bots/api#chatadministratorrights)

Represents the rights of an administrator in a chat.

type ChatBackground added in v2.1.0

type ChatBackground struct {
	// Type of the background
	Type BackgroundType `json:"type"`
}

ChatBackground (https://core.telegram.org/bots/api#chatbackground)

This object represents a chat background.

func (*ChatBackground) UnmarshalJSON added in v2.1.0

func (v *ChatBackground) UnmarshalJSON(b []byte) error

UnmarshalJSON is a custom JSON unmarshaller to use the helpers which allow for unmarshalling structs into interfaces.

type ChatBoost added in v2.1.0

type ChatBoost struct {
	// Unique identifier of the boost
	BoostId string `json:"boost_id"`
	// Point in time (Unix timestamp) when the chat was boosted
	AddDate int64 `json:"add_date"`
	// Point in time (Unix timestamp) when the boost will automatically expire, unless the booster's Telegram Premium subscription is prolonged
	ExpirationDate int64 `json:"expiration_date"`
	// Source of the added boost
	Source ChatBoostSource `json:"source"`
}

ChatBoost (https://core.telegram.org/bots/api#chatboost)

This object contains information about a chat boost.

func (*ChatBoost) UnmarshalJSON added in v2.1.0

func (v *ChatBoost) UnmarshalJSON(b []byte) error

UnmarshalJSON is a custom JSON unmarshaller to use the helpers which allow for unmarshalling structs into interfaces.

type ChatBoostAdded added in v2.1.0

type ChatBoostAdded struct {
	// Number of boosts added by the user
	BoostCount int64 `json:"boost_count"`
}

ChatBoostAdded (https://core.telegram.org/bots/api#chatboostadded)

This object represents a service message about a user boosting a chat.

type ChatBoostRemoved added in v2.1.0

type ChatBoostRemoved struct {
	// Chat which was boosted
	Chat Chat `json:"chat"`
	// Unique identifier of the boost
	BoostId string `json:"boost_id"`
	// Point in time (Unix timestamp) when the boost was removed
	RemoveDate int64 `json:"remove_date"`
	// Source of the removed boost
	Source ChatBoostSource `json:"source"`
}

ChatBoostRemoved (https://core.telegram.org/bots/api#chatboostremoved)

This object represents a boost removed from a chat.

func (*ChatBoostRemoved) UnmarshalJSON added in v2.1.0

func (v *ChatBoostRemoved) UnmarshalJSON(b []byte) error

UnmarshalJSON is a custom JSON unmarshaller to use the helpers which allow for unmarshalling structs into interfaces.

type ChatBoostSource added in v2.1.0

type ChatBoostSource interface {
	GetSource() string
	// MergeChatBoostSource returns a MergedChatBoostSource struct to simplify working with complex telegram types in a non-generic world.
	MergeChatBoostSource() MergedChatBoostSource
	// contains filtered or unexported methods
}

ChatBoostSource (https://core.telegram.org/bots/api#chatboostsource)

This object describes the source of a chat boost. It can be one of

  • ChatBoostSourcePremium
  • ChatBoostSourceGiftCode
  • ChatBoostSourceGiveaway

type ChatBoostSourceGiftCode added in v2.1.0

type ChatBoostSourceGiftCode struct {
	// User for which the gift code was created
	User User `json:"user"`
}

ChatBoostSourceGiftCode (https://core.telegram.org/bots/api#chatboostsourcegiftcode)

The boost was obtained by the creation of Telegram Premium gift codes to boost a chat. Each such code boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription.

func (ChatBoostSourceGiftCode) GetSource added in v2.1.0

func (v ChatBoostSourceGiftCode) GetSource() string

GetSource is a helper method to easily access the common fields of an interface.

func (ChatBoostSourceGiftCode) MarshalJSON added in v2.1.0

func (v ChatBoostSourceGiftCode) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Source value.

func (ChatBoostSourceGiftCode) MergeChatBoostSource added in v2.1.0

func (v ChatBoostSourceGiftCode) MergeChatBoostSource() MergedChatBoostSource

MergeChatBoostSource returns a MergedChatBoostSource struct to simplify working with types in a non-generic world.

type ChatBoostSourceGiveaway added in v2.1.0

type ChatBoostSourceGiveaway struct {
	// Identifier of a message in the chat with the giveaway; the message could have been deleted already. May be 0 if the message isn't sent yet.
	GiveawayMessageId int64 `json:"giveaway_message_id"`
	// Optional. User that won the prize in the giveaway if any
	User *User `json:"user,omitempty"`
	// Optional. True, if the giveaway was completed, but there was no user to win the prize
	IsUnclaimed bool `json:"is_unclaimed,omitempty"`
}

ChatBoostSourceGiveaway (https://core.telegram.org/bots/api#chatboostsourcegiveaway)

The boost was obtained by the creation of a Telegram Premium giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription.

func (ChatBoostSourceGiveaway) GetSource added in v2.1.0

func (v ChatBoostSourceGiveaway) GetSource() string

GetSource is a helper method to easily access the common fields of an interface.

func (ChatBoostSourceGiveaway) MarshalJSON added in v2.1.0

func (v ChatBoostSourceGiveaway) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Source value.

func (ChatBoostSourceGiveaway) MergeChatBoostSource added in v2.1.0

func (v ChatBoostSourceGiveaway) MergeChatBoostSource() MergedChatBoostSource

MergeChatBoostSource returns a MergedChatBoostSource struct to simplify working with types in a non-generic world.

type ChatBoostSourcePremium added in v2.1.0

type ChatBoostSourcePremium struct {
	// User that boosted the chat
	User User `json:"user"`
}

ChatBoostSourcePremium (https://core.telegram.org/bots/api#chatboostsourcepremium)

The boost was obtained by subscribing to Telegram Premium or by gifting a Telegram Premium subscription to another user.

func (ChatBoostSourcePremium) GetSource added in v2.1.0

func (v ChatBoostSourcePremium) GetSource() string

GetSource is a helper method to easily access the common fields of an interface.

func (ChatBoostSourcePremium) MarshalJSON added in v2.1.0

func (v ChatBoostSourcePremium) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Source value.

func (ChatBoostSourcePremium) MergeChatBoostSource added in v2.1.0

func (v ChatBoostSourcePremium) MergeChatBoostSource() MergedChatBoostSource

MergeChatBoostSource returns a MergedChatBoostSource struct to simplify working with types in a non-generic world.

type ChatBoostUpdated added in v2.1.0

type ChatBoostUpdated struct {
	// Chat which was boosted
	Chat Chat `json:"chat"`
	// Information about the chat boost
	Boost ChatBoost `json:"boost"`
}

ChatBoostUpdated (https://core.telegram.org/bots/api#chatboostupdated)

This object represents a boost added to a chat or changed.

type ChatFullInfo added in v2.1.0

type ChatFullInfo struct {
	// Unique identifier for this chat. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.
	Id int64 `json:"id"`
	// Type of the chat, can be either "private", "group", "supergroup" or "channel"
	Type string `json:"type"`
	// Optional. Title, for supergroups, channels and group chats
	Title string `json:"title,omitempty"`
	// Optional. Username, for private chats, supergroups and channels if available
	Username string `json:"username,omitempty"`
	// Optional. First name of the other party in a private chat
	FirstName string `json:"first_name,omitempty"`
	// Optional. Last name of the other party in a private chat
	LastName string `json:"last_name,omitempty"`
	// Optional. True, if the supergroup chat is a forum (has topics enabled)
	IsForum bool `json:"is_forum,omitempty"`
	// Identifier of the accent color for the chat name and backgrounds of the chat photo, reply header, and link preview. See accent colors for more details.
	AccentColorId int64 `json:"accent_color_id"`
	// The maximum number of reactions that can be set on a message in the chat
	MaxReactionCount int64 `json:"max_reaction_count"`
	// Optional. Chat photo
	Photo *ChatPhoto `json:"photo,omitempty"`
	// Optional. If non-empty, the list of all active chat usernames; for private chats, supergroups and channels
	ActiveUsernames []string `json:"active_usernames,omitempty"`
	// Optional. For private chats, the date of birth of the user
	Birthdate *Birthdate `json:"birthdate,omitempty"`
	// Optional. For private chats with business accounts, the intro of the business
	BusinessIntro *BusinessIntro `json:"business_intro,omitempty"`
	// Optional. For private chats with business accounts, the location of the business
	BusinessLocation *BusinessLocation `json:"business_location,omitempty"`
	// Optional. For private chats with business accounts, the opening hours of the business
	BusinessOpeningHours *BusinessOpeningHours `json:"business_opening_hours,omitempty"`
	// Optional. For private chats, the personal channel of the user
	PersonalChat *Chat `json:"personal_chat,omitempty"`
	// Optional. List of available reactions allowed in the chat. If omitted, then all emoji reactions are allowed.
	AvailableReactions []ReactionType `json:"available_reactions,omitempty"`
	// Optional. Custom emoji identifier of the emoji chosen by the chat for the reply header and link preview background
	BackgroundCustomEmojiId string `json:"background_custom_emoji_id,omitempty"`
	// Optional. Identifier of the accent color for the chat's profile background. See profile accent colors for more details.
	ProfileAccentColorId int64 `json:"profile_accent_color_id,omitempty"`
	// Optional. Custom emoji identifier of the emoji chosen by the chat for its profile background
	ProfileBackgroundCustomEmojiId string `json:"profile_background_custom_emoji_id,omitempty"`
	// Optional. Custom emoji identifier of the emoji status of the chat or the other party in a private chat
	EmojiStatusCustomEmojiId string `json:"emoji_status_custom_emoji_id,omitempty"`
	// Optional. Expiration date of the emoji status of the chat or the other party in a private chat, in Unix time, if any
	EmojiStatusExpirationDate int64 `json:"emoji_status_expiration_date,omitempty"`
	// Optional. Bio of the other party in a private chat
	Bio string `json:"bio,omitempty"`
	// Optional. True, if privacy settings of the other party in the private chat allows to use tg://user?id=<user_id> links only in chats with the user
	HasPrivateForwards bool `json:"has_private_forwards,omitempty"`
	// Optional. True, if the privacy settings of the other party restrict sending voice and video note messages in the private chat
	HasRestrictedVoiceAndVideoMessages bool `json:"has_restricted_voice_and_video_messages,omitempty"`
	// Optional. True, if users need to join the supergroup before they can send messages
	JoinToSendMessages bool `json:"join_to_send_messages,omitempty"`
	// Optional. True, if all users directly joining the supergroup without using an invite link need to be approved by supergroup administrators
	JoinByRequest bool `json:"join_by_request,omitempty"`
	// Optional. Description, for groups, supergroups and channel chats
	Description string `json:"description,omitempty"`
	// Optional. Primary invite link, for groups, supergroups and channel chats
	InviteLink string `json:"invite_link,omitempty"`
	// Optional. The most recent pinned message (by sending date)
	PinnedMessage *Message `json:"pinned_message,omitempty"`
	// Optional. Default chat member permissions, for groups and supergroups
	Permissions *ChatPermissions `json:"permissions,omitempty"`
	// Optional. True, if paid media messages can be sent or forwarded to the channel chat. The field is available only for channel chats.
	CanSendPaidMedia bool `json:"can_send_paid_media,omitempty"`
	// Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds
	SlowModeDelay int64 `json:"slow_mode_delay,omitempty"`
	// Optional. For supergroups, the minimum number of boosts that a non-administrator user needs to add in order to ignore slow mode and chat permissions
	UnrestrictBoostCount int64 `json:"unrestrict_boost_count,omitempty"`
	// Optional. The time after which all messages sent to the chat will be automatically deleted; in seconds
	MessageAutoDeleteTime int64 `json:"message_auto_delete_time,omitempty"`
	// Optional. True, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators.
	HasAggressiveAntiSpamEnabled bool `json:"has_aggressive_anti_spam_enabled,omitempty"`
	// Optional. True, if non-administrators can only get the list of bots and administrators in the chat
	HasHiddenMembers bool `json:"has_hidden_members,omitempty"`
	// Optional. True, if messages from the chat can't be forwarded to other chats
	HasProtectedContent bool `json:"has_protected_content,omitempty"`
	// Optional. True, if new chat members will have access to old messages; available only to chat administrators
	HasVisibleHistory bool `json:"has_visible_history,omitempty"`
	// Optional. For supergroups, name of the group sticker set
	StickerSetName string `json:"sticker_set_name,omitempty"`
	// Optional. True, if the bot can change the group sticker set
	CanSetStickerSet bool `json:"can_set_sticker_set,omitempty"`
	// Optional. For supergroups, the name of the group's custom emoji sticker set. Custom emoji from this set can be used by all users and bots in the group.
	CustomEmojiStickerSetName string `json:"custom_emoji_sticker_set_name,omitempty"`
	// Optional. Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. This identifier may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier.
	LinkedChatId int64 `json:"linked_chat_id,omitempty"`
	// Optional. For supergroups, the location to which the supergroup is connected
	Location *ChatLocation `json:"location,omitempty"`
}

ChatFullInfo (https://core.telegram.org/bots/api#chatfullinfo)

This object contains full information about a chat.

func (ChatFullInfo) ToChat added in v2.1.0

func (c ChatFullInfo) ToChat() Chat

ToChat is a helper function to turn a ChatFullInfo struct into a Chat.

func (*ChatFullInfo) UnmarshalJSON added in v2.1.0

func (v *ChatFullInfo) UnmarshalJSON(b []byte) error

UnmarshalJSON is a custom JSON unmarshaller to use the helpers which allow for unmarshalling structs into interfaces.

type ChatInviteLink struct {
	// The invite link. If the link was created by another chat administrator, then the second part of the link will be replaced with "...".
	InviteLink string `json:"invite_link"`
	// Creator of the link
	Creator User `json:"creator"`
	// True, if users joining the chat via the link need to be approved by chat administrators
	CreatesJoinRequest bool `json:"creates_join_request"`
	// True, if the link is primary
	IsPrimary bool `json:"is_primary"`
	// True, if the link is revoked
	IsRevoked bool `json:"is_revoked"`
	// Optional. Invite link name
	Name string `json:"name,omitempty"`
	// Optional. Point in time (Unix timestamp) when the link will expire or has been expired
	ExpireDate int64 `json:"expire_date,omitempty"`
	// Optional. The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999
	MemberLimit int64 `json:"member_limit,omitempty"`
	// Optional. Number of pending join requests created using this link
	PendingJoinRequestCount int64 `json:"pending_join_request_count,omitempty"`
	// Optional. The number of seconds the subscription will be active for before the next payment
	SubscriptionPeriod int64 `json:"subscription_period,omitempty"`
	// Optional. The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat using the link
	SubscriptionPrice int64 `json:"subscription_price,omitempty"`
}

ChatInviteLink (https://core.telegram.org/bots/api#chatinvitelink)

Represents an invite link for a chat.

type ChatJoinRequest

type ChatJoinRequest struct {
	// Chat to which the request was sent
	Chat Chat `json:"chat"`
	// User that sent the join request
	From User `json:"from"`
	// Identifier of a private chat with the user who sent the join request. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot can use this identifier for 5 minutes to send messages until the join request is processed, assuming no other administrator contacted the user.
	UserChatId int64 `json:"user_chat_id"`
	// Date the request was sent in Unix time
	Date int64 `json:"date"`
	// Optional. Bio of the user.
	Bio string `json:"bio,omitempty"`
	// Optional. Chat invite link that was used by the user to send the join request
	InviteLink *ChatInviteLink `json:"invite_link,omitempty"`
}

ChatJoinRequest (https://core.telegram.org/bots/api#chatjoinrequest)

Represents a join request sent to a chat.

type ChatLocation

type ChatLocation struct {
	// The location to which the supergroup is connected. Can't be a live location.
	Location Location `json:"location"`
	// Location address; 1-64 characters, as defined by the chat owner
	Address string `json:"address"`
}

ChatLocation (https://core.telegram.org/bots/api#chatlocation)

Represents a location to which a chat is connected.

type ChatMember

type ChatMember interface {
	GetStatus() string
	GetUser() User
	// MergeChatMember returns a MergedChatMember struct to simplify working with complex telegram types in a non-generic world.
	MergeChatMember() MergedChatMember
	// contains filtered or unexported methods
}

ChatMember (https://core.telegram.org/bots/api#chatmember)

This object contains information about one member of a chat. Currently, the following 6 types of chat members are supported:

  • ChatMemberOwner
  • ChatMemberAdministrator
  • ChatMemberMember
  • ChatMemberRestricted
  • ChatMemberLeft
  • ChatMemberBanned

type ChatMemberAdministrator

type ChatMemberAdministrator struct {
	// 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, get boost list, see hidden supergroup and channel members, report spam messages 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 video chats
	CanManageVideoChats bool `json:"can_manage_video_chats"`
	// True, if the administrator can restrict, ban or unban chat members, or access supergroup statistics
	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 they have 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 stories to the chat
	CanPostStories bool `json:"can_post_stories"`
	// True, if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access the chat's story archive
	CanEditStories bool `json:"can_edit_stories"`
	// True, if the administrator can delete stories posted by other users
	CanDeleteStories bool `json:"can_delete_stories"`
	// Optional. True, if the administrator can post messages in the channel, or access channel statistics; for channels only
	CanPostMessages bool `json:"can_post_messages,omitempty"`
	// Optional. True, if the administrator can edit messages of other users and can pin messages; for channels only
	CanEditMessages bool `json:"can_edit_messages,omitempty"`
	// Optional. True, if the user is allowed to pin messages; for groups and supergroups only
	CanPinMessages bool `json:"can_pin_messages,omitempty"`
	// Optional. True, if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only
	CanManageTopics bool `json:"can_manage_topics,omitempty"`
	// Optional. Custom title for this user
	CustomTitle string `json:"custom_title,omitempty"`
}

ChatMemberAdministrator (https://core.telegram.org/bots/api#chatmemberadministrator)

Represents a chat member that has some additional privileges.

func (ChatMemberAdministrator) GetStatus

func (v ChatMemberAdministrator) GetStatus() string

GetStatus is a helper method to easily access the common fields of an interface.

func (ChatMemberAdministrator) GetUser

func (v ChatMemberAdministrator) GetUser() User

GetUser is a helper method to easily access the common fields of an interface.

func (ChatMemberAdministrator) MarshalJSON

func (v ChatMemberAdministrator) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Status value.

func (ChatMemberAdministrator) MergeChatMember

func (v ChatMemberAdministrator) MergeChatMember() MergedChatMember

MergeChatMember returns a MergedChatMember struct to simplify working with types in a non-generic world.

type ChatMemberBanned

type ChatMemberBanned struct {
	// 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 (https://core.telegram.org/bots/api#chatmemberbanned)

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

func (ChatMemberBanned) GetStatus

func (v ChatMemberBanned) GetStatus() string

GetStatus is a helper method to easily access the common fields of an interface.

func (ChatMemberBanned) GetUser

func (v ChatMemberBanned) GetUser() User

GetUser is a helper method to easily access the common fields of an interface.

func (ChatMemberBanned) MarshalJSON

func (v ChatMemberBanned) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Status value.

func (ChatMemberBanned) MergeChatMember

func (v ChatMemberBanned) MergeChatMember() MergedChatMember

MergeChatMember returns a MergedChatMember struct to simplify working with types in a non-generic world.

type ChatMemberLeft

type ChatMemberLeft struct {
	// Information about the user
	User User `json:"user"`
}

ChatMemberLeft (https://core.telegram.org/bots/api#chatmemberleft)

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

func (ChatMemberLeft) GetStatus

func (v ChatMemberLeft) GetStatus() string

GetStatus is a helper method to easily access the common fields of an interface.

func (ChatMemberLeft) GetUser

func (v ChatMemberLeft) GetUser() User

GetUser is a helper method to easily access the common fields of an interface.

func (ChatMemberLeft) MarshalJSON

func (v ChatMemberLeft) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Status value.

func (ChatMemberLeft) MergeChatMember

func (v ChatMemberLeft) MergeChatMember() MergedChatMember

MergeChatMember returns a MergedChatMember struct to simplify working with types in a non-generic world.

type ChatMemberMember

type ChatMemberMember struct {
	// Information about the user
	User User `json:"user"`
	// Optional. Date when the user's subscription will expire; Unix time
	UntilDate int64 `json:"until_date,omitempty"`
}

ChatMemberMember (https://core.telegram.org/bots/api#chatmembermember)

Represents a chat member that has no additional privileges or restrictions.

func (ChatMemberMember) GetStatus

func (v ChatMemberMember) GetStatus() string

GetStatus is a helper method to easily access the common fields of an interface.

func (ChatMemberMember) GetUser

func (v ChatMemberMember) GetUser() User

GetUser is a helper method to easily access the common fields of an interface.

func (ChatMemberMember) MarshalJSON

func (v ChatMemberMember) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Status value.

func (ChatMemberMember) MergeChatMember

func (v ChatMemberMember) MergeChatMember() MergedChatMember

MergeChatMember returns a MergedChatMember struct to simplify working with types in a non-generic world.

type ChatMemberOwner

type ChatMemberOwner struct {
	// Information about the user
	User User `json:"user"`
	// True, if the user's presence in the chat is hidden
	IsAnonymous bool `json:"is_anonymous"`
	// Optional. Custom title for this user
	CustomTitle string `json:"custom_title,omitempty"`
}

ChatMemberOwner (https://core.telegram.org/bots/api#chatmemberowner)

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

func (ChatMemberOwner) GetStatus

func (v ChatMemberOwner) GetStatus() string

GetStatus is a helper method to easily access the common fields of an interface.

func (ChatMemberOwner) GetUser

func (v ChatMemberOwner) GetUser() User

GetUser is a helper method to easily access the common fields of an interface.

func (ChatMemberOwner) MarshalJSON

func (v ChatMemberOwner) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Status value.

func (ChatMemberOwner) MergeChatMember

func (v ChatMemberOwner) MergeChatMember() MergedChatMember

MergeChatMember returns a MergedChatMember struct to simplify working with types in a non-generic world.

type ChatMemberRestricted

type ChatMemberRestricted struct {
	// 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 send text messages, contacts, giveaways, giveaway winners, invoices, locations and venues
	CanSendMessages bool `json:"can_send_messages"`
	// True, if the user is allowed to send audios
	CanSendAudios bool `json:"can_send_audios"`
	// True, if the user is allowed to send documents
	CanSendDocuments bool `json:"can_send_documents"`
	// True, if the user is allowed to send photos
	CanSendPhotos bool `json:"can_send_photos"`
	// True, if the user is allowed to send videos
	CanSendVideos bool `json:"can_send_videos"`
	// True, if the user is allowed to send video notes
	CanSendVideoNotes bool `json:"can_send_video_notes"`
	// True, if the user is allowed to send voice notes
	CanSendVoiceNotes bool `json:"can_send_voice_notes"`
	// 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"`
	// 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 create forum topics
	CanManageTopics bool `json:"can_manage_topics"`
	// 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 (https://core.telegram.org/bots/api#chatmemberrestricted)

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

func (ChatMemberRestricted) GetStatus

func (v ChatMemberRestricted) GetStatus() string

GetStatus is a helper method to easily access the common fields of an interface.

func (ChatMemberRestricted) GetUser

func (v ChatMemberRestricted) GetUser() User

GetUser is a helper method to easily access the common fields of an interface.

func (ChatMemberRestricted) MarshalJSON

func (v ChatMemberRestricted) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Status value.

func (ChatMemberRestricted) MergeChatMember

func (v ChatMemberRestricted) MergeChatMember() MergedChatMember

MergeChatMember returns a MergedChatMember struct to simplify working with types in a non-generic world.

type ChatMemberUpdated

type ChatMemberUpdated struct {
	// Chat the user belongs to
	Chat Chat `json:"chat"`
	// Performer of the action, which resulted in the change
	From User `json:"from"`
	// Date the change was done in Unix time
	Date int64 `json:"date"`
	// Previous information about the chat member
	OldChatMember ChatMember `json:"old_chat_member"`
	// New information about the chat member
	NewChatMember ChatMember `json:"new_chat_member"`
	// Optional. Chat invite link, which was used by the user to join the chat; for joining by invite link events only.
	InviteLink *ChatInviteLink `json:"invite_link,omitempty"`
	// Optional. True, if the user joined the chat after sending a direct join request without using an invite link and being approved by an administrator
	ViaJoinRequest bool `json:"via_join_request,omitempty"`
	// Optional. True, if the user joined the chat via a chat folder invite link
	ViaChatFolderInviteLink bool `json:"via_chat_folder_invite_link,omitempty"`
}

ChatMemberUpdated (https://core.telegram.org/bots/api#chatmemberupdated)

This object represents changes in the status of a chat member.

func (ChatMemberUpdated) IsJoinRequest added in v2.1.0

func (cm ChatMemberUpdated) IsJoinRequest() bool

IsJoinRequest returns true if ChatMemberUpdated originated from a join request; either from a direct join, or from an invitelink.

func (*ChatMemberUpdated) UnmarshalJSON

func (v *ChatMemberUpdated) UnmarshalJSON(b []byte) error

UnmarshalJSON is a custom JSON unmarshaller to use the helpers which allow for unmarshalling structs into interfaces.

type ChatPermissions

type ChatPermissions struct {
	// Optional. True, if the user is allowed to send text messages, contacts, giveaways, giveaway winners, invoices, locations and venues
	CanSendMessages bool `json:"can_send_messages,omitempty"`
	// Optional. True, if the user is allowed to send audios
	CanSendAudios bool `json:"can_send_audios,omitempty"`
	// Optional. True, if the user is allowed to send documents
	CanSendDocuments bool `json:"can_send_documents,omitempty"`
	// Optional. True, if the user is allowed to send photos
	CanSendPhotos bool `json:"can_send_photos,omitempty"`
	// Optional. True, if the user is allowed to send videos
	CanSendVideos bool `json:"can_send_videos,omitempty"`
	// Optional. True, if the user is allowed to send video notes
	CanSendVideoNotes bool `json:"can_send_video_notes,omitempty"`
	// Optional. True, if the user is allowed to send voice notes
	CanSendVoiceNotes bool `json:"can_send_voice_notes,omitempty"`
	// Optional. True, if the user is allowed to send polls
	CanSendPolls bool `json:"can_send_polls,omitempty"`
	// Optional. True, if the user is allowed to send animations, games, stickers and use inline bots
	CanSendOtherMessages bool `json:"can_send_other_messages,omitempty"`
	// Optional. True, if the user is allowed to add web page previews to their messages
	CanAddWebPagePreviews bool `json:"can_add_web_page_previews,omitempty"`
	// Optional. True, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups
	CanChangeInfo bool `json:"can_change_info,omitempty"`
	// Optional. True, if the user is allowed to invite new users to the chat
	CanInviteUsers bool `json:"can_invite_users,omitempty"`
	// Optional. True, if the user is allowed to pin messages. Ignored in public supergroups
	CanPinMessages bool `json:"can_pin_messages,omitempty"`
	// Optional. True, if the user is allowed to create forum topics. If omitted defaults to the value of can_pin_messages
	CanManageTopics bool `json:"can_manage_topics,omitempty"`
}

ChatPermissions (https://core.telegram.org/bots/api#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 (https://core.telegram.org/bots/api#chatphoto)

This object represents a chat photo.

type ChatShared

type ChatShared struct {
	// Identifier of the request
	RequestId int64 `json:"request_id"`
	// Identifier of the shared chat. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot may not have access to the chat and could be unable to use this identifier, unless the chat is already known to the bot by some other means.
	ChatId int64 `json:"chat_id"`
	// Optional. Title of the chat, if the title was requested by the bot.
	Title string `json:"title,omitempty"`
	// Optional. Username of the chat, if the username was requested by the bot and available.
	Username string `json:"username,omitempty"`
	// Optional. Available sizes of the chat photo, if the photo was requested by the bot
	Photo []PhotoSize `json:"photo,omitempty"`
}

ChatShared (https://core.telegram.org/bots/api#chatshared)

This object contains information about a chat that was shared with the bot using a KeyboardButtonRequestChat button.

type ChosenInlineResult

type ChosenInlineResult struct {
	// The unique identifier for the result that was chosen
	ResultId string `json:"result_id"`
	// The user that chose the result
	From User `json:"from"`
	// Optional. Sender location, only for bots that require user location
	Location *Location `json:"location,omitempty"`
	// Optional. Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message. Will be also received in callback queries and can be used to edit the message.
	InlineMessageId string `json:"inline_message_id,omitempty"`
	// The query that was used to obtain the result
	Query string `json:"query"`
}

ChosenInlineResult (https://core.telegram.org/bots/api#choseninlineresult)

Represents a result of an inline query that was chosen by the user and sent to their chat partner. Note: It is necessary to enable inline feedback via @BotFather in order to receive these objects in updates.

type CloseForumTopicOpts

type CloseForumTopicOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

CloseForumTopicOpts is the set of optional fields for Bot.CloseForumTopic.

type CloseGeneralForumTopicOpts

type CloseGeneralForumTopicOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

CloseGeneralForumTopicOpts is the set of optional fields for Bot.CloseGeneralForumTopic.

type CloseOpts

type CloseOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

CloseOpts is the set of optional fields for Bot.Close.

type Contact

type Contact struct {
	// Contact's phone number
	PhoneNumber string `json:"phone_number"`
	// Contact's first name
	FirstName string `json:"first_name"`
	// Optional. Contact's last name
	LastName string `json:"last_name,omitempty"`
	// Optional. Contact's user identifier in Telegram. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier.
	UserId int64 `json:"user_id,omitempty"`
	// Optional. Additional data about the contact in the form of a vCard
	Vcard string `json:"vcard,omitempty"`
}

Contact (https://core.telegram.org/bots/api#contact)

This object represents a phone contact.

type CopyMessageOpts

type CopyMessageOpts struct {
	// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
	MessageThreadId int64
	// New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept
	Caption *string
	// Mode for parsing entities in the new caption. See formatting options for more details.
	ParseMode string
	// A JSON-serialized list of special entities that appear in the new caption, which can be specified instead of parse_mode
	CaptionEntities []MessageEntity
	// Pass True, if the caption must be shown above the message media. Ignored if a new caption isn't specified.
	ShowCaptionAboveMedia bool
	// Sends the message silently. Users will receive a notification with no sound.
	DisableNotification bool
	// Protects the contents of the sent message from forwarding and saving
	ProtectContent bool
	// Description of the message to reply to
	ReplyParameters *ReplyParameters
	// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
	ReplyMarkup ReplyMarkup
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

CopyMessageOpts is the set of optional fields for Bot.CopyMessage.

type CopyMessagesOpts added in v2.1.0

type CopyMessagesOpts struct {
	// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
	MessageThreadId int64
	// Sends the messages silently. Users will receive a notification with no sound.
	DisableNotification bool
	// Protects the contents of the sent messages from forwarding and saving
	ProtectContent bool
	// Pass True to copy the messages without their captions
	RemoveCaption bool
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

CopyMessagesOpts is the set of optional fields for Bot.CopyMessages.

type CreateChatInviteLinkOpts

type CreateChatInviteLinkOpts struct {
	// Invite link name; 0-32 characters
	Name string
	// Point in time (Unix timestamp) when the link will expire
	ExpireDate int64
	// The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999
	MemberLimit int64
	// True, if users joining the chat via the link need to be approved by chat administrators. If True, member_limit can't be specified
	CreatesJoinRequest bool
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

CreateChatInviteLinkOpts is the set of optional fields for Bot.CreateChatInviteLink.

type CreateChatSubscriptionInviteLinkOpts added in v2.1.0

type CreateChatSubscriptionInviteLinkOpts struct {
	// Invite link name; 0-32 characters
	Name string
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

CreateChatSubscriptionInviteLinkOpts is the set of optional fields for Bot.CreateChatSubscriptionInviteLink.

type CreateForumTopicOpts

type CreateForumTopicOpts struct {
	// Color of the topic icon in RGB format. Currently, must be one of 7322096 (0x6FB9F0), 16766590 (0xFFD67E), 13338331 (0xCB86DB), 9367192 (0x8EEE98), 16749490 (0xFF93B2), or 16478047 (0xFB6F5F)
	IconColor int64
	// Unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all allowed custom emoji identifiers.
	IconCustomEmojiId string
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

CreateForumTopicOpts is the set of optional fields for Bot.CreateForumTopic.

type CreateInvoiceLinkOpts

type CreateInvoiceLinkOpts struct {
	// Payment provider token, obtained via @BotFather. Pass an empty string for payments in Telegram Stars.
	ProviderToken string
	// 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. Not supported for payments in Telegram Stars.
	MaxTipAmount int64
	// 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 []int64
	// JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider.
	ProviderData string
	// URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service.
	PhotoUrl string
	// Photo size in bytes
	PhotoSize int64
	// Photo width
	PhotoWidth int64
	// Photo height
	PhotoHeight int64
	// Pass True if you require the user's full name to complete the order. Ignored for payments in Telegram Stars.
	NeedName bool
	// Pass True if you require the user's phone number to complete the order. Ignored for payments in Telegram Stars.
	NeedPhoneNumber bool
	// Pass True if you require the user's email address to complete the order. Ignored for payments in Telegram Stars.
	NeedEmail bool
	// Pass True if you require the user's shipping address to complete the order. Ignored for payments in Telegram Stars.
	NeedShippingAddress bool
	// Pass True if the user's phone number should be sent to the provider. Ignored for payments in Telegram Stars.
	SendPhoneNumberToProvider bool
	// Pass True if the user's email address should be sent to the provider. Ignored for payments in Telegram Stars.
	SendEmailToProvider bool
	// Pass True if the final price depends on the shipping method. Ignored for payments in Telegram Stars.
	IsFlexible bool
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

CreateInvoiceLinkOpts is the set of optional fields for Bot.CreateInvoiceLink.

type CreateNewStickerSetOpts

type CreateNewStickerSetOpts struct {
	// Type of stickers in the set, pass "regular", "mask", or "custom_emoji". By default, a regular sticker set is created.
	StickerType string
	// Pass True if stickers in the sticker set must be repainted to the color of text when used in messages, the accent color if used as emoji status, white on chat photos, or another appropriate color based on context; for custom emoji sticker sets only
	NeedsRepainting bool
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

CreateNewStickerSetOpts is the set of optional fields for Bot.CreateNewStickerSet.

type DeclineChatJoinRequestOpts

type DeclineChatJoinRequestOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

DeclineChatJoinRequestOpts is the set of optional fields for Bot.DeclineChatJoinRequest.

type DeleteChatPhotoOpts

type DeleteChatPhotoOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

DeleteChatPhotoOpts is the set of optional fields for Bot.DeleteChatPhoto.

type DeleteChatStickerSetOpts

type DeleteChatStickerSetOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

DeleteChatStickerSetOpts is the set of optional fields for Bot.DeleteChatStickerSet.

type DeleteForumTopicOpts

type DeleteForumTopicOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

DeleteForumTopicOpts is the set of optional fields for Bot.DeleteForumTopic.

type DeleteMessageOpts

type DeleteMessageOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

DeleteMessageOpts is the set of optional fields for Bot.DeleteMessage.

type DeleteMessagesOpts added in v2.1.0

type DeleteMessagesOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

DeleteMessagesOpts is the set of optional fields for Bot.DeleteMessages.

type DeleteMyCommandsOpts

type DeleteMyCommandsOpts struct {
	// A JSON-serialized object, describing scope of users for which the commands are relevant. Defaults to BotCommandScopeDefault.
	Scope BotCommandScope
	// 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
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

DeleteMyCommandsOpts is the set of optional fields for Bot.DeleteMyCommands.

type DeleteStickerFromSetOpts

type DeleteStickerFromSetOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

DeleteStickerFromSetOpts is the set of optional fields for Bot.DeleteStickerFromSet.

type DeleteStickerSetOpts

type DeleteStickerSetOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

DeleteStickerSetOpts is the set of optional fields for Bot.DeleteStickerSet.

type DeleteWebhookOpts

type DeleteWebhookOpts struct {
	// Pass True to drop all pending updates
	DropPendingUpdates bool
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

DeleteWebhookOpts is the set of optional fields for Bot.DeleteWebhook.

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 int64 `json:"value"`
}

Dice (https://core.telegram.org/bots/api#dice)

This object represents an animated emoji that displays a random value.

type Document

type Document struct {
	// Identifier for this file, which can be used to download or reuse the file
	FileId 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"`
	// Optional. Document thumbnail as defined by the sender
	Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
	// Optional. Original filename as defined by the sender
	FileName string `json:"file_name,omitempty"`
	// Optional. MIME type of the file as defined by the sender
	MimeType string `json:"mime_type,omitempty"`
	// Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.
	FileSize int64 `json:"file_size,omitempty"`
}

Document (https://core.telegram.org/bots/api#document)

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

type EditChatInviteLinkOpts

type EditChatInviteLinkOpts struct {
	// Invite link name; 0-32 characters
	Name string
	// Point in time (Unix timestamp) when the link will expire
	ExpireDate int64
	// The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999
	MemberLimit int64
	// True, if users joining the chat via the link need to be approved by chat administrators. If True, member_limit can't be specified
	CreatesJoinRequest bool
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

EditChatInviteLinkOpts is the set of optional fields for Bot.EditChatInviteLink.

type EditChatSubscriptionInviteLinkOpts added in v2.1.0

type EditChatSubscriptionInviteLinkOpts struct {
	// Invite link name; 0-32 characters
	Name string
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

EditChatSubscriptionInviteLinkOpts is the set of optional fields for Bot.EditChatSubscriptionInviteLink.

type EditForumTopicOpts

type EditForumTopicOpts struct {
	// New topic name, 0-128 characters. If not specified or empty, the current name of the topic will be kept
	Name string
	// New unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all allowed custom emoji identifiers. Pass an empty string to remove the icon. If not specified, the current icon will be kept
	IconCustomEmojiId *string
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

EditForumTopicOpts is the set of optional fields for Bot.EditForumTopic.

type EditGeneralForumTopicOpts

type EditGeneralForumTopicOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

EditGeneralForumTopicOpts is the set of optional fields for Bot.EditGeneralForumTopic.

type EditMessageCaptionOpts

type EditMessageCaptionOpts struct {
	// Unique identifier of the business connection on behalf of which the message to be edited was sent
	BusinessConnectionId string
	// Required if inline_message_id is not specified. Unique identifier for the target chat
	ChatId int64
	// Required if inline_message_id is not specified. Identifier of the message to edit
	MessageId int64
	// Required if chat_id and message_id are not specified. Identifier of the inline message
	InlineMessageId string
	// New caption of the message, 0-1024 characters after entities parsing
	Caption string
	// Mode for parsing entities in the message caption. See formatting options for more details.
	ParseMode string
	// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []MessageEntity
	// Pass True, if the caption must be shown above the message media. Supported only for animation, photo and video messages.
	ShowCaptionAboveMedia bool
	// A JSON-serialized object for an inline keyboard.
	ReplyMarkup InlineKeyboardMarkup
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

EditMessageCaptionOpts is the set of optional fields for Bot.EditMessageCaption.

type EditMessageLiveLocationOpts

type EditMessageLiveLocationOpts struct {
	// Unique identifier of the business connection on behalf of which the message to be edited was sent
	BusinessConnectionId string
	// Required if inline_message_id is not specified. Unique identifier for the target chat
	ChatId int64
	// Required if inline_message_id is not specified. Identifier of the message to edit
	MessageId int64
	// Required if chat_id and message_id are not specified. Identifier of the inline message
	InlineMessageId string
	// New period in seconds during which the location can be updated, starting from the message send date. If 0x7FFFFFFF is specified, then the location can be updated forever. Otherwise, the new value must not exceed the current live_period by more than a day, and the live location expiration date must remain within the next 90 days. If not specified, then live_period remains unchanged
	LivePeriod *int64
	// The radius of uncertainty for the location, measured in meters; 0-1500
	HorizontalAccuracy float64
	// Direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.
	Heading int64
	// The maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.
	ProximityAlertRadius int64
	// A JSON-serialized object for a new inline keyboard.
	ReplyMarkup InlineKeyboardMarkup
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

EditMessageLiveLocationOpts is the set of optional fields for Bot.EditMessageLiveLocation.

type EditMessageMediaOpts

type EditMessageMediaOpts struct {
	// Unique identifier of the business connection on behalf of which the message to be edited was sent
	BusinessConnectionId string
	// Required if inline_message_id is not specified. Unique identifier for the target chat
	ChatId int64
	// Required if inline_message_id is not specified. Identifier of the message to edit
	MessageId int64
	// Required if chat_id and message_id are not specified. Identifier of the inline message
	InlineMessageId string
	// A JSON-serialized object for a new inline keyboard.
	ReplyMarkup InlineKeyboardMarkup
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

EditMessageMediaOpts is the set of optional fields for Bot.EditMessageMedia.

type EditMessageReplyMarkupOpts

type EditMessageReplyMarkupOpts struct {
	// Unique identifier of the business connection on behalf of which the message to be edited was sent
	BusinessConnectionId string
	// Required if inline_message_id is not specified. Unique identifier for the target chat
	ChatId int64
	// Required if inline_message_id is not specified. Identifier of the message to edit
	MessageId int64
	// Required if chat_id and message_id are not specified. Identifier of the inline message
	InlineMessageId string
	// A JSON-serialized object for an inline keyboard.
	ReplyMarkup InlineKeyboardMarkup
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

EditMessageReplyMarkupOpts is the set of optional fields for Bot.EditMessageReplyMarkup.

type EditMessageTextOpts

type EditMessageTextOpts struct {
	// Unique identifier of the business connection on behalf of which the message to be edited was sent
	BusinessConnectionId string
	// Required if inline_message_id is not specified. Unique identifier for the target chat
	ChatId int64
	// Required if inline_message_id is not specified. Identifier of the message to edit
	MessageId int64
	// Required if chat_id and message_id are not specified. Identifier of the inline message
	InlineMessageId string
	// Mode for parsing entities in the message text. See formatting options for more details.
	ParseMode string
	// A JSON-serialized list of special entities that appear in message text, which can be specified instead of parse_mode
	Entities []MessageEntity
	// Link preview generation options for the message
	LinkPreviewOptions *LinkPreviewOptions
	// A JSON-serialized object for an inline keyboard.
	ReplyMarkup InlineKeyboardMarkup
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

EditMessageTextOpts is the set of optional fields for Bot.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 (https://core.telegram.org/bots/api#encryptedcredentials)

Describes 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. One of "personal_details", "passport", "driver_license", "identity_card", "internal_passport", "address", "utility_bill", "bank_statement", "rental_agreement", "passport_registration", "temporary_registration", "phone_number", "email".
	Type string `json:"type"`
	// Optional. Base64-encoded encrypted Telegram Passport element data provided by the user; available only for "personal_details", "passport", "driver_license", "identity_card", "internal_passport" and "address" types. Can be decrypted and verified using the accompanying EncryptedCredentials.
	Data string `json:"data,omitempty"`
	// Optional. User's verified phone number; available only for "phone_number" type
	PhoneNumber string `json:"phone_number,omitempty"`
	// Optional. User's verified email address; available only for "email" type
	Email string `json:"email,omitempty"`
	// Optional. Array of encrypted files with documents provided by the user; available only 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"`
	// Optional. Encrypted file with the front side of the document, provided by the user; available only for "passport", "driver_license", "identity_card" and "internal_passport". The file can be decrypted and verified using the accompanying EncryptedCredentials.
	FrontSide *PassportFile `json:"front_side,omitempty"`
	// Optional. Encrypted file with the reverse side of the document, provided by the user; available only for "driver_license" and "identity_card". The file can be decrypted and verified using the accompanying EncryptedCredentials.
	ReverseSide *PassportFile `json:"reverse_side,omitempty"`
	// Optional. Encrypted file with the selfie of the user holding a document, provided by the user; available if requested 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"`
	// Optional. Array of encrypted files with translated versions of documents provided by the user; available if requested for "passport", "driver_license", "identity_card", "internal_passport", "utility_bill", "bank_statement", "rental_agreement", "passport_registration" and "temporary_registration" types. Files can be decrypted and verified using the accompanying EncryptedCredentials.
	Translation []PassportFile `json:"translation,omitempty"`
	// Base64-encoded element hash for using in PassportElementErrorUnspecified
	Hash string `json:"hash"`
}

EncryptedPassportElement (https://core.telegram.org/bots/api#encryptedpassportelement)

Describes documents or other Telegram Passport elements shared with the bot by the user.

type ExportChatInviteLinkOpts

type ExportChatInviteLinkOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

ExportChatInviteLinkOpts is the set of optional fields for Bot.ExportChatInviteLink.

type ExternalReplyInfo added in v2.1.0

type ExternalReplyInfo struct {
	// Origin of the message replied to by the given message
	Origin MessageOrigin `json:"origin"`
	// Optional. Chat the original message belongs to. Available only if the chat is a supergroup or a channel.
	Chat *Chat `json:"chat,omitempty"`
	// Optional. Unique message identifier inside the original chat. Available only if the original chat is a supergroup or a channel.
	MessageId int64 `json:"message_id,omitempty"`
	// Optional. Options used for link preview generation for the original message, if it is a text message
	LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options,omitempty"`
	// Optional. Message is an animation, information about the animation
	Animation *Animation `json:"animation,omitempty"`
	// Optional. Message is an audio file, information about the file
	Audio *Audio `json:"audio,omitempty"`
	// Optional. Message is a general file, information about the file
	Document *Document `json:"document,omitempty"`
	// Optional. Message contains paid media; information about the paid media
	PaidMedia *PaidMediaInfo `json:"paid_media,omitempty"`
	// Optional. Message is a photo, available sizes of the photo
	Photo []PhotoSize `json:"photo,omitempty"`
	// Optional. Message is a sticker, information about the sticker
	Sticker *Sticker `json:"sticker,omitempty"`
	// Optional. Message is a forwarded story
	Story *Story `json:"story,omitempty"`
	// Optional. Message is a video, information about the video
	Video *Video `json:"video,omitempty"`
	// Optional. Message is a video note, information about the video message
	VideoNote *VideoNote `json:"video_note,omitempty"`
	// Optional. Message is a voice message, information about the file
	Voice *Voice `json:"voice,omitempty"`
	// Optional. True, if the message media is covered by a spoiler animation
	HasMediaSpoiler bool `json:"has_media_spoiler,omitempty"`
	// Optional. Message is a shared contact, information about the contact
	Contact *Contact `json:"contact,omitempty"`
	// Optional. Message is a dice with random value
	Dice *Dice `json:"dice,omitempty"`
	// Optional. Message is a game, information about the game. More about games: https://core.telegram.org/bots/api#games
	Game *Game `json:"game,omitempty"`
	// Optional. Message is a scheduled giveaway, information about the giveaway
	Giveaway *Giveaway `json:"giveaway,omitempty"`
	// Optional. A giveaway with public winners was completed
	GiveawayWinners *GiveawayWinners `json:"giveaway_winners,omitempty"`
	// Optional. Message is an invoice for a payment, information about the invoice. More about payments: https://core.telegram.org/bots/api#payments
	Invoice *Invoice `json:"invoice,omitempty"`
	// Optional. Message is a shared location, information about the location
	Location *Location `json:"location,omitempty"`
	// Optional. Message is a native poll, information about the poll
	Poll *Poll `json:"poll,omitempty"`
	// Optional. Message is a venue, information about the venue
	Venue *Venue `json:"venue,omitempty"`
}

ExternalReplyInfo (https://core.telegram.org/bots/api#externalreplyinfo)

This object contains information about a message that is being replied to, which may come from another chat or forum topic.

func (*ExternalReplyInfo) UnmarshalJSON added in v2.1.0

func (v *ExternalReplyInfo) UnmarshalJSON(b []byte) error

UnmarshalJSON is a custom JSON unmarshaller to use the helpers which allow for unmarshalling structs into interfaces.

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"`
	// Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.
	FileSize int64 `json:"file_size,omitempty"`
	// Optional. File path. Use https://api.telegram.org/file/bot<token>/<file_path> to get the file.
	FilePath string `json:"file_path,omitempty"`
}

File (https://core.telegram.org/bots/api#file)

This object represents a file ready to be downloaded. The file can be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile.

func (File) URL

func (f File) URL(b *Bot, opts *RequestOpts) string

URL gets the URL the file can be downloaded from.

type FileReader added in v2.1.0

type FileReader struct {
	Name string
	Data io.Reader
	// contains filtered or unexported fields
}

func (*FileReader) Attach added in v2.1.0

func (f *FileReader) Attach(key string, data map[string]FileReader) error

func (*FileReader) MarshalJSON added in v2.1.0

func (f *FileReader) MarshalJSON() ([]byte, error)

type ForceReply

type ForceReply struct {
	// Shows reply interface to the user, as if they manually selected the bot's message and tapped 'Reply'
	ForceReply bool `json:"force_reply"`
	// Optional. The placeholder to be shown in the input field when the reply is active; 1-64 characters
	InputFieldPlaceholder string `json:"input_field_placeholder,omitempty"`
	// Optional. Use this parameter if you want to force reply from specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply to a message in the same chat and forum topic, sender of the original message.
	Selective bool `json:"selective,omitempty"`
}

ForceReply (https://core.telegram.org/bots/api#forcereply)

Upon receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the user has selected the bot's message and tapped 'Reply'). This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode. Not supported in channels and for messages sent on behalf of a Telegram Business account.

type ForumTopic

type ForumTopic struct {
	// Unique identifier of the forum topic
	MessageThreadId int64 `json:"message_thread_id"`
	// Name of the topic
	Name string `json:"name"`
	// Color of the topic icon in RGB format
	IconColor int64 `json:"icon_color"`
	// Optional. Unique identifier of the custom emoji shown as the topic icon
	IconCustomEmojiId string `json:"icon_custom_emoji_id,omitempty"`
}

ForumTopic (https://core.telegram.org/bots/api#forumtopic)

This object represents a forum topic.

type ForumTopicClosed

type ForumTopicClosed struct{}

ForumTopicClosed (https://core.telegram.org/bots/api#forumtopicclosed)

This object represents a service message about a forum topic closed in the chat. Currently holds no information.

type ForumTopicCreated

type ForumTopicCreated struct {
	// Name of the topic
	Name string `json:"name"`
	// Color of the topic icon in RGB format
	IconColor int64 `json:"icon_color"`
	// Optional. Unique identifier of the custom emoji shown as the topic icon
	IconCustomEmojiId string `json:"icon_custom_emoji_id,omitempty"`
}

ForumTopicCreated (https://core.telegram.org/bots/api#forumtopiccreated)

This object represents a service message about a new forum topic created in the chat.

type ForumTopicEdited

type ForumTopicEdited struct {
	// Optional. New name of the topic, if it was edited
	Name string `json:"name,omitempty"`
	// Optional. New identifier of the custom emoji shown as the topic icon, if it was edited; an empty string if the icon was removed
	IconCustomEmojiId string `json:"icon_custom_emoji_id,omitempty"`
}

ForumTopicEdited (https://core.telegram.org/bots/api#forumtopicedited)

This object represents a service message about an edited forum topic.

type ForumTopicReopened

type ForumTopicReopened struct{}

ForumTopicReopened (https://core.telegram.org/bots/api#forumtopicreopened)

This object represents a service message about a forum topic reopened in the chat. Currently holds no information.

type ForwardMessageOpts

type ForwardMessageOpts struct {
	// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
	MessageThreadId int64
	// Sends the message silently. Users will receive a notification with no sound.
	DisableNotification bool
	// Protects the contents of the forwarded message from forwarding and saving
	ProtectContent bool
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

ForwardMessageOpts is the set of optional fields for Bot.ForwardMessage.

type ForwardMessagesOpts added in v2.1.0

type ForwardMessagesOpts struct {
	// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
	MessageThreadId int64
	// Sends the messages silently. Users will receive a notification with no sound.
	DisableNotification bool
	// Protects the contents of the forwarded messages from forwarding and saving
	ProtectContent bool
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

ForwardMessagesOpts is the set of optional fields for Bot.ForwardMessages.

type Game

type Game struct {
	// Title of the game
	Title string `json:"title"`
	// Description of the game
	Description string `json:"description"`
	// Photo that will be displayed in the game message in chats.
	Photo []PhotoSize `json:"photo,omitempty"`
	// Optional. Brief description of the game or high scores included in the game message. Can be automatically edited to include current high scores for the game when the bot calls setGameScore, or manually edited using editMessageText. 0-4096 characters.
	Text string `json:"text,omitempty"`
	// Optional. Special entities that appear in text, such as usernames, URLs, bot commands, etc.
	TextEntities []MessageEntity `json:"text_entities,omitempty"`
	// Optional. Animation that will be displayed in the game message in chats. Upload via BotFather
	Animation *Animation `json:"animation,omitempty"`
}

Game (https://core.telegram.org/bots/api#game)

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

type GameHighScore

type GameHighScore struct {
	// Position in high score table for the game
	Position int64 `json:"position"`
	// User
	User User `json:"user"`
	// Score
	Score int64 `json:"score"`
}

GameHighScore (https://core.telegram.org/bots/api#gamehighscore)

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

type GeneralForumTopicHidden

type GeneralForumTopicHidden struct{}

GeneralForumTopicHidden (https://core.telegram.org/bots/api#generalforumtopichidden)

This object represents a service message about General forum topic hidden in the chat. Currently holds no information.

type GeneralForumTopicUnhidden

type GeneralForumTopicUnhidden struct{}

GeneralForumTopicUnhidden (https://core.telegram.org/bots/api#generalforumtopicunhidden)

This object represents a service message about General forum topic unhidden in the chat. Currently holds no information.

type GetBusinessConnectionOpts added in v2.1.0

type GetBusinessConnectionOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

GetBusinessConnectionOpts is the set of optional fields for Bot.GetBusinessConnection.

type GetChatAdministratorsOpts

type GetChatAdministratorsOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

GetChatAdministratorsOpts is the set of optional fields for Bot.GetChatAdministrators.

type GetChatMemberCountOpts

type GetChatMemberCountOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

GetChatMemberCountOpts is the set of optional fields for Bot.GetChatMemberCount.

type GetChatMemberOpts

type GetChatMemberOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

GetChatMemberOpts is the set of optional fields for Bot.GetChatMember.

type GetChatMenuButtonOpts

type GetChatMenuButtonOpts struct {
	// Unique identifier for the target private chat. If not specified, default bot's menu button will be returned
	ChatId *int64
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

GetChatMenuButtonOpts is the set of optional fields for Bot.GetChatMenuButton.

type GetChatOpts

type GetChatOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

GetChatOpts is the set of optional fields for Bot.GetChat.

type GetCustomEmojiStickersOpts

type GetCustomEmojiStickersOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

GetCustomEmojiStickersOpts is the set of optional fields for Bot.GetCustomEmojiStickers.

type GetFileOpts

type GetFileOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

GetFileOpts is the set of optional fields for Bot.GetFile.

type GetForumTopicIconStickersOpts

type GetForumTopicIconStickersOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

GetForumTopicIconStickersOpts is the set of optional fields for Bot.GetForumTopicIconStickers.

type GetGameHighScoresOpts

type GetGameHighScoresOpts struct {
	// Required if inline_message_id is not specified. Unique identifier for the target chat
	ChatId int64
	// Required if inline_message_id is not specified. Identifier of the sent message
	MessageId int64
	// Required if chat_id and message_id are not specified. Identifier of the inline message
	InlineMessageId string
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

GetGameHighScoresOpts is the set of optional fields for Bot.GetGameHighScores.

type GetMeOpts

type GetMeOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

GetMeOpts is the set of optional fields for Bot.GetMe.

type GetMyCommandsOpts

type GetMyCommandsOpts struct {
	// A JSON-serialized object, describing scope of users. Defaults to BotCommandScopeDefault.
	Scope BotCommandScope
	// A two-letter ISO 639-1 language code or an empty string
	LanguageCode string
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

GetMyCommandsOpts is the set of optional fields for Bot.GetMyCommands.

type GetMyDefaultAdministratorRightsOpts

type GetMyDefaultAdministratorRightsOpts struct {
	// Pass True to get default administrator rights of the bot in channels. Otherwise, default administrator rights of the bot for groups and supergroups will be returned.
	ForChannels bool
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

GetMyDefaultAdministratorRightsOpts is the set of optional fields for Bot.GetMyDefaultAdministratorRights.

type GetMyDescriptionOpts

type GetMyDescriptionOpts struct {
	// A two-letter ISO 639-1 language code or an empty string
	LanguageCode string
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

GetMyDescriptionOpts is the set of optional fields for Bot.GetMyDescription.

type GetMyNameOpts

type GetMyNameOpts struct {
	// A two-letter ISO 639-1 language code or an empty string
	LanguageCode string
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

GetMyNameOpts is the set of optional fields for Bot.GetMyName.

type GetMyShortDescriptionOpts

type GetMyShortDescriptionOpts struct {
	// A two-letter ISO 639-1 language code or an empty string
	LanguageCode string
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

GetMyShortDescriptionOpts is the set of optional fields for Bot.GetMyShortDescription.

type GetStarTransactionsOpts added in v2.1.0

type GetStarTransactionsOpts struct {
	// Number of transactions to skip in the response
	Offset int64
	// The maximum number of transactions to be retrieved. Values between 1-100 are accepted. Defaults to 100.
	Limit int64
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

GetStarTransactionsOpts is the set of optional fields for Bot.GetStarTransactions.

type GetStickerSetOpts

type GetStickerSetOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

GetStickerSetOpts is the set of optional fields for Bot.GetStickerSet.

type GetUpdatesOpts

type GetUpdatesOpts 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 be forgotten.
	Offset int64
	// Limits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults to 100.
	Limit int64
	// 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 int64
	// A JSON-serialized list of the update types you want your bot to receive. For example, specify ["message", "edited_channel_post", "callback_query"] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member, message_reaction, and message_reaction_count (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
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

GetUpdatesOpts is the set of optional fields for Bot.GetUpdates.

type GetUserChatBoostsOpts added in v2.1.0

type GetUserChatBoostsOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

GetUserChatBoostsOpts is the set of optional fields for Bot.GetUserChatBoosts.

type GetUserProfilePhotosOpts

type GetUserProfilePhotosOpts struct {
	// Sequential number of the first photo to be returned. By default, all photos are returned.
	Offset int64
	// Limits the number of photos to be retrieved. Values between 1-100 are accepted. Defaults to 100.
	Limit int64
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

GetUserProfilePhotosOpts is the set of optional fields for Bot.GetUserProfilePhotos.

type GetWebhookInfoOpts

type GetWebhookInfoOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

GetWebhookInfoOpts is the set of optional fields for Bot.GetWebhookInfo.

type Giveaway added in v2.1.0

type Giveaway struct {
	// The list of chats which the user must join to participate in the giveaway
	Chats []Chat `json:"chats,omitempty"`
	// Point in time (Unix timestamp) when winners of the giveaway will be selected
	WinnersSelectionDate int64 `json:"winners_selection_date"`
	// The number of users which are supposed to be selected as winners of the giveaway
	WinnerCount int64 `json:"winner_count"`
	// Optional. True, if only users who join the chats after the giveaway started should be eligible to win
	OnlyNewMembers bool `json:"only_new_members,omitempty"`
	// Optional. True, if the list of giveaway winners will be visible to everyone
	HasPublicWinners bool `json:"has_public_winners,omitempty"`
	// Optional. Description of additional giveaway prize
	PrizeDescription string `json:"prize_description,omitempty"`
	// Optional. A list of two-letter ISO 3166-1 alpha-2 country codes indicating the countries from which eligible users for the giveaway must come. If empty, then all users can participate in the giveaway. Users with a phone number that was bought on Fragment can always participate in giveaways.
	CountryCodes []string `json:"country_codes,omitempty"`
	// Optional. The number of months the Telegram Premium subscription won from the giveaway will be active for
	PremiumSubscriptionMonthCount int64 `json:"premium_subscription_month_count,omitempty"`
}

Giveaway (https://core.telegram.org/bots/api#giveaway)

This object represents a message about a scheduled giveaway.

type GiveawayCompleted added in v2.1.0

type GiveawayCompleted struct {
	// Number of winners in the giveaway
	WinnerCount int64 `json:"winner_count"`
	// Optional. Number of undistributed prizes
	UnclaimedPrizeCount int64 `json:"unclaimed_prize_count,omitempty"`
	// Optional. Message with the giveaway that was completed, if it wasn't deleted
	GiveawayMessage *Message `json:"giveaway_message,omitempty"`
}

GiveawayCompleted (https://core.telegram.org/bots/api#giveawaycompleted)

This object represents a service message about the completion of a giveaway without public winners.

type GiveawayCreated added in v2.1.0

type GiveawayCreated struct{}

GiveawayCreated (https://core.telegram.org/bots/api#giveawaycreated)

This object represents a service message about the creation of a scheduled giveaway. Currently holds no information.

type GiveawayWinners added in v2.1.0

type GiveawayWinners struct {
	// The chat that created the giveaway
	Chat Chat `json:"chat"`
	// Identifier of the message with the giveaway in the chat
	GiveawayMessageId int64 `json:"giveaway_message_id"`
	// Point in time (Unix timestamp) when winners of the giveaway were selected
	WinnersSelectionDate int64 `json:"winners_selection_date"`
	// Total number of winners in the giveaway
	WinnerCount int64 `json:"winner_count"`
	// List of up to 100 winners of the giveaway
	Winners []User `json:"winners,omitempty"`
	// Optional. The number of other chats the user had to join in order to be eligible for the giveaway
	AdditionalChatCount int64 `json:"additional_chat_count,omitempty"`
	// Optional. The number of months the Telegram Premium subscription won from the giveaway will be active for
	PremiumSubscriptionMonthCount int64 `json:"premium_subscription_month_count,omitempty"`
	// Optional. Number of undistributed prizes
	UnclaimedPrizeCount int64 `json:"unclaimed_prize_count,omitempty"`
	// Optional. True, if only users who had joined the chats after the giveaway started were eligible to win
	OnlyNewMembers bool `json:"only_new_members,omitempty"`
	// Optional. True, if the giveaway was canceled because the payment for it was refunded
	WasRefunded bool `json:"was_refunded,omitempty"`
	// Optional. Description of additional giveaway prize
	PrizeDescription string `json:"prize_description,omitempty"`
}

GiveawayWinners (https://core.telegram.org/bots/api#giveawaywinners)

This object represents a message about the completion of a giveaway with public winners.

type HideGeneralForumTopicOpts

type HideGeneralForumTopicOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

HideGeneralForumTopicOpts is the set of optional fields for Bot.HideGeneralForumTopic.

type InaccessibleMessage added in v2.1.0

type InaccessibleMessage struct {
	// Chat the message belonged to
	Chat Chat `json:"chat"`
	// Unique message identifier inside the chat
	MessageId int64 `json:"message_id"`
	// Always 0. The field can be used to differentiate regular and inaccessible messages.
	Date int64 `json:"date"`
}

InaccessibleMessage (https://core.telegram.org/bots/api#inaccessiblemessage)

This object describes a message that was deleted or is otherwise inaccessible to the bot.

func (InaccessibleMessage) Copy added in v2.1.0

func (im InaccessibleMessage) Copy(b *Bot, chatId int64, opts *CopyMessageOpts) (*MessageId, error)

Copy Helper method for Bot.CopyMessage.

func (InaccessibleMessage) Delete added in v2.1.0

func (im InaccessibleMessage) Delete(b *Bot, opts *DeleteMessageOpts) (bool, error)

Delete Helper method for Bot.DeleteMessage.

func (InaccessibleMessage) EditCaption added in v2.1.0

func (im InaccessibleMessage) EditCaption(b *Bot, opts *EditMessageCaptionOpts) (*Message, bool, error)

EditCaption Helper method for Bot.EditMessageCaption.

func (InaccessibleMessage) EditLiveLocation added in v2.1.0

func (im InaccessibleMessage) EditLiveLocation(b *Bot, latitude float64, longitude float64, opts *EditMessageLiveLocationOpts) (*Message, bool, error)

EditLiveLocation Helper method for Bot.EditMessageLiveLocation.

func (InaccessibleMessage) EditMedia added in v2.1.0

func (im InaccessibleMessage) EditMedia(b *Bot, media InputMedia, opts *EditMessageMediaOpts) (*Message, bool, error)

EditMedia Helper method for Bot.EditMessageMedia.

func (InaccessibleMessage) EditReplyMarkup added in v2.1.0

func (im InaccessibleMessage) EditReplyMarkup(b *Bot, opts *EditMessageReplyMarkupOpts) (*Message, bool, error)

EditReplyMarkup Helper method for Bot.EditMessageReplyMarkup.

func (InaccessibleMessage) EditText added in v2.1.0

func (im InaccessibleMessage) EditText(b *Bot, text string, opts *EditMessageTextOpts) (*Message, bool, error)

EditText Helper method for Bot.EditMessageText.

func (InaccessibleMessage) Forward added in v2.1.0

func (im InaccessibleMessage) Forward(b *Bot, chatId int64, opts *ForwardMessageOpts) (*Message, error)

Forward Helper method for Bot.ForwardMessage.

func (InaccessibleMessage) GetChat added in v2.1.0

func (v InaccessibleMessage) GetChat() Chat

GetChat is a helper method to easily access the common fields of an interface.

func (InaccessibleMessage) GetDate added in v2.1.0

func (v InaccessibleMessage) GetDate() int64

GetDate is a helper method to easily access the common fields of an interface.

func (InaccessibleMessage) GetMessageId added in v2.1.0

func (v InaccessibleMessage) GetMessageId() int64

GetMessageId is a helper method to easily access the common fields of an interface.

func (InaccessibleMessage) Pin added in v2.1.0

func (im InaccessibleMessage) Pin(b *Bot, opts *PinChatMessageOpts) (bool, error)

Pin Helper method for Bot.PinChatMessage.

func (InaccessibleMessage) Reply added in v2.1.0

func (im InaccessibleMessage) Reply(b *Bot, text string, opts *SendMessageOpts) (*Message, error)

Reply is a helper function to easily call Bot.SendMessage as a reply to an existing InaccessibleMessage.

func (InaccessibleMessage) SetReaction added in v2.1.0

func (im InaccessibleMessage) SetReaction(b *Bot, opts *SetMessageReactionOpts) (bool, error)

SetReaction Helper method for Bot.SetMessageReaction.

func (InaccessibleMessage) StopLiveLocation added in v2.1.0

func (im InaccessibleMessage) StopLiveLocation(b *Bot, opts *StopMessageLiveLocationOpts) (*Message, bool, error)

StopLiveLocation Helper method for Bot.StopMessageLiveLocation.

func (InaccessibleMessage) ToMessage added in v2.1.0

func (im InaccessibleMessage) ToMessage() *Message

ToMessage is a helper function to simplify dealing with telegram's message nonsense. It populates a standard message object with all of InaccessibleMessage's shared fields.

func (InaccessibleMessage) Unpin added in v2.1.0

func (im InaccessibleMessage) Unpin(b *Bot, opts *UnpinChatMessageOpts) (bool, error)

Unpin Helper method for Bot.UnpinChatMessage.

type InlineKeyboardButton

type InlineKeyboardButton struct {
	// Label text on the button
	Text string `json:"text"`
	// Optional. HTTP or tg:// URL to be opened when the button is pressed. Links tg://user?id=<user_id> can be used to mention a user by their identifier without using a username, if this is allowed by their privacy settings.
	Url string `json:"url,omitempty"`
	// Optional. Data to be sent in a callback query to the bot when the button is pressed, 1-64 bytes
	CallbackData string `json:"callback_data,omitempty"`
	// Optional. Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. Available only in private chats between a user and the bot. Not supported for messages sent on behalf of a Telegram Business account.
	WebApp *WebAppInfo `json:"web_app,omitempty"`
	// Optional. An HTTPS URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget.
	LoginUrl *LoginUrl `json:"login_url,omitempty"`
	// Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted. Not supported for messages sent on behalf of a Telegram Business account.
	SwitchInlineQuery *string `json:"switch_inline_query,omitempty"`
	// Optional. If set, pressing the button will insert the bot's username and the specified inline query in the current chat's input field. May 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. Not supported in channels and for messages sent on behalf of a Telegram Business account.
	SwitchInlineQueryCurrentChat *string `json:"switch_inline_query_current_chat,omitempty"`
	// Optional. If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot's username and the specified inline query in the input field. Not supported for messages sent on behalf of a Telegram Business account.
	SwitchInlineQueryChosenChat *SwitchInlineQueryChosenChat `json:"switch_inline_query_chosen_chat,omitempty"`
	// Optional. Description of the game that will be launched when the user presses the button. NOTE: This type of button must always be the first button in the first row.
	CallbackGame *CallbackGame `json:"callback_game,omitempty"`
	// Optional. Specify True, to send a Pay button. Substrings "⭐" and "XTR" in the buttons's text will be replaced with a Telegram Star icon. NOTE: This type of button must always be the first button in the first row and can only be used in invoice messages.
	Pay bool `json:"pay,omitempty"`
}

InlineKeyboardButton (https://core.telegram.org/bots/api#inlinekeyboardbutton)

This object represents one button of an inline keyboard. Exactly one of the optional fields must be used to specify type of the button.

type InlineKeyboardMarkup

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

InlineKeyboardMarkup (https://core.telegram.org/bots/api#inlinekeyboardmarkup)

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

type InlineQuery

type InlineQuery struct {
	// Unique identifier for this query
	Id string `json:"id"`
	// Sender
	From User `json:"from"`
	// Text of the query (up to 256 characters)
	Query string `json:"query"`
	// Offset of the results to be returned, can be controlled by the bot
	Offset string `json:"offset"`
	// Optional. Type of the chat from which the inline query was sent. Can be either "sender" for a private chat with the inline query sender, "private", "group", "supergroup", or "channel". The chat type should be always known for requests sent from official clients and most third-party clients, unless the request was sent from a secret chat
	ChatType string `json:"chat_type,omitempty"`
	// Optional. Sender location, only for bots that request user location
	Location *Location `json:"location,omitempty"`
}

InlineQuery (https://core.telegram.org/bots/api#inlinequery)

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

func (InlineQuery) Answer

func (iq InlineQuery) Answer(b *Bot, results []InlineQueryResult, opts *AnswerInlineQueryOpts) (bool, error)

Answer Helper method for Bot.AnswerInlineQuery.

type InlineQueryResult

type InlineQueryResult interface {
	GetType() string
	GetId() string
	// MergeInlineQueryResult returns a MergedInlineQueryResult struct to simplify working with complex telegram types in a non-generic world.
	MergeInlineQueryResult() MergedInlineQueryResult
	// contains filtered or unexported methods
}

InlineQueryResult (https://core.telegram.org/bots/api#inlinequeryresult)

This object represents one result of an inline query. Telegram clients currently support results of the following 20 types:

  • InlineQueryResultCachedAudio
  • InlineQueryResultCachedDocument
  • InlineQueryResultCachedGif
  • InlineQueryResultCachedMpeg4Gif
  • InlineQueryResultCachedPhoto
  • InlineQueryResultCachedSticker
  • InlineQueryResultCachedVideo
  • InlineQueryResultCachedVoice
  • InlineQueryResultArticle
  • InlineQueryResultAudio
  • InlineQueryResultContact
  • InlineQueryResultGame
  • InlineQueryResultDocument
  • InlineQueryResultGif
  • InlineQueryResultLocation
  • InlineQueryResultMpeg4Gif
  • InlineQueryResultPhoto
  • InlineQueryResultVenue
  • InlineQueryResultVideo
  • InlineQueryResultVoice

Note: All URLs passed in inline query results will be available to end users and therefore must be assumed to be public.

type InlineQueryResultArticle

type InlineQueryResultArticle struct {
	// Unique identifier for this result, 1-64 Bytes
	Id string `json:"id"`
	// Title of the result
	Title string `json:"title"`
	// Content of the message to be sent
	InputMessageContent InputMessageContent `json:"input_message_content"`
	// Optional. Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// Optional. URL of the result
	Url string `json:"url,omitempty"`
	// Optional. Pass True if you don't want the URL to be shown in the message
	HideUrl bool `json:"hide_url,omitempty"`
	// Optional. Short description of the result
	Description string `json:"description,omitempty"`
	// Optional. Url of the thumbnail for the result
	ThumbnailUrl string `json:"thumbnail_url,omitempty"`
	// Optional. Thumbnail width
	ThumbnailWidth int64 `json:"thumbnail_width,omitempty"`
	// Optional. Thumbnail height
	ThumbnailHeight int64 `json:"thumbnail_height,omitempty"`
}

InlineQueryResultArticle (https://core.telegram.org/bots/api#inlinequeryresultarticle)

Represents a link to an article or web page.

func (InlineQueryResultArticle) GetId

func (v InlineQueryResultArticle) GetId() string

GetId is a helper method to easily access the common fields of an interface.

func (InlineQueryResultArticle) GetType

func (v InlineQueryResultArticle) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (InlineQueryResultArticle) MarshalJSON

func (v InlineQueryResultArticle) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (InlineQueryResultArticle) MergeInlineQueryResult

func (v InlineQueryResultArticle) MergeInlineQueryResult() MergedInlineQueryResult

MergeInlineQueryResult returns a MergedInlineQueryResult struct to simplify working with types in a non-generic world.

type InlineQueryResultAudio

type InlineQueryResultAudio struct {
	// 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"`
	// Optional. Caption, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`
	// Optional. Mode for parsing entities in the audio caption. See formatting options for more details.
	ParseMode string `json:"parse_mode,omitempty"`
	// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
	// Optional. Performer
	Performer string `json:"performer,omitempty"`
	// Optional. Audio duration in seconds
	AudioDuration int64 `json:"audio_duration,omitempty"`
	// Optional. Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// Optional. Content of the message to be sent instead of the audio
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}

InlineQueryResultAudio (https://core.telegram.org/bots/api#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 (InlineQueryResultAudio) GetId

func (v InlineQueryResultAudio) GetId() string

GetId is a helper method to easily access the common fields of an interface.

func (InlineQueryResultAudio) GetType

func (v InlineQueryResultAudio) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (InlineQueryResultAudio) MarshalJSON

func (v InlineQueryResultAudio) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (InlineQueryResultAudio) MergeInlineQueryResult

func (v InlineQueryResultAudio) MergeInlineQueryResult() MergedInlineQueryResult

MergeInlineQueryResult returns a MergedInlineQueryResult struct to simplify working with types in a non-generic world.

type InlineQueryResultCachedAudio

type InlineQueryResultCachedAudio struct {
	// 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"`
	// Optional. Caption, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`
	// Optional. Mode for parsing entities in the audio caption. See formatting options for more details.
	ParseMode string `json:"parse_mode,omitempty"`
	// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
	// Optional. Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// Optional. Content of the message to be sent instead of the audio
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}

InlineQueryResultCachedAudio (https://core.telegram.org/bots/api#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 (InlineQueryResultCachedAudio) GetId

GetId is a helper method to easily access the common fields of an interface.

func (InlineQueryResultCachedAudio) GetType

GetType is a helper method to easily access the common fields of an interface.

func (InlineQueryResultCachedAudio) MarshalJSON

func (v InlineQueryResultCachedAudio) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (InlineQueryResultCachedAudio) MergeInlineQueryResult

func (v InlineQueryResultCachedAudio) MergeInlineQueryResult() MergedInlineQueryResult

MergeInlineQueryResult returns a MergedInlineQueryResult struct to simplify working with types in a non-generic world.

type InlineQueryResultCachedDocument

type InlineQueryResultCachedDocument struct {
	// 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"`
	// Optional. Short description of the result
	Description string `json:"description,omitempty"`
	// Optional. Caption of the document to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`
	// Optional. Mode for parsing entities in the document caption. See formatting options for more details.
	ParseMode string `json:"parse_mode,omitempty"`
	// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
	// Optional. Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// Optional. Content of the message to be sent instead of the file
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}

InlineQueryResultCachedDocument (https://core.telegram.org/bots/api#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 (InlineQueryResultCachedDocument) GetId

GetId is a helper method to easily access the common fields of an interface.

func (InlineQueryResultCachedDocument) GetType

GetType is a helper method to easily access the common fields of an interface.

func (InlineQueryResultCachedDocument) MarshalJSON

func (v InlineQueryResultCachedDocument) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (InlineQueryResultCachedDocument) MergeInlineQueryResult

func (v InlineQueryResultCachedDocument) MergeInlineQueryResult() MergedInlineQueryResult

MergeInlineQueryResult returns a MergedInlineQueryResult struct to simplify working with types in a non-generic world.

type InlineQueryResultCachedGif

type InlineQueryResultCachedGif struct {
	// 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"`
	// Optional. Title for the result
	Title string `json:"title,omitempty"`
	// Optional. Caption of the GIF file to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`
	// Optional. Mode for parsing entities in the caption. See formatting options for more details.
	ParseMode string `json:"parse_mode,omitempty"`
	// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
	// Optional. Pass True, if the caption must be shown above the message media
	ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
	// Optional. Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// Optional. Content of the message to be sent instead of the GIF animation
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}

InlineQueryResultCachedGif (https://core.telegram.org/bots/api#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 (InlineQueryResultCachedGif) GetId

GetId is a helper method to easily access the common fields of an interface.

func (InlineQueryResultCachedGif) GetType

func (v InlineQueryResultCachedGif) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (InlineQueryResultCachedGif) MarshalJSON

func (v InlineQueryResultCachedGif) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (InlineQueryResultCachedGif) MergeInlineQueryResult

func (v InlineQueryResultCachedGif) MergeInlineQueryResult() MergedInlineQueryResult

MergeInlineQueryResult returns a MergedInlineQueryResult struct to simplify working with types in a non-generic world.

type InlineQueryResultCachedMpeg4Gif

type InlineQueryResultCachedMpeg4Gif struct {
	// Unique identifier for this result, 1-64 bytes
	Id string `json:"id"`
	// A valid file identifier for the MPEG4 file
	Mpeg4FileId string `json:"mpeg4_file_id"`
	// Optional. Title for the result
	Title string `json:"title,omitempty"`
	// Optional. Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`
	// Optional. Mode for parsing entities in the caption. See formatting options for more details.
	ParseMode string `json:"parse_mode,omitempty"`
	// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
	// Optional. Pass True, if the caption must be shown above the message media
	ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
	// Optional. Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// Optional. Content of the message to be sent instead of the video animation
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}

InlineQueryResultCachedMpeg4Gif (https://core.telegram.org/bots/api#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 (InlineQueryResultCachedMpeg4Gif) GetId

GetId is a helper method to easily access the common fields of an interface.

func (InlineQueryResultCachedMpeg4Gif) GetType

GetType is a helper method to easily access the common fields of an interface.

func (InlineQueryResultCachedMpeg4Gif) MarshalJSON

func (v InlineQueryResultCachedMpeg4Gif) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (InlineQueryResultCachedMpeg4Gif) MergeInlineQueryResult

func (v InlineQueryResultCachedMpeg4Gif) MergeInlineQueryResult() MergedInlineQueryResult

MergeInlineQueryResult returns a MergedInlineQueryResult struct to simplify working with types in a non-generic world.

type InlineQueryResultCachedPhoto

type InlineQueryResultCachedPhoto struct {
	// 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"`
	// Optional. Title for the result
	Title string `json:"title,omitempty"`
	// Optional. Short description of the result
	Description string `json:"description,omitempty"`
	// Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`
	// Optional. Mode for parsing entities in the photo caption. See formatting options for more details.
	ParseMode string `json:"parse_mode,omitempty"`
	// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
	// Optional. Pass True, if the caption must be shown above the message media
	ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
	// Optional. Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// Optional. Content of the message to be sent instead of the photo
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}

InlineQueryResultCachedPhoto (https://core.telegram.org/bots/api#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 (InlineQueryResultCachedPhoto) GetId

GetId is a helper method to easily access the common fields of an interface.

func (InlineQueryResultCachedPhoto) GetType

GetType is a helper method to easily access the common fields of an interface.

func (InlineQueryResultCachedPhoto) MarshalJSON

func (v InlineQueryResultCachedPhoto) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (InlineQueryResultCachedPhoto) MergeInlineQueryResult

func (v InlineQueryResultCachedPhoto) MergeInlineQueryResult() MergedInlineQueryResult

MergeInlineQueryResult returns a MergedInlineQueryResult struct to simplify working with types in a non-generic world.

type InlineQueryResultCachedSticker

type InlineQueryResultCachedSticker struct {
	// 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"`
	// Optional. Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// Optional. Content of the message to be sent instead of the sticker
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}

InlineQueryResultCachedSticker (https://core.telegram.org/bots/api#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 (InlineQueryResultCachedSticker) GetId

GetId is a helper method to easily access the common fields of an interface.

func (InlineQueryResultCachedSticker) GetType

GetType is a helper method to easily access the common fields of an interface.

func (InlineQueryResultCachedSticker) MarshalJSON

func (v InlineQueryResultCachedSticker) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (InlineQueryResultCachedSticker) MergeInlineQueryResult

func (v InlineQueryResultCachedSticker) MergeInlineQueryResult() MergedInlineQueryResult

MergeInlineQueryResult returns a MergedInlineQueryResult struct to simplify working with types in a non-generic world.

type InlineQueryResultCachedVideo

type InlineQueryResultCachedVideo struct {
	// 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"`
	// Optional. Short description of the result
	Description string `json:"description,omitempty"`
	// Optional. Caption of the video to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`
	// Optional. Mode for parsing entities in the video caption. See formatting options for more details.
	ParseMode string `json:"parse_mode,omitempty"`
	// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
	// Optional. Pass True, if the caption must be shown above the message media
	ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
	// Optional. Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// Optional. Content of the message to be sent instead of the video
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}

InlineQueryResultCachedVideo (https://core.telegram.org/bots/api#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 (InlineQueryResultCachedVideo) GetId

GetId is a helper method to easily access the common fields of an interface.

func (InlineQueryResultCachedVideo) GetType

GetType is a helper method to easily access the common fields of an interface.

func (InlineQueryResultCachedVideo) MarshalJSON

func (v InlineQueryResultCachedVideo) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (InlineQueryResultCachedVideo) MergeInlineQueryResult

func (v InlineQueryResultCachedVideo) MergeInlineQueryResult() MergedInlineQueryResult

MergeInlineQueryResult returns a MergedInlineQueryResult struct to simplify working with types in a non-generic world.

type InlineQueryResultCachedVoice

type InlineQueryResultCachedVoice struct {
	// 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"`
	// Optional. Caption, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`
	// Optional. Mode for parsing entities in the voice message caption. See formatting options for more details.
	ParseMode string `json:"parse_mode,omitempty"`
	// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
	// Optional. Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// Optional. Content of the message to be sent instead of the voice message
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}

InlineQueryResultCachedVoice (https://core.telegram.org/bots/api#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 (InlineQueryResultCachedVoice) GetId

GetId is a helper method to easily access the common fields of an interface.

func (InlineQueryResultCachedVoice) GetType

GetType is a helper method to easily access the common fields of an interface.

func (InlineQueryResultCachedVoice) MarshalJSON

func (v InlineQueryResultCachedVoice) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (InlineQueryResultCachedVoice) MergeInlineQueryResult

func (v InlineQueryResultCachedVoice) MergeInlineQueryResult() MergedInlineQueryResult

MergeInlineQueryResult returns a MergedInlineQueryResult struct to simplify working with types in a non-generic world.

type InlineQueryResultContact

type InlineQueryResultContact struct {
	// 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"`
	// Optional. Contact's last name
	LastName string `json:"last_name,omitempty"`
	// Optional. Additional data about the contact in the form of a vCard, 0-2048 bytes
	Vcard string `json:"vcard,omitempty"`
	// Optional. Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// Optional. Content of the message to be sent instead of the contact
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
	// Optional. Url of the thumbnail for the result
	ThumbnailUrl string `json:"thumbnail_url,omitempty"`
	// Optional. Thumbnail width
	ThumbnailWidth int64 `json:"thumbnail_width,omitempty"`
	// Optional. Thumbnail height
	ThumbnailHeight int64 `json:"thumbnail_height,omitempty"`
}

InlineQueryResultContact (https://core.telegram.org/bots/api#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 (InlineQueryResultContact) GetId

func (v InlineQueryResultContact) GetId() string

GetId is a helper method to easily access the common fields of an interface.

func (InlineQueryResultContact) GetType

func (v InlineQueryResultContact) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (InlineQueryResultContact) MarshalJSON

func (v InlineQueryResultContact) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (InlineQueryResultContact) MergeInlineQueryResult

func (v InlineQueryResultContact) MergeInlineQueryResult() MergedInlineQueryResult

MergeInlineQueryResult returns a MergedInlineQueryResult struct to simplify working with types in a non-generic world.

type InlineQueryResultDocument

type InlineQueryResultDocument struct {
	// Unique identifier for this result, 1-64 bytes
	Id string `json:"id"`
	// Title for the result
	Title string `json:"title"`
	// Optional. Caption of the document to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`
	// Optional. Mode for parsing entities in the document caption. See formatting options for more details.
	ParseMode string `json:"parse_mode,omitempty"`
	// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
	// 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"`
	// Optional. Short description of the result
	Description string `json:"description,omitempty"`
	// Optional. Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// Optional. Content of the message to be sent instead of the file
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
	// Optional. URL of the thumbnail (JPEG only) for the file
	ThumbnailUrl string `json:"thumbnail_url,omitempty"`
	// Optional. Thumbnail width
	ThumbnailWidth int64 `json:"thumbnail_width,omitempty"`
	// Optional. Thumbnail height
	ThumbnailHeight int64 `json:"thumbnail_height,omitempty"`
}

InlineQueryResultDocument (https://core.telegram.org/bots/api#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 (InlineQueryResultDocument) GetId

GetId is a helper method to easily access the common fields of an interface.

func (InlineQueryResultDocument) GetType

func (v InlineQueryResultDocument) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (InlineQueryResultDocument) MarshalJSON

func (v InlineQueryResultDocument) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (InlineQueryResultDocument) MergeInlineQueryResult

func (v InlineQueryResultDocument) MergeInlineQueryResult() MergedInlineQueryResult

MergeInlineQueryResult returns a MergedInlineQueryResult struct to simplify working with types in a non-generic world.

type InlineQueryResultGame

type InlineQueryResultGame struct {
	// Unique identifier for this result, 1-64 bytes
	Id string `json:"id"`
	// Short name of the game
	GameShortName string `json:"game_short_name"`
	// Optional. Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}

InlineQueryResultGame (https://core.telegram.org/bots/api#inlinequeryresultgame)

Represents a Game.

func (InlineQueryResultGame) GetId

func (v InlineQueryResultGame) GetId() string

GetId is a helper method to easily access the common fields of an interface.

func (InlineQueryResultGame) GetType

func (v InlineQueryResultGame) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (InlineQueryResultGame) MarshalJSON

func (v InlineQueryResultGame) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (InlineQueryResultGame) MergeInlineQueryResult

func (v InlineQueryResultGame) MergeInlineQueryResult() MergedInlineQueryResult

MergeInlineQueryResult returns a MergedInlineQueryResult struct to simplify working with types in a non-generic world.

type InlineQueryResultGif

type InlineQueryResultGif struct {
	// 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"`
	// Optional. Width of the GIF
	GifWidth int64 `json:"gif_width,omitempty"`
	// Optional. Height of the GIF
	GifHeight int64 `json:"gif_height,omitempty"`
	// Optional. Duration of the GIF in seconds
	GifDuration int64 `json:"gif_duration,omitempty"`
	// URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result
	ThumbnailUrl string `json:"thumbnail_url"`
	// Optional. MIME type of the thumbnail, must be one of "image/jpeg", "image/gif", or "video/mp4". Defaults to "image/jpeg"
	ThumbnailMimeType string `json:"thumbnail_mime_type,omitempty"`
	// Optional. Title for the result
	Title string `json:"title,omitempty"`
	// Optional. Caption of the GIF file to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`
	// Optional. Mode for parsing entities in the caption. See formatting options for more details.
	ParseMode string `json:"parse_mode,omitempty"`
	// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
	// Optional. Pass True, if the caption must be shown above the message media
	ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
	// Optional. Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// Optional. Content of the message to be sent instead of the GIF animation
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}

InlineQueryResultGif (https://core.telegram.org/bots/api#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 (InlineQueryResultGif) GetId

func (v InlineQueryResultGif) GetId() string

GetId is a helper method to easily access the common fields of an interface.

func (InlineQueryResultGif) GetType

func (v InlineQueryResultGif) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (InlineQueryResultGif) MarshalJSON

func (v InlineQueryResultGif) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (InlineQueryResultGif) MergeInlineQueryResult

func (v InlineQueryResultGif) MergeInlineQueryResult() MergedInlineQueryResult

MergeInlineQueryResult returns a MergedInlineQueryResult struct to simplify working with types in a non-generic world.

type InlineQueryResultLocation

type InlineQueryResultLocation struct {
	// 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"`
	// Optional. The radius of uncertainty for the location, measured in meters; 0-1500
	HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"`
	// Optional. Period in seconds during which the location can be updated, should be between 60 and 86400, or 0x7FFFFFFF for live locations that can be edited indefinitely.
	LivePeriod int64 `json:"live_period,omitempty"`
	// Optional. For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.
	Heading int64 `json:"heading,omitempty"`
	// Optional. For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.
	ProximityAlertRadius int64 `json:"proximity_alert_radius,omitempty"`
	// Optional. Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// Optional. Content of the message to be sent instead of the location
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
	// Optional. Url of the thumbnail for the result
	ThumbnailUrl string `json:"thumbnail_url,omitempty"`
	// Optional. Thumbnail width
	ThumbnailWidth int64 `json:"thumbnail_width,omitempty"`
	// Optional. Thumbnail height
	ThumbnailHeight int64 `json:"thumbnail_height,omitempty"`
}

InlineQueryResultLocation (https://core.telegram.org/bots/api#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 (InlineQueryResultLocation) GetId

GetId is a helper method to easily access the common fields of an interface.

func (InlineQueryResultLocation) GetType

func (v InlineQueryResultLocation) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (InlineQueryResultLocation) MarshalJSON

func (v InlineQueryResultLocation) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (InlineQueryResultLocation) MergeInlineQueryResult

func (v InlineQueryResultLocation) MergeInlineQueryResult() MergedInlineQueryResult

MergeInlineQueryResult returns a MergedInlineQueryResult struct to simplify working with types in a non-generic world.

type InlineQueryResultMpeg4Gif

type InlineQueryResultMpeg4Gif struct {
	// Unique identifier for this result, 1-64 bytes
	Id string `json:"id"`
	// A valid URL for the MPEG4 file. File size must not exceed 1MB
	Mpeg4Url string `json:"mpeg4_url"`
	// Optional. Video width
	Mpeg4Width int64 `json:"mpeg4_width,omitempty"`
	// Optional. Video height
	Mpeg4Height int64 `json:"mpeg4_height,omitempty"`
	// Optional. Video duration in seconds
	Mpeg4Duration int64 `json:"mpeg4_duration,omitempty"`
	// URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result
	ThumbnailUrl string `json:"thumbnail_url"`
	// Optional. MIME type of the thumbnail, must be one of "image/jpeg", "image/gif", or "video/mp4". Defaults to "image/jpeg"
	ThumbnailMimeType string `json:"thumbnail_mime_type,omitempty"`
	// Optional. Title for the result
	Title string `json:"title,omitempty"`
	// Optional. Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`
	// Optional. Mode for parsing entities in the caption. See formatting options for more details.
	ParseMode string `json:"parse_mode,omitempty"`
	// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
	// Optional. Pass True, if the caption must be shown above the message media
	ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
	// Optional. Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// Optional. Content of the message to be sent instead of the video animation
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}

InlineQueryResultMpeg4Gif (https://core.telegram.org/bots/api#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 (InlineQueryResultMpeg4Gif) GetId

GetId is a helper method to easily access the common fields of an interface.

func (InlineQueryResultMpeg4Gif) GetType

func (v InlineQueryResultMpeg4Gif) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (InlineQueryResultMpeg4Gif) MarshalJSON

func (v InlineQueryResultMpeg4Gif) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (InlineQueryResultMpeg4Gif) MergeInlineQueryResult

func (v InlineQueryResultMpeg4Gif) MergeInlineQueryResult() MergedInlineQueryResult

MergeInlineQueryResult returns a MergedInlineQueryResult struct to simplify working with types in a non-generic world.

type InlineQueryResultPhoto

type InlineQueryResultPhoto struct {
	// 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
	ThumbnailUrl string `json:"thumbnail_url"`
	// Optional. Width of the photo
	PhotoWidth int64 `json:"photo_width,omitempty"`
	// Optional. Height of the photo
	PhotoHeight int64 `json:"photo_height,omitempty"`
	// Optional. Title for the result
	Title string `json:"title,omitempty"`
	// Optional. Short description of the result
	Description string `json:"description,omitempty"`
	// Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`
	// Optional. Mode for parsing entities in the photo caption. See formatting options for more details.
	ParseMode string `json:"parse_mode,omitempty"`
	// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
	// Optional. Pass True, if the caption must be shown above the message media
	ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
	// Optional. Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// Optional. Content of the message to be sent instead of the photo
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}

InlineQueryResultPhoto (https://core.telegram.org/bots/api#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 (InlineQueryResultPhoto) GetId

func (v InlineQueryResultPhoto) GetId() string

GetId is a helper method to easily access the common fields of an interface.

func (InlineQueryResultPhoto) GetType

func (v InlineQueryResultPhoto) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (InlineQueryResultPhoto) MarshalJSON

func (v InlineQueryResultPhoto) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (InlineQueryResultPhoto) MergeInlineQueryResult

func (v InlineQueryResultPhoto) MergeInlineQueryResult() MergedInlineQueryResult

MergeInlineQueryResult returns a MergedInlineQueryResult struct to simplify working with types in a non-generic world.

type InlineQueryResultVenue

type InlineQueryResultVenue struct {
	// 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"`
	// Optional. Foursquare identifier of the venue if known
	FoursquareId string `json:"foursquare_id,omitempty"`
	// Optional. Foursquare type of the venue, if known. (For example, "arts_entertainment/default", "arts_entertainment/aquarium" or "food/icecream".)
	FoursquareType string `json:"foursquare_type,omitempty"`
	// Optional. Google Places identifier of the venue
	GooglePlaceId string `json:"google_place_id,omitempty"`
	// Optional. Google Places type of the venue. (See supported types.)
	GooglePlaceType string `json:"google_place_type,omitempty"`
	// Optional. Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// Optional. Content of the message to be sent instead of the venue
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
	// Optional. Url of the thumbnail for the result
	ThumbnailUrl string `json:"thumbnail_url,omitempty"`
	// Optional. Thumbnail width
	ThumbnailWidth int64 `json:"thumbnail_width,omitempty"`
	// Optional. Thumbnail height
	ThumbnailHeight int64 `json:"thumbnail_height,omitempty"`
}

InlineQueryResultVenue (https://core.telegram.org/bots/api#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 (InlineQueryResultVenue) GetId

func (v InlineQueryResultVenue) GetId() string

GetId is a helper method to easily access the common fields of an interface.

func (InlineQueryResultVenue) GetType

func (v InlineQueryResultVenue) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (InlineQueryResultVenue) MarshalJSON

func (v InlineQueryResultVenue) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (InlineQueryResultVenue) MergeInlineQueryResult

func (v InlineQueryResultVenue) MergeInlineQueryResult() MergedInlineQueryResult

MergeInlineQueryResult returns a MergedInlineQueryResult struct to simplify working with types in a non-generic world.

type InlineQueryResultVideo

type InlineQueryResultVideo struct {
	// 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 the video URL, "text/html" or "video/mp4"
	MimeType string `json:"mime_type"`
	// URL of the thumbnail (JPEG only) for the video
	ThumbnailUrl string `json:"thumbnail_url"`
	// Title for the result
	Title string `json:"title"`
	// Optional. Caption of the video to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`
	// Optional. Mode for parsing entities in the video caption. See formatting options for more details.
	ParseMode string `json:"parse_mode,omitempty"`
	// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
	// Optional. Pass True, if the caption must be shown above the message media
	ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
	// Optional. Video width
	VideoWidth int64 `json:"video_width,omitempty"`
	// Optional. Video height
	VideoHeight int64 `json:"video_height,omitempty"`
	// Optional. Video duration in seconds
	VideoDuration int64 `json:"video_duration,omitempty"`
	// Optional. Short description of the result
	Description string `json:"description,omitempty"`
	// Optional. Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// Optional. 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 (https://core.telegram.org/bots/api#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.

func (InlineQueryResultVideo) GetId

func (v InlineQueryResultVideo) GetId() string

GetId is a helper method to easily access the common fields of an interface.

func (InlineQueryResultVideo) GetType

func (v InlineQueryResultVideo) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (InlineQueryResultVideo) MarshalJSON

func (v InlineQueryResultVideo) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (InlineQueryResultVideo) MergeInlineQueryResult

func (v InlineQueryResultVideo) MergeInlineQueryResult() MergedInlineQueryResult

MergeInlineQueryResult returns a MergedInlineQueryResult struct to simplify working with types in a non-generic world.

type InlineQueryResultVoice

type InlineQueryResultVoice struct {
	// 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"`
	// Optional. Caption, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`
	// Optional. Mode for parsing entities in the voice message caption. See formatting options for more details.
	ParseMode string `json:"parse_mode,omitempty"`
	// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
	// Optional. Recording duration in seconds
	VoiceDuration int64 `json:"voice_duration,omitempty"`
	// Optional. Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// Optional. Content of the message to be sent instead of the voice recording
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}

InlineQueryResultVoice (https://core.telegram.org/bots/api#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 (InlineQueryResultVoice) GetId

func (v InlineQueryResultVoice) GetId() string

GetId is a helper method to easily access the common fields of an interface.

func (InlineQueryResultVoice) GetType

func (v InlineQueryResultVoice) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (InlineQueryResultVoice) MarshalJSON

func (v InlineQueryResultVoice) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (InlineQueryResultVoice) MergeInlineQueryResult

func (v InlineQueryResultVoice) MergeInlineQueryResult() MergedInlineQueryResult

MergeInlineQueryResult returns a MergedInlineQueryResult struct to simplify working with types in a non-generic world.

type InlineQueryResultsButton

type InlineQueryResultsButton struct {
	// Label text on the button
	Text string `json:"text"`
	// Optional. Description of the Web App that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method switchInlineQuery inside the Web App.
	WebApp *WebAppInfo `json:"web_app,omitempty"`
	// Optional. Deep-linking parameter for the /start message sent to the bot when a user presses the button. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed. Example: An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube account to adapt search results accordingly. To do this, it displays a 'Connect your YouTube account' button above the results, or even before showing any. The user presses the button, switches to a private chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an OAuth link. Once done, the bot can offer a switch_inline button so that the user can easily return to the chat where they wanted to use the bot's inline capabilities.
	StartParameter string `json:"start_parameter,omitempty"`
}

InlineQueryResultsButton (https://core.telegram.org/bots/api#inlinequeryresultsbutton)

This object represents a button to be shown above inline query results. You must use exactly one of the optional fields.

type InputContactMessageContent

type InputContactMessageContent struct {
	// Contact's phone number
	PhoneNumber string `json:"phone_number"`
	// Contact's first name
	FirstName string `json:"first_name"`
	// Optional. Contact's last name
	LastName string `json:"last_name,omitempty"`
	// Optional. Additional data about the contact in the form of a vCard, 0-2048 bytes
	Vcard string `json:"vcard,omitempty"`
}

InputContactMessageContent (https://core.telegram.org/bots/api#inputcontactmessagecontent)

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

type InputFile

type InputFile interface {
	InputFileOrString
	// contains filtered or unexported methods
}

InputFile (https://core.telegram.org/bots/api#inputfile)

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

func InputFileByReader added in v2.1.0

func InputFileByReader(name string, r io.Reader) InputFile

InputFileByReader is used to send a file by a reader interface; such as a filehandle from os.Open(), or from a byte buffer.

For example:

f, err := os.Open("some_file.go")
if err != nil {
	return fmt.Errorf("failed to open file: %w", err)
}

m, err := b.SendDocument(<chat_id>, gotgbot.InputFileByReader("source.go", f), nil)

Or

m, err := b.SendDocument(<chat_id>, gotgbot.InputFileByReader("file.txt", strings.NewReader("Some file contents")), nil)

type InputFileOrString added in v2.1.0

type InputFileOrString interface {
	Attach(name string, data map[string]FileReader) error
	// contains filtered or unexported methods
}

InputFileOrString (https://core.telegram.org/bots/api#inputfile)

This object represents the contents of a file to be uploaded, or a publicly accessible URL to be reused. Files must be posted using multipart/form-data in the usual way that files are uploaded via the browser.

func InputFileByID added in v2.1.0

func InputFileByID(fileID string) InputFileOrString

InputFileByID is used to send a file that is already present on telegram's servers, using its telegram file_id.

func InputFileByURL added in v2.1.0

func InputFileByURL(url string) InputFileOrString

InputFileByURL is used to send a file on the internet via a publicly accessible HTTP URL.

type InputInvoiceMessageContent

type InputInvoiceMessageContent struct {
	// Product name, 1-32 characters
	Title string `json:"title"`
	// Product description, 1-255 characters
	Description string `json:"description"`
	// Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes.
	Payload string `json:"payload"`
	// Optional. Payment provider token, obtained via @BotFather. Pass an empty string for payments in Telegram Stars.
	ProviderToken string `json:"provider_token,omitempty"`
	// Three-letter ISO 4217 currency code, see more on currencies. Pass "XTR" for payments in Telegram Stars.
	Currency string `json:"currency"`
	// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars.
	Prices []LabeledPrice `json:"prices,omitempty"`
	// Optional. The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in Telegram Stars.
	MaxTipAmount int64 `json:"max_tip_amount,omitempty"`
	// Optional. A JSON-serialized array of suggested amounts of tip in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount.
	SuggestedTipAmounts []int64 `json:"suggested_tip_amounts,omitempty"`
	// Optional. A JSON-serialized object for data about the invoice, which will be shared with the payment provider. A detailed description of the required fields should be provided by the payment provider.
	ProviderData string `json:"provider_data,omitempty"`
	// Optional. URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service.
	PhotoUrl string `json:"photo_url,omitempty"`
	// Optional. Photo size in bytes
	PhotoSize int64 `json:"photo_size,omitempty"`
	// Optional. Photo width
	PhotoWidth int64 `json:"photo_width,omitempty"`
	// Optional. Photo height
	PhotoHeight int64 `json:"photo_height,omitempty"`
	// Optional. Pass True if you require the user's full name to complete the order. Ignored for payments in Telegram Stars.
	NeedName bool `json:"need_name,omitempty"`
	// Optional. Pass True if you require the user's phone number to complete the order. Ignored for payments in Telegram Stars.
	NeedPhoneNumber bool `json:"need_phone_number,omitempty"`
	// Optional. Pass True if you require the user's email address to complete the order. Ignored for payments in Telegram Stars.
	NeedEmail bool `json:"need_email,omitempty"`
	// Optional. Pass True if you require the user's shipping address to complete the order. Ignored for payments in Telegram Stars.
	NeedShippingAddress bool `json:"need_shipping_address,omitempty"`
	// Optional. Pass True if the user's phone number should be sent to the provider. Ignored for payments in Telegram Stars.
	SendPhoneNumberToProvider bool `json:"send_phone_number_to_provider,omitempty"`
	// Optional. Pass True if the user's email address should be sent to the provider. Ignored for payments in Telegram Stars.
	SendEmailToProvider bool `json:"send_email_to_provider,omitempty"`
	// Optional. Pass True if the final price depends on the shipping method. Ignored for payments in Telegram Stars.
	IsFlexible bool `json:"is_flexible,omitempty"`
}

InputFile (https://core.telegram.org/bots/api#inputfile)

This object represents the contents of a file to be uploaded. Must be posted using multipart/form-data in the usual way that files are uploaded via the browser. InputInvoiceMessageContent (https://core.telegram.org/bots/api#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"`
	// Optional. The radius of uncertainty for the location, measured in meters; 0-1500
	HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"`
	// Optional. Period in seconds during which the location can be updated, should be between 60 and 86400, or 0x7FFFFFFF for live locations that can be edited indefinitely.
	LivePeriod int64 `json:"live_period,omitempty"`
	// Optional. For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.
	Heading int64 `json:"heading,omitempty"`
	// Optional. For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.
	ProximityAlertRadius int64 `json:"proximity_alert_radius,omitempty"`
}

InputLocationMessageContent (https://core.telegram.org/bots/api#inputlocationmessagecontent)

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

type InputMedia

type InputMedia interface {
	GetType() string
	GetMedia() InputFileOrString
	// InputParams allows for uploading attachments with files.
	InputParams(string, map[string]FileReader) ([]byte, error)
	// MergeInputMedia returns a MergedInputMedia struct to simplify working with complex telegram types in a non-generic world.
	MergeInputMedia() MergedInputMedia
	// contains filtered or unexported methods
}

InputMedia (https://core.telegram.org/bots/api#inputmedia)

This object represents the content of a media message to be sent. It should be one of

  • InputMediaAnimation
  • InputMediaDocument
  • InputMediaAudio
  • InputMediaPhoto
  • InputMediaVideo

type InputMediaAnimation

type InputMediaAnimation struct {
	// 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. More information on Sending Files: https://core.telegram.org/bots/api#sending-files
	Media InputFileOrString `json:"media"`
	// Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://<file_attach_name>" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files: https://core.telegram.org/bots/api#sending-files
	Thumbnail InputFile `json:"thumbnail,omitempty"`
	// Optional. Caption of the animation to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`
	// Optional. Mode for parsing entities in the animation caption. See formatting options for more details.
	ParseMode string `json:"parse_mode,omitempty"`
	// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
	// Optional. Pass True, if the caption must be shown above the message media
	ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
	// Optional. Animation width
	Width int64 `json:"width,omitempty"`
	// Optional. Animation height
	Height int64 `json:"height,omitempty"`
	// Optional. Animation duration in seconds
	Duration int64 `json:"duration,omitempty"`
	// Optional. Pass True if the animation needs to be covered with a spoiler animation
	HasSpoiler bool `json:"has_spoiler,omitempty"`
}

InputMediaAnimation (https://core.telegram.org/bots/api#inputmediaanimation)

Represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent.

func (InputMediaAnimation) GetMedia

GetMedia is a helper method to easily access the common fields of an interface.

func (InputMediaAnimation) GetType

func (v InputMediaAnimation) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (InputMediaAnimation) InputParams

func (v InputMediaAnimation) InputParams(mediaName string, data map[string]FileReader) ([]byte, error)

func (InputMediaAnimation) MarshalJSON

func (v InputMediaAnimation) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (InputMediaAnimation) MergeInputMedia

func (v InputMediaAnimation) MergeInputMedia() MergedInputMedia

MergeInputMedia returns a MergedInputMedia struct to simplify working with types in a non-generic world.

type InputMediaAudio

type InputMediaAudio struct {
	// 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. More information on Sending Files: https://core.telegram.org/bots/api#sending-files
	Media InputFileOrString `json:"media"`
	// Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://<file_attach_name>" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files: https://core.telegram.org/bots/api#sending-files
	Thumbnail InputFile `json:"thumbnail,omitempty"`
	// Optional. Caption of the audio to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`
	// Optional. Mode for parsing entities in the audio caption. See formatting options for more details.
	ParseMode string `json:"parse_mode,omitempty"`
	// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
	// Optional. Duration of the audio in seconds
	Duration int64 `json:"duration,omitempty"`
	// Optional. Performer of the audio
	Performer string `json:"performer,omitempty"`
	// Optional. Title of the audio
	Title string `json:"title,omitempty"`
}

InputMediaAudio (https://core.telegram.org/bots/api#inputmediaaudio)

Represents an audio file to be treated as music to be sent.

func (InputMediaAudio) GetMedia

func (v InputMediaAudio) GetMedia() InputFileOrString

GetMedia is a helper method to easily access the common fields of an interface.

func (InputMediaAudio) GetType

func (v InputMediaAudio) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (InputMediaAudio) InputParams

func (v InputMediaAudio) InputParams(mediaName string, data map[string]FileReader) ([]byte, error)

func (InputMediaAudio) MarshalJSON

func (v InputMediaAudio) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (InputMediaAudio) MergeInputMedia

func (v InputMediaAudio) MergeInputMedia() MergedInputMedia

MergeInputMedia returns a MergedInputMedia struct to simplify working with types in a non-generic world.

type InputMediaDocument

type InputMediaDocument struct {
	// 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. More information on Sending Files: https://core.telegram.org/bots/api#sending-files
	Media InputFileOrString `json:"media"`
	// Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://<file_attach_name>" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files: https://core.telegram.org/bots/api#sending-files
	Thumbnail InputFile `json:"thumbnail,omitempty"`
	// Optional. Caption of the document to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`
	// Optional. Mode for parsing entities in the document caption. See formatting options for more details.
	ParseMode string `json:"parse_mode,omitempty"`
	// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
	// Optional. 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 (https://core.telegram.org/bots/api#inputmediadocument)

Represents a general file to be sent.

func (InputMediaDocument) GetMedia

GetMedia is a helper method to easily access the common fields of an interface.

func (InputMediaDocument) GetType

func (v InputMediaDocument) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (InputMediaDocument) InputParams

func (v InputMediaDocument) InputParams(mediaName string, data map[string]FileReader) ([]byte, error)

func (InputMediaDocument) MarshalJSON

func (v InputMediaDocument) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (InputMediaDocument) MergeInputMedia

func (v InputMediaDocument) MergeInputMedia() MergedInputMedia

MergeInputMedia returns a MergedInputMedia struct to simplify working with types in a non-generic world.

type InputMediaPhoto

type InputMediaPhoto struct {
	// 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. More information on Sending Files: https://core.telegram.org/bots/api#sending-files
	Media InputFileOrString `json:"media"`
	// Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`
	// Optional. Mode for parsing entities in the photo caption. See formatting options for more details.
	ParseMode string `json:"parse_mode,omitempty"`
	// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
	// Optional. Pass True, if the caption must be shown above the message media
	ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
	// Optional. Pass True if the photo needs to be covered with a spoiler animation
	HasSpoiler bool `json:"has_spoiler,omitempty"`
}

InputMediaPhoto (https://core.telegram.org/bots/api#inputmediaphoto)

Represents a photo to be sent.

func (InputMediaPhoto) GetMedia

func (v InputMediaPhoto) GetMedia() InputFileOrString

GetMedia is a helper method to easily access the common fields of an interface.

func (InputMediaPhoto) GetType

func (v InputMediaPhoto) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (InputMediaPhoto) InputParams

func (v InputMediaPhoto) InputParams(mediaName string, data map[string]FileReader) ([]byte, error)

func (InputMediaPhoto) MarshalJSON

func (v InputMediaPhoto) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (InputMediaPhoto) MergeInputMedia

func (v InputMediaPhoto) MergeInputMedia() MergedInputMedia

MergeInputMedia returns a MergedInputMedia struct to simplify working with types in a non-generic world.

type InputMediaVideo

type InputMediaVideo struct {
	// 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. More information on Sending Files: https://core.telegram.org/bots/api#sending-files
	Media InputFileOrString `json:"media"`
	// Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://<file_attach_name>" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files: https://core.telegram.org/bots/api#sending-files
	Thumbnail InputFile `json:"thumbnail,omitempty"`
	// Optional. Caption of the video to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`
	// Optional. Mode for parsing entities in the video caption. See formatting options for more details.
	ParseMode string `json:"parse_mode,omitempty"`
	// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
	// Optional. Pass True, if the caption must be shown above the message media
	ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
	// Optional. Video width
	Width int64 `json:"width,omitempty"`
	// Optional. Video height
	Height int64 `json:"height,omitempty"`
	// Optional. Video duration in seconds
	Duration int64 `json:"duration,omitempty"`
	// Optional. Pass True if the uploaded video is suitable for streaming
	SupportsStreaming bool `json:"supports_streaming,omitempty"`
	// Optional. Pass True if the video needs to be covered with a spoiler animation
	HasSpoiler bool `json:"has_spoiler,omitempty"`
}

InputMediaVideo (https://core.telegram.org/bots/api#inputmediavideo)

Represents a video to be sent.

func (InputMediaVideo) GetMedia

func (v InputMediaVideo) GetMedia() InputFileOrString

GetMedia is a helper method to easily access the common fields of an interface.

func (InputMediaVideo) GetType

func (v InputMediaVideo) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (InputMediaVideo) InputParams

func (v InputMediaVideo) InputParams(mediaName string, data map[string]FileReader) ([]byte, error)

func (InputMediaVideo) MarshalJSON

func (v InputMediaVideo) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (InputMediaVideo) MergeInputMedia

func (v InputMediaVideo) MergeInputMedia() MergedInputMedia

MergeInputMedia returns a MergedInputMedia struct to simplify working with types in a non-generic world.

type InputMessageContent

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

InputMessageContent (https://core.telegram.org/bots/api#inputmessagecontent)

This object represents the content of a message to be sent as a result of an inline query. Telegram clients currently support the following 5 types:

  • InputTextMessageContent
  • InputLocationMessageContent
  • InputVenueMessageContent
  • InputContactMessageContent
  • InputInvoiceMessageContent

type InputPaidMedia added in v2.1.0

type InputPaidMedia interface {
	GetType() string
	GetMedia() InputFileOrString
	// InputParams allows for uploading attachments with files.
	InputParams(string, map[string]FileReader) ([]byte, error)
	// MergeInputPaidMedia returns a MergedInputPaidMedia struct to simplify working with complex telegram types in a non-generic world.
	MergeInputPaidMedia() MergedInputPaidMedia
	// contains filtered or unexported methods
}

InputPaidMedia (https://core.telegram.org/bots/api#inputpaidmedia)

This object describes the paid media to be sent. Currently, it can be one of

  • InputPaidMediaPhoto
  • InputPaidMediaVideo

type InputPaidMediaPhoto added in v2.1.0

type InputPaidMediaPhoto struct {
	// 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. More information on Sending Files: https://core.telegram.org/bots/api#sending-files
	Media InputFileOrString `json:"media"`
}

InputPaidMediaPhoto (https://core.telegram.org/bots/api#inputpaidmediaphoto)

The paid media to send is a photo.

func (InputPaidMediaPhoto) GetMedia added in v2.1.0

GetMedia is a helper method to easily access the common fields of an interface.

func (InputPaidMediaPhoto) GetType added in v2.1.0

func (v InputPaidMediaPhoto) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (InputPaidMediaPhoto) InputParams added in v2.1.0

func (v InputPaidMediaPhoto) InputParams(mediaName string, data map[string]FileReader) ([]byte, error)

func (InputPaidMediaPhoto) MarshalJSON added in v2.1.0

func (v InputPaidMediaPhoto) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (InputPaidMediaPhoto) MergeInputPaidMedia added in v2.1.0

func (v InputPaidMediaPhoto) MergeInputPaidMedia() MergedInputPaidMedia

MergeInputPaidMedia returns a MergedInputPaidMedia struct to simplify working with types in a non-generic world.

type InputPaidMediaVideo added in v2.1.0

type InputPaidMediaVideo struct {
	// 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. More information on Sending Files: https://core.telegram.org/bots/api#sending-files
	Media InputFileOrString `json:"media"`
	// Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://<file_attach_name>" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files: https://core.telegram.org/bots/api#sending-files
	Thumbnail InputFile `json:"thumbnail,omitempty"`
	// Optional. Video width
	Width int64 `json:"width,omitempty"`
	// Optional. Video height
	Height int64 `json:"height,omitempty"`
	// Optional. Video duration in seconds
	Duration int64 `json:"duration,omitempty"`
	// Optional. Pass True if the uploaded video is suitable for streaming
	SupportsStreaming bool `json:"supports_streaming,omitempty"`
}

InputPaidMediaVideo (https://core.telegram.org/bots/api#inputpaidmediavideo)

The paid media to send is a video.

func (InputPaidMediaVideo) GetMedia added in v2.1.0

GetMedia is a helper method to easily access the common fields of an interface.

func (InputPaidMediaVideo) GetType added in v2.1.0

func (v InputPaidMediaVideo) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (InputPaidMediaVideo) InputParams added in v2.1.0

func (v InputPaidMediaVideo) InputParams(mediaName string, data map[string]FileReader) ([]byte, error)

func (InputPaidMediaVideo) MarshalJSON added in v2.1.0

func (v InputPaidMediaVideo) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (InputPaidMediaVideo) MergeInputPaidMedia added in v2.1.0

func (v InputPaidMediaVideo) MergeInputPaidMedia() MergedInputPaidMedia

MergeInputPaidMedia returns a MergedInputPaidMedia struct to simplify working with types in a non-generic world.

type InputPollOption added in v2.1.0

type InputPollOption struct {
	// Option text, 1-100 characters
	Text string `json:"text"`
	// Optional. Mode for parsing entities in the text. See formatting options for more details. Currently, only custom emoji entities are allowed
	TextParseMode string `json:"text_parse_mode,omitempty"`
	// Optional. A JSON-serialized list of special entities that appear in the poll option text. It can be specified instead of text_parse_mode
	TextEntities []MessageEntity `json:"text_entities,omitempty"`
}

InputPollOption (https://core.telegram.org/bots/api#inputpolloption)

This object contains information about one answer option in a poll to be sent.

type InputSticker

type InputSticker struct {
	// The added sticker. 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, upload a new one using multipart/form-data, or pass "attach://<file_attach_name>" to upload a new one using multipart/form-data under <file_attach_name> name. Animated and video stickers can't be uploaded via HTTP URL. More information on Sending Files: https://core.telegram.org/bots/api#sending-files
	Sticker InputFileOrString `json:"sticker"`
	// Format of the added sticker, must be one of "static" for a .WEBP or .PNG image, "animated" for a .TGS animation, "video" for a WEBM video
	Format string `json:"format"`
	// List of 1-20 emoji associated with the sticker
	EmojiList []string `json:"emoji_list,omitempty"`
	// Optional. Position where the mask should be placed on faces. For "mask" stickers only.
	MaskPosition *MaskPosition `json:"mask_position,omitempty"`
	// Optional. List of 0-20 search keywords for the sticker with total length of up to 64 characters. For "regular" and "custom_emoji" stickers only.
	Keywords []string `json:"keywords,omitempty"`
}

InputSticker (https://core.telegram.org/bots/api#inputsticker)

This object describes a sticker to be added to a sticker set.

func (InputSticker) InputParams

func (v InputSticker) InputParams(mediaName string, data map[string]FileReader) ([]byte, error)

type InputTextMessageContent

type InputTextMessageContent struct {
	// Text of the message to be sent, 1-4096 characters
	MessageText string `json:"message_text"`
	// Optional. Mode for parsing entities in the message text. See formatting options for more details.
	ParseMode string `json:"parse_mode,omitempty"`
	// Optional. List of special entities that appear in message text, which can be specified instead of parse_mode
	Entities []MessageEntity `json:"entities,omitempty"`
	// Optional. Link preview generation options for the message
	LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options,omitempty"`
}

InputTextMessageContent (https://core.telegram.org/bots/api#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 venue in degrees
	Latitude float64 `json:"latitude"`
	// Longitude of the venue in degrees
	Longitude float64 `json:"longitude"`
	// Name of the venue
	Title string `json:"title"`
	// Address of the venue
	Address string `json:"address"`
	// Optional. Foursquare identifier of the venue, if known
	FoursquareId string `json:"foursquare_id,omitempty"`
	// Optional. Foursquare type of the venue, if known. (For example, "arts_entertainment/default", "arts_entertainment/aquarium" or "food/icecream".)
	FoursquareType string `json:"foursquare_type,omitempty"`
	// Optional. Google Places identifier of the venue
	GooglePlaceId string `json:"google_place_id,omitempty"`
	// Optional. Google Places type of the venue. (See supported types.)
	GooglePlaceType string `json:"google_place_type,omitempty"`
}

InputVenueMessageContent (https://core.telegram.org/bots/api#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, or "XTR" for payments in Telegram Stars
	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 int64 `json:"total_amount"`
}

Invoice (https://core.telegram.org/bots/api#invoice)

This object contains basic information about an invoice.

type KeyboardButton

type KeyboardButton struct {
	// Text of the button. If none of the optional fields are used, it will be sent as a message when the button is pressed
	Text string `json:"text"`
	// Optional. If specified, pressing the button will open a list of suitable users. Identifiers of selected users will be sent to the bot in a "users_shared" service message. Available in private chats only.
	RequestUsers *KeyboardButtonRequestUsers `json:"request_users,omitempty"`
	// Optional. If specified, pressing the button will open a list of suitable chats. Tapping on a chat will send its identifier to the bot in a "chat_shared" service message. Available in private chats only.
	RequestChat *KeyboardButtonRequestChat `json:"request_chat,omitempty"`
	// Optional. If True, the user's phone number will be sent as a contact when the button is pressed. Available in private chats only.
	RequestContact bool `json:"request_contact,omitempty"`
	// Optional. If True, the user's current location will be sent when the button is pressed. Available in private chats only.
	RequestLocation bool `json:"request_location,omitempty"`
	// Optional. If specified, the user will be asked to create a poll and send it to the bot when the button is pressed. Available in private chats only.
	RequestPoll *KeyboardButtonPollType `json:"request_poll,omitempty"`
	// Optional. If specified, the described Web App will be launched when the button is pressed. The Web App will be able to send a "web_app_data" service message. Available in private chats only.
	WebApp *WebAppInfo `json:"web_app,omitempty"`
}

KeyboardButton (https://core.telegram.org/bots/api#keyboardbutton)

This object represents one button of the reply keyboard. At most one of the optional fields must be used to specify type of the button. For simple text buttons, String can be used instead of this object to specify the button text. Note: request_users and request_chat options will only work in Telegram versions released after 3 February, 2023. Older clients will display unsupported message.

type KeyboardButtonPollType

type KeyboardButtonPollType struct {
	// Optional. If quiz is passed, the user will be allowed to create only polls in the quiz mode. If regular is passed, only regular polls will be allowed. Otherwise, the user will be allowed to create a poll of any type.
	Type string `json:"type,omitempty"`
}

KeyboardButtonPollType (https://core.telegram.org/bots/api#keyboardbuttonpolltype)

This object represents type of a poll, which is allowed to be created and sent when the corresponding button is pressed.

type KeyboardButtonRequestChat

type KeyboardButtonRequestChat struct {
	// Signed 32-bit identifier of the request, which will be received back in the ChatShared object. Must be unique within the message
	RequestId int64 `json:"request_id"`
	// Pass True to request a channel chat, pass False to request a group or a supergroup chat.
	ChatIsChannel bool `json:"chat_is_channel"`
	// Optional. Pass True to request a forum supergroup, pass False to request a non-forum chat. If not specified, no additional restrictions are applied.
	ChatIsForum *bool `json:"chat_is_forum,omitempty"`
	// Optional. Pass True to request a supergroup or a channel with a username, pass False to request a chat without a username. If not specified, no additional restrictions are applied.
	ChatHasUsername *bool `json:"chat_has_username,omitempty"`
	// Optional. Pass True to request a chat owned by the user. Otherwise, no additional restrictions are applied.
	ChatIsCreated bool `json:"chat_is_created,omitempty"`
	// Optional. A JSON-serialized object listing the required administrator rights of the user in the chat. The rights must be a superset of bot_administrator_rights. If not specified, no additional restrictions are applied.
	UserAdministratorRights *ChatAdministratorRights `json:"user_administrator_rights,omitempty"`
	// Optional. A JSON-serialized object listing the required administrator rights of the bot in the chat. The rights must be a subset of user_administrator_rights. If not specified, no additional restrictions are applied.
	BotAdministratorRights *ChatAdministratorRights `json:"bot_administrator_rights,omitempty"`
	// Optional. Pass True to request a chat with the bot as a member. Otherwise, no additional restrictions are applied.
	BotIsMember bool `json:"bot_is_member,omitempty"`
	// Optional. Pass True to request the chat's title
	RequestTitle bool `json:"request_title,omitempty"`
	// Optional. Pass True to request the chat's username
	RequestUsername bool `json:"request_username,omitempty"`
	// Optional. Pass True to request the chat's photo
	RequestPhoto bool `json:"request_photo,omitempty"`
}

KeyboardButtonRequestChat (https://core.telegram.org/bots/api#keyboardbuttonrequestchat)

This object defines the criteria used to request a suitable chat. Information about the selected chat will be shared with the bot when the corresponding button is pressed. The bot will be granted requested rights in the chat if appropriate. More about requesting chats: https://core.telegram.org/bots/features#chat-and-user-selection.

type KeyboardButtonRequestUsers added in v2.1.0

type KeyboardButtonRequestUsers struct {
	// Signed 32-bit identifier of the request that will be received back in the UsersShared object. Must be unique within the message
	RequestId int64 `json:"request_id"`
	// Optional. Pass True to request bots, pass False to request regular users. If not specified, no additional restrictions are applied.
	UserIsBot *bool `json:"user_is_bot,omitempty"`
	// Optional. Pass True to request premium users, pass False to request non-premium users. If not specified, no additional restrictions are applied.
	UserIsPremium *bool `json:"user_is_premium,omitempty"`
	// Optional. The maximum number of users to be selected; 1-10. Defaults to 1.
	MaxQuantity int64 `json:"max_quantity,omitempty"`
	// Optional. Pass True to request the users' first and last names
	RequestName bool `json:"request_name,omitempty"`
	// Optional. Pass True to request the users' usernames
	RequestUsername bool `json:"request_username,omitempty"`
	// Optional. Pass True to request the users' photos
	RequestPhoto bool `json:"request_photo,omitempty"`
}

KeyboardButtonRequestUsers (https://core.telegram.org/bots/api#keyboardbuttonrequestusers)

This object defines the criteria used to request suitable users. Information about the selected users will be shared with the bot when the corresponding button is pressed. More about requesting users: https://core.telegram.org/bots/features#chat-and-user-selection

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 int64 `json:"amount"`
}

LabeledPrice (https://core.telegram.org/bots/api#labeledprice)

This object represents a portion of the price for goods or services.

type LeaveChatOpts

type LeaveChatOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

LeaveChatOpts is the set of optional fields for Bot.LeaveChat.

type LinkPreviewOptions added in v2.1.0

type LinkPreviewOptions struct {
	// Optional. True, if the link preview is disabled
	IsDisabled bool `json:"is_disabled,omitempty"`
	// Optional. URL to use for the link preview. If empty, then the first URL found in the message text will be used
	Url string `json:"url,omitempty"`
	// Optional. True, if the media in the link preview is supposed to be shrunk; ignored if the URL isn't explicitly specified or media size change isn't supported for the preview
	PreferSmallMedia bool `json:"prefer_small_media,omitempty"`
	// Optional. True, if the media in the link preview is supposed to be enlarged; ignored if the URL isn't explicitly specified or media size change isn't supported for the preview
	PreferLargeMedia bool `json:"prefer_large_media,omitempty"`
	// Optional. True, if the link preview must be shown above the message text; otherwise, the link preview will be shown below the message text
	ShowAboveText bool `json:"show_above_text,omitempty"`
}

LinkPreviewOptions (https://core.telegram.org/bots/api#linkpreviewoptions)

Describes the options used for link preview generation.

type Location

type Location struct {
	// Latitude as defined by the sender
	Latitude float64 `json:"latitude"`
	// Longitude as defined by the sender
	Longitude float64 `json:"longitude"`
	// Optional. The radius of uncertainty for the location, measured in meters; 0-1500
	HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"`
	// Optional. Time relative to the message sending date, during which the location can be updated; in seconds. For active live locations only.
	LivePeriod int64 `json:"live_period,omitempty"`
	// Optional. The direction in which user is moving, in degrees; 1-360. For active live locations only.
	Heading int64 `json:"heading,omitempty"`
	// Optional. The maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only.
	ProximityAlertRadius int64 `json:"proximity_alert_radius,omitempty"`
}

Location (https://core.telegram.org/bots/api#location)

This object represents a point on the map.

type LogOutOpts

type LogOutOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

LogOutOpts is the set of optional fields for Bot.LogOut.

type LoginUrl

type LoginUrl struct {
	// An HTTPS 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"`
	// Optional. New text of the button in forwarded messages.
	ForwardText string `json:"forward_text,omitempty"`
	// Optional. Username of a bot, which will be used for user authorization. See Setting up a bot for more details. If not specified, the current bot's username will be assumed. The url's domain must be the same as the domain linked with the bot. See Linking your domain to the bot for more details.
	BotUsername *string `json:"bot_username,omitempty"`
	// Optional. Pass True to request the permission for your bot to send messages to the user.
	RequestWriteAccess bool `json:"request_write_access,omitempty"`
}

LoginUrl (https://core.telegram.org/bots/api#loginurl)

This object represents a parameter of the inline keyboard button used to automatically authorize a user. Serves as a great replacement for the Telegram Login Widget when the user is coming from Telegram. All the user needs to do is tap/click a button and confirm that they want to log in: Telegram apps support these buttons as of version 5.7.

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 (https://core.telegram.org/bots/api#maskposition)

This object describes the position on faces where a mask should be placed by default.

type MaybeInaccessibleMessage added in v2.1.0

type MaybeInaccessibleMessage interface {
	GetMessageId() int64
	GetDate() int64
	GetChat() Chat

	// Helper methods shared across all subtypes of this interface.
	// Copy Helper method for Bot.CopyMessage.
	Copy(b *Bot, chatId int64, opts *CopyMessageOpts) (*MessageId, error)
	// Delete Helper method for Bot.DeleteMessage.
	Delete(b *Bot, opts *DeleteMessageOpts) (bool, error)
	// EditCaption Helper method for Bot.EditMessageCaption.
	EditCaption(b *Bot, opts *EditMessageCaptionOpts) (*Message, bool, error)
	// EditLiveLocation Helper method for Bot.EditMessageLiveLocation.
	EditLiveLocation(b *Bot, latitude float64, longitude float64, opts *EditMessageLiveLocationOpts) (*Message, bool, error)
	// EditMedia Helper method for Bot.EditMessageMedia.
	EditMedia(b *Bot, media InputMedia, opts *EditMessageMediaOpts) (*Message, bool, error)
	// EditReplyMarkup Helper method for Bot.EditMessageReplyMarkup.
	EditReplyMarkup(b *Bot, opts *EditMessageReplyMarkupOpts) (*Message, bool, error)
	// EditText Helper method for Bot.EditMessageText.
	EditText(b *Bot, text string, opts *EditMessageTextOpts) (*Message, bool, error)
	// Forward Helper method for Bot.ForwardMessage.
	Forward(b *Bot, chatId int64, opts *ForwardMessageOpts) (*Message, error)
	// Pin Helper method for Bot.PinChatMessage.
	Pin(b *Bot, opts *PinChatMessageOpts) (bool, error)
	// SetReaction Helper method for Bot.SetMessageReaction.
	SetReaction(b *Bot, opts *SetMessageReactionOpts) (bool, error)
	// StopLiveLocation Helper method for Bot.StopMessageLiveLocation.
	StopLiveLocation(b *Bot, opts *StopMessageLiveLocationOpts) (*Message, bool, error)
	// Unpin Helper method for Bot.UnpinChatMessage.
	Unpin(b *Bot, opts *UnpinChatMessageOpts) (bool, error)
	// contains filtered or unexported methods
}

MaybeInaccessibleMessage (https://core.telegram.org/bots/api#maybeinaccessiblemessage)

This object describes a message that can be inaccessible to the bot. It can be one of

  • Message
  • InaccessibleMessage
type MenuButton interface {
	GetType() string
	// MergeMenuButton returns a MergedMenuButton struct to simplify working with complex telegram types in a non-generic world.
	MergeMenuButton() MergedMenuButton
	// contains filtered or unexported methods
}

MenuButton (https://core.telegram.org/bots/api#menubutton)

This object describes the bot's menu button in a private chat. It should be one of

  • MenuButtonCommands
  • MenuButtonWebApp
  • MenuButtonDefault

If a menu button other than MenuButtonDefault is set for a private chat, then it is applied in the chat. Otherwise the default menu button is applied. By default, the menu button opens the list of bot commands.

type MenuButtonCommands struct{}

MenuButtonCommands (https://core.telegram.org/bots/api#menubuttoncommands)

Represents a menu button, which opens the bot's list of commands.

func (v MenuButtonCommands) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (v MenuButtonCommands) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (v MenuButtonCommands) MergeMenuButton() MergedMenuButton

MergeMenuButton returns a MergedMenuButton struct to simplify working with types in a non-generic world.

type MenuButtonDefault struct{}

MenuButtonDefault (https://core.telegram.org/bots/api#menubuttondefault)

Describes that no specific value for the menu button was set.

func (v MenuButtonDefault) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (v MenuButtonDefault) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (v MenuButtonDefault) MergeMenuButton() MergedMenuButton

MergeMenuButton returns a MergedMenuButton struct to simplify working with types in a non-generic world.

type MenuButtonWebApp struct {
	// Text on the button
	Text string `json:"text"`
	// Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. Alternatively, a t.me link to a Web App of the bot can be specified in the object instead of the Web App's URL, in which case the Web App will be opened as if the user pressed the link.
	WebApp WebAppInfo `json:"web_app"`
}

MenuButtonWebApp (https://core.telegram.org/bots/api#menubuttonwebapp)

Represents a menu button, which launches a Web App.

func (v MenuButtonWebApp) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (v MenuButtonWebApp) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (v MenuButtonWebApp) MergeMenuButton() MergedMenuButton

MergeMenuButton returns a MergedMenuButton struct to simplify working with types in a non-generic world.

type MergedBackgroundFill added in v2.1.0

type MergedBackgroundFill struct {
	// Type of the background fill
	Type string `json:"type"`
	// Optional. The color of the background fill in the RGB24 format (Only for solid)
	Color int64 `json:"color,omitempty"`
	// Optional. Top color of the gradient in the RGB24 format (Only for gradient)
	TopColor int64 `json:"top_color,omitempty"`
	// Optional. Bottom color of the gradient in the RGB24 format (Only for gradient)
	BottomColor int64 `json:"bottom_color,omitempty"`
	// Optional. Clockwise rotation angle of the background fill in degrees; 0-359 (Only for gradient)
	RotationAngle int64 `json:"rotation_angle,omitempty"`
	// Optional. A list of the 3 or 4 base colors that are used to generate the freeform gradient in the RGB24 format (Only for freeform_gradient)
	Colors []int64 `json:"colors,omitempty"`
}

MergedBackgroundFill is a helper type to simplify interactions with the various BackgroundFill subtypes.

func (MergedBackgroundFill) GetType added in v2.1.0

func (v MergedBackgroundFill) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (MergedBackgroundFill) MergeBackgroundFill added in v2.1.0

func (v MergedBackgroundFill) MergeBackgroundFill() MergedBackgroundFill

MergeBackgroundFill returns a MergedBackgroundFill struct to simplify working with types in a non-generic world.

type MergedBackgroundType added in v2.1.0

type MergedBackgroundType struct {
	// Type of the background
	Type string `json:"type"`
	// Optional. The background fill (Only for fill, pattern)
	Fill BackgroundFill `json:"fill,omitempty"`
	// Optional. Dimming of the background in dark themes, as a percentage; 0-100 (Only for fill, wallpaper)
	DarkThemeDimming int64 `json:"dark_theme_dimming,omitempty"`
	// Optional. Document with the wallpaper (Only for wallpaper, pattern)
	Document *Document `json:"document,omitempty"`
	// Optional. True, if the wallpaper is downscaled to fit in a 450x450 square and then box-blurred with radius 12 (Only for wallpaper)
	IsBlurred bool `json:"is_blurred,omitempty"`
	// Optional. True, if the background moves slightly when the device is tilted (Only for wallpaper, pattern)
	IsMoving bool `json:"is_moving,omitempty"`
	// Optional. Intensity of the pattern when it is shown above the filled background; 0-100 (Only for pattern)
	Intensity int64 `json:"intensity,omitempty"`
	// Optional. True, if the background fill must be applied only to the pattern itself. All other pixels are black in this case. For dark themes only (Only for pattern)
	IsInverted bool `json:"is_inverted,omitempty"`
	// Optional. Name of the chat theme, which is usually an emoji (Only for chat_theme)
	ThemeName string `json:"theme_name,omitempty"`
}

MergedBackgroundType is a helper type to simplify interactions with the various BackgroundType subtypes.

func (MergedBackgroundType) GetType added in v2.1.0

func (v MergedBackgroundType) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (MergedBackgroundType) MergeBackgroundType added in v2.1.0

func (v MergedBackgroundType) MergeBackgroundType() MergedBackgroundType

MergeBackgroundType returns a MergedBackgroundType struct to simplify working with types in a non-generic world.

type MergedBotCommandScope

type MergedBotCommandScope struct {
	// Scope type
	Type string `json:"type"`
	// Optional. Unique identifier for the target chat (Only for chat, chat_administrators, chat_member)
	ChatId int64 `json:"chat_id,omitempty"`
	// Optional. Unique identifier of the target user (Only for chat_member)
	UserId int64 `json:"user_id,omitempty"`
}

MergedBotCommandScope is a helper type to simplify interactions with the various BotCommandScope subtypes.

func (MergedBotCommandScope) GetType

func (v MergedBotCommandScope) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (MergedBotCommandScope) MergeBotCommandScope

func (v MergedBotCommandScope) MergeBotCommandScope() MergedBotCommandScope

MergeBotCommandScope returns a MergedBotCommandScope struct to simplify working with types in a non-generic world.

type MergedChatBoostSource added in v2.1.0

type MergedChatBoostSource struct {
	// Source of the boost
	Source string `json:"source"`
	// Optional. User that provided the boost (may be empty for ChatBoostSourceGiveaway)
	User *User `json:"user,omitempty"`
	// Optional. Identifier of a message in the chat with the giveaway; the message could have been deleted already. May be 0 if the message isn't sent yet. (Only for giveaway)
	GiveawayMessageId int64 `json:"giveaway_message_id,omitempty"`
	// Optional. True, if the giveaway was completed, but there was no user to win the prize (Only for giveaway)
	IsUnclaimed bool `json:"is_unclaimed,omitempty"`
}

MergedChatBoostSource is a helper type to simplify interactions with the various ChatBoostSource subtypes.

func (MergedChatBoostSource) GetSource added in v2.1.0

func (v MergedChatBoostSource) GetSource() string

GetSource is a helper method to easily access the common fields of an interface.

func (MergedChatBoostSource) MergeChatBoostSource added in v2.1.0

func (v MergedChatBoostSource) MergeChatBoostSource() MergedChatBoostSource

MergeChatBoostSource returns a MergedChatBoostSource struct to simplify working with types in a non-generic world.

type MergedChatMember

type MergedChatMember struct {
	// The member's status in the chat
	Status string `json:"status"`
	// Information about the user
	User User `json:"user"`
	// Optional. True, if the user's presence in the chat is hidden (Only for creator, administrator)
	IsAnonymous bool `json:"is_anonymous,omitempty"`
	// Optional. Custom title for this user (Only for creator, administrator)
	CustomTitle string `json:"custom_title,omitempty"`
	// Optional. True, if the bot is allowed to edit administrator privileges of that user (Only for administrator)
	CanBeEdited bool `json:"can_be_edited,omitempty"`
	// Optional. True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages and ignore slow mode. Implied by any other administrator privilege. (Only for administrator)
	CanManageChat bool `json:"can_manage_chat,omitempty"`
	// Optional. True, if the administrator can delete messages of other users (Only for administrator)
	CanDeleteMessages bool `json:"can_delete_messages,omitempty"`
	// Optional. True, if the administrator can manage video chats (Only for administrator)
	CanManageVideoChats bool `json:"can_manage_video_chats,omitempty"`
	// Optional. True, if the administrator can restrict, ban or unban chat members, or access supergroup statistics (Only for administrator)
	CanRestrictMembers bool `json:"can_restrict_members,omitempty"`
	// Optional. True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by the user) (Only for administrator)
	CanPromoteMembers bool `json:"can_promote_members,omitempty"`
	// Optional. True, if the user is allowed to change the chat title, photo and other settings (Only for administrator, restricted)
	CanChangeInfo bool `json:"can_change_info,omitempty"`
	// Optional. True, if the user is allowed to invite new users to the chat (Only for administrator, restricted)
	CanInviteUsers bool `json:"can_invite_users,omitempty"`
	// Optional. True, if the administrator can post stories to the chat (Only for administrator)
	CanPostStories bool `json:"can_post_stories,omitempty"`
	// Optional. True, if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access the chat's story archive (Only for administrator)
	CanEditStories bool `json:"can_edit_stories,omitempty"`
	// Optional. True, if the administrator can delete stories posted by other users (Only for administrator)
	CanDeleteStories bool `json:"can_delete_stories,omitempty"`
	// Optional. True, if the administrator can post messages in the channel, or access channel statistics; for channels only (Only for administrator)
	CanPostMessages bool `json:"can_post_messages,omitempty"`
	// Optional. True, if the administrator can edit messages of other users and can pin messages; for channels only (Only for administrator)
	CanEditMessages bool `json:"can_edit_messages,omitempty"`
	// Optional. True, if the user is allowed to pin messages; for groups and supergroups only (Only for administrator, restricted)
	CanPinMessages bool `json:"can_pin_messages,omitempty"`
	// Optional. True, if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only (Only for administrator, restricted)
	CanManageTopics bool `json:"can_manage_topics,omitempty"`
	// Optional. Date when the user's subscription will expire; Unix time (Only for member, restricted, kicked)
	UntilDate int64 `json:"until_date,omitempty"`
	// Optional. True, if the user is a member of the chat at the moment of the request (Only for restricted)
	IsMember bool `json:"is_member,omitempty"`
	// Optional. True, if the user is allowed to send text messages, contacts, giveaways, giveaway winners, invoices, locations and venues (Only for restricted)
	CanSendMessages bool `json:"can_send_messages,omitempty"`
	// Optional. True, if the user is allowed to send audios (Only for restricted)
	CanSendAudios bool `json:"can_send_audios,omitempty"`
	// Optional. True, if the user is allowed to send documents (Only for restricted)
	CanSendDocuments bool `json:"can_send_documents,omitempty"`
	// Optional. True, if the user is allowed to send photos (Only for restricted)
	CanSendPhotos bool `json:"can_send_photos,omitempty"`
	// Optional. True, if the user is allowed to send videos (Only for restricted)
	CanSendVideos bool `json:"can_send_videos,omitempty"`
	// Optional. True, if the user is allowed to send video notes (Only for restricted)
	CanSendVideoNotes bool `json:"can_send_video_notes,omitempty"`
	// Optional. True, if the user is allowed to send voice notes (Only for restricted)
	CanSendVoiceNotes bool `json:"can_send_voice_notes,omitempty"`
	// Optional. True, if the user is allowed to send polls (Only for restricted)
	CanSendPolls bool `json:"can_send_polls,omitempty"`
	// Optional. True, if the user is allowed to send animations, games, stickers and use inline bots (Only for restricted)
	CanSendOtherMessages bool `json:"can_send_other_messages,omitempty"`
	// Optional. True, if the user is allowed to add web page previews to their messages (Only for restricted)
	CanAddWebPagePreviews bool `json:"can_add_web_page_previews,omitempty"`
}

MergedChatMember is a helper type to simplify interactions with the various ChatMember subtypes.

func (MergedChatMember) GetStatus

func (v MergedChatMember) GetStatus() string

GetStatus is a helper method to easily access the common fields of an interface.

func (MergedChatMember) GetUser

func (v MergedChatMember) GetUser() User

GetUser is a helper method to easily access the common fields of an interface.

func (MergedChatMember) MergeChatMember

func (v MergedChatMember) MergeChatMember() MergedChatMember

MergeChatMember returns a MergedChatMember struct to simplify working with types in a non-generic world.

type MergedInlineQueryResult

type MergedInlineQueryResult struct {
	// Type of the result
	Type string `json:"type"`
	// Unique identifier for this result, 1-64 bytes
	Id string `json:"id"`
	// Optional. A valid file identifier for the audio file (Only for audio)
	AudioFileId string `json:"audio_file_id,omitempty"`
	// Optional. Caption, 0-1024 characters after entities parsing (Only for audio, document, gif, mpeg4_gif, photo, video, voice, audio, document, gif, mpeg4_gif, photo, video, voice)
	Caption string `json:"caption,omitempty"`
	// Optional. Mode for parsing entities in the audio caption. See formatting options for more details. (Only for audio, document, gif, mpeg4_gif, photo, video, voice, audio, document, gif, mpeg4_gif, photo, video, voice)
	ParseMode string `json:"parse_mode,omitempty"`
	// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode (Only for audio, document, gif, mpeg4_gif, photo, video, voice, audio, document, gif, mpeg4_gif, photo, video, voice)
	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
	// Optional. Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
	// Optional. Content of the message to be sent instead of the audio (Only for audio, document, gif, mpeg4_gif, photo, sticker, video, voice, article, audio, contact, document, gif, location, mpeg4_gif, photo, venue, video, voice)
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
	// Optional. Title for the result (Only for document, gif, mpeg4_gif, photo, video, voice, article, audio, document, gif, location, mpeg4_gif, photo, venue, video, voice)
	Title string `json:"title,omitempty"`
	// Optional. A valid file identifier for the file (Only for document)
	DocumentFileId string `json:"document_file_id,omitempty"`
	// Optional. Short description of the result (Only for document, photo, video, article, document, photo, video)
	Description string `json:"description,omitempty"`
	// Optional. A valid file identifier for the GIF file (Only for gif)
	GifFileId string `json:"gif_file_id,omitempty"`
	// Optional. Pass True, if the caption must be shown above the message media (Only for gif, mpeg4_gif, photo, video, gif, mpeg4_gif, photo, video)
	ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
	// Optional. A valid file identifier for the MPEG4 file (Only for mpeg4_gif)
	Mpeg4FileId string `json:"mpeg4_file_id,omitempty"`
	// Optional. A valid file identifier of the photo (Only for photo)
	PhotoFileId string `json:"photo_file_id,omitempty"`
	// Optional. A valid file identifier of the sticker (Only for sticker)
	StickerFileId string `json:"sticker_file_id,omitempty"`
	// Optional. A valid file identifier for the video file (Only for video)
	VideoFileId string `json:"video_file_id,omitempty"`
	// Optional. A valid file identifier for the voice message (Only for voice)
	VoiceFileId string `json:"voice_file_id,omitempty"`
	// Optional. URL of the result (Only for article)
	Url string `json:"url,omitempty"`
	// Optional. Pass True if you don't want the URL to be shown in the message (Only for article)
	HideUrl bool `json:"hide_url,omitempty"`
	// Optional. Url of the thumbnail for the result (Only for article, contact, document, gif, location, mpeg4_gif, photo, venue, video)
	ThumbnailUrl string `json:"thumbnail_url,omitempty"`
	// Optional. Thumbnail width (Only for article, contact, document, location, venue)
	ThumbnailWidth int64 `json:"thumbnail_width,omitempty"`
	// Optional. Thumbnail height (Only for article, contact, document, location, venue)
	ThumbnailHeight int64 `json:"thumbnail_height,omitempty"`
	// Optional. A valid URL for the audio file (Only for audio)
	AudioUrl string `json:"audio_url,omitempty"`
	// Optional. Performer (Only for audio)
	Performer string `json:"performer,omitempty"`
	// Optional. Audio duration in seconds (Only for audio)
	AudioDuration int64 `json:"audio_duration,omitempty"`
	// Optional. Contact's phone number (Only for contact)
	PhoneNumber string `json:"phone_number,omitempty"`
	// Optional. Contact's first name (Only for contact)
	FirstName string `json:"first_name,omitempty"`
	// Optional. Contact's last name (Only for contact)
	LastName string `json:"last_name,omitempty"`
	// Optional. Additional data about the contact in the form of a vCard, 0-2048 bytes (Only for contact)
	Vcard string `json:"vcard,omitempty"`
	// Optional. Short name of the game (Only for game)
	GameShortName string `json:"game_short_name,omitempty"`
	// Optional. A valid URL for the file (Only for document)
	DocumentUrl string `json:"document_url,omitempty"`
	// Optional. MIME type of the content of the file, either "application/pdf" or "application/zip" (Only for document, video)
	MimeType string `json:"mime_type,omitempty"`
	// Optional. A valid URL for the GIF file. File size must not exceed 1MB (Only for gif)
	GifUrl string `json:"gif_url,omitempty"`
	// Optional. Width of the GIF (Only for gif)
	GifWidth int64 `json:"gif_width,omitempty"`
	// Optional. Height of the GIF (Only for gif)
	GifHeight int64 `json:"gif_height,omitempty"`
	// Optional. Duration of the GIF in seconds (Only for gif)
	GifDuration int64 `json:"gif_duration,omitempty"`
	// Optional. MIME type of the thumbnail, must be one of "image/jpeg", "image/gif", or "video/mp4". Defaults to "image/jpeg" (Only for gif, mpeg4_gif)
	ThumbnailMimeType string `json:"thumbnail_mime_type,omitempty"`
	// Optional. Location latitude in degrees (Only for location, venue)
	Latitude float64 `json:"latitude,omitempty"`
	// Optional. Location longitude in degrees (Only for location, venue)
	Longitude float64 `json:"longitude,omitempty"`
	// Optional. The radius of uncertainty for the location, measured in meters; 0-1500 (Only for location)
	HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"`
	// Optional. Period in seconds during which the location can be updated, should be between 60 and 86400, or 0x7FFFFFFF for live locations that can be edited indefinitely. (Only for location)
	LivePeriod int64 `json:"live_period,omitempty"`
	// Optional. For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified. (Only for location)
	Heading int64 `json:"heading,omitempty"`
	// Optional. For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified. (Only for location)
	ProximityAlertRadius int64 `json:"proximity_alert_radius,omitempty"`
	// Optional. A valid URL for the MPEG4 file. File size must not exceed 1MB (Only for mpeg4_gif)
	Mpeg4Url string `json:"mpeg4_url,omitempty"`
	// Optional. Video width (Only for mpeg4_gif)
	Mpeg4Width int64 `json:"mpeg4_width,omitempty"`
	// Optional. Video height (Only for mpeg4_gif)
	Mpeg4Height int64 `json:"mpeg4_height,omitempty"`
	// Optional. Video duration in seconds (Only for mpeg4_gif)
	Mpeg4Duration int64 `json:"mpeg4_duration,omitempty"`
	// Optional. A valid URL of the photo. Photo must be in JPEG format. Photo size must not exceed 5MB (Only for photo)
	PhotoUrl string `json:"photo_url,omitempty"`
	// Optional. Width of the photo (Only for photo)
	PhotoWidth int64 `json:"photo_width,omitempty"`
	// Optional. Height of the photo (Only for photo)
	PhotoHeight int64 `json:"photo_height,omitempty"`
	// Optional. Address of the venue (Only for venue)
	Address string `json:"address,omitempty"`
	// Optional. Foursquare identifier of the venue if known (Only for venue)
	FoursquareId string `json:"foursquare_id,omitempty"`
	// Optional. Foursquare type of the venue, if known. (For example, "arts_entertainment/default", "arts_entertainment/aquarium" or "food/icecream".) (Only for venue)
	FoursquareType string `json:"foursquare_type,omitempty"`
	// Optional. Google Places identifier of the venue (Only for venue)
	GooglePlaceId string `json:"google_place_id,omitempty"`
	// Optional. Google Places type of the venue. (See supported types.) (Only for venue)
	GooglePlaceType string `json:"google_place_type,omitempty"`
	// Optional. A valid URL for the embedded video player or video file (Only for video)
	VideoUrl string `json:"video_url,omitempty"`
	// Optional. Video width (Only for video)
	VideoWidth int64 `json:"video_width,omitempty"`
	// Optional. Video height (Only for video)
	VideoHeight int64 `json:"video_height,omitempty"`
	// Optional. Video duration in seconds (Only for video)
	VideoDuration int64 `json:"video_duration,omitempty"`
	// Optional. A valid URL for the voice recording (Only for voice)
	VoiceUrl string `json:"voice_url,omitempty"`
	// Optional. Recording duration in seconds (Only for voice)
	VoiceDuration int64 `json:"voice_duration,omitempty"`
}

MergedInlineQueryResult is a helper type to simplify interactions with the various InlineQueryResult subtypes.

func (MergedInlineQueryResult) GetId

func (v MergedInlineQueryResult) GetId() string

GetId is a helper method to easily access the common fields of an interface.

func (MergedInlineQueryResult) GetType

func (v MergedInlineQueryResult) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (MergedInlineQueryResult) MergeInlineQueryResult

func (v MergedInlineQueryResult) MergeInlineQueryResult() MergedInlineQueryResult

MergeInlineQueryResult returns a MergedInlineQueryResult struct to simplify working with types in a non-generic world.

type MergedInputMedia

type MergedInputMedia struct {
	// Type of the result
	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. More information on Sending Files: https://core.telegram.org/bots/api#sending-files
	Media InputFileOrString `json:"media"`
	// Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://<file_attach_name>" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files: https://core.telegram.org/bots/api#sending-files (Only for animation, document, audio, video)
	Thumbnail InputFile `json:"thumbnail,omitempty"`
	// Optional. Caption of the animation to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`
	// Optional. Mode for parsing entities in the animation caption. See formatting options for more details.
	ParseMode string `json:"parse_mode,omitempty"`
	// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
	// Optional. Pass True, if the caption must be shown above the message media (Only for animation, photo, video)
	ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
	// Optional. Animation width (Only for animation, video)
	Width int64 `json:"width,omitempty"`
	// Optional. Animation height (Only for animation, video)
	Height int64 `json:"height,omitempty"`
	// Optional. Animation duration in seconds (Only for animation, audio, video)
	Duration int64 `json:"duration,omitempty"`
	// Optional. Pass True if the animation needs to be covered with a spoiler animation (Only for animation, photo, video)
	HasSpoiler bool `json:"has_spoiler,omitempty"`
	// Optional. Disables automatic server-side content type detection for files uploaded using multipart/form-data. Always True, if the document is sent as part of an album. (Only for document)
	DisableContentTypeDetection bool `json:"disable_content_type_detection,omitempty"`
	// Optional. Performer of the audio (Only for audio)
	Performer string `json:"performer,omitempty"`
	// Optional. Title of the audio (Only for audio)
	Title string `json:"title,omitempty"`
	// Optional. Pass True if the uploaded video is suitable for streaming (Only for video)
	SupportsStreaming bool `json:"supports_streaming,omitempty"`
}

MergedInputMedia is a helper type to simplify interactions with the various InputMedia subtypes.

func (MergedInputMedia) GetMedia

func (v MergedInputMedia) GetMedia() InputFileOrString

GetMedia is a helper method to easily access the common fields of an interface.

func (MergedInputMedia) GetType

func (v MergedInputMedia) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (MergedInputMedia) MergeInputMedia

func (v MergedInputMedia) MergeInputMedia() MergedInputMedia

MergeInputMedia returns a MergedInputMedia struct to simplify working with types in a non-generic world.

type MergedInputPaidMedia added in v2.1.0

type MergedInputPaidMedia struct {
	// Type of the media
	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. More information on Sending Files: https://core.telegram.org/bots/api#sending-files
	Media InputFileOrString `json:"media"`
	// Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://<file_attach_name>" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files: https://core.telegram.org/bots/api#sending-files (Only for video)
	Thumbnail InputFile `json:"thumbnail,omitempty"`
	// Optional. Video width (Only for video)
	Width int64 `json:"width,omitempty"`
	// Optional. Video height (Only for video)
	Height int64 `json:"height,omitempty"`
	// Optional. Video duration in seconds (Only for video)
	Duration int64 `json:"duration,omitempty"`
	// Optional. Pass True if the uploaded video is suitable for streaming (Only for video)
	SupportsStreaming bool `json:"supports_streaming,omitempty"`
}

MergedInputPaidMedia is a helper type to simplify interactions with the various InputPaidMedia subtypes.

func (MergedInputPaidMedia) GetMedia added in v2.1.0

GetMedia is a helper method to easily access the common fields of an interface.

func (MergedInputPaidMedia) GetType added in v2.1.0

func (v MergedInputPaidMedia) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (MergedInputPaidMedia) MergeInputPaidMedia added in v2.1.0

func (v MergedInputPaidMedia) MergeInputPaidMedia() MergedInputPaidMedia

MergeInputPaidMedia returns a MergedInputPaidMedia struct to simplify working with types in a non-generic world.

type MergedMenuButton

type MergedMenuButton struct {
	// Type of the button
	Type string `json:"type"`
	// Optional. Text on the button (Only for web_app)
	Text string `json:"text,omitempty"`
	// Optional. Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. Alternatively, a t.me link to a Web App of the bot can be specified in the object instead of the Web App's URL, in which case the Web App will be opened as if the user pressed the link. (Only for web_app)
	WebApp *WebAppInfo `json:"web_app,omitempty"`
}

MergedMenuButton is a helper type to simplify interactions with the various MenuButton subtypes.

func (MergedMenuButton) GetType

func (v MergedMenuButton) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (MergedMenuButton) MergeMenuButton

func (v MergedMenuButton) MergeMenuButton() MergedMenuButton

MergeMenuButton returns a MergedMenuButton struct to simplify working with types in a non-generic world.

type MergedMessageOrigin added in v2.1.0

type MergedMessageOrigin struct {
	// Type of the message origin
	Type string `json:"type"`
	// Date the message was sent originally in Unix time
	Date int64 `json:"date"`
	// Optional. User that sent the message originally (Only for user)
	SenderUser *User `json:"sender_user,omitempty"`
	// Optional. Name of the user that sent the message originally (Only for hidden_user)
	SenderUserName string `json:"sender_user_name,omitempty"`
	// Optional. Chat that sent the message originally (Only for chat)
	SenderChat *Chat `json:"sender_chat,omitempty"`
	// Optional. For messages originally sent by an anonymous chat administrator, original message author signature (Only for chat, channel)
	AuthorSignature string `json:"author_signature,omitempty"`
	// Optional. Channel chat to which the message was originally sent (Only for channel)
	Chat *Chat `json:"chat,omitempty"`
	// Optional. Unique message identifier inside the chat (Only for channel)
	MessageId int64 `json:"message_id,omitempty"`
}

MergedMessageOrigin is a helper type to simplify interactions with the various MessageOrigin subtypes.

func (MergedMessageOrigin) GetDate added in v2.1.0

func (v MergedMessageOrigin) GetDate() int64

GetDate is a helper method to easily access the common fields of an interface.

func (MergedMessageOrigin) GetType added in v2.1.0

func (v MergedMessageOrigin) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (MergedMessageOrigin) MergeMessageOrigin added in v2.1.0

func (v MergedMessageOrigin) MergeMessageOrigin() MergedMessageOrigin

MergeMessageOrigin returns a MergedMessageOrigin struct to simplify working with types in a non-generic world.

type MergedPaidMedia added in v2.1.0

type MergedPaidMedia struct {
	// Type of the paid media
	Type string `json:"type"`
	// Optional. Media width as defined by the sender (Only for preview)
	Width int64 `json:"width,omitempty"`
	// Optional. Media height as defined by the sender (Only for preview)
	Height int64 `json:"height,omitempty"`
	// Optional. Duration of the media in seconds as defined by the sender (Only for preview)
	Duration int64 `json:"duration,omitempty"`
	// Optional. The photo (Only for photo)
	Photo []PhotoSize `json:"photo,omitempty"`
	// Optional. The video (Only for video)
	Video *Video `json:"video,omitempty"`
}

MergedPaidMedia is a helper type to simplify interactions with the various PaidMedia subtypes.

func (MergedPaidMedia) GetType added in v2.1.0

func (v MergedPaidMedia) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (MergedPaidMedia) MergePaidMedia added in v2.1.0

func (v MergedPaidMedia) MergePaidMedia() MergedPaidMedia

MergePaidMedia returns a MergedPaidMedia struct to simplify working with types in a non-generic world.

type MergedPassportElementError

type MergedPassportElementError struct {
	// Error source
	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"`
	// Optional. Name of the data field which has the error (Only for data)
	FieldName string `json:"field_name,omitempty"`
	// Optional. Base64-encoded data hash (Only for data)
	DataHash string `json:"data_hash,omitempty"`
	// Error message
	Message string `json:"message"`
	// Optional. Base64-encoded hash of the file with the front side of the document (Only for front_side, reverse_side, selfie, file, translation_file)
	FileHash string `json:"file_hash,omitempty"`
	// Optional. List of base64-encoded file hashes (Only for files, translation_files)
	FileHashes []string `json:"file_hashes,omitempty"`
	// Optional. Base64-encoded element hash (Only for unspecified)
	ElementHash string `json:"element_hash,omitempty"`
}

MergedPassportElementError is a helper type to simplify interactions with the various PassportElementError subtypes.

func (MergedPassportElementError) GetMessage

func (v MergedPassportElementError) GetMessage() string

GetMessage is a helper method to easily access the common fields of an interface.

func (MergedPassportElementError) GetSource

func (v MergedPassportElementError) GetSource() string

GetSource is a helper method to easily access the common fields of an interface.

func (MergedPassportElementError) GetType

func (v MergedPassportElementError) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (MergedPassportElementError) MergePassportElementError

func (v MergedPassportElementError) MergePassportElementError() MergedPassportElementError

MergePassportElementError returns a MergedPassportElementError struct to simplify working with types in a non-generic world.

type MergedReactionType added in v2.1.0

type MergedReactionType struct {
	// Type of the reaction
	Type string `json:"type"`
	// Optional. Reaction emoji. Currently, it can be one of "👍", "👎", "❤", "🔥", "🥰", "👏", "😁", "🤔", "🤯", "😱", "🤬", "😢", "🎉", "🤩", "🤮", "💩", "🙏", "👌", "🕊", "🤡", "🥱", "🥴", "😍", "🐳", "❤‍🔥", "🌚", "🌭", "💯", "🤣", "⚡", "🍌", "🏆", "💔", "🤨", "😐", "🍓", "🍾", "💋", "🖕", "😈", "😴", "😭", "🤓", "👻", "👨‍💻", "👀", "🎃", "🙈", "😇", "😨", "🤝", "✍", "🤗", "🫡", "🎅", "🎄", "☃", "💅", "🤪", "🗿", "🆒", "💘", "🙉", "🦄", "😘", "💊", "🙊", "😎", "👾", "🤷‍♂", "🤷", "🤷‍♀", "😡" (Only for emoji)
	Emoji string `json:"emoji,omitempty"`
	// Optional. Custom emoji identifier (Only for custom_emoji)
	CustomEmojiId string `json:"custom_emoji_id,omitempty"`
}

MergedReactionType is a helper type to simplify interactions with the various ReactionType subtypes.

func (MergedReactionType) GetType added in v2.1.0

func (v MergedReactionType) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (MergedReactionType) MergeReactionType added in v2.1.0

func (v MergedReactionType) MergeReactionType() MergedReactionType

MergeReactionType returns a MergedReactionType struct to simplify working with types in a non-generic world.

type MergedRevenueWithdrawalState added in v2.1.0

type MergedRevenueWithdrawalState struct {
	// Type of the state
	Type string `json:"type"`
	// Optional. Date the withdrawal was completed in Unix time (Only for succeeded)
	Date int64 `json:"date,omitempty"`
	// Optional. An HTTPS URL that can be used to see transaction details (Only for succeeded)
	Url string `json:"url,omitempty"`
}

MergedRevenueWithdrawalState is a helper type to simplify interactions with the various RevenueWithdrawalState subtypes.

func (MergedRevenueWithdrawalState) GetType added in v2.1.0

GetType is a helper method to easily access the common fields of an interface.

func (MergedRevenueWithdrawalState) MergeRevenueWithdrawalState added in v2.1.0

func (v MergedRevenueWithdrawalState) MergeRevenueWithdrawalState() MergedRevenueWithdrawalState

MergeRevenueWithdrawalState returns a MergedRevenueWithdrawalState struct to simplify working with types in a non-generic world.

type MergedTransactionPartner added in v2.1.0

type MergedTransactionPartner struct {
	// Type of the transaction partner
	Type string `json:"type"`
	// Optional. Information about the user (Only for user)
	User *User `json:"user,omitempty"`
	// Optional. Bot-specified invoice payload (Only for user)
	InvoicePayload string `json:"invoice_payload,omitempty"`
	// Optional. Information about the paid media bought by the user (Only for user)
	PaidMedia []PaidMedia `json:"paid_media,omitempty"`
	// Optional. State of the transaction if the transaction is outgoing (Only for fragment)
	WithdrawalState RevenueWithdrawalState `json:"withdrawal_state,omitempty"`
}

MergedTransactionPartner is a helper type to simplify interactions with the various TransactionPartner subtypes.

func (MergedTransactionPartner) GetType added in v2.1.0

func (v MergedTransactionPartner) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (MergedTransactionPartner) MergeTransactionPartner added in v2.1.0

func (v MergedTransactionPartner) MergeTransactionPartner() MergedTransactionPartner

MergeTransactionPartner returns a MergedTransactionPartner struct to simplify working with types in a non-generic world.

type Message

type Message struct {
	// Unique message identifier inside this chat
	MessageId int64 `json:"message_id"`
	// Optional. Unique identifier of a message thread to which the message belongs; for supergroups only
	MessageThreadId int64 `json:"message_thread_id,omitempty"`
	// Optional. Sender of the message; may be empty for messages sent to channels. For backward compatibility, if the message was sent on behalf of a chat, the field contains a fake sender user in non-channel chats
	From *User `json:"from,omitempty"`
	// Optional. Sender of the message when sent on behalf of a chat. For example, the supergroup itself for messages sent by its anonymous administrators or a linked channel for messages automatically forwarded to the channel's discussion group. For backward compatibility, if the message was sent on behalf of a chat, the field from contains a fake sender user in non-channel chats.
	SenderChat *Chat `json:"sender_chat,omitempty"`
	// Optional. If the sender of the message boosted the chat, the number of boosts added by the user
	SenderBoostCount int64 `json:"sender_boost_count,omitempty"`
	// Optional. The bot that actually sent the message on behalf of the business account. Available only for outgoing messages sent on behalf of the connected business account.
	SenderBusinessBot *User `json:"sender_business_bot,omitempty"`
	// Date the message was sent in Unix time. It is always a positive number, representing a valid date.
	Date int64 `json:"date"`
	// Optional. Unique identifier of the business connection from which the message was received. If non-empty, the message belongs to a chat of the corresponding business account that is independent from any potential bot chat which might share the same identifier.
	BusinessConnectionId string `json:"business_connection_id,omitempty"`
	// Chat the message belongs to
	Chat Chat `json:"chat"`
	// Optional. Information about the original message for forwarded messages
	ForwardOrigin MessageOrigin `json:"forward_origin,omitempty"`
	// Optional. True, if the message is sent to a forum topic
	IsTopicMessage bool `json:"is_topic_message,omitempty"`
	// Optional. True, if the message is a channel post that was automatically forwarded to the connected discussion group
	IsAutomaticForward bool `json:"is_automatic_forward,omitempty"`
	// Optional. For replies in the same chat and message thread, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply.
	ReplyToMessage *Message `json:"reply_to_message,omitempty"`
	// Optional. Information about the message that is being replied to, which may come from another chat or forum topic
	ExternalReply *ExternalReplyInfo `json:"external_reply,omitempty"`
	// Optional. For replies that quote part of the original message, the quoted part of the message
	Quote *TextQuote `json:"quote,omitempty"`
	// Optional. For replies to a story, the original story
	ReplyToStory *Story `json:"reply_to_story,omitempty"`
	// Optional. Bot through which the message was sent
	ViaBot *User `json:"via_bot,omitempty"`
	// Optional. Date the message was last edited in Unix time
	EditDate int64 `json:"edit_date,omitempty"`
	// Optional. True, if the message can't be forwarded
	HasProtectedContent bool `json:"has_protected_content,omitempty"`
	// Optional. True, if the message was sent by an implicit action, for example, as an away or a greeting business message, or as a scheduled message
	IsFromOffline bool `json:"is_from_offline,omitempty"`
	// Optional. The unique identifier of a media message group this message belongs to
	MediaGroupId string `json:"media_group_id,omitempty"`
	// Optional. Signature of the post author for messages in channels, or the custom title of an anonymous group administrator
	AuthorSignature string `json:"author_signature,omitempty"`
	// Optional. For text messages, the actual UTF-8 text of the message
	Text string `json:"text,omitempty"`
	// Optional. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text
	Entities []MessageEntity `json:"entities,omitempty"`
	// Optional. Options used for link preview generation for the message, if it is a text message and link preview options were changed
	LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options,omitempty"`
	// Optional. Unique identifier of the message effect added to the message
	EffectId string `json:"effect_id,omitempty"`
	// Optional. Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set
	Animation *Animation `json:"animation,omitempty"`
	// Optional. Message is an audio file, information about the file
	Audio *Audio `json:"audio,omitempty"`
	// Optional. Message is a general file, information about the file
	Document *Document `json:"document,omitempty"`
	// Optional. Message contains paid media; information about the paid media
	PaidMedia *PaidMediaInfo `json:"paid_media,omitempty"`
	// Optional. Message is a photo, available sizes of the photo
	Photo []PhotoSize `json:"photo,omitempty"`
	// Optional. Message is a sticker, information about the sticker
	Sticker *Sticker `json:"sticker,omitempty"`
	// Optional. Message is a forwarded story
	Story *Story `json:"story,omitempty"`
	// Optional. Message is a video, information about the video
	Video *Video `json:"video,omitempty"`
	// Optional. Message is a video note, information about the video message
	VideoNote *VideoNote `json:"video_note,omitempty"`
	// Optional. Message is a voice message, information about the file
	Voice *Voice `json:"voice,omitempty"`
	// Optional. Caption for the animation, audio, document, paid media, photo, video or voice
	Caption string `json:"caption,omitempty"`
	// Optional. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption
	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
	// Optional. True, if the caption must be shown above the message media
	ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
	// Optional. True, if the message media is covered by a spoiler animation
	HasMediaSpoiler bool `json:"has_media_spoiler,omitempty"`
	// Optional. Message is a shared contact, information about the contact
	Contact *Contact `json:"contact,omitempty"`
	// Optional. Message is a dice with random value
	Dice *Dice `json:"dice,omitempty"`
	// Optional. Message is a game, information about the game. More about games: https://core.telegram.org/bots/api#games
	Game *Game `json:"game,omitempty"`
	// Optional. Message is a native poll, information about the poll
	Poll *Poll `json:"poll,omitempty"`
	// Optional. Message is a venue, information about the venue. For backward compatibility, when this field is set, the location field will also be set
	Venue *Venue `json:"venue,omitempty"`
	// Optional. Message is a shared location, information about the location
	Location *Location `json:"location,omitempty"`
	// Optional. New members that were added to the group or supergroup and information about them (the bot itself may be one of these members)
	NewChatMembers []User `json:"new_chat_members,omitempty"`
	// Optional. A member was removed from the group, information about them (this member may be the bot itself)
	LeftChatMember *User `json:"left_chat_member,omitempty"`
	// Optional. A chat title was changed to this value
	NewChatTitle string `json:"new_chat_title,omitempty"`
	// Optional. A chat photo was change to this value
	NewChatPhoto []PhotoSize `json:"new_chat_photo,omitempty"`
	// Optional. Service message: the chat photo was deleted
	DeleteChatPhoto bool `json:"delete_chat_photo,omitempty"`
	// Optional. Service message: the group has been created
	GroupChatCreated bool `json:"group_chat_created,omitempty"`
	// Optional. Service message: the supergroup has been created. This field can't be received in a message coming through updates, because bot can't be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup.
	SupergroupChatCreated bool `json:"supergroup_chat_created,omitempty"`
	// Optional. Service message: the channel has been created. This field can't be received in a message coming through updates, because bot can't be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel.
	ChannelChatCreated bool `json:"channel_chat_created,omitempty"`
	// Optional. Service message: auto-delete timer settings changed in the chat
	MessageAutoDeleteTimerChanged *MessageAutoDeleteTimerChanged `json:"message_auto_delete_timer_changed,omitempty"`
	// Optional. The group has been migrated to a supergroup with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.
	MigrateToChatId int64 `json:"migrate_to_chat_id,omitempty"`
	// Optional. The supergroup has been migrated from a group with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.
	MigrateFromChatId int64 `json:"migrate_from_chat_id,omitempty"`
	// Optional. Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply.
	PinnedMessage MaybeInaccessibleMessage `json:"pinned_message,omitempty"`
	// Optional. Message is an invoice for a payment, information about the invoice. More about payments: https://core.telegram.org/bots/api#payments
	Invoice *Invoice `json:"invoice,omitempty"`
	// Optional. Message is a service message about a successful payment, information about the payment. More about payments: https://core.telegram.org/bots/api#payments
	SuccessfulPayment *SuccessfulPayment `json:"successful_payment,omitempty"`
	// Optional. Message is a service message about a refunded payment, information about the payment. More about payments: https://core.telegram.org/bots/api#payments
	RefundedPayment *RefundedPayment `json:"refunded_payment,omitempty"`
	// Optional. Service message: users were shared with the bot
	UsersShared *UsersShared `json:"users_shared,omitempty"`
	// Optional. Service message: a chat was shared with the bot
	ChatShared *ChatShared `json:"chat_shared,omitempty"`
	// Optional. The domain name of the website on which the user has logged in. More about Telegram Login: https://core.telegram.org/widgets/login
	ConnectedWebsite string `json:"connected_website,omitempty"`
	// Optional. Service message: the user allowed the bot to write messages after adding it to the attachment or side menu, launching a Web App from a link, or accepting an explicit request from a Web App sent by the method requestWriteAccess
	WriteAccessAllowed *WriteAccessAllowed `json:"write_access_allowed,omitempty"`
	// Optional. Telegram Passport data
	PassportData *PassportData `json:"passport_data,omitempty"`
	// Optional. Service message. A user in the chat triggered another user's proximity alert while sharing Live Location.
	ProximityAlertTriggered *ProximityAlertTriggered `json:"proximity_alert_triggered,omitempty"`
	// Optional. Service message: user boosted the chat
	BoostAdded *ChatBoostAdded `json:"boost_added,omitempty"`
	// Optional. Service message: chat background set
	ChatBackgroundSet *ChatBackground `json:"chat_background_set,omitempty"`
	// Optional. Service message: forum topic created
	ForumTopicCreated *ForumTopicCreated `json:"forum_topic_created,omitempty"`
	// Optional. Service message: forum topic edited
	ForumTopicEdited *ForumTopicEdited `json:"forum_topic_edited,omitempty"`
	// Optional. Service message: forum topic closed
	ForumTopicClosed *ForumTopicClosed `json:"forum_topic_closed,omitempty"`
	// Optional. Service message: forum topic reopened
	ForumTopicReopened *ForumTopicReopened `json:"forum_topic_reopened,omitempty"`
	// Optional. Service message: the 'General' forum topic hidden
	GeneralForumTopicHidden *GeneralForumTopicHidden `json:"general_forum_topic_hidden,omitempty"`
	// Optional. Service message: the 'General' forum topic unhidden
	GeneralForumTopicUnhidden *GeneralForumTopicUnhidden `json:"general_forum_topic_unhidden,omitempty"`
	// Optional. Service message: a scheduled giveaway was created
	GiveawayCreated *GiveawayCreated `json:"giveaway_created,omitempty"`
	// Optional. The message is a scheduled giveaway message
	Giveaway *Giveaway `json:"giveaway,omitempty"`
	// Optional. A giveaway with public winners was completed
	GiveawayWinners *GiveawayWinners `json:"giveaway_winners,omitempty"`
	// Optional. Service message: a giveaway without public winners was completed
	GiveawayCompleted *GiveawayCompleted `json:"giveaway_completed,omitempty"`
	// Optional. Service message: video chat scheduled
	VideoChatScheduled *VideoChatScheduled `json:"video_chat_scheduled,omitempty"`
	// Optional. Service message: video chat started
	VideoChatStarted *VideoChatStarted `json:"video_chat_started,omitempty"`
	// Optional. Service message: video chat ended
	VideoChatEnded *VideoChatEnded `json:"video_chat_ended,omitempty"`
	// Optional. Service message: new participants invited to a video chat
	VideoChatParticipantsInvited *VideoChatParticipantsInvited `json:"video_chat_participants_invited,omitempty"`
	// Optional. Service message: data sent by a Web App
	WebAppData *WebAppData `json:"web_app_data,omitempty"`
	// Optional. Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons.
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}

Message (https://core.telegram.org/bots/api#message)

This object represents a message.

func (Message) Copy

func (m Message) Copy(b *Bot, chatId int64, opts *CopyMessageOpts) (*MessageId, error)

Copy Helper method for Bot.CopyMessage.

func (Message) Delete

func (m Message) Delete(b *Bot, opts *DeleteMessageOpts) (bool, error)

Delete Helper method for Bot.DeleteMessage.

func (Message) EditCaption

func (m Message) EditCaption(b *Bot, opts *EditMessageCaptionOpts) (*Message, bool, error)

EditCaption Helper method for Bot.EditMessageCaption.

func (Message) EditLiveLocation

func (m Message) EditLiveLocation(b *Bot, latitude float64, longitude float64, opts *EditMessageLiveLocationOpts) (*Message, bool, error)

EditLiveLocation Helper method for Bot.EditMessageLiveLocation.

func (Message) EditMedia

func (m Message) EditMedia(b *Bot, media InputMedia, opts *EditMessageMediaOpts) (*Message, bool, error)

EditMedia Helper method for Bot.EditMessageMedia.

func (Message) EditReplyMarkup

func (m Message) EditReplyMarkup(b *Bot, opts *EditMessageReplyMarkupOpts) (*Message, bool, error)

EditReplyMarkup Helper method for Bot.EditMessageReplyMarkup.

func (Message) EditText

func (m Message) EditText(b *Bot, text string, opts *EditMessageTextOpts) (*Message, bool, error)

EditText Helper method for Bot.EditMessageText.

func (Message) Forward

func (m Message) Forward(b *Bot, chatId int64, opts *ForwardMessageOpts) (*Message, error)

Forward Helper method for Bot.ForwardMessage.

func (Message) GetChat added in v2.1.0

func (v Message) GetChat() Chat

GetChat is a helper method to easily access the common fields of an interface.

func (Message) GetDate added in v2.1.0

func (v Message) GetDate() int64

GetDate is a helper method to easily access the common fields of an interface.

func (Message) GetEntities added in v2.1.0

func (m Message) GetEntities() []MessageEntity

GetEntities returns the message entities, for both text messages and media messages. (Why is this not the telegram default!)

func (m Message) GetLink() string

GetLink is a helper method to easily get the message link (It will return an empty string in case of private or group chat type).

func (Message) GetMessageId added in v2.1.0

func (v Message) GetMessageId() int64

GetMessageId is a helper method to easily access the common fields of an interface.

func (Message) GetSender

func (m Message) GetSender() *Sender

GetSender populates the relevant fields of a Sender struct given a message.

func (Message) GetText added in v2.1.0

func (m Message) GetText() string

GetText returns the message text, for both text messages and media messages. (Why is this not the telegram default!)

func (Message) OriginalCaptionHTML

func (m Message) OriginalCaptionHTML() string

OriginalCaptionHTML gets the original HTML formatting of a message caption.

func (Message) OriginalCaptionMD

func (m Message) OriginalCaptionMD() string

OriginalCaptionMD gets the original markdown formatting of a message caption.

func (Message) OriginalCaptionMDV2

func (m Message) OriginalCaptionMDV2() string

OriginalCaptionMDV2 gets the original markdownV2 formatting of a message caption.

func (Message) OriginalHTML

func (m Message) OriginalHTML() string

OriginalHTML gets the original HTML formatting of a message text.

func (Message) OriginalMD

func (m Message) OriginalMD() string

OriginalMD gets the original markdown formatting of a message text.

func (Message) OriginalMDV2

func (m Message) OriginalMDV2() string

OriginalMDV2 gets the original markdownV2 formatting of a message text.

func (Message) ParseCaptionEntities

func (m Message) ParseCaptionEntities() (out []ParsedMessageEntity)

ParseCaptionEntities calls Message.ParseEntity on all message caption entities.

func (Message) ParseCaptionEntity

func (m Message) ParseCaptionEntity(entity MessageEntity) ParsedMessageEntity

ParseCaptionEntity parses a single message caption entity to populate text contents, URL, and offsets in UTF8.

func (Message) ParseCaptionEntityTypes

func (m Message) ParseCaptionEntityTypes(accepted map[string]struct{}) (out []ParsedMessageEntity)

ParseCaptionEntityTypes calls Message.ParseEntity on a subset of message caption entities.

func (Message) ParseEntities

func (m Message) ParseEntities() (out []ParsedMessageEntity)

ParseEntities calls Message.ParseEntity on all message text entities.

func (Message) ParseEntity

func (m Message) ParseEntity(entity MessageEntity) ParsedMessageEntity

ParseEntity parses a single message text entity to populate text contents, URL, and offsets in UTF8.

func (Message) ParseEntityTypes

func (m Message) ParseEntityTypes(accepted map[string]struct{}) (out []ParsedMessageEntity)

ParseEntityTypes calls Message.ParseEntity on a subset of message text entities.

func (Message) Pin

func (m Message) Pin(b *Bot, opts *PinChatMessageOpts) (bool, error)

Pin Helper method for Bot.PinChatMessage.

func (Message) Reply

func (m Message) Reply(b *Bot, text string, opts *SendMessageOpts) (*Message, error)

Reply is a helper function to easily call Bot.SendMessage as a reply to an existing Message.

func (Message) SetReaction added in v2.1.0

func (m Message) SetReaction(b *Bot, opts *SetMessageReactionOpts) (bool, error)

SetReaction Helper method for Bot.SetMessageReaction.

func (Message) StopLiveLocation

func (m Message) StopLiveLocation(b *Bot, opts *StopMessageLiveLocationOpts) (*Message, bool, error)

StopLiveLocation Helper method for Bot.StopMessageLiveLocation.

func (*Message) UnmarshalJSON added in v2.1.0

func (v *Message) UnmarshalJSON(b []byte) error

UnmarshalJSON is a custom JSON unmarshaller to use the helpers which allow for unmarshalling structs into interfaces.

func (Message) Unpin

func (m Message) Unpin(b *Bot, opts *UnpinChatMessageOpts) (bool, error)

Unpin Helper method for Bot.UnpinChatMessage.

type MessageAutoDeleteTimerChanged

type MessageAutoDeleteTimerChanged struct {
	// New auto-delete time for messages in the chat; in seconds
	MessageAutoDeleteTime int64 `json:"message_auto_delete_time"`
}

MessageAutoDeleteTimerChanged (https://core.telegram.org/bots/api#messageautodeletetimerchanged)

This object represents a service message about a change in auto-delete timer settings.

type MessageEntity

type MessageEntity struct {
	// Type of the entity. Currently, can be "mention" (@username), "hashtag" (#hashtag), "cashtag" ($USD), "bot_command" (/start@jobs_bot), "url" (https://telegram.org), "email" (do-not-reply@telegram.org), "phone_number" (+1-212-555-0123), "bold" (bold text), "italic" (italic text), "underline" (underlined text), "strikethrough" (strikethrough text), "spoiler" (spoiler message), "blockquote" (block quotation), "expandable_blockquote" (collapsed-by-default block quotation), "code" (monowidth string), "pre" (monowidth block), "text_link" (for clickable text URLs), "text_mention" (for users without usernames), "custom_emoji" (for inline custom emoji stickers)
	Type string `json:"type"`
	// Offset in UTF-16 code units to the start of the entity
	Offset int64 `json:"offset"`
	// Length of the entity in UTF-16 code units
	Length int64 `json:"length"`
	// Optional. For "text_link" only, URL that will be opened after user taps on the text
	Url string `json:"url,omitempty"`
	// Optional. For "text_mention" only, the mentioned user
	User *User `json:"user,omitempty"`
	// Optional. For "pre" only, the programming language of the entity text
	Language string `json:"language,omitempty"`
	// Optional. For "custom_emoji" only, unique identifier of the custom emoji. Use getCustomEmojiStickers to get full information about the sticker
	CustomEmojiId string `json:"custom_emoji_id,omitempty"`
}

MessageEntity (https://core.telegram.org/bots/api#messageentity)

This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc.

type MessageId

type MessageId struct {
	// Unique message identifier
	MessageId int64 `json:"message_id"`
}

MessageId (https://core.telegram.org/bots/api#messageid)

This object represents a unique message identifier.

type MessageOrigin added in v2.1.0

type MessageOrigin interface {
	GetType() string
	GetDate() int64
	// MergeMessageOrigin returns a MergedMessageOrigin struct to simplify working with complex telegram types in a non-generic world.
	MergeMessageOrigin() MergedMessageOrigin
	// contains filtered or unexported methods
}

MessageOrigin (https://core.telegram.org/bots/api#messageorigin)

This object describes the origin of a message. It can be one of

  • MessageOriginUser
  • MessageOriginHiddenUser
  • MessageOriginChat
  • MessageOriginChannel

type MessageOriginChannel added in v2.1.0

type MessageOriginChannel struct {
	// Date the message was sent originally in Unix time
	Date int64 `json:"date"`
	// Channel chat to which the message was originally sent
	Chat Chat `json:"chat"`
	// Unique message identifier inside the chat
	MessageId int64 `json:"message_id"`
	// Optional. Signature of the original post author
	AuthorSignature string `json:"author_signature,omitempty"`
}

MessageOriginChannel (https://core.telegram.org/bots/api#messageoriginchannel)

The message was originally sent to a channel chat.

func (MessageOriginChannel) GetDate added in v2.1.0

func (v MessageOriginChannel) GetDate() int64

GetDate is a helper method to easily access the common fields of an interface.

func (MessageOriginChannel) GetType added in v2.1.0

func (v MessageOriginChannel) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (MessageOriginChannel) MarshalJSON added in v2.1.0

func (v MessageOriginChannel) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (MessageOriginChannel) MergeMessageOrigin added in v2.1.0

func (v MessageOriginChannel) MergeMessageOrigin() MergedMessageOrigin

MergeMessageOrigin returns a MergedMessageOrigin struct to simplify working with types in a non-generic world.

type MessageOriginChat added in v2.1.0

type MessageOriginChat struct {
	// Date the message was sent originally in Unix time
	Date int64 `json:"date"`
	// Chat that sent the message originally
	SenderChat Chat `json:"sender_chat"`
	// Optional. For messages originally sent by an anonymous chat administrator, original message author signature
	AuthorSignature string `json:"author_signature,omitempty"`
}

MessageOriginChat (https://core.telegram.org/bots/api#messageoriginchat)

The message was originally sent on behalf of a chat to a group chat.

func (MessageOriginChat) GetDate added in v2.1.0

func (v MessageOriginChat) GetDate() int64

GetDate is a helper method to easily access the common fields of an interface.

func (MessageOriginChat) GetType added in v2.1.0

func (v MessageOriginChat) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (MessageOriginChat) MarshalJSON added in v2.1.0

func (v MessageOriginChat) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (MessageOriginChat) MergeMessageOrigin added in v2.1.0

func (v MessageOriginChat) MergeMessageOrigin() MergedMessageOrigin

MergeMessageOrigin returns a MergedMessageOrigin struct to simplify working with types in a non-generic world.

type MessageOriginHiddenUser added in v2.1.0

type MessageOriginHiddenUser struct {
	// Date the message was sent originally in Unix time
	Date int64 `json:"date"`
	// Name of the user that sent the message originally
	SenderUserName string `json:"sender_user_name"`
}

MessageOriginHiddenUser (https://core.telegram.org/bots/api#messageoriginhiddenuser)

The message was originally sent by an unknown user.

func (MessageOriginHiddenUser) GetDate added in v2.1.0

func (v MessageOriginHiddenUser) GetDate() int64

GetDate is a helper method to easily access the common fields of an interface.

func (MessageOriginHiddenUser) GetType added in v2.1.0

func (v MessageOriginHiddenUser) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (MessageOriginHiddenUser) MarshalJSON added in v2.1.0

func (v MessageOriginHiddenUser) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (MessageOriginHiddenUser) MergeMessageOrigin added in v2.1.0

func (v MessageOriginHiddenUser) MergeMessageOrigin() MergedMessageOrigin

MergeMessageOrigin returns a MergedMessageOrigin struct to simplify working with types in a non-generic world.

type MessageOriginUser added in v2.1.0

type MessageOriginUser struct {
	// Date the message was sent originally in Unix time
	Date int64 `json:"date"`
	// User that sent the message originally
	SenderUser User `json:"sender_user"`
}

MessageOriginUser (https://core.telegram.org/bots/api#messageoriginuser)

The message was originally sent by a known user.

func (MessageOriginUser) GetDate added in v2.1.0

func (v MessageOriginUser) GetDate() int64

GetDate is a helper method to easily access the common fields of an interface.

func (MessageOriginUser) GetType added in v2.1.0

func (v MessageOriginUser) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (MessageOriginUser) MarshalJSON added in v2.1.0

func (v MessageOriginUser) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (MessageOriginUser) MergeMessageOrigin added in v2.1.0

func (v MessageOriginUser) MergeMessageOrigin() MergedMessageOrigin

MergeMessageOrigin returns a MergedMessageOrigin struct to simplify working with types in a non-generic world.

type MessageReactionCountUpdated added in v2.1.0

type MessageReactionCountUpdated struct {
	// The chat containing the message
	Chat Chat `json:"chat"`
	// Unique message identifier inside the chat
	MessageId int64 `json:"message_id"`
	// Date of the change in Unix time
	Date int64 `json:"date"`
	// List of reactions that are present on the message
	Reactions []ReactionCount `json:"reactions,omitempty"`
}

MessageReactionCountUpdated (https://core.telegram.org/bots/api#messagereactioncountupdated)

This object represents reaction changes on a message with anonymous reactions.

type MessageReactionUpdated added in v2.1.0

type MessageReactionUpdated struct {
	// The chat containing the message the user reacted to
	Chat Chat `json:"chat"`
	// Unique identifier of the message inside the chat
	MessageId int64 `json:"message_id"`
	// Optional. The user that changed the reaction, if the user isn't anonymous
	User *User `json:"user,omitempty"`
	// Optional. The chat on behalf of which the reaction was changed, if the user is anonymous
	ActorChat *Chat `json:"actor_chat,omitempty"`
	// Date of the change in Unix time
	Date int64 `json:"date"`
	// Previous list of reaction types that were set by the user
	OldReaction []ReactionType `json:"old_reaction,omitempty"`
	// New list of reaction types that have been set by the user
	NewReaction []ReactionType `json:"new_reaction,omitempty"`
}

MessageReactionUpdated (https://core.telegram.org/bots/api#messagereactionupdated)

This object represents a change of a reaction on a message performed by a user.

func (MessageReactionUpdated) GetSender added in v2.1.0

func (mru MessageReactionUpdated) GetSender() *Sender

GetSender populates the relevant fields of a Sender struct given a reaction.

func (*MessageReactionUpdated) UnmarshalJSON added in v2.1.0

func (v *MessageReactionUpdated) UnmarshalJSON(b []byte) error

UnmarshalJSON is a custom JSON unmarshaller to use the helpers which allow for unmarshalling structs into interfaces.

type OrderInfo

type OrderInfo struct {
	// Optional. User name
	Name string `json:"name,omitempty"`
	// Optional. User's phone number
	PhoneNumber string `json:"phone_number,omitempty"`
	// Optional. User email
	Email string `json:"email,omitempty"`
	// Optional. User shipping address
	ShippingAddress *ShippingAddress `json:"shipping_address,omitempty"`
}

OrderInfo (https://core.telegram.org/bots/api#orderinfo)

This object represents information about an order.

type PaidMedia added in v2.1.0

type PaidMedia interface {
	GetType() string
	// MergePaidMedia returns a MergedPaidMedia struct to simplify working with complex telegram types in a non-generic world.
	MergePaidMedia() MergedPaidMedia
	// contains filtered or unexported methods
}

PaidMedia (https://core.telegram.org/bots/api#paidmedia)

This object describes paid media. Currently, it can be one of

  • PaidMediaPreview
  • PaidMediaPhoto
  • PaidMediaVideo

type PaidMediaInfo added in v2.1.0

type PaidMediaInfo struct {
	// The number of Telegram Stars that must be paid to buy access to the media
	StarCount int64 `json:"star_count"`
	// Information about the paid media
	PaidMedia []PaidMedia `json:"paid_media,omitempty"`
}

PaidMediaInfo (https://core.telegram.org/bots/api#paidmediainfo)

Describes the paid media added to a message.

func (*PaidMediaInfo) UnmarshalJSON added in v2.1.0

func (v *PaidMediaInfo) UnmarshalJSON(b []byte) error

UnmarshalJSON is a custom JSON unmarshaller to use the helpers which allow for unmarshalling structs into interfaces.

type PaidMediaPhoto added in v2.1.0

type PaidMediaPhoto struct {
	// The photo
	Photo []PhotoSize `json:"photo,omitempty"`
}

PaidMediaPhoto (https://core.telegram.org/bots/api#paidmediaphoto)

The paid media is a photo.

func (PaidMediaPhoto) GetType added in v2.1.0

func (v PaidMediaPhoto) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (PaidMediaPhoto) MarshalJSON added in v2.1.0

func (v PaidMediaPhoto) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (PaidMediaPhoto) MergePaidMedia added in v2.1.0

func (v PaidMediaPhoto) MergePaidMedia() MergedPaidMedia

MergePaidMedia returns a MergedPaidMedia struct to simplify working with types in a non-generic world.

type PaidMediaPreview added in v2.1.0

type PaidMediaPreview struct {
	// Optional. Media width as defined by the sender
	Width int64 `json:"width,omitempty"`
	// Optional. Media height as defined by the sender
	Height int64 `json:"height,omitempty"`
	// Optional. Duration of the media in seconds as defined by the sender
	Duration int64 `json:"duration,omitempty"`
}

PaidMediaPreview (https://core.telegram.org/bots/api#paidmediapreview)

The paid media isn't available before the payment.

func (PaidMediaPreview) GetType added in v2.1.0

func (v PaidMediaPreview) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (PaidMediaPreview) MarshalJSON added in v2.1.0

func (v PaidMediaPreview) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (PaidMediaPreview) MergePaidMedia added in v2.1.0

func (v PaidMediaPreview) MergePaidMedia() MergedPaidMedia

MergePaidMedia returns a MergedPaidMedia struct to simplify working with types in a non-generic world.

type PaidMediaVideo added in v2.1.0

type PaidMediaVideo struct {
	// The video
	Video Video `json:"video"`
}

PaidMediaVideo (https://core.telegram.org/bots/api#paidmediavideo)

The paid media is a video.

func (PaidMediaVideo) GetType added in v2.1.0

func (v PaidMediaVideo) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (PaidMediaVideo) MarshalJSON added in v2.1.0

func (v PaidMediaVideo) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (PaidMediaVideo) MergePaidMedia added in v2.1.0

func (v PaidMediaVideo) MergePaidMedia() MergedPaidMedia

MergePaidMedia returns a MergedPaidMedia struct to simplify working with types in a non-generic world.

type ParsedMessageEntity

type ParsedMessageEntity struct {
	MessageEntity
	Text string `json:"text"`
}

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,omitempty"`
	// Encrypted credentials required to decrypt the data
	Credentials EncryptedCredentials `json:"credentials"`
}

PassportData (https://core.telegram.org/bots/api#passportdata)

Describes Telegram Passport data shared with the bot by the user.

type PassportElementError

type PassportElementError interface {
	GetSource() string
	GetType() string
	GetMessage() string
	// MergePassportElementError returns a MergedPassportElementError struct to simplify working with complex telegram types in a non-generic world.
	MergePassportElementError() MergedPassportElementError
	// contains filtered or unexported methods
}

PassportElementError (https://core.telegram.org/bots/api#passportelementerror)

This object represents an error in the Telegram Passport element which was submitted that should be resolved by the user. It should be one of:

  • PassportElementErrorDataField
  • PassportElementErrorFrontSide
  • PassportElementErrorReverseSide
  • PassportElementErrorSelfie
  • PassportElementErrorFile
  • PassportElementErrorFiles
  • PassportElementErrorTranslationFile
  • PassportElementErrorTranslationFiles
  • PassportElementErrorUnspecified

type PassportElementErrorDataField

type PassportElementErrorDataField struct {
	// 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 (https://core.telegram.org/bots/api#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.

func (PassportElementErrorDataField) GetMessage

func (v PassportElementErrorDataField) GetMessage() string

GetMessage is a helper method to easily access the common fields of an interface.

func (PassportElementErrorDataField) GetSource

func (v PassportElementErrorDataField) GetSource() string

GetSource is a helper method to easily access the common fields of an interface.

func (PassportElementErrorDataField) GetType

GetType is a helper method to easily access the common fields of an interface.

func (PassportElementErrorDataField) MarshalJSON

func (v PassportElementErrorDataField) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Source value.

func (PassportElementErrorDataField) MergePassportElementError

func (v PassportElementErrorDataField) MergePassportElementError() MergedPassportElementError

MergePassportElementError returns a MergedPassportElementError struct to simplify working with types in a non-generic world.

type PassportElementErrorFile

type PassportElementErrorFile struct {
	// 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 (https://core.telegram.org/bots/api#passportelementerrorfile)

Represents an issue with a document scan. The error is considered resolved when the file with the document scan changes.

func (PassportElementErrorFile) GetMessage

func (v PassportElementErrorFile) GetMessage() string

GetMessage is a helper method to easily access the common fields of an interface.

func (PassportElementErrorFile) GetSource

func (v PassportElementErrorFile) GetSource() string

GetSource is a helper method to easily access the common fields of an interface.

func (PassportElementErrorFile) GetType

func (v PassportElementErrorFile) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (PassportElementErrorFile) MarshalJSON

func (v PassportElementErrorFile) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Source value.

func (PassportElementErrorFile) MergePassportElementError

func (v PassportElementErrorFile) MergePassportElementError() MergedPassportElementError

MergePassportElementError returns a MergedPassportElementError struct to simplify working with types in a non-generic world.

type PassportElementErrorFiles

type PassportElementErrorFiles struct {
	// 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,omitempty"`
	// Error message
	Message string `json:"message"`
}

PassportElementErrorFiles (https://core.telegram.org/bots/api#passportelementerrorfiles)

Represents an issue with a list of scans. The error is considered resolved when the list of files containing the scans changes.

func (PassportElementErrorFiles) GetMessage

func (v PassportElementErrorFiles) GetMessage() string

GetMessage is a helper method to easily access the common fields of an interface.

func (PassportElementErrorFiles) GetSource

func (v PassportElementErrorFiles) GetSource() string

GetSource is a helper method to easily access the common fields of an interface.

func (PassportElementErrorFiles) GetType

func (v PassportElementErrorFiles) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (PassportElementErrorFiles) MarshalJSON

func (v PassportElementErrorFiles) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Source value.

func (PassportElementErrorFiles) MergePassportElementError

func (v PassportElementErrorFiles) MergePassportElementError() MergedPassportElementError

MergePassportElementError returns a MergedPassportElementError struct to simplify working with types in a non-generic world.

type PassportElementErrorFrontSide

type PassportElementErrorFrontSide struct {
	// 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 (https://core.telegram.org/bots/api#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.

func (PassportElementErrorFrontSide) GetMessage

func (v PassportElementErrorFrontSide) GetMessage() string

GetMessage is a helper method to easily access the common fields of an interface.

func (PassportElementErrorFrontSide) GetSource

func (v PassportElementErrorFrontSide) GetSource() string

GetSource is a helper method to easily access the common fields of an interface.

func (PassportElementErrorFrontSide) GetType

GetType is a helper method to easily access the common fields of an interface.

func (PassportElementErrorFrontSide) MarshalJSON

func (v PassportElementErrorFrontSide) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Source value.

func (PassportElementErrorFrontSide) MergePassportElementError

func (v PassportElementErrorFrontSide) MergePassportElementError() MergedPassportElementError

MergePassportElementError returns a MergedPassportElementError struct to simplify working with types in a non-generic world.

type PassportElementErrorReverseSide

type PassportElementErrorReverseSide struct {
	// 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 (https://core.telegram.org/bots/api#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.

func (PassportElementErrorReverseSide) GetMessage

func (v PassportElementErrorReverseSide) GetMessage() string

GetMessage is a helper method to easily access the common fields of an interface.

func (PassportElementErrorReverseSide) GetSource

GetSource is a helper method to easily access the common fields of an interface.

func (PassportElementErrorReverseSide) GetType

GetType is a helper method to easily access the common fields of an interface.

func (PassportElementErrorReverseSide) MarshalJSON

func (v PassportElementErrorReverseSide) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Source value.

func (PassportElementErrorReverseSide) MergePassportElementError

func (v PassportElementErrorReverseSide) MergePassportElementError() MergedPassportElementError

MergePassportElementError returns a MergedPassportElementError struct to simplify working with types in a non-generic world.

type PassportElementErrorSelfie

type PassportElementErrorSelfie struct {
	// 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 (https://core.telegram.org/bots/api#passportelementerrorselfie)

Represents an issue with the selfie with a document. The error is considered resolved when the file with the selfie changes.

func (PassportElementErrorSelfie) GetMessage

func (v PassportElementErrorSelfie) GetMessage() string

GetMessage is a helper method to easily access the common fields of an interface.

func (PassportElementErrorSelfie) GetSource

func (v PassportElementErrorSelfie) GetSource() string

GetSource is a helper method to easily access the common fields of an interface.

func (PassportElementErrorSelfie) GetType

func (v PassportElementErrorSelfie) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (PassportElementErrorSelfie) MarshalJSON

func (v PassportElementErrorSelfie) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Source value.

func (PassportElementErrorSelfie) MergePassportElementError

func (v PassportElementErrorSelfie) MergePassportElementError() MergedPassportElementError

MergePassportElementError returns a MergedPassportElementError struct to simplify working with types in a non-generic world.

type PassportElementErrorTranslationFile

type PassportElementErrorTranslationFile struct {
	// 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 (https://core.telegram.org/bots/api#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.

func (PassportElementErrorTranslationFile) GetMessage

GetMessage is a helper method to easily access the common fields of an interface.

func (PassportElementErrorTranslationFile) GetSource

GetSource is a helper method to easily access the common fields of an interface.

func (PassportElementErrorTranslationFile) GetType

GetType is a helper method to easily access the common fields of an interface.

func (PassportElementErrorTranslationFile) MarshalJSON

func (v PassportElementErrorTranslationFile) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Source value.

func (PassportElementErrorTranslationFile) MergePassportElementError

MergePassportElementError returns a MergedPassportElementError struct to simplify working with types in a non-generic world.

type PassportElementErrorTranslationFiles

type PassportElementErrorTranslationFiles struct {
	// 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,omitempty"`
	// Error message
	Message string `json:"message"`
}

PassportElementErrorTranslationFiles (https://core.telegram.org/bots/api#passportelementerrortranslationfiles)

Represents an issue with the translated version of a document. The error is considered resolved when a file with the document translation change.

func (PassportElementErrorTranslationFiles) GetMessage

GetMessage is a helper method to easily access the common fields of an interface.

func (PassportElementErrorTranslationFiles) GetSource

GetSource is a helper method to easily access the common fields of an interface.

func (PassportElementErrorTranslationFiles) GetType

GetType is a helper method to easily access the common fields of an interface.

func (PassportElementErrorTranslationFiles) MarshalJSON

func (v PassportElementErrorTranslationFiles) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Source value.

func (PassportElementErrorTranslationFiles) MergePassportElementError

MergePassportElementError returns a MergedPassportElementError struct to simplify working with types in a non-generic world.

type PassportElementErrorUnspecified

type PassportElementErrorUnspecified struct {
	// 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 (https://core.telegram.org/bots/api#passportelementerrorunspecified)

Represents an issue in an unspecified place. The error is considered resolved when new data is added.

func (PassportElementErrorUnspecified) GetMessage

func (v PassportElementErrorUnspecified) GetMessage() string

GetMessage is a helper method to easily access the common fields of an interface.

func (PassportElementErrorUnspecified) GetSource

GetSource is a helper method to easily access the common fields of an interface.

func (PassportElementErrorUnspecified) GetType

GetType is a helper method to easily access the common fields of an interface.

func (PassportElementErrorUnspecified) MarshalJSON

func (v PassportElementErrorUnspecified) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Source value.

func (PassportElementErrorUnspecified) MergePassportElementError

func (v PassportElementErrorUnspecified) MergePassportElementError() MergedPassportElementError

MergePassportElementError returns a MergedPassportElementError struct to simplify working with types in a non-generic world.

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 in bytes
	FileSize int64 `json:"file_size"`
	// Unix time when the file was uploaded
	FileDate int64 `json:"file_date"`
}

PassportFile (https://core.telegram.org/bots/api#passportfile)

This object represents a file uploaded to Telegram Passport. Currently all Telegram Passport files are in JPEG format when decrypted and don't exceed 10MB.

type PhotoSize

type PhotoSize struct {
	// Identifier for this file, which can be used to download or reuse the file
	FileId 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 int64 `json:"width"`
	// Photo height
	Height int64 `json:"height"`
	// Optional. File size in bytes
	FileSize int64 `json:"file_size,omitempty"`
}

PhotoSize (https://core.telegram.org/bots/api#photosize)

This object represents one size of a photo or a file / sticker thumbnail.

type PinChatMessageOpts

type PinChatMessageOpts struct {
	// Unique identifier of the business connection on behalf of which the message will be pinned
	BusinessConnectionId string
	// Pass True if it is not necessary to send a notification to all chat members about the new pinned message. Notifications are always disabled in channels and private chats.
	DisableNotification bool
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

PinChatMessageOpts is the set of optional fields for Bot.PinChatMessage.

type Poll

type Poll struct {
	// Unique poll identifier
	Id string `json:"id"`
	// Poll question, 1-300 characters
	Question string `json:"question"`
	// Optional. Special entities that appear in the question. Currently, only custom emoji entities are allowed in poll questions
	QuestionEntities []MessageEntity `json:"question_entities,omitempty"`
	// List of poll options
	Options []PollOption `json:"options,omitempty"`
	// Total number of users that voted in the poll
	TotalVoterCount int64 `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"`
	// Optional. 0-based identifier of the correct answer option. Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to the private chat with the bot.
	CorrectOptionId int64 `json:"correct_option_id,omitempty"`
	// Optional. Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters
	Explanation string `json:"explanation,omitempty"`
	// Optional. Special entities like usernames, URLs, bot commands, etc. that appear in the explanation
	ExplanationEntities []MessageEntity `json:"explanation_entities,omitempty"`
	// Optional. Amount of time in seconds the poll will be active after creation
	OpenPeriod int64 `json:"open_period,omitempty"`
	// Optional. Point in time (Unix timestamp) when the poll will be automatically closed
	CloseDate int64 `json:"close_date,omitempty"`
}

Poll (https://core.telegram.org/bots/api#poll)

This object contains information about a poll.

type PollAnswer

type PollAnswer struct {
	// Unique poll identifier
	PollId string `json:"poll_id"`
	// Optional. The chat that changed the answer to the poll, if the voter is anonymous
	VoterChat *Chat `json:"voter_chat,omitempty"`
	// Optional. The user that changed the answer to the poll, if the voter isn't anonymous
	User *User `json:"user,omitempty"`
	// 0-based identifiers of chosen answer options. May be empty if the vote was retracted.
	OptionIds []int64 `json:"option_ids,omitempty"`
}

PollAnswer (https://core.telegram.org/bots/api#pollanswer)

This object represents an answer of a user in a non-anonymous poll.

func (PollAnswer) GetSender added in v2.1.0

func (pa PollAnswer) GetSender() *Sender

GetSender populates the relevant fields of a Sender struct given a poll answer.

type PollOption

type PollOption struct {
	// Option text, 1-100 characters
	Text string `json:"text"`
	// Optional. Special entities that appear in the option text. Currently, only custom emoji entities are allowed in poll option texts
	TextEntities []MessageEntity `json:"text_entities,omitempty"`
	// Number of users that voted for this option
	VoterCount int64 `json:"voter_count"`
}

PollOption (https://core.telegram.org/bots/api#polloption)

This object contains information about one answer option in a poll.

type PreCheckoutQuery

type PreCheckoutQuery struct {
	// Unique query identifier
	Id string `json:"id"`
	// User who sent the query
	From User `json:"from"`
	// Three-letter ISO 4217 currency code, or "XTR" for payments in Telegram Stars
	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 int64 `json:"total_amount"`
	// Bot-specified invoice payload
	InvoicePayload string `json:"invoice_payload"`
	// Optional. Identifier of the shipping option chosen by the user
	ShippingOptionId string `json:"shipping_option_id,omitempty"`
	// Optional. Order information provided by the user
	OrderInfo *OrderInfo `json:"order_info,omitempty"`
}

PreCheckoutQuery (https://core.telegram.org/bots/api#precheckoutquery)

This object contains information about an incoming pre-checkout query.

func (PreCheckoutQuery) Answer

func (pcq PreCheckoutQuery) Answer(b *Bot, ok bool, opts *AnswerPreCheckoutQueryOpts) (bool, error)

Answer Helper method for Bot.AnswerPreCheckoutQuery.

type PromoteChatMemberOpts

type PromoteChatMemberOpts struct {
	// Pass True if the administrator's presence in the chat is hidden
	IsAnonymous bool
	// Pass True if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages and ignore slow mode. Implied by any other administrator privilege.
	CanManageChat bool
	// Pass True if the administrator can delete messages of other users
	CanDeleteMessages bool
	// Pass True if the administrator can manage video chats
	CanManageVideoChats bool
	// Pass True if the administrator can restrict, ban or unban chat members, or access supergroup statistics
	CanRestrictMembers bool
	// Pass True if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by him)
	CanPromoteMembers bool
	// Pass True if the administrator can change chat title, photo and other settings
	CanChangeInfo bool
	// Pass True if the administrator can invite new users to the chat
	CanInviteUsers bool
	// Pass True if the administrator can post stories to the chat
	CanPostStories bool
	// Pass True if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access the chat's story archive
	CanEditStories bool
	// Pass True if the administrator can delete stories posted by other users
	CanDeleteStories bool
	// Pass True if the administrator can post messages in the channel, or access channel statistics; for channels only
	CanPostMessages bool
	// Pass True if the administrator can edit messages of other users and can pin messages; for channels only
	CanEditMessages bool
	// Pass True if the administrator can pin messages; for supergroups only
	CanPinMessages bool
	// Pass True if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only
	CanManageTopics bool
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

PromoteChatMemberOpts is the set of optional fields for Bot.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 int64 `json:"distance"`
}

ProximityAlertTriggered (https://core.telegram.org/bots/api#proximityalerttriggered)

This object represents the content of a service message, sent whenever a user in the chat triggers a proximity alert set by another user.

type ReactionCount added in v2.1.0

type ReactionCount struct {
	// Type of the reaction
	Type ReactionType `json:"type"`
	// Number of times the reaction was added
	TotalCount int64 `json:"total_count"`
}

ReactionCount (https://core.telegram.org/bots/api#reactioncount)

Represents a reaction added to a message along with the number of times it was added.

func (*ReactionCount) UnmarshalJSON added in v2.1.0

func (v *ReactionCount) UnmarshalJSON(b []byte) error

UnmarshalJSON is a custom JSON unmarshaller to use the helpers which allow for unmarshalling structs into interfaces.

type ReactionType added in v2.1.0

type ReactionType interface {
	GetType() string
	// MergeReactionType returns a MergedReactionType struct to simplify working with complex telegram types in a non-generic world.
	MergeReactionType() MergedReactionType
	// contains filtered or unexported methods
}

ReactionType (https://core.telegram.org/bots/api#reactiontype)

This object describes the type of a reaction. Currently, it can be one of

  • ReactionTypeEmoji
  • ReactionTypeCustomEmoji
  • ReactionTypePaid

type ReactionTypeCustomEmoji added in v2.1.0

type ReactionTypeCustomEmoji struct {
	// Custom emoji identifier
	CustomEmojiId string `json:"custom_emoji_id"`
}

ReactionTypeCustomEmoji (https://core.telegram.org/bots/api#reactiontypecustomemoji)

The reaction is based on a custom emoji.

func (ReactionTypeCustomEmoji) GetType added in v2.1.0

func (v ReactionTypeCustomEmoji) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (ReactionTypeCustomEmoji) MarshalJSON added in v2.1.0

func (v ReactionTypeCustomEmoji) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (ReactionTypeCustomEmoji) MergeReactionType added in v2.1.0

func (v ReactionTypeCustomEmoji) MergeReactionType() MergedReactionType

MergeReactionType returns a MergedReactionType struct to simplify working with types in a non-generic world.

type ReactionTypeEmoji added in v2.1.0

type ReactionTypeEmoji struct {
	// Reaction emoji. Currently, it can be one of "👍", "👎", "❤", "🔥", "🥰", "👏", "😁", "🤔", "🤯", "😱", "🤬", "😢", "🎉", "🤩", "🤮", "💩", "🙏", "👌", "🕊", "🤡", "🥱", "🥴", "😍", "🐳", "❤‍🔥", "🌚", "🌭", "💯", "🤣", "⚡", "🍌", "🏆", "💔", "🤨", "😐", "🍓", "🍾", "💋", "🖕", "😈", "😴", "😭", "🤓", "👻", "👨‍💻", "👀", "🎃", "🙈", "😇", "😨", "🤝", "✍", "🤗", "🫡", "🎅", "🎄", "☃", "💅", "🤪", "🗿", "🆒", "💘", "🙉", "🦄", "😘", "💊", "🙊", "😎", "👾", "🤷‍♂", "🤷", "🤷‍♀", "😡"
	Emoji string `json:"emoji"`
}

ReactionTypeEmoji (https://core.telegram.org/bots/api#reactiontypeemoji)

The reaction is based on an emoji.

func (ReactionTypeEmoji) GetType added in v2.1.0

func (v ReactionTypeEmoji) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (ReactionTypeEmoji) MarshalJSON added in v2.1.0

func (v ReactionTypeEmoji) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (ReactionTypeEmoji) MergeReactionType added in v2.1.0

func (v ReactionTypeEmoji) MergeReactionType() MergedReactionType

MergeReactionType returns a MergedReactionType struct to simplify working with types in a non-generic world.

type ReactionTypePaid added in v2.1.0

type ReactionTypePaid struct{}

ReactionTypePaid (https://core.telegram.org/bots/api#reactiontypepaid)

The reaction is paid.

func (ReactionTypePaid) GetType added in v2.1.0

func (v ReactionTypePaid) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (ReactionTypePaid) MarshalJSON added in v2.1.0

func (v ReactionTypePaid) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (ReactionTypePaid) MergeReactionType added in v2.1.0

func (v ReactionTypePaid) MergeReactionType() MergedReactionType

MergeReactionType returns a MergedReactionType struct to simplify working with types in a non-generic world.

type RefundStarPaymentOpts added in v2.1.0

type RefundStarPaymentOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

RefundStarPaymentOpts is the set of optional fields for Bot.RefundStarPayment.

type RefundedPayment added in v2.1.0

type RefundedPayment struct {
	// Three-letter ISO 4217 currency code, or "XTR" for payments in Telegram Stars. Currently, always "XTR"
	Currency string `json:"currency"`
	// Total refunded price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45, total_amount = 145. 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 int64 `json:"total_amount"`
	// Bot-specified invoice payload
	InvoicePayload string `json:"invoice_payload"`
	// Telegram payment identifier
	TelegramPaymentChargeId string `json:"telegram_payment_charge_id"`
	// Optional. Provider payment identifier
	ProviderPaymentChargeId string `json:"provider_payment_charge_id,omitempty"`
}

RefundedPayment (https://core.telegram.org/bots/api#refundedpayment)

This object contains basic information about a refunded payment.

type ReopenForumTopicOpts

type ReopenForumTopicOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

ReopenForumTopicOpts is the set of optional fields for Bot.ReopenForumTopic.

type ReopenGeneralForumTopicOpts

type ReopenGeneralForumTopicOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

ReopenGeneralForumTopicOpts is the set of optional fields for Bot.ReopenGeneralForumTopic.

type ReplaceStickerInSetOpts added in v2.1.0

type ReplaceStickerInSetOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

ReplaceStickerInSetOpts is the set of optional fields for Bot.ReplaceStickerInSet.

type ReplyKeyboardMarkup

type ReplyKeyboardMarkup struct {
	// Array of button rows, each represented by an Array of KeyboardButton objects
	Keyboard [][]KeyboardButton `json:"keyboard,omitempty"`
	// Optional. Requests clients to always show the keyboard when the regular keyboard is hidden. Defaults to false, in which case the custom keyboard can be hidden and opened with a keyboard icon.
	IsPersistent bool `json:"is_persistent,omitempty"`
	// Optional. Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). Defaults to false, in which case the custom keyboard is always of the same height as the app's standard keyboard.
	ResizeKeyboard bool `json:"resize_keyboard,omitempty"`
	// Optional. Requests clients to hide the keyboard as soon as it's been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat - the user can press a special button in the input field to see the custom keyboard again. Defaults to false.
	OneTimeKeyboard bool `json:"one_time_keyboard,omitempty"`
	// Optional. The placeholder to be shown in the input field when the keyboard is active; 1-64 characters
	InputFieldPlaceholder string `json:"input_field_placeholder,omitempty"`
	// Optional. Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply to a message in the same chat and forum topic, 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 (https://core.telegram.org/bots/api#replykeyboardmarkup)

This object represents a custom keyboard with reply options (see Introduction to bots for details and examples). Not supported in channels and for messages sent on behalf of a Telegram Business account.

type ReplyKeyboardRemove

type ReplyKeyboardRemove struct {
	// Requests clients to remove the custom keyboard (user will not be able to summon this keyboard; if you want to hide the keyboard from sight but keep it accessible, use one_time_keyboard in ReplyKeyboardMarkup)
	RemoveKeyboard bool `json:"remove_keyboard"`
	// Optional. Use this parameter if you want to remove the keyboard for specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply to a message in the same chat and forum topic, 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 (https://core.telegram.org/bots/api#replykeyboardremove)

Upon receiving a message with this object, Telegram clients will remove the current custom keyboard and display the default letter-keyboard. By default, custom keyboards are displayed until a new keyboard is sent by a bot. An exception is made for one-time keyboards that are hidden immediately after the user presses a button (see ReplyKeyboardMarkup). Not supported in channels and for messages sent on behalf of a Telegram Business account.

type ReplyMarkup

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

type ReplyParameters added in v2.1.0

type ReplyParameters struct {
	// Identifier of the message that will be replied to in the current chat, or in the chat chat_id if it is specified
	MessageId int64 `json:"message_id"`
	// Optional. If the message to be replied to is from a different chat, unique identifier for the chat. Not supported for messages sent on behalf of a business account.
	ChatId int64 `json:"chat_id,omitempty"`
	// Optional. Pass True if the message should be sent even if the specified message to be replied to is not found. Always False for replies in another chat or forum topic. Always True for messages sent on behalf of a business account.
	AllowSendingWithoutReply bool `json:"allow_sending_without_reply,omitempty"`
	// Optional. Quoted part of the message to be replied to; 0-1024 characters after entities parsing. The quote must be an exact substring of the message to be replied to, including bold, italic, underline, strikethrough, spoiler, and custom_emoji entities. The message will fail to send if the quote isn't found in the original message.
	Quote string `json:"quote,omitempty"`
	// Optional. Mode for parsing entities in the quote. See formatting options for more details.
	QuoteParseMode string `json:"quote_parse_mode,omitempty"`
	// Optional. A JSON-serialized list of special entities that appear in the quote. It can be specified instead of quote_parse_mode.
	QuoteEntities []MessageEntity `json:"quote_entities,omitempty"`
	// Optional. Position of the quote in the original message in UTF-16 code units
	QuotePosition int64 `json:"quote_position,omitempty"`
}

ReplyParameters (https://core.telegram.org/bots/api#replyparameters)

Describes reply parameters for the message that is being sent.

type RequestOpts

type RequestOpts struct {
	// Timeout for the HTTP request to the telegram API.
	Timeout time.Duration
	// Custom API URL to use for requests.
	APIURL string
}

RequestOpts defines any request-specific options used to interact with the telegram API.

type Response

type Response struct {
	// Ok: if true, request was successful, and result can be found in the Result field.
	// If false, error can be explained in the Description.
	Ok bool `json:"ok"`
	// Result: result of requests (if Ok)
	Result json.RawMessage `json:"result"`
	// ErrorCode: Integer error code of request. Subject to change in the future.
	ErrorCode int `json:"error_code"`
	// Description: contains a human readable description of the error result.
	Description string `json:"description"`
	// Parameters: Optional extra data which can help automatically handle the error.
	Parameters *ResponseParameters `json:"parameters"`
}

type ResponseParameters

type ResponseParameters struct {
	// Optional. The group has been migrated to a supergroup with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.
	MigrateToChatId int64 `json:"migrate_to_chat_id,omitempty"`
	// Optional. In case of exceeding flood control, the number of seconds left to wait before the request can be repeated
	RetryAfter int64 `json:"retry_after,omitempty"`
}

ResponseParameters (https://core.telegram.org/bots/api#responseparameters)

Describes why a request was unsuccessful.

type RestrictChatMemberOpts

type RestrictChatMemberOpts struct {
	// Pass True if chat permissions are set independently. Otherwise, the can_send_other_messages and can_add_web_page_previews permissions will imply the can_send_messages, can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, and can_send_voice_notes permissions; the can_send_polls permission will imply the can_send_messages permission.
	UseIndependentChatPermissions bool
	// 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
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

RestrictChatMemberOpts is the set of optional fields for Bot.RestrictChatMember.

type RevenueWithdrawalState added in v2.1.0

type RevenueWithdrawalState interface {
	GetType() string
	// MergeRevenueWithdrawalState returns a MergedRevenueWithdrawalState struct to simplify working with complex telegram types in a non-generic world.
	MergeRevenueWithdrawalState() MergedRevenueWithdrawalState
	// contains filtered or unexported methods
}

RevenueWithdrawalState (https://core.telegram.org/bots/api#revenuewithdrawalstate)

This object describes the state of a revenue withdrawal operation. Currently, it can be one of

  • RevenueWithdrawalStatePending
  • RevenueWithdrawalStateSucceeded
  • RevenueWithdrawalStateFailed

type RevenueWithdrawalStateFailed added in v2.1.0

type RevenueWithdrawalStateFailed struct{}

RevenueWithdrawalStateFailed (https://core.telegram.org/bots/api#revenuewithdrawalstatefailed)

The withdrawal failed and the transaction was refunded.

func (RevenueWithdrawalStateFailed) GetType added in v2.1.0

GetType is a helper method to easily access the common fields of an interface.

func (RevenueWithdrawalStateFailed) MarshalJSON added in v2.1.0

func (v RevenueWithdrawalStateFailed) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (RevenueWithdrawalStateFailed) MergeRevenueWithdrawalState added in v2.1.0

func (v RevenueWithdrawalStateFailed) MergeRevenueWithdrawalState() MergedRevenueWithdrawalState

MergeRevenueWithdrawalState returns a MergedRevenueWithdrawalState struct to simplify working with types in a non-generic world.

type RevenueWithdrawalStatePending added in v2.1.0

type RevenueWithdrawalStatePending struct{}

RevenueWithdrawalStatePending (https://core.telegram.org/bots/api#revenuewithdrawalstatepending)

The withdrawal is in progress.

func (RevenueWithdrawalStatePending) GetType added in v2.1.0

GetType is a helper method to easily access the common fields of an interface.

func (RevenueWithdrawalStatePending) MarshalJSON added in v2.1.0

func (v RevenueWithdrawalStatePending) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (RevenueWithdrawalStatePending) MergeRevenueWithdrawalState added in v2.1.0

func (v RevenueWithdrawalStatePending) MergeRevenueWithdrawalState() MergedRevenueWithdrawalState

MergeRevenueWithdrawalState returns a MergedRevenueWithdrawalState struct to simplify working with types in a non-generic world.

type RevenueWithdrawalStateSucceeded added in v2.1.0

type RevenueWithdrawalStateSucceeded struct {
	// Date the withdrawal was completed in Unix time
	Date int64 `json:"date"`
	// An HTTPS URL that can be used to see transaction details
	Url string `json:"url"`
}

RevenueWithdrawalStateSucceeded (https://core.telegram.org/bots/api#revenuewithdrawalstatesucceeded)

The withdrawal succeeded.

func (RevenueWithdrawalStateSucceeded) GetType added in v2.1.0

GetType is a helper method to easily access the common fields of an interface.

func (RevenueWithdrawalStateSucceeded) MarshalJSON added in v2.1.0

func (v RevenueWithdrawalStateSucceeded) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (RevenueWithdrawalStateSucceeded) MergeRevenueWithdrawalState added in v2.1.0

func (v RevenueWithdrawalStateSucceeded) MergeRevenueWithdrawalState() MergedRevenueWithdrawalState

MergeRevenueWithdrawalState returns a MergedRevenueWithdrawalState struct to simplify working with types in a non-generic world.

type RevokeChatInviteLinkOpts

type RevokeChatInviteLinkOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

RevokeChatInviteLinkOpts is the set of optional fields for Bot.RevokeChatInviteLink.

type SendAnimationOpts

type SendAnimationOpts struct {
	// Unique identifier of the business connection on behalf of which the message will be sent
	BusinessConnectionId string
	// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
	MessageThreadId int64
	// Duration of sent animation in seconds
	Duration int64
	// Animation width
	Width int64
	// Animation height
	Height int64
	// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://<file_attach_name>" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files: https://core.telegram.org/bots/api#sending-files
	Thumbnail InputFile
	// Animation caption (may also be used when resending animation by file_id), 0-1024 characters after entities parsing
	Caption string
	// Mode for parsing entities in the animation caption. See formatting options for more details.
	ParseMode string
	// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []MessageEntity
	// Pass True, if the caption must be shown above the message media
	ShowCaptionAboveMedia bool
	// Pass True if the animation needs to be covered with a spoiler animation
	HasSpoiler bool
	// Sends the message silently. Users will receive a notification with no sound.
	DisableNotification bool
	// Protects the contents of the sent message from forwarding and saving
	ProtectContent bool
	// Unique identifier of the message effect to be added to the message; for private chats only
	MessageEffectId string
	// Description of the message to reply to
	ReplyParameters *ReplyParameters
	// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
	ReplyMarkup ReplyMarkup
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SendAnimationOpts is the set of optional fields for Bot.SendAnimation.

type SendAudioOpts

type SendAudioOpts struct {
	// Unique identifier of the business connection on behalf of which the message will be sent
	BusinessConnectionId string
	// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
	MessageThreadId int64
	// Audio caption, 0-1024 characters after entities parsing
	Caption string
	// Mode for parsing entities in the audio caption. See formatting options for more details.
	ParseMode string
	// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []MessageEntity
	// Duration of the audio in seconds
	Duration int64
	// Performer
	Performer string
	// Track name
	Title string
	// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://<file_attach_name>" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files: https://core.telegram.org/bots/api#sending-files
	Thumbnail InputFile
	// Sends the message silently. Users will receive a notification with no sound.
	DisableNotification bool
	// Protects the contents of the sent message from forwarding and saving
	ProtectContent bool
	// Unique identifier of the message effect to be added to the message; for private chats only
	MessageEffectId string
	// Description of the message to reply to
	ReplyParameters *ReplyParameters
	// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
	ReplyMarkup ReplyMarkup
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SendAudioOpts is the set of optional fields for Bot.SendAudio.

type SendChatActionOpts

type SendChatActionOpts struct {
	// Unique identifier of the business connection on behalf of which the action will be sent
	BusinessConnectionId string
	// Unique identifier for the target message thread; for supergroups only
	MessageThreadId int64
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SendChatActionOpts is the set of optional fields for Bot.SendChatAction.

type SendContactOpts

type SendContactOpts struct {
	// Unique identifier of the business connection on behalf of which the message will be sent
	BusinessConnectionId string
	// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
	MessageThreadId int64
	// Contact's last name
	LastName string
	// Additional data about the contact in the form of a vCard, 0-2048 bytes
	Vcard string
	// Sends the message silently. Users will receive a notification with no sound.
	DisableNotification bool
	// Protects the contents of the sent message from forwarding and saving
	ProtectContent bool
	// Unique identifier of the message effect to be added to the message; for private chats only
	MessageEffectId string
	// Description of the message to reply to
	ReplyParameters *ReplyParameters
	// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
	ReplyMarkup ReplyMarkup
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SendContactOpts is the set of optional fields for Bot.SendContact.

type SendDiceOpts

type SendDiceOpts struct {
	// Unique identifier of the business connection on behalf of which the message will be sent
	BusinessConnectionId string
	// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
	MessageThreadId int64
	// 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
	// Sends the message silently. Users will receive a notification with no sound.
	DisableNotification bool
	// Protects the contents of the sent message from forwarding
	ProtectContent bool
	// Unique identifier of the message effect to be added to the message; for private chats only
	MessageEffectId string
	// Description of the message to reply to
	ReplyParameters *ReplyParameters
	// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
	ReplyMarkup ReplyMarkup
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SendDiceOpts is the set of optional fields for Bot.SendDice.

type SendDocumentOpts

type SendDocumentOpts struct {
	// Unique identifier of the business connection on behalf of which the message will be sent
	BusinessConnectionId string
	// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
	MessageThreadId int64
	// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://<file_attach_name>" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files: https://core.telegram.org/bots/api#sending-files
	Thumbnail InputFile
	// Document caption (may also be used when resending documents by file_id), 0-1024 characters after entities parsing
	Caption string
	// Mode for parsing entities in the document caption. See formatting options for more details.
	ParseMode string
	// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []MessageEntity
	// Disables automatic server-side content type detection for files uploaded using multipart/form-data
	DisableContentTypeDetection bool
	// Sends the message silently. Users will receive a notification with no sound.
	DisableNotification bool
	// Protects the contents of the sent message from forwarding and saving
	ProtectContent bool
	// Unique identifier of the message effect to be added to the message; for private chats only
	MessageEffectId string
	// Description of the message to reply to
	ReplyParameters *ReplyParameters
	// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
	ReplyMarkup ReplyMarkup
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SendDocumentOpts is the set of optional fields for Bot.SendDocument.

type SendGameOpts

type SendGameOpts struct {
	// Unique identifier of the business connection on behalf of which the message will be sent
	BusinessConnectionId string
	// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
	MessageThreadId int64
	// Sends the message silently. Users will receive a notification with no sound.
	DisableNotification bool
	// Protects the contents of the sent message from forwarding and saving
	ProtectContent bool
	// Unique identifier of the message effect to be added to the message; for private chats only
	MessageEffectId string
	// Description of the message to reply to
	ReplyParameters *ReplyParameters
	// 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
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SendGameOpts is the set of optional fields for Bot.SendGame.

type SendInvoiceOpts

type SendInvoiceOpts struct {
	// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
	MessageThreadId int64
	// Payment provider token, obtained via @BotFather. Pass an empty string for payments in Telegram Stars.
	ProviderToken string
	// 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. Not supported for payments in Telegram Stars.
	MaxTipAmount int64
	// 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 []int64
	// Unique deep-linking parameter. If left empty, forwarded copies of the sent message will have a Pay button, allowing multiple users to pay directly from the forwarded message, using the same invoice. If non-empty, forwarded copies of the sent message will have a URL button with a deep link to the bot (instead of a Pay button), with the value used as the start parameter
	StartParameter string
	// JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider.
	ProviderData string
	// 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
	// Photo size in bytes
	PhotoSize int64
	// Photo width
	PhotoWidth int64
	// Photo height
	PhotoHeight int64
	// Pass True if you require the user's full name to complete the order. Ignored for payments in Telegram Stars.
	NeedName bool
	// Pass True if you require the user's phone number to complete the order. Ignored for payments in Telegram Stars.
	NeedPhoneNumber bool
	// Pass True if you require the user's email address to complete the order. Ignored for payments in Telegram Stars.
	NeedEmail bool
	// Pass True if you require the user's shipping address to complete the order. Ignored for payments in Telegram Stars.
	NeedShippingAddress bool
	// Pass True if the user's phone number should be sent to the provider. Ignored for payments in Telegram Stars.
	SendPhoneNumberToProvider bool
	// Pass True if the user's email address should be sent to the provider. Ignored for payments in Telegram Stars.
	SendEmailToProvider bool
	// Pass True if the final price depends on the shipping method. Ignored for payments in Telegram Stars.
	IsFlexible bool
	// Sends the message silently. Users will receive a notification with no sound.
	DisableNotification bool
	// Protects the contents of the sent message from forwarding and saving
	ProtectContent bool
	// Unique identifier of the message effect to be added to the message; for private chats only
	MessageEffectId string
	// Description of the message to reply to
	ReplyParameters *ReplyParameters
	// 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
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SendInvoiceOpts is the set of optional fields for Bot.SendInvoice.

type SendLocationOpts

type SendLocationOpts struct {
	// Unique identifier of the business connection on behalf of which the message will be sent
	BusinessConnectionId string
	// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
	MessageThreadId int64
	// The radius of uncertainty for the location, measured in meters; 0-1500
	HorizontalAccuracy float64
	// Period in seconds during which the location will be updated (see Live Locations, should be between 60 and 86400, or 0x7FFFFFFF for live locations that can be edited indefinitely.
	LivePeriod int64
	// For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.
	Heading int64
	// 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 int64
	// Sends the message silently. Users will receive a notification with no sound.
	DisableNotification bool
	// Protects the contents of the sent message from forwarding and saving
	ProtectContent bool
	// Unique identifier of the message effect to be added to the message; for private chats only
	MessageEffectId string
	// Description of the message to reply to
	ReplyParameters *ReplyParameters
	// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
	ReplyMarkup ReplyMarkup
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SendLocationOpts is the set of optional fields for Bot.SendLocation.

type SendMediaGroupOpts

type SendMediaGroupOpts struct {
	// Unique identifier of the business connection on behalf of which the message will be sent
	BusinessConnectionId string
	// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
	MessageThreadId int64
	// Sends messages silently. Users will receive a notification with no sound.
	DisableNotification bool
	// Protects the contents of the sent messages from forwarding and saving
	ProtectContent bool
	// Unique identifier of the message effect to be added to the message; for private chats only
	MessageEffectId string
	// Description of the message to reply to
	ReplyParameters *ReplyParameters
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SendMediaGroupOpts is the set of optional fields for Bot.SendMediaGroup.

type SendMessageOpts

type SendMessageOpts struct {
	// Unique identifier of the business connection on behalf of which the message will be sent
	BusinessConnectionId string
	// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
	MessageThreadId int64
	// Mode for parsing entities in the message text. See formatting options for more details.
	ParseMode string
	// A JSON-serialized list of special entities that appear in message text, which can be specified instead of parse_mode
	Entities []MessageEntity
	// Link preview generation options for the message
	LinkPreviewOptions *LinkPreviewOptions
	// Sends the message silently. Users will receive a notification with no sound.
	DisableNotification bool
	// Protects the contents of the sent message from forwarding and saving
	ProtectContent bool
	// Unique identifier of the message effect to be added to the message; for private chats only
	MessageEffectId string
	// Description of the message to reply to
	ReplyParameters *ReplyParameters
	// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
	ReplyMarkup ReplyMarkup
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SendMessageOpts is the set of optional fields for Bot.SendMessage.

type SendPaidMediaOpts added in v2.1.0

type SendPaidMediaOpts struct {
	// Unique identifier of the business connection on behalf of which the message will be sent
	BusinessConnectionId string
	// Media caption, 0-1024 characters after entities parsing
	Caption string
	// Mode for parsing entities in the media caption. See formatting options for more details.
	ParseMode string
	// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []MessageEntity
	// Pass True, if the caption must be shown above the message media
	ShowCaptionAboveMedia bool
	// Sends the message silently. Users will receive a notification with no sound.
	DisableNotification bool
	// Protects the contents of the sent message from forwarding and saving
	ProtectContent bool
	// Description of the message to reply to
	ReplyParameters *ReplyParameters
	// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
	ReplyMarkup ReplyMarkup
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SendPaidMediaOpts is the set of optional fields for Bot.SendPaidMedia.

type SendPhotoOpts

type SendPhotoOpts struct {
	// Unique identifier of the business connection on behalf of which the message will be sent
	BusinessConnectionId string
	// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
	MessageThreadId int64
	// Photo caption (may also be used when resending photos by file_id), 0-1024 characters after entities parsing
	Caption string
	// Mode for parsing entities in the photo caption. See formatting options for more details.
	ParseMode string
	// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []MessageEntity
	// Pass True, if the caption must be shown above the message media
	ShowCaptionAboveMedia bool
	// Pass True if the photo needs to be covered with a spoiler animation
	HasSpoiler bool
	// Sends the message silently. Users will receive a notification with no sound.
	DisableNotification bool
	// Protects the contents of the sent message from forwarding and saving
	ProtectContent bool
	// Unique identifier of the message effect to be added to the message; for private chats only
	MessageEffectId string
	// Description of the message to reply to
	ReplyParameters *ReplyParameters
	// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
	ReplyMarkup ReplyMarkup
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SendPhotoOpts is the set of optional fields for Bot.SendPhoto.

type SendPollOpts

type SendPollOpts struct {
	// Unique identifier of the business connection on behalf of which the message will be sent
	BusinessConnectionId string
	// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
	MessageThreadId int64
	// Mode for parsing entities in the question. See formatting options for more details. Currently, only custom emoji entities are allowed
	QuestionParseMode string
	// A JSON-serialized list of special entities that appear in the poll question. It can be specified instead of question_parse_mode
	QuestionEntities []MessageEntity
	// True, if the poll needs to be anonymous, defaults to True
	IsAnonymous bool
	// Poll type, "quiz" or "regular", defaults to "regular"
	Type string
	// True, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to False
	AllowsMultipleAnswers bool
	// 0-based identifier of the correct answer option, required for polls in quiz mode
	CorrectOptionId int64
	// 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
	// Mode for parsing entities in the explanation. See formatting options for more details.
	ExplanationParseMode string
	// A JSON-serialized list of special entities that appear in the poll explanation. It can be specified instead of explanation_parse_mode
	ExplanationEntities []MessageEntity
	// Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with close_date.
	OpenPeriod int64
	// 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
	// Pass True if the poll needs to be immediately closed. This can be useful for poll preview.
	IsClosed bool
	// Sends the message silently. Users will receive a notification with no sound.
	DisableNotification bool
	// Protects the contents of the sent message from forwarding and saving
	ProtectContent bool
	// Unique identifier of the message effect to be added to the message; for private chats only
	MessageEffectId string
	// Description of the message to reply to
	ReplyParameters *ReplyParameters
	// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
	ReplyMarkup ReplyMarkup
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SendPollOpts is the set of optional fields for Bot.SendPoll.

type SendStickerOpts

type SendStickerOpts struct {
	// Unique identifier of the business connection on behalf of which the message will be sent
	BusinessConnectionId string
	// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
	MessageThreadId int64
	// Emoji associated with the sticker; only for just uploaded stickers
	Emoji string
	// Sends the message silently. Users will receive a notification with no sound.
	DisableNotification bool
	// Protects the contents of the sent message from forwarding and saving
	ProtectContent bool
	// Unique identifier of the message effect to be added to the message; for private chats only
	MessageEffectId string
	// Description of the message to reply to
	ReplyParameters *ReplyParameters
	// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
	ReplyMarkup ReplyMarkup
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SendStickerOpts is the set of optional fields for Bot.SendSticker.

type SendVenueOpts

type SendVenueOpts struct {
	// Unique identifier of the business connection on behalf of which the message will be sent
	BusinessConnectionId string
	// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
	MessageThreadId int64
	// Foursquare identifier of the venue
	FoursquareId string
	// Foursquare type of the venue, if known. (For example, "arts_entertainment/default", "arts_entertainment/aquarium" or "food/icecream".)
	FoursquareType string
	// Google Places identifier of the venue
	GooglePlaceId string
	// Google Places type of the venue. (See supported types.)
	GooglePlaceType string
	// Sends the message silently. Users will receive a notification with no sound.
	DisableNotification bool
	// Protects the contents of the sent message from forwarding and saving
	ProtectContent bool
	// Unique identifier of the message effect to be added to the message; for private chats only
	MessageEffectId string
	// Description of the message to reply to
	ReplyParameters *ReplyParameters
	// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
	ReplyMarkup ReplyMarkup
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SendVenueOpts is the set of optional fields for Bot.SendVenue.

type SendVideoNoteOpts

type SendVideoNoteOpts struct {
	// Unique identifier of the business connection on behalf of which the message will be sent
	BusinessConnectionId string
	// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
	MessageThreadId int64
	// Duration of sent video in seconds
	Duration int64
	// Video width and height, i.e. diameter of the video message
	Length int64
	// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://<file_attach_name>" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files: https://core.telegram.org/bots/api#sending-files
	Thumbnail InputFile
	// Sends the message silently. Users will receive a notification with no sound.
	DisableNotification bool
	// Protects the contents of the sent message from forwarding and saving
	ProtectContent bool
	// Unique identifier of the message effect to be added to the message; for private chats only
	MessageEffectId string
	// Description of the message to reply to
	ReplyParameters *ReplyParameters
	// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
	ReplyMarkup ReplyMarkup
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SendVideoNoteOpts is the set of optional fields for Bot.SendVideoNote.

type SendVideoOpts

type SendVideoOpts struct {
	// Unique identifier of the business connection on behalf of which the message will be sent
	BusinessConnectionId string
	// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
	MessageThreadId int64
	// Duration of sent video in seconds
	Duration int64
	// Video width
	Width int64
	// Video height
	Height int64
	// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://<file_attach_name>" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files: https://core.telegram.org/bots/api#sending-files
	Thumbnail InputFile
	// Video caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing
	Caption string
	// Mode for parsing entities in the video caption. See formatting options for more details.
	ParseMode string
	// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []MessageEntity
	// Pass True, if the caption must be shown above the message media
	ShowCaptionAboveMedia bool
	// Pass True if the video needs to be covered with a spoiler animation
	HasSpoiler bool
	// Pass True if the uploaded video is suitable for streaming
	SupportsStreaming bool
	// Sends the message silently. Users will receive a notification with no sound.
	DisableNotification bool
	// Protects the contents of the sent message from forwarding and saving
	ProtectContent bool
	// Unique identifier of the message effect to be added to the message; for private chats only
	MessageEffectId string
	// Description of the message to reply to
	ReplyParameters *ReplyParameters
	// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
	ReplyMarkup ReplyMarkup
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SendVideoOpts is the set of optional fields for Bot.SendVideo.

type SendVoiceOpts

type SendVoiceOpts struct {
	// Unique identifier of the business connection on behalf of which the message will be sent
	BusinessConnectionId string
	// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
	MessageThreadId int64
	// Voice message caption, 0-1024 characters after entities parsing
	Caption string
	// Mode for parsing entities in the voice message caption. See formatting options for more details.
	ParseMode string
	// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
	CaptionEntities []MessageEntity
	// Duration of the voice message in seconds
	Duration int64
	// Sends the message silently. Users will receive a notification with no sound.
	DisableNotification bool
	// Protects the contents of the sent message from forwarding and saving
	ProtectContent bool
	// Unique identifier of the message effect to be added to the message; for private chats only
	MessageEffectId string
	// Description of the message to reply to
	ReplyParameters *ReplyParameters
	// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
	ReplyMarkup ReplyMarkup
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SendVoiceOpts is the set of optional fields for Bot.SendVoice.

type Sender

type Sender struct {
	// The User defined as the sender (if applicable)
	User *User
	// The Chat defined as the sender (if applicable)
	Chat *Chat
	// Whether the sender was an automatic forward; eg, a linked channel.
	IsAutomaticForward bool
	// The location that was sent to. Required to determine if the sender is a linked channel, an anonymous channel,
	// or an anonymous admin.
	ChatId int64
	// The custom admin title of the anonymous group administrator sender.
	// Only available if IsAnonymousAdmin is true.
	AuthorSignature string
}

Sender is a merge of the User and SenderChat fields of a message, to provide easier interaction with message senders from the telegram API.

func (Sender) FirstName

func (s Sender) FirstName() string

FirstName determines the firstname of the sender. This is:

  • Chat.Title for a Chat.
  • User.FirstName for a User.

func (Sender) Id

func (s Sender) Id() int64

Id determines the sender ID. When a message is being sent by a chat/channel, telegram usually populates the User field with dummy values. For this reason, we prefer to return the Chat.Id if it is available, rather than a dummy User.Id.

func (Sender) IsAnonymousAdmin

func (s Sender) IsAnonymousAdmin() bool

IsAnonymousAdmin returns true if the Sender is an anonymous admin sending to a group. For channel posts in a channel, see IsChannelPost.

func (Sender) IsAnonymousChannel

func (s Sender) IsAnonymousChannel() bool

IsAnonymousChannel returns true if the Sender is an anonymous channel sending to a group. For channel admins posting in their own channel, see IsChannelPost.

func (Sender) IsBot

func (s Sender) IsBot() bool

IsBot returns true if the Sender is a bot. Returns false if the user is a bot setup by telegram for backwards compatibility with the sender_chat fields.

func (Sender) IsChannelPost

func (s Sender) IsChannelPost() bool

IsChannelPost returns true if the Sender is a channel admin posting to that same channel.

func (Sender) IsLinkedChannel

func (s Sender) IsLinkedChannel() bool

IsLinkedChannel returns true if the Sender is a linked channel sending to the group it is linked to.

func (Sender) IsUser

func (s Sender) IsUser() bool

IsUser returns true if the Sender is a User (including bot).

func (Sender) LastName

func (s Sender) LastName() string

LastName determines the firstname of the sender. This is:

  • empty for a Chat.
  • User.LastName for a User.

func (Sender) Name

func (s Sender) Name() string

Name determines the name of the sender. This is:

  • Chat.Title for a Chat.
  • User.FirstName + User.LastName for a User (the full name).

func (Sender) Username

func (s Sender) Username() string

Username determines the sender username.

type SentWebAppMessage

type SentWebAppMessage struct {
	// Optional. Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message.
	InlineMessageId string `json:"inline_message_id,omitempty"`
}

SentWebAppMessage (https://core.telegram.org/bots/api#sentwebappmessage)

Describes an inline message sent by a Web App on behalf of a user.

type SetChatAdministratorCustomTitleOpts

type SetChatAdministratorCustomTitleOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SetChatAdministratorCustomTitleOpts is the set of optional fields for Bot.SetChatAdministratorCustomTitle.

type SetChatDescriptionOpts

type SetChatDescriptionOpts struct {
	// New chat description, 0-255 characters
	Description string
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SetChatDescriptionOpts is the set of optional fields for Bot.SetChatDescription.

type SetChatMenuButtonOpts

type SetChatMenuButtonOpts struct {
	// Unique identifier for the target private chat. If not specified, default bot's menu button will be changed
	ChatId *int64
	// A JSON-serialized object for the bot's new menu button. Defaults to MenuButtonDefault
	MenuButton MenuButton
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SetChatMenuButtonOpts is the set of optional fields for Bot.SetChatMenuButton.

type SetChatPermissionsOpts

type SetChatPermissionsOpts struct {
	// Pass True if chat permissions are set independently. Otherwise, the can_send_other_messages and can_add_web_page_previews permissions will imply the can_send_messages, can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, and can_send_voice_notes permissions; the can_send_polls permission will imply the can_send_messages permission.
	UseIndependentChatPermissions bool
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SetChatPermissionsOpts is the set of optional fields for Bot.SetChatPermissions.

type SetChatPhotoOpts

type SetChatPhotoOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SetChatPhotoOpts is the set of optional fields for Bot.SetChatPhoto.

type SetChatStickerSetOpts

type SetChatStickerSetOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SetChatStickerSetOpts is the set of optional fields for Bot.SetChatStickerSet.

type SetChatTitleOpts

type SetChatTitleOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SetChatTitleOpts is the set of optional fields for Bot.SetChatTitle.

type SetCustomEmojiStickerSetThumbnailOpts

type SetCustomEmojiStickerSetThumbnailOpts struct {
	// Custom emoji identifier of a sticker from the sticker set; pass an empty string to drop the thumbnail and use the first sticker as the thumbnail.
	CustomEmojiId string
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SetCustomEmojiStickerSetThumbnailOpts is the set of optional fields for Bot.SetCustomEmojiStickerSetThumbnail.

type SetGameScoreOpts

type SetGameScoreOpts struct {
	// Pass True if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters
	Force bool
	// Pass True if the game message should not be automatically edited to include the current scoreboard
	DisableEditMessage bool
	// Required if inline_message_id is not specified. Unique identifier for the target chat
	ChatId int64
	// Required if inline_message_id is not specified. Identifier of the sent message
	MessageId int64
	// Required if chat_id and message_id are not specified. Identifier of the inline message
	InlineMessageId string
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SetGameScoreOpts is the set of optional fields for Bot.SetGameScore.

type SetMessageReactionOpts added in v2.1.0

type SetMessageReactionOpts struct {
	// A JSON-serialized list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators. Paid reactions can't be used by bots.
	Reaction []ReactionType
	// Pass True to set the reaction with a big animation
	IsBig bool
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SetMessageReactionOpts is the set of optional fields for Bot.SetMessageReaction.

type SetMyCommandsOpts

type SetMyCommandsOpts struct {
	// A JSON-serialized object, describing scope of users for which the commands are relevant. Defaults to BotCommandScopeDefault.
	Scope BotCommandScope
	// 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
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SetMyCommandsOpts is the set of optional fields for Bot.SetMyCommands.

type SetMyDefaultAdministratorRightsOpts

type SetMyDefaultAdministratorRightsOpts struct {
	// A JSON-serialized object describing new default administrator rights. If not specified, the default administrator rights will be cleared.
	Rights *ChatAdministratorRights
	// Pass True to change the default administrator rights of the bot in channels. Otherwise, the default administrator rights of the bot for groups and supergroups will be changed.
	ForChannels bool
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SetMyDefaultAdministratorRightsOpts is the set of optional fields for Bot.SetMyDefaultAdministratorRights.

type SetMyDescriptionOpts

type SetMyDescriptionOpts struct {
	// New bot description; 0-512 characters. Pass an empty string to remove the dedicated description for the given language.
	Description string
	// A two-letter ISO 639-1 language code. If empty, the description will be applied to all users for whose language there is no dedicated description.
	LanguageCode string
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SetMyDescriptionOpts is the set of optional fields for Bot.SetMyDescription.

type SetMyNameOpts

type SetMyNameOpts struct {
	// New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language.
	Name string
	// A two-letter ISO 639-1 language code. If empty, the name will be shown to all users for whose language there is no dedicated name.
	LanguageCode string
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SetMyNameOpts is the set of optional fields for Bot.SetMyName.

type SetMyShortDescriptionOpts

type SetMyShortDescriptionOpts struct {
	// New short description for the bot; 0-120 characters. Pass an empty string to remove the dedicated short description for the given language.
	ShortDescription string
	// A two-letter ISO 639-1 language code. If empty, the short description will be applied to all users for whose language there is no dedicated short description.
	LanguageCode string
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SetMyShortDescriptionOpts is the set of optional fields for Bot.SetMyShortDescription.

type SetPassportDataErrorsOpts

type SetPassportDataErrorsOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SetPassportDataErrorsOpts is the set of optional fields for Bot.SetPassportDataErrors.

type SetStickerEmojiListOpts

type SetStickerEmojiListOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SetStickerEmojiListOpts is the set of optional fields for Bot.SetStickerEmojiList.

type SetStickerKeywordsOpts

type SetStickerKeywordsOpts struct {
	// A JSON-serialized list of 0-20 search keywords for the sticker with total length of up to 64 characters
	Keywords []string
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SetStickerKeywordsOpts is the set of optional fields for Bot.SetStickerKeywords.

type SetStickerMaskPositionOpts

type SetStickerMaskPositionOpts struct {
	// A JSON-serialized object with the position where the mask should be placed on faces. Omit the parameter to remove the mask position.
	MaskPosition *MaskPosition
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SetStickerMaskPositionOpts is the set of optional fields for Bot.SetStickerMaskPosition.

type SetStickerPositionInSetOpts

type SetStickerPositionInSetOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SetStickerPositionInSetOpts is the set of optional fields for Bot.SetStickerPositionInSet.

type SetStickerSetThumbnailOpts

type SetStickerSetThumbnailOpts struct {
	// A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size (see https://core.telegram.org/stickers#animation-requirements for animated sticker technical requirements), or a WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files: https://core.telegram.org/bots/api#sending-files. Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.
	Thumbnail InputFile
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SetStickerSetThumbnailOpts is the set of optional fields for Bot.SetStickerSetThumbnail.

type SetStickerSetTitleOpts

type SetStickerSetTitleOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SetStickerSetTitleOpts is the set of optional fields for Bot.SetStickerSetTitle.

type SetWebhookOpts

type SetWebhookOpts struct {
	// Upload your public key certificate so that the root certificate in use can be checked. See our self-signed guide for details.
	Certificate InputFile
	// The fixed IP address which will be used to send webhook requests instead of the IP address resolved through DNS
	IpAddress string
	// The 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 int64
	// A JSON-serialized list of the update types you want your bot to receive. For example, specify ["message", "edited_channel_post", "callback_query"] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member, message_reaction, and message_reaction_count (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
	// Pass True to drop all pending updates
	DropPendingUpdates bool
	// A secret token to be sent in a header "X-Telegram-Bot-Api-Secret-Token" in every webhook request, 1-256 characters. Only characters A-Z, a-z, 0-9, _ and - are allowed. The header is useful to ensure that the request comes from a webhook set by you.
	SecretToken string
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

SetWebhookOpts is the set of optional fields for Bot.SetWebhook.

type SharedUser added in v2.1.0

type SharedUser struct {
	// Identifier of the shared user. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so 64-bit integers or double-precision float types are safe for storing these identifiers. The bot may not have access to the user and could be unable to use this identifier, unless the user is already known to the bot by some other means.
	UserId int64 `json:"user_id"`
	// Optional. First name of the user, if the name was requested by the bot
	FirstName string `json:"first_name,omitempty"`
	// Optional. Last name of the user, if the name was requested by the bot
	LastName string `json:"last_name,omitempty"`
	// Optional. Username of the user, if the username was requested by the bot
	Username string `json:"username,omitempty"`
	// Optional. Available sizes of the chat photo, if the photo was requested by the bot
	Photo []PhotoSize `json:"photo,omitempty"`
}

SharedUser (https://core.telegram.org/bots/api#shareduser)

This object contains information about a user that was shared with the bot using a KeyboardButtonRequestUsers button.

type ShippingAddress

type ShippingAddress struct {
	// Two-letter 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 (https://core.telegram.org/bots/api#shippingaddress)

This object 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,omitempty"`
}

ShippingOption (https://core.telegram.org/bots/api#shippingoption)

This object represents one shipping option.

type ShippingQuery

type ShippingQuery struct {
	// Unique query identifier
	Id string `json:"id"`
	// User who sent the query
	From User `json:"from"`
	// Bot-specified invoice payload
	InvoicePayload string `json:"invoice_payload"`
	// User specified shipping address
	ShippingAddress ShippingAddress `json:"shipping_address"`
}

ShippingQuery (https://core.telegram.org/bots/api#shippingquery)

This object contains information about an incoming shipping query.

func (ShippingQuery) Answer

func (sq ShippingQuery) Answer(b *Bot, ok bool, opts *AnswerShippingQueryOpts) (bool, error)

Answer Helper method for Bot.AnswerShippingQuery.

type StarTransaction added in v2.1.0

type StarTransaction struct {
	// Unique identifier of the transaction. Coincides with the identifer of the original transaction for refund transactions. Coincides with SuccessfulPayment.telegram_payment_charge_id for successful incoming payments from users.
	Id string `json:"id"`
	// Number of Telegram Stars transferred by the transaction
	Amount int64 `json:"amount"`
	// Date the transaction was created in Unix time
	Date int64 `json:"date"`
	// Optional. Source of an incoming transaction (e.g., a user purchasing goods or services, Fragment refunding a failed withdrawal). Only for incoming transactions
	Source TransactionPartner `json:"source,omitempty"`
	// Optional. Receiver of an outgoing transaction (e.g., a user for a purchase refund, Fragment for a withdrawal). Only for outgoing transactions
	Receiver TransactionPartner `json:"receiver,omitempty"`
}

StarTransaction (https://core.telegram.org/bots/api#startransaction)

Describes a Telegram Star transaction.

func (*StarTransaction) UnmarshalJSON added in v2.1.0

func (v *StarTransaction) UnmarshalJSON(b []byte) error

UnmarshalJSON is a custom JSON unmarshaller to use the helpers which allow for unmarshalling structs into interfaces.

type StarTransactions added in v2.1.0

type StarTransactions struct {
	// The list of transactions
	Transactions []StarTransaction `json:"transactions,omitempty"`
}

StarTransactions (https://core.telegram.org/bots/api#startransactions)

Contains a list of Telegram Star transactions.

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"`
	// Type of the sticker, currently one of "regular", "mask", "custom_emoji". The type of the sticker is independent from its format, which is determined by the fields is_animated and is_video.
	Type string `json:"type"`
	// Sticker width
	Width int64 `json:"width"`
	// Sticker height
	Height int64 `json:"height"`
	// True, if the sticker is animated
	IsAnimated bool `json:"is_animated"`
	// True, if the sticker is a video sticker
	IsVideo bool `json:"is_video"`
	// Optional. Sticker thumbnail in the .WEBP or .JPG format
	Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
	// Optional. Emoji associated with the sticker
	Emoji string `json:"emoji,omitempty"`
	// Optional. Name of the sticker set to which the sticker belongs
	SetName string `json:"set_name,omitempty"`
	// Optional. For premium regular stickers, premium animation for the sticker
	PremiumAnimation *File `json:"premium_animation,omitempty"`
	// Optional. For mask stickers, the position where the mask should be placed
	MaskPosition *MaskPosition `json:"mask_position,omitempty"`
	// Optional. For custom emoji stickers, unique identifier of the custom emoji
	CustomEmojiId string `json:"custom_emoji_id,omitempty"`
	// Optional. True, if the sticker must be repainted to a text color in messages, the color of the Telegram Premium badge in emoji status, white color on chat photos, or another appropriate color in other places
	NeedsRepainting bool `json:"needs_repainting,omitempty"`
	// Optional. File size in bytes
	FileSize int64 `json:"file_size,omitempty"`
}

Sticker (https://core.telegram.org/bots/api#sticker)

This object represents a sticker.

type StickerSet

type StickerSet struct {
	// Sticker set name
	Name string `json:"name"`
	// Sticker set title
	Title string `json:"title"`
	// Type of stickers in the set, currently one of "regular", "mask", "custom_emoji"
	StickerType string `json:"sticker_type"`
	// List of all set stickers
	Stickers []Sticker `json:"stickers,omitempty"`
	// Optional. Sticker set thumbnail in the .WEBP, .TGS, or .WEBM format
	Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
}

StickerSet (https://core.telegram.org/bots/api#stickerset)

This object represents a sticker set.

type StopMessageLiveLocationOpts

type StopMessageLiveLocationOpts struct {
	// Unique identifier of the business connection on behalf of which the message to be edited was sent
	BusinessConnectionId string
	// Required if inline_message_id is not specified. Unique identifier for the target chat
	ChatId int64
	// Required if inline_message_id is not specified. Identifier of the message with live location to stop
	MessageId int64
	// Required if chat_id and message_id are not specified. Identifier of the inline message
	InlineMessageId string
	// A JSON-serialized object for a new inline keyboard.
	ReplyMarkup InlineKeyboardMarkup
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

StopMessageLiveLocationOpts is the set of optional fields for Bot.StopMessageLiveLocation.

type StopPollOpts

type StopPollOpts struct {
	// Unique identifier of the business connection on behalf of which the message to be edited was sent
	BusinessConnectionId string
	// A JSON-serialized object for a new message inline keyboard.
	ReplyMarkup InlineKeyboardMarkup
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

StopPollOpts is the set of optional fields for Bot.StopPoll.

type Story

type Story struct {
	// Chat that posted the story
	Chat Chat `json:"chat"`
	// Unique identifier for the story in the chat
	Id int64 `json:"id"`
}

Story (https://core.telegram.org/bots/api#story)

This object represents a story.

type SuccessfulPayment

type SuccessfulPayment struct {
	// Three-letter ISO 4217 currency code, or "XTR" for payments in Telegram Stars
	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 int64 `json:"total_amount"`
	// Bot-specified invoice payload
	InvoicePayload string `json:"invoice_payload"`
	// Optional. Identifier of the shipping option chosen by the user
	ShippingOptionId string `json:"shipping_option_id,omitempty"`
	// Optional. Order information provided by the user
	OrderInfo *OrderInfo `json:"order_info,omitempty"`
	// Telegram payment identifier
	TelegramPaymentChargeId string `json:"telegram_payment_charge_id"`
	// Provider payment identifier
	ProviderPaymentChargeId string `json:"provider_payment_charge_id"`
}

SuccessfulPayment (https://core.telegram.org/bots/api#successfulpayment)

This object contains basic information about a successful payment.

type SwitchInlineQueryChosenChat

type SwitchInlineQueryChosenChat struct {
	// Optional. The default inline query to be inserted in the input field. If left empty, only the bot's username will be inserted
	Query string `json:"query,omitempty"`
	// Optional. True, if private chats with users can be chosen
	AllowUserChats bool `json:"allow_user_chats,omitempty"`
	// Optional. True, if private chats with bots can be chosen
	AllowBotChats bool `json:"allow_bot_chats,omitempty"`
	// Optional. True, if group and supergroup chats can be chosen
	AllowGroupChats bool `json:"allow_group_chats,omitempty"`
	// Optional. True, if channel chats can be chosen
	AllowChannelChats bool `json:"allow_channel_chats,omitempty"`
}

SwitchInlineQueryChosenChat (https://core.telegram.org/bots/api#switchinlinequerychosenchat)

This object represents an inline button that switches the current user to inline mode in a chosen chat, with an optional default inline query.

type TelegramError

type TelegramError struct {
	// The telegram method which raised the error.
	Method string
	// The HTTP parameters which raised the error.
	Params map[string]string
	// The error code returned by telegram.
	Code int
	// The error description returned by telegram.
	Description string
	// The additional parameters returned by telegram
	ResponseParams *ResponseParameters
}

func (*TelegramError) Error

func (t *TelegramError) Error() string

type TextQuote added in v2.1.0

type TextQuote struct {
	// Text of the quoted part of a message that is replied to by the given message
	Text string `json:"text"`
	// Optional. Special entities that appear in the quote. Currently, only bold, italic, underline, strikethrough, spoiler, and custom_emoji entities are kept in quotes.
	Entities []MessageEntity `json:"entities,omitempty"`
	// Approximate quote position in the original message in UTF-16 code units as specified by the sender
	Position int64 `json:"position"`
	// Optional. True, if the quote was chosen manually by the message sender. Otherwise, the quote was added automatically by the server.
	IsManual bool `json:"is_manual,omitempty"`
}

TextQuote (https://core.telegram.org/bots/api#textquote)

This object contains information about the quoted part of a message that is replied to by the given message.

type TransactionPartner added in v2.1.0

type TransactionPartner interface {
	GetType() string
	// MergeTransactionPartner returns a MergedTransactionPartner struct to simplify working with complex telegram types in a non-generic world.
	MergeTransactionPartner() MergedTransactionPartner
	// contains filtered or unexported methods
}

TransactionPartner (https://core.telegram.org/bots/api#transactionpartner)

This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of

  • TransactionPartnerUser
  • TransactionPartnerFragment
  • TransactionPartnerTelegramAds
  • TransactionPartnerOther

type TransactionPartnerFragment added in v2.1.0

type TransactionPartnerFragment struct {
	// Optional. State of the transaction if the transaction is outgoing
	WithdrawalState RevenueWithdrawalState `json:"withdrawal_state,omitempty"`
}

TransactionPartnerFragment (https://core.telegram.org/bots/api#transactionpartnerfragment)

Describes a withdrawal transaction with Fragment.

func (TransactionPartnerFragment) GetType added in v2.1.0

func (v TransactionPartnerFragment) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (TransactionPartnerFragment) MarshalJSON added in v2.1.0

func (v TransactionPartnerFragment) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (TransactionPartnerFragment) MergeTransactionPartner added in v2.1.0

func (v TransactionPartnerFragment) MergeTransactionPartner() MergedTransactionPartner

MergeTransactionPartner returns a MergedTransactionPartner struct to simplify working with types in a non-generic world.

func (*TransactionPartnerFragment) UnmarshalJSON added in v2.1.0

func (v *TransactionPartnerFragment) UnmarshalJSON(b []byte) error

UnmarshalJSON is a custom JSON unmarshaller to use the helpers which allow for unmarshalling structs into interfaces.

type TransactionPartnerOther added in v2.1.0

type TransactionPartnerOther struct{}

TransactionPartnerOther (https://core.telegram.org/bots/api#transactionpartnerother)

Describes a transaction with an unknown source or recipient.

func (TransactionPartnerOther) GetType added in v2.1.0

func (v TransactionPartnerOther) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (TransactionPartnerOther) MarshalJSON added in v2.1.0

func (v TransactionPartnerOther) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (TransactionPartnerOther) MergeTransactionPartner added in v2.1.0

func (v TransactionPartnerOther) MergeTransactionPartner() MergedTransactionPartner

MergeTransactionPartner returns a MergedTransactionPartner struct to simplify working with types in a non-generic world.

type TransactionPartnerTelegramAds added in v2.1.0

type TransactionPartnerTelegramAds struct{}

TransactionPartnerTelegramAds (https://core.telegram.org/bots/api#transactionpartnertelegramads)

Describes a withdrawal transaction to the Telegram Ads platform.

func (TransactionPartnerTelegramAds) GetType added in v2.1.0

GetType is a helper method to easily access the common fields of an interface.

func (TransactionPartnerTelegramAds) MarshalJSON added in v2.1.0

func (v TransactionPartnerTelegramAds) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (TransactionPartnerTelegramAds) MergeTransactionPartner added in v2.1.0

func (v TransactionPartnerTelegramAds) MergeTransactionPartner() MergedTransactionPartner

MergeTransactionPartner returns a MergedTransactionPartner struct to simplify working with types in a non-generic world.

type TransactionPartnerUser added in v2.1.0

type TransactionPartnerUser struct {
	// Information about the user
	User User `json:"user"`
	// Optional. Bot-specified invoice payload
	InvoicePayload string `json:"invoice_payload,omitempty"`
	// Optional. Information about the paid media bought by the user
	PaidMedia []PaidMedia `json:"paid_media,omitempty"`
}

TransactionPartnerUser (https://core.telegram.org/bots/api#transactionpartneruser)

Describes a transaction with a user.

func (TransactionPartnerUser) GetType added in v2.1.0

func (v TransactionPartnerUser) GetType() string

GetType is a helper method to easily access the common fields of an interface.

func (TransactionPartnerUser) MarshalJSON added in v2.1.0

func (v TransactionPartnerUser) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller to allow for enforcing the Type value.

func (TransactionPartnerUser) MergeTransactionPartner added in v2.1.0

func (v TransactionPartnerUser) MergeTransactionPartner() MergedTransactionPartner

MergeTransactionPartner returns a MergedTransactionPartner struct to simplify working with types in a non-generic world.

func (*TransactionPartnerUser) UnmarshalJSON added in v2.1.0

func (v *TransactionPartnerUser) UnmarshalJSON(b []byte) error

UnmarshalJSON is a custom JSON unmarshaller to use the helpers which allow for unmarshalling structs into interfaces.

type UnbanChatMemberOpts

type UnbanChatMemberOpts struct {
	// Do nothing if the user is not banned
	OnlyIfBanned bool
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

UnbanChatMemberOpts is the set of optional fields for Bot.UnbanChatMember.

type UnbanChatSenderChatOpts

type UnbanChatSenderChatOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

UnbanChatSenderChatOpts is the set of optional fields for Bot.UnbanChatSenderChat.

type UnhideGeneralForumTopicOpts

type UnhideGeneralForumTopicOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

UnhideGeneralForumTopicOpts is the set of optional fields for Bot.UnhideGeneralForumTopic.

type UnpinAllChatMessagesOpts

type UnpinAllChatMessagesOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

UnpinAllChatMessagesOpts is the set of optional fields for Bot.UnpinAllChatMessages.

type UnpinAllForumTopicMessagesOpts

type UnpinAllForumTopicMessagesOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

UnpinAllForumTopicMessagesOpts is the set of optional fields for Bot.UnpinAllForumTopicMessages.

type UnpinAllGeneralForumTopicMessagesOpts

type UnpinAllGeneralForumTopicMessagesOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

UnpinAllGeneralForumTopicMessagesOpts is the set of optional fields for Bot.UnpinAllGeneralForumTopicMessages.

type UnpinChatMessageOpts

type UnpinChatMessageOpts struct {
	// Unique identifier of the business connection on behalf of which the message will be unpinned
	BusinessConnectionId string
	// Identifier of the message to unpin. Required if business_connection_id is specified. If not specified, the most recent pinned message (by sending date) will be unpinned.
	MessageId *int64
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

UnpinChatMessageOpts is the set of optional fields for Bot.UnpinChatMessage.

type Update

type Update struct {
	// The update's unique identifier. Update identifiers start from a certain positive number and increase sequentially. This identifier becomes especially handy if you're using webhooks, since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order. If there are no new updates for at least a week, then identifier of the next update will be chosen randomly instead of sequentially.
	UpdateId int64 `json:"update_id"`
	// Optional. New incoming message of any kind - text, photo, sticker, etc.
	Message *Message `json:"message,omitempty"`
	// Optional. New version of a message that is known to the bot and was edited. This update may at times be triggered by changes to message fields that are either unavailable or not actively used by your bot.
	EditedMessage *Message `json:"edited_message,omitempty"`
	// Optional. New incoming channel post of any kind - text, photo, sticker, etc.
	ChannelPost *Message `json:"channel_post,omitempty"`
	// Optional. New version of a channel post that is known to the bot and was edited. This update may at times be triggered by changes to message fields that are either unavailable or not actively used by your bot.
	EditedChannelPost *Message `json:"edited_channel_post,omitempty"`
	// Optional. The bot was connected to or disconnected from a business account, or a user edited an existing connection with the bot
	BusinessConnection *BusinessConnection `json:"business_connection,omitempty"`
	// Optional. New message from a connected business account
	BusinessMessage *Message `json:"business_message,omitempty"`
	// Optional. New version of a message from a connected business account
	EditedBusinessMessage *Message `json:"edited_business_message,omitempty"`
	// Optional. Messages were deleted from a connected business account
	DeletedBusinessMessages *BusinessMessagesDeleted `json:"deleted_business_messages,omitempty"`
	// Optional. A reaction to a message was changed by a user. The bot must be an administrator in the chat and must explicitly specify "message_reaction" in the list of allowed_updates to receive these updates. The update isn't received for reactions set by bots.
	MessageReaction *MessageReactionUpdated `json:"message_reaction,omitempty"`
	// Optional. Reactions to a message with anonymous reactions were changed. The bot must be an administrator in the chat and must explicitly specify "message_reaction_count" in the list of allowed_updates to receive these updates. The updates are grouped and can be sent with delay up to a few minutes.
	MessageReactionCount *MessageReactionCountUpdated `json:"message_reaction_count,omitempty"`
	// Optional. New incoming inline query
	InlineQuery *InlineQuery `json:"inline_query,omitempty"`
	// Optional. The result of an inline query that was chosen by a user and sent to their chat partner. Please see our documentation on the feedback collecting for details on how to enable these updates for your bot.
	ChosenInlineResult *ChosenInlineResult `json:"chosen_inline_result,omitempty"`
	// Optional. New incoming callback query
	CallbackQuery *CallbackQuery `json:"callback_query,omitempty"`
	// Optional. New incoming shipping query. Only for invoices with flexible price
	ShippingQuery *ShippingQuery `json:"shipping_query,omitempty"`
	// Optional. New incoming pre-checkout query. Contains full information about checkout
	PreCheckoutQuery *PreCheckoutQuery `json:"pre_checkout_query,omitempty"`
	// Optional. New poll state. Bots receive only updates about manually stopped polls and polls, which are sent by the bot
	Poll *Poll `json:"poll,omitempty"`
	// Optional. A user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself.
	PollAnswer *PollAnswer `json:"poll_answer,omitempty"`
	// Optional. The bot's chat member status was updated in a chat. For private chats, this update is received only when the bot is blocked or unblocked by the user.
	MyChatMember *ChatMemberUpdated `json:"my_chat_member,omitempty"`
	// Optional. A chat member's status was updated in a chat. The bot must be an administrator in the chat and must explicitly specify "chat_member" in the list of allowed_updates to receive these updates.
	ChatMember *ChatMemberUpdated `json:"chat_member,omitempty"`
	// Optional. A request to join the chat has been sent. The bot must have the can_invite_users administrator right in the chat to receive these updates.
	ChatJoinRequest *ChatJoinRequest `json:"chat_join_request,omitempty"`
	// Optional. A chat boost was added or changed. The bot must be an administrator in the chat to receive these updates.
	ChatBoost *ChatBoostUpdated `json:"chat_boost,omitempty"`
	// Optional. A boost was removed from a chat. The bot must be an administrator in the chat to receive these updates.
	RemovedChatBoost *ChatBoostRemoved `json:"removed_chat_boost,omitempty"`
}

Update (https://core.telegram.org/bots/api#update)

This object represents an incoming update. At most one of the optional parameters can be present in any given update.

func (Update) GetType added in v2.1.0

func (u Update) GetType() string

GetType is a helper method to easily identify the type of update that is being received.

type UploadStickerFileOpts

type UploadStickerFileOpts struct {
	// RequestOpts are an additional optional field to configure timeouts for individual requests
	RequestOpts *RequestOpts
}

UploadStickerFileOpts is the set of optional fields for Bot.UploadStickerFile.

type User

type User struct {
	// Unique identifier for this user or bot. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier.
	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"`
	// Optional. User's or bot's last name
	LastName string `json:"last_name,omitempty"`
	// Optional. User's or bot's username
	Username string `json:"username,omitempty"`
	// Optional. IETF language tag of the user's language
	LanguageCode string `json:"language_code,omitempty"`
	// Optional. True, if this user is a Telegram Premium user
	IsPremium bool `json:"is_premium,omitempty"`
	// Optional. True, if this user added the bot to the attachment menu
	AddedToAttachmentMenu bool `json:"added_to_attachment_menu,omitempty"`
	// Optional. True, if the bot can be invited to groups. Returned only in getMe.
	CanJoinGroups bool `json:"can_join_groups,omitempty"`
	// Optional. True, if privacy mode is disabled for the bot. Returned only in getMe.
	CanReadAllGroupMessages bool `json:"can_read_all_group_messages,omitempty"`
	// Optional. True, if the bot supports inline queries. Returned only in getMe.
	SupportsInlineQueries bool `json:"supports_inline_queries,omitempty"`
	// Optional. True, if the bot can be connected to a Telegram Business account to receive its messages. Returned only in getMe.
	CanConnectToBusiness bool `json:"can_connect_to_business,omitempty"`
	// Optional. True, if the bot has a main Web App. Returned only in getMe.
	HasMainWebApp bool `json:"has_main_web_app,omitempty"`
}

User (https://core.telegram.org/bots/api#user)

This object represents a Telegram user or bot.

func (User) GetChatBoosts added in v2.1.0

func (u User) GetChatBoosts(b *Bot, chatId int64, opts *GetUserChatBoostsOpts) (*UserChatBoosts, error)

GetChatBoosts Helper method for Bot.GetUserChatBoosts.

func (User) GetProfilePhotos

func (u User) GetProfilePhotos(b *Bot, opts *GetUserProfilePhotosOpts) (*UserProfilePhotos, error)

GetProfilePhotos Helper method for Bot.GetUserProfilePhotos.

type UserChatBoosts added in v2.1.0

type UserChatBoosts struct {
	// The list of boosts added to the chat by the user
	Boosts []ChatBoost `json:"boosts,omitempty"`
}

UserChatBoosts (https://core.telegram.org/bots/api#userchatboosts)

This object represents a list of boosts added to a chat by a user.

type UserProfilePhotos

type UserProfilePhotos struct {
	// Total number of profile pictures the target user has
	TotalCount int64 `json:"total_count"`
	// Requested profile pictures (in up to 4 sizes each)
	Photos [][]PhotoSize `json:"photos,omitempty"`
}

UserProfilePhotos (https://core.telegram.org/bots/api#userprofilephotos)

This object represent a user's profile pictures.

type UsersShared added in v2.1.0

type UsersShared struct {
	// Identifier of the request
	RequestId int64 `json:"request_id"`
	// Information about users shared with the bot.
	Users []SharedUser `json:"users,omitempty"`
}

UsersShared (https://core.telegram.org/bots/api#usersshared)

This object contains information about the users whose identifiers were shared with the bot using a KeyboardButtonRequestUsers button.

type Venue

type Venue struct {
	// Venue location. Can't be a live location
	Location Location `json:"location"`
	// Name of the venue
	Title string `json:"title"`
	// Address of the venue
	Address string `json:"address"`
	// Optional. Foursquare identifier of the venue
	FoursquareId string `json:"foursquare_id,omitempty"`
	// Optional. Foursquare type of the venue. (For example, "arts_entertainment/default", "arts_entertainment/aquarium" or "food/icecream".)
	FoursquareType string `json:"foursquare_type,omitempty"`
	// Optional. Google Places identifier of the venue
	GooglePlaceId string `json:"google_place_id,omitempty"`
	// Optional. Google Places type of the venue. (See supported types.)
	GooglePlaceType string `json:"google_place_type,omitempty"`
}

Venue (https://core.telegram.org/bots/api#venue)

This object represents a venue.

type Video

type Video struct {
	// Identifier for this file, which can be used to download or reuse the file
	FileId 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 the sender
	Width int64 `json:"width"`
	// Video height as defined by the sender
	Height int64 `json:"height"`
	// Duration of the video in seconds as defined by the sender
	Duration int64 `json:"duration"`
	// Optional. Video thumbnail
	Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
	// Optional. Original filename as defined by the sender
	FileName string `json:"file_name,omitempty"`
	// Optional. MIME type of the file as defined by the sender
	MimeType string `json:"mime_type,omitempty"`
	// Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.
	FileSize int64 `json:"file_size,omitempty"`
}

Video (https://core.telegram.org/bots/api#video)

This object represents a video file.

type VideoChatEnded

type VideoChatEnded struct {
	// Video chat duration in seconds
	Duration int64 `json:"duration"`
}

VideoChatEnded (https://core.telegram.org/bots/api#videochatended)

This object represents a service message about a video chat ended in the chat.

type VideoChatParticipantsInvited

type VideoChatParticipantsInvited struct {
	// New members that were invited to the video chat
	Users []User `json:"users,omitempty"`
}

VideoChatParticipantsInvited (https://core.telegram.org/bots/api#videochatparticipantsinvited)

This object represents a service message about new members invited to a video chat.

type VideoChatScheduled

type VideoChatScheduled struct {
	// Point in time (Unix timestamp) when the video chat is supposed to be started by a chat administrator
	StartDate int64 `json:"start_date"`
}

VideoChatScheduled (https://core.telegram.org/bots/api#videochatscheduled)

This object represents a service message about a video chat scheduled in the chat.

type VideoChatStarted

type VideoChatStarted struct{}

VideoChatStarted (https://core.telegram.org/bots/api#videochatstarted)

This object represents a service message about a video chat started in the chat. Currently holds no information.

type VideoNote

type VideoNote struct {
	// Identifier for this file, which can be used to download or reuse the file
	FileId 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 the sender
	Length int64 `json:"length"`
	// Duration of the video in seconds as defined by the sender
	Duration int64 `json:"duration"`
	// Optional. Video thumbnail
	Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
	// Optional. File size in bytes
	FileSize int64 `json:"file_size,omitempty"`
}

VideoNote (https://core.telegram.org/bots/api#videonote)

This object represents a video message (available in Telegram apps as of v.4.0).

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 the sender
	Duration int64 `json:"duration"`
	// Optional. MIME type of the file as defined by the sender
	MimeType string `json:"mime_type,omitempty"`
	// Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.
	FileSize int64 `json:"file_size,omitempty"`
}

Voice (https://core.telegram.org/bots/api#voice)

This object represents a voice note.

type WebAppData

type WebAppData struct {
	// The data. Be aware that a bad client can send arbitrary data in this field.
	Data string `json:"data"`
	// Text of the web_app keyboard button from which the Web App was opened. Be aware that a bad client can send arbitrary data in this field.
	ButtonText string `json:"button_text"`
}

WebAppData (https://core.telegram.org/bots/api#webappdata)

Describes data sent from a Web App to the bot.

type WebAppInfo

type WebAppInfo struct {
	// An HTTPS URL of a Web App to be opened with additional data as specified in Initializing Web Apps
	Url string `json:"url"`
}

WebAppInfo (https://core.telegram.org/bots/api#webappinfo)

Describes a Web App.

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 int64 `json:"pending_update_count"`
	// Optional. Currently used webhook IP address
	IpAddress string `json:"ip_address,omitempty"`
	// Optional. Unix time for the most recent error that happened when trying to deliver an update via webhook
	LastErrorDate int64 `json:"last_error_date,omitempty"`
	// Optional. Error message in human-readable format for the most recent error that happened when trying to deliver an update via webhook
	LastErrorMessage string `json:"last_error_message,omitempty"`
	// Optional. Unix time of the most recent error that happened when trying to synchronize available updates with Telegram datacenters
	LastSynchronizationErrorDate int64 `json:"last_synchronization_error_date,omitempty"`
	// Optional. The maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery
	MaxConnections int64 `json:"max_connections,omitempty"`
	// Optional. A list of update types the bot is subscribed to. Defaults to all update types except chat_member
	AllowedUpdates []string `json:"allowed_updates,omitempty"`
}

WebhookInfo (https://core.telegram.org/bots/api#webhookinfo)

Describes the current status of a webhook.

type WriteAccessAllowed

type WriteAccessAllowed struct {
	// Optional. True, if the access was granted after the user accepted an explicit request from a Web App sent by the method requestWriteAccess
	FromRequest bool `json:"from_request,omitempty"`
	// Optional. Name of the Web App, if the access was granted when the Web App was launched from a link
	WebAppName string `json:"web_app_name,omitempty"`
	// Optional. True, if the access was granted when the bot was added to the attachment or side menu
	FromAttachmentMenu bool `json:"from_attachment_menu,omitempty"`
}

WriteAccessAllowed (https://core.telegram.org/bots/api#writeaccessallowed)

This object represents a service message about a user allowing a bot to write messages after adding it to the attachment menu, launching a Web App from a link, or accepting an explicit request from a Web App sent by the method requestWriteAccess.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL