Categorygithub.com/mr-linch/go-tg
modulepackage
0.15.0
Repository: https://github.com/mr-linch/go-tg.git
Documentation: pkg.go.dev

# README

go-tg

Go Reference go.mod GitHub release (latest by date) Telegram Bot API CI codecov Go Report Card [Telegram]

beta

go-tg is a Go client library for accessing Telegram Bot API, with batteries for building complex bots included.

⚠️ Although the API definitions are considered stable package is well tested and used in production, please keep in mind that go-tg is still under active development and therefore full backward compatibility is not guaranteed before reaching v1.0.0.

Features

  • :rocket: Code for Bot API types and methods is generated with embedded official documentation.
  • :white_check_mark: Support context.Context.
  • :link: API Client and bot framework are strictly separated, you can use them independently.
  • :zap: No runtime reflection overhead.
  • :arrows_counterclockwise: Supports Webhook and Polling natively;
  • :mailbox_with_mail: Webhook reply for high load bots;
  • :raised_hands: Handlers, filters, and middleware are supported.
  • :globe_with_meridians: WebApps and Login Widget helpers.
  • :handshake: Business connections support

Install

# go 1.18+
go get -u github.com/mr-linch/go-tg

Quick Example

package main

import (
  "context"
  "fmt"
  "os"
  "os/signal"
  "regexp"
  "syscall"
  "time"

  "github.com/mr-linch/go-tg"
  "github.com/mr-linch/go-tg/tgb"
)

func main() {
  ctx := context.Background()

  ctx, cancel := signal.NotifyContext(ctx, os.Interrupt, os.Kill, syscall.SIGTERM)
  defer cancel()

  if err := run(ctx); err != nil {
    fmt.Println(err)
    defer os.Exit(1)
  }
}

func run(ctx context.Context) error {
  client := tg.New(os.Getenv("BOT_TOKEN"))

  router := tgb.NewRouter().
    // handles /start and /help
    Message(func(ctx context.Context, msg *tgb.MessageUpdate) error {
      return msg.Answer(
        tg.HTML.Text(
          tg.HTML.Bold("👋 Hi, I'm echo bot!"),
          "",
          tg.HTML.Italic("🚀 Powered by", tg.HTML.Spoiler(tg.HTML.Link("go-tg", "github.com/mr-linch/go-tg"))),
        ),
      ).ParseMode(tg.HTML).DoVoid(ctx)
    }, tgb.Command("start", tgb.WithCommandAlias("help"))).
    // handles gopher image
    Message(func(ctx context.Context, msg *tgb.MessageUpdate) error {
      if err := msg.Update.Reply(ctx, msg.AnswerChatAction(tg.ChatActionUploadPhoto)); err != nil {
        return fmt.Errorf("answer chat action: %w", err)
      }

      // emulate thinking :)
      time.Sleep(time.Second)

      return msg.AnswerPhoto(
        tg.NewFileArgURL("https://go.dev/blog/go-brand/Go-Logo/PNG/Go-Logo_Blue.png"),
      ).DoVoid(ctx)

    }, tgb.Regexp(regexp.MustCompile(`(?mi)(go|golang|gopher)[$\s+]?`))).
    // handle other messages
    Message(func(ctx context.Context, msg *tgb.MessageUpdate) error {
      return msg.Copy(msg.Chat).DoVoid(ctx)
    }).
    MessageReaction(func(ctx context.Context, reaction *tgb.MessageReactionUpdate) error {
			// sets same reaction to the message
			answer := tg.NewSetMessageReactionCall(reaction.Chat, reaction.MessageID).Reaction(reaction.NewReaction)
			return reaction.Update.Reply(ctx, answer)
		})

  return tgb.NewPoller(
    router,
    client,
    tgb.WithPollerAllowedUpdates(
			tg.UpdateTypeMessage,
      tg.UpdateTypeMessageReaction,
    )
  ).Run(ctx)
}

More examples can be found in examples.

API Client

Creating

The simplest way for create client it's call tg.New with token. That constructor use http.DefaultClient as default client and api.telegram.org as server URL:

client := tg.New("<TOKEN>") // from @BotFather

With custom http.Client:

proxyURL, err := url.Parse("http://user:pass@ip:port")
if err != nil {
  return err
}

httpClient := &http.Client{
  Transport: &http.Transport{
    Proxy: http.ProxyURL(proxyURL),
  },
}

client := tg.New("<TOKEN>",
 tg.WithClientDoer(httpClient),
)

With self hosted Bot API server:

client := tg.New("<TOKEN>",
 tg.WithClientServerURL("http://localhost:8080"),
)

Bot API methods

All API methods are supported with embedded official documentation. It's provided via Client methods.

e.g. getMe call:

me, err := client.GetMe().Do(ctx)
if err != nil {
 return err
}

log.Printf("authorized as @%s", me.Username)

sendMessage call with required and optional arguments:

peer := tg.Username("MrLinch")

msg, err := client.SendMessage(peer, "<b>Hello, world!</b>").
  ParseMode(tg.HTML). // optional passed like this
  Do(ctx)

if err != nil {
  return err
}

log.Printf("sended message id %d", msg.ID)

Some Bot API methods do not return the object and just say True. So, you should use the DoVoid method to execute calls like that.

All calls with the returned object also have the DoVoid method. Use it when you do not care about the result, just ensure it's not an error (unmarshaling also be skipped).

peer := tg.Username("MrLinch")

if err := client.SendChatAction(
  peer,
  tg.ChatActionTyping
).DoVoid(ctx); err != nil {
  return err
}

Low-level Bot API methods call

Client has method Do for low-level requests execution:

req := tg.NewRequest("sendChatAction").
  PeerID("chat_id", tg.Username("@MrLinch")).
  String("action", "typing")

if err := client.Do(ctx, req, nil); err != nil {
  return err
}

Helper methods

Method Client.Me() fetches authorized bot info via Client.GetMe() and cache it between calls.

me, err := client.Me(ctx)
if err != nil {
  return err
}

Sending files

There are several ways to send files to Telegram:

  • uploading a file along with a method call;
  • sending a previously uploaded file by its identifier;
  • sending a file using a URL from the Internet;

The FileArg type is used to combine all these methods. It is an object that can be passed to client methods and depending on its contents the desired method will be chosen to send the file.

Consider each method by example.

Uploading a file along with a method call:

For upload a file you need to create an object tg.InputFile. It is a structure with two fields: file name and io.Reader with its contents.

Type has some handy constructors, for example consider uploading a file from a local file system:

inputFile, err := tg.NewInputFileLocal("/path/to/file.pdf")
if err != nil {
  return err
}
defer inputFile.Close()

peer := tg.Username("MrLinch")

if err := client.SendDocument(
  peer,
  tg.NewFileArgUpload(inputFile),
).DoVoid(ctx); err != nil {
	return err
}

Loading a file from a buffer in memory:


buf := bytes.NewBufferString("<html>...</html>")

inputFile := tg.NewInputFile("index.html", buf)

peer := tg.Username("MrLinch")

if err := client.SendDocument(
  peer,
  tg.NewFileArgUpload(inputFile),
).DoVoid(ctx); err != nil {
	return err
}

Sending a file using a URL from the Internet:

peer := tg.Username("MrLinch")

