bot

package module
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 17 Imported by: 72

README

Golang Telegram Bot

Go Report Card codecov

✅ Present in the list of libraries https://core.telegram.org/bots/samples#go

Telegram Group

Supports Bot API version: 7.2 from March 31, 2024

It's a Go zero-dependencies telegram bot framework

A simple example echo-bot:

package main

import (
	"context"
	"os"
	"os/signal"

	"github.com/go-telegram/bot"
	"github.com/go-telegram/bot/models"
)

// Send any text message to the bot after the bot has been started

func main() {
	ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt)
	defer cancel()

	opts := []bot.Option{
		bot.WithDefaultHandler(handler),
	}

	b, err := bot.New("YOUR_BOT_TOKEN_FROM_BOTFATHER", opts...)
	if err != nil {
		panic(err)
	}

	b.Start(ctx)
}

func handler(ctx context.Context, b *bot.Bot, update *models.Update) {
	b.SendMessage(ctx, &bot.SendMessageParams{
		ChatID: update.Message.Chat.ID,
		Text:   update.Message.Text,
	})
}

You can find more examples in the examples folder.

For test examples, you should set environment variable EXAMPLE_TELEGRAM_BOT_TOKEN to your bot token.

Getting started

Go version: 1.18

Install the dependencies:

go get -u github.com/go-telegram/bot

Initialize and run the bot:

b, err := bot.New("YOUR_BOT_TOKEN_FROM_BOTFATHER")

b.Start(context.TODO())

On create bot will call the getMe method (with 5 sec timeout). And returns error on fail. If you want to change this timeout, use option bot.WithCheckInitTimeout

You can to define default handler for the bot:

b, err := bot.New("YOUR_BOT_TOKEN_FROM_BOTFATHER", bot.WithDefaultHandler(handler))

func handler(ctx context.Context, b *bot.Bot, update *models.Update) {
	// this handler will be called for all updates
}

Webhooks

If you want to use webhooks, instead bot.Start you should use bot.StartWebhook method for start the bot. Also, you should to use bot.WebhookHandler() method as http handler for your server.

func main() {
	ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt)
	defer cancel()

	opts := []bot.Option{
		bot.WithDefaultHandler(handler),
	}

	b, _ := bot.New(os.Getenv("EXAMPLE_TELEGRAM_BOT_TOKEN"), opts...)

	// call methods.SetWebhook if needed
	
	go b.StartWebhook(ctx)

	http.ListenAndServe(":2000", b.WebhookHandler())

	// call methods.DeleteWebhook if needed
}

func handler(ctx context.Context, b *bot.Bot, update *models.Update) {
	b.SendMessage(ctx, &bot.SendMessageParams{
		ChatID: update.Message.Chat.ID,
		Text:   update.Message.Text,
	})
}

Demo in examples

Also, you can manually process updates with bot.ProcessUpdate method.

update := models.Update{}

json.NewDecoder(req.Body).Decode(&update)

b.ProcessUpdate(ctx, &update)

Middlewares

You can use middlewares with WithMiddlewares(middlewares ...Middleware) option.

See an example in examples

Available methods

All available methods are listed in the Telegram Bot API documentation

You can use all these methods as bot funcs. All methods have name like in official documentation, but with capital first letter.

bot.SendMessage, bot.GetMe, bot.SendPhoto, etc

All methods have signature (ctx context.Context, params <PARAMS>) (<response>, error). Except GetMe, Close and Logout which are have not params

<PARAMS> is a struct with fields that corresponds to Telegram Bot API parameters. All Params structs have name like for corresponded methods, but with Params suffix.

SendMessageParams for SendMessage method etc.

You should pass params by pointer

bot.SendMessage(ctx, &bot.SendMessageParams{...})

Options

You can use options to customize the bot.

b, err := bot.New("YOUR_BOT_TOKEN_FROM_BOTFATHER", opts...)
Options list (see options.go for more details)
  • WithCheckInitTimeout(timeout time.Duration) - timeout for check init bot
  • WithMiddlewares(middlewares ...Middleware) - add middlewares
  • WithMessageTextHandler(pattern string, matchType MatchType, handler HandlerFunc) - add handler for Message.Text field
  • WithCallbackQueryDataHandler(pattern string, matchType MatchType, handler HandlerFunc) - add handler for CallbackQuery.Data field
  • WithDefaultHandler(handler HandlerFunc) - add default handler
  • WithDebug() - enable debug mode
  • WithErrorsHandler(handler ErrorsHandler) - add errors handler
  • WithDebugHandler(handler DebugHandler) - add debug handler
  • WithHTTPClient(pollTimeout time.Duration, client HttpClient) - set custom http client
  • WithServerURL(serverURL string) - set server url
  • WithSkipGetMe() - skip call GetMe on bot init
  • WithAllowedUpdates(params AllowedUpdates) - set allowed_updates for getUpdates method
  • WithUpdatesChannelCap(cap int) - set updates channel capacity, by default 1024

Message.Text and CallbackQuery.Data handlers

For your convenience, you can use Message.Text and CallbackQuery.Data handlers.

An example:

b, err := bot.New("YOUR_BOT_TOKEN_FROM_BOTFATHER")

b.RegisterHandler(bot.HandlerTypeMessageText, "/start", bot.MatchTypeExact, myStartHandler)

b.Start(context.TODO())

also you can use bot init options WithMessageTextHandler and WithCallbackQueryDataHandler

In this example, the handler will be called when the user sends /start message. All other messages will be handled by the default handler.

Handler Types:

  • HandlerTypeMessageText - for Update.Message.Text field
  • HandlerTypeCallbackQueryData - for Update.CallbackQuery.Data field

RegisterHandler returns a handler ID string. You can use it to remove the handler later.

b.UnregisterHandler(handlerID)

Match Types:

  • MatchTypeExact
  • MatchTypePrefix
  • MatchTypeContains

You can use RegisterHandlerRegexp to match by regular expression.

re := regexp.MustCompile(`^/start`)

b.RegisterHandlerRegexp(bot.HandlerTypeMessageText, re, myStartHandler)

If you want to use custom handler, use RegisterHandlerMatchFunc

matchFunc := func(update *models.Update) bool {
	// your checks
	return true
}

b.RegisterHandlerMatchFunc(bot.HandlerTypeMessageText, matchFunc, myHandler)

InputFile

For some methods, like SendPhoto, SendAudio etc, you can send file by file path or file contents.

For send file by URL or FileID, you can use &models.InputFileString{Data: string}:

// file id of uploaded image 
inputFileData := "AgACAgIAAxkDAAIBOWJimnCJHQJiJ4P3aasQCPNyo6mlAALDuzEbcD0YSxzjB-vmkZ6BAQADAgADbQADJAQ"
// or URL image path
// inputFileData := "https://example.com/image.png"

params := &bot.SendPhotoParams{
    ChatID:  chatID,
    Photo:   &models.InputFileString{Data: inputFileData},
}

bot.SendPhoto(ctx, params)

Demo in examples

For send image file by file contents, you can use &models.InputFileUpload{Filename: string, Data: io.Reader}:

fileContent, _ := os.ReadFile("/path/to/image.png")

params := &bot.SendPhotoParams{
    ChatID:  chatID,
    Photo:   &models.InputFileUpload{Filename: "image.png", Data: bytes.NewReader(fileContent)},
}

bot.SendPhoto(ctx, params)

Demo in examples

InputMedia

For methods like SendMediaGroup or EditMessageMedia you can send media by file path or file contents.

Official documentation InputMedia

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

If you want to use attach:// format, you should to define MediaAttachment field with file content reader.

fileConetent, _ := os.ReadFile("/path/to/image.png")

media1 := &models.InputMediaPhoto{
	Media: "https://telegram.org/img/t_logo.png",
}

media2 := &models.InputMediaPhoto{
	Media: "attach://image.png", 
	Caption: "2",
	MediaAttachment: bytes.NewReader(fileConetent),
}

params := &bot.SendMediaGroupParams{
    ChatID: update.Message.Chat.ID,
    Media: []models.InputMedia{
        media1,
        media2,
    },
}

bot.SendMediaGroup(ctx, params)

Demo in examples

Helpers

EscapeMarkdown(s string) string

Escape special symbols for Telegram MarkdownV2 syntax

EscapeMarkdownUnescaped(s string) string

Escape only unescaped special symbols for Telegram MarkdownV2 syntax

RandomString(n int) string

Returns fast random a-zA-Z string with n length

True() bool, False() bool

Allows you to define *bool values for params, which require *bool, like SendPoolParams

p := &bot.SendPollParams{
    ChatID: chatID,
    Question: "Question",
    Options: []string{"Option 1", "Option 2"},
    IsAnonymous: bot.False(),
}

b.SendPool(ctx, p)

Return file download link after call method GetFile

