echotron

package module
v3.30.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: GPL-3.0 Imports: 16 Imported by: 11

README

logo

Language PkgGoDev Go Report Card License Coverage Status Mentioned in Awesome Go Telegram

Echotron is an elegant and concurrent library for the Telegram bot API in Go.

Fetch with

go get github.com/NicoNex/echotron/v3

Example

Simplest implementations

Long polling
package main

import "github.com/NicoNex/echotron/v3"

const token = "MY TELEGRAM TOKEN"

func main() {
	api := echotron.NewAPI(token)

	for u := range echotron.PollingUpdates(token) {
		if u.Message.Text == "/start" {
			api.SendMessage("Hello world", u.ChatID(), nil)
		}
	}
}
Webhook
package main

import "github.com/NicoNex/echotron/v3"

const token = "MY TELEGRAM TOKEN"

func main() {
	api := echotron.NewAPI(token)

	for u := range echotron.WebhookUpdates("https://example.com:443/my_token", token) {
		if u.Message.Text == "/start" {
			api.SendMessage("Hello world", u.ChatID(), nil)
		}
	}
}

For more scalable and recommended implementations see the other examples.

Long Polling

package main

import (
	"log"
	"time"

	"github.com/NicoNex/echotron/v3"
)

// Struct useful for managing internal states in your bot, but it could be of
// any type such as `type bot int64` if you only need to store the chatID.
type bot struct {
	chatID int64
	echotron.API
}

const token = "MY TELEGRAM TOKEN"

// This function needs to be of type 'echotron.NewBotFn' and is called by
// the echotron dispatcher upon any new message from a chatID that has never
// interacted with the bot before.
// This means that echotron keeps one instance of the echotron.Bot implementation
// for each chat where the bot is used.
func newBot(chatID int64) echotron.Bot {
	return &bot{
		chatID,
		echotron.NewAPI(token),
	}
}

// This method is needed to implement the echotron.Bot interface.
func (b *bot) Update(update *echotron.Update) {
	if update.Message.Text == "/start" {
		b.SendMessage("Hello world", b.chatID, nil)
	}
}

func main() {
	// This is the entry point of echotron library.
	dsp := echotron.NewDispatcher(token, newBot)
	for {
		log.Println(dsp.Poll())
		// In case of connection issues wait 5 seconds before trying to reconnect.
		time.Sleep(5 * time.Second)
	}
}

Design

Echotron makes a new instance of the struct bot for each open chat with a Telegram user, channel or group. This allows to:

  • safely call the Update(*echotron.Update) method concurrently
  • give to the user a convenient way to manage the bot internal states across all the chats
  • make sure that, even if one instance of the bot is deadlocked, the other ones keep running just fine, making the bot work for other users without any issues and/or slowdowns.

Please note that the the aforementioned behaviour is dictated by the echotron.Dispatcher object whose usage is not mandatory and for special needs can be ignored and implemented in different ways still keeping all the methods in the echotron.API object.

Echotron is designed to be as similar to the official Telegram API as possible, but there are some things to take into account before starting to work with this library.

  • The methods have the exact same name, but with a capital first letter, since in Go methods have to start with a capital letter to be exported. Example: sendMessage becomes SendMessage
  • The order of the parameters in some methods is different than in the official Telegram API, so refer to the docs for the correct one.
  • The only chat_id (or, in this case, chatID) type supported is int64, instead of the "Integer or String" requirement of the official API. That's because numeric IDs can't change in any way, which isn't the case with text-based usernames.
  • In some methods, you might find a InputFile type parameter. InputFile is a struct with unexported fields, since only three combination of fields are valid, which can be obtained through the methods NewInputFileID, NewInputFilePath and NewInputFileBytes.
  • In some methods, you might find a MessageIDOptions type parameter. MessageIDOptions is another struct with unexported fields, since only two combination of field are valid, which can be obtained through the methods NewMessageID and NewInlineMessageID.
  • Optional parameters can be added by passing the correct struct to each method that might request optional parameters. If you don't want to pass any optional parameter, nil is more than enough. Refer to the docs to check for each method's optional parameters struct: it's the type of the opts parameter.
  • Some parameters are hardcoded to avoid putting random stuff which isn't recognized by the Telegram API. Some notable examples are ParseMode, ChatAction and InlineQueryType. For a full list of custom hardcoded parameters, refer to the docs for each custom type: by clicking on the type's name, you'll get the source which contains the possible values for that type.

Additional examples

Functional approach to state management

package main

import (
	"log"
	"strings"

	"github.com/NicoNex/echotron/v3"
)

// Recursive type definition of the bot state function.
type stateFn func(*echotron.Update) stateFn

type bot struct {
	chatID int64
	state  stateFn
	name   string
	echotron.API
}

const token = "MY TELEGRAM TOKEN"

func newBot(chatID int64) echotron.Bot {
	bot := &bot{
		chatID: chatID,
		API:	echotron.NewAPI(token),
	}
	// We set the default state to the bot.handleMessage method.
	bot.state = bot.handleMessage
	return bot
}

func (b *bot) Update(update *echotron.Update) {
	// Here we execute the current state and set the next one.
	b.state = b.state(update)
}

func (b *bot) handleMessage(update *echotron.Update) stateFn {
	if strings.HasPrefix(update.Message.Text, "/set_name") {
		b.SendMessage("Send me my new name!", b.chatID, nil)
		// Here we return b.handleName since next time we receive a message it
		// will be the new name.
		return b.handleName
	}
	return b.handleMessage
}

func (b *bot) handleName(update *echotron.Update) stateFn {
	b.name = update.Message.Text
	b.SendMessage(fmt.Sprintf("My new name is %q", b.name), b.chatID, nil)
	// Here we return b.handleMessage since the next time we receive a message
	// it will be handled in the default way.
	return b.handleMessage
}

func main() {
	dsp := echotron.NewDispatcher(token, newBot)
	log.Println(dsp.Poll())
}

Self destruction for lower memory footprint

package main

import (
	"log"
	"time"

	"github.com/NicoNex/echotron/v3"
)

type bot struct {
	chatID int64
	echotron.API
}

const token = "MY TELEGRAM TOKEN"

var dsp *echotron.Dispatcher

func newBot(chatID int64) echotron.Bot {
	bot := &bot{
		chatID,
		echotron.NewAPI(token),
	}
	go bot.selfDestruct(time.After(time.Hour))
	return bot
}

func (b *bot) selfDestruct(timech <-chan time.Time) {
	<-timech
	b.SendMessage("goodbye", b.chatID, nil)
	dsp.DelSession(b.chatID)
}

func (b *bot) Update(update *echotron.Update) {
	if update.Message.Text == "/start" {
		b.SendMessage("Hello world", b.chatID, nil)
	}
}

func main() {
	dsp = echotron.NewDispatcher(token, newBot)
	log.Println(dsp.Poll())
}

Webhook

package main

import "github.com/NicoNex/echotron/v3"

type bot struct {
	chatID int64
	echotron.API
}

const token = "MY TELEGRAM TOKEN"

func newBot(chatID int64) echotron.Bot {
	return &bot{
		chatID,
		echotron.NewAPI(token),
	}
}

func (b *bot) Update(update *echotron.Update) {
	if update.Message.Text == "/start" {
		b.SendMessage("Hello world", b.chatID, nil)
	}
}

func main() {
	dsp := echotron.NewDispatcher(token, newBot)
	dsp.ListenWebhook("https://example.com:443/my_bot_token")
}

Webhook with a custom http.Server

This is an example for a custom http.Server which handles your own specified routes and also the webhook route which is specified by ListenWebhook.

package main

import (
	"github.com/NicoNex/echotron/v3"

	"context"
	"log"
	"net/http"
)

type bot struct {
	chatID int64
	echotron.API
}

const token = "MY TELEGRAM TOKEN"

func newBot(chatID int64) echotron.Bot {
	return &bot{
		chatID,
		echotron.NewAPI(token),
	}
}

func (b *bot) Update(update *echotron.Update) {
	if update.Message.Text == "/start" {
		b.SendMessage("Hello world", b.chatID, nil)
	}
}

func main() {
	termChan := make(chan os.Signal, 1) // Channel for terminating the app via os.Interrupt signal
	signal.Notify(termChan, syscall.SIGINT, syscall.SIGTERM)

	mux := http.NewServeMux()
	mux.HandleFunc("/login", func(w http.ResponseWriter, r *http.Request) {
		// Handle user login
	})
	mux.HandleFunc("/logout", func(w http.ResponseWriter, r *http.Request) {
		// Handle user logout
	})
	mux.HandleFunc("/about", func(w http.ResponseWriter, r *http.Request) {
		// Tell something about your awesome telegram bot
	})

	// Set custom http.Server
	server := &http.Server{Addr: ":8080", Handler: mux}

	go func() {
		<-termChan
		// Perform some cleanup..
		if err := server.Shutdown(context.Background()); err != nil {
			log.Print(err)
		}
	}()

	// Capture the interrupt signal for app termination handling
	dsp := echotron.NewDispatcher(token, newBot)
	dsp.SetHTTPServer(server)
	// Start your custom http.Server with a registered /my_bot_token handler.
	log.Println(dsp.ListenWebhook("https://example.com/my_bot_token"))
}

Documentation

Index

Constants

View Source
const (
	InlineArticle  InlineQueryType = "article"
	InlinePhoto                    = "photo"
	InlineGIF                      = "gif"
	InlineMPEG4GIF                 = "mpeg4_gif"
	InlineVideo                    = "video"
	InlineAudio                    = "audio"
	InlineVoice                    = "voice"
	InlineDocument                 = "document"
	InlineLocation                 = "location"
	InlineVenue                    = "venue"
	InlineContact                  = "contact"
	InlineGame                     = "game"
	InlineSticker                  = "sticker"
)

These are all the possible types for the various InlineQueryResult*'s Type field.

View Source
const (
	MenuButtonTypeCommands MenuButtonType = "commands"
	MenuButtonTypeWebApp                  = "web_app"
	MenuButtonTypeDefault                 = "default"
)

These are all the possible types for the various MenuButton*'s Type field.

View Source
const (
	Markdown   ParseMode = "Markdown"
	MarkdownV2           = "MarkdownV2"
	HTML                 = "HTML"
)

These are all the possible options that can be used by some methods.

View Source
const (
	Quiz    PollType = "quiz"
	Regular          = "regular"
	Any              = ""
)

These are all the possible poll types.

View Source
const (
	Die     DiceEmoji = "🎲"
	Darts             = "🎯"
	Basket            = "🏀"
	Goal              = "⚽️"
	Bowling           = "🎳"
	Slot              = "🎰"
)

These are all the possible emojis that can be sent through the SendDice method.

View Source
const (
	Typing          ChatAction = "typing"
	UploadPhoto                = "upload_photo"
	RecordVideo                = "record_video"
	UploadVideo                = "upload_video"
	RecordAudio                = "record_audio"
	UploadAudio                = "upload_audio"
	UploadDocument             = "upload_document"
	FindLocation               = "find_location"
	RecordVideoNote            = "record_video_note"
	UploadVideoNote            = "upload_video_note"
	ChooseSticker              = "choose_sticker"
)

These are all the possible actions that can be sent through the SendChatAction method.

View Source
const (
	MentionEntity       MessageEntityType = "mention"
	HashtagEntity                         = "hashtag"
	CashtagEntity                         = "cashtag"
	BotCommandEntity                      = "bot_command"
	UrlEntity                             = "url"
	EmailEntity                           = "email"
	PhoneNumberEntity                     = "phone_number"
	BoldEntity                            = "bold"
	ItalicEntity                          = "italic"
	UnderlineEntity                       = "underline"
	StrikethroughEntity                   = "strikethrough"
	SpoilerEntity                         = "spoiler"
	CodeEntity                            = "code"
	PreEntity                             = "pre"
	TextLinkEntity                        = "text_link"
	TextMentionEntity                     = "text_mention"
	CustomEmojiEntity                     = "custom_emoji"
)

These are all the possible types for MessageEntityType.

View Source
const (
	MessageUpdate            UpdateType = "message"
	EditedMessageUpdate                 = "edited_message"
	ChannelPostUpdate                   = "channel_post"
	EditedChannelPostUpdate             = "edited_channel_post"
	InlineQueryUpdate                   = "inline_query"
	ChosenInlineResultUpdate            = "chosen_inline_result"
	CallbackQueryUpdate                 = "callback_query"
	ShippingQueryUpdate                 = "shipping_query"
	PreCheckoutQueryUpdate              = "pre_checkout_query"
	PollUpdate                          = "poll"
	PollAnswerUpdate                    = "poll_answer"
	MyChatMemberUpdate                  = "my_chat_member"
	ChatMemberUpdate                    = "chat_member"
)

These are all the possible types that a bot can be subscribed to.

View Source
const (
	TypePersonalDetails       EncryptedPassportElementType = "personal_details"
	TypePassport                                           = "passport"
	TypeDriverLicense                                      = "driver_license"
	TypeIdentityCard                                       = "identity_card"
	TypeInternalPassport                                   = "internal_passport"
	TypeAddress                                            = "address"
	TypeUtilityBill                                        = "utility_bill"
	TypeBankStatement                                      = "bank_statement"
	TypeRentalAgreement                                    = "rental_agreement"
	TypePassportRegistration                               = "passport_registration"
	TypeTemporaryRegistration                              = "temporary_registration"
	TypePhoneNumber                                        = "phone_number"
	TypeEmail                                              = "email"
)

These are all the possible options that can be used as Type in EncryptedPassportElement.

View Source
const (
	SourceData             PassportElementErrorSource = "data"
	SourceFrontSide                                   = "front_side"
	SourceReverseSide                                 = "reverse_side"
	SourceSelfie                                      = "selfie"
	SourceFile                                        = "file"
	SourceFiles                                       = "files"
	SourceTranslationFile                             = "translation_file"
	SourceTranslationFiles                            = "translation_files"
	SourceUnspecified                                 = "unspecified"
)

These are all the possible options that can be used as Source in PassportElementSource.

View Source
const (
	RegularStickerSet     StickerSetType = "regular"
	MaskStickerSet                       = "mask"
	CustomEmojiStickerSet                = "custom_emoji"
)
View Source
const (
	StaticFormat   StickerFormat = "static"
	AnimatedFormat               = "animated"
	VideoFormat                  = "video"
)

These are all the possible sticker formats.

View Source
const (
	ForeheadPoint MaskPoint = "forehead"
	EyesPoint               = "eyes"
	MouthPoint              = "mouth"
	ChinPoint               = "chin"
)

These are all the possible parts of the face for a mask.

View Source
const (
	MediaTypePhoto     InputMediaType = "photo"
	MediaTypeVideo                    = "video"
	MediaTypeAnimation                = "animation"
	MediaTypeAudio                    = "audio"
	MediaTypeDocument                 = "document"
)

These are all the possible types for the various InputMedia*'s Type field.

View Source
const (
	BCSTDefault               BotCommandScopeType = "default"
	BCSTAllPrivateChats                           = "all_private_chats"
	BCSTAllGroupChats                             = "all_group_chats"
	BCSTAllChatAdministrators                     = "all_chat_administrators"
	BCSTChat                                      = "chat"
	BCSTChatAdministrators                        = "chat_administrators"
	BCSTChatMember                                = "chat_member"
)

These are all the various bot command scope types.

View Source
const (
	LightBlue IconColor = 0x6FB9F0
	Yellow              = 0xFFD67E
	Purple              = 0xCB86DB
	Green               = 0x8EEE98
	Pink                = 0xFF93B2
	Red                 = 0xFB6F5F
)

These are all the various icon colors.

View Source
const (
	ChatBoostSourcePremium  ChatBoostSourceType = "premium"
	ChatBoostSourceGiftCode                     = "gift_code"
	ChatBoostSourceGiveaway                     = "giveaway"
)

These are all the possible chat boost types.

Variables

This section is empty.

Functions

func PollingUpdates added in v3.23.2

func PollingUpdates(token string) <-chan *Update

PollingUpdates is a wrapper function for PollingUpdatesOptions.

func PollingUpdatesOptions added in v3.23.2

func PollingUpdatesOptions(token string, dropPendingUpdates bool, opts UpdateOptions) <-chan *Update

PollingUpdatesOptions returns a read-only channel of incoming updates from the Telegram API.

func WebhookUpdates added in v3.23.3

func WebhookUpdates(url, token string) <-chan *Update

WebhookUpdates is a wrapper function for WebhookUpdatesOptions.

func WebhookUpdatesOptions added in v3.23.3

func WebhookUpdatesOptions(whURL, token string, dropPendingUpdates bool, opts *WebhookOptions) <-chan *Update

WebhookUpdatesOptions returns a read-only channel of incoming updates from the Telegram API. The webhookUrl should be provided in the following format: '<hostname>:<port>/<path>', eg: 'https://example.com:443/bot_token'. WebhookUpdatesOptions will then proceed to communicate the webhook url '<hostname>/<path>' to Telegram and run a webserver that listens to ':<port>' and handles the path.

Types

type API

type API struct {
	// contains filtered or unexported fields
}

API is the object that contains all the functions that wrap those of the Telegram Bot API.

func NewAPI

func NewAPI(token string) API

NewAPI returns a new API object.

func (API) AddStickerToSet

func (a API) AddStickerToSet(userID int64, name string, sticker InputSticker) (res APIResponseBool, err error)

AddStickerToSet is used to add a new sticker to a set created by the bot.

func (API) AnswerCallbackQuery

func (a API) AnswerCallbackQuery(callbackID string, opts *CallbackQueryOptions) (res APIResponseBool, err error)

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

func (API) AnswerInlineQuery

func (a API) AnswerInlineQuery(inlineQueryID string, results []InlineQueryResult, opts *InlineQueryOptions) (res APIResponseBase, err error)

AnswerInlineQuery is used to send answers to an inline query.

func (API) AnswerPreCheckoutQuery added in v3.15.0

func (a API) AnswerPreCheckoutQuery(preCheckoutQueryID string, ok bool, opts *PreCheckoutOptions) (res APIResponseBase, err error)

AnswerPreCheckoutQuery is used to respond to such pre-checkout queries. Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query. NOTE: The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent.

func (API) AnswerShippingQuery added in v3.15.0

func (a API) AnswerShippingQuery(shippingQueryID string, ok bool, opts *ShippingQueryOptions) (res APIResponseBase, err error)

AnswerShippingQuery is used to reply to shipping queries. If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot.

func (API) AnswerWebAppQuery added in v3.18.0

func (a API) AnswerWebAppQuery(webAppQueryID string, result InlineQueryResult) (res APIResponseSentWebAppMessage, err error)

AnswerWebAppQuery is used to set the result of an interaction with a Web App and send a corresponding message on behalf of the user to the chat from which the query originated.

func (API) ApproveChatJoinRequest added in v3.12.0

func (a API) ApproveChatJoinRequest(chatID, userID int64) (res APIResponseBool, err error)

ApproveChatJoinRequest is used to approve a chat join request. The bot must be an administrator in the chat for this to work and must have the CanInviteUsers administrator right.

func (API) BanChatMember added in v3.5.0

func (a API) BanChatMember(chatID, userID int64, opts *BanOptions) (res APIResponseBool, err error)

BanChatMember is used to ban a user in a group, a supergroup or a channel. In the case of supergroups or channels, the user will not be able to return to the chat on their own using invite links, etc., unless unbanned first (through the UnbanChatMember method). The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.

func (API) BanChatSenderChat added in v3.13.0

func (a API) BanChatSenderChat(chatID, senderChatID int64) (res APIResponseBool, err error)

BanChatSenderChat is used to ban a channel chat in a supergroup or a channel. The owner of the chat will not be able to send messages and join live streams on behalf of the chat, unless it is unbanned first. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights.

func (API) Close added in v3.2.0

func (a API) Close() (res APIResponseBool, err error)

Close is used 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.

func (API) CloseForumTopic added in v3.21.0

func (a API) CloseForumTopic(chatID, messageThreadID int64) (res APIResponseBool, err error)

CloseForumTopic is used 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.

func (API) CloseGeneralForumTopic added in v3.22.0

func (a API) CloseGeneralForumTopic(chatID int64) (res APIResponseBool, err error)

CloseGeneralForumTopic is used 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 can_manage_topics administrator rights.

func (API) CopyMessage added in v3.2.0

func (a API) CopyMessage(chatID, fromChatID int64, messageID int, opts *CopyOptions) (res APIResponseMessageID, err error)

CopyMessage is used to copy messages of any kind. Service messages and invoice messages can't be copied. The method is analogous to the method ForwardMessage, but the copied message doesn't have a link to the original message.

func (API) CopyMessages added in v3.28.0

func (a API) CopyMessages(chatID, fromChatID int64, messageIDs []int, opts *CopyMessagesOptions) (res APIResponseMessageIDs, err error)

CopyMessages is used to copy messages of any kind. If some of the specified messages can't be found or copied, they are skipped. Service messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. 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.

func (a API) CreateChatInviteLink(chatID int64, opts *InviteLinkOptions) (res APIResponseInviteLink, err error)

CreateChatInviteLink is used to create an additional invite link for a chat. The bot must be an administrator in the supergroup for this to work and must have the appropriate admin rights. The link can be revoked using the method RevokeChatInviteLink.

func (API) CreateForumTopic added in v3.21.0

func (a API) CreateForumTopic(chatID int64, name string, opts *CreateTopicOptions) (res APIResponseForumTopic, err error)

CreateForumTopic is used 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.

func (a API) CreateInvoiceLink(title, description, payload, providerToken, currency string, prices []LabeledPrice, opts *CreateInvoiceLinkOptions) (res APIResponseBase, err error)

CreateInvoiceLink creates a link for an invoice.

func (API) CreateNewStickerSet

func (a API) CreateNewStickerSet(userID int64, name, title string, stickers []InputSticker, opts *NewStickerSetOptions) (res APIResponseBool, err error)

CreateNewStickerSet is used to create a new sticker set owned by a user.

func (API) DeclineChatJoinRequest added in v3.12.0

func (a API) DeclineChatJoinRequest(chatID, userID int64) (res APIResponseBool, err error)

DeclineChatJoinRequest is used to decline a chat join request. The bot must be an administrator in the chat for this to work and must have the CanInviteUsers administrator right.

func (API) DeleteChatPhoto added in v3.5.0

func (a API) DeleteChatPhoto(chatID int64) (res APIResponseBool, err error)

DeleteChatPhoto is used 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 admin rights.

func (API) DeleteChatStickerSet added in v3.5.0

func (a API) DeleteChatStickerSet(chatID int64) (res APIResponseBool, err error)

DeleteChatStickerSet is used to delete a group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field `CanSetStickerSet` optionally returned in GetChat requests to check if the bot can use this method.

func (API) DeleteForumTopic added in v3.21.0

func (a API) DeleteForumTopic(chatID, messageThreadID int64) (res APIResponseBool, err error)