if err := client.SendPhoto(
  peer,
  tg.NewFileArgURL("https://picsum.photos/500"),
).DoVoid(ctx); err != nil {
	return err
}

Sending a previously uploaded file by its identifier:

peer := tg.Username("MrLinch")

if err := client.SendPhoto(
  peer,
  tg.NewFileArgID(tg.FileID("AgACAgIAAxk...")),
).DoVoid(ctx); err != nil {
	return err
}

Please checkout examples with "File Upload" features for more usecases.

Downloading files

To download a file you need to get its FileID. After that you need to call method Client.GetFile to get metadata about the file. At the end we call method Client.Download to fetch the contents of the file.


fid := tg.FileID("AgACAgIAAxk...")

file, err := client.GetFile(fid).Do(ctx)
if err != nil {
  return err
}

f, err := client.Download(ctx, file.FilePath)
if err != nil {
  return err
}
defer f.Close()

// ...

Interceptors

Interceptors are used to modify or process the request before it is sent to the server and the response before it is returned to the caller. It's like a [tgb.Middleware], but for outgoing requests.

All interceptors should be registered on the client before the request is made.

client := tg.New("<TOKEN>",
  tg.WithClientInterceptors(
    tg.Interceptor(func(ctx context.Context, req *tg.Request, dst any, invoker tg.InterceptorInvoker) error {
      started := time.Now()

      // before request
      err := invoker(ctx, req, dst)
      // after request

      log.Print("call %s took %s", req.Method, time.Since(started))

      return err
    }),
  ),
)

Arguments of the interceptor are:

  • ctx - context of the request;
  • req - request object tg.Request;
  • dst - pointer to destination for the response, can be nil if the request is made with DoVoid method;
  • invoker - function for calling the next interceptor or the actual request.

Contrib package has some useful interceptors:

Interceptors are called in the order they are registered.

Example of using retry flood interceptor: examples/retry-flood

Updates

Everything related to receiving and processing updates is in the tgb package.

Handlers

You can create an update handler in three ways:

  1. Declare the structure that implements the interface tgb.Handler:
type MyHandler struct {}

func (h *MyHandler) Handle(ctx context.Context, update *tgb.Update) error {
  if update.Message != nil {
    return nil
  }

 log.Printf("update id: %d, message id: %d", update.ID, update.Message.ID)

 return nil
}
  1. Wrap the function to the type tgb.HandlerFunc:
var handler tgb.Handler = tgb.HandlerFunc(func(ctx context.Context, update *tgb.Update) error {
 // skip updates of other types
 if update.Message == nil {
  return nil
 }

 log.Printf("update id: %d, message id: %d", update.ID, update.Message.ID)

 return nil
})
  1. Wrap the function to the type tgb.*Handler for creating typed handlers with null pointer check:
// that handler will be called only for messages
// other updates will be ignored
var handler tgb.Handler = tgb.MessageHandler(func(ctx context.Context, mu *tgb.MessageUpdate) error {
  log.Printf("update id: %d, message id: %d", mu.Update.ID, mu.ID)
  return nil
})

Typed Handlers

For each subtype (field) of tg.Update you can create a typed handler.

Typed handlers it's not about routing updates but about handling them. These handlers will only be called for updates of a certain type, the rest will be skipped. Also, they implement the tgb.Handler interface.

List of typed handlers:

tgb.*Updates has many useful methods for "answer" the update, please checkout godoc by links above.

Receive updates via Polling

Use tgb.NewPoller to create a poller with specified tg.Client and tgb.Handler. Also accepts tgb.PollerOption for customizing the poller.

handler := tgb.HandlerFunc(func(ctx context.Context, update *tgb.Update) error {
  // ...
})

poller := tgb.NewPoller(handler, client,
  // recieve max 100 updates in a batch
  tgb.WithPollerLimit(100),
)

// polling will be stopped on context cancel
if err := poller.Run(ctx); err != nil {
  return err
}

Receive updates via Webhook

Webhook handler and server can be created by tgb.NewWebhook. That function has following arguments:

  • handler - tgb.Handler for handling updates;
  • client - tg.Client for making setup requests;
  • url - full url of the webhook server
  • optional options - tgb.WebhookOption for customizing the webhook.

Webhook has several security checks that are enabled by default:

  • Check if the IP of the sender is in the allowed ranges.
  • Check if the request has a valid security token header. By default, the token is the SHA256 hash of the Telegram Bot API token.

ℹ️ That checks can be disabled by passing tgb.WithWebhookSecurityToken(""), tgb.WithWebhookSecuritySubnets() when creating the webhook.

⚠️ At the moment, the webhook does not integrate custom certificate. So, you should handle HTTPS requests on load balancer.

handler := tgb.HandlerFunc(func(ctx context.Context, update *tgb.Update) error {
   // ...
})


webhook := tgb.NewWebhook(handler, client, "https://bot.com/webhook",
  tgb.WithDropPendingUpdates(true),
)

// configure telegram webhook and start HTTP server.
// the server will be stopped on context cancel.
if err := webhook.Run(ctx, ":8080"); err != nil {
  return err
}

Webhook is a regular http.Handler that can be used in any HTTP-compatible router. But you should call Webhook.Setup before starting the server to configure the webhook on the Telegram side.

e.g. integration with chi router

handler := tgb.HandlerFunc(func(ctx context.Context, update *tgb.Update) error {
  // ...
})

webhook := tgb.NewWebhook(handler, client, "https://bot.com/webhook",
  tgb.WithDropPendingUpdates(true),
)

// get current webhook configuration and sync it if needed.
if err := webhook.Setup(ctx); err != nil {
  return err
}

r := chi.NewRouter()

r.Get("/webhook", webhook)

http.ListenAndServe(":8080", r)

Routing updates

When building complex bots, routing updates is one of the most boilerplate parts of the code. The tgb package contains a number of primitives to simplify this.

tgb.Router

This is an implementation of tgb.Handler, which provides the ability to route updates between multiple related handlers. It is useful for handling updates in different ways depending on the update subtype.

router := tgb.NewRouter()

router.Message(func(ctx context.Context, mu *tgb.MessageUpdate) error {
  // will be called for every Update with not nil `Message` field
})

router.EditedMessage(func(ctx context.Context, mu *tgb.MessageUpdate) error {
  // will be called for every Update with not nil `EditedMessage` field
})

router.CallbackQuery(func(ctx context.Context, update *tgb.CallbackQueryUpdate) error {
  // will be called for every Update with not nil `CallbackQuery` field
})

client := tg.NewClient(...)

// e.g. run in long polling mode
if err := tgb.NewPoller(router, client).Run(ctx); err != nil {
  return err
}

tgb.Filter

Routing by update subtype is first level of the routing. Second is filters. Filters are needed to determine more precisely which handler to call, for which update, depending on its contents.

In essence, filters are predicates. Functions that return a boolean value. If the value is true, then the given update corresponds to a handler and the handler will be called. If the value is false, check the subsequent handlers.

The tgb package contains many built-in filters.

e.g. command filter (can be customized via CommandFilterOption)

router.Message(func(ctx context.Context, mu *tgb.MessageUpdate) error {
  // will be called for every Update with not nil `Message` field and if the message text contains "/start"
}, tgb.Command("start", ))

The handler registration function accepts any number of filters. They will be combined using the boolean operator and