See [documentation(https://core.telegram.org/bots/api#getfile)

Errors

This library includes error handling. It provides the following error types:

  • ErrorForbidden (403): This error occurs when the bot has no access to the action, such as when the user has blocked the bot.
  • ErrorBadRequest (400): This error indicates a bad request made to the bot's API.
  • ErrorUnauthorized (401): This error occurs when the bot's access is unauthorized for the requested action.
  • TooManyRequestsError: (429) This error indicates that the bot has received too many requests within a short period. It includes a RetryAfter value indicating when to retry the request.
  • ErrorNotFound (404): This error indicates that the requested resource was not found.
  • ErrorConflict (409): This error indicates a conflict occurred during the request.

Usage:

_, err := b.SendMessage(...)

if errors.Is(err, mybot.ErrorForbidden) {
    // Handle the ErrorForbidden (403) case here
}

if errors.Is(err, mybot.ErrorBadRequest) {
    // Handle the ErrorBadRequest (400) case here
}

if errors.Is(err, mybot.ErrorUnauthorized) {
    // Handle the ErrorUnauthorized (401) case here
}

if mybot.IsTooManyRequestsError(err) {
    // Handle the TooManyRequestsError (429) case here
    fmt.Println("Received TooManyRequestsError with retry_after:", err.(*mybot.TooManyRequestsError).RetryAfter)
}

if errors.Is(err, mybot.ErrorNotFound) {
    // Handle the ErrorNotFound (404) case here
}

if errors.Is(err, mybot.ErrorConflict) {
    // Handle the ErrorConflict (409) case here
}

UI Components

In the repo https://github.com/go-telegram/ui you can find a some UI elements for your bot.

  • datepicker
  • inline_keyboard
  • slider
  • paginator

and more...

Please, check the repo for more information and live demo.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorForbidden       = errors.New("forbidden")
	ErrorBadRequest      = errors.New("bad request")
	ErrorUnauthorized    = errors.New("unauthorized")
	ErrorTooManyRequests = errors.New("too many requests")
	ErrorNotFound        = errors.New("not found")
	ErrorConflict        = errors.New("conflict")
)

Functions

func EscapeMarkdown

func EscapeMarkdown(s string) string

EscapeMarkdown escapes special symbols for Telegram MarkdownV2 syntax

func EscapeMarkdownUnescaped added in v0.4.1

func EscapeMarkdownUnescaped(s string) string

EscapeMarkdownUnescaped escapes unescaped special symbols for Telegram Markdown v2 syntax

func False added in v0.7.4

func False() *bool

func IsMigrateError added in v1.2.1

func IsMigrateError(err error) bool

func IsTooManyRequestsError added in v1.2.1

func IsTooManyRequestsError(err error) bool

func RandomString

func RandomString(n int) string

RandomString returns random a-zA-Z string with n length

func True added in v0.7.4

func True() *bool

Types

type AddStickerToSetParams

type AddStickerToSetParams struct {
	UserID  int64               `json:"user_id"`
	Name    string              `json:"name"`
	Sticker models.InputSticker `json:"sticker"`
}

type AllowedUpdates added in v1.1.5

type AllowedUpdates []string

type AnswerCallbackQueryParams

type AnswerCallbackQueryParams struct {
	CallbackQueryID string `json:"callback_query_id"`
	Text            string `json:"text,omitempty"`
	ShowAlert       bool   `json:"show_alert,omitempty"`
	URL             string `json:"url,omitempty"`
	CacheTime       int    `json:"cache_time,omitempty"`
}

type AnswerInlineQueryParams

type AnswerInlineQueryParams struct {
	InlineQueryID string                           `json:"inline_query_id"`
	Results       []models.InlineQueryResult       `json:"results"`
	CacheTime     int                              `json:"cache_time,omitempty"`
	IsPersonal    bool                             `json:"is_personal,omitempty"`
	NextOffset    string                           `json:"next_offset,omitempty"`
	Button        *models.InlineQueryResultsButton `json:"button,omitempty"`
}

type AnswerPreCheckoutQueryParams

type AnswerPreCheckoutQueryParams struct {
	PreCheckoutQueryID string `json:"pre_checkout_query_id"`
	OK                 bool   `json:"ok"`
	ErrorMessage       string `json:"error_message,omitempty"`
}

type AnswerShippingQueryParams

type AnswerShippingQueryParams struct {
	ShippingQueryID string                  `json:"shipping_query_id"`
	OK              bool                    `json:"ok"`
	ShippingOptions []models.ShippingOption `json:"shipping_options,omitempty"`
	ErrorMessage    string                  `json:"error_message,omitempty"`
}

type AnswerWebAppQueryParams

type AnswerWebAppQueryParams struct {
	WebAppQueryID string                   `json:"web_app_query_id"`
	Result        models.InlineQueryResult `json:"result"`
}

type ApproveChatJoinRequestParams

type ApproveChatJoinRequestParams struct {
	ChatID any   `json:"chat_id"`
	UserID int64 `json:"user_id"`
}

type BanChatMemberParams

type BanChatMemberParams struct {
	ChatID         any   `json:"chat_id"`
	UserID         int64 `json:"user_id"`
	UntilDate      int   `json:"until_date,omitempty"`
	RevokeMessages bool  `json:"revoke_messages,omitempty"`
}

type BanChatSenderChatParams

type BanChatSenderChatParams struct {
	ChatID       any `json:"chat_id"`
	SenderChatID int `json:"sender_chat_id"`
}

type Bot

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

Bot represents Telegram Bot main object

func New

func New(token string, options ...Option) (*Bot, error)

New creates new Bot instance

func (*Bot) AddStickerToSet

func (b *Bot) AddStickerToSet(ctx context.Context, params *AddStickerToSetParams) (bool, error)

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

func (*Bot) AnswerCallbackQuery

func (b *Bot) AnswerCallbackQuery(ctx context.Context, params *AnswerCallbackQueryParams) (bool, error)

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

func (*Bot) AnswerInlineQuery

func (b *Bot) AnswerInlineQuery(ctx context.Context, params *AnswerInlineQueryParams) (bool, error)

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

func (*Bot) AnswerPreCheckoutQuery

func (b *Bot) AnswerPreCheckoutQuery(ctx context.Context, params *AnswerPreCheckoutQueryParams) (bool, error)

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

func (*Bot) AnswerShippingQuery

func (b *Bot) AnswerShippingQuery(ctx context.Context, params *AnswerShippingQueryParams) (bool, error)

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

func (*Bot) ApproveChatJoinRequest

func (b *Bot) ApproveChatJoinRequest(ctx context.Context, params *ApproveChatJoinRequestParams) (bool, error)

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

func (*Bot) BanChatMember

func (b *Bot) BanChatMember(ctx context.Context, params *BanChatMemberParams) (bool, error)

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

func (*Bot) BanChatSenderChat

func (b *Bot) BanChatSenderChat(ctx context.Context, params *BanChatSenderChatParams) (bool, error)

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

func (*Bot) Close

func (b *Bot) Close(ctx context.Context) (bool, error)

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

func (*Bot) CloseForumTopic added in v0.3.1

func (b *Bot) CloseForumTopic(ctx context.Context, params *CloseForumTopicParams) (bool, error)

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

func (*Bot) CloseGeneralForumTopic added in v0.3.4

func (b *Bot) CloseGeneralForumTopic(ctx context.Context, params *CloseGeneralForumTopicParams) (bool, error)

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

func (*Bot) CopyMessages added in v1.0.0

func (b *Bot) CopyMessages(ctx context.Context, params *CopyMessagesParams) ([]models.MessageID, error)

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

func (*Bot) CreateForumTopic added in v0.3.1

func (b *Bot) CreateForumTopic(ctx context.Context, params *CreateForumTopicParams) (*models.ForumTopic, error)

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

func (b *Bot) CreateInvoiceLink(ctx context.Context, params *CreateInvoiceLinkParams) (string, error)

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

func (*Bot) CreateNewStickerSet

func (b *Bot) CreateNewStickerSet(ctx context.Context, params *CreateNewStickerSetParams) (bool, error)

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

func (*Bot) DeclineChatJoinRequest

func (b *Bot) DeclineChatJoinRequest(ctx context.Context, params *DeclineChatJoinRequestParams) (bool, error)

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

func (*Bot) DeleteChatPhoto

func (b *Bot) DeleteChatPhoto(ctx context.Context, params *DeleteChatPhotoParams) (bool, error)

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

func (*Bot) DeleteChatStickerSet

func (b *Bot) DeleteChatStickerSet(ctx context.Context, params *DeleteChatStickerSetParams) (bool, error)

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

func (*Bot) DeleteForumTopic added in v0.3.1

func (b *Bot) DeleteForumTopic(ctx context.Context, params *DeleteForumTopicParams) (bool, error)

DeleteForumTopic https://core.telegram.org/bots/api#unpinallforumtopicmessages

func (*Bot) DeleteMessage

func (b *Bot) DeleteMessage(ctx context.Context, params *DeleteMessageParams) (bool, error)

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

func (*Bot) DeleteMessages added in v1.0.0

func (b *Bot) DeleteMessages(ctx context.Context, params *DeleteMessagesParams) (bool, error)

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

func (*Bot) DeleteMyCommands

func (b *Bot) DeleteMyCommands(ctx context.Context, params *DeleteMyCommandsParams) (bool, error)

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

func (*Bot) DeleteStickerFromSet

func (b *Bot) DeleteStickerFromSet(ctx context.Context, params *DeleteStickerFromSetParams) (bool, error)

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

func (*Bot) DeleteStickerSet added in v0.7.0

func (b *Bot) DeleteStickerSet(ctx context.Context, params *DeleteStickerSetParams) (bool, error)

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

func (*Bot) DeleteWebhook

func (b *Bot) DeleteWebhook(ctx context.Context, params *DeleteWebhookParams) (bool, error)

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

func (*Bot) EditForumTopic added in v0.3.1

func (b *Bot) EditForumTopic(ctx context.Context, params *EditForumTopicParams) (bool, error)

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

func (*Bot) EditGeneralForumTopic added in v0.3.4

func (b *Bot) EditGeneralForumTopic(ctx context.Context, params *EditGeneralForumTopicParams) (bool, error)

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

func (*Bot) EditMessageCaption

func (b *Bot) EditMessageCaption(ctx context.Context, params *EditMessageCaptionParams) (*models.Message, error)

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

func (*Bot) EditMessageLiveLocation

func (b *Bot) EditMessageLiveLocation(ctx context.Context, params *EditMessageLiveLocationParams) (*models.Message, error)

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

func (*Bot) EditMessageMedia

func (b *Bot) EditMessageMedia(ctx context.Context, params *EditMessageMediaParams) (*models.Message, error)

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

func (*Bot) EditMessageReplyMarkup

func (b *Bot) EditMessageReplyMarkup(ctx context.Context, params *EditMessageReplyMarkupParams) (*models.Message, error)

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

func (*Bot) EditMessageText

func (b *Bot) EditMessageText(ctx context.Context, params *EditMessageTextParams) (*models.Message, error)

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

func (b *Bot) ExportChatInviteLink(ctx context.Context, params *ExportChatInviteLinkParams) (string, error)

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

func (b *Bot) FileDownloadLink(f *models.File) string

FileDownloadLink returns the file download link

func (*Bot) ForwardMessage

func (b *Bot) ForwardMessage(ctx context.Context, params *ForwardMessageParams) (*models.Message, error)

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

func (*Bot) ForwardMessages added in v1.0.0

func (b *Bot) ForwardMessages(ctx context.Context, params *ForwardMessagesParams) ([]models.MessageID, error)

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

func (*Bot) GetChat

func (b *Bot) GetChat(ctx context.Context, params *GetChatParams) (*models.Chat, error)

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

func (*Bot) GetChatAdministrators

func (b *Bot) GetChatAdministrators(ctx context.Context, params *GetChatAdministratorsParams) ([]models.ChatMember, error)

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

func (*Bot) GetChatMemberCount

func (b *Bot) GetChatMemberCount(ctx context.Context, params *GetChatMemberCountParams) (int, error)

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

func (*Bot) GetCustomEmojiStickers

func (b *Bot) GetCustomEmojiStickers(ctx context.Context, params *GetCustomEmojiStickersParams) ([]*models.Sticker, error)

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

func (*Bot) GetFile

func (b *Bot) GetFile(ctx context.Context, params *GetFileParams) (*models.File, error)

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

func (*Bot) GetForumTopicIconStickers added in v0.3.1

func (b *Bot) GetForumTopicIconStickers(ctx context.Context) ([]*models.Sticker, error)

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

func (*Bot) GetMe

func (b *Bot) GetMe(ctx context.Context) (*models.User, error)

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

func (*Bot) GetMyCommands

func (b *Bot) GetMyCommands(ctx context.Context, params *GetMyCommandsParams) ([]models.BotCommand, error)

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

func (*Bot) GetMyDescription added in v0.7.0

func (b *Bot) GetMyDescription(ctx context.Context, params *GetMyDescriptionParams) (models.BotDescription, error)

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

func (*Bot) GetMyName added in v0.7.6

func (b *Bot) GetMyName(ctx context.Context, params *GetMyNameParams) (models.BotName, error)

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

func (*Bot) GetMyShortDescription added in v0.7.0

func (b *Bot) GetMyShortDescription(ctx context.Context, params *GetMyShortDescriptionParams) (models.BotShortDescription, error)

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

func (*Bot) GetUserChatBoosts added in v1.0.0

func (b *Bot) GetUserChatBoosts(ctx context.Context, params *GetUserChatBoostsParams) (*models.UserChatBoosts, error)

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

func (*Bot) GetWebhookInfo

func (b *Bot) GetWebhookInfo(ctx context.Context) (*models.WebhookInfo, error)

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

func (*Bot) HideGeneralForumTopic added in v0.3.4

func (b *Bot) HideGeneralForumTopic(ctx context.Context, params *HideGeneralForumTopicParams) (bool, error)

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

func (*Bot) LeaveChat

func (b *Bot) LeaveChat(ctx context.Context, params *LeaveChatParams) (bool, error)

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

func (*Bot) Logout

func (b *Bot) Logout(ctx context.Context) (bool, error)

Logout https://core.telegram.org/bots/api#logout

func (*Bot) PinChatMessage

func (b *Bot) PinChatMessage(ctx context.Context, params *PinChatMessageParams) (bool, error)

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

func (*Bot) ProcessUpdate added in v0.7.3

func (b *Bot) ProcessUpdate(ctx context.Context, upd *models.Update)

ProcessUpdate allows you to process update

func (*Bot) PromoteChatMember

func (b *Bot) PromoteChatMember(ctx context.Context, params *PromoteChatMemberParams) (bool, error)

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

func (*Bot) RegisterHandler

func (b *Bot) RegisterHandler(handlerType HandlerType, pattern string, matchType MatchType, f HandlerFunc) string

func (*Bot) RegisterHandlerMatchFunc added in v0.3.3

func (b *Bot) RegisterHandlerMatchFunc(matchFunc MatchFunc, f HandlerFunc) string

func (*Bot) RegisterHandlerRegexp

func (b *Bot) RegisterHandlerRegexp(handlerType HandlerType, re *regexp.Regexp, f HandlerFunc) string

func (*Bot) ReopenForumTopic added in v0.3.1

func (b *Bot) ReopenForumTopic(ctx context.Context, params *ReopenForumTopicParams) (bool, error)

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

func (*Bot) ReopenGeneralForumTopic added in v0.3.4

func (b *Bot) ReopenGeneralForumTopic(ctx context.Context, params *ReopenGeneralForumTopicParams) (bool, error)

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

func (*Bot) ReplaceStickerInSet added in v1.2.0

func (b *Bot) ReplaceStickerInSet(ctx context.Context, params *ReplaceStickerInSetParams) (bool, error)

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

func (*Bot) RestrictChatMember

func (b *Bot) RestrictChatMember(ctx context.Context, params *RestrictChatMemberParams) (bool, error)

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

func (*Bot) SendAnimation

func (b *Bot) SendAnimation(ctx context.Context, params *SendAnimationParams) (*models.Message, error)

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

func (*Bot) SendAudio

func (b *Bot) SendAudio(ctx context.Context, params *SendAudioParams) (*models.Message, error)

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

func (*Bot) SendChatAction

func (b *Bot) SendChatAction(ctx context.Context, params *SendChatActionParams) (bool, error)

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

func (*Bot) SendContact

func (b *Bot) SendContact(ctx context.Context, params *SendContactParams) (*models.Message, error)

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

func (*Bot) SendDice

func (b *Bot) SendDice(ctx context.Context, params *SendDiceParams) (*models.Message, error)

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

func (*Bot) SendDocument

func (b *Bot) SendDocument(ctx context.Context, params *SendDocumentParams) (*models.Message, error)

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

func (*Bot) SendGame

func (b *Bot) SendGame(ctx context.Context, params *SendGameParams) (*models.Message, error)

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

func (*Bot) SendInvoice

func (b *Bot) SendInvoice(ctx context.Context, params *SendInvoiceParams) (*models.Message, error)

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

func (*Bot) SendLocation

func (b *Bot) SendLocation(ctx context.Context, params *SendLocationParams) (*models.Message, error)

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

func (*Bot) SendMediaGroup

func (b *Bot) SendMediaGroup(ctx context.Context, params *SendMediaGroupParams) ([]*models.Message, error)

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

func (*Bot) SendMessage

func (b *Bot) SendMessage(ctx context.Context, params *SendMessageParams) (*models.Message, error)

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

func (*Bot) SendPhoto

func (b *Bot) SendPhoto(ctx context.Context, params *SendPhotoParams) (*models.Message, error)

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

func (*Bot) SendPoll

func (b *Bot) SendPoll(ctx context.Context, params *SendPollParams) (*models.Message, error)

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

func (*Bot) SendSticker

func (b *Bot) SendSticker(ctx context.Context, params *SendStickerParams) (*models.Message, error)

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

func (*Bot) SendVenue

func (b *Bot) SendVenue(ctx context.Context, params *SendVenueParams) (*models.Message, error)

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

func (*Bot) SendVideo

func (b *Bot) SendVideo(ctx context.Context, params *SendVideoParams) (*models.Message, error)

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

func (*Bot) SendVideoNote

func (b *Bot) SendVideoNote(ctx context.Context, params *SendVideoNoteParams) (*models.Message, error)

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

func (*Bot) SendVoice

func (b *Bot) SendVoice(ctx context.Context, params *SendVoiceParams) (*models.Message, error)

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

func (*Bot) SetChatAdministratorCustomTitle

func (b *Bot) SetChatAdministratorCustomTitle(ctx context.Context, params *SetChatAdministratorCustomTitleParams) (bool, error)

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

func (*Bot) SetChatDescription

func (b *Bot) SetChatDescription(ctx context.Context, params *SetChatDescriptionParams) (bool, error)

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

func (*Bot) SetChatMenuButton

func (b *Bot) SetChatMenuButton(ctx context.Context, params *SetChatMenuButtonParams) (bool, error)

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

func (*Bot) SetChatPermissions

func (b *Bot) SetChatPermissions(ctx context.Context, params *SetChatPermissionsParams) (bool, error)

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

func (*Bot) SetChatPhoto

func (b *Bot) SetChatPhoto(ctx context.Context, params *SetChatPhotoParams) (bool, error)

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

func (*Bot) SetChatStickerSet

func (b *Bot) SetChatStickerSet(ctx context.Context, params *SetChatStickerSetParams) (bool, error)

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

func (*Bot) SetChatTitle

func (b *Bot) SetChatTitle(ctx context.Context, params *SetChatTitleParams) (bool, error)

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

func (*Bot) SetCustomEmojiStickerSetThumbnail added in v0.7.0

func (b *Bot) SetCustomEmojiStickerSetThumbnail(ctx context.Context, params *SetCustomEmojiStickerSetThumbnailParams) (bool, error)

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

func (*Bot) SetGameScore

func (b *Bot) SetGameScore(ctx context.Context, params *SetGameScoreParams) (*models.Message, error)

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

func (*Bot) SetMessageReaction added in v1.0.0

func (b *Bot) SetMessageReaction(ctx context.Context, params *SetMessageReactionParams) (bool, error)

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

func (*Bot) SetMyCommands

func (b *Bot) SetMyCommands(ctx context.Context, params *SetMyCommandsParams) (bool, error)

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

func (*Bot) SetMyDefaultAdministratorRights

func (b *Bot) SetMyDefaultAdministratorRights(ctx context.Context, params *SetMyDefaultAdministratorRightsParams) (bool, error)

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

func (*Bot) SetMyDescription added in v0.7.0

func (b *Bot) SetMyDescription(ctx context.Context, params *SetMyDescriptionParams) (bool, error)

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

func (*Bot) SetMyName added in v0.7.6

func (b *Bot) SetMyName(ctx context.Context, params *SetMyNameParams) (bool, error)

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

func (*Bot) SetMyShortDescription added in v0.7.0

func (b *Bot) SetMyShortDescription(ctx context.Context, params *SetMyShortDescriptionParams) (bool, error)

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

func (*Bot) SetPassportDataErrors

func (b *Bot) SetPassportDataErrors(ctx context.Context, params *SetPassportDataErrorsParams) (bool, error)

SetPassportDataErrors https://core.telegram.org/bots/api#setpassportdataerrors

func (*Bot) SetStickerEmojiList added in v0.7.0

func (b *Bot) SetStickerEmojiList(ctx context.Context, params *SetStickerEmojiListParams) (bool, error)

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

func (*Bot) SetStickerKeywords added in v0.7.0

func (b *Bot) SetStickerKeywords(ctx context.Context, params *SetStickerKeywordsParams) (bool, error)

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

func (*Bot) SetStickerMaskPosition added in v0.7.0

func (b *Bot) SetStickerMaskPosition(ctx context.Context, params *SetStickerMaskPositionParams) (bool, error)

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

func (*Bot) SetStickerPositionInSet

func (b *Bot) SetStickerPositionInSet(ctx context.Context, params *SetStickerPositionInSetParams) (bool, error)

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

func (*Bot) SetStickerSetThumbnail added in v0.7.0

func (b *Bot) SetStickerSetThumbnail(ctx context.Context, params *SetStickerSetThumbnailParams) (bool, error)

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

func (*Bot) SetStickerSetTitle added in v0.7.0

func (b *Bot) SetStickerSetTitle(ctx context.Context, params *SetStickerSetTitleParams) (bool, error)

SetStickerSetTitle https://core.telegram.org/bots/api#setstickermaskposition

func (*Bot) SetWebhook

func (b *Bot) SetWebhook(ctx context.Context, params *SetWebhookParams) (bool, error)

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

func (*Bot) Start

func (b *Bot) Start(ctx context.Context)

Start the bot

func (*Bot) StartWebhook

func (b *Bot) StartWebhook(ctx context.Context)

StartWebhook starts the Bot with webhook mode

func (*Bot) StopMessageLiveLocation

func (b *Bot) StopMessageLiveLocation(ctx context.Context, params *StopMessageLiveLocationParams) (*models.Message, error)

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

func (*Bot) StopPoll

func (b *Bot) StopPoll(ctx context.Context, params *StopPollParams) (*models.Poll, error)

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

func (*Bot) UnbanChatMember

func (b *Bot) UnbanChatMember(ctx context.Context, params *UnbanChatMemberParams) (bool, error)

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

func (*Bot) UnbanChatSenderChat

func (b *Bot) UnbanChatSenderChat(ctx context.Context, params *UnbanChatSenderChatParams) (bool, error)

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

func (*Bot) UnhideGeneralForumTopic added in v0.3.4

func (b *Bot) UnhideGeneralForumTopic(ctx context.Context, params *UnhideGeneralForumTopicParams) (bool, error)

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

func (*Bot) UnpinAllChatMessages

func (b *Bot) UnpinAllChatMessages(ctx context.Context, params *UnpinAllChatMessagesParams) (bool, error)

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

func (*Bot) UnpinAllForumTopicMessages added in v0.3.1

func (b *Bot) UnpinAllForumTopicMessages(ctx context.Context, params *UnpinAllForumTopicMessagesParams) (bool, error)

UnpinAllForumTopicMessages https://core.telegram.org/bots/api#deleteforumtopic

func (*Bot) UnpinAllGeneralForumTopicMessages added in v0.7.15

func (b *Bot) UnpinAllGeneralForumTopicMessages(ctx context.Context, params *UnpinAllGeneralForumTopicMessagesParams) (bool, error)

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

func (*Bot) UnpinChatMessage

func (b *Bot) UnpinChatMessage(ctx context.Context, params *UnpinChatMessageParams) (bool, error)

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

func (*Bot) UnregisterHandler

func (b *Bot) UnregisterHandler(id string)

func (*Bot) UploadStickerFile

func (b *Bot) UploadStickerFile(ctx context.Context, params *UploadStickerFileParams) (*models.File, error)

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

func (*Bot) WebhookHandler

func (b *Bot) WebhookHandler() http.HandlerFunc

type CloseForumTopicParams added in v0.3.1

type CloseForumTopicParams struct {
	ChatID          any `json:"chat_id"`
	MessageThreadID int `json:"message_thread_id"`
}

type CloseGeneralForumTopicParams added in v0.3.4

type CloseGeneralForumTopicParams struct {
	ChatID any `json:"chat_id"`
}

type CopyMessageParams

type CopyMessageParams struct {
	ChatID              any                     `json:"chat_id"`
	MessageThreadID     int                     `json:"message_thread_id,omitempty"`
	FromChatID          string                  `json:"from_chat_id"`
	MessageID           int                     `json:"message_id"`
	Caption             string                  `json:"caption,omitempty"`
	ParseMode           models.ParseMode        `json:"parse_mode,omitempty"`
	CaptionEntities     []models.MessageEntity  `json:"caption_entities,omitempty"`
	DisableNotification bool                    `json:"disable_notification,omitempty"`
	ProtectContent      bool                    `json:"protect_content,omitempty"`
	ReplyParameters     *models.ReplyParameters `json:"reply_parameters,omitempty"`
	ReplyMarkup         models.ReplyMarkup      `json:"reply_markup,omitempty"`
}

CopyMessageParams https://core.telegram.org/bots/api#copymessage

type CopyMessagesParams added in v1.0.0

type CopyMessagesParams struct {
	ChatID              any    `json:"chat_id"`
	MessageThreadID     int    `json:"message_thread_id,omitempty"`
	FromChatID          string `json:"from_chat_id"`
	MessageIDs          []int  `json:"message_ids"`
	DisableNotification bool   `json:"disable_notification,omitempty"`
	ProtectContent      bool   `json:"protect_content,omitempty"`
	RemoveCaption       bool   `json:"remove_caption,omitempty"`
}

CopyMessagesParams https://core.telegram.org/bots/api#copymessages

type CreateChatInviteLinkParams

type CreateChatInviteLinkParams struct {
	ChatID             any    `json:"chat_id"`
	Name               string `json:"name,omitempty"`
	ExpireDate         int    `json:"expire_date,omitempty"`
	MemberLimit        int    `json:"member_limit,omitempty"`
	CreatesJoinRequest bool   `json:"creates_join_request,omitempty"`
}

type CreateForumTopicParams added in v0.3.1

type CreateForumTopicParams struct {
	ChatID            any    `json:"chat_id"`
	Name              string `json:"name"`
	IconColor         int    `json:"icon_color,omitempty"`
	IconCustomEmojiID string `json:"icon_custom_emoji_id,omitempty"`
}

type CreateInvoiceLinkParams

type CreateInvoiceLinkParams struct {
	Title                     string                `json:"title"`
	Description               string                `json:"description"`
	Payload                   string                `json:"payload"`
	ProviderToken             string                `json:"provider_token"`
	Currency                  string                `json:"currency"`
	Prices                    []models.LabeledPrice `json:"prices"`
	MaxTipAmount              int                   `json:"max_tip_amount,omitempty"`
	SuggestedTipAmounts       []int                 `json:"suggested_tip_amounts,omitempty"`
	ProviderData              string                `json:"provider_data,omitempty"`
	PhotoURL                  string                `json:"photo_url,omitempty"`
	PhotoSize                 int                   `json:"photo_size,omitempty"`
	PhotoWidth                int                   `json:"photo_width,omitempty"`
	PhotoHeight               int                   `json:"photo_height,omitempty"`
	NeedName                  bool                  `json:"need_name,omitempty"`
	NeedPhoneNumber           bool                  `json:"need_phone_number,omitempty"`
	NeedEmail                 bool                  `json:"need_email,omitempty"`
	NeedShippingAddress       bool                  `json:"need_shipping_address,omitempty"`
	SendPhoneNumberToProvider bool                  `json:"send_phone_number_to_provider,omitempty"`
	SendEmailToProvider       bool                  `json:"send_email_to_provider,omitempty"`
	IsFlexible                bool                  `json:"is_flexible,omitempty"`
}

type CreateNewStickerSetParams

type CreateNewStickerSetParams struct {
	UserID          int64            `json:"user_id"`
	Name            string           `json:"name"`
	Title           string           `json:"title"`
	Sticker         models.InputFile `json:"sticker"`
	StickerType     string           `json:"sticker_type,omitempty"`
	NeedsRepainting bool             `json:"needs_repainting,omitempty"`
}

type DebugHandler added in v0.7.5

type DebugHandler func(format string, args ...any)

type DeclineChatJoinRequestParams

type DeclineChatJoinRequestParams struct {
	ChatID any   `json:"chat_id"`
	UserID int64 `json:"user_id"`
}

type DeleteChatPhotoParams

type DeleteChatPhotoParams struct {
	ChatID any `json:"chat_id"`
}

type DeleteChatStickerSetParams

type DeleteChatStickerSetParams struct {
	ChatID         any    `json:"chat_id"`
	StickerSetName string `json:"sticker_set_name"`
}

type DeleteForumTopicParams added in v0.3.1

type DeleteForumTopicParams struct {
	ChatID          any `json:"chat_id"`
	MessageThreadID int `json:"message_thread_id"`
}

type DeleteMessageParams

type DeleteMessageParams struct {
	ChatID    any `json:"chat_id"`
	MessageID int `json:"message_id"`
}

DeleteMessageParams https://core.telegram.org/bots/api#deletemessage

type DeleteMessagesParams added in v1.0.0

type DeleteMessagesParams struct {
	ChatID     any   `json:"chat_id"`
	MessageIDs []int `json:"message_ids"`
}

DeleteMessagesParams https://core.telegram.org/bots/api#deletemessages

type DeleteMyCommandsParams

type DeleteMyCommandsParams struct {
	Scope        models.BotCommandScope `json:"scope,omitempty"`
	LanguageCode string                 `json:"language_code,omitempty"`
}

type DeleteStickerFromSetParams

type DeleteStickerFromSetParams struct {
	Sticker string `json:"sticker"`
}

type DeleteStickerSetParams added in v0.7.0

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

type DeleteWebhookParams

type DeleteWebhookParams struct {
	DropPendingUpdates bool `json:"drop_pending_updates,omitempty"`
}

type EditChatInviteLinkParams

type EditChatInviteLinkParams struct {
	ChatID             any    `json:"chat_id"`
	InviteLink         string `json:"invite_link"`
	Name               string `json:"name,omitempty"`
	ExpireDate         int    `json:"expire_date,omitempty"`
	MemberLimit        int    `json:"member_limit,omitempty"`
	CreatesJoinRequest bool   `json:"creates_join_request,omitempty"`
}

type EditForumTopicParams added in v0.3.1

type EditForumTopicParams struct {
	ChatID            any    `json:"chat_id"`
	MessageThreadID   int    `json:"message_thread_id"`
	Name              string `json:"name,omitempty"`
	IconCustomEmojiID string `json:"icon_custom_emoji_id,omitempty"`
}

type EditGeneralForumTopicParams added in v0.3.4

type EditGeneralForumTopicParams struct {
	ChatID any    `json:"chat_id"`
	Name   string `json:"name"`
}

type EditMessageCaptionParams

type EditMessageCaptionParams struct {
	ChatID                any                    `json:"chat_id"`
	MessageID             int                    `json:"message_id,omitempty"`
	InlineMessageID       string                 `json:"inline_message_id,omitempty"`
	Caption               string                 `json:"caption,omitempty"`
	ParseMode             models.ParseMode       `json:"parse_mode,omitempty"`
	CaptionEntities       []models.MessageEntity `json:"caption_entities,omitempty"`
	DisableWebPagePreview bool                   `json:"disable_web_page_preview,omitempty"`
	ReplyMarkup           models.ReplyMarkup     `json:"reply_markup,omitempty"`
}

type EditMessageLiveLocationParams

type EditMessageLiveLocationParams struct {
	ChatID               any                `json:"chat_id"`
	MessageID            int                `json:"message_id,omitempty"`
	InlineMessageID      string             `json:"inline_message_id,omitempty"`
	Latitude             float64            `json:"latitude"`
	Longitude            float64            `json:"longitude"`
	HorizontalAccuracy   float64            `json:"horizontal_accuracy,omitempty"`
	Heading              int                `json:"heading,omitempty"`
	ProximityAlertRadius int                `json:"proximity_alert_radius,omitempty"`
	ReplyMarkup          models.ReplyMarkup `json:"reply_markup,omitempty"`
}

type EditMessageMediaParams

type EditMessageMediaParams struct {
	ChatID          any                `json:"chat_id"`
	MessageID       int                `json:"message_id,omitempty"`
	InlineMessageID string             `json:"inline_message_id,omitempty"`
	Media           models.InputMedia  `json:"media"`
	ReplyMarkup     models.ReplyMarkup `json:"reply_markup,omitempty"`
}

type EditMessageReplyMarkupParams

type EditMessageReplyMarkupParams struct {
	ChatID          any                `json:"chat_id"`
	MessageID       int                `json:"message_id,omitempty"`
	InlineMessageID string             `json:"inline_message_id,omitempty"`
	ReplyMarkup     models.ReplyMarkup `json:"reply_markup,omitempty"`
}

type EditMessageTextParams

type EditMessageTextParams struct {
	ChatID             any                        `json:"chat_id"`
	MessageID          int                        `json:"message_id,omitempty"`
	InlineMessageID    string                     `json:"inline_message_id,omitempty"`
	Text               string                     `json:"text"`
	ParseMode          models.ParseMode           `json:"parse_mode,omitempty"`
	Entities           []models.MessageEntity     `json:"entities,omitempty"`
	LinkPreviewOptions *models.LinkPreviewOptions `json:"link_preview_options,omitempty"`
	ReplyMarkup        models.ReplyMarkup         `json:"reply_markup,omitempty"`
}

EditMessageTextParams https://core.telegram.org/bots/api#editmessagetext

type ErrorsHandler

type ErrorsHandler func(err error)

type ExportChatInviteLinkParams

type ExportChatInviteLinkParams struct {
	ChatID any `json:"chat_id"`
}

type ForwardMessageParams

type ForwardMessageParams struct {
	ChatID              any    `json:"chat_id"`
	MessageThreadID     int    `json:"message_thread_id,omitempty"`
	FromChatID          string `json:"from_chat_id"`
	DisableNotification bool   `json:"disable_notification,omitempty"`
	ProtectContent      bool   `json:"protect_content,omitempty"`
	MessageID           int    `json:"message_id"`
}

ForwardMessageParams https://core.telegram.org/bots/api#forwardmessage

type ForwardMessagesParams added in v1.0.0

type ForwardMessagesParams struct {
	ChatID              any    `json:"chat_id"`
	MessageThreadID     int    `json:"message_thread_id,omitempty"`
	FromChatID          string `json:"from_chat_id"`
	MessageIDs          []int  `json:"message_ids"`
	DisableNotification bool   `json:"disable_notification,omitempty"`
	ProtectContent      bool   `json:"protect_content,omitempty"`
}

ForwardMessagesParams https://core.telegram.org/bots/api#forwardmessages

type GetChatAdministratorsParams

type GetChatAdministratorsParams struct {
	ChatID any `json:"chat_id"`
}

type GetChatMemberCountParams

type GetChatMemberCountParams struct {
	ChatID any `json:"chat_id"`
}

type GetChatMemberParams

type GetChatMemberParams struct {
	ChatID any   `json:"chat_id"`
	UserID int64 `json:"user_id"`
}

type GetChatMenuButtonParams

type GetChatMenuButtonParams struct {
	ChatID any `json:"chat_id"`
}

type GetChatParams

type GetChatParams struct {
	ChatID any `json:"chat_id"`
}

type GetCustomEmojiStickersParams

type GetCustomEmojiStickersParams struct {
	CustomEmojiIDs []string `json:"custom_emoji_ids"`
}

type GetFileParams

type GetFileParams struct {
	FileID string `json:"file_id"`
}

type GetGameHighScoresParams

type GetGameHighScoresParams struct {
	UserID          int64 `json:"user_id"`
	ChatID          int   `json:"chat_id,omitempty"`
	MessageID       int   `json:"message_id,omitempty"`
	InlineMessageID int   `json:"inline_message_id,omitempty"`
}

type GetMyCommandsParams

type GetMyCommandsParams struct {
	Scope        models.BotCommandScope `json:"scope,omitempty"`
	LanguageCode string                 `json:"language_code,omitempty"`
}

type GetMyDefaultAdministratorRightsParams

type GetMyDefaultAdministratorRightsParams struct {
	ForChannels bool `json:"for_channels,omitempty"`
}

type GetMyDescriptionParams added in v0.7.0

type GetMyDescriptionParams struct {
	LanguageCode string `json:"language_code,omitempty"`
}

type GetMyNameParams added in v0.7.6

type GetMyNameParams struct {
	LanguageCode string `json:"language_code,omitempty"`
}

type GetMyShortDescriptionParams added in v0.7.0

type GetMyShortDescriptionParams struct {
	LanguageCode string `json:"language_code,omitempty"`
}

type GetStickerSetParams

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

type GetUserChatBoostsParams added in v1.0.0

type GetUserChatBoostsParams struct {
	ChatID any `json:"chat_id"`
	UserID int `json:"user_id"`
}

GetUserChatBoostsParams https://core.telegram.org/bots/api#getuserchatboosts

type GetUserProfilePhotosParams

type GetUserProfilePhotosParams struct {
	UserID int64 `json:"user_id"`
	Offset int   `json:"offset,omitempty"`
	Limit  int   `json:"limit,omitempty"`
}

type HandlerFunc

type HandlerFunc func(ctx context.Context, bot *Bot, update *models.Update)

type HandlerType

type HandlerType int
const (
	HandlerTypeMessageText HandlerType = iota
	HandlerTypeCallbackQueryData
)

type HideGeneralForumTopicParams added in v0.3.4

type HideGeneralForumTopicParams struct {
	ChatID any `json:"chat_id"`
}

type HttpClient

type HttpClient interface {
	Do(*http.Request) (*http.Response, error)
}

type LeaveChatParams

type LeaveChatParams struct {
	ChatID any `json:"chat_id"`
}

type MatchFunc added in v0.3.3

type MatchFunc func(update *models.Update) bool

type MatchType

type MatchType int
const (
	MatchTypeExact MatchType = iota
	MatchTypePrefix
	MatchTypeContains
)

type Middleware

type Middleware func(next HandlerFunc) HandlerFunc

type MigrateError added in v1.2.1

type MigrateError struct {
	Message         string
	MigrateToChatID int
}

func (*MigrateError) Error added in v1.2.1

func (e *MigrateError) Error() string

type Option

type Option func(b *Bot)

Option is a function that configures a bot.

func WithAllowedUpdates added in v1.1.5

func WithAllowedUpdates(params AllowedUpdates) Option

WithAllowedUpdates allows to set custom params for getUpdates method

func WithCallbackQueryDataHandler

func WithCallbackQueryDataHandler(pattern string, matchType MatchType, handler HandlerFunc) Option

WithCallbackQueryDataHandler allows to set handler for incoming callback query Also you can use *bot.RegisterHandler function after bot creation

func WithCheckInitTimeout added in v0.3.0

func WithCheckInitTimeout(timeout time.Duration) Option

WithCheckInitTimeout allows to redefine CheckInitTimeout

func WithDebug

func WithDebug() Option

WithDebug allows to enable debug mode. In debug mode, all requests and responses are logged by debug handler

func WithDebugHandler added in v0.7.5

func WithDebugHandler(handler DebugHandler) Option

WithDebugHandler allows to set handler for debug messages

func WithDefaultHandler

func WithDefaultHandler(handler HandlerFunc) Option

WithDefaultHandler allows to set default handler for incoming updates

func WithErrorsHandler

func WithErrorsHandler(handler ErrorsHandler) Option

WithErrorsHandler allows to set handler for errors

func WithHTTPClient

func WithHTTPClient(pollTimeout time.Duration, client HttpClient) Option

WithHTTPClient allows to set custom http client

func WithMessageTextHandler

func WithMessageTextHandler(pattern string, matchType MatchType, handler HandlerFunc) Option

WithMessageTextHandler allows to set handler for incoming text messages Also you can use *bot.RegisterHandler function after bot creation

func WithMiddlewares

func WithMiddlewares(middlewares ...Middleware) Option

WithMiddlewares allows to set middlewares for each incoming request

func WithServerURL

func WithServerURL(serverURL string) Option

WithServerURL allows to set custom server url

func WithSkipGetMe added in v0.7.9

func WithSkipGetMe() Option

WithSkipGetMe allows skip call GetMe on bot init

func WithUpdatesChannelCap added in v1.2.0

func WithUpdatesChannelCap(cap int) Option

WithUpdatesChannelCap allows setting custom capacity for the Updates channel

type PinChatMessageParams

type PinChatMessageParams struct {
	ChatID              any  `json:"chat_id"`
	MessageID           int  `json:"message_id"`
	DisableNotification bool `json:"disable_notification,omitempty"`
}

type PromoteChatMemberParams

type PromoteChatMemberParams struct {
	ChatID              any   `json:"chat_id" rules:"required,chat_id"`
	UserID              int64 `json:"user_id" rules:"required"`
	IsAnonymous         bool  `json:"is_anonymous,omitempty"`
	CanManageChat       bool  `json:"can_manage_chat,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"`
	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"`
}

type ReopenForumTopicParams added in v0.3.1

type ReopenForumTopicParams struct {
	ChatID          any `json:"chat_id"`
	MessageThreadID int `json:"message_thread_id"`
}

type ReopenGeneralForumTopicParams added in v0.3.4

type ReopenGeneralForumTopicParams struct {
	ChatID any `json:"chat_id"`
}

type ReplaceStickerInSetParams added in v1.2.0

type ReplaceStickerInSetParams struct {
	UserID     int64               `json:"user_id"`
	Name       string              `json:"name"`
	OldSticker string              `json:"old_sticker"`
	Sticker    models.InputSticker `json:"sticker"`
}

type RestrictChatMemberParams

type RestrictChatMemberParams struct {
	ChatID                        any                     `json:"chat_id"`
	UserID                        int64                   `json:"user_id"`
	Permissions                   *models.ChatPermissions `json:"permissions,omitempty"`
	UseIndependentChatPermissions bool                    `json:"use_independent_chat_permissions,omitempty"`
	UntilDate                     int                     `json:"until_date,omitempty"`
}

type RevokeChatInviteLinkParams

type RevokeChatInviteLinkParams struct {
	ChatID     any    `json:"chat_id"`
	InviteLink string `json:"invite_link"`
}

type SendAnimationParams

type SendAnimationParams struct {
	BusinessConnectionID string                  `json:"business_connection_id,omitempty"`
	ChatID               any                     `json:"chat_id"`
	MessageThreadID      int                     `json:"message_thread_id,omitempty"`
	Animation            models.InputFile        `json:"animation"`
	Duration             int                     `json:"duration,omitempty"`
	Width                int                     `json:"width,omitempty"`
	Height               int                     `json:"height,omitempty"`
	Thumbnail            models.InputFile        `json:"thumbnail,omitempty"`
	Caption              string                  `json:"caption,omitempty"`
	ParseMode            models.ParseMode        `json:"parse_mode,omitempty"`
	CaptionEntities      []models.MessageEntity  `json:"caption_entities,omitempty"`
	HasSpoiler           bool                    `json:"has_spoiler,omitempty"`
	DisableNotification  bool                    `json:"disable_notification,omitempty"`
	ProtectContent       bool                    `json:"protect_content,omitempty"`
	ReplyParameters      *models.ReplyParameters `json:"reply_parameters,omitempty"`
	ReplyMarkup          models.ReplyMarkup      `json:"reply_markup,omitempty"`
}

SendAnimationParams https://core.telegram.org/bots/api#sendanimation

type SendAudioParams

type SendAudioParams struct {
	BusinessConnectionID string                  `json:"business_connection_id,omitempty"`
	ChatID               any                     `json:"chat_id"`
	MessageThreadID      int                     `json:"message_thread_id,omitempty"`
	Audio                models.InputFile        `json:"audio"`
	Caption              string                  `json:"caption,omitempty"`
	ParseMode            models.ParseMode        `json:"parse_mode,omitempty"`
	CaptionEntities      []models.MessageEntity  `json:"caption_entities,omitempty"`
	Duration             int                     `json:"duration,omitempty"`
	Performer            string                  `json:"performer,omitempty"`
	Title                string                  `json:"title,omitempty"`
	Thumbnail            models.InputFile        `json:"thumbnail,omitempty"`
	DisableNotification  bool                    `json:"disable_notification,omitempty"`
	ProtectContent       bool                    `json:"protect_content,omitempty"`
	ReplyParameters      *models.ReplyParameters `json:"reply_parameters,omitempty"`
	ReplyMarkup          models.ReplyMarkup      `json:"reply_markup,omitempty"`
}

SendAudioParams https://core.telegram.org/bots/api#sendaudio

type SendChatActionParams

type SendChatActionParams struct {
	BusinessConnectionID string            `json:"business_connection_id,omitempty"`
	ChatID               any               `json:"chat_id"`
	MessageThreadID      int               `json:"message_thread_id,omitempty"`
	Action               models.ChatAction `json:"action"`
}

type SendContactParams

type SendContactParams struct {
	BusinessConnectionID string                  `json:"business_connection_id,omitempty"`
	ChatID               any                     `json:"chat_id"`
	MessageThreadID      int                     `json:"message_thread_id,omitempty"`
	PhoneNumber          string                  `json:"phone_number"`
	FirstName            string                  `json:"first_name"`
	LastName             string                  `json:"last_name,omitempty"`
	VCard                string                  `json:"vcard,omitempty"`
	DisableNotification  bool                    `json:"disable_notification,omitempty"`
	ProtectContent       bool                    `json:"protect_content,omitempty"`
	ReplyParameters      *models.ReplyParameters `json:"reply_parameters,omitempty"`
	ReplyMarkup          models.ReplyMarkup      `json:"reply_markup,omitempty"`
}

SendContactParams https://core.telegram.org/bots/api#sendcontact

type SendDiceParams

type SendDiceParams struct {
	BusinessConnectionID string                  `json:"business_connection_id,omitempty"`
	ChatID               any                     `json:"chat_id"`
	MessageThreadID      int                     `json:"message_thread_id,omitempty"`
	Emoji                string                  `json:"emoji,omitempty"`
	DisableNotification  bool                    `json:"disable_notification,omitempty"`
	ProtectContent       bool                    `json:"protect_content,omitempty"`
	ReplyParameters      *models.ReplyParameters `json:"reply_parameters,omitempty"`
	ReplyMarkup          models.ReplyMarkup      `json:"reply_markup,omitempty"`
}

SendDiceParams https://core.telegram.org/bots/api#senddice

type SendDocumentParams

type SendDocumentParams struct {
	BusinessConnectionID        string                  `json:"business_connection_id,omitempty"`
	ChatID                      any                     `json:"chat_id"`
	MessageThreadID             int                     `json:"message_thread_id,omitempty"`
	Document                    models.InputFile        `json:"document"`
	Thumbnail                   models.InputFile        `json:"thumbnail,omitempty"`
	Caption                     string                  `json:"caption,omitempty"`
	ParseMode                   models.ParseMode        `json:"parse_mode,omitempty"`
	CaptionEntities             []models.MessageEntity  `json:"caption_entities,omitempty"`
	DisableContentTypeDetection bool                    `json:"disable_content_type_detection,omitempty"`
	DisableNotification         bool                    `json:"disable_notification,omitempty"`
	ProtectContent              bool                    `json:"protect_content,omitempty"`
	ReplyParameters             *models.ReplyParameters `json:"reply_parameters,omitempty"`
	ReplyMarkup                 models.ReplyMarkup      `json:"reply_markup,omitempty"`
}

SendDocumentParams https://core.telegram.org/bots/api#senddocument

type SendGameParams

type SendGameParams struct {
	BusinessConnectionID string                  `json:"business_connection_id,omitempty"`
	ChatID               any                     `json:"chat_id"`
	MessageThreadID      int                     `json:"message_thread_id,omitempty"`
	GameShorName         string                  `json:"game_short_name"`
	DisableNotification  bool                    `json:"disable_notification,omitempty"`
	ProtectContent       bool                    `json:"protect_content,omitempty"`
	ReplyParameters      *models.ReplyParameters `json:"reply_parameters,omitempty"`
	ReplyMarkup          models.ReplyMarkup      `json:"reply_markup,omitempty"`
}

SendGameParams https://core.telegram.org/bots/api#sendgame

type SendInvoiceParams

type SendInvoiceParams struct {
	ChatID                    any                     `json:"chat_id"`
	MessageThreadID           int                     `json:"message_thread_id,omitempty"`
	Title                     string                  `json:"title"`
	Description               string                  `json:"description"`
	Payload                   string                  `json:"payload"`
	ProviderToken             string                  `json:"provider_token"`
	Currency                  string                  `json:"currency"`
	Prices                    []models.LabeledPrice   `json:"prices"`
	MaxTipAmount              int                     `json:"max_tip_amount,omitempty"`
	SuggestedTipAmounts       []int                   `json:"suggested_tip_amounts,omitempty"`
	StartParameter            string                  `json:"start_parameter,omitempty"`
	ProviderData              string                  `json:"provider_data,omitempty"`
	PhotoURL                  string                  `json:"photo_url,omitempty"`
	PhotoSize                 int                     `json:"photo_size,omitempty"`
	PhotoWidth                int                     `json:"photo_width,omitempty"`
	PhotoHeight               int                     `json:"photo_height,omitempty"`
	NeedName                  bool                    `json:"need_name,omitempty"`
	NeedPhoneNumber           bool                    `json:"need_phone_number,omitempty"`
	NeedEmail                 bool                    `json:"need_email,omitempty"`
	NeedShippingAddress       bool                    `json:"need_shipping_address,omitempty"`
	SendPhoneNumberToProvider bool                    `json:"send_phone_number_to_provider,omitempty"`
	SendEmailToProvider       bool                    `json:"send_email_to_provider,omitempty"`
	IsFlexible                bool                    `json:"is_flexible,omitempty"`
	DisableNotification       bool                    `json:"disable_notification,omitempty"`
	ProtectContent            bool                    `json:"protect_content,omitempty"`
	ReplyParameters           *models.ReplyParameters `json:"reply_parameters,omitempty"`
	ReplyMarkup               models.ReplyMarkup      `json:"reply_markup,omitempty"`
}

SendInvoiceParams https://core.telegram.org/bots/api#sendinvoice

type SendLocationParams

type SendLocationParams struct {
	BusinessConnectionID string                  `json:"business_connection_id,omitempty"`
	ChatID               any                     `json:"chat_id"`
	MessageThreadID      int                     `json:"message_thread_id,omitempty"`
	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"`
	DisableNotification  bool                    `json:"disable_notification,omitempty"`
	ProtectContent       bool                    `json:"protect_content,omitempty"`
	ReplyParameters      *models.ReplyParameters `json:"reply_parameters,omitempty"`
	ReplyMarkup          models.ReplyMarkup      `json:"reply_markup,omitempty"`
}

SendLocationParams https://core.telegram.org/bots/api#sendlocation

type SendMediaGroupParams

type SendMediaGroupParams struct {
	BusinessConnectionID string                  `json:"business_connection_id,omitempty"`
	ChatID               any                     `json:"chat_id"`
	MessageThreadID      int                     `json:"message_thread_id,omitempty"`
	Media                []models.InputMedia     `json:"media"`
	DisableNotification  bool                    `json:"disable_notification,omitempty"`
	ProtectContent       bool                    `json:"protect_content,omitempty"`
	ReplyParameters      *models.ReplyParameters `json:"reply_parameters,omitempty"`
}

SendMediaGroupParams https://core.telegram.org/bots/api#sendmediagroup

type SendMessageParams

type SendMessageParams struct {
	BusinessConnectionID string                     `json:"business_connection_id,omitempty"`
	ChatID               any                        `json:"chat_id"`
	MessageThreadID      int                        `json:"message_thread_id,omitempty"`
	Text                 string                     `json:"text"`
	ParseMode            models.ParseMode           `json:"parse_mode,omitempty"`
	Entities             []models.MessageEntity     `json:"entities,omitempty"`
	LinkPreviewOptions   *models.LinkPreviewOptions `json:"link_preview_options,omitempty"`
	DisableNotification  bool                       `json:"disable_notification,omitempty"`
	ProtectContent       bool                       `json:"protect_content,omitempty"`
	ReplyParameters      *models.ReplyParameters    `json:"reply_parameters,omitempty"`
	ReplyMarkup          models.ReplyMarkup         `json:"reply_markup,omitempty"`
}

SendMessageParams https://core.telegram.org/bots/api#sendmessage

type SendPhotoParams

type SendPhotoParams struct {
	BusinessConnectionID string                  `json:"business_connection_id,omitempty"`
	ChatID               any                     `json:"chat_id"`
	MessageThreadID      int                     `json:"message_thread_id,omitempty"`
	Photo                models.InputFile        `json:"photo"`
	Caption              string                  `json:"caption,omitempty"`
	ParseMode            models.ParseMode        `json:"parse_mode,omitempty"`
	CaptionEntities      []models.MessageEntity  `json:"caption_entities,omitempty"`
	HasSpoiler           bool                    `json:"has_spoiler,omitempty"`
	DisableNotification  bool                    `json:"disable_notification,omitempty"`
	ProtectContent       bool                    `json:"protect_content,omitempty"`
	ReplyParameters      *models.ReplyParameters `json:"reply_parameters,omitempty"`
	ReplyMarkup          models.ReplyMarkup      `json:"reply_markup,omitempty"`
}

SendPhotoParams https://core.telegram.org/bots/api#sendphoto

type SendPollParams

type SendPollParams struct {
	BusinessConnectionID  string                  `json:"business_connection_id,omitempty"`
	ChatID                any                     `json:"chat_id"`
	MessageThreadID       int                     `json:"message_thread_id,omitempty"`
	Question              string                  `json:"question"`
	Options               []string                `json:"options"`
	IsAnonymous           *bool                   `json:"is_anonymous,omitempty"`
	Type                  string                  `json:"type,omitempty"`
	AllowsMultipleAnswers bool                    `json:"allows_multiple_answers,omitempty"`
	CorrectOptionID       int                     `json:"correct_option_id"`
	Explanation           string                  `json:"explanation,omitempty"`
	ExplanationParseMode  string                  `json:"explanation_parse_mode,omitempty"`
	ExplanationEntities   []models.MessageEntity  `json:"explanation_entities,omitempty"`
	OpenPeriod            int                     `json:"open_period,omitempty"`
	CloseDate             int                     `json:"close_date,omitempty"`
	IsClosed              bool                    `json:"is_closed,omitempty"`
	DisableNotification   bool                    `json:"disable_notification,omitempty"`
	ProtectContent        bool                    `json:"protect_content,omitempty"`
	ReplyParameters       *models.ReplyParameters `json:"reply_parameters,omitempty"`
	ReplyMarkup           models.ReplyMarkup      `json:"reply_markup,omitempty"`
}

SendPollParams https://core.telegram.org/bots/api#sendpoll

type SendStickerParams

type SendStickerParams struct {
	BusinessConnectionID string                  `json:"business_connection_id,omitempty"`
	ChatID               any                     `json:"chat_id"`
	MessageThreadID      int                     `json:"message_thread_id,omitempty"`
	Sticker              models.InputFile        `json:"sticker"`
	Emoji                string                  `json:"emoji,omitempty"`
	DisableNotification  bool                    `json:"disable_notification,omitempty"`
	ProtectContent       bool                    `json:"protect_content,omitempty"`
	ReplyParameters      *models.ReplyParameters `json:"reply_parameters,omitempty"`
	ReplyMarkup          models.ReplyMarkup      `json:"reply_markup,omitempty"`
}

SendStickerParams https://core.telegram.org/bots/api#sendsticker

type SendVenueParams

type SendVenueParams struct {
	BusinessConnectionID string                  `json:"business_connection_id,omitempty"`
	ChatID               any                     `json:"chat_id"`
	MessageThreadID      int                     `json:"message_thread_id,omitempty"`
	Latitude             float64                 `json:"latitude"`
	Longitude            float64                 `json:"longitude"`
	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"`
	DisableNotification  bool                    `json:"disable_notification,omitempty"`
	ProtectContent       bool                    `json:"protect_content,omitempty"`
	ReplyParameters      *models.ReplyParameters `json:"reply_parameters,omitempty"`
	ReplyMarkup          models.ReplyMarkup      `json:"reply_markup,omitempty"`
}

SendVenueParams https://core.telegram.org/bots/api#sendvenue

type SendVideoNoteParams

type SendVideoNoteParams struct {
	BusinessConnectionID string                  `json:"business_connection_id,omitempty"`
	ChatID               any                     `json:"chat_id"`
	MessageThreadID      int                     `json:"message_thread_id,omitempty"`
	VideoNote            models.InputFile        `json:"video_note"`
	Duration             int                     `json:"duration,omitempty"`
	Length               int                     `json:"length,omitempty"`
	Thumbnail            models.InputFile        `json:"thumbnail,omitempty"`
	DisableNotification  bool                    `json:"disable_notification,omitempty"`
	ProtectContent       bool                    `json:"protect_content,omitempty"`
	ReplyParameters      *models.ReplyParameters `json:"reply_parameters,omitempty"`
	ReplyMarkup          models.ReplyMarkup      `json:"reply_markup,omitempty"`
}

SendVideoNoteParams https://core.telegram.org/bots/api#sendvideonote

type SendVideoParams

type SendVideoParams struct {
	BusinessConnectionID string                  `json:"business_connection_id,omitempty"`
	ChatID               any                     `json:"chat_id"`
	MessageThreadID      int                     `json:"message_thread_id,omitempty"`
	Video                models.InputFile        `json:"video"`
	Duration             int                     `json:"duration,omitempty"`
	Width                int                     `json:"width,omitempty"`
	Height               int                     `json:"height,omitempty"`
	Thumbnail            models.InputFile        `json:"thumbnail,omitempty"`
	Caption              string                  `json:"caption,omitempty"`
	ParseMode            models.ParseMode        `json:"parse_mode,omitempty"`
	CaptionEntities      []models.MessageEntity  `json:"caption_entities,omitempty"`
	HasSpoiler           bool                    `json:"has_spoiler,omitempty"`
	SupportsStreaming    bool                    `json:"supports_streaming,omitempty"`
	DisableNotification  bool                    `json:"disable_notification,omitempty"`
	ProtectContent       bool                    `json:"protect_content,omitempty"`
	ReplyParameters      *models.ReplyParameters `json:"reply_parameters,omitempty"`
	ReplyMarkup          models.ReplyMarkup      `json:"reply_markup,omitempty"`
}

SendVideoParams https://core.telegram.org/bots/api#sendvideo

type SendVoiceParams

type SendVoiceParams struct {
	BusinessConnectionID string                  `json:"business_connection_id,omitempty"`
	ChatID               any                     `json:"chat_id"`
	MessageThreadID      int                     `json:"message_thread_id,omitempty"`
	Voice                models.InputFile        `json:"voice"`
	Caption              string                  `json:"caption,omitempty"`
	ParseMode            models.ParseMode        `json:"parse_mode,omitempty"`
	CaptionEntities      []models.MessageEntity  `json:"caption_entities,omitempty"`
	Duration             int                     `json:"duration,omitempty"`
	DisableNotification  bool                    `json:"disable_notification,omitempty"`
	ProtectContent       bool                    `json:"protect_content,omitempty"`
	ReplyParameters      *models.ReplyParameters `json:"reply_parameters,omitempty"`
	ReplyMarkup          models.ReplyMarkup      `json:"reply_markup,omitempty"`
}

SendVoiceParams https://core.telegram.org/bots/api#sendvoice

type SetChatAdministratorCustomTitleParams

type SetChatAdministratorCustomTitleParams struct {
	ChatID      any    `json:"chat_id"`
	UserID      int64  `json:"user_id"`
	CustomTitle string `json:"custom_title"`
}

type SetChatDescriptionParams

type SetChatDescriptionParams struct {
	ChatID      any    `json:"chat_id"`
	Description string `json:"description"`
}

type SetChatMenuButtonParams

type SetChatMenuButtonParams struct {
	ChatID     any                    `json:"chat_id,omitempty"`
	MenuButton models.InputMenuButton `json:"menu_button"`
}

type SetChatPermissionsParams

type SetChatPermissionsParams struct {
	ChatID                        any                    `json:"chat_id"`
	Permissions                   models.ChatPermissions `json:"permissions"`
	UseIndependentChatPermissions bool                   `json:"use_independent_chat_permissions,omitempty"`
}

type SetChatPhotoParams

type SetChatPhotoParams struct {
	ChatID any              `json:"chat_id"`
	Photo  models.InputFile `json:"photo"`
}

type SetChatStickerSetParams

type SetChatStickerSetParams struct {
	ChatID         any    `json:"chat_id"`
	StickerSetName string `json:"sticker_set_name"`
}

type SetChatTitleParams

type SetChatTitleParams struct {
	ChatID any    `json:"chat_id"`
	Title  string `json:"title"`
}

type SetCustomEmojiStickerSetThumbnailParams added in v0.7.0

type SetCustomEmojiStickerSetThumbnailParams struct {
	Name          string `json:"name"`
	CustomEmojiID string `json:"custom_emoji_id,omitempty"`
}

type SetGameScoreParams

type SetGameScoreParams struct {
	UserID             int64 `json:"user_id"`
	Score              int   `json:"score"`
	Force              bool  `json:"force,omitempty"`
	DisableEditMessage bool  `json:"disable_edit_message,omitempty"`
	ChatID             int   `json:"chat_id,omitempty"`
	MessageID          int   `json:"message_id,omitempty"`
	InlineMessageID    int   `json:"inline_message_id,omitempty"`
}

type SetMessageReactionParams added in v1.0.0

type SetMessageReactionParams struct {
	ChatID    any                   `json:"chat_id"`
	MessageID int                   `json:"message_id"`
	Reaction  []models.ReactionType `json:"reaction,omitempty"`
	IsBig     *bool                 `json:"is_big,omitempty"`
}

SetMessageReactionParams https://core.telegram.org/bots/api#setmessagereaction

type SetMyCommandsParams

type SetMyCommandsParams struct {
	Commands     []models.BotCommand    `json:"commands"`
	Scope        models.BotCommandScope `json:"scope,omitempty"`
	LanguageCode string                 `json:"language_code,omitempty"`
}

type SetMyDefaultAdministratorRightsParams

type SetMyDefaultAdministratorRightsParams struct {
	Rights      *models.ChatAdministratorRights `json:"rights,omitempty"`
	ForChannels bool                            `json:"for_channels,omitempty"`
}

type SetMyDescriptionParams added in v0.7.0

type SetMyDescriptionParams struct {
	Description  string `json:"description,omitempty"`
	LanguageCode string `json:"language_code,omitempty"`
}

type SetMyNameParams added in v0.7.6

type SetMyNameParams struct {
	Name         string `json:"name,omitempty"`
	LanguageCode string `json:"language_code,omitempty"`
}

type SetMyShortDescriptionParams added in v0.7.0

type SetMyShortDescriptionParams struct {
	ShortDescription string `json:"short_description,omitempty"`
	LanguageCode     string `json:"language_code,omitempty"`
}

type SetPassportDataErrorsParams

type SetPassportDataErrorsParams struct {
	UserID int64                         `json:"user_id"`
	Errors []models.PassportElementError `json:"errors"`
}

type SetStickerEmojiListParams added in v0.7.0

type SetStickerEmojiListParams struct {
	Sticker   string   `json:"sticker"`
	EmojiList []string `json:"emoji_list"`
}

type SetStickerKeywordsParams added in v0.7.0

type SetStickerKeywordsParams struct {
	Sticker  string   `json:"sticker"`
	Keywords []string `json:"keywords"`
}

type SetStickerMaskPositionParams added in v0.7.0

type SetStickerMaskPositionParams struct {
	Sticker      string              `json:"sticker"`
	MaskPosition models.MaskPosition `json:"mask_position"`
}

type SetStickerPositionInSetParams

type SetStickerPositionInSetParams struct {
	Sticker  string `json:"sticker"`
	Position int    `json:"position"`
}

type SetStickerSetThumbnailParams added in v0.7.0

type SetStickerSetThumbnailParams struct {
	Name      string           `json:"name"`
	UserID    int64            `json:"user_id"`
	Thumbnail models.InputFile `json:"thumbnail,omitempty"`
	Format    string           `json:"format"`
}

type SetStickerSetTitleParams added in v0.7.0

type SetStickerSetTitleParams struct {
	Name  string `json:"name"`
	Title string `json:"title"`
}

type SetWebhookParams

type SetWebhookParams struct {
	URL                string           `json:"url"`
	Certificate        models.InputFile `json:"certificate,omitempty"`
	IPAddress          string           `json:"ip_address,omitempty"`
	MaxConnections     int              `json:"max_connections,omitempty"`
	AllowedUpdates     []string         `json:"allowed_updates,omitempty"`
	DropPendingUpdates bool             `json:"drop_pending_updates,omitempty"`
	SecretToken        string           `json:"secret_token,omitempty"`
}

type StopMessageLiveLocationParams

type StopMessageLiveLocationParams struct {
	ChatID          any                `json:"chat_id,omitempty"`
	MessageID       int                `json:"message_id,omitempty"`
	InlineMessageID string             `json:"inline_message_id,omitempty"`
	ReplyMarkup     models.ReplyMarkup `json:"reply_markup,omitempty"`
}

type StopPollParams

type StopPollParams struct {
	ChatID      any                `json:"chat_id"`
	MessageID   int                `json:"message_id"`
	ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
}

type TooManyRequestsError added in v1.2.1

type TooManyRequestsError struct {
	Message    string
	RetryAfter int
}

func (*TooManyRequestsError) Error added in v1.2.1

func (e *TooManyRequestsError) Error() string

type UnbanChatMemberParams

type UnbanChatMemberParams struct {
	ChatID       any   `json:"chat_id"`
	UserID       int64 `json:"user_id"`
	OnlyIfBanned bool  `json:"only_if_banned,omitempty"`
}

type UnbanChatSenderChatParams

type UnbanChatSenderChatParams struct {
	ChatID       any `json:"chat_id"`
	SenderChatID int `json:"sender_chat_id"`
}

type UnhideGeneralForumTopicParams added in v0.3.4

type UnhideGeneralForumTopicParams struct {
	ChatID any `json:"chat_id"`
}

type UnpinAllChatMessagesParams

type UnpinAllChatMessagesParams struct {
	ChatID any `json:"chat_id"`
}

type UnpinAllForumTopicMessagesParams added in v0.3.1

type UnpinAllForumTopicMessagesParams struct {
	ChatID          any `json:"chat_id"`
	MessageThreadID int `json:"message_thread_id"`
}

type UnpinAllGeneralForumTopicMessagesParams added in v0.7.15

type UnpinAllGeneralForumTopicMessagesParams struct {
	ChatID any `json:"chat_id"`
}

type UnpinChatMessageParams

type UnpinChatMessageParams struct {
	ChatID    any `json:"chat_id"`
	MessageID int `json:"message_id,omitempty"`
}

type UploadStickerFileParams

type UploadStickerFileParams struct {
	UserID     int64            `json:"user_id"`
	PngSticker models.InputFile `json:"png_sticker"`
}

Jump to

Keyboard shortcuts

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