DeleteForumTopic is used 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_manage_topics administrator rights.

func (API) DeleteMessage

func (a API) DeleteMessage(chatID int64, messageID int) (res APIResponseBase, err error)

DeleteMessage is used to delete a message, including service messages, with the following limitations: - A message can only be deleted if it was sent less than 48 hours ago. - A dice message in a private chat can only be deleted if it was sent more than 24 hours ago. - Bots can delete outgoing messages in private chats, groups, and supergroups. - Bots can delete incoming messages in private chats. - Bots granted can_post_messages permissions can delete outgoing messages in channels. - If the bot is an administrator of a group, it can delete any message there. - If the bot has can_delete_messages permission in a supergroup or a channel, it can delete any message there.

func (API) DeleteMessages added in v3.28.0

func (a API) DeleteMessages(chatID int64, messageIDs []int) (res APIResponseBool, err error)

DeleteMessages is used to delete multiple messages simultaneously. If some of the specified messages can't be found, they are skipped.

func (API) DeleteMyCommands

func (a API) DeleteMyCommands(opts *CommandOptions) (res APIResponseBool, err error)

DeleteMyCommands is used to delete the list of the bot's commands for the given scope and user language.

func (API) DeleteStickerFromSet

func (a API) DeleteStickerFromSet(sticker string) (res APIResponseBase, err error)

DeleteStickerFromSet is used to delete a sticker from a set created by the bot.

func (API) DeleteStickerSet added in v3.24.0

func (a API) DeleteStickerSet(name string) (res APIResponseBool, err error)

DeleteStickerSet is used to delete a sticker set that was created by the bot.

func (API) DeleteWebhook

func (a API) DeleteWebhook(dropPendingUpdates bool) (res APIResponseBase, err error)

DeleteWebhook is used to remove webhook integration if you decide to switch back to GetUpdates.

func (API) DownloadFile added in v3.1.0

func (a API) DownloadFile(filePath string) ([]byte, error)

DownloadFile returns the bytes of the file corresponding to the given filePath. This function is callable for at least 1 hour since the call to GetFile. When the download expires a new one can be requested by calling GetFile again.

func (a API) EditChatInviteLink(chatID int64, inviteLink string, opts *InviteLinkOptions) (res APIResponseInviteLink, err error)

EditChatInviteLink is used to edit a non-primary invite link created by the bot. The bot must be an administrator in the supergroup for this to work and must have the appropriate admin rights.

func (API) EditForumTopic added in v3.21.0

func (a API) EditForumTopic(chatID, messageThreadID int64, opts *EditTopicOptions) (res APIResponseBool, err error)

EditForumTopic is used 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.

func (API) EditGeneralForumTopic added in v3.22.0

func (a API) EditGeneralForumTopic(chatID int64, name string) (res APIResponseBool, err error)

EditGeneralForumTopic is used 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 can_manage_topics administrator rights.

func (API) EditMessageCaption

func (a API) EditMessageCaption(msg MessageIDOptions, opts *MessageCaptionOptions) (res APIResponseMessage, err error)

EditMessageCaption is used to edit captions of messages.

func (API) EditMessageLiveLocation added in v3.5.0

func (a API) EditMessageLiveLocation(msg MessageIDOptions, latitude, longitude float64, opts *EditLocationOptions) (res APIResponseMessage, err error)

EditMessageLiveLocation is used to edit live location messages. A location can be edited until its `LivePeriod` expires or editing is explicitly disabled by a call to `StopMessageLiveLocation`.

func (API) EditMessageMedia

func (a API) EditMessageMedia(msg MessageIDOptions, media InputMedia, opts *MessageReplyMarkup) (res APIResponseMessage, err error)

EditMessageMedia is used 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.

func (API) EditMessageReplyMarkup

func (a API) EditMessageReplyMarkup(msg MessageIDOptions, opts *MessageReplyMarkup) (res APIResponseMessage, err error)

EditMessageReplyMarkup is used to edit only the reply markup of messages.

func (API) EditMessageText

func (a API) EditMessageText(text string, msg MessageIDOptions, opts *MessageTextOptions) (res APIResponseMessage, err error)

EditMessageText is used to edit text and game messages.

func (a API) ExportChatInviteLink(chatID int64) (res APIResponseString, err error)

ExportChatInviteLink is used 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 supergroup for this to work and must have the appropriate admin rights.

func (API) ForwardMessage added in v3.2.0

func (a API) ForwardMessage(chatID, fromChatID int64, messageID int, opts *ForwardOptions) (res APIResponseMessage, err error)

ForwardMessage is used to forward messages of any kind. Service messages can't be forwarded.

func (API) ForwardMessages added in v3.28.0

func (a API) ForwardMessages(chatID, fromChatID int64, messageIDs []int, opts *ForwardOptions) (res APIResponseMessageIDs, err error)

ForwardMessages is used 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.

func (API) GetBusinessConnection added in v3.30.0

func (a API) GetBusinessConnection(business_connection_id string) (res APIResponseBusinessConnection, err error)

GetBusinessConnection is used to get information about the connection of the bot with a business account.

func (API) GetChat

func (a API) GetChat(chatID int64) (res APIResponseChat, err error)

GetChat is used to get up to date information about the chat. (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.)

func (API) GetChatAdministrators

func (a API) GetChatAdministrators(chatID int64) (res APIResponseAdministrators, err error)

GetChatAdministrators is used to get a list of administrators in a chat.

func (API) GetChatMember

func (a API) GetChatMember(chatID, userID int64) (res APIResponseChatMember, err error)

GetChatMember is used to get information about a member of a chat.

func (API) GetChatMemberCount

func (a API) GetChatMemberCount(chatID int64) (res APIResponseInteger, err error)

GetChatMemberCount is used to get the number of members in a chat.

func (API) GetChatMenuButton added in v3.18.0

func (a API) GetChatMenuButton(opts GetChatMenuButtonOptions) (res APIResponseMenuButton, err error)

GetChatMenuButton is used to get the current value of the bot's menu button in a private chat, or the default menu button.

func (API) GetCustomEmojiStickers added in v3.20.0

func (a API) GetCustomEmojiStickers(customEmojiIDs ...string) (res APIResponseStickers, err error)

GetCustomEmojiStickers is used to get information about custom emoji stickers by their identifiers.

func (API) GetFile added in v3.1.0

func (a API) GetFile(fileID string) (res APIResponseFile, err error)

GetFile returns the basic info about a file and prepares it for downloading. For the moment, bots can download files of up to 20MB in size. The file can then be downloaded with DownloadFile where filePath is taken from the response. It is guaranteed that the file will be downloadable for at least 1 hour. When the download file expires, a new one can be requested by calling GetFile again.

func (API) GetForumTopicIconStickers added in v3.21.0

func (a API) GetForumTopicIconStickers() (res APIResponseStickers, err error)

GetForumTopicIconStickers is used to get custom emoji stickers, which can be used as a forum topic icon by any user.

func (API) GetGameHighScores

func (a API) GetGameHighScores(userID int64, opts MessageIDOptions) (res APIResponseGameHighScore, err error)

GetGameHighScores is used to get data for high score tables.

func (API) GetMe added in v3.2.0

func (a API) GetMe() (res APIResponseUser, err error)

GetMe is a simple method for testing your bot's auth token.

func (API) GetMyCommands

func (a API) GetMyCommands(opts *CommandOptions) (res APIResponseCommands, err error)

GetMyCommands is used to get the current list of the bot's commands for the given scope and user language.

func (API) GetMyDefaultAdministratorRights added in v3.18.0

func (a API) GetMyDefaultAdministratorRights(opts GetMyDefaultAdministratorRightsOptions) (res APIResponseChatAdministratorRights, err error)

GetMyDefaultAdministratorRights is used to get the current default administrator rights of the bot.

func (API) GetMyDescription added in v3.24.0

func (a API) GetMyDescription(languageCode string) (res APIResponseBotDescription, err error)

GetMyDescription is used to get the current bot description for the given user language.

func (API) GetMyName added in v3.25.0

func (a API) GetMyName(languageCode string) (res APIResponseBotName, err error)

GetMyName is used to get the current bot name for the given user language.

func (API) GetMyShortDescription added in v3.24.0

func (a API) GetMyShortDescription(languageCode string) (res APIResponseBotShortDescription, err error)

GetMyShortDescription is used to get the current bot short description for the given user language.

func (API) GetStickerSet

func (a API) GetStickerSet(name string) (res APIResponseStickerSet, err error)

GetStickerSet is used to get a sticker set.

func (API) GetUpdates

func (a API) GetUpdates(opts *UpdateOptions) (res APIResponseUpdate, err error)

GetUpdates is used to receive incoming updates using long polling.

func (API) GetUserChatBoosts added in v3.28.0

func (a API) GetUserChatBoosts(chatID, userID int64) (res APIResponseUserChatBoosts, err error)

GetUserChatBoosts is used to get the list of boosts added to a chat by a user. Requires administrator rights in the chat.

func (API) GetUserProfilePhotos added in v3.5.0

func (a API) GetUserProfilePhotos(userID int64, opts *UserProfileOptions) (res APIResponseUserProfile, err error)

GetUserProfilePhotos is used to get a list of profile pictures for a user.

func (API) GetWebhookInfo

func (a API) GetWebhookInfo() (res APIResponseWebhook, err error)

GetWebhookInfo is used to get current webhook status.

func (API) HideGeneralForumTopic added in v3.22.0

func (a API) HideGeneralForumTopic(chatID int64) (res APIResponseBool, err error)

HideGeneralForumTopic is used 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 can_manage_topics administrator rights. The topic will be automatically closed if it was open.

func (API) LeaveChat added in v3.5.0

func (a API) LeaveChat(chatID int64) (res APIResponseBool, err error)

LeaveChat is used to make the bot leave a group, supergroup or channel.

func (API) LogOut added in v3.2.0

func (a API) LogOut() (res APIResponseBool, err error)

LogOut is used 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.

func (API) PinChatMessage added in v3.5.0

func (a API) PinChatMessage(chatID int64, messageID int, opts *PinMessageOptions) (res APIResponseBool, err error)

PinChatMessage is used to add a message to the list of pinned messages in the chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' admin right in a supergroup or 'can_edit_messages' admin right in a channel.

func (API) PromoteChatMember added in v3.5.0

func (a API) PromoteChatMember(chatID, userID int64, opts *PromoteOptions) (res APIResponseBool, err error)

PromoteChatMember is used to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the supergroup for this to work and must have the appropriate admin rights.

func (API) ReopenForumTopic added in v3.21.0

func (a API) ReopenForumTopic(chatID, messageThreadID int64) (res APIResponseBool, err error)

ReopenForumTopic is used 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.

func (API) ReopenGeneralForumTopic added in v3.22.0

func (a API) ReopenGeneralForumTopic(chatID int64) (res APIResponseBool, err error)

ReopenGeneralForumTopic is used 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 can_manage_topics administrator rights. The topic will be automatically unhidden if it was hidden.

func (API) ReplaceStickerInSet added in v3.30.0

func (a API) ReplaceStickerInSet(userID int64, name string, old_sticker string, sticker InputSticker) (res APIResponseBool, err error)

ReplaceStickerInSet is used to replace an existing sticker in a sticker set with a new one. The method is equivalent to calling DeleteStickerFromSet, then AddStickerToSet, then SetStickerPositionInSet.

func (API) RestrictChatMember added in v3.5.0

func (a API) RestrictChatMember(chatID, userID int64, permissions ChatPermissions, opts *RestrictOptions) (res APIResponseBool, err error)

RestrictChatMember is used 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 admin rights.

func (a API) RevokeChatInviteLink(chatID int64, inviteLink string) (res APIResponseInviteLink, err error)

RevokeChatInviteLink is used 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 supergroup for this to work and must have the appropriate admin rights.

func (API) SendAnimation

func (a API) SendAnimation(file InputFile, chatID int64, opts *AnimationOptions) (res APIResponseMessage, err error)

SendAnimation is used to send animation files (GIF or H.264/MPEG-4 AVC video without sound).

func (API) SendAudio

func (a API) SendAudio(file InputFile, chatID int64, opts *AudioOptions) (res APIResponseMessage, err error)

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

func (API) SendChatAction

func (a API) SendChatAction(action ChatAction, chatID int64, opts *ChatActionOptions) (res APIResponseBool, err error)

SendChatAction is used 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).

func (API) SendContact

func (a API) SendContact(phoneNumber, firstName string, chatID int64, opts *ContactOptions) (res APIResponseMessage, err error)

SendContact is used to send phone contacts.

func (API) SendDice added in v3.2.0

func (a API) SendDice(chatID int64, emoji DiceEmoji, opts *BaseOptions) (res APIResponseMessage, err error)

SendDice is used to send an animated emoji that will display a random value.

func (API) SendDocument

func (a API) SendDocument(file InputFile, chatID int64, opts *DocumentOptions) (res APIResponseMessage, err error)

SendDocument is used to send general files.

func (API) SendGame

func (a API) SendGame(gameShortName string, chatID int64, opts *BaseOptions) (res APIResponseMessage, err error)

SendGame is used to send a Game.

func (API) SendInvoice added in v3.15.0

func (a API) SendInvoice(chatID int64, title, description, payload, providerToken, currency string, prices []LabeledPrice, opts *InvoiceOptions) (res APIResponseMessage, err error)

SendInvoice is used to send invoices.

func (API) SendLocation added in v3.2.0

func (a API) SendLocation(chatID int64, latitude, longitude float64, opts *LocationOptions) (res APIResponseMessage, err error)

SendLocation is used to send point on the map.

func (API) SendMediaGroup added in v3.11.0

func (a API) SendMediaGroup(chatID int64, media []GroupableInputMedia, opts *MediaGroupOptions) (res APIResponseMessageArray, err error)

SendMediaGroup is used 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.

func (API) SendMessage

func (a API) SendMessage(text string, chatID int64, opts *MessageOptions) (res APIResponseMessage, err error)

SendMessage is used to send text messages.

func (API) SendPhoto

func (a API) SendPhoto(file InputFile, chatID int64, opts *PhotoOptions) (res APIResponseMessage, err error)

SendPhoto is used to send photos.

func (API) SendPoll added in v3.5.0

func (a API) SendPoll(chatID int64, question string, options []string, opts *PollOptions) (res APIResponseMessage, err error)

SendPoll is used to send a native poll.

func (API) SendSticker

func (a API) SendSticker(stickerID string, chatID int64, opts *StickerOptions) (res APIResponseMessage, err error)

SendSticker is used to send static .WEBP or animated .TGS stickers.

func (API) SendVenue added in v3.2.0

func (a API) SendVenue(chatID int64, latitude, longitude float64, title, address string, opts *VenueOptions) (res APIResponseMessage, err error)

SendVenue is used to send information about a venue.

func (API) SendVideo

func (a API) SendVideo(file InputFile, chatID int64, opts *VideoOptions) (res APIResponseMessage, err error)

SendVideo is used to send video files. Telegram clients support mp4 videos (other formats may be sent with SendDocument).

func (API) SendVideoNote

func (a API) SendVideoNote(file InputFile, chatID int64, opts *VideoNoteOptions) (res APIResponseMessage, err error)

SendVideoNote is used to send video messages.

func (API) SendVoice

func (a API) SendVoice(file InputFile, chatID int64, opts *VoiceOptions) (res APIResponseMessage, err error)

SendVoice is used to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS (other formats may be sent as Audio or Document).

func (API) SetChatAdministratorCustomTitle added in v3.5.0

func (a API) SetChatAdministratorCustomTitle(chatID, userID int64, customTitle string) (res APIResponseBool, err error)

SetChatAdministratorCustomTitle is used to set a custom title for an administrator in a supergroup promoted by the bot.

func (API) SetChatDescription added in v3.5.0

func (a API) SetChatDescription(chatID int64, description string) (res APIResponseBool, err error)

SetChatDescription is used 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 admin rights.

func (API) SetChatMenuButton added in v3.18.0

func (a API) SetChatMenuButton(opts SetChatMenuButtonOptions) (res APIResponseBool, err error)

SetChatMenuButton is used to change the bot's menu button in a private chat, or the default menu button.

func (API) SetChatPermissions added in v3.5.0

func (a API) SetChatPermissions(chatID int64, permissions ChatPermissions, opts *ChatPermissionsOptions) (res APIResponseBool, err error)

SetChatPermissions is used to set default chat permissions for all members. The bot must be an administrator in the supergroup for this to work and must have the can_restrict_members admin rights.

func (API) SetChatPhoto added in v3.5.0

func (a API) SetChatPhoto(file InputFile, chatID int64) (res APIResponseBool, err error)

SetChatPhoto is used 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 admin rights.

func (API) SetChatStickerSet added in v3.5.0

func (a API) SetChatStickerSet(chatID int64, stickerSetName string) (res APIResponseBool, err error)

SetChatStickerSet is used 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 admin rights. Use the field `CanSetStickerSet` optionally returned in GetChat requests to check if the bot can use this method.

func (API) SetChatTitle added in v3.5.0

func (a API) SetChatTitle(chatID int64, title string) (res APIResponseBool, err error)

SetChatTitle is used 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 admin rights.

func (API) SetCustomEmojiStickerSetThumbnail added in v3.24.0

func (a API) SetCustomEmojiStickerSetThumbnail(name, emojiID string) (res APIResponseBool, err error)

SetCustomEmojiStickerSetThumbnail is used to set the thumbnail of a custom emoji sticker set.

func (API) SetGameScore

func (a API) SetGameScore(userID int64, score int, msgID MessageIDOptions, opts *GameScoreOptions) (res APIResponseMessage, err error)

SetGameScore is used to set the score of the specified user in a game.

func (API) SetMessageReaction added in v3.28.0

func (a API) SetMessageReaction(chatID int64, messageID int, opts *MessageReactionOptions) (res APIResponseBool, err error)

SetMessageReaction is used 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. In albums, bots must react to the first message.

func (API) SetMyCommands

func (a API) SetMyCommands(opts *CommandOptions, commands ...BotCommand) (res APIResponseBool, err error)

SetMyCommands is used to change the list of the bot's commands for the given scope and user language.

func (API) SetMyDefaultAdministratorRights added in v3.18.0

func (a API) SetMyDefaultAdministratorRights(opts SetMyDefaultAdministratorRightsOptions) (res APIResponseBool, err error)

SetMyDefaultAdministratorRights is used to change the default administrator rights requested by the bot when it's added as an administrator to groups or channels. These rights will be suggested to users, but they are are free to modify the list before adding the bot.

func (API) SetMyDescription added in v3.24.0

func (a API) SetMyDescription(description, languageCode string) (res APIResponseBool, err error)

SetMyDescription is used to to change the bot's description, which is shown in the chat with the bot if the chat is empty.

func (API) SetMyName added in v3.25.0

func (a API) SetMyName(name, languageCode string) (res APIResponseBool, err error)

SetMyName is used to change the bot's name.

func (API) SetMyShortDescription added in v3.24.0

func (a API) SetMyShortDescription(shortDescription, languageCode string) (res APIResponseBool, err error)

SetMyShortDescription is used to 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.

func (API) SetPassportDataErrors added in v3.15.0

func (a API) SetPassportDataErrors(userID int64, errors []PassportElementError) (res APIResponseBool, err error)

SetPassportDataErrors Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed. The contents of the field for which you returned the error must change.

func (API) SetStickerEmojiList added in v3.24.0

func (a API) SetStickerEmojiList(sticker string, emojis []string) (res APIResponseBool, err error)

SetStickerEmojiList is used 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.

func (API) SetStickerKeywords added in v3.24.0

func (a API) SetStickerKeywords(sticker string, keywords []string) (res APIResponseBool, err error)

SetStickerKeywords is used to change search keywords assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot.

func (API) SetStickerMaskPosition added in v3.24.0

func (a API) SetStickerMaskPosition(sticker string, mask MaskPosition) (res APIResponseBool, err error)

SetStickerMaskPosition is used to change the mask position of a mask sticker. The sticker must belong to a sticker set that was created by the bot.

func (API) SetStickerPositionInSet

func (a API) SetStickerPositionInSet(sticker string, position int) (res APIResponseBase, err error)

SetStickerPositionInSet is used to move a sticker in a set created by the bot to a specific position.

func (API) SetStickerSetThumbnail added in v3.24.0

func (a API) SetStickerSetThumbnail(name string, userID int64, thumbnail InputFile, format StickerFormat) (res APIResponseBase, err error)

SetStickerSetThumbnail is used to set the thumbnail of a sticker set.

func (API) SetStickerSetTitle added in v3.24.0

func (a API) SetStickerSetTitle(name, title string) (res APIResponseBool, err error)

SetStickerSetTitle is used to set the title of a created sticker set.

func (API) SetWebhook

func (a API) SetWebhook(webhookURL string, dropPendingUpdates bool, opts *WebhookOptions) (res APIResponseBase, err error)

SetWebhook is used to specify a url and receive incoming updates via an outgoing webhook.

func (API) StopMessageLiveLocation added in v3.5.0

func (a API) StopMessageLiveLocation(msg MessageIDOptions, opts *MessageReplyMarkup) (res APIResponseMessage, err error)

StopMessageLiveLocation is used to stop updating a live location message before `LivePeriod` expires.

func (API) StopPoll added in v3.5.0

func (a API) StopPoll(chatID int64, messageID int, opts *MessageReplyMarkup) (res APIResponsePoll, err error)

StopPoll is used to stop a poll which was sent by the bot.

func (API) UnbanChatMember added in v3.5.0

func (a API) UnbanChatMember(chatID, userID int64, opts *UnbanOptions) (res APIResponseBool, err error)

UnbanChatMember is used 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 `OnlyIfBanned`.

func (API) UnbanChatSenderChat added in v3.13.0

func (a API) UnbanChatSenderChat(chatID, senderChatID int64) (res APIResponseBool, err error)

UnbanChatSenderChat is used to unban a previously channel chat in a supergroup or channel. The bot must be an administrator for this to work and must have the appropriate administrator rights.

func (API) UnhideGeneralForumTopic added in v3.22.0

func (a API) UnhideGeneralForumTopic(chatID int64) (res APIResponseBool, err error)

UnhideGeneralForumTopic is used 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 can_manage_topics administrator rights.

func (API) UnpinAllChatMessages added in v3.5.0

func (a API) UnpinAllChatMessages(chatID int64) (res APIResponseBool, err error)

UnpinAllChatMessages is used to clear the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' admin right in a supergroup or 'can_edit_messages' admin right in a channel.

func (API) UnpinAllForumTopicMessages added in v3.21.0

func (a API) UnpinAllForumTopicMessages(chatID, messageThreadID int64) (res APIResponseBool, err error)

UnpinAllForumTopicMessages is used 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_manage_topics administrator rights.

func (API) UnpinAllGeneralForumTopicMessages added in v3.26.0