e.g. handle /start command in private chats only

router.Message(func(ctx context.Context, mu *tgb.MessageUpdate) error {
  // will be called for every Update with not nil `Message` field
  //  and
  // if the message text contains "/start"
  //  and
  // if the Message.Chat.Type is private
}, tgb.Command("start"), tgb.ChatType(tg.ChatTypePrivate))

Logical operator or also supported.

e.g. handle /start command in groups or supergroups only

isGroupOrSupergroup := tgb.Any(
  tgb.ChatType(tg.ChatTypeGroup),
  tgb.ChatType(tg.ChatTypeSupergroup),
)

router.Message(func(ctx context.Context, mu *tgb.MessageUpdate) error {
  // will be called for every Update with not nil `Message` field
  //  and
  // if the message text contains "/start"
  //  and
  //    if the Message.Chat.Type is group
  //      or
  //    if the Message.Chat.Type is supergroup
}, tgb.Command("start"), isGroupOrSupergroup)

All filters are universal. e.g. the command filter can be used in the Message, EditedMessage, ChannelPost, EditedChannelPost handlers. Please checkout tgb.Filter constructors for more information about built-in filters.

For define a custom filter you should implement the tgb.Filter interface. Also you can use tgb.FilterFunc wrapper to define a filter in functional way.

e.g. filter for messages with document attachments with image type

// tgb.All works like boolean `and` operator.
var isDocumentPhoto = tgb.All(
  tgb.MessageType(tg.MessageTypeDocument),
  tgb.FilterFunc(func(ctx context.Context, update *tgb.Update) (bool, error) {
    return strings.HasPrefix(update.Message.Document.MIMEType, "image/"), nil
  }),
)

tgb.Middleware

Middleware is used to modify or process the Update before it is passed to the handler. All middleware should be registered before the handlers registration.

e.g. log all updates

router.Use(func(next tgb.Handler) tgb.Handler {
  return tgb.HandlerFunc(func(ctx context.Context, update *tgb.Update) error {
    defer func(started time.Time) {
      log.Printf("%#v [%s]", update, time.Since(started))
    }(time.Now())

    return next(ctx, update)
  })
})

Error Handler

As you all handlers returns an error. If any error occurs in the chain, it will be passed to that handler. By default, errors are returned back by handler method. You can customize this behavior by passing a custom error handler.

e.g. log all errors

router.Error(func(ctx context.Context, update *tgb.Update, err error) error {
  log.Printf("error when handling update #%d: %v", update.ID, err)
  return nil
})

That example is not useful and just demonstrates the error handler. The better way to achieve this is simply to enable logging in Webhook or Poller.

Extensions

Sessions

What is a Session?

Session it's a simple storage for data related to the Telegram chat. It allow you to share data between different updates from the same chat. This data is persisted in the session store and will be available for the next updates from the same chat.

In fact, the session is the usual struct and you can define it as you wish. One requirement is that the session must be serializable. By default, the session is serialized using encoding/json package, but you can use any other marshal/unmarshal funcs.

When not to use sessions?

  • you need to store large amount of data;
  • your data is not serializable;
  • you need access to data from other chat sessions;
  • session data should be used by other systems;

Where sessions store

Session store is simple key-value storage. Where key is a string value unique for each chat and value is serialized session data. By default, manager use StoreMemory implementation. Also package has StoreFile based on FS.

How to use sessions?

  1. You should define a session struct:
     type Session struct {
       PizzaCount int
     }
    
  2. Create a session manager:
     var sessionManager = session.NewManager(Session{
       PizzaCount: 0,
     })
    
  3. Attach the session manager to the router:
     router.Use(sessionManager)
    
  4. Use the session manager in the handlers:
     router.Message(func(ctx context.Context, mu *tgb.Update) error {
       count := strings.Count(strings.ToLower(mu.Message.Text), "pizza") + strings.Count(mu.Message.Text, "🍕")
       if count > 0 {
         session := sessionManager.Get(ctx)
         session.PizzaCount += count
       }
       return nil
     })
    

See session package and examples with Session Manager feature for more information.

Related Projects

Projects using this package

  • @ttkeeperbot - Automatically upload tiktoks in groups and verify users 🇺🇦

Thanks

  • gotd/td for inspiration for the use of codegen;
  • aiogram/aiogram for handlers, middlewares, filters concepts;

# Packages

Packages examples contains usage examples of go-tg.
Package tgb is a Telegram bot framework.

# Functions

BindClient binds Client to the Call.
New creates new Client with given token and options.
NewAddStickerToSetCall constructs a new AddStickerToSetCall with required parameters.
NewAnswerCallbackQueryCall constructs a new AnswerCallbackQueryCall with required parameters.
NewAnswerInlineQueryCall constructs a new AnswerInlineQueryCall with required parameters.
NewAnswerPreCheckoutQueryCall constructs a new AnswerPreCheckoutQueryCall with required parameters.
NewAnswerShippingQueryCall constructs a new AnswerShippingQueryCall with required parameters.
NewAnswerWebAppQueryCall constructs a new AnswerWebAppQueryCall with required parameters.
NewApproveChatJoinRequestCall constructs a new ApproveChatJoinRequestCall with required parameters.
NewBanChatMemberCall constructs a new BanChatMemberCall with required parameters.
NewBanChatSenderChatCall constructs a new BanChatSenderChatCall with required parameters.
NewButtonColumn returns keyboard from a single column of Button.
NewButtonLayout creates layout with specified width.
NewButtonRow it's generic helper for create keyboards in functional way.
NewCloseCall constructs a new CloseCall with required parameters.
NewCloseForumTopicCall constructs a new CloseForumTopicCall with required parameters.
NewCloseGeneralForumTopicCall constructs a new CloseGeneralForumTopicCall with required parameters.
NewCopyMessageCall constructs a new CopyMessageCall with required parameters.
NewCopyMessagesCall constructs a new CopyMessagesCall with required parameters.
NewCreateChatInviteLinkCall constructs a new CreateChatInviteLinkCall with required parameters.
NewCreateForumTopicCall constructs a new CreateForumTopicCall with required parameters.
NewCreateInvoiceLinkCall constructs a new CreateInvoiceLinkCall with required parameters.
NewCreateNewStickerSetCall constructs a new CreateNewStickerSetCall with required parameters.
NewDeclineChatJoinRequestCall constructs a new DeclineChatJoinRequestCall with required parameters.
NewDeleteChatPhotoCall constructs a new DeleteChatPhotoCall with required parameters.
NewDeleteChatStickerSetCall constructs a new DeleteChatStickerSetCall with required parameters.
NewDeleteForumTopicCall constructs a new DeleteForumTopicCall with required parameters.
NewDeleteMessageCall constructs a new DeleteMessageCall with required parameters.
NewDeleteMessagesCall constructs a new DeleteMessagesCall with required parameters.
NewDeleteMyCommandsCall constructs a new DeleteMyCommandsCall with required parameters.
NewDeleteStickerFromSetCall constructs a new DeleteStickerFromSetCall with required parameters.
NewDeleteStickerSetCall constructs a new DeleteStickerSetCall with required parameters.
NewDeleteWebhookCall constructs a new DeleteWebhookCall with required parameters.
NewEditChatInviteLinkCall constructs a new EditChatInviteLinkCall with required parameters.
NewEditForumTopicCall constructs a new EditForumTopicCall with required parameters.
NewEditGeneralForumTopicCall constructs a new EditGeneralForumTopicCall with required parameters.
NewEditMessageCaptionCall constructs a new EditMessageCaptionCall with required parameters.
NewEditMessageCaptionCall constructs a new EditMessageCaptionCall with required parameters.
NewEditMessageLiveLocationCall constructs a new EditMessageLiveLocationCall with required parameters.
NewEditMessageLiveLocationCall constructs a new EditMessageLiveLocationCall with required parameters.
NewEditMessageMediaCall constructs a new EditMessageMediaCall with required parameters.
NewEditMessageReplyMarkupCall constructs a new EditMessageReplyMarkupCall with required parameters.
NewEditMessageReplyMarkupCall constructs a new EditMessageReplyMarkupCall with required parameters.
NewEditMessageTextCall constructs a new EditMessageTextCall with required parameters.
NewEditMessageTextCall constructs a new EditMessageTextCall with required parameters.
NewExportChatInviteLinkCall constructs a new ExportChatInviteLinkCall with required parameters.
NewFileArgID creates a new FileArg for sending a file by file_id.
NewFileArgUpload creates a new FileArg for uploading a file by content.
NewFileArgURL creates a new FileArg for sending a file by URL.
NewForceReply creates a new ForceReply.
NewForwardMessageCall constructs a new ForwardMessageCall with required parameters.
NewForwardMessagesCall constructs a new ForwardMessagesCall with required parameters.
NewGetBusinessConnectionCall constructs a new GetBusinessConnectionCall with required parameters.
NewGetChatAdministratorsCall constructs a new GetChatAdministratorsCall with required parameters.
NewGetChatCall constructs a new GetChatCall with required parameters.
NewGetChatMemberCall constructs a new GetChatMemberCall with required parameters.
NewGetChatMemberCountCall constructs a new GetChatMemberCountCall with required parameters.
NewGetChatMenuButtonCall constructs a new GetChatMenuButtonCall with required parameters.
NewGetCustomEmojiStickersCall constructs a new GetCustomEmojiStickersCall with required parameters.
NewGetFileCall constructs a new GetFileCall with required parameters.
NewGetForumTopicIconStickersCall constructs a new GetForumTopicIconStickersCall with required parameters.
NewGetGameHighScoresCall constructs a new GetGameHighScoresCall with required parameters.
NewGetMeCall constructs a new GetMeCall with required parameters.
NewGetMyCommandsCall constructs a new GetMyCommandsCall with required parameters.
NewGetMyDefaultAdministratorRightsCall constructs a new GetMyDefaultAdministratorRightsCall with required parameters.
NewGetMyDescriptionCall constructs a new GetMyDescriptionCall with required parameters.
NewGetMyNameCall constructs a new GetMyNameCall with required parameters.
NewGetMyShortDescriptionCall constructs a new GetMyShortDescriptionCall with required parameters.
NewGetStickerSetCall constructs a new GetStickerSetCall with required parameters.
NewGetUpdatesCall constructs a new GetUpdatesCall with required parameters.
NewGetUserChatBoostsCall constructs a new GetUserChatBoostsCall with required parameters.
NewGetUserProfilePhotosCall constructs a new GetUserProfilePhotosCall with required parameters.
NewGetWebhookInfoCall constructs a new GetWebhookInfoCall with required parameters.
NewHideGeneralForumTopicCall constructs a new HideGeneralForumTopicCall with required parameters.
NewInlineKeyboardButtonCallback creates a new InlineKeyboardButton with specified callback data.
NewInlineKeyboardButtonCallbackGame represents the button which open a game.
InlineKeyboardMarkup represents button that open web page with auth data.
NewInlineKeyboardButtonPay represents a Pay button.
NewInlineKeyboardButtonSwitchInlineQuery represents button that will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field.
NewInlineKeyboardButtonSwitchInlineQueryCurrentChat represents button that will insert the bot's username and the specified inline query in the current chat's input field.
NewInlineButtonURL create inline button with http(s):// or tg:// URL to be opened when the button is pressed.
NewInlineKeyboardButtonWebApp creates a button that open a web app.
NewInlineKeyboardMarkup creates a new InlineKeyboardMarkup.
NewInputFile creates new InputFile with given name and body.
NewInputFileFromBytes creates new InputFile with given name and bytes slice.
NewInputFileFS creates the InputFile from provided FS and file path.
NewInputFileLocal creates the InputFile from provided local file path.
NewInterceptorDefaultParseMethod returns a new interceptor that sets the parse_method to the request if it is empty.
ТewInterceptorMethodFilter returns a new filtering interceptor that calls the interceptor only for specified methods.
NewInterceptorRetryFloodError returns a new interceptor that retries the request if the error is flood error.
NewInterceptorRetryInternalServerError returns a new interceptor that retries the request if the error is internal server error.
NewKeyboardButton creates a plain reply keyboard button.
NewKeyboardButtonRequestChats creates a reply keyboard button that request a chat from user.
NewKeyboardButtonRequestContact creates a reply keyboard button that request a contact from user.
NewKeyboardButtonRequestLocation creates a reply keyboard button that request a location from user.
NewKeyboardButtonRequestPoll creates a reply keyboard button that request a poll from user.
NewKeyboardButtonRequestUsers creates a reply keyboard button that request a user from user.
NewKeyboardButtonWebApp create a reply keyboard button that open a web app.
NewLeaveChatCall constructs a new LeaveChatCall with required parameters.
NewLogOutCall constructs a new LogOutCall with required parameters.
NewPinChatMessageCall constructs a new PinChatMessageCall with required parameters.
NewPromoteChatMemberCall constructs a new PromoteChatMemberCall with required parameters.
NewReactionTypeCustomEmoji returns ReactionType with custom emoji subtype.
NewReactionTypeEmoji returns ReactionType with emoji subtype.
NewReopenForumTopicCall constructs a new ReopenForumTopicCall with required parameters.
NewReopenGeneralForumTopicCall constructs a new ReopenGeneralForumTopicCall with required parameters.
NewReplaceStickerInSetCall constructs a new ReplaceStickerInSetCall with required parameters.
NewReplyKeyboardMarkup creates a new ReplyKeyboardMarkup.
NewReplyKeyboardRemove creates a new ReplyKeyboardRemove.
No description provided by the author
NewRestrictChatMemberCall constructs a new RestrictChatMemberCall with required parameters.
NewRevokeChatInviteLinkCall constructs a new RevokeChatInviteLinkCall with required parameters.
NewSendAnimationCall constructs a new SendAnimationCall with required parameters.
NewSendAudioCall constructs a new SendAudioCall with required parameters.
NewSendChatActionCall constructs a new SendChatActionCall with required parameters.
NewSendContactCall constructs a new SendContactCall with required parameters.
NewSendDiceCall constructs a new SendDiceCall with required parameters.
NewSendDocumentCall constructs a new SendDocumentCall with required parameters.
NewSendGameCall constructs a new SendGameCall with required parameters.
NewSendInvoiceCall constructs a new SendInvoiceCall with required parameters.
NewSendLocationCall constructs a new SendLocationCall with required parameters.
NewSendMediaGroupCall constructs a new SendMediaGroupCall with required parameters.
NewSendMessageCall constructs a new SendMessageCall with required parameters.
NewSendPhotoCall constructs a new SendPhotoCall with required parameters.
NewSendPollCall constructs a new SendPollCall with required parameters.
NewSendStickerCall constructs a new SendStickerCall with required parameters.
NewSendVenueCall constructs a new SendVenueCall with required parameters.
NewSendVideoCall constructs a new SendVideoCall with required parameters.
NewSendVideoNoteCall constructs a new SendVideoNoteCall with required parameters.
NewSendVoiceCall constructs a new SendVoiceCall with required parameters.
NewSetChatAdministratorCustomTitleCall constructs a new SetChatAdministratorCustomTitleCall with required parameters.
NewSetChatDescriptionCall constructs a new SetChatDescriptionCall with required parameters.
NewSetChatMenuButtonCall constructs a new SetChatMenuButtonCall with required parameters.
NewSetChatPermissionsCall constructs a new SetChatPermissionsCall with required parameters.
NewSetChatPhotoCall constructs a new SetChatPhotoCall with required parameters.
NewSetChatStickerSetCall constructs a new SetChatStickerSetCall with required parameters.
NewSetChatTitleCall constructs a new SetChatTitleCall with required parameters.
NewSetCustomEmojiStickerSetThumbnailCall constructs a new SetCustomEmojiStickerSetThumbnailCall with required parameters.
NewSetGameScoreCall constructs a new SetGameScoreCall with required parameters.
NewSetMessageReactionCall constructs a new SetMessageReactionCall with required parameters.
NewSetMyCommandsCall constructs a new SetMyCommandsCall with required parameters.
NewSetMyDefaultAdministratorRightsCall constructs a new SetMyDefaultAdministratorRightsCall with required parameters.
NewSetMyDescriptionCall constructs a new SetMyDescriptionCall with required parameters.
NewSetMyNameCall constructs a new SetMyNameCall with required parameters.
NewSetMyShortDescriptionCall constructs a new SetMyShortDescriptionCall with required parameters.
NewSetPassportDataErrorsCall constructs a new SetPassportDataErrorsCall with required parameters.
NewSetStickerEmojiListCall constructs a new SetStickerEmojiListCall with required parameters.
NewSetStickerKeywordsCall constructs a new SetStickerKeywordsCall with required parameters.
NewSetStickerMaskPositionCall constructs a new SetStickerMaskPositionCall with required parameters.
NewSetStickerPositionInSetCall constructs a new SetStickerPositionInSetCall with required parameters.
NewSetStickerSetThumbnailCall constructs a new SetStickerSetThumbnailCall with required parameters.
NewSetStickerSetTitleCall constructs a new SetStickerSetTitleCall with required parameters.
NewSetWebhookCall constructs a new SetWebhookCall with required parameters.
NewStopMessageLiveLocationCall constructs a new StopMessageLiveLocationCall with required parameters.
NewStopMessageLiveLocationCall constructs a new StopMessageLiveLocationCall with required parameters.
NewStopPollCall constructs a new StopPollCall with required parameters.
NewUnbanChatMemberCall constructs a new UnbanChatMemberCall with required parameters.
NewUnbanChatSenderChatCall constructs a new UnbanChatSenderChatCall with required parameters.
NewUnhideGeneralForumTopicCall constructs a new UnhideGeneralForumTopicCall with required parameters.
NewUnpinAllChatMessagesCall constructs a new UnpinAllChatMessagesCall with required parameters.
NewUnpinAllForumTopicMessagesCall constructs a new UnpinAllForumTopicMessagesCall with required parameters.
NewUnpinAllGeneralForumTopicMessagesCall constructs a new UnpinAllGeneralForumTopicMessagesCall with required parameters.
NewUnpinChatMessageCall constructs a new UnpinChatMessageCall with required parameters.
NewUploadStickerFileCall constructs a new UploadStickerFileCall with required parameters.
ParseAuthWidgetQuery parses a query string and returns an AuthWidget.
ParseWebAppInitData parses a WebAppInitData from query string.
WithClientDoer sets custom http client for Client.
WithClientInterceptor adds interceptor to client.
WithClientServerURL sets custom server url for Client.
WithClientTestEnv switches bot to test environment.
WithInterceptorRetryFloodErrorMaxRetryAfter sets the maximum retry after duration.
WithInterceptorRetryFloodErrorTimeAfter sets the time.After function.
WithInterceptorRetryFloodErrorTries sets the number of tries.
WithInterceptorRetryInternalServerErrorDelay sets the delay between tries.
WithInterceptorRetryInternalServerErrorTimeAfter sets the time.After function.
WithInterceptorRetryInternalServerErrorTries sets the number of tries.

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
ChatTypeChannel represents channels.
ChatTypeGroup represents group chats.
ChatTypePrivate represents one-to-one chat.
ChatTypeSender for a private chat with the inline query sender.
ChatTypeSupergroup supergroup chats.
<blockquote>quote</blockquote>.
<strong>bold</strong>.
/start@jobs_bot.
$USD.
<code>code</code>.
for inline custom emoji sticker.
#hashtag.
<i>italic</i>.
@username.
+1-212-555-0123.
<pre>pre</pre>.
<tg-spoiler>spoiler</tg-spoiler>.
<strike>strike</strike>.
<a href="https://telegram.org">link</a>.
for users without usernames.
<u>underline</u>.
No description provided by the author
https://telegram.org.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