func (a API) UnpinAllGeneralForumTopicMessages(chatID int64) (res APIResponseBool, err error)

UnpinAllGeneralForumTopicMessages is used 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 can_pin_messages administrator right in the supergroup.

func (API) UnpinChatMessage added in v3.5.0

func (a API) UnpinChatMessage(chatID int64, messageID int) (res APIResponseBool, err error)

UnpinChatMessage is used to remove a message from the list of pinned messages in the chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' admin right in a supergroup or 'can_edit_messages' admin right in a channel.

func (API) UploadStickerFile

func (a API) UploadStickerFile(userID int64, sticker InputFile, format StickerFormat) (res APIResponseFile, err error)

UploadStickerFile is used to upload a .PNG file with a sticker for later use in CreateNewStickerSet and AddStickerToSet methods (can be used multiple times).

type APIError added in v3.14.2

type APIError struct {
	// contains filtered or unexported fields
}

APIError represents an error returned by the Telegram API.

func (*APIError) Description added in v3.14.2

func (a *APIError) Description() string

Description returns the error description received from the Telegram API.

func (*APIError) Error added in v3.14.2

func (a *APIError) Error() string

Error returns the error string.

func (*APIError) ErrorCode added in v3.14.2

func (a *APIError) ErrorCode() int

ErrorCode returns the error code received from the Telegram API.

type APIResponse added in v3.13.1

type APIResponse interface {
	// Base returns the object of type APIResponseBase contained in each implemented type.
	Base() APIResponseBase
}

APIResponse is implemented by all the APIResponse* types.

type APIResponseAdministrators

type APIResponseAdministrators struct {
	Result []*ChatMember `json:"result,omitempty"`
	APIResponseBase
}

APIResponseAdministrators represents the incoming response from Telegram servers. Used by all methods that return an array of ChatMember objects on success.

func (APIResponseAdministrators) Base added in v3.13.1

Base returns the contained object of type APIResponseBase.

type APIResponseBase

type APIResponseBase struct {
	Description string `json:"description,omitempty"`
	ErrorCode   int    `json:"error_code,omitempty"`
	Ok          bool   `json:"ok"`
}

APIResponseBase is a base type that represents the incoming response from Telegram servers. Used by APIResponse* to slim down the implementation.

func (APIResponseBase) Base added in v3.13.1

Base returns the APIResponseBase itself.

type APIResponseBool

type APIResponseBool struct {
	APIResponseBase
	Result bool `json:"result,omitempty"`
}

APIResponseBool represents the incoming response from Telegram servers. Used by all methods that return True on success.

func (APIResponseBool) Base added in v3.13.1

Base returns the contained object of type APIResponseBase.

type APIResponseBotDescription added in v3.24.0

type APIResponseBotDescription struct {
	Result *BotDescription `json:"result,omitempty"`
	APIResponseBase
}

APIResponseBotDescription represents the incoming response from Telegram servers. Used by all methods that return a BotDescription object on success.

func (APIResponseBotDescription) Base added in v3.24.0

Base returns the contained object of type APIResponseBase.

type APIResponseBotName added in v3.25.0

type APIResponseBotName struct {
	Result *BotName `json:"result,omitempty"`
	APIResponseBase
}

APIResponseBotName represents the incoming response from Telegram servers. Used by all methods that return a BotName object on success.

func (APIResponseBotName) Base added in v3.25.0

Base returns the contained object of type APIResponseBase.

type APIResponseBotShortDescription added in v3.24.0

type APIResponseBotShortDescription struct {
	Result *BotShortDescription `json:"result,omitempty"`
	APIResponseBase
}

APIResponseBotShortDescription represents the incoming response from Telegram servers. Used by all methods that return a BotShortDescription object on success.

func (APIResponseBotShortDescription) Base added in v3.24.0

Base returns the contained object of type APIResponseBase.

type APIResponseBusinessConnection added in v3.30.0

type APIResponseBusinessConnection struct {
	Result *BusinessConnection `json:"result,omitempty"`
	APIResponseBase
}

APIResponseBusinessConnection represents the incoming response from Telegram servers. Used by all methods that return a BusinessConnection object on success.

func (APIResponseBusinessConnection) Base added in v3.30.0

Base returns the contained object of type APIResponseBase.

type APIResponseChat

type APIResponseChat struct {
	Result *Chat `json:"result,omitempty"`
	APIResponseBase
}

APIResponseChat represents the incoming response from Telegram servers. Used by all methods that return a Chat object on success.

func (APIResponseChat) Base added in v3.13.1

Base returns the contained object of type APIResponseBase.

type APIResponseChatAdministratorRights added in v3.18.0

type APIResponseChatAdministratorRights struct {
	Result *ChatAdministratorRights `json:"result,omitempty"`
	APIResponseBase
}

APIResponseChatAdministratorRights represents the incoming response from Telegram servers. Used by all methods that return a ChatAdministratorRights object on success.

func (APIResponseChatAdministratorRights) Base added in v3.18.0

Base returns the contained object of type APIResponseBase.

type APIResponseChatMember

type APIResponseChatMember struct {
	Result *ChatMember `json:"result,omitempty"`
	APIResponseBase
}

APIResponseChatMember represents the incoming response from Telegram servers. Used by all methods that return a ChatMember object on success.

func (APIResponseChatMember) Base added in v3.13.1

Base returns the contained object of type APIResponseBase.

type APIResponseCommands

type APIResponseCommands struct {
	Result []*BotCommand `json:"result,omitempty"`
	APIResponseBase
}

APIResponseCommands represents the incoming response from Telegram servers. Used by all methods that return an array of BotCommand objects on success.

func (APIResponseCommands) Base added in v3.13.1

Base returns the contained object of type APIResponseBase.

type APIResponseFile

type APIResponseFile struct {
	Result *File `json:"result,omitempty"`
	APIResponseBase
}

APIResponseFile represents the incoming response from Telegram servers. Used by all methods that return a File object on success.

func (APIResponseFile) Base added in v3.13.1

Base returns the contained object of type APIResponseBase.

type APIResponseForumTopic added in v3.21.0

type APIResponseForumTopic struct {
	Result *ForumTopic `json:"result,omitempty"`
	APIResponseBase
}

APIResponseForumTopic represents the incoming response from Telegram servers. Used by all methods that return a ForumTopic object on success.

func (APIResponseForumTopic) Base added in v3.21.0

Base returns the contained object of type APIResponseBase.

type APIResponseGameHighScore

type APIResponseGameHighScore struct {
	Result []*GameHighScore `json:"result,omitempty"`
	APIResponseBase
}

APIResponseGameHighScore represents the incoming response from Telegram servers. Used by all methods that return an array of GameHighScore objects on success.

func (APIResponseGameHighScore) Base added in v3.13.1

Base returns the contained object of type APIResponseBase.

type APIResponseInteger added in v3.5.0

type APIResponseInteger struct {
	APIResponseBase
	Result int `json:"result,omitempty"`
}

APIResponseInteger represents the incoming response from Telegram servers. Used by all methods that return an integer on success.

func (APIResponseInteger) Base added in v3.13.1

Base returns the contained object of type APIResponseBase.

type APIResponseInviteLink struct {
	Result *ChatInviteLink `json:"result,omitempty"`
	APIResponseBase
}

APIResponseInviteLink represents the incoming response from Telegram servers. Used by all methods that return a ChatInviteLink object on success.

func (APIResponseInviteLink) Base added in v3.13.1

Base returns the contained object of type APIResponseBase.

type APIResponseMenuButton added in v3.18.0

type APIResponseMenuButton struct {
	Result *MenuButton `json:"result,omitempty"`
	APIResponseBase
}

APIResponseMenuButton represents the incoming response from Telegram servers. Used by all methods that return a MenuButton object on success.

func (APIResponseMenuButton) Base added in v3.18.0

Base returns the contained object of type APIResponseBase.

type APIResponseMessage

type APIResponseMessage struct {
	Result *Message `json:"result,omitempty"`
	APIResponseBase
}

APIResponseMessage represents the incoming response from Telegram servers. Used by all methods that return a Message object on success.

func (APIResponseMessage) Base added in v3.13.1

Base returns the contained object of type APIResponseBase.

type APIResponseMessageArray added in v3.11.0

type APIResponseMessageArray struct {
	Result []*Message `json:"result,omitempty"`
	APIResponseBase
}

APIResponseMessageArray represents the incoming response from Telegram servers. Used by all methods that return an array of Message objects on success.

func (APIResponseMessageArray) Base added in v3.13.1

Base returns the contained object of type APIResponseBase.

type APIResponseMessageID added in v3.2.0

type APIResponseMessageID struct {
	Result *MessageID `json:"result,omitempty"`
	APIResponseBase
}

APIResponseMessageID represents the incoming response from Telegram servers. Used by all methods that return a MessageID object on success.

func (APIResponseMessageID) Base added in v3.13.1

Base returns the contained object of type APIResponseBase.

type APIResponseMessageIDs added in v3.28.0

type APIResponseMessageIDs struct {
	Result []*MessageID `json:"result,omitempty"`
	APIResponseBase
}

APIResponseMessageIDs represents the incoming response from Telegram servers. Used by all methods that return a MessageID object on success.

func (APIResponseMessageIDs) Base added in v3.28.0

Base returns the contained object of type APIResponseBase.

type APIResponsePoll added in v3.5.0

type APIResponsePoll struct {
	Result *Poll `json:"result,omitempty"`
	APIResponseBase
}

APIResponsePoll represents the incoming response from Telegram servers. Used by all methods that return a Poll object on success.

func (APIResponsePoll) Base added in v3.13.1

Base returns the contained object of type APIResponseBase.

type APIResponseSentWebAppMessage added in v3.18.0

type APIResponseSentWebAppMessage struct {
	Result *SentWebAppMessage `json:"result,omitempty"`
	APIResponseBase
}

APIResponseSentWebAppMessage represents the incoming response from Telegram servers. Used by all methods that return a SentWebAppMessage object on success.

func (APIResponseSentWebAppMessage) Base added in v3.18.0

Base returns the contained object of type APIResponseBase.

type APIResponseStickerSet

type APIResponseStickerSet struct {
	Result *StickerSet `json:"result,omitempty"`
	APIResponseBase
}

APIResponseStickerSet represents the incoming response from Telegram servers. Used by all methods that return a StickerSet object on success.

func (APIResponseStickerSet) Base added in v3.13.1

Base returns the contained object of type APIResponseBase.

type APIResponseStickers added in v3.20.0

type APIResponseStickers struct {
	Result []*Sticker `json:"result,omitempty"`
	APIResponseBase
}

APIResponseStickers represents the incoming response from Telegram servers. Used by all methods that return an array of Stickers on success.

func (APIResponseStickers) Base added in v3.20.0

Base returns the contained object of type APIResponseBase.

type APIResponseString added in v3.5.0

type APIResponseString struct {
	Result string `json:"result,omitempty"`
	APIResponseBase
}

APIResponseString represents the incoming response from Telegram servers. Used by all methods that return a string on success.

func (APIResponseString) Base added in v3.13.1

Base returns the contained object of type APIResponseBase.

type APIResponseUpdate

type APIResponseUpdate struct {
	Result []*Update `json:"result,omitempty"`
	APIResponseBase
}

APIResponseUpdate represents the incoming response from Telegram servers. Used by all methods that return an array of Update objects on success.

func (APIResponseUpdate) Base added in v3.13.1

Base returns the contained object of type APIResponseBase.

type APIResponseUser added in v3.2.0

type APIResponseUser struct {
	Result *User `json:"result,omitempty"`
	APIResponseBase
}

APIResponseUser represents the incoming response from Telegram servers. Used by all methods that return a User object on success.

func (APIResponseUser) Base added in v3.13.1

Base returns the contained object of type APIResponseBase.

type APIResponseUserChatBoosts added in v3.28.0

type APIResponseUserChatBoosts struct {
	Result *UserChatBoosts `json:"result,omitempty"`
	APIResponseBase
}

APIResponseUserChatBoosts represents the incoming response from Telegram servers. Used by all methods that return a UserChatBoosts object on success.

func (APIResponseUserChatBoosts) Base added in v3.28.0

Base returns the contained object of type APIResponseBase.

type APIResponseUserProfile added in v3.5.0

type APIResponseUserProfile struct {
	Result *UserProfilePhotos `json:"result,omitempty"`
	APIResponseBase
}

APIResponseUserProfile represents the incoming response from Telegram servers. Used by all methods that return a UserProfilePhotos object on success.

func (APIResponseUserProfile) Base added in v3.13.1

Base returns the contained object of type APIResponseBase.

type APIResponseWebhook

type APIResponseWebhook struct {
	Result *WebhookInfo `json:"result,omitempty"`
	APIResponseBase
}

APIResponseWebhook represents the incoming response from Telegram servers. Used by all methods that return a WebhookInfo object on success.

func (APIResponseWebhook) Base added in v3.13.1

Base returns the contained object of type APIResponseBase.

type Animation

type Animation struct {
	Thumbnail    *PhotoSize `json:"thumbnail,omitempty"`
	FileID       string     `json:"file_id"`
	FileUniqueID string     `json:"file_unique_id"`
	FileName     string     `json:"file_name,omitempty"`
	MimeType     string     `json:"mime_type,omitempty"`
	Width        int        `json:"width"`
	Height       int        `json:"height"`
	Duration     int        `json:"duration"`
	FileSize     int64      `json:"file_size,omitempty"`
}

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

type AnimationOptions

type AnimationOptions struct {
	ReplyMarkup          ReplyMarkup `query:"reply_markup"`
	BusinessConnectionID string      `query:"business_connection_id"`
	ParseMode            ParseMode   `query:"parse_mode"`
	Caption              string      `query:"caption"`
	Thumbnail            InputFile
	CaptionEntities      []MessageEntity `query:"caption_entities"`
	ReplyParameters      ReplyParameters `query:"reply_parameters"`
	MessageThreadID      int             `query:"message_thread_id"`
	Duration             int             `query:"duration"`
	Width                int             `query:"width"`
	Height               int             `query:"height"`
	HasSpoiler           bool            `query:"has_spoiler"`
	DisableNotification  bool            `query:"disable_notification"`
	ProtectContent       bool            `query:"protect_content"`
}

AnimationOptions contains the optional parameters used by the SendAnimation method.

type Audio

type Audio struct {
	Thumbnail    *PhotoSize `json:"thumbnail,omitempty"`
	FileID       string     `json:"file_id"`
	FileUniqueID string     `json:"file_unique_id"`
	Performer    string     `json:"performer,omitempty"`
	Title        string     `json:"title,omitempty"`
	FileName     string     `json:"file_name,omitempty"`
	MimeType     string     `json:"mime_type,omitempty"`
	FileSize     int64      `json:"file_size,omitempty"`
	Duration     int        `json:"duration"`
}

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

type AudioOptions

type AudioOptions struct {
	ReplyMarkup          ReplyMarkup `query:"reply_markup"`
	Title                string      `query:"title"`
	ParseMode            ParseMode   `query:"parse_mode"`
	Caption              string      `query:"caption"`
	Performer            string      `query:"performer"`
	BusinessConnectionID string      `query:"business_connection_id"`
	Thumbnail            InputFile
	CaptionEntities      []MessageEntity `query:"caption_entities"`
	ReplyParameters      ReplyParameters `query:"reply_parameters"`
	MessageThreadID      int             `query:"message_thread_id"`
	Duration             int             `query:"duration"`
	DisableNotification  bool            `query:"disable_notification"`
	ProtectContent       bool            `query:"protect_content"`
}

AudioOptions contains the optional parameters used by the SendAudio method.

type BanOptions added in v3.5.0

type BanOptions struct {
	UntilDate      int  `query:"until_date"`
	RevokeMessages bool `query:"revoke_messages"`
}

BanOptions contains the optional parameters used by the BanChatMember method.

type BaseOptions

type BaseOptions struct {
	BusinessConnectionID string          `query:"business_connection_id"`
	ReplyMarkup          ReplyMarkup     `query:"reply_markup"`
	ReplyParameters      ReplyParameters `query:"reply_parameters"`
	MessageThreadID      int             `query:"message_thread_id"`
	DisableNotification  bool            `query:"disable_notification"`
	ProtectContent       bool            `query:"protect_content"`
}

BaseOptions contains the optional parameters used frequently in some Telegram API methods.

type Birthdate added in v3.30.0

type Birthdate struct {
	Day   int `json:"day"`
	Month int `json:"month"`
	Year  int `json:"year"`
}

Birthdate

type Bot

type Bot interface {
	// Update will be called upon receiving any update from Telegram.
	Update(*Update)
}

Bot is the interface that must be implemented by your definition of the struct thus it represent each open session with a user on Telegram.

type BotCommand

type BotCommand struct {
	Command     string `json:"command"`
	Description string `json:"description"`
}

BotCommand represents a bot command.

type BotCommandScope

type BotCommandScope struct {
	Type   BotCommandScopeType `json:"type"`
	ChatID int64               `json:"chat_id"`
	UserID int64               `json:"user_id"`
}

BotCommandScope is an optional parameter used in the SetMyCommands, DeleteMyCommands and GetMyCommands methods.

type BotCommandScopeType

type BotCommandScopeType string

BotCommandScopeType is a custom type for the various bot command scope types.

type BotDescription added in v3.24.0

type BotDescription struct {
	Description string `json:"description"`
}

BotDescription represents the bot's description.

type BotName added in v3.25.0

type BotName struct {
	Name string `json:"name"`
}

BotName represents the bot's name.

type BotShortDescription added in v3.24.0

type BotShortDescription struct {
	ShortDescription string `json:"short_description"`
}

BotShortDescription represents the bot's short description.

type BusinessConnection added in v3.30.0

type BusinessConnection struct {
	ID         string `json:"id"`
	User       User   `json:"user"`
	UserChatID int64  `json:"user_chat_id"`
	Date       int64  `json:"date"`
	CanReply   bool   `json:"can_reply"`
	IsEnabled  bool   `json:"is_enabled"`
}

BusinessConnection describes the connection of the bot with a business account.

type BusinessIntro added in v3.30.0

type BusinessIntro struct {
	Sticker *Sticker `json:"sticker,omitempty"`
	Title   string   `json:"title,omitempty"`
	Message string   `json:"message,omitempty"`
}

BusinessIntro

type BusinessLocation added in v3.30.0

type BusinessLocation struct {
	Location *Location `json:"location,omitempty"`
	Address  string    `json:"address"`
}

BusinessLocation

type BusinessMessagesDeleted added in v3.30.0

type BusinessMessagesDeleted struct {
	BusinessConnectionID string `json:"business_connection_id"`
	MessageIDs           []int  `json:"message_ids"`
	Chat                 Chat   `json:"chat"`
}

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

type BusinessOpeningHours added in v3.30.0

type BusinessOpeningHours struct {
	TimeZoneName string                         `json:"time_zone_name"`
	OpeningHours []BusinessOpeningHoursInterval `json:"opening_hours"`
}

BusinessOpeningHours

type BusinessOpeningHoursInterval added in v3.30.0

type BusinessOpeningHoursInterval struct {
	OpeningMinute int `json:"opening_minute"`
	ClosingMinute int `json:"closing_minute"`
}

BusinessOpeningHoursInterval

type CallbackGame

type CallbackGame struct{}

CallbackGame is a placeholder, currently holds no information.

type CallbackQuery

type CallbackQuery struct {
	ID              string   `json:"id"`
	From            *User    `json:"from"`
	Message         *Message `json:"message,omitempty"`
	InlineMessageID string   `json:"inline_message_id,omitempty"`
	ChatInstance    string   `json:"chat_instance,omitempty"`
	Data            string   `json:"data,omitempty"`
	GameShortName   string   `json:"game_short_name,omitempty"`
}

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

type CallbackQueryOptions

type CallbackQueryOptions struct {
	Text      string `query:"text"`
	URL       string `query:"url"`
	CacheTime int    `query:"cache_time"`
	ShowAlert bool   `query:"show_alert"`
}

CallbackQueryOptions contains the optional parameters used by the AnswerCallbackQuery method.

type Chat

type Chat struct {
	Permissions                        *ChatPermissions      `json:"permissions,omitempty"`
	Location                           *ChatLocation         `json:"location,omitempty"`
	PinnedMessage                      *Message              `json:"pinned_message,omitempty"`
	Photo                              *ChatPhoto            `json:"photo,omitempty"`
	ActiveUsernames                    *[]string             `json:"active_usernames,omitempty"`
	AvailableReactions                 *[]ReactionType       `json:"available_reactions,omitempty"`
	BusinessIntro                      *BusinessIntro        `json:"business_intro,omitempty"`
	BusinessLocation                   *BusinessLocation     `json:"business_location,omitempty"`
	BusinessOpeningHours               *BusinessOpeningHours `json:"business_opening_hours,omitempty"`
	PersonalChat                       *Chat                 `json:"personal_chat,omitempty"`
	Birthdate                          *Birthdate            `json:"birthdate,omitempty"`
	BackgroundCustomEmojiID            string                `json:"background_custom_emoji_id,omitempty"`
	ProfileBackgroundCustomEmojiID     string                `json:"profile_background_custom_emoji_id,omitempty"`
	Bio                                string                `json:"bio,omitempty"`
	Username                           string                `json:"username,omitempty"`
	Title                              string                `json:"title,omitempty"`
	StickerSetName                     string                `json:"sticker_set_name,omitempty"`
	Description                        string                `json:"description,omitempty"`
	FirstName                          string                `json:"first_name,omitempty"`
	LastName                           string                `json:"last_name,omitempty"`
	InviteLink                         string                `json:"invite_link,omitempty"`
	EmojiStatusCustomEmojiID           string                `json:"emoji_status_custom_emoji_id,omitempty"`
	Type                               string                `json:"type"`
	CustomEmojiStickerSetName          string                `json:"custom_emoji_sticker_set_name,omitempty"`
	AccentColorID                      int                   `json:"accent_color_id,omitempty"`
	ProfileAccentColorID               int                   `json:"profile_accent_color_id,omitempty"`
	EmojiStatusExpirationDate          int                   `json:"emoji_status_expiration_date,omitempty"`
	MessageAutoDeleteTime              int                   `json:"message_auto_delete_time,omitempty"`
	SlowModeDelay                      int                   `json:"slow_mode_delay,omitempty"`
	UnrestrictBoostCount               int                   `json:"unrestrict_boost_count,omitempty"`
	LinkedChatID                       int64                 `json:"linked_chat_id,omitempty"`
	ID                                 int64                 `json:"id"`
	IsForum                            bool                  `json:"is_forum,omitempty"`
	HasAggressiveAntiSpamEnabled       bool                  `json:"has_aggressive_anti_spam_enabled,omitempty"`
	HasHiddenMembers                   bool                  `json:"has_hidden_members,omitempty"`
	HasProtectedContent                bool                  `json:"has_protected_content,omitempty"`
	HasVisibleHistory                  bool                  `json:"has_visible_history,omitempty"`
	HasPrivateForwards                 bool                  `json:"has_private_forwards,omitempty"`
	CanSetStickerSet                   bool                  `json:"can_set_sticker_set,omitempty"`
	JoinToSendMessages                 bool                  `json:"join_to_send_messages,omitempty"`
	JoinByRequest                      bool                  `json:"join_by_request,omitempty"`
	HasRestrictedVoiceAndVideoMessages bool                  `json:"has_restricted_voice_and_video_messages,omitempty"`
}