HTML is ParseMode that uses HTML tags.
MD is ParseMode that uses Markdown tags.
MD2 is ParseMode that uses MarkdownV2 tags.
Define all available reactions that can be used in the bot.
ReactionTypeEmojiAll is a list of all available emoji reactions that can be used in the bot as ReactionType.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.
Define all available reactions that can be used in the bot.

# Structs

AddStickerToSetCall reprenesents a call to the addStickerToSet method.
Animation this object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound).
AnswerCallbackQueryCall reprenesents a call to the answerCallbackQuery method.
AnswerInlineQueryCall reprenesents a call to the answerInlineQuery method.
AnswerPreCheckoutQueryCall reprenesents a call to the answerPreCheckoutQuery method.
AnswerShippingQueryCall reprenesents a call to the answerShippingQuery method.
AnswerWebAppQueryCall reprenesents a call to the answerWebAppQuery method.
ApproveChatJoinRequestCall reprenesents a call to the approveChatJoinRequest method.
Audio this object represents an audio file to be treated as music by the Telegram clients.
AuthWidget represents Telegram Login Widget data.
BanChatMemberCall reprenesents a call to the banChatMember method.
BanChatSenderChatCall reprenesents a call to the banChatSenderChat method.
Birthdate.
BotCommand this object represents a bot command.
BotCommandScopeAllChatAdministrators represents the scope of bot commands, covering all group and supergroup chat administrators.
BotCommandScopeAllGroupChats represents the scope of bot commands, covering all group and supergroup chats.
BotCommandScopeAllPrivateChats represents the scope of bot commands, covering all private chats.
BotCommandScopeChat represents the scope of bot commands, covering a specific chat.
BotCommandScopeChatAdministrators represents the scope of bot commands, covering all administrators of a specific group or supergroup chat.
BotCommandScopeChatMember represents the scope of bot commands, covering a specific member of a group or supergroup chat.
BotCommandScopeDefault represents the default scope of bot commands.
BotDescription this object represents the bot's description.
BotName this object represents the bot's name.
BotShortDescription this object represents the bot's short description.
BusinessConnection describes the connection of the bot with a business account.
BusinessIntro.
BusinessLocation.
BusinessMessagesDeleted this object is received when messages are deleted from a connected business account.
BusinessOpeningHours.
BusinessOpeningHoursInterval.
ButtonLayout it's build for fixed width keyboards.
No description provided by the author
No description provided by the author
CallbackQuery this object represents an incoming callback query from a callback button in an inline keyboard.
No description provided by the author
Chat this object represents a chat.
ChatAdministratorRights represents the rights of an administrator in a chat.
ChatBoost this object contains information about a chat boost.
ChatBoostAdded this object represents a service message about a user boosting a chat.
ChatBoostRemoved this object represents a boost removed from a chat.
ChatBoostSource this object describes the source of a chat boost.
ChatBoostSourceGiftCode the boost was obtained by the creation of Telegram Premium gift codes to boost a chat.
ChatBoostSourceGiveaway the boost was obtained by the creation of a Telegram Premium giveaway.
ChatBoostSourcePremium the boost was obtained by subscribing to Telegram Premium or by gifting a Telegram Premium subscription to another user.
ChatBoostUpdated this object represents a boost added to a chat or changed.
ChatInviteLink represents an invite link for a chat.
ChatJoinRequest represents a join request sent to a chat.
ChatLocation represents a location to which a chat is connected.
ChatMember this object contains information about one member of a chat.
ChatMemberAdministrator represents a chat member that has some additional privileges.
ChatMemberBanned represents a chat member that was banned in the chat and can't return to the chat or view chat messages.
ChatMemberLeft represents a chat member that isn't currently a member of the chat, but may join it themselves.
ChatMemberMember represents a chat member that has no additional privileges or restrictions.
ChatMemberOwner represents a chat member that owns the chat and has all administrator privileges.
ChatMemberRestricted represents a chat member that is under certain restrictions in the chat.
ChatMemberUpdated this object represents changes in the status of a chat member.
ChatPermissions describes actions that a non-administrator user is allowed to take in a chat.
ChatPhoto this object represents a chat photo.
ChatShared this object contains information about a chat that was shared with the bot using a KeyboardButtonRequestChat button.
ChosenInlineResult represents a result of an inline query that was chosen by the user and sent to their chat partner.
Client is Telegram Bot API client structure.
CloseCall reprenesents a call to the close method.
CloseForumTopicCall reprenesents a call to the closeForumTopic method.
CloseGeneralForumTopicCall reprenesents a call to the closeGeneralForumTopic method.
Contact this object represents a phone contact.
CopyMessageCall reprenesents a call to the copyMessage method.
CopyMessagesCall reprenesents a call to the copyMessages method.
CreateChatInviteLinkCall reprenesents a call to the createChatInviteLink method.
CreateForumTopicCall reprenesents a call to the createForumTopic method.
CreateInvoiceLinkCall reprenesents a call to the createInvoiceLink method.
CreateNewStickerSetCall reprenesents a call to the createNewStickerSet method.
DeclineChatJoinRequestCall reprenesents a call to the declineChatJoinRequest method.
DeleteChatPhotoCall reprenesents a call to the deleteChatPhoto method.
DeleteChatStickerSetCall reprenesents a call to the deleteChatStickerSet method.
DeleteForumTopicCall reprenesents a call to the deleteForumTopic method.
DeleteMessageCall reprenesents a call to the deleteMessage method.
DeleteMessagesCall reprenesents a call to the deleteMessages method.
DeleteMyCommandsCall reprenesents a call to the deleteMyCommands method.
DeleteStickerFromSetCall reprenesents a call to the deleteStickerFromSet method.
DeleteStickerSetCall reprenesents a call to the deleteStickerSet method.
DeleteWebhookCall reprenesents a call to the deleteWebhook method.
Dice this object represents an animated emoji that displays a random value.
Document this object represents a general file (as opposed to photos, voice messages and audio files).
EditChatInviteLinkCall reprenesents a call to the editChatInviteLink method.
EditForumTopicCall reprenesents a call to the editForumTopic method.
EditGeneralForumTopicCall reprenesents a call to the editGeneralForumTopic method.
EditMessageCaptionCall reprenesents a call to the editMessageCaption method.
EditMessageLiveLocationCall reprenesents a call to the editMessageLiveLocation method.
EditMessageMediaCall reprenesents a call to the editMessageMedia method.
EditMessageReplyMarkupCall reprenesents a call to the editMessageReplyMarkup method.
EditMessageTextCall reprenesents a call to the editMessageText method.
EncryptedCredentials describes data required for decrypting and authenticating EncryptedPassportElement.
EncryptedPassportElement describes documents or other Telegram Passport elements shared with the bot by the user.
Error is Telegram Bot API error structure.
ExportChatInviteLinkCall reprenesents a call to the exportChatInviteLink method.
ExternalReplyInfo this object contains information about a message that is being replied to, which may come from another chat or forum topic.
File this object represents a file ready to be downloaded.
FileArg it's union type for different ways of sending files.
ForceReply upon receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the user has selected the bot's message and tapped 'Reply').
ForumTopic this object represents a forum topic.
ForumTopicClosed represents a service message about a forum topic closed in the chat.
ForumTopicCreated this object represents a service message about a new forum topic created in the chat.
ForumTopicEdited this object represents a service message about an edited forum topic.
ForumTopicReopened represents a service message about a forum topic reopened in the chat.
ForwardMessageCall reprenesents a call to the forwardMessage method.
ForwardMessagesCall reprenesents a call to the forwardMessages method.
Game this object represents a game.
GameHighScore this object represents one row of the high scores table for a game.
GeneralForumTopicHidden represents a service message about General forum topic hidden in the chat.
GeneralForumTopicUnhidden represents a service message about General forum topic unhidden in the chat.
GetBusinessConnectionCall reprenesents a call to the getBusinessConnection method.
GetChatAdministratorsCall reprenesents a call to the getChatAdministrators method.
GetChatCall reprenesents a call to the getChat method.
GetChatMemberCall reprenesents a call to the getChatMember method.
GetChatMemberCountCall reprenesents a call to the getChatMemberCount method.
GetChatMenuButtonCall reprenesents a call to the getChatMenuButton method.
GetCustomEmojiStickersCall reprenesents a call to the getCustomEmojiStickers method.
GetFileCall reprenesents a call to the getFile method.
GetForumTopicIconStickersCall reprenesents a call to the getForumTopicIconStickers method.
GetGameHighScoresCall reprenesents a call to the getGameHighScores method.
GetMeCall reprenesents a call to the getMe method.
GetMyCommandsCall reprenesents a call to the getMyCommands method.
GetMyDefaultAdministratorRightsCall reprenesents a call to the getMyDefaultAdministratorRights method.
GetMyDescriptionCall reprenesents a call to the getMyDescription method.
GetMyNameCall reprenesents a call to the getMyName method.
GetMyShortDescriptionCall reprenesents a call to the getMyShortDescription method.
GetStickerSetCall reprenesents a call to the getStickerSet method.
GetUpdatesCall reprenesents a call to the getUpdates method.
GetUserChatBoostsCall reprenesents a call to the getUserChatBoosts method.
GetUserProfilePhotosCall reprenesents a call to the getUserProfilePhotos method.
GetWebhookInfoCall reprenesents a call to the getWebhookInfo method.
Giveaway this object represents a message about a scheduled giveaway.
GiveawayCompleted this object represents a service message about the completion of a giveaway without public winners.
GiveawayCreated represents a service message about a giveaway created in the chat.
GiveawayWinners this object represents a message about the completion of a giveaway with public winners.
HideGeneralForumTopicCall reprenesents a call to the hideGeneralForumTopic method.
InaccessibleMessage this object describes a message that was deleted or is otherwise inaccessible to the bot.
InlineKeyboardButton this object represents one button of an inline keyboard.
InlineKeyboardMarkup this object represents an inline keyboard that appears right next to the message it belongs to.
InlineQuery this object represents an incoming inline query.
InlineQueryResultArticle represents a link to an article or web page.
InlineQueryResultAudio represents a link to an MP3 audio file.
InlineQueryResultCachedAudio represents a link to an MP3 audio file stored on the Telegram servers.
InlineQueryResultCachedDocument represents a link to a file stored on the Telegram servers.
InlineQueryResultCachedGIF represents a link to an animated GIF file stored on the Telegram servers.
InlineQueryResultCachedMPEG4GIF represents a link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the Telegram servers.
InlineQueryResultCachedPhoto represents a link to a photo stored on the Telegram servers.
InlineQueryResultCachedSticker represents a link to a sticker stored on the Telegram servers.
InlineQueryResultCachedVideo represents a link to a video file stored on the Telegram servers.
InlineQueryResultCachedVoice represents a link to a voice message stored on the Telegram servers.
InlineQueryResultContact represents a contact with a phone number.
InlineQueryResultDocument represents a link to a file.
InlineQueryResultGame represents a Game.
InlineQueryResultGIF represents a link to an animated GIF file.
InlineQueryResultLocation represents a location on a map.
InlineQueryResultMPEG4GIF represents a link to a video animation (H.264/MPEG-4 AVC video without sound).
InlineQueryResultPhoto represents a link to a photo.
InlineQueryResultsButton this object represents a button to be shown above inline query results.
InlineQueryResultVenue represents a venue.
InlineQueryResultVideo represents a link to a page containing an embedded video player or a video file.
InlineQueryResultVoice represents a link to a voice recording in an .OGG container encoded with OPUS.
InputContactMessageContent represents the content of a contact message to be sent as the result of an inline query.
InputFile represents the file that should be uploaded to the telegram.
InputInvoiceMessageContent represents the content of an invoice message to be sent as the result of an inline query.
InputLocationMessageContent represents the content of a location message to be sent as the result of an inline query.
InputMediaAnimation represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent.
InputMediaAudio represents an audio file to be treated as music to be sent.
InputMediaDocument represents a general file to be sent.
InputMediaPhoto represents a photo to be sent.
InputMediaVideo represents a video to be sent.
InputSticker this object describes a sticker to be added to a sticker set.
InputTextMessageContent represents the content of a text message to be sent as the result of an inline query.
InputVenueMessageContent represents the content of a venue message to be sent as the result of an inline query.
Invoice this object contains basic information about an invoice.
KeyboardButton this object represents one button of the reply keyboard.
KeyboardButtonPollType this object represents type of a poll, which is allowed to be created and sent when the corresponding button is pressed.
KeyboardButtonRequestChat this object defines the criteria used to request a suitable chat.
KeyboardButtonRequestUsers this object defines the criteria used to request suitable users.
LabeledPrice this object represents a portion of the price for goods or services.
LeaveChatCall reprenesents a call to the leaveChat method.
LinkPreviewOptions describes the options used for link preview generation.
Location this object represents a point on the map.
LoginURL this object represents a parameter of the inline keyboard button used to automatically authorize a user.
LogOutCall reprenesents a call to the logOut method.
MaskPosition this object describes the position on faces where a mask should be placed by default.
This object describes a message that can be inaccessible to the bot.
MenuButtonCommands represents a menu button, which opens the bot's list of commands.
MenuButtonDefault describes that no specific value for the menu button was set.
MenuButtonOneOf contains one of MenuButton implementations.
MenuButtonWebApp represents a menu button, which launches a Web App.
Message this object represents a message.
MessageAutoDeleteTimerChanged this object represents a service message about a change in auto-delete timer settings.
MessageEntity this object represents one special entity in a text message.
MessageID this object represents a unique message identifier.
MessageOrigin this object describes the origin of a message.
MessageOriginChannel the message was originally sent to a channel chat.
MessageOriginChat the message was originally sent on behalf of a chat to a group chat.
MessageOriginHiddenUser the message was originally sent by an unknown user.
MessageOriginUser the message was originally sent by a known user.
MessageReactionCountUpdated this object represents reaction changes on a message with anonymous reactions.
MessageReactionUpdated this object represents a change of a reaction on a message performed by a user.
OrderInfo this object represents information about an order.
PassportData describes Telegram Passport data shared with the bot by the user.
PassportElementError this object represents an error in the Telegram Passport element which was submitted that should be resolved by the user.
PassportElementErrorDataField represents an issue in one of the data fields that was provided by the user.
PassportElementErrorFile represents an issue with a document scan.
PassportElementErrorFiles represents an issue with a list of scans.
PassportElementErrorFrontSide represents an issue with the front side of a document.
PassportElementErrorReverseSide represents an issue with the reverse side of a document.
PassportElementErrorSelfie represents an issue with the selfie with a document.
PassportElementErrorTranslationFile represents an issue with one of the files that constitute the translation of a document.
PassportElementErrorTranslationFiles represents an issue with the translated version of a document.
PassportElementErrorUnspecified represents an issue in an unspecified place.
PassportFile this object represents a file uploaded to Telegram Passport.
PhotoSize this object represents one size of a photo or a file / sticker thumbnail.
PinChatMessageCall reprenesents a call to the pinChatMessage method.
Poll this object contains information about a poll.
PollAnswer this object represents an answer of a user in a non-anonymous poll.
PollOption this object contains information about one answer option in a poll.
PreCheckoutQuery this object contains information about an incoming pre-checkout query.
PromoteChatMemberCall reprenesents a call to the promoteChatMember method.
ProximityAlertTriggered this object represents the content of a service message, sent whenever a user in the chat triggers a proximity alert set by another user.
ReactionCount represents a reaction added to a message along with the number of times it was added.
ReactionType it's type for describe content of Reaction.
ReactionTypeCustomEmoji the reaction is based on a custom emoji.
ReactionTypeEmoji the reaction is based on an emoji.
ReopenForumTopicCall reprenesents a call to the reopenForumTopic method.
ReopenGeneralForumTopicCall reprenesents a call to the reopenGeneralForumTopic method.
ReplaceStickerInSetCall reprenesents a call to the replaceStickerInSet method.
ReplyKeyboardMarkup this object represents a custom keyboard with reply options (see Introduction to bots for details and examples).
ReplyKeyboardRemove upon receiving a message with this object, Telegram clients will remove the current custom keyboard and display the default letter-keyboard.
ReplyParameters describes reply parameters for the message that is being sent.
Request is Telegram Bot API request structure.
Response is Telegram Bot API response structure.
ResponseParameters describes why a request was unsuccessful.
RestrictChatMemberCall reprenesents a call to the restrictChatMember method.
RevokeChatInviteLinkCall reprenesents a call to the revokeChatInviteLink method.
SendAnimationCall reprenesents a call to the sendAnimation method.
SendAudioCall reprenesents a call to the sendAudio method.
SendChatActionCall reprenesents a call to the sendChatAction method.
SendContactCall reprenesents a call to the sendContact method.
SendDiceCall reprenesents a call to the sendDice method.
SendDocumentCall reprenesents a call to the sendDocument method.
SendGameCall reprenesents a call to the sendGame method.
SendInvoiceCall reprenesents a call to the sendInvoice method.
SendLocationCall reprenesents a call to the sendLocation method.
SendMediaGroupCall reprenesents a call to the sendMediaGroup method.
SendMessageCall reprenesents a call to the sendMessage method.
SendPhotoCall reprenesents a call to the sendPhoto method.
SendPollCall reprenesents a call to the sendPoll method.
SendStickerCall reprenesents a call to the sendSticker method.
SendVenueCall reprenesents a call to the sendVenue method.
SendVideoCall reprenesents a call to the sendVideo method.
SendVideoNoteCall reprenesents a call to the sendVideoNote method.
SendVoiceCall reprenesents a call to the sendVoice method.
SentWebAppMessage describes an inline message sent by a Web App on behalf of a user.
SetChatAdministratorCustomTitleCall reprenesents a call to the setChatAdministratorCustomTitle method.
SetChatDescriptionCall reprenesents a call to the setChatDescription method.
SetChatMenuButtonCall reprenesents a call to the setChatMenuButton method.
SetChatPermissionsCall reprenesents a call to the setChatPermissions method.
SetChatPhotoCall reprenesents a call to the setChatPhoto method.
SetChatStickerSetCall reprenesents a call to the setChatStickerSet method.
SetChatTitleCall reprenesents a call to the setChatTitle method.
SetCustomEmojiStickerSetThumbnailCall reprenesents a call to the setCustomEmojiStickerSetThumbnail method.
SetGameScoreCall reprenesents a call to the setGameScore method.
SetMessageReactionCall reprenesents a call to the setMessageReaction method.
SetMyCommandsCall reprenesents a call to the setMyCommands method.
SetMyDefaultAdministratorRightsCall reprenesents a call to the setMyDefaultAdministratorRights method.
SetMyDescriptionCall reprenesents a call to the setMyDescription method.
SetMyNameCall reprenesents a call to the setMyName method.
SetMyShortDescriptionCall reprenesents a call to the setMyShortDescription method.
SetPassportDataErrorsCall reprenesents a call to the setPassportDataErrors method.
SetStickerEmojiListCall reprenesents a call to the setStickerEmojiList method.
SetStickerKeywordsCall reprenesents a call to the setStickerKeywords method.
SetStickerMaskPositionCall reprenesents a call to the setStickerMaskPosition method.
SetStickerPositionInSetCall reprenesents a call to the setStickerPositionInSet method.
SetStickerSetThumbnailCall reprenesents a call to the setStickerSetThumbnail method.
SetStickerSetTitleCall reprenesents a call to the setStickerSetTitle method.
SetWebhookCall reprenesents a call to the setWebhook method.
SharedUser this object contains information about a user that was shared with the bot using a KeyboardButtonRequestUser button.
ShippingAddress this object represents a shipping address.
ShippingOption this object represents one shipping option.
ShippingQuery this object contains information about an incoming shipping query.
Sticker this object represents a sticker.
StickerSet this object represents a sticker set.
StopMessageLiveLocationCall reprenesents a call to the stopMessageLiveLocation method.
StopPollCall reprenesents a call to the stopPoll method.
Story
Story this object represents a story.
SuccessfulPayment this object contains basic information about a successful payment.
SwitchInlineQueryChosenChat this object represents an inline button that switches the current user to inline mode in a chosen chat, with an optional default inline query.
TextQuote this object contains information about the quoted part of a message that is replied to by the given message.
UnbanChatMemberCall reprenesents a call to the unbanChatMember method.
UnbanChatSenderChatCall reprenesents a call to the unbanChatSenderChat method.
UnhideGeneralForumTopicCall reprenesents a call to the unhideGeneralForumTopic method.
UnpinAllChatMessagesCall reprenesents a call to the unpinAllChatMessages method.
UnpinAllForumTopicMessagesCall reprenesents a call to the unpinAllForumTopicMessages method.
UnpinAllGeneralForumTopicMessagesCall reprenesents a call to the unpinAllGeneralForumTopicMessages method.
UnpinChatMessageCall reprenesents a call to the unpinChatMessage method.
Update this object represents an incoming update.At most one of the optional parameters can be present in any given update.
UploadStickerFileCall reprenesents a call to the uploadStickerFile method.
User this object represents a Telegram user or bot.
UserChatBoosts this object represents a list of boosts added to a chat by a user.
UserProfilePhotos this object represent a user's profile pictures.
UsersShared this object contains information about the users whose identifiers were shared with the bot using a KeyboardButtonRequestUsers button.
Venue this object represents a venue.
Video this object represents a video file.
VideoChatEnded this object represents a service message about a video chat ended in the chat.
VideoChatParticipantsInvited this object represents a service message about new members invited to a video chat.
VideoChatScheduled this object represents a service message about a video chat scheduled in the chat.
VideoChatStarted represents a service message about a video chat started in the chat.
VideoNote this object represents a video message (available in Telegram apps as of v.4.0).
Voice this object represents a voice note.
WebAppChat this object represents a chat.
WebAppData describes data sent from a Web App to the bot.
WebAppInfo describes a Web App.
WebAppInitData this object contains data that is transferred to the Mini App when it is opened.
WebAppUser this object contains the data of the Mini App user.
WebhookInfo describes the current status of a webhook.
WriteAccessAllowed this object represents a service message about a user allowing a bot to write messages after adding it to the attachment menu, launching a Web App from a link, or accepting an explicit request from a Web App sent by the method requestWriteAccess.

# Interfaces

BotCommandScope it's generic interface for all types of bot command scope.
Button define generic button interface.
No description provided by the author
No description provided by the author
Encoder represents request encoder.
InlineQueryResult it's a generic interface for all inline query results.
InputMedia generic interface for InputMedia*.
InputMessageContent it's generic interface for all types of input message content.
MenuButton it's generic interface for all types of menu button.
No description provided by the author
PeerID represents generic Telegram peer.
ReplyMarkup generic for keyboards.

# Type aliases

ChatAction type of action to broadcast via sendChatAction.
No description provided by the author
ChatType represents enum of possible chat types.
ClientOption is a function that sets some option for Client.
No description provided by the author
Interceptor is a function that intercepts request and response.
No description provided by the author
InterceptorRetryFloodErrorOption is an option for NewRetryFloodErrorInterceptor.
MessageEntityType it's type for describe content of MessageEntity.
MessageType it's type for describe content of Message.
RetryInternalServerErrorOption is an option for NewRetryInternalServerErrorInterceptor.
StickerType it's type for describe content of Sticker.
UpdateType it's type for describe content of Update.
UserID it's unique identifier for Telegram user or bot.
Username represents a Telegram username.