Chat represents a chat.

type ChatAction

type ChatAction string

ChatAction is a custom type for the various actions that can be sent through the SendChatAction method.

type ChatActionOptions added in v3.22.0

type ChatActionOptions struct {
	BusinessConnectionID string `query:"business_connection_id"`
	MessageThreadID      int    `query:"message_thread_id"`
}

ChatActionOptions contains the optional parameters used by the SendChatAction API method.

type ChatAdministratorRights added in v3.18.0

type ChatAdministratorRights struct {
	IsAnonymous          bool `json:"is_anonymous"`
	CanManageChat        bool `json:"can_manage_chat"`
	CanDeleteMessages    bool `json:"can_delete_messages"`
	CanManageVideo_chats bool `json:"can_manage_video_chats"`
	CanRestrictMembers   bool `json:"can_restrict_members"`
	CanPromoteMembers    bool `json:"can_promote_members"`
	CanChangeInfo        bool `json:"can_change_info"`
	CanInviteUsers       bool `json:"can_invite_users"`
	CanPostMessages      bool `json:"can_post_messages,omitempty"`
	CanEditMessages      bool `json:"can_edit_messages,omitempty"`
	CanPinMessages       bool `json:"can_pin_messages,omitempty"`
	CanPostStories       bool `json:"can_post_stories,omitempty"`
	CanEditStories       bool `json:"can_edit_stories,omitempty"`
	CanDeleteStories     bool `json:"can_delete_stories,omitempty"`
	CanManageTopics      bool `json:"can_manage_topics,omitempty"`
}

ChatAdministratorRights represents the rights of an administrator in a chat.

type ChatBoost added in v3.28.0

type ChatBoost struct {
	BoostID        string          `json:"boost_id"`
	Source         ChatBoostSource `json:"source"`
	AddDate        int             `json:"add_date"`
	ExpirationDate int             `json:"expiration_date"`
}

ChatBoost contains information about a chat boost.

type ChatBoostAdded added in v3.29.0

type ChatBoostAdded struct {
	BoostCount int `json:"boost_count"`
}

ChatBoostAdded represents a service message about a user boosting a chat.

type ChatBoostRemoved added in v3.28.0

type ChatBoostRemoved struct {
	BoostID    string          `json:"boost_id"`
	Source     ChatBoostSource `json:"source"`
	Chat       Chat            `json:"chat"`
	RemoveDate int             `json:"remove_date"`
}

ChatBoostRemoved represents a boost removed from a chat.

type ChatBoostSource added in v3.28.0

type ChatBoostSource struct {
	User              *User               `json:"user,omitempty"`
	Source            ChatBoostSourceType `json:"source"`
	GiveawayMessageID int                 `json:"giveaway_message_id,omitempty"`
	IsUnclaimed       bool                `json:"is_unclaimed,omitempty"`
}

ChatBoostSource describes the source of a chat boost.

type ChatBoostSourceType added in v3.28.0

type ChatBoostSourceType string

ChatBoostSourceType is a custom type for the various chat boost sources.

type ChatBoostUpdated added in v3.28.0

type ChatBoostUpdated struct {
	Boost ChatBoost `json:"boost"`
	Chat  Chat      `json:"chat"`
}

ChatBoostUpdated represents a boost added to a chat or changed.

type ChatInviteLink struct {
	Creator                 *User  `json:"creator"`
	InviteLink              string `json:"invite_link"`
	Name                    string `json:"name,omitempty"`
	PendingJoinRequestCount int    `json:"pending_join_request_count,omitempty"`
	ExpireDate              int    `json:"expire_date,omitempty"`
	MemberLimit             int    `json:"member_limit,omitempty"`
	IsPrimary               bool   `json:"is_primary"`
	IsRevoked               bool   `json:"is_revoked"`
	CreatesJoinRequest      bool   `json:"creates_join_request"`
}

ChatInviteLink represents an invite link for a chat.

type ChatJoinRequest added in v3.12.0

type ChatJoinRequest struct {
	InviteLink *ChatInviteLink `json:"invite_link,omitempty"`
	Bio        string          `json:"bio,omitempty"`
	From       User            `json:"user"`
	Chat       Chat            `json:"chat"`
	Date       int             `json:"date"`
	UserChatID int64           `json:"user_chat_id"`
}

ChatJoinRequest represents a join request sent to a chat.

type ChatLocation

type ChatLocation struct {
	Location *Location `json:"location"`
	Address  string    `json:"address"`
}

ChatLocation represents a location to which a chat is connected.

type ChatMember

type ChatMember struct {
	User                  *User  `json:"user"`
	Status                string `json:"status"`
	CustomTitle           string `json:"custom_title,omitempty"`
	IsAnonymous           bool   `json:"is_anonymous,omitempty"`
	CanBeEdited           bool   `json:"can_be_edited,omitempty"`
	CanManageChat         bool   `json:"can_manage_chat,omitempty"`
	CanPostMessages       bool   `json:"can_post_messages,omitempty"`
	CanEditMessages       bool   `json:"can_edit_messages,omitempty"`
	CanDeleteMessages     bool   `json:"can_delete_messages,omitempty"`
	CanManageVideoChats   bool   `json:"can_manage_video_chats,omitempty"`
	CanRestrictMembers    bool   `json:"can_restrict_members,omitempty"`
	CanPromoteMembers     bool   `json:"can_promote_members,omitempty"`
	CanChangeInfo         bool   `json:"can_change_info,omitempty"`
	CanInviteUsers        bool   `json:"can_invite_users,omitempty"`
	CanPinMessages        bool   `json:"can_pin_messages,omitempty"`
	IsMember              bool   `json:"is_member,omitempty"`
	CanSendMessages       bool   `json:"can_send_messages,omitempty"`
	CanSendAudios         bool   `json:"can_send_audios,omitempty"`
	CanSendDocuments      bool   `json:"can_send_documents,omitempty"`
	CanSendPhotos         bool   `json:"can_send_photos,omitempty"`
	CanSendVideos         bool   `json:"can_send_videos,omitempty"`
	CanSendVideoNotes     bool   `json:"can_send_video_notes,omitempty"`
	CanSendVoiceNotes     bool   `json:"can_send_voice_notes,omitempty"`
	CanSendPolls          bool   `json:"can_send_polls,omitempty"`
	CanSendOtherMessages  bool   `json:"can_send_other_messages,omitempty"`
	CanAddWebPagePreviews bool   `json:"can_add_web_page_previews,omitempty"`
	CanManageTopics       bool   `json:"can_manage_topics,omitempty"`
	CanPostStories        bool   `json:"can_post_stories,omitempty"`
	CanEditStories        bool   `json:"can_edit_stories,omitempty"`
	CanDeleteStories      bool   `json:"can_delete_stories,omitempty"`
	UntilDate             int    `json:"until_date,omitempty"`
}

ChatMember contains information about one member of a chat.

type ChatMemberUpdated

type ChatMemberUpdated struct {
	InviteLink              *ChatInviteLink `json:"invite_link,omitempty"`
	From                    User            `json:"from"`
	OldChatMember           ChatMember      `json:"old_chat_member"`
	NewChatMember           ChatMember      `json:"new_chat_member"`
	Chat                    Chat            `json:"chat"`
	ViaChatFolderInviteLink bool            `json:"via_chat_folder_invite_link,omitempty"`
	Date                    int             `json:"date"`
}

ChatMemberUpdated represents changes in the status of a chat member.

type ChatPermissions

type ChatPermissions struct {
	CanSendMessages       bool `json:"can_send_messages,omitempty"`
	CanSendAudios         bool `json:"can_send_audios,omitempty"`
	CanSendDocuments      bool `json:"can_send_documents,omitempty"`
	CanSendPhotos         bool `json:"can_send_photos,omitempty"`
	CanSendVideos         bool `json:"can_send_videos,omitempty"`
	CanSendVideoNotes     bool `json:"can_send_video_notes,omitempty"`
	CanSendVoiceNotes     bool `json:"can_send_voice_notes,omitempty"`
	CanSendPolls          bool `json:"can_send_polls,omitempty"`
	CanSendOtherMessages  bool `json:"can_send_other_messages,omitempty"`
	CanAddWebPagePreviews bool `json:"can_add_web_page_previews,omitempty"`
	CanChangeInfo         bool `json:"can_change_info,omitempty"`
	CanInviteUsers        bool `json:"can_invite_users,omitempty"`
	CanPinMessages        bool `json:"can_pin_messages,omitempty"`
	CanManageTopics       bool `json:"can_manage_topics,omitempty"`
}

ChatPermissions describes actions that a non-administrator user is allowed to take in a chat.

type ChatPermissionsOptions added in v3.23.0

type ChatPermissionsOptions struct {
	UseIndependentChatPermissions bool `query:"use_independent_chat_permissions"`
}

ChatPermissionsOptions contains the optional parameters used by the SetChatPermissions method.

type ChatPhoto

type ChatPhoto struct {
	SmallFileID       string `json:"small_file_id"`
	SmallFileUniqueID string `json:"small_file_unique_id"`
	BigFileID         string `json:"big_file_id"`
	BigFileUniqueID   string `json:"big_file_unique_id"`
}

ChatPhoto represents a chat photo.

type ChatShared added in v3.23.0

type ChatShared struct {
	Photo     *[]PhotoSize `json:"photo,omitempty"`
	Title     string       `json:"title,omitempty"`
	Username  string       `json:"username,omitempty"`
	RequestID int          `json:"request_id"`
	ChatID    int64        `json:"chat_id"`
}

ChatShared contains information about the chat whose identifier was shared with the bot using a KeyboardButtonRequestChat button.

type ChosenInlineResult

type ChosenInlineResult struct {
	ResultID        string    `json:"result_id"`
	From            *User     `json:"from"`
	Location        *Location `json:"location,omitempty"`
	InlineMessageID string    `json:"inline_message_id,omitempty"`
	Query           string    `json:"query"`
}

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

type CommandOptions

type CommandOptions struct {
	LanguageCode string          `query:"language_code"`
	Scope        BotCommandScope `query:"scope"`
}

CommandOptions contains the optional parameters used by the SetMyCommands, DeleteMyCommands and GetMyCommands methods.

type Contact

type Contact struct {
	PhoneNumber string `json:"phone_number"`
	FirstName   string `json:"first_name"`
	LastName    string `json:"last_name,omitempty"`
	VCard       string `json:"vcard,omitempty"`
	UserID      int    `json:"user_id,omitempty"`
}

Contact represents a phone contact.

type ContactOptions

type ContactOptions struct {
	ReplyMarkup          ReplyMarkup     `query:"reply_markup"`
	BusinessConnectionID string          `query:"business_connection_id"`
	VCard                string          `query:"vcard"`
	LastName             string          `query:"last_name"`
	ReplyParameters      ReplyParameters `query:"reply_parameters"`
	MessageThreadID      int             `query:"message_thread_id"`
	DisableNotification  bool            `query:"disable_notification"`
	ProtectContent       bool            `query:"protect_content"`
}

ContactOptions contains the optional parameters used by the SendContact method.

type CopyMessagesOptions added in v3.28.0

type CopyMessagesOptions struct {
	MessageThreadID     int  `query:"message_thread_id"`
	DisableNotification bool `query:"disable_notification"`
	ProtectContent      bool `query:"protect_content"`
	RemoveCaption       bool `query:"remove_caption"`
}

CopyMessagesOptions contains the optional parameters used by the CopyMessages methods.

type CopyOptions added in v3.2.0

type CopyOptions struct {
	ReplyMarkup         ReplyMarkup     `query:"reply_markup"`
	ParseMode           ParseMode       `query:"parse_mode"`
	Caption             string          `query:"caption"`
	CaptionEntities     []MessageEntity `query:"caption_entities"`
	ReplyParameters     ReplyParameters `query:"reply_parameters"`
	MessageThreadID     int             `query:"message_thread_id"`
	DisableNotification bool            `query:"disable_notification"`
	ProtectContent      bool            `query:"protect_content"`
}

CopyOptions contains the optional parameters used by the CopyMessage method.

type CreateInvoiceLinkOptions added in v3.19.0

type CreateInvoiceLinkOptions struct {
	ProviderData              string `query:"provider_data"`
	PhotoURL                  string `query:"photo_url"`
	SuggestedTipAmounts       []int  `query:"suggested_tip_amounts"`
	PhotoSize                 int    `query:"photo_size"`
	PhotoWidth                int    `query:"photo_width"`
	PhotoHeight               int    `query:"photo_height"`
	MaxTipAmount              int    `query:"max_tip_amount"`
	NeedPhoneNumber           bool   `query:"need_phone_number"`
	NeepShippingAddress       bool   `query:"need_shipping_address"`
	SendPhoneNumberToProvider bool   `query:"send_phone_number_to_provider"`
	SendEmailToProvider       bool   `query:"send_email_to_provider"`
	IsFlexible                bool   `query:"is_flexible"`
	NeedName                  bool   `query:"need_name"`
	NeedEmail                 bool   `query:"need_email"`
}

CreateInvoiceLinkOptions contains the optional parameters used by the CreateInvoiceLink API method.

type CreateTopicOptions added in v3.21.0

type CreateTopicOptions struct {
	IconCustomEmojiID string    `query:"icon_custom_emoji_id"`
	IconColor         IconColor `query:"icon_color"`
}

CreateTopicOptions contains the optional parameters used by the CreateForumTopic API method.

type Dice

type Dice struct {
	Emoji string `json:"emoji"`
	Value int    `json:"value"`
}

Dice represents an animated emoji that displays a random value.

type DiceEmoji added in v3.2.0

type DiceEmoji string

DiceEmoji is a custom type for the various emojis that can be sent through the SendDice method.

type Dispatcher

type Dispatcher struct {
	// contains filtered or unexported fields
}

The Dispatcher passes the updates from the Telegram Bot API to the Bot instance associated with each chatID. When a new chat ID is found, the provided function of type NewBotFn will be called.

func NewDispatcher

func NewDispatcher(token string, newBotFn NewBotFn) *Dispatcher

NewDispatcher returns a new instance of the Dispatcher object. Calls the Update function of the bot associated with each chat ID. If a new chat ID is found, newBotFn will be called first.

func (*Dispatcher) AddSession

func (d *Dispatcher) AddSession(chatID int64)

AddSession allows to arbitrarily create a new Bot instance.

func (*Dispatcher) DelSession

func (d *Dispatcher) DelSession(chatID int64)

DelSession deletes the Bot instance, seen as a session, from the map with all of them.

func (*Dispatcher) HandleWebhook added in v3.14.1

func (d *Dispatcher) HandleWebhook(w http.ResponseWriter, r *http.Request)

HandleWebhook is the http.HandlerFunc for the webhook URL. Useful if you've already a http server running and want to handle the request yourself.

func (*Dispatcher) ListenWebhook

func (d *Dispatcher) ListenWebhook(webhookURL string) error

ListenWebhook is a wrapper function for ListenWebhookOptions.

func (*Dispatcher) ListenWebhookOptions

func (d *Dispatcher) ListenWebhookOptions(webhookURL string, dropPendingUpdates bool, opts *WebhookOptions) error

ListenWebhookOptions sets a webhook and listens for incoming updates. The webhookUrl should be provided in the following format: '<hostname>:<port>/<path>', eg: 'https://example.com:443/bot_token'. ListenWebhook will then proceed to communicate the webhook url '<hostname>/<path>' to Telegram and run a webserver that listens to ':<port>' and handles the path.

func (*Dispatcher) Poll

func (d *Dispatcher) Poll() error

Poll is a wrapper function for PollOptions.

func (*Dispatcher) PollOptions

func (d *Dispatcher) PollOptions(dropPendingUpdates bool, opts UpdateOptions) error

PollOptions starts the polling loop so that the dispatcher calls the function Update upon receiving any update from Telegram.

func (*Dispatcher) SetHTTPServer added in v3.16.0

func (d *Dispatcher) SetHTTPServer(s *http.Server)

SetHTTPServer allows to set a custom http.Server for ListenWebhook and ListenWebhookOptions.

type Document

type Document struct {
	FileID       string     `json:"file_id"`
	FileUniqueID string     `json:"file_unique_id"`
	Thumbnail    *PhotoSize `json:"thumbnail,omitempty"`
	FileName     string     `json:"file_name,omitempty"`
	MimeType     string     `json:"mime_type,omitempty"`
	FileSize     int64      `json:"file_size,omitempty"`
}

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

type DocumentOptions

type DocumentOptions struct {
	ReplyMarkup                 ReplyMarkup `query:"reply_markup"`
	BusinessConnectionID        string      `query:"business_connection_id"`
	ParseMode                   ParseMode   `query:"parse_mode"`
	Caption                     string      `query:"caption"`
	Thumbnail                   InputFile
	CaptionEntities             []MessageEntity `query:"caption_entities"`
	ReplyParameters             ReplyParameters `query:"reply_parameters"`
	MessageThreadID             int             `query:"message_thread_id"`
	DisableNotification         bool            `query:"disable_notification"`
	ProtectContent              bool            `query:"protect_content"`
	DisableContentTypeDetection bool            `query:"disable_content_type_detection"`
}

DocumentOptions contains the optional parameters used by the SendDocument method.

type EditLocationOptions added in v3.5.0

type EditLocationOptions struct {
	ReplyMarkup          InlineKeyboardMarkup `query:"reply_markup"`
	HorizontalAccuracy   float64              `query:"horizontal_accuracy"`
	Heading              int                  `query:"heading"`
	ProximityAlertRadius int                  `query:"proximity_alert_radius"`
}

EditLocationOptions contains the optional parameters used by the EditMessageLiveLocation method.

type EditTopicOptions added in v3.22.0

type EditTopicOptions struct {
	Name              string `query:"name"`
	IconCustomEmojiID string `query:"icon_custom_emoji_id"`
}

EditTopicOptions contains the optional parameters used by the EditForumTopic API method.

type EncryptedCredentials added in v3.15.0

type EncryptedCredentials struct {
	Data   string `json:"data"`
	Hash   string `json:"hash"`
	Secret string `json:"secret"`
}

EncryptedCredentials contains data required for decrypting and authenticating EncryptedPassportElement. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes. https://core.telegram.org/passport#receiving-information

type EncryptedPassportElement added in v3.15.0

type EncryptedPassportElement struct {
	Type        EncryptedPassportElementType `json:"type"`
	Data        string                       `json:"data,omitempty"`
	PhoneNumber string                       `json:"phone_number,omitempty"`
	Email       string                       `json:"email,omitempty"`
	Files       *[]PassportFile              `json:"files,omitempty"`
	FrontSide   *PassportFile                `json:"front_side,omitempty"`
	ReverseSide *PassportFile                `json:"reverse_side,omitempty"`
	Selfie      *PassportFile                `json:"selfie,omitempty"`
	Translation *[]PassportFile              `json:"translation,omitempty"`
	Hash        string                       `json:"hash"`
}

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

type EncryptedPassportElementType added in v3.15.0

type EncryptedPassportElementType string

EncryptedPassportElementType is a custom type for the various possible options used as Type in EncryptedPassportElement.

type ExternalReplyInfo added in v3.28.0

type ExternalReplyInfo struct {
	Origin             MessageOrigin      `json:"origin"`
	GiveawayWinners    GiveawayWinners    `json:"giveaway_winners,omitempty"`
	Venue              Venue              `json:"venue,omitempty"`
	Giveaway           Giveaway           `json:"giveaway,omitempty"`
	Document           Document           `json:"document,omitempty"`
	Contact            Contact            `json:"contact,omitempty"`
	Invoice            Invoice            `json:"invoice,omitempty"`
	LinkPreviewOptions LinkPreviewOptions `json:"link_preview_options,omitempty"`
	Photo              []PhotoSize        `json:"photo,omitempty"`
	Dice               Dice               `json:"dice,omitempty"`
	Audio              Audio              `json:"audio,omitempty"`
	Voice              Voice              `json:"voice,omitempty"`
	VideoNote          VideoNote          `json:"video_note,omitempty"`
	Game               Game               `json:"game,omitempty"`
	Video              Video              `json:"video,omitempty"`
	Animation          Animation          `json:"animation,omitempty"`
	Sticker            Sticker            `json:"sticker,omitempty"`
	Poll               Poll               `json:"poll,omitempty"`
	Chat               Chat               `json:"chat,omitempty"`
	Story              Story              `json:"story,omitempty"`
	Location           Location           `json:"location,omitempty"`
	MessageID          int                `json:"message_id,omitempty"`
	HasMediaSpoiler    bool               `json:"has_media_spoiler,omitempty"`
}

ExternalReplyInfo contains information about a message that is being replied to, which may come from another chat or forum topic.

type File

type File struct {
	FileID       string `json:"file_id"`
	FileUniqueID string `json:"file_unique_id"`
	FilePath     string `json:"file_path,omitempty"`
	FileSize     int64  `json:"file_size,omitempty"`
}

File represents a file ready to be downloaded.

type ForceReply

type ForceReply struct {
	InputFieldPlaceholder string `json:"input_field_placeholder,omitempty"`
	ForceReply            bool   `json:"force_reply"`
	Selective             bool   `json:"selective"`
}

ForceReply is used to 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.

func (ForceReply) ImplementsReplyMarkup

func (f ForceReply) ImplementsReplyMarkup()

ImplementsReplyMarkup is a dummy method which exists to implement the interface ReplyMarkup.

type ForumTopic added in v3.21.0

type ForumTopic struct {
	Name              string    `json:"name"`
	IconCustomEmojiID string    `json:"icon_custom_emoji_id"`
	IconColor         IconColor `json:"icon_color"`
	MessageThreadID   int64     `json:"message_thread_id"`
}

ForumTopic represents a forum topic.

type ForumTopicClosed added in v3.21.0

type ForumTopicClosed struct{}

ForumTopicClosed represents a service message about a forum topic closed in the chat.

type ForumTopicCreated added in v3.21.0

type ForumTopicCreated struct {
	Name              string `json:"name"`
	IconCustomEmojiID string `json:"icon_custom_emoji_id"`
	IconColor         int    `json:"icon_color"`
}

ForumTopicCreated represents a service message about a new forum topic created in the chat.

type ForumTopicEdited added in v3.22.0

type ForumTopicEdited struct {
	Name              string `json:"name"`
	IconCustomEmojiID string `json:"icon_custom_emoji_id"`
}

ForumTopicEdited represents a service message about an edited forum topic.

type ForumTopicReopened added in v3.21.0

type ForumTopicReopened struct{}

ForumTopicReopened represents a service message about a forum topic reopened in the chat.

type ForwardOptions added in v3.2.0

type ForwardOptions struct {
	MessageThreadID     int  `query:"message_thread_id"`
	DisableNotification bool `query:"disable_notification"`
	ProtectContent      bool `query:"protect_content"`
}

ForwardOptions contains the optional parameters used by the ForwardMessage method.

type Game

type Game struct {
	Title        string          `json:"title"`
	Description  string          `json:"description"`
	Photo        []PhotoSize     `json:"photo"`
	Text         string          `json:"text,omitempty"`
	TextEntities []MessageEntity `json:"text_entities,omitempty"`
	Animation    Animation       `json:"animation,omitempty"`
}

Game represents a game.

type GameHighScore

type GameHighScore struct {
	User     User `json:"user"`
	Position int  `json:"position"`
	Score    int  `json:"score"`
}

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

type GameScoreOptions

type GameScoreOptions struct {
	Force              bool `query:"force"`
	DisableEditMessage bool `query:"disable_edit_message"`
}

GameScoreOptions contains the optional parameters used in SetGameScore method.

type GeneralForumTopicHidden added in v3.22.0

type GeneralForumTopicHidden struct{}

GeneralForumTopicHidden represents a service message about General forum topic hidden in the chat.

type GeneralForumTopicUnhidden added in v3.22.0

type GeneralForumTopicUnhidden struct{}

GeneralForumTopicUnhidden represents a service message about General forum topic unhidden in the chat.

type GetChatMenuButtonOptions added in v3.18.0

type GetChatMenuButtonOptions struct {
	ChatID int64 `query:"chat_id"`
}

GetChatMenuButtonOptions contains the optional parameters used by the GetChatMenuButton method.

type GetMyDefaultAdministratorRightsOptions added in v3.18.0

type GetMyDefaultAdministratorRightsOptions struct {
	ForChannels bool `query:"for_channels"`
}

GetMyDefaultAdministratorRightsOptions contains the optional parameters used by the GetMyDefaultAdministratorRights method.

type Giveaway added in v3.28.0

type Giveaway struct {
	CountryCodes                  *[]string `json:"country_codes,omitempty"`
	PrizeDescription              string    `json:"prize_description,omitempty"`
	Chats                         []Chat    `json:"chats"`
	WinnersSelectionDate          int       `json:"winners_selection_date"`
	WinnerCount                   int       `json:"winner_count"`
	PremiumSubscriptionMonthCount int       `json:"premium_subscription_month_count,omitempty"`
	OnlyNewMembers                bool      `json:"only_new_members,omitempty"`
	HasPublicWinners              bool      `json:"has_public_winners,omitempty"`
}

Giveaway represents a message about a scheduled giveaway.

type GiveawayCompleted added in v3.28.0

type GiveawayCompleted struct {
	GiveawayMessage     *Message `json:"giveaway_message,omitempty"`
	WinnerCount         int      `json:"winner_count"`
	UnclaimedPrizeCount int      `json:"unclaimed_prize_count,omitempty"`
}

GiveawayCompleted represents a service message about the completion of a giveaway without public winners.

type GiveawayCreated added in v3.28.0

type GiveawayCreated struct{}

GiveawayCreated represents a service message about the creation of a scheduled giveaway. Currently holds no information.

type GiveawayWinners added in v3.28.0

type GiveawayWinners struct {
	PrizeDescription              string `json:"prize_description,omitempty"`
	Chats                         []Chat `json:"chats"`
	Winners                       []User `json:"winners"`
	GiveawayMessageID             int    `json:"giveaway_message_id"`
	WinnersSelectionDate          int    `json:"winners_selection_date"`
	WinnerCount                   int    `json:"winner_count"`
	AdditionalChatCount           int    `json:"additional_chat_count,omitempty"`
	PremiumSubscriptionMonthCount int    `json:"premium_subscription_month_count,omitempty"`
	UnclaimedPrizeCount           int    `json:"unclaimed_prize_count,omitempty"`
	OnlyNewMembers                bool   `json:"only_new_members,omitempty"`
	WasRefunded                   bool   `json:"was_refunded,omitempty"`
}

GiveawayWinners represents a message about the completion of a giveaway with public winners.

type GroupableInputMedia added in v3.11.0

type GroupableInputMedia interface {
	InputMedia
	// contains filtered or unexported methods
}

GroupableInputMedia is an interface for the various groupable media types.

type IconColor added in v3.21.0

type IconColor int

IconColor represents a forum topic icon in RGB format.

type InlineKeyboardButton

type InlineKeyboardButton struct {
	CallbackGame                 *CallbackGame                `json:"callback_game,omitempty"`
	WebApp                       *WebAppInfo                  `json:"web_app,omitempty"`
	LoginURL                     *LoginURL                    `json:"login_url,omitempty"`
	SwitchInlineQueryChosenChat  *SwitchInlineQueryChosenChat `json:"switch_inline_query_chosen_chat,omitempty"`
	Text                         string                       `json:"text"`
	CallbackData                 string                       `json:"callback_data,omitempty"`
	SwitchInlineQuery            string                       `json:"switch_inline_query,omitempty"`
	SwitchInlineQueryCurrentChat string                       `json:"switch_inline_query_current_chat,omitempty"`
	URL                          string                       `json:"url,omitempty"`
	Pay                          bool                         `json:"pay,omitempty"`
}

InlineKeyboardButton represents a button in an inline keyboard.

type InlineKeyboardMarkup

type InlineKeyboardMarkup struct {
	InlineKeyboard [][]InlineKeyboardButton `json:"inline_keyboard" query:"inline_keyboard"`
}

InlineKeyboardMarkup represents an inline keyboard.

func (InlineKeyboardMarkup) ImplementsReplyMarkup

func (i InlineKeyboardMarkup) ImplementsReplyMarkup()

ImplementsReplyMarkup is a dummy method which exists to implement the interface ReplyMarkup.

type InlineQuery

type InlineQuery struct {
	From     *User     `json:"from"`
	Location *Location `json:"location,omitempty"`
	ID       string    `json:"id"`
	Query    string    `json:"query"`
	Offset   string    `json:"offset"`
	ChatType string    `json:"chat_type,omitempty"`
}

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

type InlineQueryOptions

type InlineQueryOptions struct {
	Button     InlineQueryResultsButton `query:"button"`
	NextOffset string                   `query:"next_offset"`
	CacheTime  int                      `query:"cache_time"`
	IsPersonal bool                     `query:"is_personal"`
}

InlineQueryOptions is a custom type which contains the various options required by the AnswerInlineQuery method.

type InlineQueryResult

type InlineQueryResult interface {
	ImplementsInlineQueryResult()
}

InlineQueryResult represents an interface that implements all the various InlineQueryResult* types.

type InlineQueryResultArticle

type InlineQueryResultArticle struct {
	ReplyMarkup         ReplyMarkup         `json:"reply_markup,omitempty"`
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
	Type                InlineQueryType     `json:"type"`
	ID                  string              `json:"id"`
	Title               string              `json:"title"`
	Description         string              `json:"description,omitempty"`
	ThumbnailURL        string              `json:"thumbnail_url,omitempty"`
	URL                 string              `json:"url,omitempty"`
	ThumbnailWidth      int                 `json:"thumbnail_width,omitempty"`
	ThumbnailHeight     int                 `json:"thumbnail_height,omitempty"`
	HideURL             bool                `json:"hide_url,omitempty"`
}

InlineQueryResultArticle represents a link to an article or web page.

func (InlineQueryResultArticle) ImplementsInlineQueryResult

func (i InlineQueryResultArticle) ImplementsInlineQueryResult()

ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.

type InlineQueryResultAudio

type InlineQueryResultAudio struct {
	ReplyMarkup         ReplyMarkup         `json:"reply_markup,omitempty"`
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
	Type                InlineQueryType     `json:"type"`
	ID                  string              `json:"id"`
	AudioURL            string              `json:"audio_url"`
	ParseMode           string              `json:"parse_mode,omitempty"`
	Performer           string              `json:"performer,omitempty"`
	Title               string              `json:"title"`
	Caption             string              `json:"caption,omitempty"`
	CaptionEntities     []*MessageEntity    `json:"caption_entities,omitempty"`
	AudioDuration       int                 `json:"audio_duration,omitempty"`
}

InlineQueryResultAudio represents a link to an MP3 audio file. By default, this audio file will be sent by the user. Alternatively, you can use InputMessageContent to send a message with the specified content instead of the audio.

func (InlineQueryResultAudio) ImplementsInlineQueryResult

func (i InlineQueryResultAudio) ImplementsInlineQueryResult()

ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.

type InlineQueryResultCachedAudio

type InlineQueryResultCachedAudio struct {
	ReplyMarkup         ReplyMarkup         `json:"reply_markup,omitempty"`
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
	AudioFileID         string              `json:"audio_file_id"`
	Caption             string              `json:"caption,omitempty"`
	ParseMode           string              `json:"parse_mode,omitempty"`
	Type                InlineQueryType     `json:"type"`
	ID                  string              `json:"id"`
	CaptionEntities     []*MessageEntity    `json:"caption_entities,omitempty"`
}

InlineQueryResultCachedAudio represents a link to an MP3 audio file stored on the Telegram servers. By default, this audio file will be sent by the user. Alternatively, you can use InputMessageContent to send a message with the specified content instead of the audio.

func (InlineQueryResultCachedAudio) ImplementsInlineQueryResult

func (i InlineQueryResultCachedAudio) ImplementsInlineQueryResult()

ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.

type InlineQueryResultCachedDocument

type InlineQueryResultCachedDocument struct {
	ReplyMarkup         ReplyMarkup         `json:"reply_markup,omitempty"`
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
	Type                InlineQueryType     `json:"type"`
	ID                  string              `json:"id"`
	Description         string              `json:"description,omitempty"`
	Caption             string              `json:"caption,omitempty"`
	ParseMode           string              `json:"parse_mode,omitempty"`
	Title               string              `json:"title"`
	DocumentFileID      string              `json:"document_file_id"`
	CaptionEntities     []*MessageEntity    `json:"caption_entities,omitempty"`
}

InlineQueryResultCachedDocument represents a link to a file stored on the Telegram servers. By default, this file will be sent by the user with an optional caption. Alternatively, you can use InputMessageContent to send a message with the specified content instead of the file.

func (InlineQueryResultCachedDocument) ImplementsInlineQueryResult

func (i InlineQueryResultCachedDocument) ImplementsInlineQueryResult()

ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.

type InlineQueryResultCachedGif

type InlineQueryResultCachedGif struct {
	ReplyMarkup         ReplyMarkup         `json:"reply_markup,omitempty"`
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
	Type                InlineQueryType     `json:"type"`
	Title               string              `json:"title,omitempty"`
	Caption             string              `json:"caption,omitempty"`
	ParseMode           string              `json:"parse_mode,omitempty"`
	ID                  string              `json:"id"`
	GifFileID           string              `json:"gif_file_id"`
	CaptionEntities     []*MessageEntity    `json:"caption_entities,omitempty"`
}

InlineQueryResultCachedGif represents a link to an animated GIF file stored on the Telegram servers. By default, this animated GIF file will be sent by the user with an optional caption. Alternatively, you can use InputMessageContent to send a message with specified content instead of the animation.

func (InlineQueryResultCachedGif) ImplementsInlineQueryResult

func (i InlineQueryResultCachedGif) ImplementsInlineQueryResult()

ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.

type InlineQueryResultCachedMpeg4Gif

type InlineQueryResultCachedMpeg4Gif struct {
	ReplyMarkup         ReplyMarkup         `json:"reply_markup,omitempty"`
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
	Type                InlineQueryType     `json:"type"`
	Title               string              `json:"title,omitempty"`
	Caption             string              `json:"caption,omitempty"`
	ParseMode           string              `json:"parse_mode,omitempty"`
	ID                  string              `json:"id"`
	Mpeg4FileID         string              `json:"mpeg4_file_id"`
	CaptionEntities     []*MessageEntity    `json:"caption_entities,omitempty"`
}

InlineQueryResultCachedMpeg4Gif represents a link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the Telegram servers. By default, this animated MPEG-4 file will be sent by the user with an optional caption. Alternatively, you can use InputMessageContent to send a message with the specified content instead of the animation.

func (InlineQueryResultCachedMpeg4Gif) ImplementsInlineQueryResult

func (i InlineQueryResultCachedMpeg4Gif) ImplementsInlineQueryResult()

ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.

type InlineQueryResultCachedPhoto

type InlineQueryResultCachedPhoto struct {
	ReplyMarkup         ReplyMarkup         `json:"reply_markup,omitempty"`
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
	Type                InlineQueryType     `json:"type"`
	ID                  string              `json:"id"`
	Description         string              `json:"description,omitempty"`
	Caption             string              `json:"caption,omitempty"`
	ParseMode           string              `json:"parse_mode,omitempty"`
	PhotoFileID         string              `json:"photo_file_id"`
	Title               string              `json:"title,omitempty"`
	CaptionEntities     []*MessageEntity    `json:"caption_entities,omitempty"`
}

InlineQueryResultCachedPhoto represents a link to a photo stored on the Telegram servers. By default, this photo will be sent by the user with an optional caption. Alternatively, you can use InputMessageContent to send a message with the specified content instead of the photo.

func (InlineQueryResultCachedPhoto) ImplementsInlineQueryResult

func (i InlineQueryResultCachedPhoto) ImplementsInlineQueryResult()

ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.

type InlineQueryResultCachedSticker

type InlineQueryResultCachedSticker struct {
	ReplyMarkup         ReplyMarkup         `json:"reply_markup,omitempty"`
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
	Type                InlineQueryType     `json:"type"`
	ID                  string              `json:"id"`
	StickerFileID       string              `json:"sticker_file_id"`
}

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 InputMessageContent to send a message with the specified content instead of the sticker.

func (InlineQueryResultCachedSticker) ImplementsInlineQueryResult

func (i InlineQueryResultCachedSticker) ImplementsInlineQueryResult()

ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.

type InlineQueryResultCachedVideo

type InlineQueryResultCachedVideo struct {
	ReplyMarkup         ReplyMarkup         `json:"reply_markup,omitempty"`
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
	Type                InlineQueryType     `json:"type"`
	ID                  string              `json:"id"`
	Description         string              `json:"description,omitempty"`
	Caption             string              `json:"caption,omitempty"`
	ParseMode           string              `json:"parse_mode,omitempty"`
	VideoFileID         string              `json:"video_file_id"`
	Title               string              `json:"title"`
	CaptionEntities     []*MessageEntity    `json:"caption_entities,omitempty"`
}

InlineQueryResultCachedVideo represents a link to a video file stored on the Telegram servers. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use InputMessageContent to send a message with the specified content instead of the video.

func (InlineQueryResultCachedVideo) ImplementsInlineQueryResult

func (i InlineQueryResultCachedVideo) ImplementsInlineQueryResult()

ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.

type InlineQueryResultCachedVoice

type InlineQueryResultCachedVoice struct {
	ReplyMarkup         ReplyMarkup         `json:"reply_markup,omitempty"`
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
	Type                InlineQueryType     `json:"type"`
	Title               string              `json:"title"`
	Caption             string              `json:"caption,omitempty"`
	ParseMode           string              `json:"parse_mode,omitempty"`
	ID                  string              `json:"id"`
	VoiceFileID         string              `json:"voice_file_id"`
	CaptionEntities     []*MessageEntity    `json:"caption_entities,omitempty"`
}

InlineQueryResultCachedVoice represents a link to a voice message stored on the Telegram servers. By default, this voice message will be sent by the user. Alternatively, you can use InputMessageContent to send a message with the specified content instead of the voice message.

func (InlineQueryResultCachedVoice) ImplementsInlineQueryResult

func (i InlineQueryResultCachedVoice) ImplementsInlineQueryResult()

ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.

type InlineQueryResultContact

type InlineQueryResultContact struct {
	ReplyMarkup         ReplyMarkup         `json:"reply_markup,omitempty"`
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
	ID                  string              `json:"id"`
	PhoneNumber         string              `json:"phone_number"`
	FirstName           string              `json:"first_name"`
	VCard               string              `json:"vcard,omitempty"`
	Type                InlineQueryType     `json:"type"`
	ThumbnailURL        string              `json:"thumbnail_url,omitempty"`
	LastName            string              `json:"last_name,omitempty"`
	ThumbnailWidth      int                 `json:"thumbnail_width,omitempty"`
	ThumbnailHeight     int                 `json:"thumbnail_height,omitempty"`
}

InlineQueryResultContact represents a contact with a phone number. By default, this contact will be sent by the user. Alternatively, you can use InputMessageContent to send a message with the specified content instead of the contact.

func (InlineQueryResultContact) ImplementsInlineQueryResult

func (i InlineQueryResultContact) ImplementsInlineQueryResult()

ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.

type InlineQueryResultDocument

type InlineQueryResultDocument struct {
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
	ReplyMarkup         ReplyMarkup         `json:"reply_markup,omitempty"`
	MimeType            string              `json:"mime_type"`
	Caption             string              `json:"caption,omitempty"`
	ParseMode           string              `json:"parse_mode,omitempty"`
	ThumbnailURL        string              `json:"thumbnail_url,omitempty"`
	DocumentURL         string              `json:"document_url"`
	Title               string              `json:"title"`
	Description         string              `json:"description,omitempty"`
	ID                  string              `json:"id"`
	Type                InlineQueryType     `json:"type"`
	CaptionEntities     []*MessageEntity    `json:"caption_entities,omitempty"`
	ThumbnailWidth      int                 `json:"thumbnail_width,omitempty"`
	ThumbnailHeight     int                 `json:"thumbnail_height,omitempty"`
}

InlineQueryResultDocument represents a link to a file. By default, this file will be sent by the user with an optional caption. Alternatively, you can use InputMessageContent 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) ImplementsInlineQueryResult

func (i InlineQueryResultDocument) ImplementsInlineQueryResult()

ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.

type InlineQueryResultGame

type InlineQueryResultGame struct {
	ReplyMarkup   ReplyMarkup     `json:"reply_markup,omitempty"`
	Type          InlineQueryType `json:"type"`
	ID            string          `json:"id"`
	GameShortName string          `json:"game_short_name"`
}

InlineQueryResultGame represents a Game.

func (InlineQueryResultGame) ImplementsInlineQueryResult

func (i InlineQueryResultGame) ImplementsInlineQueryResult()

ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.

type InlineQueryResultGif

type InlineQueryResultGif struct {
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
	ReplyMarkup         ReplyMarkup         `json:"reply_markup,omitempty"`
	Title               string              `json:"title,omitempty"`
	GifURL              string              `json:"gif_url"`
	ParseMode           string              `json:"parse_mode,omitempty"`
	Caption             string              `json:"caption,omitempty"`
	ThumbnailURL        string              `json:"thumbnail_url"`
	ID                  string              `json:"id"`
	ThumbnailMimeType   string              `json:"thumbnail_mime_type,omitempty"`
	Type                InlineQueryType     `json:"type"`
	CaptionEntities     []*MessageEntity    `json:"caption_entities,omitempty"`
	GifDuration         int                 `json:"gif_duration,omitempty"`
	GifHeight           int                 `json:"gif_height,omitempty"`
	GifWidth            int                 `json:"gif_width,omitempty"`
}

InlineQueryResultGif represents a link to an animated GIF file. By default, this animated GIF file will be sent by the user with optional caption. Alternatively, you can use InputMessageContent to send a message with the specified content instead of the animation.

func (InlineQueryResultGif) ImplementsInlineQueryResult

func (i InlineQueryResultGif) ImplementsInlineQueryResult()

ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.

type InlineQueryResultLocation

type InlineQueryResultLocation struct {
	InputMessageContent  InputMessageContent `json:"input_message_content,omitempty"`
	ReplyMarkup          ReplyMarkup         `json:"reply_markup,omitempty"`
	ID                   string              `json:"id"`
	ThumbnailURL         string              `json:"thumbnail_url,omitempty"`
	Title                string              `json:"title"`
	Type                 InlineQueryType     `json:"type"`
	LivePeriod           int                 `json:"live_period,omitempty"`
	HorizontalAccuracy   float64             `json:"horizontal_accuracy,omitempty"`
	ProximityAlertRadius int                 `json:"proximity_alert_radius,omitempty"`
	Longitude            float64             `json:"longitude"`
	Latitude             float64             `json:"latitude"`
	ThumbnailWidth       int                 `json:"thumbnail_width,omitempty"`
	ThumbnailHeight      int                 `json:"thumbnail_height,omitempty"`
	Heading              int                 `json:"heading,omitempty"`
}

InlineQueryResultLocation represents a location on a map. By default, the location will be sent by the user. Alternatively, you can use InputMessageContent to send a message with the specified content instead of the location.

func (InlineQueryResultLocation) ImplementsInlineQueryResult

func (i InlineQueryResultLocation) ImplementsInlineQueryResult()

ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.

type InlineQueryResultMpeg4Gif

type InlineQueryResultMpeg4Gif struct {
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
	ReplyMarkup         ReplyMarkup         `json:"reply_markup,omitempty"`
	Title               string              `json:"title,omitempty"`
	Mpeg4URL            string              `json:"mpeg4_url"`
	ParseMode           string              `json:"parse_mode,omitempty"`
	Caption             string              `json:"caption,omitempty"`
	ThumbnailURL        string              `json:"thumbnail_url"`
	ID                  string              `json:"id"`
	ThumbnailMimeType   string              `json:"thumbnail_mime_type,omitempty"`
	Type                InlineQueryType     `json:"type"`
	CaptionEntities     []*MessageEntity    `json:"caption_entities,omitempty"`
	Mpeg4Duration       int                 `json:"mpeg4_duration,omitempty"`
	Mpeg4Height         int                 `json:"mpeg4_height,omitempty"`
	Mpeg4Width          int                 `json:"mpeg4_width,omitempty"`
}

InlineQueryResultMpeg4Gif represents a link to a video animation (H.264/MPEG-4 AVC video without sound). By default, this animated MPEG-4 file will be sent by the user with optional caption. Alternatively, you can use InputMessageContent to send a message with the specified content instead of the animation.

func (InlineQueryResultMpeg4Gif) ImplementsInlineQueryResult

func (i InlineQueryResultMpeg4Gif) ImplementsInlineQueryResult()

ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.

type InlineQueryResultPhoto

type InlineQueryResultPhoto struct {
	ReplyMarkup         ReplyMarkup         `json:"reply_markup,omitempty"`
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
	Title               string              `json:"title,omitempty"`
	ThumbnailURL        string              `json:"thumbnail_url"`
	PhotoURL            string              `json:"photo_url"`
	ParseMode           string              `json:"parse_mode,omitempty"`
	ID                  string              `json:"id"`
	Description         string              `json:"description,omitempty"`
	Caption             string              `json:"caption,omitempty"`
	Type                InlineQueryType     `json:"type"`
	CaptionEntities     []*MessageEntity    `json:"caption_entities,omitempty"`
	PhotoHeight         int                 `json:"photo_height,omitempty"`
	PhotoWidth          int                 `json:"photo_width,omitempty"`
}

InlineQueryResultPhoto represents a link to a photo. By default, this photo will be sent by the user with optional caption. Alternatively, you can use InputMessageContent to send a message with the specified content instead of the photo.

func (InlineQueryResultPhoto) ImplementsInlineQueryResult

func (i InlineQueryResultPhoto) ImplementsInlineQueryResult()

ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.

type InlineQueryResultVenue

type InlineQueryResultVenue struct {
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
	ReplyMarkup         ReplyMarkup         `json:"reply_markup,omitempty"`
	GooglePlaceType     string              `json:"google_place_type,omitempty"`
	ThumbnailURL        string              `json:"thumbnail_url,omitempty"`
	Title               string              `json:"title"`
	Address             string              `json:"address"`
	FoursquareID        string              `json:"foursquare_id,omitempty"`
	ID                  string              `json:"id"`
	GooglePlaceID       string              `json:"google_place_id,omitempty"`
	FoursquareType      string              `json:"foursquare_type,omitempty"`
	Type                InlineQueryType     `json:"type"`
	Longitude           float64             `json:"longitude"`
	Latitude            float64             `json:"latitude"`
	ThumbnailWidth      int                 `json:"thumbnail_width,omitempty"`
	ThumbnailHeight     int                 `json:"thumbnail_height,omitempty"`
}

InlineQueryResultVenue represents a venue. By default, the venue will be sent by the user. Alternatively, you can use InputMessageContent to send a message with the specified content instead of the venue.

func (InlineQueryResultVenue) ImplementsInlineQueryResult

func (i InlineQueryResultVenue) ImplementsInlineQueryResult()

ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.

type InlineQueryResultVideo

type InlineQueryResultVideo struct {
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
	ReplyMarkup         ReplyMarkup         `json:"reply_markup,omitempty"`
	Description         string              `json:"description,omitempty"`
	MimeType            string              `json:"mime_type"`
	ThumbnailURL        string              `json:"thumbnail_url"`
	Title               string              `json:"title"`
	Caption             string              `json:"caption,omitempty"`
	ID                  string              `json:"id"`
	VideoURL            string              `json:"video_url"`
	ParseMode           string              `json:"parse_mode,omitempty"`
	Type                InlineQueryType     `json:"type"`
	CaptionEntities     []*MessageEntity    `json:"caption_entities,omitempty"`
	VideoHeight         int                 `json:"video_height,omitempty"`
	VideoDuration       int                 `json:"video_duration,omitempty"`
	VideoWidth          int                 `json:"video_width,omitempty"`
}

InlineQueryResultVideo represents a link to a page containing an embedded video player or a video file. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use InputMessageContent to send a message with the specified content instead of the video.

func (InlineQueryResultVideo) ImplementsInlineQueryResult

func (i InlineQueryResultVideo) ImplementsInlineQueryResult()

ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.

type InlineQueryResultVoice

type InlineQueryResultVoice struct {
	ReplyMarkup         ReplyMarkup         `json:"reply_markup,omitempty"`
	InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
	Type                InlineQueryType     `json:"type"`
	ID                  string              `json:"id"`
	Caption             string              `json:"caption,omitempty"`
	ParseMode           string              `json:"parse_mode,omitempty"`
	VoiceURL            string              `json:"voice_url"`
	Title               string              `json:"title"`
	CaptionEntities     []*MessageEntity    `json:"caption_entities,omitempty"`
	VoiceDuration       int                 `json:"voice_duration,omitempty"`
}

InlineQueryResultVoice represents a link to a voice recording in an .OGG container encoded with OPUS. By default, this voice recording will be sent by the user. Alternatively, you can use InputMessageContent to send a message with the specified content instead of the the voice message.

func (InlineQueryResultVoice) ImplementsInlineQueryResult

func (i InlineQueryResultVoice) ImplementsInlineQueryResult()

ImplementsInlineQueryResult is used to implement the InlineQueryResult interface.

type InlineQueryResultsButton added in v3.25.0

type InlineQueryResultsButton struct {
	WebApp         WebAppInfo `json:"web_app,omitempty"`
	StartParameter string     `json:"start_parameter,omitempty"`
	Text           string     `json:"text"`
}

InlineQueryResultsButton represents a button to be shown above inline query results. You MUST use exactly one of the fields.

type InlineQueryType

type InlineQueryType string

InlineQueryType is a custom type for the various InlineQueryResult*'s Type field.

type InputContactMessageContent

type InputContactMessageContent struct {
	PhoneNumber string `json:"phone_number"`
	FirstName   string `json:"first_name"`
	LastName    string `json:"last_name,omitempty"`
	VCard       string `json:"vcard,omitempty"`
}

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

func (InputContactMessageContent) ImplementsInputMessageContent

func (i InputContactMessageContent) ImplementsInputMessageContent()

ImplementsInputMessageContent is used to implement the InputMessageContent interface.

type InputFile

type InputFile struct {
	// contains filtered or unexported fields
}

InputFile is a struct which contains data about a file to be sent.

func NewInputFileBytes

func NewInputFileBytes(fileName string, content []byte) InputFile

NewInputFileBytes is a wrapper for InputFile which only fills the path and content fields.

func NewInputFileID

func NewInputFileID(ID string) InputFile

NewInputFileID is a wrapper for InputFile which only fills the id field.

func NewInputFilePath

func NewInputFilePath(filePath string) InputFile

NewInputFilePath is a wrapper for InputFile which only fills the path field.

func NewInputFileURL added in v3.23.1

func NewInputFileURL(url string) InputFile

NewInputFileURL is a wrapper for InputFile which only fills the url field.

type InputLocationMessageContent

type InputLocationMessageContent struct {
	Latitude             float64 `json:"latitude"`
	Longitude            float64 `json:"longitude"`
	HorizontalAccuracy   float64 `json:"horizontal_accuracy,omitempty"`
	LivePeriod           int     `json:"live_period,omitempty"`
	Heading              int     `json:"heading,omitempty"`
	ProximityAlertRadius int     `json:"proximity_alert_radius,omitempty"`
}

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

func (InputLocationMessageContent) ImplementsInputMessageContent

func (i InputLocationMessageContent) ImplementsInputMessageContent()

ImplementsInputMessageContent is used to implement the InputMessageContent interface.

type InputMedia

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

InputMedia is an interface for the various media types.

type InputMediaAnimation

type InputMediaAnimation struct {
	Type            InputMediaType   `json:"type"`
	Media           InputFile        `json:"-"`
	Thumbnail       InputFile        `json:"-"`
	Caption         string           `json:"caption,omitempty"`
	ParseMode       ParseMode        `json:"parse_mode,omitempty"`
	CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`
	Width           int              `json:"width,omitempty"`
	Height          int              `json:"height,omitempty"`
	Duration        int              `json:"duration,omitempty"`
	HasSpoiler      bool             `json:"has_spoiler,omitempty"`
}

InputMediaAnimation represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent. Type MUST BE "animation".

type InputMediaAudio

type InputMediaAudio struct {
	Type            InputMediaType   `json:"type"`
	Performer       string           `json:"performer,omitempty"`
	Title           string           `json:"title,omitempty"`
	Caption         string           `json:"caption,omitempty"`
	ParseMode       ParseMode        `json:"parse_mode,omitempty"`
	Media           InputFile        `json:"-"`
	Thumbnail       InputFile        `json:"-"`
	CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`
	Duration        int              `json:"duration,omitempty"`
}

InputMediaAudio represents an audio file to be treated as music to be sent. Type MUST BE "audio".

type InputMediaDocument

type InputMediaDocument struct {
	Type                        InputMediaType   `json:"type"`
	Media                       InputFile        `json:"-"`
	Thumbnail                   InputFile        `json:"-"`
	Caption                     string           `json:"caption,omitempty"`
	ParseMode                   ParseMode        `json:"parse_mode,omitempty"`
	CaptionEntities             []*MessageEntity `json:"caption_entities,omitempty"`
	DisableContentTypeDetection bool             `json:"disable_content_type_detection,omitempty"`
}

InputMediaDocument represents a general file to be sent. Type MUST BE "document".

type InputMediaPhoto

type InputMediaPhoto struct {
	Type            InputMediaType   `json:"type"`
	Media           InputFile        `json:"-"`
	Caption         string           `json:"caption,omitempty"`
	ParseMode       ParseMode        `json:"parse_mode,omitempty"`
	CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`
	HasSpoiler      bool             `json:"has_spoiler,omitempty"`
}

InputMediaPhoto represents a photo to be sent. Type MUST BE "photo".

type InputMediaType added in v3.6.0

type InputMediaType string

InputMediaType is a custom type for the various InputMedia*'s Type field.

type InputMediaVideo

type InputMediaVideo struct {
	Type              InputMediaType   `json:"type"`
	Media             InputFile        `json:"-"`
	Thumbnail         InputFile        `json:"-"`
	Caption           string           `json:"caption,omitempty"`
	ParseMode         ParseMode        `json:"parse_mode,omitempty"`
	CaptionEntities   []*MessageEntity `json:"caption_entities,omitempty"`
	Width             int              `json:"width,omitempty"`
	Height            int              `json:"height,omitempty"`
	Duration          int              `json:"duration,omitempty"`
	SupportsStreaming bool             `json:"supports_streaming,omitempty"`
	HasSpoiler        bool             `json:"has_spoiler,omitempty"`
}

InputMediaVideo represents a video to be sent. Type MUST BE "video".

type InputMessageContent

type InputMessageContent interface {
	ImplementsInputMessageContent()
}

InputMessageContent represents an interface that implements all the various Input*MessageContent types.

type InputSticker added in v3.24.0

type InputSticker struct {
	MaskPosition *MaskPosition `json:"mask_position,omitempty"`
	Keywords     *[]string     `json:"keywords,omitempty"`
	Format       StickerFormat `json:"format"`
	Sticker      InputFile     `json:"-"`
	EmojiList    []string      `json:"emoji_list"`
}

InputSticker is a struct which describes a sticker to be added to a sticker set.

type InputTextMessageContent

type InputTextMessageContent struct {
	LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options,omitempty"`
	MessageText        string              `json:"message_text"`
	ParseMode          string              `json:"parse_mode,omitempty"`
	Entities           []*MessageEntity    `json:"entities,omitempty"`
}

InputTextMessageContent represents the content of a text message to be sent as the result of an inline query.

func (InputTextMessageContent) ImplementsInputMessageContent

func (i InputTextMessageContent) ImplementsInputMessageContent()

ImplementsInputMessageContent is used to implement the InputMessageContent interface.

type InputVenueMessageContent

type InputVenueMessageContent struct {
	GooglePlaceID   string  `json:"google_place_id,omitempty"`
	GooglePlaceType string  `json:"google_place_type,omitempty"`
	Title           string  `json:"title"`
	Address         string  `json:"address"`
	FoursquareID    string  `json:"foursquare_id,omitempty"`
	FoursquareType  string  `json:"foursquare_type,omitempty"`
	Latitude        float64 `json:"latitude"`
	Longitude       float64 `json:"longitude"`
}

InputVenueMessageContent represents the content of a venue message to be sent as the result of an inline query.

func (InputVenueMessageContent) ImplementsInputMessageContent

func (i InputVenueMessageContent) ImplementsInputMessageContent()

ImplementsInputMessageContent is used to implement the InputMessageContent interface.

type InviteLinkOptions added in v3.5.0

type InviteLinkOptions struct {
	Name               string `query:"name"`
	ExpireDate         int64  `query:"expire_date"`
	MemberLimit        int    `query:"member_limit"`
	CreatesJoinRequest bool   `query:"creates_join_request"`
}

InviteLinkOptions contains the optional parameters used by the CreateChatInviteLink and EditChatInviteLink methods.

type Invoice added in v3.15.0

type Invoice struct {
	Title          string `json:"title"`
	Description    string `json:"description"`
	StartParameter string `json:"start_parameter"`
	// Three-letter ISO 4217 currency code.
	Currency string `json:"currency"`
	// Total amount in the smallest units of the currency (integer, not float/double).
	// For example, for a price of US$ 1.45 pass amount = 145.
	// See the exp parameter in currencies.json, it shows the number of digits
	// past the decimal point for each currency (2 for the majority of currencies).
	TotalAmount int `json:"total_amount"`
}

Invoice contains basic information about an invoice.

type InvoiceOptions added in v3.15.0

type InvoiceOptions struct {
	StartParameter            string               `query:"start_parameter"`
	ProviderData              string               `query:"provider_data"`
	PhotoURL                  string               `query:"photo_url"`
	ReplyMarkup               InlineKeyboardMarkup `query:"reply_markup"`
	SuggestedTipAmount        []int                `query:"suggested_tip_amounts"`
	ReplyParameters           ReplyParameters      `query:"reply_parameters"`
	MaxTipAmount              int                  `query:"max_tip_amount"`
	PhotoSize                 int                  `query:"photo_size"`
	PhotoWidth                int                  `query:"photo_width"`
	PhotoHeight               int                  `query:"photo_height"`
	MessageThreadID           int                  `query:"message_thread_id"`
	SendPhoneNumberToProvider bool                 `query:"send_phone_number_to_provider"`
	NeepShippingAddress       bool                 `query:"need_shipping_address"`
	NeedPhoneNumber           bool                 `query:"need_phone_number"`
	SendEmailToProvider       bool                 `query:"send_email_to_provider"`
	IsFlexible                bool                 `query:"is_flexible"`
	DisableNotification       bool                 `query:"disable_notification"`
	ProtectContent            bool                 `query:"protect_content"`
	NeedName                  bool                 `query:"need_name"`
	NeedEmail                 bool                 `query:"need_email"`
}

InvoiceOptions contains the optional parameters used by the SendInvoice API method.

type KeyboardButton

type KeyboardButton struct {
	RequestPoll     *KeyboardButtonPollType     `json:"request_poll,omitempty"`
	WebApp          *WebAppInfo                 `json:"web_app,omitempty"`
	RequestUsers    *KeyboardButtonRequestUsers `json:"request_users,omitempty"`
	RequestChat     *KeyboardButtonRequestChat  `json:"request_chat,omitempty"`
	Text            string                      `json:"text"`
	RequestContact  bool                        `json:"request_contact,omitempty"`
	RequestLocation bool                        `json:"request_location,omitempty"`
}

KeyboardButton represents a button in a keyboard.

type KeyboardButtonPollType

type KeyboardButtonPollType struct {
	Type PollType `json:"type"`
}

KeyboardButtonPollType represents type of a poll, which is allowed to be created and sent when the corresponding button is pressed.

type KeyboardButtonRequestChat added in v3.23.0

type KeyboardButtonRequestChat struct {
	UserAdministratorRights *ChatAdministratorRights `json:"user_administrator_rights,omitempty"`
	BotAdministratorRights  *ChatAdministratorRights `json:"bot_administrator_rights,omitempty"`
	RequestID               int                      `json:"request_id"`
	ChatIsChannel           bool                     `json:"chat_is_channel,omitempty"`
	ChatIsForum             bool                     `json:"chat_is_forum,omitempty"`
	ChatHasUsername         bool                     `json:"chat_has_username,omitempty"`
	ChatIsCreated           bool                     `json:"chat_is_created,omitempty"`
	BotIsMember             bool                     `json:"bot_is_member,omitempty"`
	RequestName             bool                     `json:"request_name,omitempty"`
	RequestUsername         bool                     `json:"request_username,omitempty"`
	RequestPhoto            bool                     `json:"request_photo,omitempty"`
}

KeyboardButtonRequestChat defines the criteria used to request a suitable chat. The identifier of the selected chat will be shared with the bot when the corresponding button is pressed.

type KeyboardButtonRequestUsers added in v3.28.0

type KeyboardButtonRequestUsers struct {
	RequestID       int  `json:"request_id"`
	MaxQuantity     int  `json:"max_quantity,omitempty"`
	UserIsBot       bool `json:"user_is_bot,omitempty"`
	UserIsPremium   bool `json:"user_is_premium,omitempty"`
	RequestName     bool `json:"request_name,omitempty"`
	RequestUsername bool `json:"request_username,omitempty"`
	RequestPhoto    bool `json:"request_photo,omitempty"`
}

KeyboardButtonRequestUsers defines the criteria used to request suitable users. The identifiers of the selected users will be shared with the bot when the corresponding button is pressed.

type LabeledPrice added in v3.15.0

type LabeledPrice struct {
	Label string `json:"label"`
	// Price of the product in the smallest units of the currency (integer, not float/double).
	// For example, for a price of US$ 1.45 pass amount = 145.
	// See the exp parameter in currencies.json, it shows the number of digits
	// past the decimal point for each currency (2 for the majority of currencies).
	Amount int `json:"amount"`
}

LabeledPrice represents a portion of the price for goods or services.

type LinkPreviewOptions added in v3.28.0

type LinkPreviewOptions struct {
	URL              string `json:"url,omitempty"`
	IsDisabled       bool   `json:"is_disabled,omitempty"`
	PreferSmallMedia bool   `json:"prefer_small_media,omitempty"`
	PreferLargeMedia bool   `json:"prefer_large_media,omitempty"`
	ShowAboveText    bool   `json:"show_above_text,omitempty"`
}

LinkPreviewOptions describes the options used for link preview generation.

type Location

type Location struct {
	Longitude            float64 `json:"longitude"`
	Latitude             float64 `json:"latitude"`
	HorizontalAccuracy   float64 `json:"horizontal_accuracy,omitempty"`
	LivePeriod           int     `json:"live_period,omitempty"`
	Heading              int     `json:"heading,omitempty"`
	ProximityAlertRadius int     `json:"proximity_alert_radius,omitempty"`
}

Location represents a point on the map.

type LocationOptions

type LocationOptions struct {
	BusinessConnectionID string          `query:"business_connection_id"`
	ReplyMarkup          ReplyMarkup     `query:"reply_markup"`
	ReplyParameters      ReplyParameters `query:"reply_parameters"`
	HorizontalAccuracy   float64         `query:"horizontal_accuracy"`
	MessageThreadID      int             `query:"message_thread_id"`
	LivePeriod           int             `query:"live_period"`
	ProximityAlertRadius int             `query:"proximity_alert_radius"`
	Heading              int             `query:"heading"`
	DisableNotification  bool            `query:"disable_notification"`
	ProtectContent       bool            `query:"protect_content"`
}

LocationOptions contains the optional parameters used by the SendLocation method.

type LoginURL

type LoginURL struct {
	URL                string `json:"url"`
	ForwardText        string `json:"forward_text,omitempty"`
	BotUsername        string `json:"bot_username,omitempty"`
	RequestWriteAccess bool   `json:"request_write_access,omitempty"`
}

LoginURL represents a parameter of the inline keyboard button used to automatically authorize a user.

type MaskPoint added in v3.24.0

type MaskPoint string

MaskPoint is a custom type for the various part of face where a mask should be placed.

type MaskPosition

type MaskPosition struct {
	Point  MaskPoint `json:"point"`
	XShift float32   `json:"x_shift"`
	YShift float32   `json:"y_shift"`
	Scale  float32   `json:"scale"`
}

MaskPosition describes the position on faces where a mask should be placed by default.

type MediaGroupOptions

type MediaGroupOptions struct {
	BusinessConnectionID string          `query:"business_connection_id"`
	ReplyParameters      ReplyParameters `query:"reply_parameters"`
	MessageThreadID      int             `query:"message_thread_id"`
	DisableNotification  bool            `query:"disable_notification"`
	ProtectContent       bool            `query:"protect_content"`
}

MediaGroupOptions contains the optional parameters used by the SendMediaGroup method.

type MenuButton struct {
	WebApp *WebAppInfo    `json:"web_app,omitempty"`
	Type   MenuButtonType `json:"type"`
	Text   string         `json:"text,omitempty"`
}

MenuButton is a unique type for MenuButtonCommands, MenuButtonWebApp and MenuButtonDefault

type MenuButtonType string

MenuButtonType is a custom type for the various MenuButton*'s Type field.

type Message

type Message struct {
	MessageAutoDeleteTimerChanged *MessageAutoDeleteTimerChanged `json:"message_auto_delete_timer_changed,omitempty"`
	Contact                       *Contact                       `json:"contact,omitempty"`
	SenderChat                    *Chat                          `json:"sender_chat,omitempty"`
	WebAppData                    *WebAppData                    `json:"web_app_data,omitempty"`
	From                          *User                          `json:"from,omitempty"`
	VideoChatParticipantsInvited  *VideoChatParticipantsInvited  `json:"video_chat_participants_invited,omitempty"`
	Invoice                       *Invoice                       `json:"invoice,omitempty"`
	SuccessfulPayment             *SuccessfulPayment             `json:"successful_payment,omitempty"`
	VideoChatEnded                *VideoChatEnded                `json:"video_chat_ended,omitempty"`
	VideoChatStarted              *VideoChatStarted              `json:"video_chat_started,omitempty"`
	ReplyToMessage                *Message                       `json:"reply_to_message,omitempty"`
	ViaBot                        *User                          `json:"via_bot,omitempty"`
	Poll                          *Poll                          `json:"poll,omitempty"`
	ProximityAlertTriggered       *ProximityAlertTriggered       `json:"proximity_alert_triggered,omitempty"`
	ReplyMarkup                   *InlineKeyboardMarkup          `json:"reply_markup,omitempty"`
	Document                      *Document                      `json:"document,omitempty"`
	PinnedMessage                 *Message                       `json:"pinned_message,omitempty"`
	LeftChatMember                *User                          `json:"left_chat_member,omitempty"`
	Animation                     *Animation                     `json:"animation,omitempty"`
	Audio                         *Audio                         `json:"audio,omitempty"`
	Voice                         *Voice                         `json:"voice,omitempty"`
	Location                      *Location                      `json:"location,omitempty"`
	Sticker                       *Sticker                       `json:"sticker,omitempty"`
	Video                         *Video                         `json:"video,omitempty"`
	VideoNote                     *VideoNote                     `json:"video_note,omitempty"`
	Venue                         *Venue                         `json:"venue,omitempty"`
	Game                          *Game                          `json:"game,omitempty"`
	Dice                          *Dice                          `json:"dice,omitempty"`
	ForumTopicCreated             *ForumTopicCreated             `json:"forum_topic_created,omitempty"`
	ForumTopicEdited              *ForumTopicEdited              `json:"forum_topic_edited,omitempty"`
	VideoChatScheduled            *VideoChatScheduled            `json:"video_chat_scheduled,omitempty"`
	ForumTopicClosed              *ForumTopicClosed              `json:"forum_topic_closed,omitempty"`
	ForumTopicReopened            *ForumTopicReopened            `json:"forum_topic_reopened,omitempty"`
	GeneralForumTopicHidden       *GeneralForumTopicHidden       `json:"general_forum_topic_hidden,omitempty"`
	GeneralForumTopicUnhidden     *GeneralForumTopicUnhidden     `json:"general_forum_topic_unhidden,omitempty"`
	GiveawayCreated               *GiveawayCreated               `json:"giveaway_created,omitempty"`
	Giveaway                      *Giveaway                      `json:"giveaway,omitempty"`
	GiveawayWinners               *GiveawayWinners               `json:"giveaway_winners,omitempty"`
	GiveawayCompleted             *GiveawayCompleted             `json:"giveaway_completed,omitempty"`
	WriteAccessAllowed            *WriteAccessAllowed            `json:"write_access_allowed,omitempty"`
	UsersShared                   *UsersShared                   `json:"users_shared,omitempty"`
	ChatShared                    *ChatShared                    `json:"chat_shared,omitempty"`
	Story                         *Story                         `json:"story,omitempty"`
	ReplyToStory                  *Story                         `json:"reply_to_story,omitempty"`
	ExternalReply                 *ExternalReplyInfo             `json:"external_reply,omitempty"`
	Quote                         *TextQuote                     `json:"quote,omitempty"`
	LinkPreviewOptions            *LinkPreviewOptions            `json:"link_preview_options,omitempty"`
	ForwardOrigin                 *MessageOrigin                 `json:"forward_origin,omitempty"`
	BoostAdded                    *ChatBoostAdded                `json:"boost_added,omitempty"`
	SenderBusinessBot             *User                          `json:"sender_business_bot,omitempty"`
	MediaGroupID                  string                         `json:"media_group_id,omitempty"`
	ConnectedWebsite              string                         `json:"connected_website,omitempty"`
	NewChatTitle                  string                         `json:"new_chat_title,omitempty"`
	AuthorSignature               string                         `json:"author_signature,omitempty"`
	Caption                       string                         `json:"caption,omitempty"`
	Text                          string                         `json:"text,omitempty"`
	BusinessConnectionID          string                         `json:"business_connection_id,omitempty"`
	CaptionEntities               []*MessageEntity               `json:"caption_entities,omitempty"`
	NewChatPhoto                  []*PhotoSize                   `json:"new_chat_photo,omitempty"`
	NewChatMembers                []*User                        `json:"new_chat_members,omitempty"`
	Photo                         []*PhotoSize                   `json:"photo,omitempty"`
	Entities                      []*MessageEntity               `json:"entities,omitempty"`
	Chat                          Chat                           `json:"chat"`
	ID                            int                            `json:"message_id"`
	ThreadID                      int                            `json:"message_thread_id,omitempty"`
	MigrateFromChatID             int                            `json:"migrate_from_chat_id,omitempty"`
	Date                          int                            `json:"date"`
	MigrateToChatID               int                            `json:"migrate_to_chat_id,omitempty"`
	EditDate                      int                            `json:"edit_date,omitempty"`
	SenderBoostCount              int                            `json:"sender_boost_count,omitempty"`
	DeleteChatPhoto               bool                           `json:"delete_chat_photo,omitempty"`
	IsTopicMessage                bool                           `json:"is_topic_message,omitempty"`
	IsAutomaticForward            bool                           `json:"is_automatic_forward,omitempty"`
	GroupChatCreated              bool                           `json:"group_chat_created,omitempty"`
	SupergroupChatCreated         bool                           `json:"supergroup_chat_created,omitempty"`
	ChannelChatCreated            bool                           `json:"channel_chat_created,omitempty"`
	HasProtectedContent           bool                           `json:"has_protected_content,omitempty"`
	HasMediaSpoiler               bool                           `json:"has_media_spoiler,omitempty"`
	IsFromOffline                 bool                           `json:"is_from_offline,omitempty"`
}

Message represents a message.

type MessageAutoDeleteTimerChanged

type MessageAutoDeleteTimerChanged struct {
	MessageAutoDeleteTime int `json:"message_auto_delete_time"`
}

MessageAutoDeleteTimerChanged represents a service message about a change in auto-delete timer settings.

type MessageCaptionOptions

type MessageCaptionOptions struct {
	Caption         string               `query:"caption"`
	ParseMode       ParseMode            `query:"parse_mode"`
	CaptionEntities []MessageEntity      `query:"caption_entities"`
	ReplyMarkup     InlineKeyboardMarkup `query:"reply_markup"`
}

MessageCaptionOptions contains the optional parameters used by the EditMessageCaption method.

type MessageEntity

type MessageEntity struct {
	User          *User             `json:"user,omitempty"`
	Type          MessageEntityType `json:"type"`
	URL           string            `json:"url,omitempty"`
	Language      string            `json:"language,omitempty"`
	CustomEmojiID string            `json:"custom_emoji_id,omitempty"`
	Offset        int               `json:"offset"`
	Length        int               `json:"length"`
}

MessageEntity represents one special entity in a text message. For example, hashtags, usernames, URLs, etc.

type MessageEntityType added in v3.14.0

type MessageEntityType string

MessageEntityType is a custom type for the various MessageEntity types used in various methods.

type MessageID

type MessageID struct {
	MessageID int `json:"message_id"`
}

MessageID represents a unique message identifier.

type MessageIDOptions

type MessageIDOptions struct {
	// contains filtered or unexported fields
}

MessageIDOptions is a struct which contains data about a message to edit.

func NewInlineMessageID

func NewInlineMessageID(ID string) MessageIDOptions

NewInlineMessageID is a wrapper for MessageIDOptions which only fills the inlineMessageID fields.

func NewMessageID

func NewMessageID(chatID int64, messageID int) MessageIDOptions

NewMessageID is a wrapper for MessageIDOptions which only fills the chatID and messageID fields.

type MessageOptions

type MessageOptions struct {
	ReplyMarkup          ReplyMarkup        `query:"reply_markup"`
	BusinessConnectionID string             `query:"business_connection_id"`
	ParseMode            ParseMode          `query:"parse_mode"`
	LinkPreviewOptions   LinkPreviewOptions `query:"link_preview_options"`
	Entities             []MessageEntity    `query:"entities"`
	ReplyParameters      ReplyParameters    `query:"reply_parameters"`
	MessageThreadID      int64              `query:"message_thread_id"`
	DisableNotification  bool               `query:"disable_notification"`
	ProtectContent       bool               `query:"protect_content"`
}

MessageOptions contains the optional parameters used by some Telegram API methods.

type MessageOrigin added in v3.28.0

type MessageOrigin struct {
	SenderChat      *Chat  `json:"sender_chat,omitempty"`
	SenderUser      *User  `json:"sender_user,omitempty"`
	Type            string `json:"type"`
	SenderUserName  string `json:"sender_user_name,omitempty"`
	AuthorSignature string `json:"author_signature,omitempty"`
	Date            int    `json:"date"`
}

MessageOrigin describes the origin of a message.

type MessageReactionCountUpdated added in v3.28.0

type MessageReactionCountUpdated struct {
	Reactions []ReactionCount `json:"reactions"`
	Chat      Chat            `json:"chat"`
	MessageID int             `json:"message_id"`
	Date      int             `json:"date"`
}

MessageReactionCountUpdated represents reaction changes on a message with anonymous reactions.

type MessageReactionOptions added in v3.28.0

type MessageReactionOptions struct {
	Reaction []ReactionType `query:"reaction"`
	IsBig    bool           `query:"is_big"`
}

MessageReactionOptions contains the optional parameters used by the SetMessageReaction API method.

type MessageReactionUpdated added in v3.28.0

type MessageReactionUpdated struct {
	OldReaction []ReactionType `json:"old_reaction"`
	NewReaction []ReactionType `json:"new_reaction"`
	User        User           `json:"user,omitempty"`
	Chat        Chat           `json:"chat"`
	ActorChat   Chat           `json:"actor_chat,omitempty"`
	MessageID   int            `json:"message_id"`
	Date        int            `json:"date"`
}

MessageReactionUpdated represents a change of a reaction on a message performed by a user.

type MessageReplyMarkup

type MessageReplyMarkup struct {
	ReplyMarkup InlineKeyboardMarkup `query:"reply_markup"`
}

MessageReplyMarkup contains the optional parameters used by the method which only require reply_markup.

type MessageTextOptions

type MessageTextOptions struct {
	ParseMode          ParseMode            `query:"parse_mode"`
	Entities           []MessageEntity      `query:"entities"`
	ReplyMarkup        InlineKeyboardMarkup `query:"reply_markup"`
	LinkPreviewOptions LinkPreviewOptions   `query:"link_preview_options"`
}

MessageTextOptions contains the optional parameters used by the EditMessageText method.

type NewBotFn

type NewBotFn func(chatId int64) Bot

NewBotFn is called every time echotron receives an update with a chat ID never encountered before.

type NewStickerSetOptions

type NewStickerSetOptions struct {
	StickerType     StickerSetType `query:"sticker_type"`
	NeedsRepainting bool           `query:"needs_repainting"`
}

NewStickerSetOptions contains the optional parameters used in the CreateNewStickerSet method.

type OrderInfo added in v3.15.0

type OrderInfo struct {
	Name            string          `json:"name,omitempty"`
	PhoneNumber     string          `json:"phone_number,omitempty"`
	Email           string          `json:"email,omitempty"`
	ShippingAddress ShippingAddress `json:"shipping_address,omitempty"`
}

OrderInfo represents information about an order.

type ParseMode

type ParseMode string

ParseMode is a custom type for the various frequent options used by some methods of the API.

type PassportData added in v3.15.0

type PassportData struct {
	Credentials EncryptedCredentials       `json:"encrypted_credentials"`
	Data        []EncryptedPassportElement `json:"encrypted_passport_element"`
}

PassportData contains information about Telegram Passport data shared with the bot by the user.

type PassportElementError added in v3.15.0

type PassportElementError interface {
	ImplementsPassportElementError()
}

PassportElementError is an interface for the various PassportElementError types.

type PassportElementErrorDataField added in v3.15.0

type PassportElementErrorDataField struct {
	Source    PassportElementErrorSource   `json:"source"`
	Type      EncryptedPassportElementType `json:"type"`
	FieldName string                       `json:"field_name"`
	DataHash  string                       `json:"data_hash"`
	Message   string                       `json:"message"`
}

PassportElementErrorDataField represents an issue in one of the data fields that was provided by the user. The error is considered resolved when the field's value changes. Source MUST BE SourceData. Type MUST BE one of TypePersonalDetails, TypePassport, TypeDriverLicense, TypeIdentityCard, TypeInternalPassport and TypeAddress.

func (PassportElementErrorDataField) ImplementsPassportElementError added in v3.15.0

func (p PassportElementErrorDataField) ImplementsPassportElementError()

ImplementsPassportElementError us a dummy method which exists to implement the interface PassportElementError.

type PassportElementErrorFile added in v3.15.0

type PassportElementErrorFile struct {
	Source   PassportElementErrorSource   `json:"source"`
	Type     EncryptedPassportElementType `json:"type"`
	FileHash string                       `json:"file_hash"`
	Message  string                       `json:"message"`
}

PassportElementErrorFile represents an issue with the document scan. The error is considered resolved when the file with the document scan changes. Source MUST BE SourceFile. Type MUST BE one of TypePassport, TypeDriverLicense, TypeIdentityCard and TypeIdentityPassport.

func (PassportElementErrorFile) ImplementsPassportElementError added in v3.15.0

func (p PassportElementErrorFile) ImplementsPassportElementError()

ImplementsPassportElementError us a dummy method which exists to implement the interface PassportElementError.

type PassportElementErrorFiles added in v3.15.0

type PassportElementErrorFiles struct {
	Source     PassportElementErrorSource   `json:"source"`
	Type       EncryptedPassportElementType `json:"type"`
	Message    string                       `json:"message"`
	FileHashes []string                     `json:"file_hashes"`
}

PassportElementErrorFiles represents an issue with a list of scans. The error is considered resolved when the list of files containing the scans changes. Source MUST BE SourceFiles. Type MUST BE one of TypeUtilityBill, TypeBankStatement, TypeRentalAgreement, TypePassportRegistration and TypeTemporaryRegistration.

func (PassportElementErrorFiles) ImplementsPassportElementError added in v3.15.0

func (p PassportElementErrorFiles) ImplementsPassportElementError()

ImplementsPassportElementError us a dummy method which exists to implement the interface PassportElementError.

type PassportElementErrorFrontSide added in v3.15.0

type PassportElementErrorFrontSide struct {
	Source   PassportElementErrorSource   `json:"source"`
	Type     EncryptedPassportElementType `json:"type"`
	FileHash string                       `json:"file_hash"`
	Message  string                       `json:"message"`
}

PassportElementErrorFrontSide represents an issue with the front side of a document. The error is considered resolved when the file with the front side of the document changes. Source MUST BE SourceFrontSide. Type MUST BE one of TypeDriverLicense and TypeIdentityCard.

func (PassportElementErrorFrontSide) ImplementsPassportElementError added in v3.15.0

func (p PassportElementErrorFrontSide) ImplementsPassportElementError()

ImplementsPassportElementError us a dummy method which exists to implement the interface PassportElementError.

type PassportElementErrorReverseSide added in v3.15.0

type PassportElementErrorReverseSide struct {
	Source   PassportElementErrorSource   `json:"source"`
	Type     EncryptedPassportElementType `json:"type"`
	FileHash string                       `json:"file_hash"`
	Message  string                       `json:"message"`
}

PassportElementErrorReverseSide represents an issue with the reverse side of a document. The error is considered resolved when the file with the reverse side of the document changes. Source MUST BE SourceReverseSide. Type MUST BE one of TypeDriverLicense and TypeIdentityCard.

func (PassportElementErrorReverseSide) ImplementsPassportElementError added in v3.15.0

func (p PassportElementErrorReverseSide) ImplementsPassportElementError()

ImplementsPassportElementError us a dummy method which exists to implement the interface PassportElementError.

type PassportElementErrorSelfie added in v3.15.0

type PassportElementErrorSelfie struct {
	Source   PassportElementErrorSource   `json:"source"`
	Type     EncryptedPassportElementType `json:"type"`
	FileHash string                       `json:"file_hash"`
	Message  string                       `json:"message"`
}

PassportElementErrorSelfie represents an issue with the selfie with a document. The error is considered resolved when the file with the selfie changes. Source MUST BE SourceSelfie. Type MUST BE one of TypePassport, TypeDriverLicense, TypeIdentityCard and TypeIdentityPassport.

func (PassportElementErrorSelfie) ImplementsPassportElementError added in v3.15.0

func (p PassportElementErrorSelfie) ImplementsPassportElementError()

ImplementsPassportElementError us a dummy method which exists to implement the interface PassportElementError.

type PassportElementErrorSource added in v3.15.0

type PassportElementErrorSource string

PassportElementErrorSource is a custom type for the various possible options used as Source in PassportElementSource.

type PassportElementErrorTranslationFile added in v3.15.0

type PassportElementErrorTranslationFile struct {
	Source   PassportElementErrorSource   `json:"source"`
	Type     EncryptedPassportElementType `json:"type"`
	FileHash string                       `json:"file_hash"`
	Message  string                       `json:"message"`
}

PassportElementErrorTranslationFile represents an issue with one of the files that constitute the translation of the document. The error is considered resolved when the file changes. Source MUST BE SourceTranslationFile. Type MUST BE one of TypePassport, TypeDriverLicense, TypeIdentityCard, TypeInternalPassport, TypeUtilityBill, TypeBankStatement, TypeRentalAgreement, TypePassportRegistration and TypeTemporaryRegistration.

func (PassportElementErrorTranslationFile) ImplementsPassportElementError added in v3.15.0

func (p PassportElementErrorTranslationFile) ImplementsPassportElementError()

ImplementsPassportElementError us a dummy method which exists to implement the interface PassportElementError.

type PassportElementErrorTranslationFiles added in v3.15.0

type PassportElementErrorTranslationFiles struct {
	Source     PassportElementErrorSource   `json:"source"`
	Type       EncryptedPassportElementType `json:"type"`
	Message    string                       `json:"message"`
	FileHashes []string                     `json:"file_hashes"`
}

PassportElementErrorTranslationFiles represents an issue with the translated version of a document. The error is considered resolved when a file with the document translation changes. Source MUST BE SourceTranslationFiles. Type MUST BE one of TypePassport, TypeDriverLicense, TypeIdentityCard, TypeInternalPassport, TypeUtilityBill, TypeBankStatement, TypeRentalAgreement, TypePassportRegistration and TypeTemporaryRegistration.

func (PassportElementErrorTranslationFiles) ImplementsPassportElementError added in v3.15.0

func (p PassportElementErrorTranslationFiles) ImplementsPassportElementError()

ImplementsPassportElementError us a dummy method which exists to implement the interface PassportElementError.

type PassportElementErrorUnspecified added in v3.15.0

type PassportElementErrorUnspecified struct {
	Source      PassportElementErrorSource   `json:"source"`
	Type        EncryptedPassportElementType `json:"type"`
	ElementHash string                       `json:"element_hash"`
	Message     string                       `json:"message"`
}

PassportElementErrorUnspecified represents an issue in an unspecified place. The error is considered resolved when new data is added.

func (PassportElementErrorUnspecified) ImplementsPassportElementError added in v3.15.0

func (p PassportElementErrorUnspecified) ImplementsPassportElementError()

ImplementsPassportElementError us a dummy method which exists to implement the interface PassportElementError.

type PassportFile added in v3.15.0

type PassportFile struct {
	FileID       string `json:"file_id"`
	FileUniqueID string `json:"file_unique_id"`
	FileSize     int64  `json:"file_size"`
	FileDate     int64  `json:"file_date"`
}

PassportFile represents a file uploaded to Telegram Passport. Currently all Telegram Passport files are in JPEG format when decrypted and don't exceed 10MB.

type PhotoOptions

type PhotoOptions struct {
	ReplyMarkup          ReplyMarkup     `query:"reply_markup"`
	BusinessConnectionID string          `query:"business_connection_id"`
	ParseMode            ParseMode       `query:"parse_mode"`
	Caption              string          `query:"caption"`
	CaptionEntities      []MessageEntity `query:"caption_entities"`
	ReplyParameters      ReplyParameters `query:"reply_parameters"`
	MessageThreadID      int             `query:"message_thread_id"`
	HasSpoiler           bool            `query:"has_spoiler"`
	DisableNotification  bool            `query:"disable_notification"`
	ProtectContent       bool            `query:"protect_content"`
}

PhotoOptions contains the optional parameters used by the SendPhoto method.

type PhotoSize

type PhotoSize struct {
	FileID       string `json:"file_id"`
	FileUniqueID string `json:"file_unique_id"`
	Width        int    `json:"width"`
	Height       int    `json:"height"`
	FileSize     int    `json:"file_size,omitempty"`
}

PhotoSize represents one size of a photo or a file / sticker thumbnail.

type PinMessageOptions added in v3.14.0

type PinMessageOptions struct {
	DisableNotification bool `query:"disable_notification"`
}

PinMessageOptions contains the optional parameters used by the PinChatMember method.

type Poll

type Poll struct {
	Type                  string           `json:"type"`
	Question              string           `json:"question"`
	Explanation           string           `json:"explanation,omitempty"`
	ID                    string           `json:"id"`
	ExplanationEntities   []*MessageEntity `json:"explanation_entities,omitempty"`
	Options               []*PollOption    `json:"options"`
	OpenPeriod            int              `json:"open_period,omitempty"`
	TotalVoterCount       int              `json:"total_voter_count"`
	CorrectOptionID       int              `json:"correct_option_id,omitempty"`
	CloseDate             int              `json:"close_date,omitempty"`
	AllowsMultipleAnswers bool             `json:"allows_multiple_answers"`
	IsClosed              bool             `json:"is_closed"`
	IsAnonymous           bool             `json:"is_anonymous"`
}

Poll contains information about a poll.

type PollAnswer

type PollAnswer struct {
	PollID    string `json:"poll_id"`
	VoterChat *Chat  `json:"chat,omitempty"`
	User      *User  `json:"user,omitempty"`
	OptionIDs []int  `json:"option_ids"`
}

PollAnswer represents an answer of a user in a non-anonymous poll.

type PollOption

type PollOption struct {
	Text       string `json:"text"`
	VoterCount int    `json:"voter_count"`
}

PollOption contains information about one answer option in a poll.

type PollOptions added in v3.5.0

type PollOptions struct {
	ReplyMarkup           ReplyMarkup     `query:"reply_markup"`
	BusinessConnectionID  string          `query:"business_connection_id"`
	Explanation           string          `query:"explanation"`
	ExplanationParseMode  ParseMode       `query:"explanation_parse_mode"`
	Type                  PollType        `query:"type"`
	ExplanationEntities   []MessageEntity `query:"explanation_entities"`
	ReplyParameters       ReplyParameters `query:"reply_parameters"`
	CorrectOptionID       int             `query:"correct_option_id"`
	MessageThreadID       int             `query:"message_thread_id"`
	CloseDate             int             `query:"close_date"`
	OpenPeriod            int             `query:"open_period"`
	IsClosed              bool            `query:"is_closed"`
	DisableNotification   bool            `query:"disable_notification"`
	ProtectContent        bool            `query:"protect_content"`
	AllowsMultipleAnswers bool            `query:"allows_multiple_answers"`
	IsAnonymous           bool            `query:"is_anonymous"`
}

PollOptions contains the optional parameters used by the SendPoll method.

type PollType

type PollType string

PollType is a custom type for the various types of poll that can be sent.

type PreCheckoutOptions added in v3.15.0

type PreCheckoutOptions struct {
	ErrorMessage string `query:"error_message"`
}

PreCheckoutOptions contains the optional parameters used by the AnswerPreCheckoutQuery API method.

type PreCheckoutQuery added in v3.15.0

type PreCheckoutQuery struct {
	OrderInfo        OrderInfo `json:"order_info,omitempty"`
	Currency         string    `json:"currency"`
	InvoicePayload   string    `json:"invoice_payload"`
	ShippingOptionID string    `json:"shipping_option_id,omitempty"`
	ID               string    `json:"id"`
	From             User      `json:"from"`
	TotalAmount      int       `json:"total_amount"`
}

PreCheckoutQuery contains information about an incoming pre-checkout query.

type PromoteOptions added in v3.5.0

type PromoteOptions struct {
	IsAnonymous         bool `query:"is_anonymous,omitempty"`
	CanManageChat       bool `query:"can_manage_chat,omitempty"`
	CanPostMessages     bool `query:"can_post_messages,omitempty"`
	CanEditMessages     bool `query:"can_edit_messages,omitempty"`
	CanDeleteMessages   bool `query:"can_delete_messages,omitempty"`
	CanManageVideoChats bool `query:"can_manage_video_chats,omitempty"`
	CanRestrictMembers  bool `query:"can_restrict_members,omitempty"`
	CanPromoteMembers   bool `query:"can_promote_members,omitempty"`
	CanChangeInfo       bool `query:"can_change_info,omitempty"`
	CanInviteUsers      bool `query:"can_invite_users,omitempty"`
	CanPinMessages      bool `query:"can_pin_messages,omitempty"`
	CanPostStories      bool `json:"can_post_stories,omitempty"`
	CanEditStories      bool `json:"can_edit_stories,omitempty"`
	CanDeleteStories    bool `json:"can_delete_stories,omitempty"`
	CanManageTopics     bool `query:"can_manage_topics,omitempty"`
}

PromoteOptions contains the optional parameters used by the PromoteChatMember method.

type ProximityAlertTriggered

type ProximityAlertTriggered struct {
	Traveler *User `json:"traveler"`
	Watcher  *User `json:"watcher"`
	Distance int   `json:"distance"`
}

ProximityAlertTriggered represents the content of a service message, sent whenever a user in the chat triggers a proximity alert set by another user.

type ReactionCount added in v3.28.0

type ReactionCount struct {
	Type       ReactionType `json:"type"`
	TotalCount int          `json:"total_count"`
}

ReactionCount represents a reaction added to a message along with the number of times it was added.

type ReactionType added in v3.28.0

type ReactionType interface {
	ImplementsReactionType()
}

type ReactionTypeCustomEmoji added in v3.28.0

type ReactionTypeCustomEmoji struct {
	Type        string `json:"type"`
	CustomEmoji string `json:"custom_emoji"`
}

ReactionTypeCustomEmoji is based on a custom emoji. Type is always "custom_emoji".

func (ReactionTypeCustomEmoji) ImplementsReactionType added in v3.28.0

func (i ReactionTypeCustomEmoji) ImplementsReactionType()

type ReactionTypeEmoji added in v3.28.0

type ReactionTypeEmoji struct {
	Type  string `json:"type"`
	Emoji string `json:"emoji"`
}

ReactionTypeEmoji is based on an emoji. Type is always "emoji".

func (ReactionTypeEmoji) ImplementsReactionType added in v3.28.0

func (i ReactionTypeEmoji) ImplementsReactionType()

type ReplyKeyboardMarkup

type ReplyKeyboardMarkup struct {
	InputFieldPlaceholder string             `json:"input_field_placeholder,omitempty"`
	Keyboard              [][]KeyboardButton `json:"keyboard"`
	IsPersistent          bool               `json:"is_persistent,omitempty"`
	ResizeKeyboard        bool               `json:"resize_keyboard,omitempty"`
	OneTimeKeyboard       bool               `json:"one_time_keyboard,omitempty"`
	Selective             bool               `json:"selective,omitempty"`
}

ReplyKeyboardMarkup represents a custom keyboard with reply options.

func (ReplyKeyboardMarkup) ImplementsReplyMarkup

func (i ReplyKeyboardMarkup) ImplementsReplyMarkup()

ImplementsReplyMarkup is a dummy method which exists to implement the interface ReplyMarkup.

type ReplyKeyboardRemove

type ReplyKeyboardRemove struct {
	RemoveKeyboard bool `json:"remove_keyboard"`
	Selective      bool `json:"selective"`
}

ReplyKeyboardRemove is used to 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). RemoveKeyboard MUST BE true.

func (ReplyKeyboardRemove) ImplementsReplyMarkup

func (r ReplyKeyboardRemove) ImplementsReplyMarkup()

ImplementsReplyMarkup is a dummy method which exists to implement the interface ReplyMarkup.

type ReplyMarkup

type ReplyMarkup interface {
	ImplementsReplyMarkup()
}

ReplyMarkup is an interface for the various keyboard types.

type ReplyParameters added in v3.28.0

type ReplyParameters struct {
	Quote                    string          `json:"quote,omitempty"`
	QuoteParseMode           string          `json:"quote_parse_mode,omitempty"`
	QuoteEntities            []MessageEntity `json:"quote_entitites,omitempty"`
	MessageID                int             `json:"message_id"`
	ChatID                   int64           `json:"chat_id,omitempty"`
	QuotePosition            int             `json:"quote_position,omitempty"`
	AllowSendingWithoutReply bool            `json:"allow_sending_without_reply,omitempty"`
}

ReplyParameters describes reply parameters for the message that is being sent.

type ResponseParameters

type ResponseParameters struct {
	MigrateToChatID int `json:"migrate_to_chat_id,omitempty"`
	RetryAfter      int `json:"retry_after,omitempty"`
}

ResponseParameters contains information about why a request was unsuccessful.

type RestrictOptions added in v3.5.0

type RestrictOptions struct {
	UseIndependentChatPermissions bool `query:"use_independent_chat_permissions"`
	UntilDate                     int  `query:"until_date"`
}

RestrictOptions contains the optional parameters used by the RestrictChatMember method.

type SentWebAppMessage added in v3.18.0

type SentWebAppMessage struct {
	InlineMessageID string `json:"inline_message_id,omitempty"`
}

SentWebAppMessage contains information about an inline message sent by a Web App on behalf of a user.

type SetChatMenuButtonOptions added in v3.18.0

type SetChatMenuButtonOptions struct {
	MenuButton MenuButton `query:"menu_button"`
	ChatID     int64      `query:"chat_id"`
}

SetChatMenuButtonOptions contains the optional parameters used by the SetChatMenuButton method.

type SetMyDefaultAdministratorRightsOptions added in v3.18.0

type SetMyDefaultAdministratorRightsOptions struct {
	Rights      ChatAdministratorRights `query:"rights"`
	ForChannels bool                    `query:"for_channels"`
}

SetMyDefaultAdministratorRightsOptions contains the optional parameters used by the SetMyDefaultAdministratorRights method.

type SharedUser added in v3.30.0

type SharedUser struct {
	Photo     *[]PhotoSize `json:"photo,omitempty"`
	FirstName string       `json:"firstname,omitempty"`
	LastName  string       `json:"lastname,omitempty"`
	Username  string       `json:"username,omitempty"`
	UserID    int64        `json:"user_id"`
}

SharedUser contains information about a user that was shared with the bot using a KeyboardButtonRequestUser button.

type ShippingAddress added in v3.15.0

type ShippingAddress struct {
	// ISO 3166-1 alpha-2 country code.
	CountryCode string `json:"country_code"`
	State       string `json:"state"`
	City        string `json:"city"`
	StreetLine1 string `json:"street_line1"`
	StreetLine2 string `json:"street_line2"`
	PostCode    string `json:"post_code"`
}

ShippingAddress represents a shipping address.

type ShippingOption added in v3.15.0

type ShippingOption struct {
	ID     string         `query:"id"`
	Title  string         `query:"title"`
	Prices []LabeledPrice `query:"prices"`
}

ShippingOption represents one shipping option.

type ShippingQuery added in v3.15.0

type ShippingQuery struct {
	ShippingAddress ShippingAddress `json:"shipping_address"`
	ID              string          `json:"id"`
	InvoicePayload  string          `json:"invoice_payload"`
	From            User            `json:"from"`
}

ShippingQuery contains information about an incoming shipping query.

type ShippingQueryOptions added in v3.15.0

type ShippingQueryOptions struct {
	ErrorMessage    string           `query:"error_message"`
	ShippingOptions []ShippingOption `query:"shipping_options"`
}

ShippingQueryOptions contains the optional parameters used by the AnswerShippingQuery API method.

type Sticker

type Sticker struct {
	Thumbnail        *PhotoSize     `json:"thumbnail,omitempty"`
	MaskPosition     *MaskPosition  `json:"mask_position,omitempty"`
	Type             StickerSetType `json:"type"`
	FileUniqueID     string         `json:"file_unique_id"`
	SetName          string         `json:"set_name,omitempty"`
	FileID           string         `json:"file_id"`
	Emoji            string         `json:"emoji,omitempty"`
	CustomEmojiID    string         `json:"custom_emoji_id,omitempty"`
	PremiumAnimation File           `json:"premium_animation,omitempty"`
	FileSize         int            `json:"file_size,omitempty"`
	Width            int            `json:"width"`
	Height           int            `json:"height"`
	IsVideo          bool           `json:"is_video"`
	IsAnimated       bool           `json:"is_animated"`
	NeedsRepainting  bool           `json:"needs_repainting,omitempty"`
}

Sticker represents a sticker.

type StickerFormat added in v3.24.0

type StickerFormat string

StickerFormat is a custom type for the various sticker formats.

type StickerOptions added in v3.24.0

type StickerOptions struct {
	BusinessConnectionID string          `query:"business_connection_id"`
	Emoji                string          `query:"emoji"`
	ReplyMarkup          ReplyMarkup     `query:"reply_markup"`
	ReplyParameters      ReplyParameters `query:"reply_parameters"`
	MessageThreadID      int             `query:"message_thread_id"`
	DisableNotification  bool            `query:"disable_notification"`
	ProtectContent       bool            `query:"protect_content"`
}

StickerOptions contains the optional parameters used by the SendSticker method.

type StickerSet

type StickerSet struct {
	Thumbnail   *PhotoSize     `json:"thumbnail,omitempty"`
	Title       string         `json:"title"`
	Name        string         `json:"name"`
	StickerType StickerSetType `json:"sticker_type"`
	Stickers    []Sticker      `json:"stickers"`
}

StickerSet represents a sticker set.

type StickerSetType added in v3.20.0

type StickerSetType string

StickerSetType represents the type of a sticker or of the entire set

type Story added in v3.26.0

type Story struct {
	Chat Chat  `json:"chat"`
	ID   int64 `json:"id"`
}

Story represents a story.

type SuccessfulPayment added in v3.15.0

type SuccessfulPayment struct {
	OrderInfo               OrderInfo `json:"order_info"`
	Currency                string    `json:"currency"`
	InvoicePayload          string    `json:"invoice_payload"`
	ShippingOptionID        string    `json:"shipping_option_id"`
	TelegramPaymentChargeID string    `json:"telegram_payment_charge_id"`
	ProviderPaymentChargeID string    `json:"provider_payment_charge_id"`
	TotalAmount             int       `json:"total_amount"`
}

SuccessfulPayment contains basic information about a successful payment.

type SwitchInlineQueryChosenChat added in v3.25.0

type SwitchInlineQueryChosenChat struct {
	Query             string `json:"query,omitempty"`
	AllowUserChats    bool   `json:"allow_user_chats,omitempty"`
	AllowBotChats     bool   `json:"allow_bot_chats,omitempty"`
	AllowGroupChats   bool   `json:"allow_group_chats,omitempty"`
	AllowChannelChats bool   `json:"allow_channel_chats,omitempty"`
}

SwitchInlineQueryChosenChat represents an inline button that switches the current user to inline mode in a chosen chat, with an optional default inline query.

type TextQuote added in v3.28.0

type TextQuote struct {
	Entities *[]MessageEntity `json:"entities,omitempty"`
	Text     string           `json:"text"`
	Position int              `json:"position"`
	IsManual bool             `json:"is_manual,omitempty"`
}

TextQuote contains information about the quoted part of a message that is replied to by the given message.

type UnbanOptions added in v3.5.0

type UnbanOptions struct {
	OnlyIfBanned bool `query:"only_if_banned"`
}

UnbanOptions contains the optional parameters used by the UnbanChatMember method.

type Update

type Update struct {
	ChatJoinRequest         *ChatJoinRequest             `json:"chat_join_request,omitempty"`
	ChatBoost               *ChatBoostUpdated            `json:"chat_boost,omitempty"`
	RemovedChatBoost        *ChatBoostRemoved            `json:"removed_chat_boost,omitempty"`
	Message                 *Message                     `json:"message,omitempty"`
	EditedMessage           *Message                     `json:"edited_message,omitempty"`
	ChannelPost             *Message                     `json:"channel_post,omitempty"`
	EditedChannelPost       *Message                     `json:"edited_channel_post,omitempty"`
	BusinessConnection      *BusinessConnection          `json:"business_connection,omitempty"`
	BusinessMessage         *Message                     `json:"business_message,omitempty"`
	EditedBusinessMessage   *Message                     `json:"edited_business_message,omitempty"`
	DeletedBusinessMessages *BusinessMessagesDeleted     `json:"deleted_business_messages,omitempty"`
	MessageReaction         *MessageReactionUpdated      `json:"message_reaction,omitempty"`
	MessageReactionCount    *MessageReactionCountUpdated `json:"message_reaction_count,omitempty"`
	InlineQuery             *InlineQuery                 `json:"inline_query,omitempty"`
	ChosenInlineResult      *ChosenInlineResult          `json:"chosen_inline_result,omitempty"`
	CallbackQuery           *CallbackQuery               `json:"callback_query,omitempty"`
	ShippingQuery           *ShippingQuery               `json:"shipping_query,omitempty"`
	PreCheckoutQuery        *PreCheckoutQuery            `json:"pre_checkout_query,omitempty"`
	MyChatMember            *ChatMemberUpdated           `json:"my_chat_member,omitempty"`
	ChatMember              *ChatMemberUpdated           `json:"chat_member,omitempty"`
	ID                      int                          `json:"update_id"`
}

Update represents an incoming update. At most one of the optional parameters can be present in any given update.

func (Update) ChatID added in v3.23.3

func (u Update) ChatID() int64

ChatID returns the ID of the chat the update is coming from.

type UpdateOptions

type UpdateOptions struct {
	AllowedUpdates []UpdateType `query:"allowed_updates"`
	Offset         int          `query:"offset"`
	Limit          int          `query:"limit"`
	Timeout        int          `query:"timeout"`
}

UpdateOptions contains the optional parameters used by the GetUpdates method.

type UpdateType

type UpdateType string

UpdateType is a custom type for the various update types that a bot can be subscribed to.

type User

type User struct {
	FirstName               string `json:"first_name"`
	LastName                string `json:"last_name,omitempty"`
	Username                string `json:"username,omitempty"`
	LanguageCode            string `json:"language_code,omitempty"`
	ID                      int64  `json:"id"`
	IsBot                   bool   `json:"is_bot"`
	CanJoinGroups           bool   `json:"can_join_groups,omitempty"`
	CanReadAllGroupMessages bool   `json:"can_read_all_group_messages,omitempty"`
	SupportsInlineQueries   bool   `json:"supports_inline_queries,omitempty"`
	CanConnectToBusiness    bool   `json:"can_connect_to_business,omitempty"`
	IsPremium               bool   `json:"is_premium,omitempty"`
	AddedToAttachmentMenu   bool   `json:"added_to_attachment_menu,omitempty"`
}

User represents a Telegram user or bot.

type UserChatBoosts added in v3.28.0

type UserChatBoosts struct {
	Boosts []ChatBoost `json:"boosts"`
}

UserChatBoosts represents a list of boosts added to a chat by a user.

type UserProfileOptions added in v3.5.0

type UserProfileOptions struct {
	Offset int `query:"offset"`
	Limit  int `query:"limit"`
}

UserProfileOptions contains the optional parameters used by the GetUserProfilePhotos method.

type UserProfilePhotos

type UserProfilePhotos struct {
	Photos     [][]PhotoSize `json:"photos"`
	TotalCount int           `json:"total_count"`
}

UserProfilePhotos represents a user's profile pictures.

type UserShared added in v3.23.0

type UserShared struct {
	RequestID int   `json:"request_id"`
	UserID    int64 `json:"user_id"`
}

UserShared contains information about the user whose identifier was shared with the bot using a KeyboardButtonRequestUser button.

type UsersShared added in v3.28.0

type UsersShared struct {
	Users     []SharedUser `json:"users"`
	RequestID int          `json:"request_id"`
}

UsersShared contains information about the users whose identifiers were shared with the bot using a KeyboardButtonRequestUsers button.

type Venue

type Venue struct {
	Location        *Location `json:"location"`
	Title           string    `json:"title"`
	Address         string    `json:"address"`
	FoursquareID    string    `json:"foursquare_id,omitempty"`
	FoursquareType  string    `json:"foursquare_type,omitempty"`
	GooglePlaceID   string    `json:"google_place_id,omitempty"`
	GooglePlaceType string    `json:"google_place_type,omitempty"`
}

Venue represents a venue.

type VenueOptions added in v3.2.0

type VenueOptions struct {
	ReplyMarkup          ReplyMarkup     `query:"reply_markup"`
	BusinessConnectionID string          `query:"business_connection_id"`
	FoursquareID         string          `query:"foursquare_id"`
	FoursquareType       string          `query:"foursquare_type"`
	GooglePlaceType      string          `query:"google_place_type"`
	GooglePlaceID        string          `query:"google_place_id"`
	ReplyParameters      ReplyParameters `query:"reply_parameters"`
	MessageThreadID      int             `query:"message_thread_id"`
	DisableNotification  bool            `query:"disable_notification"`
	ProtectContent       bool            `query:"protect_content"`
}

VenueOptions contains the optional parameters used by the SendVenue method.

type Video

type Video struct {
	Thumbnail    *PhotoSize `json:"thumbnail,omitempty"`
	FileID       string     `json:"file_id"`
	FileUniqueID string     `json:"file_unique_id"`
	FileName     string     `json:"file_name,omitempty"`
	MimeType     string     `json:"mime_type,omitempty"`
	Width        int        `json:"width"`
	Height       int        `json:"height"`
	Duration     int        `json:"duration"`
	FileSize     int64      `json:"file_size,omitempty"`
}

Video represents a video file.

type VideoChatEnded added in v3.18.0

type VideoChatEnded struct {
	Duration int `json:"duration"`
}

VideoChatEnded represents a service message about a voice chat ended in the chat.

type VideoChatParticipantsInvited added in v3.18.0

type VideoChatParticipantsInvited struct {
	Users []*User `json:"users,omitempty"`
}

VideoChatParticipantsInvited represents a service message about new members invited to a voice chat.

type VideoChatScheduled added in v3.18.0

type VideoChatScheduled struct {
	StartDate int `json:"start_date"`
}

VideoChatScheduled represents a service message about a voice chat scheduled in the chat.

type VideoChatStarted added in v3.18.0

type VideoChatStarted struct{}

VideoChatStarted represents a service message about a voice chat started in the chat.

type VideoNote

type VideoNote struct {
	Thumbnail    *PhotoSize `json:"thumbnail,omitempty"`
	FileID       string     `json:"file_id"`
	FileUniqueID string     `json:"file_unique_id"`
	Length       int        `json:"length"`
	Duration     int        `json:"duration"`
	FileSize     int        `json:"file_size,omitempty"`
}

VideoNote represents a video message (available in Telegram apps as of v.4.0).

type VideoNoteOptions

type VideoNoteOptions struct {
	ReplyMarkup          ReplyMarkup `query:"reply_markup"`
	BusinessConnectionID string      `query:"business_connection_id"`
	Thumbnail            InputFile
	ReplyParameters      ReplyParameters `query:"reply_parameters"`
	MessageThreadID      int             `query:"message_thread_id"`
	Duration             int             `query:"duration"`
	Length               int             `query:"length"`
	DisableNotification  bool            `query:"disable_notification"`
	ProtectContent       bool            `query:"protect_content"`
}

VideoNoteOptions contains the optional parameters used by the SendVideoNote method.

type VideoOptions

type VideoOptions struct {
	ReplyMarkup          ReplyMarkup `query:"reply_markup"`
	BusinessConnectionID string      `query:"business_connection_id"`
	Caption              string      `query:"caption"`
	ParseMode            ParseMode   `query:"parse_mode"`
	Thumbnail            InputFile
	CaptionEntities      []MessageEntity `query:"caption_entities"`
	ReplyParameters      ReplyParameters `query:"reply_parameters"`
	MessageThreadID      int             `query:"message_thread_id"`
	Duration             int             `query:"duration"`
	Width                int             `query:"width"`
	Height               int             `query:"height"`
	HasSpoiler           bool            `query:"has_spoiler"`
	SupportsStreaming    bool            `query:"supports_streaming"`
	DisableNotification  bool            `query:"disable_notification"`
	ProtectContent       bool            `query:"protect_content"`
}

VideoOptions contains the optional parameters used by the SendVideo method.

type Voice

type Voice struct {
	FileID       string `json:"file_id"`
	FileUniqueID string `json:"file_unique_id"`
	MimeType     string `json:"mime_type,omitempty"`
	Duration     int    `json:"duration"`
	FileSize     int64  `json:"file_size,omitempty"`
}

Voice represents a voice note.

type VoiceOptions

type VoiceOptions struct {
	ReplyMarkup          ReplyMarkup     `query:"reply_markup"`
	BusinessConnectionID string          `query:"business_connection_id"`
	ParseMode            ParseMode       `query:"parse_mode"`
	Caption              string          `query:"caption"`
	CaptionEntities      []MessageEntity `query:"caption_entities"`
	ReplyParameters      ReplyParameters `query:"reply_parameters"`
	MessageThreadID      int             `query:"message_thread_id"`
	Duration             int             `query:"duration"`
	DisableNotification  bool            `query:"disable_notification"`
	ProtectContent       bool            `query:"protect_content"`
}

VoiceOptions contains the optional parameters used by the SendVoice method.

type WebAppData added in v3.18.0

type WebAppData struct {
	Data       string `json:"data"`
	ButtonText string `json:"button_text"`
}

WebAppData contains data sent from a Web App to the bot.

type WebAppInfo added in v3.18.0

type WebAppInfo struct {
	URL string `json:"url"`
}

WebAppInfo contains information about a Web App.

type WebhookInfo

type WebhookInfo struct {
	URL                          string        `json:"url"`
	IPAddress                    string        `json:"ip_address,omitempty"`
	LastErrorMessage             string        `json:"last_error_message,omitempty"`
	AllowedUpdates               []*UpdateType `json:"allowed_updates,omitempty"`
	MaxConnections               int           `json:"max_connections,omitempty"`
	LastErrorDate                int64         `json:"last_error_date,omitempty"`
	LastSynchronizationErrorDate int64         `json:"last_synchronization_error_date,omitempty"`
	PendingUpdateCount           int           `json:"pending_update_count"`
	HasCustomCertificate         bool          `json:"has_custom_certificate"`
}

WebhookInfo contains information about the current status of a webhook.

type WebhookOptions

type WebhookOptions struct {
	IPAddress      string `query:"ip_address"`
	SecretToken    string `query:"secret_token"`
	Certificate    InputFile
	AllowedUpdates []UpdateType `query:"allowed_updates"`
	MaxConnections int          `query:"max_connections"`
}

WebhookOptions contains the optional parameters used by the SetWebhook method.

type WriteAccessAllowed added in v3.22.0

type WriteAccessAllowed struct {
	WebAppName         string `json:"web_app_name,omitempty"`
	FromRequest        bool   `json:"from_request,omitempty"`
	FromAttachmentMenu bool   `json:"from_attachment_menu,omitempty"`
}

WriteAccessAllowed represents a service message about a user allowing a bot added to the attachment menu to write messages.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL