tg

package module
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: MIT Imports: 28 Imported by: 8

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.

⚠️ The API definitions are stable and the package is well tested and used in production. However, go-tg is still under active development and full backward compatibility is not guaranteed before reaching v1.0.0.

Features

  • 🚀 Code for Bot API types and methods is generated with embedded official documentation.
  • ✅ Support context.Context.
  • 🔗 API Client and bot framework are strictly separated, you can use them independently.
  • ⚡ No runtime reflection overhead.
  • 🔄 Supports Webhook and Polling natively;
  • 📬 Webhook reply for high load bots;
  • 🙌 Handlers, filters, and middleware are supported.
  • 🌐 WebApps and Login Widget helpers.
  • 🤝 Business connections support

Install

# go 1.21+
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 to create a client is to call tg.New with a token. It uses http.DefaultClient and api.telegram.org by default:

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("sent 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 will 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.Printf("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

Parse Mode Formatters

The tg.ParseMode interface provides a fluent API for formatting message text. Three modes are available: tg.HTML, tg.MD2 (MarkdownV2), and tg.MD (legacy Markdown).

pm := tg.HTML

text := pm.Text(
  pm.Bold("Order confirmed"),
  "",
  pm.Line("Item:", pm.Code("SKU-42")),
  pm.Line("Price:", pm.Bold("$9.99")),
  "",
  pm.Italic("Thank you for your purchase!"),
)

// sends:
// <b>Order confirmed</b>
//
// Item: <code>SKU-42</code>
// Price: <b>$9.99</b>
//
// <i>Thank you for your purchase!</i>

Text(parts...) joins with newlines, Line(parts...) joins with spaces.

Formatting methods: Bold, Italic, Underline, Strike, Spoiler, Code, Pre, PreLanguage, Blockquote, ExpandableBlockquote.

Links and mentions: Link(title, url), Mention(name, userID), CustomEmoji(emoji, emojiID).

Escaping: Escape(v) escapes special characters for the current mode. Escapef(format, args...) escapes the format string while passing args through unchanged — useful for MarkdownV2 where characters like . ! | need escaping:

pm := tg.MD2

pm.Escapef("Total: %s for %s", pm.Bold("$9.99"), pm.Code("SKU-42"))
// escapes "Total:" and "for" but leaves Bold/Code output intact

See full example: examples/parse-mode.

Keyboard Builders

tg.NewInlineKeyboard and tg.NewReplyKeyboard provide a fluent API for building keyboards.

Inline keyboard with explicit rows:

kb := tg.NewInlineKeyboard().
    Callback("📋 Orders", "orders").Callback("⚙ Settings", "settings").Row().
    URL("📖 Docs", "https://example.com/docs")

msg.Answer("Menu").ReplyMarkup(kb).DoVoid(ctx)

Dynamic buttons with Adjust:

Adjust(sizes...) redistributes buttons into rows with a repeating size pattern.

kb := tg.NewInlineKeyboard()
for _, item := range items {
    kb.Button(itemFilter.MustButton(item.Name, itemData{ID: item.ID}))
}

msg.Answer("Items:").ReplyMarkup(kb.Adjust(2)).DoVoid(ctx)
// 2 buttons per row

Mixing static and dynamic rows:

kb := tg.NewInlineKeyboard().
    Callback("A", "a").Callback("B", "b").Callback("C", "c").Row()
for _, item := range items {
    kb.Callback(item.Name, "item:"+item.ID)
}
kb.Adjust(4)
kb.Callback("Back", "back")
// [A] [B] [C]         ← static
// [I1] [I2] [I3] [I4] ← dynamic
// [I5] [I6]            ← remainder
// [Back]               ← static

Reply keyboard with options:

kb := tg.NewReplyKeyboard().
    Text("Male").Text("Female").Text("Other").
    Resize().OneTime()

msg.Answer("Gender?").ReplyMarkup(kb).DoVoid(ctx)

Methods:

  • Button(buttons...) — add pre-built buttons (e.g. from CallbackFilter.MustButton)
  • Row() — end the current row and start a new one
  • Adjust(sizes...) — redistribute uncommitted buttons into rows with repeating pattern
  • Markup() — return the underlying InlineKeyboardMarkup / ReplyKeyboardMarkup

Both builders implement ReplyMarkup and can be passed directly to .ReplyMarkup().

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,
  // receive 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.

ℹ️ These 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.Post("/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.New(...)

// 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.Handle(ctx, update)
  })
})
Error Handler

All handlers return an error. If any error occurs in the chain, it will be passed to the error handler. By default, errors are returned as-is. You can customize this behavior by registering 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.

Message Builders

When building bots with inline keyboards, you often need to send the same message as a new message in one handler and edit an existing message in another (e.g., responding to a /start command vs. updating on a callback button press). Message builders let you define the message content once and convert it to different API calls as needed.

tgb.TextMessageCallBuilder

Builds text messages that can be sent, edited, or have their reply markup updated.

builder := tgb.NewTextMessageCallBuilder(
  tg.HTML.Text(
    tg.HTML.Bold("Hello!"),
    "",
    tg.HTML.Italic("Select an option:"),
  ),
).
  ParseMode(tg.HTML).
  ReplyMarkup(tg.NewInlineKeyboardMarkup(
    tg.NewButtonRow(
      tg.NewInlineKeyboardButtonCallbackData("Option 1", "opt:1"),
      tg.NewInlineKeyboardButtonCallbackData("Option 2", "opt:2"),
    ),
  ))

Fluent setters: Text, ParseMode, ReplyMarkup, LinkPreviewOptions, Entities, BusinessConnectionID, Client.

Conversion methods:

  • AsSend(peer)sendMessage
  • AsEditText(peer, id) / FromCBQ / FromMsg / InlineeditMessageText
  • AsEditReplyMarkup(peer, id) / FromCBQ / FromMsg / InlineeditMessageReplyMarkup

Example: reusable menu message used for both initial send and callback edits:

func newMenuMessage(items []Item) *tgb.TextMessageCallBuilder {
  pm := tg.HTML
  kb := tg.NewInlineKeyboard()
  for _, item := range items {
    kb.Button(itemFilter.MustButton(item.Name, itemData{ID: item.ID}))
  }

  return tgb.NewTextMessageCallBuilder(
    pm.Text(pm.Bold("Menu"), "", pm.Italic("Select an item:")),
  ).
    ParseMode(pm).
    ReplyMarkup(kb.Adjust(2).Markup())
}

router.
  // send menu as new message on /start
  Message(func(ctx context.Context, msg *tgb.MessageUpdate) error {
    return msg.Update.Reply(ctx, newMenuMessage(items).AsSend(msg.Chat))
  }, tgb.Command("start")).
  // edit existing message on "back" callback
  CallbackQuery(func(ctx context.Context, cbq *tgb.CallbackQueryUpdate) error {
    return cbq.Update.Reply(ctx, newMenuMessage(items).AsEditTextFromCBQ(cbq.CallbackQuery))
  }, backFilter.Filter())

See full example: examples/menu.

tgb.MediaMessageCallBuilder

Builds caption-based media messages that can be sent as different media types, or used to edit captions and media.

builder := tgb.NewMediaMessageCallBuilder(
  tg.HTML.Text(tg.HTML.Bold("Mountain Lake"), "", "A serene mountain lake."),
).
  ParseMode(tg.HTML).
  ShowCaptionAboveMedia(true).
  ReplyMarkup(keyboard)

Fluent setters: Caption, ParseMode, ReplyMarkup, CaptionEntities, ShowCaptionAboveMedia, BusinessConnectionID, Client.

Conversion methods — each send method takes a tg.PeerID and a tg.FileArg:

  • AsSendPhoto / AsSendVideo / AsSendAudio / AsSendDocument / AsSendAnimation / AsSendVoice → corresponding send* method
  • AsEditCaption(peer, id) / FromCBQ / FromMsg / InlineeditMessageCaption
  • AsEditMedia(peer, id, media) / FromCBQ / FromMsg / InlineeditMessageMedia

InputMedia helpers — create tg.InputMedia with the builder's caption settings pre-filled:

NewInputMediaPhoto, NewInputMediaVideo, NewInputMediaAnimation, NewInputMediaAudio, NewInputMediaDocument.

Example: photo gallery with navigation buttons:

func newGalleryMessage(index int) *tgb.MediaMessageCallBuilder {
  item := gallery[index]
  pm := tg.HTML

  prev := (index - 1 + len(gallery)) % len(gallery)
  next := (index + 1) % len(gallery)

  return tgb.NewMediaMessageCallBuilder(
    pm.Text(pm.Bold(item.Title), "", pm.Escape(item.Description)),
  ).
    ParseMode(pm).
    ShowCaptionAboveMedia(true).
    ReplyMarkup(tg.NewInlineKeyboard().
      Button(
        navFilter.MustButton("< Prev", nav{Index: prev}),
        navFilter.MustButton("Next >", nav{Index: next}),
      ).Markup())
}

router.
  // send photo on /start
  Message(func(ctx context.Context, msg *tgb.MessageUpdate) error {
    b := newGalleryMessage(0)
    return msg.Update.Reply(ctx, b.AsSendPhoto(msg.Chat, tg.NewFileArgURL(gallery[0].PhotoURL)))
  }, tgb.Command("start")).
  // navigate gallery on button press
  CallbackQuery(navFilter.Handler(func(ctx context.Context, cbq *tgb.CallbackQueryUpdate, n nav) error {
    b := newGalleryMessage(n.Index)
    photo := b.NewInputMediaPhoto(tg.NewFileArgURL(gallery[n.Index].PhotoURL))
    return cbq.Update.Reply(ctx, b.AsEditMediaFromCBQ(cbq.CallbackQuery, photo))
  }), navFilter.Filter())

See full example: examples/media-gallery.

Structured Callback Data

tgb.CallbackDataFilter[T] provides type-safe, declarative routing for inline keyboards. Instead of manually parsing callback_data strings, you define Go structs for each action — the filter handles encoding (compact enough for the 64-byte Telegram limit), prefix-based routing, and automatic decoding in handlers.

1. Define a struct and create a filter:

type PageNav struct {
  Page int
}

var pageFilter = tgb.NewCallbackDataFilter[PageNav]("page")

The filter encodes structs as "page:1" (integers use base-36 by default for compactness). Supported field types: bool, int*, uint*, float*, string.

2. Create buttons with encoded data:

tg.NewInlineKeyboard().
  Button(
    pageFilter.MustButton("< Prev", PageNav{Page: page - 1}),
    pageFilter.MustButton("Next >", PageNav{Page: page + 1}),
  )

MustButton(text, value) encodes the struct into callback_data and returns an InlineKeyboardButton. Use Button(text, value) if you need error handling.

3. Route and handle with automatic decoding:

router.CallbackQuery(
  pageFilter.Handler(func(ctx context.Context, cbq *tgb.CallbackQueryUpdate, nav PageNav) error {
    // nav.Page is already decoded
    return cbq.Update.Reply(ctx, newPageMessage(nav.Page).AsEditTextFromCBQ(cbq.CallbackQuery))
  }),
  pageFilter.Filter(), // matches callbacks with "page:" prefix
)

Filter() matches callback queries by prefix. Handler() wraps your handler and passes the decoded struct as a third argument.

Codec options can be passed to NewCallbackDataFilter to customize encoding:

var filter = tgb.NewCallbackDataFilter[MyData]("prefix",
  tgb.WithCallbackDataCodecDelimiter(';'),  // field separator (default: ':')
  tgb.WithCallbackDataCodecIntBase(10),     // decimal integers (default: 36)
)

Per-field overrides are available via struct tags: `tgbase:"16"`, `tgfmt:"e"`, `tgprec:"2"`.

See full example: examples/menu.

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.

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;

Documentation

Overview

Package tg contains a low level API to interact with Telegram Bot API.

Index

Constants

This section is empty.

Variables

ButtonStyleAll is a list of all known ButtonStyle values.

ChatActionAll is a list of all known ChatAction values.

ChatTypeAll is a list of all known ChatType values.

View Source
var CurrencyAll = []Currency{
	CurrencyXTR,
	CurrencyTON,
}

CurrencyAll is a list of all known Currency values.

DiceEmojiAll is a list of all known DiceEmoji values.

EncryptedPassportElementTypeAll is a list of all known EncryptedPassportElementType values.

MaskPositionPointAll is a list of all known MaskPositionPoint values.

MessageEntityTypeAll is a list of all known MessageEntityType values.

View Source
var MessageTypeAll = []MessageType{
	MessageTypeText,
	MessageTypeAnimation,
	MessageTypeAudio,
	MessageTypeDocument,
	MessageTypePaidMedia,
	MessageTypePhoto,
	MessageTypeSticker,
	MessageTypeStory,
	MessageTypeVideo,
	MessageTypeVideoNote,
	MessageTypeVoice,
	MessageTypeChecklist,
	MessageTypeContact,
	MessageTypeDice,
	MessageTypeGame,
	MessageTypePoll,
	MessageTypeVenue,
	MessageTypeLocation,
	MessageTypeNewChatMembers,
	MessageTypeLeftChatMember,
	MessageTypeChatOwnerLeft,
	MessageTypeChatOwnerChanged,
	MessageTypeNewChatTitle,
	MessageTypeNewChatPhoto,
	MessageTypeDeleteChatPhoto,
	MessageTypeGroupChatCreated,
	MessageTypeSupergroupChatCreated,
	MessageTypeChannelChatCreated,
	MessageTypeMessageAutoDeleteTimerChanged,
	MessageTypeMigrateToChatID,
	MessageTypeMigrateFromChatID,
	MessageTypePinnedMessage,
	MessageTypeInvoice,
	MessageTypeSuccessfulPayment,
	MessageTypeRefundedPayment,
	MessageTypeUsersShared,
	MessageTypeChatShared,
	MessageTypeGift,
	MessageTypeUniqueGift,
	MessageTypeGiftUpgradeSent,
	MessageTypeConnectedWebsite,
	MessageTypeWriteAccessAllowed,
	MessageTypePassportData,
	MessageTypeProximityAlertTriggered,
	MessageTypeBoostAdded,
	MessageTypeChatBackgroundSet,
	MessageTypeChecklistTasksDone,
	MessageTypeChecklistTasksAdded,
	MessageTypeDirectMessagePriceChanged,
	MessageTypeForumTopicCreated,
	MessageTypeForumTopicEdited,
	MessageTypeForumTopicClosed,
	MessageTypeForumTopicReopened,
	MessageTypeGeneralForumTopicHidden,
	MessageTypeGeneralForumTopicUnhidden,
	MessageTypeGiveawayCreated,
	MessageTypeGiveaway,
	MessageTypeGiveawayWinners,
	MessageTypeGiveawayCompleted,
	MessageTypePaidMessagePriceChanged,
	MessageTypeSuggestedPostApproved,
	MessageTypeSuggestedPostApprovalFailed,
	MessageTypeSuggestedPostDeclined,
	MessageTypeSuggestedPostPaid,
	MessageTypeSuggestedPostRefunded,
	MessageTypeVideoChatScheduled,
	MessageTypeVideoChatStarted,
	MessageTypeVideoChatEnded,
	MessageTypeVideoChatParticipantsInvited,
	MessageTypeWebAppData,
}

MessageTypeAll is a list of all known MessageType values.

PollTypeAll is a list of all known PollType values.

View Source
var ReactionEmojiAll = []ReactionEmoji{
	ReactionEmojiRedHeart,
	ReactionEmojiThumbsUp,
	ReactionEmojiThumbsDown,
	ReactionEmojiFire,
	ReactionEmojiSmilingFaceWithHearts,
	ReactionEmojiClappingHands,
	ReactionEmojiBeamingFaceWithSmilingEyes,
	ReactionEmojiThinkingFace,
	ReactionEmojiExplodingHead,
	ReactionEmojiFaceScreamingInFear,
	ReactionEmojiFaceWithSymbolsOnMouth,
	ReactionEmojiCryingFace,
	ReactionEmojiPartyPopper,
	ReactionEmojiStarStruck,
	ReactionEmojiFaceVomiting,
	ReactionEmojiPileOfPoo,
	ReactionEmojiFoldedHands,
	ReactionEmojiOKHand,
	ReactionEmojiDove,
	ReactionEmojiClownFace,
	ReactionEmojiYawningFace,
	ReactionEmojiWoozyFace,
	ReactionEmojiSmilingFaceWithHeartEyes,
	ReactionEmojiSpoutingWhale,
	ReactionEmojiHeartOnFire,
	ReactionEmojiNewMoonFace,
	ReactionEmojiHotDog,
	ReactionEmojiHundredPoints,
	ReactionEmojiRollingOnTheFloorLaughing,
	ReactionEmojiHighVoltage,
	ReactionEmojiBanana,
	ReactionEmojiTrophy,
	ReactionEmojiBrokenHeart,
	ReactionEmojiFaceWithRaisedEyebrow,
	ReactionEmojiNeutralFace,
	ReactionEmojiStrawberry,
	ReactionEmojiBottleWithPoppingCork,
	ReactionEmojiKissMark,
	ReactionEmojiMiddleFinger,
	ReactionEmojiSmilingFaceWithHorns,
	ReactionEmojiSleepingFace,
	ReactionEmojiLoudlyCryingFace,
	ReactionEmojiNerdFace,
	ReactionEmojiGhost,
	ReactionEmojiManTechnologist,
	ReactionEmojiEyes,
	ReactionEmojiJackOLantern,
	ReactionEmojiSeeNoEvilMonkey,
	ReactionEmojiSmilingFaceWithHalo,
	ReactionEmojiFearfulFace,
	ReactionEmojiHandshake,
	ReactionEmojiWritingHand,
	ReactionEmojiSmilingFaceWithOpenHands,
	ReactionEmojiSalutingFace,
	ReactionEmojiSantaClaus,
	ReactionEmojiChristmasTree,
	ReactionEmojiSnowman,
	ReactionEmojiNailPolish,
	ReactionEmojiZanyFace,
	ReactionEmojiMoai,
	ReactionEmojiCoolButton,
	ReactionEmojiHeartWithArrow,
	ReactionEmojiHearNoEvilMonkey,
	ReactionEmojiUnicorn,
	ReactionEmojiFaceBlowingAKiss,
	ReactionEmojiPill,
	ReactionEmojiSpeakNoEvilMonkey,
	ReactionEmojiSmilingFaceWithSunglasses,
	ReactionEmojiAlienMonster,
	ReactionEmojiManShrugging,
	ReactionEmojiPersonShrugging,
	ReactionEmojiWomanShrugging,
	ReactionEmojiEnragedFace,
}

ReactionEmojiAll is a list of all known ReactionEmoji values.

StickerFormatAll is a list of all known StickerFormat values.

StickerTypeAll is a list of all known StickerType values.

TransactionPartnerUserTransactionTypeEnumAll is a list of all known TransactionPartnerUserTransactionTypeEnum values.

UniqueGiftModelRarityAll is a list of all known UniqueGiftModelRarity values.

UpdateTypeAll is a list of all known UpdateType values.

Functions

func BindClient added in v0.2.0

func BindClient[C interface {
	Bind(client *Client)
}](
	call C,
	client *Client,
) C

BindClient binds Client to the Call. It's useful for chaining calls.

return tg.BindClient(tg.NewGetMeCall(), client).DoVoid(ctx)

func NewButtonColumn deprecated added in v0.0.2

func NewButtonColumn[T Button](buttons ...T) [][]T

Deprecated: Use NewInlineKeyboard or NewReplyKeyboard with InlineKeyboard.Adjust instead.

func NewButtonRow added in v0.0.2

func NewButtonRow[T Button](buttons ...T) []T

NewButtonRow it's generic helper for create keyboards in functional way.

Types

type AcceptedGiftTypes added in v0.16.0

type AcceptedGiftTypes struct {
	// True, if unlimited regular gifts are accepted
	UnlimitedGifts bool `json:"unlimited_gifts"`

	// True, if limited regular gifts are accepted
	LimitedGifts bool `json:"limited_gifts"`

	// True, if unique gifts or gifts that can be upgraded to unique for free are accepted
	UniqueGifts bool `json:"unique_gifts"`

	// True, if a Telegram Premium subscription is accepted
	PremiumSubscription bool `json:"premium_subscription"`

	// True, if transfers of unique gifts from channels are accepted
	GiftsFromChannels bool `json:"gifts_from_channels"`
}

AcceptedGiftTypes this object describes the types of gifts that can be gifted to a user or a chat.

type AddStickerToSetCall

type AddStickerToSetCall struct {
	CallNoResult
}

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

func NewAddStickerToSetCall

func NewAddStickerToSetCall(userID UserID, name string, sticker InputSticker) *AddStickerToSetCall

NewAddStickerToSetCall constructs a new AddStickerToSetCall.

Required params:

  • userID: User identifier of sticker set owner
  • name: Sticker set name
  • sticker: A JSON-serialized object with information about the added sticker. If exactly the same sticker had already been added to the set, then the set isn't changed.

func (*AddStickerToSetCall) Name

Name sets the name parameter.

func (*AddStickerToSetCall) Sticker added in v0.8.0

func (call *AddStickerToSetCall) Sticker(sticker InputSticker) *AddStickerToSetCall

Sticker sets the sticker parameter.

func (*AddStickerToSetCall) UserID added in v0.0.5

func (call *AddStickerToSetCall) UserID(userID UserID) *AddStickerToSetCall

UserID sets the user_id parameter.

type AffiliateInfo added in v0.16.0

type AffiliateInfo struct {
	// Optional. The bot or the user that received an affiliate commission if it was received by a bot or a user
	AffiliateUser *User `json:"affiliate_user,omitempty"`

	// Optional. The chat that received an affiliate commission if it was received by a chat
	AffiliateChat *Chat `json:"affiliate_chat,omitempty"`

	// The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the bot from referred users
	CommissionPerMille int `json:"commission_per_mille"`

	// Integer amount of Telegram Stars received by the affiliate from the transaction, rounded to 0; can be negative for refunds
	Amount int `json:"amount"`

	// Optional. The number of 1/1000000000 shares of Telegram Stars received by the affiliate; from -999999999 to 999999999; can be negative for refunds
	NanostarAmount int `json:"nanostar_amount,omitempty"`
}

AffiliateInfo contains information about the affiliate that received a commission via this transaction.

type Animation

type Animation struct {
	// Identifier for this file, which can be used to download or reuse the file
	FileID FileID `json:"file_id"`

	// Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
	FileUniqueID string `json:"file_unique_id"`

	// Video width as defined by the sender
	Width int `json:"width"`

	// Video height as defined by the sender
	Height int `json:"height"`

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

	// Optional. Animation thumbnail as defined by the sender
	Thumbnail *PhotoSize `json:"thumbnail,omitempty"`

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

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

	// Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.
	FileSize int64 `json:"file_size,omitempty"`
}

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

type AnswerCallbackQueryCall

type AnswerCallbackQueryCall struct {
	CallNoResult
}

AnswerCallbackQueryCall represents a call to the answerCallbackQuery method. Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned. Alternatively, the user can be redirected to the specified Game URL. For this option to work, you must first create a game for your bot via @BotFather and accept the terms. Otherwise, you may use links like t.me/your_bot?start=XXXX that open your bot with a parameter.

func NewAnswerCallbackQueryCall

func NewAnswerCallbackQueryCall(callbackQueryID string) *AnswerCallbackQueryCall

NewAnswerCallbackQueryCall constructs a new AnswerCallbackQueryCall.

Required params:

  • callbackQueryID: Unique identifier for the query to be answered

func (*AnswerCallbackQueryCall) CacheTime

func (call *AnswerCallbackQueryCall) CacheTime(cacheTime int) *AnswerCallbackQueryCall

CacheTime sets the cache_time parameter.

func (*AnswerCallbackQueryCall) CallbackQueryID added in v0.0.5

func (call *AnswerCallbackQueryCall) CallbackQueryID(callbackQueryID string) *AnswerCallbackQueryCall

CallbackQueryID sets the callback_query_id parameter.

func (*AnswerCallbackQueryCall) ShowAlert

func (call *AnswerCallbackQueryCall) ShowAlert(showAlert bool) *AnswerCallbackQueryCall

ShowAlert sets the show_alert parameter.

func (*AnswerCallbackQueryCall) Text

Text sets the text parameter.

func (*AnswerCallbackQueryCall) URL added in v0.0.5

URL sets the url parameter.

type AnswerInlineQueryCall

type AnswerInlineQueryCall struct {
	CallNoResult
}

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

func NewAnswerInlineQueryCall

func NewAnswerInlineQueryCall(inlineQueryID string, results []InlineQueryResult) *AnswerInlineQueryCall

NewAnswerInlineQueryCall constructs a new AnswerInlineQueryCall.

Required params:

  • inlineQueryID: Unique identifier for the answered query
  • results: A JSON-serialized array of results for the inline query

func (*AnswerInlineQueryCall) Button added in v0.9.0

Button sets the button parameter.

func (*AnswerInlineQueryCall) CacheTime

func (call *AnswerInlineQueryCall) CacheTime(cacheTime int) *AnswerInlineQueryCall

CacheTime sets the cache_time parameter.

func (*AnswerInlineQueryCall) InlineQueryID added in v0.0.5

func (call *AnswerInlineQueryCall) InlineQueryID(inlineQueryID string) *AnswerInlineQueryCall

InlineQueryID sets the inline_query_id parameter.

func (*AnswerInlineQueryCall) IsPersonal

func (call *AnswerInlineQueryCall) IsPersonal(isPersonal bool) *AnswerInlineQueryCall

IsPersonal sets the is_personal parameter.

func (*AnswerInlineQueryCall) NextOffset

func (call *AnswerInlineQueryCall) NextOffset(nextOffset string) *AnswerInlineQueryCall

NextOffset sets the next_offset parameter.

func (*AnswerInlineQueryCall) Results

Results sets the results parameter.

type AnswerPreCheckoutQueryCall

type AnswerPreCheckoutQueryCall struct {
	CallNoResult
}

AnswerPreCheckoutQueryCall represents a call to the answerPreCheckoutQuery method. Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query. Use this method to respond to such pre-checkout queries. On success, True is returned. Note: The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent.

func NewAnswerPreCheckoutQueryCall

func NewAnswerPreCheckoutQueryCall(preCheckoutQueryID string, ok bool) *AnswerPreCheckoutQueryCall

NewAnswerPreCheckoutQueryCall constructs a new AnswerPreCheckoutQueryCall.

Required params:

  • preCheckoutQueryID: Unique identifier for the query to be answered
  • ok: Specify True if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. Use False if there are any problems.

func (*AnswerPreCheckoutQueryCall) ErrorMessage

func (call *AnswerPreCheckoutQueryCall) ErrorMessage(errorMessage string) *AnswerPreCheckoutQueryCall

ErrorMessage sets the error_message parameter.

func (*AnswerPreCheckoutQueryCall) OK added in v0.16.0

OK sets the ok parameter.

func (*AnswerPreCheckoutQueryCall) PreCheckoutQueryID added in v0.0.5

func (call *AnswerPreCheckoutQueryCall) PreCheckoutQueryID(preCheckoutQueryID string) *AnswerPreCheckoutQueryCall

PreCheckoutQueryID sets the pre_checkout_query_id parameter.

type AnswerShippingQueryCall

type AnswerShippingQueryCall struct {
	CallNoResult
}

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

func NewAnswerShippingQueryCall

func NewAnswerShippingQueryCall(shippingQueryID string, ok bool) *AnswerShippingQueryCall

NewAnswerShippingQueryCall constructs a new AnswerShippingQueryCall.

Required params:

  • shippingQueryID: Unique identifier for the query to be answered
  • ok: Pass True if delivery to the specified address is possible and False if there are any problems (for example, if delivery to the specified address is not possible)

func (*AnswerShippingQueryCall) ErrorMessage

func (call *AnswerShippingQueryCall) ErrorMessage(errorMessage string) *AnswerShippingQueryCall

ErrorMessage sets the error_message parameter.

func (*AnswerShippingQueryCall) OK added in v0.16.0

OK sets the ok parameter.

func (*AnswerShippingQueryCall) ShippingOptions

func (call *AnswerShippingQueryCall) ShippingOptions(shippingOptions []ShippingOption) *AnswerShippingQueryCall

ShippingOptions sets the shipping_options parameter.

func (*AnswerShippingQueryCall) ShippingQueryID added in v0.0.5

func (call *AnswerShippingQueryCall) ShippingQueryID(shippingQueryID string) *AnswerShippingQueryCall

ShippingQueryID sets the shipping_query_id parameter.

type AnswerWebAppQueryCall

type AnswerWebAppQueryCall struct {
	Call[SentWebAppMessage]
}

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

func NewAnswerWebAppQueryCall

func NewAnswerWebAppQueryCall(webAppQueryID string, result InlineQueryResultClass) *AnswerWebAppQueryCall

NewAnswerWebAppQueryCall constructs a new AnswerWebAppQueryCall.

Required params:

  • webAppQueryID: Unique identifier for the query to be answered
  • result: A JSON-serialized object describing the message to be sent

func (*AnswerWebAppQueryCall) Result

Result sets the result parameter.

func (*AnswerWebAppQueryCall) WebAppQueryID added in v0.0.5

func (call *AnswerWebAppQueryCall) WebAppQueryID(webAppQueryID string) *AnswerWebAppQueryCall

WebAppQueryID sets the web_app_query_id parameter.

type ApproveChatJoinRequestCall

type ApproveChatJoinRequestCall struct {
	CallNoResult
}

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

func NewApproveChatJoinRequestCall

func NewApproveChatJoinRequestCall(chatID PeerID, userID UserID) *ApproveChatJoinRequestCall

NewApproveChatJoinRequestCall constructs a new ApproveChatJoinRequestCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • userID: Unique identifier of the target user

func (*ApproveChatJoinRequestCall) ChatID added in v0.0.5

ChatID sets the chat_id parameter.

func (*ApproveChatJoinRequestCall) UserID added in v0.0.5

UserID sets the user_id parameter.

type ApproveSuggestedPostCall added in v0.16.0

type ApproveSuggestedPostCall struct {
	CallNoResult
}

ApproveSuggestedPostCall represents a call to the approveSuggestedPost method. Use this method to approve a suggested post in a direct messages chat. The bot must have the 'can_post_messages' administrator right in the corresponding channel chat. Returns True on success.

func NewApproveSuggestedPostCall added in v0.16.0

func NewApproveSuggestedPostCall(chatID int, messageID int) *ApproveSuggestedPostCall

NewApproveSuggestedPostCall constructs a new ApproveSuggestedPostCall.

Required params:

  • chatID: Unique identifier for the target direct messages chat
  • messageID: Identifier of a suggested post message to approve

func (*ApproveSuggestedPostCall) ChatID added in v0.16.0

ChatID sets the chat_id parameter.

func (*ApproveSuggestedPostCall) MessageID added in v0.16.0

func (call *ApproveSuggestedPostCall) MessageID(messageID int) *ApproveSuggestedPostCall

MessageID sets the message_id parameter.

func (*ApproveSuggestedPostCall) SendDate added in v0.16.0

func (call *ApproveSuggestedPostCall) SendDate(sendDate int) *ApproveSuggestedPostCall

SendDate sets the send_date parameter.

type Audio

type Audio struct {
	// Identifier for this file, which can be used to download or reuse the file
	FileID FileID `json:"file_id"`

	// Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
	FileUniqueID string `json:"file_unique_id"`

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

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

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

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

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

	// Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.
	FileSize int64 `json:"file_size,omitempty"`

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

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

type AuthWidget added in v0.0.5

type AuthWidget struct {
	ID        UserID   `json:"id"`
	FirstName string   `json:"first_name"`
	LastName  string   `json:"last_name,omitempty"`
	Username  string   `json:"username,omitempty"`
	PhotoURL  string   `json:"photo_url,omitempty"`
	AuthDate  UnixTime `json:"auth_date"`
	Hash      string   `json:"hash"`
}

AuthWidget represents Telegram Login Widget data.

See https://core.telegram.org/widgets/login#receiving-authorization-data for more information.

func ParseAuthWidgetQuery added in v0.0.5

func ParseAuthWidgetQuery(vs url.Values) (*AuthWidget, error)

ParseAuthWidgetQuery parses a query string and returns an AuthWidget.

func (AuthWidget) Query added in v0.0.5

func (w AuthWidget) Query() url.Values

Query returns a query values for the widget.

func (AuthWidget) Signature added in v0.0.5

func (w AuthWidget) Signature(token string) string

Signature returns the signature of the widget data.

func (AuthWidget) Valid added in v0.0.5

func (w AuthWidget) Valid(token string) bool

Valid returns true if the signature is valid.

type BackgroundFill added in v0.16.0

type BackgroundFill struct {
	Solid            *BackgroundFillSolid
	Gradient         *BackgroundFillGradient
	FreeformGradient *BackgroundFillFreeformGradient
	Unknown          *UnknownVariant
}

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

func (*BackgroundFill) IsUnknown added in v0.16.0

func (u *BackgroundFill) IsUnknown() bool

IsUnknown reports whether this union contains an unknown variant. This can happen when the API returns a new variant not yet supported by this library.

func (BackgroundFill) MarshalJSON added in v0.16.0

func (u BackgroundFill) MarshalJSON() ([]byte, error)

func (*BackgroundFill) Type added in v0.16.0

Type returns the discriminator value for this union.

func (*BackgroundFill) UnmarshalJSON added in v0.16.0

func (u *BackgroundFill) UnmarshalJSON(data []byte) error

type BackgroundFillFreeformGradient added in v0.16.0

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

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

type BackgroundFillGradient added in v0.16.0

type BackgroundFillGradient struct {
	// Top color of the gradient in the RGB24 format
	TopColor int `json:"top_color"`

	// Bottom color of the gradient in the RGB24 format
	BottomColor int `json:"bottom_color"`

	// Clockwise rotation angle of the background fill in degrees; 0-359
	RotationAngle int `json:"rotation_angle"`
}

BackgroundFillGradient the background is a gradient fill.

type BackgroundFillSolid added in v0.16.0

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

BackgroundFillSolid the background is filled using the selected color.

type BackgroundFillType added in v0.16.0

type BackgroundFillType int

BackgroundFillType represents the type of BackgroundFill.

const (
	BackgroundFillTypeSolid            BackgroundFillType = iota + 1 // "solid"
	BackgroundFillTypeGradient                                       // "gradient"
	BackgroundFillTypeFreeformGradient                               // "freeform_gradient"
)

func (BackgroundFillType) MarshalText added in v0.16.0

func (v BackgroundFillType) MarshalText() ([]byte, error)

func (BackgroundFillType) String added in v0.16.0

func (v BackgroundFillType) String() string

func (*BackgroundFillType) UnmarshalText added in v0.16.0

func (v *BackgroundFillType) UnmarshalText(b []byte) error

type BackgroundType added in v0.16.0

type BackgroundType struct {
	Fill      *BackgroundTypeFill
	Wallpaper *BackgroundTypeWallpaper
	Pattern   *BackgroundTypePattern
	ChatTheme *BackgroundTypeChatTheme
	Unknown   *UnknownVariant
}

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

func (*BackgroundType) IsUnknown added in v0.16.0

func (u *BackgroundType) IsUnknown() bool

IsUnknown reports whether this union contains an unknown variant. This can happen when the API returns a new variant not yet supported by this library.

func (BackgroundType) MarshalJSON added in v0.16.0

func (u BackgroundType) MarshalJSON() ([]byte, error)

func (*BackgroundType) Type added in v0.16.0

Type returns the discriminator value for this union.

func (*BackgroundType) UnmarshalJSON added in v0.16.0

func (u *BackgroundType) UnmarshalJSON(data []byte) error

type BackgroundTypeChatTheme added in v0.16.0

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

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

type BackgroundTypeFill added in v0.16.0

type BackgroundTypeFill struct {
	// The background fill
	Fill BackgroundFill `json:"fill"`

	// Dimming of the background in dark themes, as a percentage; 0-100
	DarkThemeDimming int `json:"dark_theme_dimming"`
}

BackgroundTypeFill the background is automatically filled based on the selected colors.

type BackgroundTypePattern added in v0.16.0

type BackgroundTypePattern struct {
	// Document with the pattern
	Document Document `json:"document"`

	// The background fill that is combined with the pattern
	Fill BackgroundFill `json:"fill"`

	// Intensity of the pattern when it is shown above the filled background; 0-100
	Intensity int `json:"intensity"`

	// Optional. True, if the background fill must be applied only to the pattern itself. All other pixels are black in this case. For dark themes only
	IsInverted bool `json:"is_inverted,omitempty"`

	// Optional. True, if the background moves slightly when the device is tilted
	IsMoving bool `json:"is_moving,omitempty"`
}

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

type BackgroundTypeType added in v0.16.0

type BackgroundTypeType int

BackgroundTypeType represents the type of BackgroundType.

const (
	BackgroundTypeTypeFill      BackgroundTypeType = iota + 1 // "fill"
	BackgroundTypeTypeWallpaper                               // "wallpaper"
	BackgroundTypeTypePattern                                 // "pattern"
	BackgroundTypeTypeChatTheme                               // "chat_theme"
)

func (BackgroundTypeType) MarshalText added in v0.16.0

func (v BackgroundTypeType) MarshalText() ([]byte, error)

func (BackgroundTypeType) String added in v0.16.0

func (v BackgroundTypeType) String() string

func (*BackgroundTypeType) UnmarshalText added in v0.16.0

func (v *BackgroundTypeType) UnmarshalText(b []byte) error

type BackgroundTypeWallpaper added in v0.16.0

type BackgroundTypeWallpaper struct {
	// Document with the wallpaper
	Document Document `json:"document"`

	// Dimming of the background in dark themes, as a percentage; 0-100
	DarkThemeDimming int `json:"dark_theme_dimming"`

	// Optional. True, if the wallpaper is downscaled to fit in a 450x450 square and then box-blurred with radius 12
	IsBlurred bool `json:"is_blurred,omitempty"`

	// Optional. True, if the background moves slightly when the device is tilted
	IsMoving bool `json:"is_moving,omitempty"`
}

BackgroundTypeWallpaper the background is a wallpaper in the JPEG format.

type BanChatMemberCall

type BanChatMemberCall struct {
	CallNoResult
}

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

func NewBanChatMemberCall

func NewBanChatMemberCall(chatID PeerID, userID UserID) *BanChatMemberCall

NewBanChatMemberCall constructs a new BanChatMemberCall.

Required params:

  • chatID: Unique identifier for the target group or username of the target supergroup or channel (in the format @channelusername)
  • userID: Unique identifier of the target user

func (*BanChatMemberCall) ChatID added in v0.0.5

func (call *BanChatMemberCall) ChatID(chatID PeerID) *BanChatMemberCall

ChatID sets the chat_id parameter.

func (*BanChatMemberCall) RevokeMessages

func (call *BanChatMemberCall) RevokeMessages(revokeMessages bool) *BanChatMemberCall

RevokeMessages sets the revoke_messages parameter.

func (*BanChatMemberCall) UntilDate

func (call *BanChatMemberCall) UntilDate(untilDate int) *BanChatMemberCall

UntilDate sets the until_date parameter.

func (*BanChatMemberCall) UserID added in v0.0.5

func (call *BanChatMemberCall) UserID(userID UserID) *BanChatMemberCall

UserID sets the user_id parameter.

type BanChatSenderChatCall

type BanChatSenderChatCall struct {
	CallNoResult
}

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

func NewBanChatSenderChatCall

func NewBanChatSenderChatCall(chatID PeerID, senderChatID int) *BanChatSenderChatCall

NewBanChatSenderChatCall constructs a new BanChatSenderChatCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • senderChatID: Unique identifier of the target sender chat

func (*BanChatSenderChatCall) ChatID added in v0.0.5

func (call *BanChatSenderChatCall) ChatID(chatID PeerID) *BanChatSenderChatCall

ChatID sets the chat_id parameter.

func (*BanChatSenderChatCall) SenderChatID added in v0.0.5

func (call *BanChatSenderChatCall) SenderChatID(senderChatID int) *BanChatSenderChatCall

SenderChatID sets the sender_chat_id parameter.

type Birthdate added in v0.15.0

type Birthdate struct {
	// Day of the user's birth; 1-31
	Day int `json:"day"`

	// Month of the user's birth; 1-12
	Month int `json:"month"`

	// Optional. Year of the user's birth
	Year int `json:"year,omitempty"`
}

Birthdate describes the birthdate of a user.

type BotCommand

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

	// Description of the command; 1-256 characters.
	Description string `json:"description"`
}

BotCommand this object represents a bot command.

type BotCommandScope

type BotCommandScope struct {
	Default               *BotCommandScopeDefault
	AllPrivateChats       *BotCommandScopeAllPrivateChats
	AllGroupChats         *BotCommandScopeAllGroupChats
	AllChatAdministrators *BotCommandScopeAllChatAdministrators
	Chat                  *BotCommandScopeChat
	ChatAdministrators    *BotCommandScopeChatAdministrators
	ChatMember            *BotCommandScopeChatMember
	Unknown               *UnknownVariant
}

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

func BotCommandScopeOf added in v0.17.0

func BotCommandScopeOf(values ...BotCommandScopeClass) []BotCommandScope

BotCommandScopeOf converts BotCommandScopeClass arguments to a slice of BotCommandScope.

func (BotCommandScope) AsBotCommandScope added in v0.17.0

func (u BotCommandScope) AsBotCommandScope() BotCommandScope

AsBotCommandScope returns the union as-is, implementing BotCommandScopeClass.

func (*BotCommandScope) IsUnknown added in v0.16.0

func (u *BotCommandScope) IsUnknown() bool

IsUnknown reports whether this union contains an unknown variant. This can happen when the API returns a new variant not yet supported by this library.

func (BotCommandScope) MarshalJSON added in v0.16.0

func (u BotCommandScope) MarshalJSON() ([]byte, error)

func (*BotCommandScope) Type added in v0.16.0

Type returns the discriminator value for this union.

func (*BotCommandScope) UnmarshalJSON added in v0.16.0

func (u *BotCommandScope) UnmarshalJSON(data []byte) error

type BotCommandScopeAllChatAdministrators

type BotCommandScopeAllChatAdministrators struct{}

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

func NewBotCommandScopeAllChatAdministrators added in v0.16.0

func NewBotCommandScopeAllChatAdministrators() *BotCommandScopeAllChatAdministrators

NewBotCommandScopeAllChatAdministrators creates a new BotCommandScopeAllChatAdministrators.

func (*BotCommandScopeAllChatAdministrators) AsBotCommandScope added in v0.17.0

AsBotCommandScope wraps the variant into a BotCommandScope union.

type BotCommandScopeAllGroupChats

type BotCommandScopeAllGroupChats struct{}

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

func NewBotCommandScopeAllGroupChats added in v0.16.0

func NewBotCommandScopeAllGroupChats() *BotCommandScopeAllGroupChats

NewBotCommandScopeAllGroupChats creates a new BotCommandScopeAllGroupChats.

func (*BotCommandScopeAllGroupChats) AsBotCommandScope added in v0.17.0

func (v *BotCommandScopeAllGroupChats) AsBotCommandScope() BotCommandScope

AsBotCommandScope wraps the variant into a BotCommandScope union.

type BotCommandScopeAllPrivateChats

type BotCommandScopeAllPrivateChats struct{}

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

func NewBotCommandScopeAllPrivateChats added in v0.16.0

func NewBotCommandScopeAllPrivateChats() *BotCommandScopeAllPrivateChats

NewBotCommandScopeAllPrivateChats creates a new BotCommandScopeAllPrivateChats.

func (*BotCommandScopeAllPrivateChats) AsBotCommandScope added in v0.17.0

func (v *BotCommandScopeAllPrivateChats) AsBotCommandScope() BotCommandScope

AsBotCommandScope wraps the variant into a BotCommandScope union.

type BotCommandScopeChat

type BotCommandScopeChat struct {
	// Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername). Channel direct messages chats and channel chats aren't supported.
	ChatID ChatID `json:"chat_id"`
}

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

func NewBotCommandScopeChat added in v0.16.0

func NewBotCommandScopeChat(chatID ChatID) *BotCommandScopeChat

NewBotCommandScopeChat creates a new BotCommandScopeChat.

func (*BotCommandScopeChat) AsBotCommandScope added in v0.17.0

func (v *BotCommandScopeChat) AsBotCommandScope() BotCommandScope

AsBotCommandScope wraps the variant into a BotCommandScope union.

type BotCommandScopeChatAdministrators

type BotCommandScopeChatAdministrators struct {
	// Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername). Channel direct messages chats and channel chats aren't supported.
	ChatID ChatID `json:"chat_id"`
}

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

func NewBotCommandScopeChatAdministrators added in v0.16.0

func NewBotCommandScopeChatAdministrators(chatID ChatID) *BotCommandScopeChatAdministrators

NewBotCommandScopeChatAdministrators creates a new BotCommandScopeChatAdministrators.

func (*BotCommandScopeChatAdministrators) AsBotCommandScope added in v0.17.0

func (v *BotCommandScopeChatAdministrators) AsBotCommandScope() BotCommandScope

AsBotCommandScope wraps the variant into a BotCommandScope union.

type BotCommandScopeChatMember

type BotCommandScopeChatMember struct {
	// Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername). Channel direct messages chats and channel chats aren't supported.
	ChatID ChatID `json:"chat_id"`

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

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

func NewBotCommandScopeChatMember added in v0.16.0

func NewBotCommandScopeChatMember(chatID ChatID, userID UserID) *BotCommandScopeChatMember

NewBotCommandScopeChatMember creates a new BotCommandScopeChatMember.

func (*BotCommandScopeChatMember) AsBotCommandScope added in v0.17.0

func (v *BotCommandScopeChatMember) AsBotCommandScope() BotCommandScope

AsBotCommandScope wraps the variant into a BotCommandScope union.

type BotCommandScopeClass added in v0.17.0

type BotCommandScopeClass interface {
	AsBotCommandScope() BotCommandScope
}

BotCommandScopeClass is an interface for types that can be used as BotCommandScope.

Known implementations:

type BotCommandScopeDefault

type BotCommandScopeDefault struct{}

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

func NewBotCommandScopeDefault added in v0.16.0

func NewBotCommandScopeDefault() *BotCommandScopeDefault

NewBotCommandScopeDefault creates a new BotCommandScopeDefault.

func (*BotCommandScopeDefault) AsBotCommandScope added in v0.17.0

func (v *BotCommandScopeDefault) AsBotCommandScope() BotCommandScope

AsBotCommandScope wraps the variant into a BotCommandScope union.

type BotCommandScopeType added in v0.16.0

type BotCommandScopeType int

BotCommandScopeType represents the type of BotCommandScope.

const (
	BotCommandScopeTypeDefault               BotCommandScopeType = iota + 1 // "default"
	BotCommandScopeTypeAllPrivateChats                                      // "all_private_chats"
	BotCommandScopeTypeAllGroupChats                                        // "all_group_chats"
	BotCommandScopeTypeAllChatAdministrators                                // "all_chat_administrators"
	BotCommandScopeTypeChat                                                 // "chat"
	BotCommandScopeTypeChatAdministrators                                   // "chat_administrators"
	BotCommandScopeTypeChatMember                                           // "chat_member"
)

func (BotCommandScopeType) MarshalText added in v0.16.0

func (v BotCommandScopeType) MarshalText() ([]byte, error)

func (BotCommandScopeType) String added in v0.16.0

func (v BotCommandScopeType) String() string

func (*BotCommandScopeType) UnmarshalText added in v0.16.0

func (v *BotCommandScopeType) UnmarshalText(b []byte) error

type BotDescription added in v0.8.0

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

BotDescription this object represents the bot's description.

type BotName added in v0.9.0

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

BotName this object represents the bot's name.

type BotShortDescription added in v0.8.0

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

BotShortDescription this object represents the bot's short description.

type BusinessBotRights added in v0.16.0

type BusinessBotRights struct {
	// Optional. True, if the bot can send and edit messages in the private chats that had incoming messages in the last 24 hours
	CanReply bool `json:"can_reply,omitempty"`

	// Optional. True, if the bot can mark incoming private messages as read
	CanReadMessages bool `json:"can_read_messages,omitempty"`

	// Optional. True, if the bot can delete messages sent by the bot
	CanDeleteSentMessages bool `json:"can_delete_sent_messages,omitempty"`

	// Optional. True, if the bot can delete all private messages in managed chats
	CanDeleteAllMessages bool `json:"can_delete_all_messages,omitempty"`

	// Optional. True, if the bot can edit the first and last name of the business account
	CanEditName bool `json:"can_edit_name,omitempty"`

	// Optional. True, if the bot can edit the bio of the business account
	CanEditBio bool `json:"can_edit_bio,omitempty"`

	// Optional. True, if the bot can edit the profile photo of the business account
	CanEditProfilePhoto bool `json:"can_edit_profile_photo,omitempty"`

	// Optional. True, if the bot can edit the username of the business account
	CanEditUsername bool `json:"can_edit_username,omitempty"`

	// Optional. True, if the bot can change the privacy settings pertaining to gifts for the business account
	CanChangeGiftSettings bool `json:"can_change_gift_settings,omitempty"`

	// Optional. True, if the bot can view gifts and the amount of Telegram Stars owned by the business account
	CanViewGiftsAndStars bool `json:"can_view_gifts_and_stars,omitempty"`

	// Optional. True, if the bot can convert regular gifts owned by the business account to Telegram Stars
	CanConvertGiftsToStars bool `json:"can_convert_gifts_to_stars,omitempty"`

	// Optional. True, if the bot can transfer and upgrade gifts owned by the business account
	CanTransferAndUpgradeGifts bool `json:"can_transfer_and_upgrade_gifts,omitempty"`

	// Optional. True, if the bot can transfer Telegram Stars received by the business account to its own account, or use them to upgrade and transfer gifts
	CanTransferStars bool `json:"can_transfer_stars,omitempty"`

	// Optional. True, if the bot can post, edit and delete stories on behalf of the business account
	CanManageStories bool `json:"can_manage_stories,omitempty"`
}

BusinessBotRights represents the rights of a business bot.

type BusinessConnection added in v0.15.0

type BusinessConnection struct {
	// Unique identifier of the business connection
	ID string `json:"id"`

	// Business account user that created the business connection
	User User `json:"user"`

	// Identifier of a private chat with the user who created the business connection. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier.
	UserChatID ChatID `json:"user_chat_id"`

	// Date the connection was established in Unix time
	Date UnixTime `json:"date"`

	// Optional. Rights of the business bot
	Rights *BusinessBotRights `json:"rights,omitempty"`

	// True, if the connection is active
	IsEnabled bool `json:"is_enabled"`
}

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

type BusinessIntro added in v0.15.0

type BusinessIntro struct {
	// Optional. Title text of the business intro
	Title string `json:"title,omitempty"`

	// Optional. Message text of the business intro
	Message string `json:"message,omitempty"`

	// Optional. Sticker of the business intro
	Sticker *Sticker `json:"sticker,omitempty"`
}

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

type BusinessLocation added in v0.15.0

type BusinessLocation struct {
	// Address of the business
	Address string `json:"address"`

	// Optional. Location of the business
	Location *Location `json:"location,omitempty"`
}

BusinessLocation contains information about the location of a Telegram Business account.

type BusinessMessagesDeleted added in v0.15.0

type BusinessMessagesDeleted struct {
	// Unique identifier of the business connection
	BusinessConnectionID string `json:"business_connection_id"`

	// Information about a chat in the business account. The bot may not have access to the chat or the corresponding user.
	Chat Chat `json:"chat"`

	// The list of identifiers of deleted messages in the chat of the business account
	MessageIDs []int `json:"message_ids"`
}

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

type BusinessOpeningHours added in v0.15.0

type BusinessOpeningHours struct {
	// Unique name of the time zone for which the opening hours are defined
	TimeZoneName string `json:"time_zone_name"`

	// List of time intervals describing business opening hours
	OpeningHours []BusinessOpeningHoursInterval `json:"opening_hours"`
}

BusinessOpeningHours describes the opening hours of a business.

type BusinessOpeningHoursInterval added in v0.15.0

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

	// The minute's sequence number in a week, starting on Monday, marking the end of the time interval during which the business is open; 0 - 8 * 24 * 60
	ClosingMinute int `json:"closing_minute"`
}

BusinessOpeningHoursInterval describes an interval of time during which a business is open.

type Button added in v0.0.2

type Button interface {
	InlineKeyboardButton | KeyboardButton
}

Button define generic button interface.

type ButtonLayout deprecated added in v0.0.2

type ButtonLayout[T Button] struct {
	// contains filtered or unexported fields
}

Deprecated: Use InlineKeyboard or ReplyKeyboard instead.

func NewButtonLayout deprecated added in v0.0.2

func NewButtonLayout[T Button](rowWidth int, buttons ...T) *ButtonLayout[T]

Deprecated: Use NewInlineKeyboard or NewReplyKeyboard instead.

func (*ButtonLayout[T]) Add added in v0.0.2

func (layout *ButtonLayout[T]) Add(buttons ...T) *ButtonLayout[T]

Add accepts any number of buttons, always starts adding from a new row and adds a row when it reaches the set width.

func (*ButtonLayout[T]) Insert added in v0.0.2

func (layout *ButtonLayout[T]) Insert(buttons ...T) *ButtonLayout[T]

Insert buttons to last row if possible, or create new and insert.

func (*ButtonLayout[T]) Keyboard added in v0.0.2

func (layout *ButtonLayout[T]) Keyboard() [][]T

Keyboard returns result of building.

func (*ButtonLayout[T]) Row added in v0.0.2

func (layout *ButtonLayout[T]) Row(buttons ...T) *ButtonLayout[T]

Row add new row with no respect for row width.

type ButtonStyle added in v0.18.0

type ButtonStyle int8

ButtonStyle represents an enum type.

const (
	ButtonStyleUnknown ButtonStyle = iota
	ButtonStyleDanger              // "danger"
	ButtonStyleSuccess             // "success"
	ButtonStylePrimary             // "primary"
)

func (ButtonStyle) IsUnknown added in v0.18.0

func (v ButtonStyle) IsUnknown() bool

IsUnknown reports whether this value is unknown.

func (ButtonStyle) MarshalText added in v0.18.0

func (v ButtonStyle) MarshalText() ([]byte, error)

func (ButtonStyle) String added in v0.18.0

func (v ButtonStyle) String() string

func (*ButtonStyle) UnmarshalText added in v0.18.0

func (v *ButtonStyle) UnmarshalText(b []byte) error

type Call

type Call[T any] struct {
	// contains filtered or unexported fields
}

func (*Call[T]) Bind

func (call *Call[T]) Bind(client *Client)

func (*Call[T]) Do

func (call *Call[T]) Do(ctx context.Context) (result T, err error)

func (*Call[T]) DoVoid added in v0.0.3

func (call *Call[T]) DoVoid(ctx context.Context) (err error)

func (*Call[T]) MarshalJSON

func (call *Call[T]) MarshalJSON() ([]byte, error)

func (*Call[T]) Request added in v0.0.3

func (call *Call[T]) Request() *Request

Request returns a low-level request object for making API calls.

type CallNoResult

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

func (*CallNoResult) Bind

func (call *CallNoResult) Bind(client *Client)

func (*CallNoResult) DoVoid added in v0.0.3

func (call *CallNoResult) DoVoid(ctx context.Context) (err error)

func (*CallNoResult) MarshalJSON

func (call *CallNoResult) MarshalJSON() ([]byte, error)

func (*CallNoResult) Request added in v0.0.3

func (call *CallNoResult) Request() *Request

type CallbackDataEncoder added in v0.12.0

type CallbackDataEncoder[T any] interface {
	Encode(data T) (string, error)
}

type CallbackGame

type CallbackGame struct{}

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

type CallbackQuery

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

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

	// Optional. Message sent by the bot with the callback button that originated the query
	Message *MaybeInaccessibleMessage `json:"message,omitempty"`

	// Optional. Identifier of the message sent via the bot in inline mode, that originated the query.
	InlineMessageID string `json:"inline_message_id,omitempty"`

	// Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent. Useful for high scores in [games].
	//
	// [games]: https://core.telegram.org/bots/api#games
	ChatInstance string `json:"chat_instance"`

	// Optional. Data associated with the callback button. Be aware that the message originated the query can contain no callback buttons with this data.
	Data string `json:"data,omitempty"`

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

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

type Chat

type Chat struct {
	// Unique identifier for this chat. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.
	ID ChatID `json:"id"`

	// Type of the chat, can be either “private”, “group”, “supergroup” or “channel”
	Type ChatType `json:"type"`

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

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

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

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

	// Optional. True, if the supergroup chat is a forum (has [topics] enabled)
	//
	// [topics]: https://telegram.org/blog/topics-in-groups-collectible-usernames#topics-in-groups
	IsForum bool `json:"is_forum,omitempty"`

	// Optional. True, if the chat is the direct messages chat of a channel
	IsDirectMessages bool `json:"is_direct_messages,omitempty"`
}

Chat this object represents a chat.

func (Chat) FullName added in v0.17.0

func (chat Chat) FullName() string

FullName returns the chat's display name. For groups, supergroups and channels it returns the title. For private chats it combines first name and last name.

func (Chat) PeerID

func (chat Chat) PeerID() string

type ChatAction added in v0.0.4

type ChatAction int8

ChatAction represents an enum type.

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

func (ChatAction) IsUnknown added in v0.16.0

func (v ChatAction) IsUnknown() bool

IsUnknown reports whether this value is unknown.

func (ChatAction) String added in v0.0.4

func (v ChatAction) String() string

type ChatAdministratorRights

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

	// True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages, ignore slow mode, and send messages to the chat without paying Telegram Stars. Implied by any other administrator privilege.
	CanManageChat bool `json:"can_manage_chat"`

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

	// True, if the administrator can manage video chats
	CanManageVideoChats bool `json:"can_manage_video_chats"`

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

	// True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by the user)
	CanPromoteMembers bool `json:"can_promote_members"`

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

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

	// True, if the administrator can post stories to the chat
	CanPostStories bool `json:"can_post_stories"`

	// True, if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access the chat's story archive
	CanEditStories bool `json:"can_edit_stories"`

	// True, if the administrator can delete stories posted by other users
	CanDeleteStories bool `json:"can_delete_stories"`

	// Optional. True, if the administrator can post messages in the channel, approve suggested posts, or access channel statistics; for channels only
	CanPostMessages bool `json:"can_post_messages,omitempty"`

	// Optional. True, if the administrator can edit messages of other users and can pin messages; for channels only
	CanEditMessages bool `json:"can_edit_messages,omitempty"`

	// Optional. True, if the user is allowed to pin messages; for groups and supergroups only
	CanPinMessages bool `json:"can_pin_messages,omitempty"`

	// Optional. True, if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only
	CanManageTopics bool `json:"can_manage_topics,omitempty"`

	// Optional. True, if the administrator can manage direct messages of the channel and decline suggested posts; for channels only
	CanManageDirectMessages bool `json:"can_manage_direct_messages,omitempty"`
}

ChatAdministratorRights represents the rights of an administrator in a chat.

type ChatBackground added in v0.16.0

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

ChatBackground this object represents a chat background.

type ChatBoost added in v0.12.0

type ChatBoost struct {
	// Unique identifier of the boost
	BoostID string `json:"boost_id"`

	// Point in time (Unix timestamp) when the chat was boosted
	AddDate UnixTime `json:"add_date"`

	// Point in time (Unix timestamp) when the boost will automatically expire, unless the booster's Telegram Premium subscription is prolonged
	ExpirationDate UnixTime `json:"expiration_date"`

	// Source of the added boost
	Source ChatBoostSource `json:"source"`
}

ChatBoost this object contains information about a chat boost.

type ChatBoostAdded added in v0.12.0

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

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

type ChatBoostRemoved added in v0.12.0

type ChatBoostRemoved struct {
	// Chat which was boosted
	Chat Chat `json:"chat"`

	// Unique identifier of the boost
	BoostID string `json:"boost_id"`

	// Point in time (Unix timestamp) when the boost was removed
	RemoveDate UnixTime `json:"remove_date"`

	// Source of the removed boost
	Source ChatBoostSource `json:"source"`
}

ChatBoostRemoved this object represents a boost removed from a chat.

type ChatBoostSource added in v0.12.0

type ChatBoostSource struct {
	Premium  *ChatBoostSourcePremium
	GiftCode *ChatBoostSourceGiftCode
	Giveaway *ChatBoostSourceGiveaway
	Unknown  *UnknownVariant
}

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

func (*ChatBoostSource) IsUnknown added in v0.16.0

func (u *ChatBoostSource) IsUnknown() bool

IsUnknown reports whether this union contains an unknown variant. This can happen when the API returns a new variant not yet supported by this library.

func (ChatBoostSource) MarshalJSON added in v0.16.0

func (u ChatBoostSource) MarshalJSON() ([]byte, error)

func (*ChatBoostSource) Source added in v0.12.0

Source returns the discriminator value for this union.

func (*ChatBoostSource) UnmarshalJSON added in v0.16.0

func (u *ChatBoostSource) UnmarshalJSON(data []byte) error

type ChatBoostSourceGiftCode added in v0.12.0

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

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

type ChatBoostSourceGiveaway added in v0.12.0

type ChatBoostSourceGiveaway struct {
	// Identifier of a message in the chat with the giveaway; the message could have been deleted already. May be 0 if the message isn't sent yet.
	GiveawayMessageID int `json:"giveaway_message_id"`

	// Optional. User that won the prize in the giveaway if any; for Telegram Premium giveaways only
	User *User `json:"user,omitempty"`

	// Optional. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only
	PrizeStarCount int `json:"prize_star_count,omitempty"`

	// Optional. True, if the giveaway was completed, but there was no user to win the prize
	IsUnclaimed bool `json:"is_unclaimed,omitempty"`
}

ChatBoostSourceGiveaway the boost was obtained by the creation of a Telegram Premium or a Telegram Star giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription for Telegram Premium giveaways and prize_star_count / 500 times for one year for Telegram Star giveaways.

type ChatBoostSourcePremium added in v0.12.0

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

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

type ChatBoostSourceSource added in v0.16.0

type ChatBoostSourceSource int

ChatBoostSourceSource represents the type of ChatBoostSource.

const (
	ChatBoostSourceSourcePremium  ChatBoostSourceSource = iota + 1 // "premium"
	ChatBoostSourceSourceGiftCode                                  // "gift_code"
	ChatBoostSourceSourceGiveaway                                  // "giveaway"
)

func (ChatBoostSourceSource) MarshalText added in v0.16.0

func (v ChatBoostSourceSource) MarshalText() ([]byte, error)

func (ChatBoostSourceSource) String added in v0.16.0

func (v ChatBoostSourceSource) String() string

func (*ChatBoostSourceSource) UnmarshalText added in v0.16.0

func (v *ChatBoostSourceSource) UnmarshalText(b []byte) error

type ChatBoostUpdated added in v0.12.0

type ChatBoostUpdated struct {
	// Chat which was boosted
	Chat Chat `json:"chat"`

	// Information about the chat boost
	Boost ChatBoost `json:"boost"`
}

ChatBoostUpdated this object represents a boost added to a chat or changed.

type ChatFullInfo added in v0.16.0

type ChatFullInfo struct {
	// Unique identifier for this chat. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.
	ID ChatID `json:"id"`

	// Type of the chat, can be either “private”, “group”, “supergroup” or “channel”
	Type ChatType `json:"type"`

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

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

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

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

	// Optional. True, if the supergroup chat is a forum (has [topics] enabled)
	//
	// [topics]: https://telegram.org/blog/topics-in-groups-collectible-usernames#topics-in-groups
	IsForum bool `json:"is_forum,omitempty"`

	// Optional. True, if the chat is the direct messages chat of a channel
	IsDirectMessages bool `json:"is_direct_messages,omitempty"`

	// Identifier of the accent color for the chat name and backgrounds of the chat photo, reply header, and link preview. See [accent colors] for more details.
	//
	// [accent colors]: https://core.telegram.org/bots/api#accent-colors
	AccentColorID int `json:"accent_color_id"`

	// The maximum number of reactions that can be set on a message in the chat
	MaxReactionCount int `json:"max_reaction_count"`

	// Optional. Chat photo
	Photo *ChatPhoto `json:"photo,omitempty"`

	// Optional. If non-empty, the list of all [active chat usernames]; for private chats, supergroups and channels
	//
	// [active chat usernames]: https://telegram.org/blog/topics-in-groups-collectible-usernames#collectible-usernames
	ActiveUsernames []string `json:"active_usernames,omitempty"`

	// Optional. For private chats, the date of birth of the user
	Birthdate *Birthdate `json:"birthdate,omitempty"`

	// Optional. For private chats with business accounts, the intro of the business
	BusinessIntro *BusinessIntro `json:"business_intro,omitempty"`

	// Optional. For private chats with business accounts, the location of the business
	BusinessLocation *BusinessLocation `json:"business_location,omitempty"`

	// Optional. For private chats with business accounts, the opening hours of the business
	BusinessOpeningHours *BusinessOpeningHours `json:"business_opening_hours,omitempty"`

	// Optional. For private chats, the personal channel of the user
	PersonalChat *Chat `json:"personal_chat,omitempty"`

	// Optional. Information about the corresponding channel chat; for direct messages chats only
	ParentChat *Chat `json:"parent_chat,omitempty"`

	// Optional. List of available reactions allowed in the chat. If omitted, then all [ReactionTypeEmoji] are allowed.
	AvailableReactions []ReactionType `json:"available_reactions,omitempty"`

	// Optional. Custom emoji identifier of the emoji chosen by the chat for the reply header and link preview background
	BackgroundCustomEmojiID string `json:"background_custom_emoji_id,omitempty"`

	// Optional. Identifier of the accent color for the chat's profile background. See [profile accent colors] for more details.
	//
	// [profile accent colors]: https://core.telegram.org/bots/api#profile-accent-colors
	ProfileAccentColorID int `json:"profile_accent_color_id,omitempty"`

	// Optional. Custom emoji identifier of the emoji chosen by the chat for its profile background
	ProfileBackgroundCustomEmojiID string `json:"profile_background_custom_emoji_id,omitempty"`

	// Optional. Custom emoji identifier of the emoji status of the chat or the other party in a private chat
	EmojiStatusCustomEmojiID string `json:"emoji_status_custom_emoji_id,omitempty"`

	// Optional. Expiration date of the emoji status of the chat or the other party in a private chat, in Unix time, if any
	EmojiStatusExpirationDate UnixTime `json:"emoji_status_expiration_date,omitempty"`

	// Optional. Bio of the other party in a private chat
	Bio string `json:"bio,omitempty"`

	// Optional. True, if privacy settings of the other party in the private chat allows to use tg://user?id=<user_id> links only in chats with the user
	HasPrivateForwards bool `json:"has_private_forwards,omitempty"`

	// Optional. True, if the privacy settings of the other party restrict sending voice and video note messages in the private chat
	HasRestrictedVoiceAndVideoMessages bool `json:"has_restricted_voice_and_video_messages,omitempty"`

	// Optional. True, if users need to join the supergroup before they can send messages
	JoinToSendMessages bool `json:"join_to_send_messages,omitempty"`

	// Optional. True, if all users directly joining the supergroup without using an invite link need to be approved by supergroup administrators
	JoinByRequest bool `json:"join_by_request,omitempty"`

	// Optional. Description, for groups, supergroups and channel chats
	Description string `json:"description,omitempty"`

	// Optional. Primary invite link, for groups, supergroups and channel chats
	InviteLink string `json:"invite_link,omitempty"`

	// Optional. The most recent pinned message (by sending date)
	PinnedMessage *Message `json:"pinned_message,omitempty"`

	// Optional. Default chat member permissions, for groups and supergroups
	Permissions *ChatPermissions `json:"permissions,omitempty"`

	// Information about types of gifts that are accepted by the chat or by the corresponding user for private chats
	AcceptedGiftTypes AcceptedGiftTypes `json:"accepted_gift_types"`

	// Optional. True, if paid media messages can be sent or forwarded to the channel chat. The field is available only for channel chats.
	CanSendPaidMedia bool `json:"can_send_paid_media,omitempty"`

	// Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds
	SlowModeDelay int `json:"slow_mode_delay,omitempty"`

	// Optional. For supergroups, the minimum number of boosts that a non-administrator user needs to add in order to ignore slow mode and chat permissions
	UnrestrictBoostCount int `json:"unrestrict_boost_count,omitempty"`

	// Optional. The time after which all messages sent to the chat will be automatically deleted; in seconds
	MessageAutoDeleteTime int `json:"message_auto_delete_time,omitempty"`

	// Optional. True, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators.
	HasAggressiveAntiSpamEnabled bool `json:"has_aggressive_anti_spam_enabled,omitempty"`

	// Optional. True, if non-administrators can only get the list of bots and administrators in the chat
	HasHiddenMembers bool `json:"has_hidden_members,omitempty"`

	// Optional. True, if messages from the chat can't be forwarded to other chats
	HasProtectedContent bool `json:"has_protected_content,omitempty"`

	// Optional. True, if new chat members will have access to old messages; available only to chat administrators
	HasVisibleHistory bool `json:"has_visible_history,omitempty"`

	// Optional. For supergroups, name of the group sticker set
	StickerSetName string `json:"sticker_set_name,omitempty"`

	// Optional. True, if the bot can change the group sticker set
	CanSetStickerSet bool `json:"can_set_sticker_set,omitempty"`

	// Optional. For supergroups, the name of the group's custom emoji sticker set. Custom emoji from this set can be used by all users and bots in the group.
	CustomEmojiStickerSetName string `json:"custom_emoji_sticker_set_name,omitempty"`

	// Optional. Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. This identifier may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier.
	LinkedChatID ChatID `json:"linked_chat_id,omitempty"`

	// Optional. For supergroups, the location to which the supergroup is connected
	Location *ChatLocation `json:"location,omitempty"`

	// Optional. For private chats, the rating of the user if any
	Rating *UserRating `json:"rating,omitempty"`

	// Optional. For private chats, the first audio added to the profile of the user
	FirstProfileAudio *Audio `json:"first_profile_audio,omitempty"`

	// Optional. The color scheme based on a unique gift that must be used for the chat's name, message replies and link previews
	UniqueGiftColors *UniqueGiftColors `json:"unique_gift_colors,omitempty"`

	// Optional. The number of Telegram Stars a general user have to pay to send a message to the chat
	PaidMessageStarCount int `json:"paid_message_star_count,omitempty"`
}

ChatFullInfo this object contains full information about a chat.

type ChatID

type ChatID int64

func (ChatID) PeerID

func (id ChatID) PeerID() string
type ChatInviteLink struct {
	// The invite link. If the link was created by another chat administrator, then the second part of the link will be replaced with “…”.
	InviteLink string `json:"invite_link"`

	// Creator of the link
	Creator User `json:"creator"`

	// True, if users joining the chat via the link need to be approved by chat administrators
	CreatesJoinRequest bool `json:"creates_join_request"`

	// True, if the link is primary
	IsPrimary bool `json:"is_primary"`

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

	// Optional. Invite link name
	Name string `json:"name,omitempty"`

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

	// Optional. The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999
	MemberLimit int `json:"member_limit,omitempty"`

	// Optional. Number of pending join requests created using this link
	PendingJoinRequestCount int `json:"pending_join_request_count,omitempty"`

	// Optional. The number of seconds the subscription will be active for before the next payment
	SubscriptionPeriod int `json:"subscription_period,omitempty"`

	// Optional. The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat using the link
	SubscriptionPrice int `json:"subscription_price,omitempty"`
}

ChatInviteLink represents an invite link for a chat.

type ChatJoinRequest

type ChatJoinRequest struct {
	// Chat to which the request was sent
	Chat Chat `json:"chat"`

	// User that sent the join request
	From User `json:"from"`

	// Identifier of a private chat with the user who sent the join request. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot can use this identifier for 5 minutes to send messages until the join request is processed, assuming no other administrator contacted the user.
	UserChatID ChatID `json:"user_chat_id"`

	// Date the request was sent in Unix time
	Date UnixTime `json:"date"`

	// Optional. Bio of the user.
	Bio string `json:"bio,omitempty"`

	// Optional. Chat invite link that was used by the user to send the join request
	InviteLink *ChatInviteLink `json:"invite_link,omitempty"`
}

ChatJoinRequest represents a join request sent to a chat.

type ChatLocation

type ChatLocation struct {
	// The location to which the supergroup is connected. Can't be a live location.
	Location Location `json:"location"`

	// Location address; 1-64 characters, as defined by the chat owner
	Address string `json:"address"`
}

ChatLocation represents a location to which a chat is connected.

type ChatMember

type ChatMember struct {
	Owner         *ChatMemberOwner
	Administrator *ChatMemberAdministrator
	Member        *ChatMemberMember
	Restricted    *ChatMemberRestricted
	Left          *ChatMemberLeft
	Banned        *ChatMemberBanned
	Unknown       *UnknownVariant
}

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

func (*ChatMember) IsUnknown added in v0.16.0

func (u *ChatMember) IsUnknown() bool

IsUnknown reports whether this union contains an unknown variant. This can happen when the API returns a new variant not yet supported by this library.

func (ChatMember) MarshalJSON added in v0.16.0

func (u ChatMember) MarshalJSON() ([]byte, error)

func (*ChatMember) Status

func (u *ChatMember) Status() ChatMemberStatus

Status returns the discriminator value for this union.

func (*ChatMember) UnmarshalJSON added in v0.16.0

func (u *ChatMember) UnmarshalJSON(data []byte) error

type ChatMemberAdministrator

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

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

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

	// True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages, ignore slow mode, and send messages to the chat without paying Telegram Stars. Implied by any other administrator privilege.
	CanManageChat bool `json:"can_manage_chat"`

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

	// True, if the administrator can manage video chats
	CanManageVideoChats bool `json:"can_manage_video_chats"`

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

	// True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by the user)
	CanPromoteMembers bool `json:"can_promote_members"`

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

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

	// True, if the administrator can post stories to the chat
	CanPostStories bool `json:"can_post_stories"`

	// True, if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access the chat's story archive
	CanEditStories bool `json:"can_edit_stories"`

	// True, if the administrator can delete stories posted by other users
	CanDeleteStories bool `json:"can_delete_stories"`

	// Optional. True, if the administrator can post messages in the channel, approve suggested posts, or access channel statistics; for channels only
	CanPostMessages bool `json:"can_post_messages,omitempty"`

	// Optional. True, if the administrator can edit messages of other users and can pin messages; for channels only
	CanEditMessages bool `json:"can_edit_messages,omitempty"`

	// Optional. True, if the user is allowed to pin messages; for groups and supergroups only
	CanPinMessages bool `json:"can_pin_messages,omitempty"`

	// Optional. True, if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only
	CanManageTopics bool `json:"can_manage_topics,omitempty"`

	// Optional. True, if the administrator can manage direct messages of the channel and decline suggested posts; for channels only
	CanManageDirectMessages bool `json:"can_manage_direct_messages,omitempty"`

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

ChatMemberAdministrator represents a ChatMember that has some additional privileges.

type ChatMemberBanned

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

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

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

type ChatMemberLeft

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

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

type ChatMemberMember

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

	// Optional. Date when the user's subscription will expire; Unix time
	UntilDate UnixTime `json:"until_date,omitempty"`
}

ChatMemberMember represents a ChatMember that has no additional privileges or restrictions.

type ChatMemberOwner

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

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

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

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

type ChatMemberRestricted

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

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

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

	// True, if the user is allowed to send audios
	CanSendAudios bool `json:"can_send_audios"`

	// True, if the user is allowed to send documents
	CanSendDocuments bool `json:"can_send_documents"`

	// True, if the user is allowed to send photos
	CanSendPhotos bool `json:"can_send_photos"`

	// True, if the user is allowed to send videos
	CanSendVideos bool `json:"can_send_videos"`

	// True, if the user is allowed to send video notes
	CanSendVideoNotes bool `json:"can_send_video_notes"`

	// True, if the user is allowed to send voice notes
	CanSendVoiceNotes bool `json:"can_send_voice_notes"`

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

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

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

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

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

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

	// True, if the user is allowed to create forum topics
	CanManageTopics bool `json:"can_manage_topics"`

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

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

type ChatMemberStatus added in v0.16.0

type ChatMemberStatus int

ChatMemberStatus represents the type of ChatMember.

const (
	ChatMemberStatusOwner         ChatMemberStatus = iota + 1 // "creator"
	ChatMemberStatusAdministrator                             // "administrator"
	ChatMemberStatusMember                                    // "member"
	ChatMemberStatusRestricted                                // "restricted"
	ChatMemberStatusLeft                                      // "left"
	ChatMemberStatusBanned                                    // "kicked"
)

func (ChatMemberStatus) MarshalText added in v0.16.0

func (v ChatMemberStatus) MarshalText() ([]byte, error)

func (ChatMemberStatus) String added in v0.16.0

func (v ChatMemberStatus) String() string

func (*ChatMemberStatus) UnmarshalText added in v0.16.0

func (v *ChatMemberStatus) UnmarshalText(b []byte) error

type ChatMemberUpdated

type ChatMemberUpdated struct {
	// Chat the user belongs to
	Chat Chat `json:"chat"`

	// Performer of the action, which resulted in the change
	From User `json:"from"`

	// Date the change was done in Unix time
	Date UnixTime `json:"date"`

	// Previous information about the chat member
	OldChatMember ChatMember `json:"old_chat_member"`

	// New information about the chat member
	NewChatMember ChatMember `json:"new_chat_member"`

	// Optional. Chat invite link, which was used by the user to join the chat; for joining by invite link events only.
	InviteLink *ChatInviteLink `json:"invite_link,omitempty"`

	// Optional. True, if the user joined the chat after sending a direct join request without using an invite link and being approved by an administrator
	ViaJoinRequest bool `json:"via_join_request,omitempty"`

	// Optional. True, if the user joined the chat via a chat folder invite link
	ViaChatFolderInviteLink bool `json:"via_chat_folder_invite_link,omitempty"`
}

ChatMemberUpdated this object represents changes in the status of a chat member.

type ChatOwnerChanged added in v0.18.0

type ChatOwnerChanged struct {
	// The new owner of the chat
	NewOwner User `json:"new_owner"`
}

ChatOwnerChanged describes a service message about an ownership change in the chat.

type ChatOwnerLeft added in v0.18.0

type ChatOwnerLeft struct {
	// Optional. The user which will be the new owner of the chat if the previous owner does not return to the chat
	NewOwner *User `json:"new_owner,omitempty"`
}

ChatOwnerLeft describes a service message about the chat owner leaving the chat.

type ChatPermissions

type ChatPermissions struct {
	// Optional. True, if the user is allowed to send text messages, contacts, giveaways, giveaway winners, invoices, locations and venues
	CanSendMessages bool `json:"can_send_messages,omitempty"`

	// Optional. True, if the user is allowed to send audios
	CanSendAudios bool `json:"can_send_audios,omitempty"`

	// Optional. True, if the user is allowed to send documents
	CanSendDocuments bool `json:"can_send_documents,omitempty"`

	// Optional. True, if the user is allowed to send photos
	CanSendPhotos bool `json:"can_send_photos,omitempty"`

	// Optional. True, if the user is allowed to send videos
	CanSendVideos bool `json:"can_send_videos,omitempty"`

	// Optional. True, if the user is allowed to send video notes
	CanSendVideoNotes bool `json:"can_send_video_notes,omitempty"`

	// Optional. True, if the user is allowed to send voice notes
	CanSendVoiceNotes bool `json:"can_send_voice_notes,omitempty"`

	// Optional. True, if the user is allowed to send polls and checklists
	CanSendPolls bool `json:"can_send_polls,omitempty"`

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

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

	// Optional. True, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups
	CanChangeInfo bool `json:"can_change_info,omitempty"`

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

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

	// Optional. True, if the user is allowed to create forum topics. If omitted defaults to the value of can_pin_messages
	CanManageTopics bool `json:"can_manage_topics,omitempty"`
}

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

type ChatPhoto

type ChatPhoto struct {
	// File identifier of small (160x160) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed.
	SmallFileID FileID `json:"small_file_id"`

	// Unique file identifier of small (160x160) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
	SmallFileUniqueID string `json:"small_file_unique_id"`

	// File identifier of big (640x640) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed.
	BigFileID FileID `json:"big_file_id"`

	// Unique file identifier of big (640x640) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
	BigFileUniqueID string `json:"big_file_unique_id"`
}

ChatPhoto this object represents a chat photo.

type ChatShared added in v0.6.0

type ChatShared struct {
	// Identifier of the request
	RequestID int `json:"request_id"`

	// Identifier of the shared chat. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot may not have access to the chat and could be unable to use this identifier, unless the chat is already known to the bot by some other means.
	ChatID ChatID `json:"chat_id"`

	// Optional. Title of the chat, if the title was requested by the bot.
	Title string `json:"title,omitempty"`

	// Optional. Username of the chat, if the username was requested by the bot and available.
	Username Username `json:"username,omitempty"`

	// Optional. Available sizes of the chat photo, if the photo was requested by the bot
	Photo []PhotoSize `json:"photo,omitempty"`
}

ChatShared this object contains information about a chat that was shared with the bot using a KeyboardButtonRequestChat button.

type ChatType added in v0.0.2

type ChatType int8

ChatType represents an enum type.

const (
	ChatTypeUnknown    ChatType = iota
	ChatTypePrivate             // "private"
	ChatTypeGroup               // "group"
	ChatTypeSupergroup          // "supergroup"
	ChatTypeChannel             // "channel"
	ChatTypeSender              // "sender"
)

func (ChatType) IsUnknown added in v0.16.0

func (v ChatType) IsUnknown() bool

IsUnknown reports whether this value is unknown.

func (ChatType) MarshalJSON added in v0.0.2

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

func (ChatType) String added in v0.0.2

func (v ChatType) String() string

func (*ChatType) UnmarshalJSON added in v0.0.2

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

type Checklist added in v0.16.0

type Checklist struct {
	// Title of the checklist
	Title string `json:"title"`

	// Optional. Special entities that appear in the checklist title
	TitleEntities []MessageEntity `json:"title_entities,omitempty"`

	// List of tasks in the checklist
	Tasks []ChecklistTask `json:"tasks"`

	// Optional. True, if users other than the creator of the list can add tasks to the list
	OthersCanAddTasks bool `json:"others_can_add_tasks,omitempty"`

	// Optional. True, if users other than the creator of the list can mark tasks as done or not done
	OthersCanMarkTasksAsDone bool `json:"others_can_mark_tasks_as_done,omitempty"`
}

Checklist describes a checklist.

type ChecklistTask added in v0.16.0

type ChecklistTask struct {
	// Unique identifier of the task
	ID int `json:"id"`

	// Text of the task
	Text string `json:"text"`

	// Optional. Special entities that appear in the task text
	TextEntities []MessageEntity `json:"text_entities,omitempty"`

	// Optional. User that completed the task; omitted if the task wasn't completed by a user
	CompletedByUser *User `json:"completed_by_user,omitempty"`

	// Optional. Chat that completed the task; omitted if the task wasn't completed by a chat
	CompletedByChat *Chat `json:"completed_by_chat,omitempty"`

	// Optional. Point in time (Unix timestamp) when the task was completed; 0 if the task wasn't completed
	CompletionDate UnixTime `json:"completion_date,omitempty"`
}

ChecklistTask describes a task in a checklist.

type ChecklistTasksAdded added in v0.16.0

type ChecklistTasksAdded struct {
	// Optional. Message containing the checklist to which the tasks were added. Note that the [Message] object in this field will not contain the reply_to_message field even if it itself is a reply.
	ChecklistMessage *Message `json:"checklist_message,omitempty"`

	// List of tasks added to the checklist
	Tasks []ChecklistTask `json:"tasks"`
}

ChecklistTasksAdded describes a service message about tasks added to a checklist.

type ChecklistTasksDone added in v0.16.0

type ChecklistTasksDone struct {
	// Optional. Message containing the checklist whose tasks were marked as done or not done. Note that the [Message] object in this field will not contain the reply_to_message field even if it itself is a reply.
	ChecklistMessage *Message `json:"checklist_message,omitempty"`

	// Optional. Identifiers of the tasks that were marked as done
	MarkedAsDoneTaskIDs []int `json:"marked_as_done_task_ids,omitempty"`

	// Optional. Identifiers of the tasks that were marked as not done
	MarkedAsNotDoneTaskIDs []int `json:"marked_as_not_done_task_ids,omitempty"`
}

ChecklistTasksDone describes a service message about checklist tasks marked as done or not done.

type ChosenInlineResult

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

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

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

	// Optional. Identifier of the sent inline message. Available only if there is an [InlineKeyboardMarkup] attached to the message. Will be also received in [CallbackQuery] and can be used to [edit] the message.
	//
	// [edit]: https://core.telegram.org/bots/api#updating-messages
	InlineMessageID string `json:"inline_message_id,omitempty"`

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

ChosenInlineResult represents a InlineQueryResult of an inline query that was chosen by the user and sent to their chat partner. Note: It is necessary to enable inline feedback via @BotFather in order to receive these objects in updates.

type Client

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

Client is Telegram Bot API client structure. Create new client with NewClient function.

func New

func New(token string, options ...ClientOption) *Client

New creates new Client with given token and options.

func (*Client) AddStickerToSet

func (client *Client) AddStickerToSet(userID UserID, name string, sticker InputSticker) *AddStickerToSetCall

AddStickerToSet constructs a new AddStickerToSetCall.

Required params:

  • userID: User identifier of sticker set owner
  • name: Sticker set name
  • sticker: A JSON-serialized object with information about the added sticker. If exactly the same sticker had already been added to the set, then the set isn't changed.

func (*Client) AnswerCallbackQuery

func (client *Client) AnswerCallbackQuery(callbackQueryID string) *AnswerCallbackQueryCall

AnswerCallbackQuery constructs a new AnswerCallbackQueryCall.

Required params:

  • callbackQueryID: Unique identifier for the query to be answered

func (*Client) AnswerInlineQuery

func (client *Client) AnswerInlineQuery(inlineQueryID string, results []InlineQueryResult) *AnswerInlineQueryCall

AnswerInlineQuery constructs a new AnswerInlineQueryCall.

Required params:

  • inlineQueryID: Unique identifier for the answered query
  • results: A JSON-serialized array of results for the inline query

func (*Client) AnswerPreCheckoutQuery

func (client *Client) AnswerPreCheckoutQuery(preCheckoutQueryID string, ok bool) *AnswerPreCheckoutQueryCall

AnswerPreCheckoutQuery constructs a new AnswerPreCheckoutQueryCall.

Required params:

  • preCheckoutQueryID: Unique identifier for the query to be answered
  • ok: Specify True if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. Use False if there are any problems.

func (*Client) AnswerShippingQuery

func (client *Client) AnswerShippingQuery(shippingQueryID string, ok bool) *AnswerShippingQueryCall

AnswerShippingQuery constructs a new AnswerShippingQueryCall.

Required params:

  • shippingQueryID: Unique identifier for the query to be answered
  • ok: Pass True if delivery to the specified address is possible and False if there are any problems (for example, if delivery to the specified address is not possible)

func (*Client) AnswerWebAppQuery

func (client *Client) AnswerWebAppQuery(webAppQueryID string, result InlineQueryResultClass) *AnswerWebAppQueryCall

AnswerWebAppQuery constructs a new AnswerWebAppQueryCall.

Required params:

  • webAppQueryID: Unique identifier for the query to be answered
  • result: A JSON-serialized object describing the message to be sent

func (*Client) ApproveChatJoinRequest

func (client *Client) ApproveChatJoinRequest(chatID PeerID, userID UserID) *ApproveChatJoinRequestCall

ApproveChatJoinRequest constructs a new ApproveChatJoinRequestCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • userID: Unique identifier of the target user

func (*Client) ApproveSuggestedPost added in v0.16.0

func (client *Client) ApproveSuggestedPost(chatID int, messageID int) *ApproveSuggestedPostCall

ApproveSuggestedPost constructs a new ApproveSuggestedPostCall.

Required params:

  • chatID: Unique identifier for the target direct messages chat
  • messageID: Identifier of a suggested post message to approve

func (*Client) BanChatMember

func (client *Client) BanChatMember(chatID PeerID, userID UserID) *BanChatMemberCall

BanChatMember constructs a new BanChatMemberCall.

Required params:

  • chatID: Unique identifier for the target group or username of the target supergroup or channel (in the format @channelusername)
  • userID: Unique identifier of the target user

func (*Client) BanChatSenderChat

func (client *Client) BanChatSenderChat(chatID PeerID, senderChatID int) *BanChatSenderChatCall

BanChatSenderChat constructs a new BanChatSenderChatCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • senderChatID: Unique identifier of the target sender chat

func (*Client) Close

func (client *Client) Close() *CloseCall

Close constructs a new CloseCall.

func (*Client) CloseForumTopic added in v0.6.0

func (client *Client) CloseForumTopic(chatID PeerID, messageThreadID int) *CloseForumTopicCall

CloseForumTopic constructs a new CloseForumTopicCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
  • messageThreadID: Unique identifier for the target message thread of the forum topic

func (*Client) CloseGeneralForumTopic added in v0.6.0

func (client *Client) CloseGeneralForumTopic(chatID PeerID) *CloseGeneralForumTopicCall

CloseGeneralForumTopic constructs a new CloseGeneralForumTopicCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

func (*Client) ConvertGiftToStars added in v0.16.0

func (client *Client) ConvertGiftToStars(businessConnectionID string, ownedGiftID string) *ConvertGiftToStarsCall

ConvertGiftToStars constructs a new ConvertGiftToStarsCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection
  • ownedGiftID: Unique identifier of the regular gift that should be converted to Telegram Stars

func (*Client) CopyMessage

func (client *Client) CopyMessage(chatID PeerID, fromChatID PeerID, messageID int) *CopyMessageCall

CopyMessage constructs a new CopyMessageCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • fromChatID: Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)
  • messageID: Message identifier in the chat specified in from_chat_id

func (*Client) CopyMessages added in v0.12.0

func (client *Client) CopyMessages(chatID PeerID, fromChatID PeerID, messageIDs []int) *CopyMessagesCall

CopyMessages constructs a new CopyMessagesCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • fromChatID: Unique identifier for the chat where the original messages were sent (or channel username in the format @channelusername)
  • messageIDs: A JSON-serialized list of 1-100 identifiers of messages in the chat from_chat_id to copy. The identifiers must be specified in a strictly increasing order.
func (client *Client) CreateChatInviteLink(chatID PeerID) *CreateChatInviteLinkCall

CreateChatInviteLink constructs a new CreateChatInviteLinkCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
func (client *Client) CreateChatSubscriptionInviteLink(chatID PeerID, subscriptionPeriod int, subscriptionPrice int) *CreateChatSubscriptionInviteLinkCall

CreateChatSubscriptionInviteLink constructs a new CreateChatSubscriptionInviteLinkCall.

Required params:

  • chatID: Unique identifier for the target channel chat or username of the target channel (in the format @channelusername)
  • subscriptionPeriod: The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days).
  • subscriptionPrice: The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat; 1-10000

func (*Client) CreateForumTopic added in v0.6.0

func (client *Client) CreateForumTopic(chatID PeerID, name string) *CreateForumTopicCall

CreateForumTopic constructs a new CreateForumTopicCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
  • name: Topic name, 1-128 characters
func (client *Client) CreateInvoiceLink(title string, description string, payload string, currency string, prices []LabeledPrice) *CreateInvoiceLinkCall

CreateInvoiceLink constructs a new CreateInvoiceLinkCall.

Required params:

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

func (*Client) CreateNewStickerSet

func (client *Client) CreateNewStickerSet(userID UserID, name string, title string, stickers []InputSticker) *CreateNewStickerSetCall

CreateNewStickerSet constructs a new CreateNewStickerSetCall.

Required params:

  • userID: User identifier of created sticker set owner
  • name: Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals). Can contain only English letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and must end in "_by_<bot_username>". <bot_username> is case insensitive. 1-64 characters.
  • title: Sticker set title, 1-64 characters
  • stickers: A JSON-serialized list of 1-50 initial stickers to be added to the sticker set

func (*Client) DeclineChatJoinRequest

func (client *Client) DeclineChatJoinRequest(chatID PeerID, userID UserID) *DeclineChatJoinRequestCall

DeclineChatJoinRequest constructs a new DeclineChatJoinRequestCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • userID: Unique identifier of the target user

func (*Client) DeclineSuggestedPost added in v0.16.0

func (client *Client) DeclineSuggestedPost(chatID int, messageID int) *DeclineSuggestedPostCall

DeclineSuggestedPost constructs a new DeclineSuggestedPostCall.

Required params:

  • chatID: Unique identifier for the target direct messages chat
  • messageID: Identifier of a suggested post message to decline

func (*Client) DeleteBusinessMessages added in v0.16.0

func (client *Client) DeleteBusinessMessages(businessConnectionID string, messageIDs []int) *DeleteBusinessMessagesCall

DeleteBusinessMessages constructs a new DeleteBusinessMessagesCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection on behalf of which to delete the messages
  • messageIDs: A JSON-serialized list of 1-100 identifiers of messages to delete. All messages must be from the same chat. See Client.DeleteMessage for limitations on which messages can be deleted

func (*Client) DeleteChatPhoto

func (client *Client) DeleteChatPhoto(chatID PeerID) *DeleteChatPhotoCall

DeleteChatPhoto constructs a new DeleteChatPhotoCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*Client) DeleteChatStickerSet

func (client *Client) DeleteChatStickerSet(chatID PeerID) *DeleteChatStickerSetCall

DeleteChatStickerSet constructs a new DeleteChatStickerSetCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

func (*Client) DeleteForumTopic added in v0.6.0

func (client *Client) DeleteForumTopic(chatID PeerID, messageThreadID int) *DeleteForumTopicCall

DeleteForumTopic constructs a new DeleteForumTopicCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
  • messageThreadID: Unique identifier for the target message thread of the forum topic

func (*Client) DeleteMessage

func (client *Client) DeleteMessage(chatID PeerID, messageID int) *DeleteMessageCall

DeleteMessage constructs a new DeleteMessageCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • messageID: Identifier of the message to delete

func (*Client) DeleteMessages added in v0.12.0

func (client *Client) DeleteMessages(chatID PeerID, messageIDs []int) *DeleteMessagesCall

DeleteMessages constructs a new DeleteMessagesCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • messageIDs: A JSON-serialized list of 1-100 identifiers of messages to delete. See Client.DeleteMessage for limitations on which messages can be deleted

func (*Client) DeleteMyCommands

func (client *Client) DeleteMyCommands() *DeleteMyCommandsCall

DeleteMyCommands constructs a new DeleteMyCommandsCall.

func (*Client) DeleteStickerFromSet

func (client *Client) DeleteStickerFromSet(sticker string) *DeleteStickerFromSetCall

DeleteStickerFromSet constructs a new DeleteStickerFromSetCall.

Required params:

  • sticker: File identifier of the sticker

func (*Client) DeleteStickerSet added in v0.8.0

func (client *Client) DeleteStickerSet(name string) *DeleteStickerSetCall

DeleteStickerSet constructs a new DeleteStickerSetCall.

Required params:

  • name: Sticker set name

func (*Client) DeleteStory added in v0.16.0

func (client *Client) DeleteStory(businessConnectionID string, storyID int) *DeleteStoryCall

DeleteStory constructs a new DeleteStoryCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection
  • storyID: Unique identifier of the story to delete

func (*Client) DeleteWebhook

func (client *Client) DeleteWebhook() *DeleteWebhookCall

DeleteWebhook constructs a new DeleteWebhookCall.

func (*Client) Do added in v0.0.6

func (client *Client) Do(ctx context.Context, req *Request, dst any) error

func (*Client) Download added in v0.1.0

func (client *Client) Download(ctx context.Context, path string) (io.ReadCloser, error)

Download file by path from Client.GetFile method. Don't forget to close ReadCloser.

func (client *Client) EditChatInviteLink(chatID PeerID, inviteLink string) *EditChatInviteLinkCall

EditChatInviteLink constructs a new EditChatInviteLinkCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • inviteLink: The invite link to edit
func (client *Client) EditChatSubscriptionInviteLink(chatID PeerID, inviteLink string) *EditChatSubscriptionInviteLinkCall

EditChatSubscriptionInviteLink constructs a new EditChatSubscriptionInviteLinkCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • inviteLink: The invite link to edit

func (*Client) EditForumTopic added in v0.6.0

func (client *Client) EditForumTopic(chatID PeerID, messageThreadID int) *EditForumTopicCall

EditForumTopic constructs a new EditForumTopicCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
  • messageThreadID: Unique identifier for the target message thread of the forum topic

func (*Client) EditGeneralForumTopic added in v0.6.0

func (client *Client) EditGeneralForumTopic(chatID PeerID, name string) *EditGeneralForumTopicCall

EditGeneralForumTopic constructs a new EditGeneralForumTopicCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
  • name: New topic name, 1-128 characters

func (*Client) EditMessageCaption

func (client *Client) EditMessageCaption(chatID PeerID, messageID int, caption string) *EditMessageCaptionCall

EditMessageCaption constructs a new EditMessageCaptionCall.

Required params:

  • chatID: Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • messageID: Required if inline_message_id is not specified. Identifier of the message to edit
  • caption: New caption of the message, 0-1024 characters after entities parsing

func (*Client) EditMessageCaptionInline added in v0.0.3

func (client *Client) EditMessageCaptionInline(inlineMessageID string, caption string) *EditMessageCaptionCall

EditMessageCaptionInline constructs a new EditMessageCaptionCall.

Required params:

  • inlineMessageID: Required if chat_id and message_id are not specified. Identifier of the inline message
  • caption: New caption of the message, 0-1024 characters after entities parsing

func (*Client) EditMessageChecklist added in v0.16.0

func (client *Client) EditMessageChecklist(businessConnectionID string, chatID int, messageID int, checklist InputChecklist) *EditMessageChecklistCall

EditMessageChecklist constructs a new EditMessageChecklistCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection on behalf of which the message will be sent
  • chatID: Unique identifier for the target chat
  • messageID: Unique identifier for the target message
  • checklist: A JSON-serialized object for the new checklist

func (*Client) EditMessageLiveLocation

func (client *Client) EditMessageLiveLocation(chatID PeerID, messageID int, latitude float64, longitude float64) *EditMessageLiveLocationCall

EditMessageLiveLocation constructs a new EditMessageLiveLocationCall.

Required params:

  • chatID: Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • messageID: Required if inline_message_id is not specified. Identifier of the message to edit
  • latitude: Latitude of new location
  • longitude: Longitude of new location

func (*Client) EditMessageLiveLocationInline

func (client *Client) EditMessageLiveLocationInline(inlineMessageID string, latitude float64, longitude float64) *EditMessageLiveLocationCall

EditMessageLiveLocationInline constructs a new EditMessageLiveLocationCall.

Required params:

  • inlineMessageID: Required if chat_id and message_id are not specified. Identifier of the inline message
  • latitude: Latitude of new location
  • longitude: Longitude of new location

func (*Client) EditMessageMedia

func (client *Client) EditMessageMedia(chatID PeerID, messageID int, media InputMediaClass) *EditMessageMediaCall

EditMessageMedia constructs a new EditMessageMediaCall.

Required params:

  • chatID: Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • messageID: Required if inline_message_id is not specified. Identifier of the message to edit
  • media: A JSON-serialized object for a new media content of the message

func (*Client) EditMessageMediaInline added in v0.16.0

func (client *Client) EditMessageMediaInline(inlineMessageID string, media InputMediaClass) *EditMessageMediaCall

EditMessageMediaInline constructs a new EditMessageMediaCall.

Required params:

  • inlineMessageID: Required if chat_id and message_id are not specified. Identifier of the inline message
  • media: A JSON-serialized object for a new media content of the message

func (*Client) EditMessageReplyMarkup

func (client *Client) EditMessageReplyMarkup(chatID PeerID, messageID int) *EditMessageReplyMarkupCall

EditMessageReplyMarkup constructs a new EditMessageReplyMarkupCall.

Required params:

  • chatID: Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • messageID: Required if inline_message_id is not specified. Identifier of the message to edit

func (*Client) EditMessageReplyMarkupInline added in v0.0.3

func (client *Client) EditMessageReplyMarkupInline(inlineMessageID string) *EditMessageReplyMarkupCall

EditMessageReplyMarkupInline constructs a new EditMessageReplyMarkupCall.

Required params:

  • inlineMessageID: Required if chat_id and message_id are not specified. Identifier of the inline message

func (*Client) EditMessageText

func (client *Client) EditMessageText(chatID PeerID, messageID int, text string) *EditMessageTextCall

EditMessageText constructs a new EditMessageTextCall.

Required params:

  • chatID: Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • messageID: Required if inline_message_id is not specified. Identifier of the message to edit
  • text: New text of the message, 1-4096 characters after entities parsing

func (*Client) EditMessageTextInline added in v0.0.3

func (client *Client) EditMessageTextInline(inlineMessageID string, text string) *EditMessageTextCall

EditMessageTextInline constructs a new EditMessageTextCall.

Required params:

  • inlineMessageID: Required if chat_id and message_id are not specified. Identifier of the inline message
  • text: New text of the message, 1-4096 characters after entities parsing

func (*Client) EditStory added in v0.16.0

func (client *Client) EditStory(businessConnectionID string, storyID int, content InputStoryContentClass) *EditStoryCall

EditStory constructs a new EditStoryCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection
  • storyID: Unique identifier of the story to edit
  • content: Content of the story

func (*Client) EditUserStarSubscription added in v0.16.0

func (client *Client) EditUserStarSubscription(userID UserID, telegramPaymentChargeID string, isCanceled bool) *EditUserStarSubscriptionCall

EditUserStarSubscription constructs a new EditUserStarSubscriptionCall.

Required params:

  • userID: Identifier of the user whose subscription will be edited
  • telegramPaymentChargeID: Telegram payment identifier for the subscription
  • isCanceled: Pass True to cancel extension of the user subscription; the subscription must be active up to the end of the current subscription period. Pass False to allow the user to re-enable a subscription that was previously canceled by the bot.
func (client *Client) ExportChatInviteLink(chatID PeerID) *ExportChatInviteLinkCall

ExportChatInviteLink constructs a new ExportChatInviteLinkCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*Client) ForwardMessage

func (client *Client) ForwardMessage(chatID PeerID, fromChatID PeerID, messageID int) *ForwardMessageCall

ForwardMessage constructs a new ForwardMessageCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • fromChatID: Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)
  • messageID: Message identifier in the chat specified in from_chat_id

func (*Client) ForwardMessages added in v0.12.0

func (client *Client) ForwardMessages(chatID PeerID, fromChatID PeerID, messageIDs []int) *ForwardMessagesCall

ForwardMessages constructs a new ForwardMessagesCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • fromChatID: Unique identifier for the chat where the original messages were sent (or channel username in the format @channelusername)
  • messageIDs: A JSON-serialized list of 1-100 identifiers of messages in the chat from_chat_id to forward. The identifiers must be specified in a strictly increasing order.

func (*Client) GetAvailableGifts added in v0.16.0

func (client *Client) GetAvailableGifts() *GetAvailableGiftsCall

GetAvailableGifts constructs a new GetAvailableGiftsCall.

func (*Client) GetBusinessAccountGifts added in v0.16.0

func (client *Client) GetBusinessAccountGifts(businessConnectionID string) *GetBusinessAccountGiftsCall

GetBusinessAccountGifts constructs a new GetBusinessAccountGiftsCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection

func (*Client) GetBusinessAccountStarBalance added in v0.16.0

func (client *Client) GetBusinessAccountStarBalance(businessConnectionID string) *GetBusinessAccountStarBalanceCall

GetBusinessAccountStarBalance constructs a new GetBusinessAccountStarBalanceCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection

func (*Client) GetBusinessConnection added in v0.15.0

func (client *Client) GetBusinessConnection(businessConnectionID string) *GetBusinessConnectionCall

GetBusinessConnection constructs a new GetBusinessConnectionCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection

func (*Client) GetChat

func (client *Client) GetChat(chatID PeerID) *GetChatCall

GetChat constructs a new GetChatCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)

func (*Client) GetChatAdministrators

func (client *Client) GetChatAdministrators(chatID PeerID) *GetChatAdministratorsCall

GetChatAdministrators constructs a new GetChatAdministratorsCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)

func (*Client) GetChatGifts added in v0.16.0

func (client *Client) GetChatGifts(chatID PeerID) *GetChatGiftsCall

GetChatGifts constructs a new GetChatGiftsCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*Client) GetChatMember

func (client *Client) GetChatMember(chatID PeerID, userID UserID) *GetChatMemberCall

GetChatMember constructs a new GetChatMemberCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
  • userID: Unique identifier of the target user

func (*Client) GetChatMemberCount

func (client *Client) GetChatMemberCount(chatID PeerID) *GetChatMemberCountCall

GetChatMemberCount constructs a new GetChatMemberCountCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)

func (*Client) GetChatMenuButton

func (client *Client) GetChatMenuButton() *GetChatMenuButtonCall

GetChatMenuButton constructs a new GetChatMenuButtonCall.

func (*Client) GetCustomEmojiStickers added in v0.5.0

func (client *Client) GetCustomEmojiStickers(customEmojiIDs []string) *GetCustomEmojiStickersCall

GetCustomEmojiStickers constructs a new GetCustomEmojiStickersCall.

Required params:

  • customEmojiIDs: A JSON-serialized list of custom emoji identifiers. At most 200 custom emoji identifiers can be specified.

func (*Client) GetFile

func (client *Client) GetFile(fileID FileID) *GetFileCall

GetFile constructs a new GetFileCall.

Required params:

  • fileID: File identifier to get information about

func (*Client) GetForumTopicIconStickers added in v0.6.0

func (client *Client) GetForumTopicIconStickers() *GetForumTopicIconStickersCall

GetForumTopicIconStickers constructs a new GetForumTopicIconStickersCall.

func (*Client) GetGameHighScores

func (client *Client) GetGameHighScores(userID UserID) *GetGameHighScoresCall

GetGameHighScores constructs a new GetGameHighScoresCall.

Required params:

  • userID: Target user id

func (*Client) GetMe

func (client *Client) GetMe() *GetMeCall

GetMe constructs a new GetMeCall.

func (*Client) GetMyCommands

func (client *Client) GetMyCommands() *GetMyCommandsCall

GetMyCommands constructs a new GetMyCommandsCall.

func (*Client) GetMyDefaultAdministratorRights

func (client *Client) GetMyDefaultAdministratorRights() *GetMyDefaultAdministratorRightsCall

GetMyDefaultAdministratorRights constructs a new GetMyDefaultAdministratorRightsCall.

func (*Client) GetMyDescription added in v0.8.0

func (client *Client) GetMyDescription() *GetMyDescriptionCall

GetMyDescription constructs a new GetMyDescriptionCall.

func (*Client) GetMyName added in v0.9.0

func (client *Client) GetMyName() *GetMyNameCall

GetMyName constructs a new GetMyNameCall.

func (*Client) GetMyShortDescription added in v0.8.0

func (client *Client) GetMyShortDescription() *GetMyShortDescriptionCall

GetMyShortDescription constructs a new GetMyShortDescriptionCall.

func (*Client) GetMyStarBalance added in v0.16.0

func (client *Client) GetMyStarBalance() *GetMyStarBalanceCall

GetMyStarBalance constructs a new GetMyStarBalanceCall.

func (*Client) GetStarTransactions added in v0.16.0

func (client *Client) GetStarTransactions() *GetStarTransactionsCall

GetStarTransactions constructs a new GetStarTransactionsCall.

func (*Client) GetStickerSet

func (client *Client) GetStickerSet(name string) *GetStickerSetCall

GetStickerSet constructs a new GetStickerSetCall.

Required params:

  • name: Name of the sticker set

func (*Client) GetUpdates

func (client *Client) GetUpdates() *GetUpdatesCall

GetUpdates constructs a new GetUpdatesCall.

func (*Client) GetUserChatBoosts added in v0.12.0

func (client *Client) GetUserChatBoosts(chatID PeerID, userID UserID) *GetUserChatBoostsCall

GetUserChatBoosts constructs a new GetUserChatBoostsCall.

Required params:

  • chatID: Unique identifier for the chat or username of the channel (in the format @channelusername)
  • userID: Unique identifier of the target user

func (*Client) GetUserGifts added in v0.16.0

func (client *Client) GetUserGifts(userID UserID) *GetUserGiftsCall

GetUserGifts constructs a new GetUserGiftsCall.

Required params:

  • userID: Unique identifier of the user

func (*Client) GetUserProfileAudios added in v0.18.0

func (client *Client) GetUserProfileAudios(userID UserID) *GetUserProfileAudiosCall

GetUserProfileAudios constructs a new GetUserProfileAudiosCall.

Required params:

  • userID: Unique identifier of the target user

func (*Client) GetUserProfilePhotos

func (client *Client) GetUserProfilePhotos(userID UserID) *GetUserProfilePhotosCall

GetUserProfilePhotos constructs a new GetUserProfilePhotosCall.

Required params:

  • userID: Unique identifier of the target user

func (*Client) GetWebhookInfo

func (client *Client) GetWebhookInfo() *GetWebhookInfoCall

GetWebhookInfo constructs a new GetWebhookInfoCall.

func (*Client) GiftPremiumSubscription added in v0.16.0

func (client *Client) GiftPremiumSubscription(userID UserID, monthCount int, starCount int) *GiftPremiumSubscriptionCall

GiftPremiumSubscription constructs a new GiftPremiumSubscriptionCall.

Required params:

  • userID: Unique identifier of the target user who will receive a Telegram Premium subscription
  • monthCount: Number of months the Telegram Premium subscription will be active for the user; must be one of 3, 6, or 12
  • starCount: Number of Telegram Stars to pay for the Telegram Premium subscription; must be 1000 for 3 months, 1500 for 6 months, and 2500 for 12 months

func (*Client) HideGeneralForumTopic added in v0.6.0

func (client *Client) HideGeneralForumTopic(chatID PeerID) *HideGeneralForumTopicCall

HideGeneralForumTopic constructs a new HideGeneralForumTopicCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

func (*Client) LeaveChat

func (client *Client) LeaveChat(chatID PeerID) *LeaveChatCall

LeaveChat constructs a new LeaveChatCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername). Channel direct messages chats aren't supported; leave the corresponding channel instead.

func (*Client) LogOut

func (client *Client) LogOut() *LogOutCall

LogOut constructs a new LogOutCall.

func (*Client) Me

func (client *Client) Me(ctx context.Context) (User, error)

Me returns cached current bot info.

func (*Client) PinChatMessage

func (client *Client) PinChatMessage(chatID PeerID, messageID int) *PinChatMessageCall

PinChatMessage constructs a new PinChatMessageCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • messageID: Identifier of a message to pin

func (*Client) PostStory added in v0.16.0

func (client *Client) PostStory(businessConnectionID string, content InputStoryContentClass, activePeriod int) *PostStoryCall

PostStory constructs a new PostStoryCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection
  • content: Content of the story
  • activePeriod: Period after which the story is moved to the archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400

func (*Client) PromoteChatMember

func (client *Client) PromoteChatMember(chatID PeerID, userID UserID) *PromoteChatMemberCall

PromoteChatMember constructs a new PromoteChatMemberCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • userID: Unique identifier of the target user

func (*Client) ReadBusinessMessage added in v0.16.0

func (client *Client) ReadBusinessMessage(businessConnectionID string, chatID int, messageID int) *ReadBusinessMessageCall

ReadBusinessMessage constructs a new ReadBusinessMessageCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection on behalf of which to read the message
  • chatID: Unique identifier of the chat in which the message was received. The chat must have been active in the last 24 hours.
  • messageID: Unique identifier of the message to mark as read

func (*Client) RefundStarPayment added in v0.16.0

func (client *Client) RefundStarPayment(userID UserID, telegramPaymentChargeID string) *RefundStarPaymentCall

RefundStarPayment constructs a new RefundStarPaymentCall.

Required params:

  • userID: Identifier of the user whose payment will be refunded
  • telegramPaymentChargeID: Telegram payment identifier

func (*Client) RemoveBusinessAccountProfilePhoto added in v0.16.0

func (client *Client) RemoveBusinessAccountProfilePhoto(businessConnectionID string) *RemoveBusinessAccountProfilePhotoCall

RemoveBusinessAccountProfilePhoto constructs a new RemoveBusinessAccountProfilePhotoCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection

func (*Client) RemoveChatVerification added in v0.16.0

func (client *Client) RemoveChatVerification(chatID PeerID) *RemoveChatVerificationCall

RemoveChatVerification constructs a new RemoveChatVerificationCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*Client) RemoveMyProfilePhoto added in v0.18.0

func (client *Client) RemoveMyProfilePhoto() *RemoveMyProfilePhotoCall

RemoveMyProfilePhoto constructs a new RemoveMyProfilePhotoCall.

func (*Client) RemoveUserVerification added in v0.16.0

func (client *Client) RemoveUserVerification(userID UserID) *RemoveUserVerificationCall

RemoveUserVerification constructs a new RemoveUserVerificationCall.

Required params:

  • userID: Unique identifier of the target user

func (*Client) ReopenForumTopic added in v0.6.0

func (client *Client) ReopenForumTopic(chatID PeerID, messageThreadID int) *ReopenForumTopicCall

ReopenForumTopic constructs a new ReopenForumTopicCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
  • messageThreadID: Unique identifier for the target message thread of the forum topic

func (*Client) ReopenGeneralForumTopic added in v0.6.0

func (client *Client) ReopenGeneralForumTopic(chatID PeerID) *ReopenGeneralForumTopicCall

ReopenGeneralForumTopic constructs a new ReopenGeneralForumTopicCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

func (*Client) ReplaceStickerInSet added in v0.15.0

func (client *Client) ReplaceStickerInSet(userID UserID, name string, oldSticker string, sticker InputSticker) *ReplaceStickerInSetCall

ReplaceStickerInSet constructs a new ReplaceStickerInSetCall.

Required params:

  • userID: User identifier of the sticker set owner
  • name: Sticker set name
  • oldSticker: File identifier of the replaced sticker
  • sticker: A JSON-serialized object with information about the added sticker. If exactly the same sticker had already been added to the set, then the set remains unchanged.

func (*Client) RepostStory added in v0.16.0

func (client *Client) RepostStory(businessConnectionID string, fromChatID int, fromStoryID int, activePeriod int) *RepostStoryCall

RepostStory constructs a new RepostStoryCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection
  • fromChatID: Unique identifier of the chat which posted the story that should be reposted
  • fromStoryID: Unique identifier of the story that should be reposted
  • activePeriod: Period after which the story is moved to the archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400

func (*Client) RestrictChatMember

func (client *Client) RestrictChatMember(chatID PeerID, userID UserID, permissions ChatPermissions) *RestrictChatMemberCall

RestrictChatMember constructs a new RestrictChatMemberCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
  • userID: Unique identifier of the target user
  • permissions: A JSON-serialized object for new user permissions
func (client *Client) RevokeChatInviteLink(chatID PeerID, inviteLink string) *RevokeChatInviteLinkCall

RevokeChatInviteLink constructs a new RevokeChatInviteLinkCall.

Required params:

  • chatID: Unique identifier of the target chat or username of the target channel (in the format @channelusername)
  • inviteLink: The invite link to revoke

func (*Client) SavePreparedInlineMessage added in v0.16.0

func (client *Client) SavePreparedInlineMessage(userID UserID, result InlineQueryResultClass) *SavePreparedInlineMessageCall

SavePreparedInlineMessage constructs a new SavePreparedInlineMessageCall.

Required params:

  • userID: Unique identifier of the target user that can use the prepared message
  • result: A JSON-serialized object describing the message to be sent

func (*Client) SendAnimation

func (client *Client) SendAnimation(chatID PeerID, animation FileArg) *SendAnimationCall

SendAnimation constructs a new SendAnimationCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • animation: Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the Internet, or upload a new animation using multipart/form-data. More information on Sending Files »

func (*Client) SendAudio

func (client *Client) SendAudio(chatID PeerID, audio FileArg) *SendAudioCall

SendAudio constructs a new SendAudioCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • audio: Audio file to send. Pass a file_id as String to send an audio file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files »

func (*Client) SendChatAction

func (client *Client) SendChatAction(chatID PeerID, action ChatAction) *SendChatActionCall

SendChatAction constructs a new SendChatActionCall.

Required params:

func (*Client) SendChecklist added in v0.16.0

func (client *Client) SendChecklist(businessConnectionID string, chatID int, checklist InputChecklist) *SendChecklistCall

SendChecklist constructs a new SendChecklistCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection on behalf of which the message will be sent
  • chatID: Unique identifier for the target chat
  • checklist: A JSON-serialized object for the checklist to send

func (*Client) SendContact

func (client *Client) SendContact(chatID PeerID, phoneNumber string, firstName string) *SendContactCall

SendContact constructs a new SendContactCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • phoneNumber: Contact's phone number
  • firstName: Contact's first name

func (*Client) SendDice

func (client *Client) SendDice(chatID PeerID) *SendDiceCall

SendDice constructs a new SendDiceCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*Client) SendDocument

func (client *Client) SendDocument(chatID PeerID, document FileArg) *SendDocumentCall

SendDocument constructs a new SendDocumentCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • document: File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files »

func (*Client) SendGame

func (client *Client) SendGame(chatID int, gameShortName string) *SendGameCall

SendGame constructs a new SendGameCall.

Required params:

  • chatID: Unique identifier for the target chat. Games can't be sent to channel direct messages chats and channel chats.
  • gameShortName: Short name of the game, serves as the unique identifier for the game. Set up your games via @BotFather.

func (*Client) SendGift added in v0.16.0

func (client *Client) SendGift(giftID string) *SendGiftCall

SendGift constructs a new SendGiftCall.

Required params:

  • giftID: Identifier of the gift; limited gifts can't be sent to channel chats

func (*Client) SendInvoice

func (client *Client) SendInvoice(chatID PeerID, title string, description string, payload string, currency string, prices []LabeledPrice) *SendInvoiceCall

SendInvoice constructs a new SendInvoiceCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • title: Product name, 1-32 characters
  • description: Product description, 1-255 characters
  • payload: Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes.
  • currency: Three-letter ISO 4217 currency code, see more on currencies. Pass “XTR” for payments in Telegram Stars.
  • prices: Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars.

func (*Client) SendLocation

func (client *Client) SendLocation(chatID PeerID, latitude float64, longitude float64) *SendLocationCall

SendLocation constructs a new SendLocationCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • latitude: Latitude of the location
  • longitude: Longitude of the location

func (*Client) SendMediaGroup added in v0.0.5

func (client *Client) SendMediaGroup(chatID PeerID, media []InputMedia) *SendMediaGroupCall

SendMediaGroup constructs a new SendMediaGroupCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • media: A JSON-serialized array describing messages to be sent, must include 2-10 items

func (*Client) SendMessage

func (client *Client) SendMessage(chatID PeerID, text string) *SendMessageCall

SendMessage constructs a new SendMessageCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • text: Text of the message to be sent, 1-4096 characters after entities parsing

func (*Client) SendMessageDraft added in v0.16.0

func (client *Client) SendMessageDraft(chatID int, draftID int, text string) *SendMessageDraftCall

SendMessageDraft constructs a new SendMessageDraftCall.

Required params:

  • chatID: Unique identifier for the target private chat
  • draftID: Unique identifier of the message draft; must be non-zero. Changes of drafts with the same identifier are animated
  • text: Text of the message to be sent, 1-4096 characters after entities parsing

func (*Client) SendPaidMedia added in v0.16.0

func (client *Client) SendPaidMedia(chatID PeerID, starCount int, media []InputPaidMedia) *SendPaidMediaCall

SendPaidMedia constructs a new SendPaidMediaCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername). If the chat is a channel, all Telegram Star proceeds from this media will be credited to the chat's balance. Otherwise, they will be credited to the bot's balance.
  • starCount: The number of Telegram Stars that must be paid to buy access to the media; 1-25000
  • media: A JSON-serialized array describing the media to be sent; up to 10 items

func (*Client) SendPhoto

func (client *Client) SendPhoto(chatID PeerID, photo FileArg) *SendPhotoCall

SendPhoto constructs a new SendPhotoCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • photo: Photo to send. Pass a file_id as String to send a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, or upload a new photo using multipart/form-data. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20. More information on Sending Files »

func (*Client) SendPoll

func (client *Client) SendPoll(chatID PeerID, question string, options []InputPollOption) *SendPollCall

SendPoll constructs a new SendPollCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername). Polls can't be sent to channel direct messages chats.
  • question: Poll question, 1-300 characters
  • options: A JSON-serialized list of 2-12 answer options

func (*Client) SendSticker

func (client *Client) SendSticker(chatID PeerID, sticker FileArg) *SendStickerCall

SendSticker constructs a new SendStickerCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • sticker: Sticker to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a .WEBP sticker from the Internet, or upload a new .WEBP, .TGS, or .WEBM sticker using multipart/form-data. More information on Sending Files ». Video and animated stickers can't be sent via an HTTP URL.

func (*Client) SendVenue

func (client *Client) SendVenue(chatID PeerID, latitude float64, longitude float64, title string, address string) *SendVenueCall

SendVenue constructs a new SendVenueCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • latitude: Latitude of the venue
  • longitude: Longitude of the venue
  • title: Name of the venue
  • address: Address of the venue

func (*Client) SendVideo

func (client *Client) SendVideo(chatID PeerID, video FileArg) *SendVideoCall

SendVideo constructs a new SendVideoCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • video: Video to send. Pass a file_id as String to send a video that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a video from the Internet, or upload a new video using multipart/form-data. More information on Sending Files »

func (*Client) SendVideoNote

func (client *Client) SendVideoNote(chatID PeerID, videoNote FileArg) *SendVideoNoteCall

SendVideoNote constructs a new SendVideoNoteCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • videoNote: Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data. More information on Sending Files ». Sending video notes by a URL is currently unsupported

func (*Client) SendVoice

func (client *Client) SendVoice(chatID PeerID, voice FileArg) *SendVoiceCall

SendVoice constructs a new SendVoiceCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • voice: Audio file to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files »

func (*Client) SetBusinessAccountBio added in v0.16.0

func (client *Client) SetBusinessAccountBio(businessConnectionID string) *SetBusinessAccountBioCall

SetBusinessAccountBio constructs a new SetBusinessAccountBioCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection

func (*Client) SetBusinessAccountGiftSettings added in v0.16.0

func (client *Client) SetBusinessAccountGiftSettings(businessConnectionID string, showGiftButton bool, acceptedGiftTypes AcceptedGiftTypes) *SetBusinessAccountGiftSettingsCall

SetBusinessAccountGiftSettings constructs a new SetBusinessAccountGiftSettingsCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection
  • showGiftButton: Pass True, if a button for sending a gift to the user or by the business account must always be shown in the input field
  • acceptedGiftTypes: Types of gifts accepted by the business account

func (*Client) SetBusinessAccountName added in v0.16.0

func (client *Client) SetBusinessAccountName(businessConnectionID string, firstName string) *SetBusinessAccountNameCall

SetBusinessAccountName constructs a new SetBusinessAccountNameCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection
  • firstName: The new value of the first name for the business account; 1-64 characters

func (*Client) SetBusinessAccountProfilePhoto added in v0.16.0

func (client *Client) SetBusinessAccountProfilePhoto(businessConnectionID string, photo InputProfilePhotoClass) *SetBusinessAccountProfilePhotoCall

SetBusinessAccountProfilePhoto constructs a new SetBusinessAccountProfilePhotoCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection
  • photo: The new profile photo to set

func (*Client) SetBusinessAccountUsername added in v0.16.0

func (client *Client) SetBusinessAccountUsername(businessConnectionID string) *SetBusinessAccountUsernameCall

SetBusinessAccountUsername constructs a new SetBusinessAccountUsernameCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection

func (*Client) SetChatAdministratorCustomTitle

func (client *Client) SetChatAdministratorCustomTitle(chatID PeerID, userID UserID, customTitle string) *SetChatAdministratorCustomTitleCall

SetChatAdministratorCustomTitle constructs a new SetChatAdministratorCustomTitleCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
  • userID: Unique identifier of the target user
  • customTitle: New custom title for the administrator; 0-16 characters, emoji are not allowed

func (*Client) SetChatDescription

func (client *Client) SetChatDescription(chatID PeerID) *SetChatDescriptionCall

SetChatDescription constructs a new SetChatDescriptionCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*Client) SetChatMenuButton

func (client *Client) SetChatMenuButton() *SetChatMenuButtonCall

SetChatMenuButton constructs a new SetChatMenuButtonCall.

func (*Client) SetChatPermissions

func (client *Client) SetChatPermissions(chatID PeerID, permissions ChatPermissions) *SetChatPermissionsCall

SetChatPermissions constructs a new SetChatPermissionsCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
  • permissions: A JSON-serialized object for new default chat permissions

func (*Client) SetChatPhoto

func (client *Client) SetChatPhoto(chatID PeerID, photo InputFile) *SetChatPhotoCall

SetChatPhoto constructs a new SetChatPhotoCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • photo: New chat photo, uploaded using multipart/form-data

func (*Client) SetChatStickerSet

func (client *Client) SetChatStickerSet(chatID PeerID, stickerSetName string) *SetChatStickerSetCall

SetChatStickerSet constructs a new SetChatStickerSetCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
  • stickerSetName: Name of the sticker set to be set as the group sticker set

func (*Client) SetChatTitle

func (client *Client) SetChatTitle(chatID PeerID, title string) *SetChatTitleCall

SetChatTitle constructs a new SetChatTitleCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • title: New chat title, 1-128 characters

func (*Client) SetCustomEmojiStickerSetThumbnail added in v0.8.0

func (client *Client) SetCustomEmojiStickerSetThumbnail(name string) *SetCustomEmojiStickerSetThumbnailCall

SetCustomEmojiStickerSetThumbnail constructs a new SetCustomEmojiStickerSetThumbnailCall.

Required params:

  • name: Sticker set name

func (*Client) SetGameScore

func (client *Client) SetGameScore(userID UserID, score int) *SetGameScoreCall

SetGameScore constructs a new SetGameScoreCall.

Required params:

  • userID: User identifier
  • score: New score, must be non-negative

func (*Client) SetMessageReaction added in v0.12.0

func (client *Client) SetMessageReaction(chatID PeerID, messageID int) *SetMessageReactionCall

SetMessageReaction constructs a new SetMessageReactionCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • messageID: Identifier of the target message. If the message belongs to a media group, the reaction is set to the first non-deleted message in the group instead.

func (*Client) SetMyCommands

func (client *Client) SetMyCommands(commands []BotCommand) *SetMyCommandsCall

SetMyCommands constructs a new SetMyCommandsCall.

Required params:

  • commands: A JSON-serialized list of bot commands to be set as the list of the bot's commands. At most 100 commands can be specified.

func (*Client) SetMyDefaultAdministratorRights

func (client *Client) SetMyDefaultAdministratorRights() *SetMyDefaultAdministratorRightsCall

SetMyDefaultAdministratorRights constructs a new SetMyDefaultAdministratorRightsCall.

func (*Client) SetMyDescription added in v0.8.0

func (client *Client) SetMyDescription() *SetMyDescriptionCall

SetMyDescription constructs a new SetMyDescriptionCall.

func (*Client) SetMyName added in v0.9.0

func (client *Client) SetMyName() *SetMyNameCall

SetMyName constructs a new SetMyNameCall.

func (*Client) SetMyProfilePhoto added in v0.18.0

func (client *Client) SetMyProfilePhoto(photo InputProfilePhotoClass) *SetMyProfilePhotoCall

SetMyProfilePhoto constructs a new SetMyProfilePhotoCall.

Required params:

  • photo: The new profile photo to set

func (*Client) SetMyShortDescription added in v0.8.0

func (client *Client) SetMyShortDescription() *SetMyShortDescriptionCall

SetMyShortDescription constructs a new SetMyShortDescriptionCall.

func (*Client) SetPassportDataErrors

func (client *Client) SetPassportDataErrors(userID UserID, errors []PassportElementError) *SetPassportDataErrorsCall

SetPassportDataErrors constructs a new SetPassportDataErrorsCall.

Required params:

  • userID: User identifier
  • errors: A JSON-serialized array describing the errors

func (*Client) SetStickerEmojiList added in v0.8.0

func (client *Client) SetStickerEmojiList(sticker string, emojiList []string) *SetStickerEmojiListCall

SetStickerEmojiList constructs a new SetStickerEmojiListCall.

Required params:

  • sticker: File identifier of the sticker
  • emojiList: A JSON-serialized list of 1-20 emoji associated with the sticker

func (*Client) SetStickerKeywords added in v0.8.0

func (client *Client) SetStickerKeywords(sticker string) *SetStickerKeywordsCall

SetStickerKeywords constructs a new SetStickerKeywordsCall.

Required params:

  • sticker: File identifier of the sticker

func (*Client) SetStickerMaskPosition added in v0.8.0

func (client *Client) SetStickerMaskPosition(sticker string) *SetStickerMaskPositionCall

SetStickerMaskPosition constructs a new SetStickerMaskPositionCall.

Required params:

  • sticker: File identifier of the sticker

func (*Client) SetStickerPositionInSet

func (client *Client) SetStickerPositionInSet(sticker string, position int) *SetStickerPositionInSetCall

SetStickerPositionInSet constructs a new SetStickerPositionInSetCall.

Required params:

  • sticker: File identifier of the sticker
  • position: New sticker position in the set, zero-based

func (*Client) SetStickerSetThumbnail added in v0.8.0

func (client *Client) SetStickerSetThumbnail(name string, userID UserID, format string) *SetStickerSetThumbnailCall

SetStickerSetThumbnail constructs a new SetStickerSetThumbnailCall.

Required params:

  • name: Sticker set name
  • userID: User identifier of the sticker set owner
  • format: Format of the thumbnail, must be one of “static” for a .WEBP or .PNG image, “animated” for a .TGS animation, or “video” for a .WEBM video

func (*Client) SetStickerSetTitle added in v0.8.0

func (client *Client) SetStickerSetTitle(name string, title string) *SetStickerSetTitleCall

SetStickerSetTitle constructs a new SetStickerSetTitleCall.

Required params:

  • name: Sticker set name
  • title: Sticker set title, 1-64 characters

func (*Client) SetUserEmojiStatus added in v0.16.0

func (client *Client) SetUserEmojiStatus(userID UserID) *SetUserEmojiStatusCall

SetUserEmojiStatus constructs a new SetUserEmojiStatusCall.

Required params:

  • userID: Unique identifier of the target user

func (*Client) SetWebhook

func (client *Client) SetWebhook(url string) *SetWebhookCall

SetWebhook constructs a new SetWebhookCall.

Required params:

  • url: HTTPS URL to send updates to. Use an empty string to remove webhook integration

func (*Client) StopMessageLiveLocation

func (client *Client) StopMessageLiveLocation(chatID PeerID, messageID int) *StopMessageLiveLocationCall

StopMessageLiveLocation constructs a new StopMessageLiveLocationCall.

Required params:

  • chatID: Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • messageID: Required if inline_message_id is not specified. Identifier of the message with live location to stop

func (*Client) StopMessageLiveLocationInline

func (client *Client) StopMessageLiveLocationInline(inlineMessageID string) *StopMessageLiveLocationCall

StopMessageLiveLocationInline constructs a new StopMessageLiveLocationCall.

Required params:

  • inlineMessageID: Required if chat_id and message_id are not specified. Identifier of the inline message

func (*Client) StopPoll

func (client *Client) StopPoll(chatID PeerID, messageID int) *StopPollCall

StopPoll constructs a new StopPollCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • messageID: Identifier of the original message with the poll

func (*Client) Token

func (client *Client) Token() string

func (*Client) TransferBusinessAccountStars added in v0.16.0

func (client *Client) TransferBusinessAccountStars(businessConnectionID string, starCount int) *TransferBusinessAccountStarsCall

TransferBusinessAccountStars constructs a new TransferBusinessAccountStarsCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection
  • starCount: Number of Telegram Stars to transfer; 1-10000

func (*Client) TransferGift added in v0.16.0

func (client *Client) TransferGift(businessConnectionID string, ownedGiftID string, newOwnerChatID int) *TransferGiftCall

TransferGift constructs a new TransferGiftCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection
  • ownedGiftID: Unique identifier of the regular gift that should be transferred
  • newOwnerChatID: Unique identifier of the chat which will own the gift. The chat must be active in the last 24 hours.

func (*Client) UnbanChatMember

func (client *Client) UnbanChatMember(chatID PeerID, userID UserID) *UnbanChatMemberCall

UnbanChatMember constructs a new UnbanChatMemberCall.

Required params:

  • chatID: Unique identifier for the target group or username of the target supergroup or channel (in the format @channelusername)
  • userID: Unique identifier of the target user

func (*Client) UnbanChatSenderChat

func (client *Client) UnbanChatSenderChat(chatID PeerID, senderChatID int) *UnbanChatSenderChatCall

UnbanChatSenderChat constructs a new UnbanChatSenderChatCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • senderChatID: Unique identifier of the target sender chat

func (*Client) UnhideGeneralForumTopic added in v0.6.0

func (client *Client) UnhideGeneralForumTopic(chatID PeerID) *UnhideGeneralForumTopicCall

UnhideGeneralForumTopic constructs a new UnhideGeneralForumTopicCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

func (*Client) UnpinAllChatMessages

func (client *Client) UnpinAllChatMessages(chatID PeerID) *UnpinAllChatMessagesCall

UnpinAllChatMessages constructs a new UnpinAllChatMessagesCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*Client) UnpinAllForumTopicMessages added in v0.6.0

func (client *Client) UnpinAllForumTopicMessages(chatID PeerID, messageThreadID int) *UnpinAllForumTopicMessagesCall

UnpinAllForumTopicMessages constructs a new UnpinAllForumTopicMessagesCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
  • messageThreadID: Unique identifier for the target message thread of the forum topic

func (*Client) UnpinAllGeneralForumTopicMessages added in v0.10.0

func (client *Client) UnpinAllGeneralForumTopicMessages(chatID PeerID) *UnpinAllGeneralForumTopicMessagesCall

UnpinAllGeneralForumTopicMessages constructs a new UnpinAllGeneralForumTopicMessagesCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

func (*Client) UnpinChatMessage

func (client *Client) UnpinChatMessage(chatID PeerID) *UnpinChatMessageCall

UnpinChatMessage constructs a new UnpinChatMessageCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*Client) UpgradeGift added in v0.16.0

func (client *Client) UpgradeGift(businessConnectionID string, ownedGiftID string) *UpgradeGiftCall

UpgradeGift constructs a new UpgradeGiftCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection
  • ownedGiftID: Unique identifier of the regular gift that should be upgraded to a unique one

func (*Client) UploadStickerFile

func (client *Client) UploadStickerFile(userID UserID, sticker InputFile, stickerFormat string) *UploadStickerFileCall

UploadStickerFile constructs a new UploadStickerFileCall.

Required params:

func (*Client) VerifyChat added in v0.16.0

func (client *Client) VerifyChat(chatID PeerID) *VerifyChatCall

VerifyChat constructs a new VerifyChatCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername). Channel direct messages chats can't be verified.

func (*Client) VerifyUser added in v0.16.0

func (client *Client) VerifyUser(userID UserID) *VerifyUserCall

VerifyUser constructs a new VerifyUserCall.

Required params:

  • userID: Unique identifier of the target user

type ClientOption

type ClientOption func(*Client)

ClientOption is a function that sets some option for Client.

func WithClientDoer added in v0.0.5

func WithClientDoer(doer Doer) ClientOption

WithClientDoer sets custom http client for Client.

func WithClientInterceptors added in v0.13.0

func WithClientInterceptors(ints ...Interceptor) ClientOption

WithClientInterceptor adds interceptor to client.

func WithClientServerURL added in v0.0.6

func WithClientServerURL(server string) ClientOption

WithClientServerURL sets custom server url for Client.

func WithClientTestEnv added in v0.1.0

func WithClientTestEnv() ClientOption

WithClientTestEnv switches bot to test environment. See https://core.telegram.org/bots/webapps#using-bots-in-the-test-environment

type CloseCall

type CloseCall struct {
	CallNoResult
}

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

func NewCloseCall

func NewCloseCall() *CloseCall

NewCloseCall constructs a new CloseCall.

type CloseForumTopicCall added in v0.6.0

type CloseForumTopicCall struct {
	CallNoResult
}

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

func NewCloseForumTopicCall added in v0.6.0

func NewCloseForumTopicCall(chatID PeerID, messageThreadID int) *CloseForumTopicCall

NewCloseForumTopicCall constructs a new CloseForumTopicCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
  • messageThreadID: Unique identifier for the target message thread of the forum topic

func (*CloseForumTopicCall) ChatID added in v0.6.0

func (call *CloseForumTopicCall) ChatID(chatID PeerID) *CloseForumTopicCall

ChatID sets the chat_id parameter.

func (*CloseForumTopicCall) MessageThreadID added in v0.6.0

func (call *CloseForumTopicCall) MessageThreadID(messageThreadID int) *CloseForumTopicCall

MessageThreadID sets the message_thread_id parameter.

type CloseGeneralForumTopicCall added in v0.6.0

type CloseGeneralForumTopicCall struct {
	CallNoResult
}

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

func NewCloseGeneralForumTopicCall added in v0.6.0

func NewCloseGeneralForumTopicCall(chatID PeerID) *CloseGeneralForumTopicCall

NewCloseGeneralForumTopicCall constructs a new CloseGeneralForumTopicCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

func (*CloseGeneralForumTopicCall) ChatID added in v0.6.0

ChatID sets the chat_id parameter.

type Contact

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

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

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

	// Optional. Contact's user identifier in Telegram. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier.
	UserID UserID `json:"user_id,omitempty"`

	// Optional. Additional data about the contact in the form of a [vCard]
	//
	// [vCard]: https://en.wikipedia.org/wiki/VCard
	VCard string `json:"vcard,omitempty"`
}

Contact this object represents a phone contact.

type ConvertGiftToStarsCall added in v0.16.0

type ConvertGiftToStarsCall struct {
	CallNoResult
}

ConvertGiftToStarsCall represents a call to the convertGiftToStars method. Converts a given regular gift to Telegram Stars. Requires the can_convert_gifts_to_stars business bot right. Returns True on success.

func NewConvertGiftToStarsCall added in v0.16.0

func NewConvertGiftToStarsCall(businessConnectionID string, ownedGiftID string) *ConvertGiftToStarsCall

NewConvertGiftToStarsCall constructs a new ConvertGiftToStarsCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection
  • ownedGiftID: Unique identifier of the regular gift that should be converted to Telegram Stars

func (*ConvertGiftToStarsCall) BusinessConnectionID added in v0.16.0

func (call *ConvertGiftToStarsCall) BusinessConnectionID(businessConnectionID string) *ConvertGiftToStarsCall

BusinessConnectionID sets the business_connection_id parameter.

func (*ConvertGiftToStarsCall) OwnedGiftID added in v0.16.0

func (call *ConvertGiftToStarsCall) OwnedGiftID(ownedGiftID string) *ConvertGiftToStarsCall

OwnedGiftID sets the owned_gift_id parameter.

type CopyMessageCall

type CopyMessageCall struct {
	Call[MessageID]
}

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

func NewCopyMessageCall

func NewCopyMessageCall(chatID PeerID, fromChatID PeerID, messageID int) *CopyMessageCall

NewCopyMessageCall constructs a new CopyMessageCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • fromChatID: Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)
  • messageID: Message identifier in the chat specified in from_chat_id

func (*CopyMessageCall) AllowPaidBroadcast added in v0.16.0

func (call *CopyMessageCall) AllowPaidBroadcast(allowPaidBroadcast bool) *CopyMessageCall

AllowPaidBroadcast sets the allow_paid_broadcast parameter.

func (*CopyMessageCall) Caption

func (call *CopyMessageCall) Caption(caption string) *CopyMessageCall

Caption sets the caption parameter.

func (*CopyMessageCall) CaptionEntities

func (call *CopyMessageCall) CaptionEntities(captionEntities []MessageEntity) *CopyMessageCall

CaptionEntities sets the caption_entities parameter.

func (*CopyMessageCall) ChatID added in v0.0.5

func (call *CopyMessageCall) ChatID(chatID PeerID) *CopyMessageCall

ChatID sets the chat_id parameter.

func (*CopyMessageCall) DirectMessagesTopicID added in v0.16.0

func (call *CopyMessageCall) DirectMessagesTopicID(directMessagesTopicID int) *CopyMessageCall

DirectMessagesTopicID sets the direct_messages_topic_id parameter.

func (*CopyMessageCall) DisableNotification

func (call *CopyMessageCall) DisableNotification(disableNotification bool) *CopyMessageCall

DisableNotification sets the disable_notification parameter.

func (*CopyMessageCall) FromChatID added in v0.0.5

func (call *CopyMessageCall) FromChatID(fromChatID PeerID) *CopyMessageCall

FromChatID sets the from_chat_id parameter.

func (*CopyMessageCall) MessageEffectID added in v0.16.0

func (call *CopyMessageCall) MessageEffectID(messageEffectID string) *CopyMessageCall

MessageEffectID sets the message_effect_id parameter.

func (*CopyMessageCall) MessageID added in v0.0.5

func (call *CopyMessageCall) MessageID(messageID int) *CopyMessageCall

MessageID sets the message_id parameter.

func (*CopyMessageCall) MessageThreadID added in v0.6.0

func (call *CopyMessageCall) MessageThreadID(messageThreadID int) *CopyMessageCall

MessageThreadID sets the message_thread_id parameter.

func (*CopyMessageCall) ParseMode

func (call *CopyMessageCall) ParseMode(parseMode ParseMode) *CopyMessageCall

ParseMode sets the parse_mode parameter.

func (*CopyMessageCall) ProtectContent

func (call *CopyMessageCall) ProtectContent(protectContent bool) *CopyMessageCall

ProtectContent sets the protect_content parameter.

func (*CopyMessageCall) ReplyMarkup

func (call *CopyMessageCall) ReplyMarkup(replyMarkup ReplyMarkup) *CopyMessageCall

ReplyMarkup sets the reply_markup parameter.

func (*CopyMessageCall) ReplyParameters added in v0.12.0

func (call *CopyMessageCall) ReplyParameters(replyParameters ReplyParameters) *CopyMessageCall

ReplyParameters sets the reply_parameters parameter.

func (*CopyMessageCall) ShowCaptionAboveMedia added in v0.16.0

func (call *CopyMessageCall) ShowCaptionAboveMedia(showCaptionAboveMedia bool) *CopyMessageCall

ShowCaptionAboveMedia sets the show_caption_above_media parameter.

func (*CopyMessageCall) SuggestedPostParameters added in v0.16.0

func (call *CopyMessageCall) SuggestedPostParameters(suggestedPostParameters SuggestedPostParameters) *CopyMessageCall

SuggestedPostParameters sets the suggested_post_parameters parameter.

func (*CopyMessageCall) VideoStartTimestamp added in v0.16.0

func (call *CopyMessageCall) VideoStartTimestamp(videoStartTimestamp int) *CopyMessageCall

VideoStartTimestamp sets the video_start_timestamp parameter.

type CopyMessagesCall added in v0.12.0

type CopyMessagesCall struct {
	Call[[]MessageID]
}

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

func NewCopyMessagesCall added in v0.12.0

func NewCopyMessagesCall(chatID PeerID, fromChatID PeerID, messageIDs []int) *CopyMessagesCall

NewCopyMessagesCall constructs a new CopyMessagesCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • fromChatID: Unique identifier for the chat where the original messages were sent (or channel username in the format @channelusername)
  • messageIDs: A JSON-serialized list of 1-100 identifiers of messages in the chat from_chat_id to copy. The identifiers must be specified in a strictly increasing order.

func (*CopyMessagesCall) ChatID added in v0.12.0

func (call *CopyMessagesCall) ChatID(chatID PeerID) *CopyMessagesCall

ChatID sets the chat_id parameter.

func (*CopyMessagesCall) DirectMessagesTopicID added in v0.16.0

func (call *CopyMessagesCall) DirectMessagesTopicID(directMessagesTopicID int) *CopyMessagesCall

DirectMessagesTopicID sets the direct_messages_topic_id parameter.

func (*CopyMessagesCall) DisableNotification added in v0.12.0

func (call *CopyMessagesCall) DisableNotification(disableNotification bool) *CopyMessagesCall

DisableNotification sets the disable_notification parameter.

func (*CopyMessagesCall) FromChatID added in v0.12.0

func (call *CopyMessagesCall) FromChatID(fromChatID PeerID) *CopyMessagesCall

FromChatID sets the from_chat_id parameter.

func (*CopyMessagesCall) MessageIDs added in v0.16.0

func (call *CopyMessagesCall) MessageIDs(messageIDs []int) *CopyMessagesCall

MessageIDs sets the message_ids parameter.

func (*CopyMessagesCall) MessageThreadID added in v0.12.0

func (call *CopyMessagesCall) MessageThreadID(messageThreadID int) *CopyMessagesCall

MessageThreadID sets the message_thread_id parameter.

func (*CopyMessagesCall) ProtectContent added in v0.12.0

func (call *CopyMessagesCall) ProtectContent(protectContent bool) *CopyMessagesCall

ProtectContent sets the protect_content parameter.

func (*CopyMessagesCall) RemoveCaption added in v0.12.0

func (call *CopyMessagesCall) RemoveCaption(removeCaption bool) *CopyMessagesCall

RemoveCaption sets the remove_caption parameter.

type CopyTextButton added in v0.16.0

type CopyTextButton struct {
	// The text to be copied to the clipboard; 1-256 characters
	Text string `json:"text"`
}

CopyTextButton this object represents an inline keyboard button that copies specified text to the clipboard.

type CreateChatInviteLinkCall

type CreateChatInviteLinkCall struct {
	Call[ChatInviteLink]
}

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

func NewCreateChatInviteLinkCall

func NewCreateChatInviteLinkCall(chatID PeerID) *CreateChatInviteLinkCall

NewCreateChatInviteLinkCall constructs a new CreateChatInviteLinkCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*CreateChatInviteLinkCall) ChatID added in v0.0.5

ChatID sets the chat_id parameter.

func (*CreateChatInviteLinkCall) CreatesJoinRequest

func (call *CreateChatInviteLinkCall) CreatesJoinRequest(createsJoinRequest bool) *CreateChatInviteLinkCall

CreatesJoinRequest sets the creates_join_request parameter.

func (*CreateChatInviteLinkCall) ExpireDate

func (call *CreateChatInviteLinkCall) ExpireDate(expireDate int) *CreateChatInviteLinkCall

ExpireDate sets the expire_date parameter.

func (*CreateChatInviteLinkCall) MemberLimit

func (call *CreateChatInviteLinkCall) MemberLimit(memberLimit int) *CreateChatInviteLinkCall

MemberLimit sets the member_limit parameter.

func (*CreateChatInviteLinkCall) Name

Name sets the name parameter.

type CreateChatSubscriptionInviteLinkCall added in v0.16.0

type CreateChatSubscriptionInviteLinkCall struct {
	Call[ChatInviteLink]
}

CreateChatSubscriptionInviteLinkCall represents a call to the createChatSubscriptionInviteLink method. Use this method to create a subscription invite link for a channel chat. The bot must have the can_invite_users administrator rights. The link can be edited using the method Client.EditChatSubscriptionInviteLink or revoked using the method Client.RevokeChatInviteLink. Returns the new invite link as a ChatInviteLink object.

func NewCreateChatSubscriptionInviteLinkCall added in v0.16.0

func NewCreateChatSubscriptionInviteLinkCall(chatID PeerID, subscriptionPeriod int, subscriptionPrice int) *CreateChatSubscriptionInviteLinkCall

NewCreateChatSubscriptionInviteLinkCall constructs a new CreateChatSubscriptionInviteLinkCall.

Required params:

  • chatID: Unique identifier for the target channel chat or username of the target channel (in the format @channelusername)
  • subscriptionPeriod: The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days).
  • subscriptionPrice: The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat; 1-10000

func (*CreateChatSubscriptionInviteLinkCall) ChatID added in v0.16.0

ChatID sets the chat_id parameter.

func (*CreateChatSubscriptionInviteLinkCall) Name added in v0.16.0

Name sets the name parameter.

func (*CreateChatSubscriptionInviteLinkCall) SubscriptionPeriod added in v0.16.0

func (call *CreateChatSubscriptionInviteLinkCall) SubscriptionPeriod(subscriptionPeriod int) *CreateChatSubscriptionInviteLinkCall

SubscriptionPeriod sets the subscription_period parameter.

func (*CreateChatSubscriptionInviteLinkCall) SubscriptionPrice added in v0.16.0

func (call *CreateChatSubscriptionInviteLinkCall) SubscriptionPrice(subscriptionPrice int) *CreateChatSubscriptionInviteLinkCall

SubscriptionPrice sets the subscription_price parameter.

type CreateForumTopicCall added in v0.6.0

type CreateForumTopicCall struct {
	Call[ForumTopic]
}

CreateForumTopicCall represents a call to the createForumTopic method. Use this method to create a topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator right. Returns information about the created topic as a ForumTopic object.

func NewCreateForumTopicCall added in v0.6.0

func NewCreateForumTopicCall(chatID PeerID, name string) *CreateForumTopicCall

NewCreateForumTopicCall constructs a new CreateForumTopicCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
  • name: Topic name, 1-128 characters

func (*CreateForumTopicCall) ChatID added in v0.6.0

func (call *CreateForumTopicCall) ChatID(chatID PeerID) *CreateForumTopicCall

ChatID sets the chat_id parameter.

func (*CreateForumTopicCall) IconColor added in v0.6.0

func (call *CreateForumTopicCall) IconColor(iconColor TopicIconColor) *CreateForumTopicCall

IconColor sets the icon_color parameter.

func (*CreateForumTopicCall) IconCustomEmojiID added in v0.6.0

func (call *CreateForumTopicCall) IconCustomEmojiID(iconCustomEmojiID string) *CreateForumTopicCall

IconCustomEmojiID sets the icon_custom_emoji_id parameter.

func (*CreateForumTopicCall) Name added in v0.6.0

Name sets the name parameter.

type CreateInvoiceLinkCall

type CreateInvoiceLinkCall struct {
	Call[string]
}

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

func NewCreateInvoiceLinkCall

func NewCreateInvoiceLinkCall(title string, description string, payload string, currency string, prices []LabeledPrice) *CreateInvoiceLinkCall

NewCreateInvoiceLinkCall constructs a new CreateInvoiceLinkCall.

Required params:

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

func (*CreateInvoiceLinkCall) BusinessConnectionID added in v0.16.0

func (call *CreateInvoiceLinkCall) BusinessConnectionID(businessConnectionID string) *CreateInvoiceLinkCall

BusinessConnectionID sets the business_connection_id parameter.

func (*CreateInvoiceLinkCall) Currency

func (call *CreateInvoiceLinkCall) Currency(currency string) *CreateInvoiceLinkCall

Currency sets the currency parameter.

func (*CreateInvoiceLinkCall) Description

func (call *CreateInvoiceLinkCall) Description(description string) *CreateInvoiceLinkCall

Description sets the description parameter.

func (*CreateInvoiceLinkCall) IsFlexible

func (call *CreateInvoiceLinkCall) IsFlexible(isFlexible bool) *CreateInvoiceLinkCall

IsFlexible sets the is_flexible parameter.

func (*CreateInvoiceLinkCall) MaxTipAmount

func (call *CreateInvoiceLinkCall) MaxTipAmount(maxTipAmount int) *CreateInvoiceLinkCall

MaxTipAmount sets the max_tip_amount parameter.

func (*CreateInvoiceLinkCall) NeedEmail

func (call *CreateInvoiceLinkCall) NeedEmail(needEmail bool) *CreateInvoiceLinkCall

NeedEmail sets the need_email parameter.

func (*CreateInvoiceLinkCall) NeedName

func (call *CreateInvoiceLinkCall) NeedName(needName bool) *CreateInvoiceLinkCall

NeedName sets the need_name parameter.

func (*CreateInvoiceLinkCall) NeedPhoneNumber

func (call *CreateInvoiceLinkCall) NeedPhoneNumber(needPhoneNumber bool) *CreateInvoiceLinkCall

NeedPhoneNumber sets the need_phone_number parameter.

func (*CreateInvoiceLinkCall) NeedShippingAddress

func (call *CreateInvoiceLinkCall) NeedShippingAddress(needShippingAddress bool) *CreateInvoiceLinkCall

NeedShippingAddress sets the need_shipping_address parameter.

func (*CreateInvoiceLinkCall) Payload

func (call *CreateInvoiceLinkCall) Payload(payload string) *CreateInvoiceLinkCall

Payload sets the payload parameter.

func (*CreateInvoiceLinkCall) PhotoHeight

func (call *CreateInvoiceLinkCall) PhotoHeight(photoHeight int) *CreateInvoiceLinkCall

PhotoHeight sets the photo_height parameter.

func (*CreateInvoiceLinkCall) PhotoSize

func (call *CreateInvoiceLinkCall) PhotoSize(photoSize int) *CreateInvoiceLinkCall

PhotoSize sets the photo_size parameter.

func (*CreateInvoiceLinkCall) PhotoURL added in v0.0.5

func (call *CreateInvoiceLinkCall) PhotoURL(photoURL string) *CreateInvoiceLinkCall

PhotoURL sets the photo_url parameter.

func (*CreateInvoiceLinkCall) PhotoWidth

func (call *CreateInvoiceLinkCall) PhotoWidth(photoWidth int) *CreateInvoiceLinkCall

PhotoWidth sets the photo_width parameter.

func (*CreateInvoiceLinkCall) Prices

Prices sets the prices parameter.

func (*CreateInvoiceLinkCall) ProviderData

func (call *CreateInvoiceLinkCall) ProviderData(providerData string) *CreateInvoiceLinkCall

ProviderData sets the provider_data parameter.

func (*CreateInvoiceLinkCall) ProviderToken

func (call *CreateInvoiceLinkCall) ProviderToken(providerToken string) *CreateInvoiceLinkCall

ProviderToken sets the provider_token parameter.

func (*CreateInvoiceLinkCall) SendEmailToProvider

func (call *CreateInvoiceLinkCall) SendEmailToProvider(sendEmailToProvider bool) *CreateInvoiceLinkCall

SendEmailToProvider sets the send_email_to_provider parameter.

func (*CreateInvoiceLinkCall) SendPhoneNumberToProvider

func (call *CreateInvoiceLinkCall) SendPhoneNumberToProvider(sendPhoneNumberToProvider bool) *CreateInvoiceLinkCall

SendPhoneNumberToProvider sets the send_phone_number_to_provider parameter.

func (*CreateInvoiceLinkCall) SubscriptionPeriod added in v0.16.0

func (call *CreateInvoiceLinkCall) SubscriptionPeriod(subscriptionPeriod int) *CreateInvoiceLinkCall

SubscriptionPeriod sets the subscription_period parameter.

func (*CreateInvoiceLinkCall) SuggestedTipAmounts

func (call *CreateInvoiceLinkCall) SuggestedTipAmounts(suggestedTipAmounts []int) *CreateInvoiceLinkCall

SuggestedTipAmounts sets the suggested_tip_amounts parameter.

func (*CreateInvoiceLinkCall) Title

Title sets the title parameter.

type CreateNewStickerSetCall

type CreateNewStickerSetCall struct {
	CallNoResult
}

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

func NewCreateNewStickerSetCall

func NewCreateNewStickerSetCall(userID UserID, name string, title string, stickers []InputSticker) *CreateNewStickerSetCall

NewCreateNewStickerSetCall constructs a new CreateNewStickerSetCall.

Required params:

  • userID: User identifier of created sticker set owner
  • name: Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals). Can contain only English letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and must end in "_by_<bot_username>". <bot_username> is case insensitive. 1-64 characters.
  • title: Sticker set title, 1-64 characters
  • stickers: A JSON-serialized list of 1-50 initial stickers to be added to the sticker set

func (*CreateNewStickerSetCall) Name

Name sets the name parameter.

func (*CreateNewStickerSetCall) NeedsRepainting added in v0.8.0

func (call *CreateNewStickerSetCall) NeedsRepainting(needsRepainting bool) *CreateNewStickerSetCall

NeedsRepainting sets the needs_repainting parameter.

func (*CreateNewStickerSetCall) StickerType added in v0.5.0

func (call *CreateNewStickerSetCall) StickerType(stickerType string) *CreateNewStickerSetCall

StickerType sets the sticker_type parameter.

func (*CreateNewStickerSetCall) Stickers added in v0.8.0

func (call *CreateNewStickerSetCall) Stickers(stickers []InputSticker) *CreateNewStickerSetCall

Stickers sets the stickers parameter.

func (*CreateNewStickerSetCall) Title

Title sets the title parameter.

func (*CreateNewStickerSetCall) UserID added in v0.0.5

UserID sets the user_id parameter.

type Currency added in v0.17.0

type Currency int8

Currency represents an enum type.

const (
	CurrencyUnknown Currency = iota
	CurrencyXTR              // "XTR"
	CurrencyTON              // "TON"
)

func (Currency) IsUnknown added in v0.17.0

func (v Currency) IsUnknown() bool

IsUnknown reports whether this value is unknown.

func (Currency) MarshalText added in v0.17.0

func (v Currency) MarshalText() ([]byte, error)

func (Currency) String added in v0.17.0

func (v Currency) String() string

func (*Currency) UnmarshalText added in v0.17.0

func (v *Currency) UnmarshalText(b []byte) error

type DeclineChatJoinRequestCall

type DeclineChatJoinRequestCall struct {
	CallNoResult
}

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

func NewDeclineChatJoinRequestCall

func NewDeclineChatJoinRequestCall(chatID PeerID, userID UserID) *DeclineChatJoinRequestCall

NewDeclineChatJoinRequestCall constructs a new DeclineChatJoinRequestCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • userID: Unique identifier of the target user

func (*DeclineChatJoinRequestCall) ChatID added in v0.0.5

ChatID sets the chat_id parameter.

func (*DeclineChatJoinRequestCall) UserID added in v0.0.5

UserID sets the user_id parameter.

type DeclineSuggestedPostCall added in v0.16.0

type DeclineSuggestedPostCall struct {
	CallNoResult
}

DeclineSuggestedPostCall represents a call to the declineSuggestedPost method. Use this method to decline a suggested post in a direct messages chat. The bot must have the 'can_manage_direct_messages' administrator right in the corresponding channel chat. Returns True on success.

func NewDeclineSuggestedPostCall added in v0.16.0

func NewDeclineSuggestedPostCall(chatID int, messageID int) *DeclineSuggestedPostCall

NewDeclineSuggestedPostCall constructs a new DeclineSuggestedPostCall.

Required params:

  • chatID: Unique identifier for the target direct messages chat
  • messageID: Identifier of a suggested post message to decline

func (*DeclineSuggestedPostCall) ChatID added in v0.16.0

ChatID sets the chat_id parameter.

func (*DeclineSuggestedPostCall) Comment added in v0.16.0

Comment sets the comment parameter.

func (*DeclineSuggestedPostCall) MessageID added in v0.16.0

func (call *DeclineSuggestedPostCall) MessageID(messageID int) *DeclineSuggestedPostCall

MessageID sets the message_id parameter.

type DeleteBusinessMessagesCall added in v0.16.0

type DeleteBusinessMessagesCall struct {
	CallNoResult
}

DeleteBusinessMessagesCall represents a call to the deleteBusinessMessages method. Delete messages on behalf of a business account. Requires the can_delete_sent_messages business bot right to delete messages sent by the bot itself, or the can_delete_all_messages business bot right to delete any message. Returns True on success.

func NewDeleteBusinessMessagesCall added in v0.16.0

func NewDeleteBusinessMessagesCall(businessConnectionID string, messageIDs []int) *DeleteBusinessMessagesCall

NewDeleteBusinessMessagesCall constructs a new DeleteBusinessMessagesCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection on behalf of which to delete the messages
  • messageIDs: A JSON-serialized list of 1-100 identifiers of messages to delete. All messages must be from the same chat. See Client.DeleteMessage for limitations on which messages can be deleted

func (*DeleteBusinessMessagesCall) BusinessConnectionID added in v0.16.0

func (call *DeleteBusinessMessagesCall) BusinessConnectionID(businessConnectionID string) *DeleteBusinessMessagesCall

BusinessConnectionID sets the business_connection_id parameter.

func (*DeleteBusinessMessagesCall) MessageIDs added in v0.16.0

func (call *DeleteBusinessMessagesCall) MessageIDs(messageIDs []int) *DeleteBusinessMessagesCall

MessageIDs sets the message_ids parameter.

type DeleteChatPhotoCall

type DeleteChatPhotoCall struct {
	CallNoResult
}

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

func NewDeleteChatPhotoCall

func NewDeleteChatPhotoCall(chatID PeerID) *DeleteChatPhotoCall

NewDeleteChatPhotoCall constructs a new DeleteChatPhotoCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*DeleteChatPhotoCall) ChatID added in v0.0.5

func (call *DeleteChatPhotoCall) ChatID(chatID PeerID) *DeleteChatPhotoCall

ChatID sets the chat_id parameter.

type DeleteChatStickerSetCall

type DeleteChatStickerSetCall struct {
	CallNoResult
}

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

func NewDeleteChatStickerSetCall

func NewDeleteChatStickerSetCall(chatID PeerID) *DeleteChatStickerSetCall

NewDeleteChatStickerSetCall constructs a new DeleteChatStickerSetCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

func (*DeleteChatStickerSetCall) ChatID added in v0.0.5

ChatID sets the chat_id parameter.

type DeleteForumTopicCall added in v0.6.0

type DeleteForumTopicCall struct {
	CallNoResult
}

DeleteForumTopicCall represents a call to the deleteForumTopic method. Use this method to delete a forum topic along with all its messages in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can_delete_messages administrator rights. Returns True on success.

func NewDeleteForumTopicCall added in v0.6.0

func NewDeleteForumTopicCall(chatID PeerID, messageThreadID int) *DeleteForumTopicCall

NewDeleteForumTopicCall constructs a new DeleteForumTopicCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
  • messageThreadID: Unique identifier for the target message thread of the forum topic

func (*DeleteForumTopicCall) ChatID added in v0.6.0

func (call *DeleteForumTopicCall) ChatID(chatID PeerID) *DeleteForumTopicCall

ChatID sets the chat_id parameter.

func (*DeleteForumTopicCall) MessageThreadID added in v0.6.0

func (call *DeleteForumTopicCall) MessageThreadID(messageThreadID int) *DeleteForumTopicCall

MessageThreadID sets the message_thread_id parameter.

type DeleteMessageCall

type DeleteMessageCall struct {
	CallNoResult
}

DeleteMessageCall represents a call to the deleteMessage method. Use this method to delete a message, including service messages, with the following limitations: - A message can only be deleted if it was sent less than 48 hours ago. - Service messages about a supergroup, channel, or forum topic creation can't be deleted. - A dice message in a private chat can only be deleted if it was sent more than 24 hours ago. - Bots can delete outgoing messages in private chats, groups, and supergroups. - Bots can delete incoming messages in private chats. - Bots granted can_post_messages permissions can delete outgoing messages in channels. - If the bot is an administrator of a group, it can delete any message there. - If the bot has can_delete_messages administrator right in a supergroup or a channel, it can delete any message there. - If the bot has can_manage_direct_messages administrator right in a channel, it can delete any message in the corresponding direct messages chat. Returns True on success.

func NewDeleteMessageCall

func NewDeleteMessageCall(chatID PeerID, messageID int) *DeleteMessageCall

NewDeleteMessageCall constructs a new DeleteMessageCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • messageID: Identifier of the message to delete

func (*DeleteMessageCall) ChatID added in v0.0.5

func (call *DeleteMessageCall) ChatID(chatID PeerID) *DeleteMessageCall

ChatID sets the chat_id parameter.

func (*DeleteMessageCall) MessageID added in v0.0.5

func (call *DeleteMessageCall) MessageID(messageID int) *DeleteMessageCall

MessageID sets the message_id parameter.

type DeleteMessagesCall added in v0.12.0

type DeleteMessagesCall struct {
	CallNoResult
}

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

func NewDeleteMessagesCall added in v0.12.0

func NewDeleteMessagesCall(chatID PeerID, messageIDs []int) *DeleteMessagesCall

NewDeleteMessagesCall constructs a new DeleteMessagesCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • messageIDs: A JSON-serialized list of 1-100 identifiers of messages to delete. See Client.DeleteMessage for limitations on which messages can be deleted

func (*DeleteMessagesCall) ChatID added in v0.12.0

func (call *DeleteMessagesCall) ChatID(chatID PeerID) *DeleteMessagesCall

ChatID sets the chat_id parameter.

func (*DeleteMessagesCall) MessageIDs added in v0.16.0

func (call *DeleteMessagesCall) MessageIDs(messageIDs []int) *DeleteMessagesCall

MessageIDs sets the message_ids parameter.

type DeleteMyCommandsCall

type DeleteMyCommandsCall struct {
	CallNoResult
}

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

func NewDeleteMyCommandsCall

func NewDeleteMyCommandsCall() *DeleteMyCommandsCall

NewDeleteMyCommandsCall constructs a new DeleteMyCommandsCall.

func (*DeleteMyCommandsCall) LanguageCode

func (call *DeleteMyCommandsCall) LanguageCode(languageCode string) *DeleteMyCommandsCall

LanguageCode sets the language_code parameter.

func (*DeleteMyCommandsCall) Scope

Scope sets the scope parameter.

type DeleteStickerFromSetCall

type DeleteStickerFromSetCall struct {
	CallNoResult
}

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

func NewDeleteStickerFromSetCall

func NewDeleteStickerFromSetCall(sticker string) *DeleteStickerFromSetCall

NewDeleteStickerFromSetCall constructs a new DeleteStickerFromSetCall.

Required params:

  • sticker: File identifier of the sticker

func (*DeleteStickerFromSetCall) Sticker

Sticker sets the sticker parameter.

type DeleteStickerSetCall added in v0.8.0

type DeleteStickerSetCall struct {
	CallNoResult
}

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

func NewDeleteStickerSetCall added in v0.8.0

func NewDeleteStickerSetCall(name string) *DeleteStickerSetCall

NewDeleteStickerSetCall constructs a new DeleteStickerSetCall.

Required params:

  • name: Sticker set name

func (*DeleteStickerSetCall) Name added in v0.8.0

Name sets the name parameter.

type DeleteStoryCall added in v0.16.0

type DeleteStoryCall struct {
	CallNoResult
}

DeleteStoryCall represents a call to the deleteStory method. Deletes a story previously posted by the bot on behalf of a managed business account. Requires the can_manage_stories business bot right. Returns True on success.

func NewDeleteStoryCall added in v0.16.0

func NewDeleteStoryCall(businessConnectionID string, storyID int) *DeleteStoryCall

NewDeleteStoryCall constructs a new DeleteStoryCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection
  • storyID: Unique identifier of the story to delete

func (*DeleteStoryCall) BusinessConnectionID added in v0.16.0

func (call *DeleteStoryCall) BusinessConnectionID(businessConnectionID string) *DeleteStoryCall

BusinessConnectionID sets the business_connection_id parameter.

func (*DeleteStoryCall) StoryID added in v0.16.0

func (call *DeleteStoryCall) StoryID(storyID int) *DeleteStoryCall

StoryID sets the story_id parameter.

type DeleteWebhookCall

type DeleteWebhookCall struct {
	CallNoResult
}

DeleteWebhookCall represents a call to the deleteWebhook method. Use this method to remove webhook integration if you decide to switch back to Client.GetUpdates. Returns True on success.

func NewDeleteWebhookCall

func NewDeleteWebhookCall() *DeleteWebhookCall

NewDeleteWebhookCall constructs a new DeleteWebhookCall.

func (*DeleteWebhookCall) DropPendingUpdates

func (call *DeleteWebhookCall) DropPendingUpdates(dropPendingUpdates bool) *DeleteWebhookCall

DropPendingUpdates sets the drop_pending_updates parameter.

type Dice

type Dice struct {
	// Emoji on which the dice throw animation is based
	Emoji DiceEmoji `json:"emoji"`

	// Value of the dice, 1-6 for “🎲”, “🎯” and “🎳” base emoji, 1-5 for “🏀” and “⚽” base emoji, 1-64 for “🎰” base emoji
	Value int `json:"value"`
}

Dice this object represents an animated emoji that displays a random value.

type DiceEmoji added in v0.17.0

type DiceEmoji int8

DiceEmoji represents an enum type.

const (
	DiceEmojiUnknown     DiceEmoji = iota
	DiceEmojiGameDie               // "🎲"
	DiceEmojiBullseye              // "🎯"
	DiceEmojiBasketball            // "🏀"
	DiceEmojiSoccerBall            // "⚽"
	DiceEmojiBowling               // "🎳"
	DiceEmojiSlotMachine           // "🎰"
)

func (DiceEmoji) IsUnknown added in v0.17.0

func (v DiceEmoji) IsUnknown() bool

IsUnknown reports whether this value is unknown.

func (DiceEmoji) MarshalText added in v0.17.0

func (v DiceEmoji) MarshalText() ([]byte, error)

func (DiceEmoji) String added in v0.17.0

func (v DiceEmoji) String() string

func (*DiceEmoji) UnmarshalText added in v0.17.0

func (v *DiceEmoji) UnmarshalText(b []byte) error

type DirectMessagePriceChanged added in v0.16.0

type DirectMessagePriceChanged struct {
	// True, if direct messages are enabled for the channel chat; false otherwise
	AreDirectMessagesEnabled bool `json:"are_direct_messages_enabled"`

	// Optional. The new number of Telegram Stars that must be paid by users for each direct message sent to the channel. Does not apply to users who have been exempted by administrators. Defaults to 0.
	DirectMessageStarCount int `json:"direct_message_star_count,omitempty"`
}

DirectMessagePriceChanged describes a service message about a change in the price of direct messages sent to a channel chat.

type DirectMessagesTopic added in v0.16.0

type DirectMessagesTopic struct {
	// Unique identifier of the topic. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier.
	TopicID int64 `json:"topic_id"`

	// Optional. Information about the user that created the topic. Currently, it is always present
	User *User `json:"user,omitempty"`
}

DirectMessagesTopic describes a topic of a direct messages chat.

type Document

type Document struct {
	// Identifier for this file, which can be used to download or reuse the file
	FileID FileID `json:"file_id"`

	// Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
	FileUniqueID string `json:"file_unique_id"`

	// Optional. Document thumbnail as defined by the sender
	Thumbnail *PhotoSize `json:"thumbnail,omitempty"`

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

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

	// Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.
	FileSize int64 `json:"file_size,omitempty"`
}

Document this object represents a general file (as opposed to PhotoSize, Voice and Audio).

type Doer added in v0.8.1

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

type EditChatInviteLinkCall

type EditChatInviteLinkCall struct {
	Call[ChatInviteLink]
}

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

func NewEditChatInviteLinkCall

func NewEditChatInviteLinkCall(chatID PeerID, inviteLink string) *EditChatInviteLinkCall

NewEditChatInviteLinkCall constructs a new EditChatInviteLinkCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • inviteLink: The invite link to edit

func (*EditChatInviteLinkCall) ChatID added in v0.0.5

ChatID sets the chat_id parameter.

func (*EditChatInviteLinkCall) CreatesJoinRequest

func (call *EditChatInviteLinkCall) CreatesJoinRequest(createsJoinRequest bool) *EditChatInviteLinkCall

CreatesJoinRequest sets the creates_join_request parameter.

func (*EditChatInviteLinkCall) ExpireDate

func (call *EditChatInviteLinkCall) ExpireDate(expireDate int) *EditChatInviteLinkCall

ExpireDate sets the expire_date parameter.

func (call *EditChatInviteLinkCall) InviteLink(inviteLink string) *EditChatInviteLinkCall

InviteLink sets the invite_link parameter.

func (*EditChatInviteLinkCall) MemberLimit

func (call *EditChatInviteLinkCall) MemberLimit(memberLimit int) *EditChatInviteLinkCall

MemberLimit sets the member_limit parameter.

func (*EditChatInviteLinkCall) Name

Name sets the name parameter.

type EditChatSubscriptionInviteLinkCall added in v0.16.0

type EditChatSubscriptionInviteLinkCall struct {
	Call[ChatInviteLink]
}

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

func NewEditChatSubscriptionInviteLinkCall added in v0.16.0

func NewEditChatSubscriptionInviteLinkCall(chatID PeerID, inviteLink string) *EditChatSubscriptionInviteLinkCall

NewEditChatSubscriptionInviteLinkCall constructs a new EditChatSubscriptionInviteLinkCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • inviteLink: The invite link to edit

func (*EditChatSubscriptionInviteLinkCall) ChatID added in v0.16.0

ChatID sets the chat_id parameter.

InviteLink sets the invite_link parameter.

func (*EditChatSubscriptionInviteLinkCall) Name added in v0.16.0

Name sets the name parameter.

type EditForumTopicCall added in v0.6.0

type EditForumTopicCall struct {
	CallNoResult
}

EditForumTopicCall represents a call to the editForumTopic method. Use this method to edit name and icon of a topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success.

func NewEditForumTopicCall added in v0.6.0

func NewEditForumTopicCall(chatID PeerID, messageThreadID int) *EditForumTopicCall

NewEditForumTopicCall constructs a new EditForumTopicCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
  • messageThreadID: Unique identifier for the target message thread of the forum topic

func (*EditForumTopicCall) ChatID added in v0.6.0

func (call *EditForumTopicCall) ChatID(chatID PeerID) *EditForumTopicCall

ChatID sets the chat_id parameter.

func (*EditForumTopicCall) IconCustomEmojiID added in v0.6.0

func (call *EditForumTopicCall) IconCustomEmojiID(iconCustomEmojiID string) *EditForumTopicCall

IconCustomEmojiID sets the icon_custom_emoji_id parameter.

func (*EditForumTopicCall) MessageThreadID added in v0.6.0

func (call *EditForumTopicCall) MessageThreadID(messageThreadID int) *EditForumTopicCall

MessageThreadID sets the message_thread_id parameter.

func (*EditForumTopicCall) Name added in v0.6.0

func (call *EditForumTopicCall) Name(name string) *EditForumTopicCall

Name sets the name parameter.

type EditGeneralForumTopicCall added in v0.6.0

type EditGeneralForumTopicCall struct {
	CallNoResult
}

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

func NewEditGeneralForumTopicCall added in v0.6.0

func NewEditGeneralForumTopicCall(chatID PeerID, name string) *EditGeneralForumTopicCall

NewEditGeneralForumTopicCall constructs a new EditGeneralForumTopicCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
  • name: New topic name, 1-128 characters

func (*EditGeneralForumTopicCall) ChatID added in v0.6.0

ChatID sets the chat_id parameter.

func (*EditGeneralForumTopicCall) Name added in v0.6.0

Name sets the name parameter.

type EditMessageCaptionCall

type EditMessageCaptionCall struct {
	Call[Message]
}

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

func NewEditMessageCaptionCall

func NewEditMessageCaptionCall(chatID PeerID, messageID int, caption string) *EditMessageCaptionCall

NewEditMessageCaptionCall constructs a new EditMessageCaptionCall.

Required params:

  • chatID: Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • messageID: Required if inline_message_id is not specified. Identifier of the message to edit
  • caption: New caption of the message, 0-1024 characters after entities parsing

func NewEditMessageCaptionInlineCall added in v0.0.3

func NewEditMessageCaptionInlineCall(inlineMessageID string, caption string) *EditMessageCaptionCall

NewEditMessageCaptionInlineCall constructs a new EditMessageCaptionCall.

Required params:

  • inlineMessageID: Required if chat_id and message_id are not specified. Identifier of the inline message
  • caption: New caption of the message, 0-1024 characters after entities parsing

func (*EditMessageCaptionCall) BusinessConnectionID added in v0.16.0

func (call *EditMessageCaptionCall) BusinessConnectionID(businessConnectionID string) *EditMessageCaptionCall

BusinessConnectionID sets the business_connection_id parameter.

func (*EditMessageCaptionCall) Caption

func (call *EditMessageCaptionCall) Caption(caption string) *EditMessageCaptionCall

Caption sets the caption parameter.

func (*EditMessageCaptionCall) CaptionEntities

func (call *EditMessageCaptionCall) CaptionEntities(captionEntities []MessageEntity) *EditMessageCaptionCall

CaptionEntities sets the caption_entities parameter.

func (*EditMessageCaptionCall) ChatID added in v0.0.5

ChatID sets the chat_id parameter.

func (*EditMessageCaptionCall) InlineMessageID added in v0.0.5

func (call *EditMessageCaptionCall) InlineMessageID(inlineMessageID string) *EditMessageCaptionCall

InlineMessageID sets the inline_message_id parameter.

func (*EditMessageCaptionCall) MessageID added in v0.0.5

func (call *EditMessageCaptionCall) MessageID(messageID int) *EditMessageCaptionCall

MessageID sets the message_id parameter.

func (*EditMessageCaptionCall) ParseMode

func (call *EditMessageCaptionCall) ParseMode(parseMode ParseMode) *EditMessageCaptionCall

ParseMode sets the parse_mode parameter.

func (*EditMessageCaptionCall) ReplyMarkup

func (call *EditMessageCaptionCall) ReplyMarkup(replyMarkup InlineKeyboardMarkup) *EditMessageCaptionCall

ReplyMarkup sets the reply_markup parameter.

func (*EditMessageCaptionCall) ShowCaptionAboveMedia added in v0.16.0

func (call *EditMessageCaptionCall) ShowCaptionAboveMedia(showCaptionAboveMedia bool) *EditMessageCaptionCall

ShowCaptionAboveMedia sets the show_caption_above_media parameter.

type EditMessageChecklistCall added in v0.16.0

type EditMessageChecklistCall struct {
	Call[Message]
}

EditMessageChecklistCall represents a call to the editMessageChecklist method. Use this method to edit a checklist on behalf of a connected business account. On success, the edited Message is returned.

func NewEditMessageChecklistCall added in v0.16.0

func NewEditMessageChecklistCall(businessConnectionID string, chatID int, messageID int, checklist InputChecklist) *EditMessageChecklistCall

NewEditMessageChecklistCall constructs a new EditMessageChecklistCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection on behalf of which the message will be sent
  • chatID: Unique identifier for the target chat
  • messageID: Unique identifier for the target message
  • checklist: A JSON-serialized object for the new checklist

func (*EditMessageChecklistCall) BusinessConnectionID added in v0.16.0

func (call *EditMessageChecklistCall) BusinessConnectionID(businessConnectionID string) *EditMessageChecklistCall

BusinessConnectionID sets the business_connection_id parameter.

func (*EditMessageChecklistCall) ChatID added in v0.16.0

ChatID sets the chat_id parameter.

func (*EditMessageChecklistCall) Checklist added in v0.16.0

Checklist sets the checklist parameter.

func (*EditMessageChecklistCall) MessageID added in v0.16.0

func (call *EditMessageChecklistCall) MessageID(messageID int) *EditMessageChecklistCall

MessageID sets the message_id parameter.

func (*EditMessageChecklistCall) ReplyMarkup added in v0.16.0

ReplyMarkup sets the reply_markup parameter.

type EditMessageLiveLocationCall

type EditMessageLiveLocationCall struct {
	Call[Message]
}

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

func NewEditMessageLiveLocationCall

func NewEditMessageLiveLocationCall(chatID PeerID, messageID int, latitude float64, longitude float64) *EditMessageLiveLocationCall

NewEditMessageLiveLocationCall constructs a new EditMessageLiveLocationCall.

Required params:

  • chatID: Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • messageID: Required if inline_message_id is not specified. Identifier of the message to edit
  • latitude: Latitude of new location
  • longitude: Longitude of new location

func NewEditMessageLiveLocationInlineCall

func NewEditMessageLiveLocationInlineCall(inlineMessageID string, latitude float64, longitude float64) *EditMessageLiveLocationCall

NewEditMessageLiveLocationInlineCall constructs a new EditMessageLiveLocationCall.

Required params:

  • inlineMessageID: Required if chat_id and message_id are not specified. Identifier of the inline message
  • latitude: Latitude of new location
  • longitude: Longitude of new location

func (*EditMessageLiveLocationCall) BusinessConnectionID added in v0.16.0

func (call *EditMessageLiveLocationCall) BusinessConnectionID(businessConnectionID string) *EditMessageLiveLocationCall

BusinessConnectionID sets the business_connection_id parameter.

func (*EditMessageLiveLocationCall) ChatID added in v0.0.5

ChatID sets the chat_id parameter.

func (*EditMessageLiveLocationCall) Heading

Heading sets the heading parameter.

func (*EditMessageLiveLocationCall) HorizontalAccuracy

func (call *EditMessageLiveLocationCall) HorizontalAccuracy(horizontalAccuracy float64) *EditMessageLiveLocationCall

HorizontalAccuracy sets the horizontal_accuracy parameter.

func (*EditMessageLiveLocationCall) InlineMessageID added in v0.0.5

func (call *EditMessageLiveLocationCall) InlineMessageID(inlineMessageID string) *EditMessageLiveLocationCall

InlineMessageID sets the inline_message_id parameter.

func (*EditMessageLiveLocationCall) Latitude

Latitude sets the latitude parameter.

func (*EditMessageLiveLocationCall) LivePeriod added in v0.16.0

func (call *EditMessageLiveLocationCall) LivePeriod(livePeriod int) *EditMessageLiveLocationCall

LivePeriod sets the live_period parameter.

func (*EditMessageLiveLocationCall) Longitude

Longitude sets the longitude parameter.

func (*EditMessageLiveLocationCall) MessageID added in v0.0.5

func (call *EditMessageLiveLocationCall) MessageID(messageID int) *EditMessageLiveLocationCall

MessageID sets the message_id parameter.

func (*EditMessageLiveLocationCall) ProximityAlertRadius

func (call *EditMessageLiveLocationCall) ProximityAlertRadius(proximityAlertRadius int) *EditMessageLiveLocationCall

ProximityAlertRadius sets the proximity_alert_radius parameter.

func (*EditMessageLiveLocationCall) ReplyMarkup

ReplyMarkup sets the reply_markup parameter.

type EditMessageMediaCall

type EditMessageMediaCall struct {
	Call[Message]
}

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

func NewEditMessageMediaCall

func NewEditMessageMediaCall(chatID PeerID, messageID int, media InputMediaClass) *EditMessageMediaCall

NewEditMessageMediaCall constructs a new EditMessageMediaCall.

Required params:

  • chatID: Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • messageID: Required if inline_message_id is not specified. Identifier of the message to edit
  • media: A JSON-serialized object for a new media content of the message

func NewEditMessageMediaInlineCall added in v0.16.0

func NewEditMessageMediaInlineCall(inlineMessageID string, media InputMediaClass) *EditMessageMediaCall

NewEditMessageMediaInlineCall constructs a new EditMessageMediaCall.

Required params:

  • inlineMessageID: Required if chat_id and message_id are not specified. Identifier of the inline message
  • media: A JSON-serialized object for a new media content of the message

func (*EditMessageMediaCall) BusinessConnectionID added in v0.16.0

func (call *EditMessageMediaCall) BusinessConnectionID(businessConnectionID string) *EditMessageMediaCall

BusinessConnectionID sets the business_connection_id parameter.

func (*EditMessageMediaCall) ChatID added in v0.0.5

func (call *EditMessageMediaCall) ChatID(chatID PeerID) *EditMessageMediaCall

ChatID sets the chat_id parameter.

func (*EditMessageMediaCall) InlineMessageID added in v0.0.5

func (call *EditMessageMediaCall) InlineMessageID(inlineMessageID string) *EditMessageMediaCall

InlineMessageID sets the inline_message_id parameter.

func (*EditMessageMediaCall) Media

Media sets the media parameter.

func (*EditMessageMediaCall) MessageID added in v0.0.5

func (call *EditMessageMediaCall) MessageID(messageID int) *EditMessageMediaCall

MessageID sets the message_id parameter.

func (*EditMessageMediaCall) ReplyMarkup

func (call *EditMessageMediaCall) ReplyMarkup(replyMarkup InlineKeyboardMarkup) *EditMessageMediaCall

ReplyMarkup sets the reply_markup parameter.

type EditMessageReplyMarkupCall

type EditMessageReplyMarkupCall struct {
	Call[Message]
}

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

func NewEditMessageReplyMarkupCall

func NewEditMessageReplyMarkupCall(chatID PeerID, messageID int) *EditMessageReplyMarkupCall

NewEditMessageReplyMarkupCall constructs a new EditMessageReplyMarkupCall.

Required params:

  • chatID: Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • messageID: Required if inline_message_id is not specified. Identifier of the message to edit

func NewEditMessageReplyMarkupInlineCall added in v0.0.3

func NewEditMessageReplyMarkupInlineCall(inlineMessageID string) *EditMessageReplyMarkupCall

NewEditMessageReplyMarkupInlineCall constructs a new EditMessageReplyMarkupCall.

Required params:

  • inlineMessageID: Required if chat_id and message_id are not specified. Identifier of the inline message

func (*EditMessageReplyMarkupCall) BusinessConnectionID added in v0.16.0

func (call *EditMessageReplyMarkupCall) BusinessConnectionID(businessConnectionID string) *EditMessageReplyMarkupCall

BusinessConnectionID sets the business_connection_id parameter.

func (*EditMessageReplyMarkupCall) ChatID added in v0.0.5

ChatID sets the chat_id parameter.

func (*EditMessageReplyMarkupCall) InlineMessageID added in v0.0.5

func (call *EditMessageReplyMarkupCall) InlineMessageID(inlineMessageID string) *EditMessageReplyMarkupCall

InlineMessageID sets the inline_message_id parameter.

func (*EditMessageReplyMarkupCall) MessageID added in v0.0.5

func (call *EditMessageReplyMarkupCall) MessageID(messageID int) *EditMessageReplyMarkupCall

MessageID sets the message_id parameter.

func (*EditMessageReplyMarkupCall) ReplyMarkup

ReplyMarkup sets the reply_markup parameter.

type EditMessageTextCall

type EditMessageTextCall struct {
	Call[Message]
}

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

func NewEditMessageTextCall

func NewEditMessageTextCall(chatID PeerID, messageID int, text string) *EditMessageTextCall

NewEditMessageTextCall constructs a new EditMessageTextCall.

Required params:

  • chatID: Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • messageID: Required if inline_message_id is not specified. Identifier of the message to edit
  • text: New text of the message, 1-4096 characters after entities parsing

func NewEditMessageTextInlineCall added in v0.0.3

func NewEditMessageTextInlineCall(inlineMessageID string, text string) *EditMessageTextCall

NewEditMessageTextInlineCall constructs a new EditMessageTextCall.

Required params:

  • inlineMessageID: Required if chat_id and message_id are not specified. Identifier of the inline message
  • text: New text of the message, 1-4096 characters after entities parsing

func (*EditMessageTextCall) BusinessConnectionID added in v0.16.0

func (call *EditMessageTextCall) BusinessConnectionID(businessConnectionID string) *EditMessageTextCall

BusinessConnectionID sets the business_connection_id parameter.

func (*EditMessageTextCall) ChatID added in v0.0.5

func (call *EditMessageTextCall) ChatID(chatID PeerID) *EditMessageTextCall

ChatID sets the chat_id parameter.

func (*EditMessageTextCall) Entities

func (call *EditMessageTextCall) Entities(entities []MessageEntity) *EditMessageTextCall

Entities sets the entities parameter.

func (*EditMessageTextCall) InlineMessageID added in v0.0.5

func (call *EditMessageTextCall) InlineMessageID(inlineMessageID string) *EditMessageTextCall

InlineMessageID sets the inline_message_id parameter.

func (*EditMessageTextCall) LinkPreviewOptions added in v0.12.0

func (call *EditMessageTextCall) LinkPreviewOptions(linkPreviewOptions LinkPreviewOptions) *EditMessageTextCall

LinkPreviewOptions sets the link_preview_options parameter.

func (*EditMessageTextCall) MessageID added in v0.0.5

func (call *EditMessageTextCall) MessageID(messageID int) *EditMessageTextCall

MessageID sets the message_id parameter.

func (*EditMessageTextCall) ParseMode

func (call *EditMessageTextCall) ParseMode(parseMode ParseMode) *EditMessageTextCall

ParseMode sets the parse_mode parameter.

func (*EditMessageTextCall) ReplyMarkup

func (call *EditMessageTextCall) ReplyMarkup(replyMarkup InlineKeyboardMarkup) *EditMessageTextCall

ReplyMarkup sets the reply_markup parameter.

func (*EditMessageTextCall) Text

Text sets the text parameter.

type EditStoryCall added in v0.16.0

type EditStoryCall struct {
	Call[Story]
}

EditStoryCall represents a call to the editStory method. Edits a story previously posted by the bot on behalf of a managed business account. Requires the can_manage_stories business bot right. Returns Story on success.

func NewEditStoryCall added in v0.16.0

func NewEditStoryCall(businessConnectionID string, storyID int, content InputStoryContentClass) *EditStoryCall

NewEditStoryCall constructs a new EditStoryCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection
  • storyID: Unique identifier of the story to edit
  • content: Content of the story

func (*EditStoryCall) Areas added in v0.16.0

func (call *EditStoryCall) Areas(areas []StoryArea) *EditStoryCall

Areas sets the areas parameter.

func (*EditStoryCall) BusinessConnectionID added in v0.16.0

func (call *EditStoryCall) BusinessConnectionID(businessConnectionID string) *EditStoryCall

BusinessConnectionID sets the business_connection_id parameter.

func (*EditStoryCall) Caption added in v0.16.0

func (call *EditStoryCall) Caption(caption string) *EditStoryCall

Caption sets the caption parameter.

func (*EditStoryCall) CaptionEntities added in v0.16.0

func (call *EditStoryCall) CaptionEntities(captionEntities []MessageEntity) *EditStoryCall

CaptionEntities sets the caption_entities parameter.

func (*EditStoryCall) Content added in v0.16.0

func (call *EditStoryCall) Content(content InputStoryContentClass) *EditStoryCall

Content sets the content parameter.

func (*EditStoryCall) ParseMode added in v0.16.0

func (call *EditStoryCall) ParseMode(parseMode ParseMode) *EditStoryCall

ParseMode sets the parse_mode parameter.

func (*EditStoryCall) StoryID added in v0.16.0

func (call *EditStoryCall) StoryID(storyID int) *EditStoryCall

StoryID sets the story_id parameter.

type EditUserStarSubscriptionCall added in v0.16.0

type EditUserStarSubscriptionCall struct {
	CallNoResult
}

EditUserStarSubscriptionCall represents a call to the editUserStarSubscription method. Allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars. Returns True on success.

func NewEditUserStarSubscriptionCall added in v0.16.0

func NewEditUserStarSubscriptionCall(userID UserID, telegramPaymentChargeID string, isCanceled bool) *EditUserStarSubscriptionCall

NewEditUserStarSubscriptionCall constructs a new EditUserStarSubscriptionCall.

Required params:

  • userID: Identifier of the user whose subscription will be edited
  • telegramPaymentChargeID: Telegram payment identifier for the subscription
  • isCanceled: Pass True to cancel extension of the user subscription; the subscription must be active up to the end of the current subscription period. Pass False to allow the user to re-enable a subscription that was previously canceled by the bot.

func (*EditUserStarSubscriptionCall) IsCanceled added in v0.16.0

func (call *EditUserStarSubscriptionCall) IsCanceled(isCanceled bool) *EditUserStarSubscriptionCall

IsCanceled sets the is_canceled parameter.

func (*EditUserStarSubscriptionCall) TelegramPaymentChargeID added in v0.16.0

func (call *EditUserStarSubscriptionCall) TelegramPaymentChargeID(telegramPaymentChargeID string) *EditUserStarSubscriptionCall

TelegramPaymentChargeID sets the telegram_payment_charge_id parameter.

func (*EditUserStarSubscriptionCall) UserID added in v0.16.0

UserID sets the user_id parameter.

type Encoder

type Encoder interface {
	// Writes string argument k to encoder.
	WriteString(k string, v string) error

	// Write files argument k to encoder.
	WriteFile(k string, file InputFile) error
}

Encoder represents request encoder.

type EncryptedCredentials

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

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

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

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

type EncryptedPassportElement

type EncryptedPassportElement struct {
	// Element type. One of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”, “phone_number”, “email”.
	Type EncryptedPassportElementType `json:"type"`

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

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

	// Optional. User's verified email address; available only for “email” type
	Email string `json:"email,omitempty"`

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

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

	// Optional. Encrypted file with the reverse side of the document, provided by the user; available only for “driver_license” and “identity_card”. The file can be decrypted and verified using the accompanying [EncryptedCredentials].
	ReverseSide *PassportFile `json:"reverse_side,omitempty"`

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

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

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

EncryptedPassportElement describes documents or other Telegram Passport elements shared with the bot by the user.

type EncryptedPassportElementType added in v0.17.0

type EncryptedPassportElementType int8

EncryptedPassportElementType represents an enum type.

const (
	EncryptedPassportElementTypeUnknown               EncryptedPassportElementType = iota
	EncryptedPassportElementTypePersonalDetails                                    // "personal_details"
	EncryptedPassportElementTypePassport                                           // "passport"
	EncryptedPassportElementTypeDriverLicense                                      // "driver_license"
	EncryptedPassportElementTypeIdentityCard                                       // "identity_card"
	EncryptedPassportElementTypeInternalPassport                                   // "internal_passport"
	EncryptedPassportElementTypeAddress                                            // "address"
	EncryptedPassportElementTypeUtilityBill                                        // "utility_bill"
	EncryptedPassportElementTypeBankStatement                                      // "bank_statement"
	EncryptedPassportElementTypeRentalAgreement                                    // "rental_agreement"
	EncryptedPassportElementTypePassportRegistration                               // "passport_registration"
	EncryptedPassportElementTypeTemporaryRegistration                              // "temporary_registration"
	EncryptedPassportElementTypePhoneNumber                                        // "phone_number"
	EncryptedPassportElementTypeEmail                                              // "email"
)

func (EncryptedPassportElementType) IsUnknown added in v0.17.0

func (v EncryptedPassportElementType) IsUnknown() bool

IsUnknown reports whether this value is unknown.

func (EncryptedPassportElementType) MarshalText added in v0.17.0

func (v EncryptedPassportElementType) MarshalText() ([]byte, error)

func (EncryptedPassportElementType) String added in v0.17.0

func (*EncryptedPassportElementType) UnmarshalText added in v0.17.0

func (v *EncryptedPassportElementType) UnmarshalText(b []byte) error

type Error added in v0.0.5

type Error struct {
	Code       int                 `json:"code"`
	Message    string              `json:"message"`
	Parameters *ResponseParameters `json:"parameters"`
}

Error is Telegram Bot API error structure.

func (*Error) Contains added in v0.0.5

func (err *Error) Contains(v string) bool

func (*Error) Error added in v0.0.5

func (err *Error) Error() string

type ExportChatInviteLinkCall

type ExportChatInviteLinkCall struct {
	Call[string]
}

ExportChatInviteLinkCall represents a call to the exportChatInviteLink method. Use this method to generate a new primary invite link for a chat; any previously generated primary link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the new invite link as String on success. Note: Each administrator in a chat generates their own invite links. Bots can't use invite links generated by other administrators. If you want your bot to work with invite links, it will need to generate its own link using Client.ExportChatInviteLink or by calling the Client.GetChat method. If your bot needs to generate a new primary invite link replacing its previous one, use Client.ExportChatInviteLink again.

func NewExportChatInviteLinkCall

func NewExportChatInviteLinkCall(chatID PeerID) *ExportChatInviteLinkCall

NewExportChatInviteLinkCall constructs a new ExportChatInviteLinkCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*ExportChatInviteLinkCall) ChatID added in v0.0.5

ChatID sets the chat_id parameter.

type ExternalReplyInfo added in v0.12.0

type ExternalReplyInfo struct {
	// Origin of the message replied to by the given message
	Origin MessageOrigin `json:"origin"`

	// Optional. Chat the original message belongs to. Available only if the chat is a supergroup or a channel.
	Chat *Chat `json:"chat,omitempty"`

	// Optional. Unique message identifier inside the original chat. Available only if the original chat is a supergroup or a channel.
	MessageID int `json:"message_id,omitempty"`

	// Optional. Options used for link preview generation for the original message, if it is a text message
	LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options,omitempty"`

	// Optional. Message is an animation, information about the animation
	Animation *Animation `json:"animation,omitempty"`

	// Optional. Message is an audio file, information about the file
	Audio *Audio `json:"audio,omitempty"`

	// Optional. Message is a general file, information about the file
	Document *Document `json:"document,omitempty"`

	// Optional. Message contains paid media; information about the paid media
	PaidMedia *PaidMediaInfo `json:"paid_media,omitempty"`

	// Optional. Message is a photo, available sizes of the photo
	Photo []PhotoSize `json:"photo,omitempty"`

	// Optional. Message is a sticker, information about the sticker
	Sticker *Sticker `json:"sticker,omitempty"`

	// Optional. Message is a forwarded story
	Story *Story `json:"story,omitempty"`

	// Optional. Message is a video, information about the video
	Video *Video `json:"video,omitempty"`

	// Optional. Message is a [video note], information about the video message
	//
	// [video note]: https://telegram.org/blog/video-messages-and-telescope
	VideoNote *VideoNote `json:"video_note,omitempty"`

	// Optional. Message is a voice message, information about the file
	Voice *Voice `json:"voice,omitempty"`

	// Optional. True, if the message media is covered by a spoiler animation
	HasMediaSpoiler bool `json:"has_media_spoiler,omitempty"`

	// Optional. Message is a checklist
	Checklist *Checklist `json:"checklist,omitempty"`

	// Optional. Message is a shared contact, information about the contact
	Contact *Contact `json:"contact,omitempty"`

	// Optional. Message is a dice with random value
	Dice *Dice `json:"dice,omitempty"`

	// Optional. Message is a game, information about the game. [More about games »]
	//
	// [More about games »]: https://core.telegram.org/bots/api#games
	Game *Game `json:"game,omitempty"`

	// Optional. Message is a scheduled giveaway, information about the giveaway
	Giveaway *Giveaway `json:"giveaway,omitempty"`

	// Optional. A giveaway with public winners was completed
	GiveawayWinners *GiveawayWinners `json:"giveaway_winners,omitempty"`

	// Optional. Message is an invoice for a [payment], information about the invoice. [More about payments »]
	//
	// [payment]: https://core.telegram.org/bots/api#payments
	// [More about payments »]: https://core.telegram.org/bots/api#payments
	Invoice *Invoice `json:"invoice,omitempty"`

	// Optional. Message is a shared location, information about the location
	Location *Location `json:"location,omitempty"`

	// Optional. Message is a native poll, information about the poll
	Poll *Poll `json:"poll,omitempty"`

	// Optional. Message is a venue, information about the venue
	Venue *Venue `json:"venue,omitempty"`
}

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

type File

type File struct {
	// Identifier for this file, which can be used to download or reuse the file
	FileID FileID `json:"file_id"`

	// Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
	FileUniqueID string `json:"file_unique_id"`

	// Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.
	FileSize int64 `json:"file_size,omitempty"`

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

File this object represents a file ready to be downloaded. The file can be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling Client.GetFile.

type FileArg

type FileArg struct {
	// Send already uploaded file by its file_id.
	FileID FileID

	// Send remote file by URL.
	URL string

	// Upload file
	Upload InputFile
	// contains filtered or unexported fields
}

FileArg it's union type for different ways of sending files.

func NewFileArgID added in v0.1.1

func NewFileArgID(id FileID) FileArg

NewFileArgID creates a new FileArg for sending a file by file_id.

func NewFileArgURL added in v0.1.1

func NewFileArgURL(url string) FileArg

NewFileArgURL creates a new FileArg for sending a file by URL.

func NewFileArgUpload added in v0.1.1

func NewFileArgUpload(file InputFile) FileArg

NewFileArgUpload creates a new FileArg for uploading a file by content.

func (FileArg) MarshalJSON added in v0.0.5

func (arg FileArg) MarshalJSON() ([]byte, error)

type FileID

type FileID string

type ForceReply

type ForceReply struct {
	// Shows reply interface to the user, as if they manually selected the bot's message and tapped 'Reply'
	ForceReply bool `json:"force_reply"`

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

	// Optional. Use this parameter if you want to force reply from specific users only. Targets: 1) users that are @mentioned in the text of the [Message] object; 2) if the bot's message is a reply to a message in the same chat and forum topic, sender of the original message.
	Selective bool `json:"selective,omitempty"`
}

ForceReply upon receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the user has selected the bot's message and tapped 'Reply'). This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode. Not supported in channels and for messages sent on behalf of a Telegram Business account.

func NewForceReply added in v0.0.2

func NewForceReply() *ForceReply

NewForceReply creates a new ForceReply.

func (*ForceReply) WithInputFieldPlaceholder added in v0.0.2

func (v *ForceReply) WithInputFieldPlaceholder(inputFieldPlaceholder string) *ForceReply

WithInputFieldPlaceholder sets the InputFieldPlaceholder field.

func (*ForceReply) WithSelective added in v0.0.2

func (v *ForceReply) WithSelective() *ForceReply

WithSelective sets the Selective field.

type ForumTopic added in v0.6.0

type ForumTopic struct {
	// Unique identifier of the forum topic
	MessageThreadID int `json:"message_thread_id"`

	// Name of the topic
	Name string `json:"name"`

	// Color of the topic icon in RGB format
	IconColor TopicIconColor `json:"icon_color"`

	// Optional. Unique identifier of the custom emoji shown as the topic icon
	IconCustomEmojiID string `json:"icon_custom_emoji_id,omitempty"`

	// Optional. True, if the name of the topic wasn't specified explicitly by its creator and likely needs to be changed by the bot
	IsNameImplicit bool `json:"is_name_implicit,omitempty"`
}

ForumTopic this object represents a forum topic.

type ForumTopicClosed added in v0.6.0

type ForumTopicClosed struct{}

ForumTopicClosed this object represents a service message about a forum topic closed in the chat. Currently holds no information.

type ForumTopicCreated added in v0.6.0

type ForumTopicCreated struct {
	// Name of the topic
	Name string `json:"name"`

	// Color of the topic icon in RGB format
	IconColor TopicIconColor `json:"icon_color"`

	// Optional. Unique identifier of the custom emoji shown as the topic icon
	IconCustomEmojiID string `json:"icon_custom_emoji_id,omitempty"`

	// Optional. True, if the name of the topic wasn't specified explicitly by its creator and likely needs to be changed by the bot
	IsNameImplicit bool `json:"is_name_implicit,omitempty"`
}

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

type ForumTopicEdited added in v0.6.0

type ForumTopicEdited struct {
	// Optional. New name of the topic, if it was edited
	Name string `json:"name,omitempty"`

	// Optional. New identifier of the custom emoji shown as the topic icon, if it was edited; an empty string if the icon was removed
	IconCustomEmojiID string `json:"icon_custom_emoji_id,omitempty"`
}

ForumTopicEdited this object represents a service message about an edited forum topic.

type ForumTopicReopened added in v0.6.0

type ForumTopicReopened struct{}

ForumTopicReopened this object represents a service message about a forum topic reopened in the chat. Currently holds no information.

type ForwardMessageCall

type ForwardMessageCall struct {
	Call[Message]
}

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

func NewForwardMessageCall

func NewForwardMessageCall(chatID PeerID, fromChatID PeerID, messageID int) *ForwardMessageCall

NewForwardMessageCall constructs a new ForwardMessageCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • fromChatID: Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)
  • messageID: Message identifier in the chat specified in from_chat_id

func (*ForwardMessageCall) ChatID added in v0.0.5

func (call *ForwardMessageCall) ChatID(chatID PeerID) *ForwardMessageCall

ChatID sets the chat_id parameter.

func (*ForwardMessageCall) DirectMessagesTopicID added in v0.16.0

func (call *ForwardMessageCall) DirectMessagesTopicID(directMessagesTopicID int) *ForwardMessageCall

DirectMessagesTopicID sets the direct_messages_topic_id parameter.

func (*ForwardMessageCall) DisableNotification

func (call *ForwardMessageCall) DisableNotification(disableNotification bool) *ForwardMessageCall

DisableNotification sets the disable_notification parameter.

func (*ForwardMessageCall) FromChatID added in v0.0.5

func (call *ForwardMessageCall) FromChatID(fromChatID PeerID) *ForwardMessageCall

FromChatID sets the from_chat_id parameter.

func (*ForwardMessageCall) MessageEffectID added in v0.16.0

func (call *ForwardMessageCall) MessageEffectID(messageEffectID string) *ForwardMessageCall

MessageEffectID sets the message_effect_id parameter.

func (*ForwardMessageCall) MessageID added in v0.0.5

func (call *ForwardMessageCall) MessageID(messageID int) *ForwardMessageCall

MessageID sets the message_id parameter.

func (*ForwardMessageCall) MessageThreadID added in v0.6.0

func (call *ForwardMessageCall) MessageThreadID(messageThreadID int) *ForwardMessageCall

MessageThreadID sets the message_thread_id parameter.

func (*ForwardMessageCall) ProtectContent

func (call *ForwardMessageCall) ProtectContent(protectContent bool) *ForwardMessageCall

ProtectContent sets the protect_content parameter.

func (*ForwardMessageCall) SuggestedPostParameters added in v0.16.0

func (call *ForwardMessageCall) SuggestedPostParameters(suggestedPostParameters SuggestedPostParameters) *ForwardMessageCall

SuggestedPostParameters sets the suggested_post_parameters parameter.

func (*ForwardMessageCall) VideoStartTimestamp added in v0.16.0

func (call *ForwardMessageCall) VideoStartTimestamp(videoStartTimestamp int) *ForwardMessageCall

VideoStartTimestamp sets the video_start_timestamp parameter.

type ForwardMessagesCall added in v0.12.0

type ForwardMessagesCall struct {
	Call[[]MessageID]
}

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

func NewForwardMessagesCall added in v0.12.0

func NewForwardMessagesCall(chatID PeerID, fromChatID PeerID, messageIDs []int) *ForwardMessagesCall

NewForwardMessagesCall constructs a new ForwardMessagesCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • fromChatID: Unique identifier for the chat where the original messages were sent (or channel username in the format @channelusername)
  • messageIDs: A JSON-serialized list of 1-100 identifiers of messages in the chat from_chat_id to forward. The identifiers must be specified in a strictly increasing order.

func (*ForwardMessagesCall) ChatID added in v0.12.0

func (call *ForwardMessagesCall) ChatID(chatID PeerID) *ForwardMessagesCall

ChatID sets the chat_id parameter.

func (*ForwardMessagesCall) DirectMessagesTopicID added in v0.16.0

func (call *ForwardMessagesCall) DirectMessagesTopicID(directMessagesTopicID int) *ForwardMessagesCall

DirectMessagesTopicID sets the direct_messages_topic_id parameter.

func (*ForwardMessagesCall) DisableNotification added in v0.12.0

func (call *ForwardMessagesCall) DisableNotification(disableNotification bool) *ForwardMessagesCall

DisableNotification sets the disable_notification parameter.

func (*ForwardMessagesCall) FromChatID added in v0.12.0

func (call *ForwardMessagesCall) FromChatID(fromChatID PeerID) *ForwardMessagesCall

FromChatID sets the from_chat_id parameter.

func (*ForwardMessagesCall) MessageIDs added in v0.16.0

func (call *ForwardMessagesCall) MessageIDs(messageIDs []int) *ForwardMessagesCall

MessageIDs sets the message_ids parameter.

func (*ForwardMessagesCall) MessageThreadID added in v0.12.0

func (call *ForwardMessagesCall) MessageThreadID(messageThreadID int) *ForwardMessagesCall

MessageThreadID sets the message_thread_id parameter.

func (*ForwardMessagesCall) ProtectContent added in v0.12.0

func (call *ForwardMessagesCall) ProtectContent(protectContent bool) *ForwardMessagesCall

ProtectContent sets the protect_content parameter.

type Game

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

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

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

	// Optional. Brief description of the game or high scores included in the game message. Can be automatically edited to include current high scores for the game when the bot calls [Client.SetGameScore], or manually edited using [Client.EditMessageText]. 0-4096 characters.
	Text string `json:"text,omitempty"`

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

	// Optional. Animation that will be displayed in the game message in chats. Upload via [BotFather]
	//
	// [BotFather]: https://t.me/botfather
	Animation *Animation `json:"animation,omitempty"`
}

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

type GameHighScore

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

	// User
	User User `json:"user"`

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

GameHighScore this object represents one row of the high scores table for a game. And that's about all we've got for now. If you've got any questions, please check out our Bot FAQ » -

type GeneralForumTopicHidden added in v0.6.0

type GeneralForumTopicHidden struct{}

GeneralForumTopicHidden this object represents a service message about General forum topic hidden in the chat. Currently holds no information.

type GeneralForumTopicUnhidden added in v0.6.0

type GeneralForumTopicUnhidden struct{}

GeneralForumTopicUnhidden this object represents a service message about General forum topic unhidden in the chat. Currently holds no information.

type GetAvailableGiftsCall added in v0.16.0

type GetAvailableGiftsCall struct {
	Call[Gifts]
}

GetAvailableGiftsCall represents a call to the getAvailableGifts method. Returns the list of gifts that can be sent by the bot to users and channel chats. Requires no parameters. Returns a Gifts object.

func NewGetAvailableGiftsCall added in v0.16.0

func NewGetAvailableGiftsCall() *GetAvailableGiftsCall

NewGetAvailableGiftsCall constructs a new GetAvailableGiftsCall.

type GetBusinessAccountGiftsCall added in v0.16.0

type GetBusinessAccountGiftsCall struct {
	Call[OwnedGifts]
}

GetBusinessAccountGiftsCall represents a call to the getBusinessAccountGifts method. Returns the gifts received and owned by a managed business account. Requires the can_view_gifts_and_stars business bot right. Returns OwnedGifts on success.

func NewGetBusinessAccountGiftsCall added in v0.16.0

func NewGetBusinessAccountGiftsCall(businessConnectionID string) *GetBusinessAccountGiftsCall

NewGetBusinessAccountGiftsCall constructs a new GetBusinessAccountGiftsCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection

func (*GetBusinessAccountGiftsCall) BusinessConnectionID added in v0.16.0

func (call *GetBusinessAccountGiftsCall) BusinessConnectionID(businessConnectionID string) *GetBusinessAccountGiftsCall

BusinessConnectionID sets the business_connection_id parameter.

func (*GetBusinessAccountGiftsCall) ExcludeFromBlockchain added in v0.16.0

func (call *GetBusinessAccountGiftsCall) ExcludeFromBlockchain(excludeFromBlockchain bool) *GetBusinessAccountGiftsCall

ExcludeFromBlockchain sets the exclude_from_blockchain parameter.

func (*GetBusinessAccountGiftsCall) ExcludeLimitedNonUpgradable added in v0.16.0

func (call *GetBusinessAccountGiftsCall) ExcludeLimitedNonUpgradable(excludeLimitedNonUpgradable bool) *GetBusinessAccountGiftsCall

ExcludeLimitedNonUpgradable sets the exclude_limited_non_upgradable parameter.

func (*GetBusinessAccountGiftsCall) ExcludeLimitedUpgradable added in v0.16.0

func (call *GetBusinessAccountGiftsCall) ExcludeLimitedUpgradable(excludeLimitedUpgradable bool) *GetBusinessAccountGiftsCall

ExcludeLimitedUpgradable sets the exclude_limited_upgradable parameter.

func (*GetBusinessAccountGiftsCall) ExcludeSaved added in v0.16.0

func (call *GetBusinessAccountGiftsCall) ExcludeSaved(excludeSaved bool) *GetBusinessAccountGiftsCall

ExcludeSaved sets the exclude_saved parameter.

func (*GetBusinessAccountGiftsCall) ExcludeUnique added in v0.16.0

func (call *GetBusinessAccountGiftsCall) ExcludeUnique(excludeUnique bool) *GetBusinessAccountGiftsCall

ExcludeUnique sets the exclude_unique parameter.

func (*GetBusinessAccountGiftsCall) ExcludeUnlimited added in v0.16.0

func (call *GetBusinessAccountGiftsCall) ExcludeUnlimited(excludeUnlimited bool) *GetBusinessAccountGiftsCall

ExcludeUnlimited sets the exclude_unlimited parameter.

func (*GetBusinessAccountGiftsCall) ExcludeUnsaved added in v0.16.0

func (call *GetBusinessAccountGiftsCall) ExcludeUnsaved(excludeUnsaved bool) *GetBusinessAccountGiftsCall

ExcludeUnsaved sets the exclude_unsaved parameter.

func (*GetBusinessAccountGiftsCall) Limit added in v0.16.0

Limit sets the limit parameter.

func (*GetBusinessAccountGiftsCall) Offset added in v0.16.0

Offset sets the offset parameter.

func (*GetBusinessAccountGiftsCall) SortByPrice added in v0.16.0

func (call *GetBusinessAccountGiftsCall) SortByPrice(sortByPrice bool) *GetBusinessAccountGiftsCall

SortByPrice sets the sort_by_price parameter.

type GetBusinessAccountStarBalanceCall added in v0.16.0

type GetBusinessAccountStarBalanceCall struct {
	Call[StarAmount]
}

GetBusinessAccountStarBalanceCall represents a call to the getBusinessAccountStarBalance method. Returns the amount of Telegram Stars owned by a managed business account. Requires the can_view_gifts_and_stars business bot right. Returns StarAmount on success.

func NewGetBusinessAccountStarBalanceCall added in v0.16.0

func NewGetBusinessAccountStarBalanceCall(businessConnectionID string) *GetBusinessAccountStarBalanceCall

NewGetBusinessAccountStarBalanceCall constructs a new GetBusinessAccountStarBalanceCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection

func (*GetBusinessAccountStarBalanceCall) BusinessConnectionID added in v0.16.0

func (call *GetBusinessAccountStarBalanceCall) BusinessConnectionID(businessConnectionID string) *GetBusinessAccountStarBalanceCall

BusinessConnectionID sets the business_connection_id parameter.

type GetBusinessConnectionCall added in v0.15.0

type GetBusinessConnectionCall struct {
	Call[BusinessConnection]
}

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

func NewGetBusinessConnectionCall added in v0.15.0

func NewGetBusinessConnectionCall(businessConnectionID string) *GetBusinessConnectionCall

NewGetBusinessConnectionCall constructs a new GetBusinessConnectionCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection

func (*GetBusinessConnectionCall) BusinessConnectionID added in v0.15.0

func (call *GetBusinessConnectionCall) BusinessConnectionID(businessConnectionID string) *GetBusinessConnectionCall

BusinessConnectionID sets the business_connection_id parameter.

type GetChatAdministratorsCall

type GetChatAdministratorsCall struct {
	Call[[]ChatMember]
}

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

func NewGetChatAdministratorsCall

func NewGetChatAdministratorsCall(chatID PeerID) *GetChatAdministratorsCall

NewGetChatAdministratorsCall constructs a new GetChatAdministratorsCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)

func (*GetChatAdministratorsCall) ChatID added in v0.0.5

ChatID sets the chat_id parameter.

type GetChatCall

type GetChatCall struct {
	Call[ChatFullInfo]
}

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

func NewGetChatCall

func NewGetChatCall(chatID PeerID) *GetChatCall

NewGetChatCall constructs a new GetChatCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)

func (*GetChatCall) ChatID added in v0.0.5

func (call *GetChatCall) ChatID(chatID PeerID) *GetChatCall

ChatID sets the chat_id parameter.

type GetChatGiftsCall added in v0.16.0

type GetChatGiftsCall struct {
	Call[OwnedGifts]
}

GetChatGiftsCall represents a call to the getChatGifts method. Returns the gifts owned by a chat. Returns OwnedGifts on success.

func NewGetChatGiftsCall added in v0.16.0

func NewGetChatGiftsCall(chatID PeerID) *GetChatGiftsCall

NewGetChatGiftsCall constructs a new GetChatGiftsCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*GetChatGiftsCall) ChatID added in v0.16.0

func (call *GetChatGiftsCall) ChatID(chatID PeerID) *GetChatGiftsCall

ChatID sets the chat_id parameter.

func (*GetChatGiftsCall) ExcludeFromBlockchain added in v0.16.0

func (call *GetChatGiftsCall) ExcludeFromBlockchain(excludeFromBlockchain bool) *GetChatGiftsCall

ExcludeFromBlockchain sets the exclude_from_blockchain parameter.

func (*GetChatGiftsCall) ExcludeLimitedNonUpgradable added in v0.16.0

func (call *GetChatGiftsCall) ExcludeLimitedNonUpgradable(excludeLimitedNonUpgradable bool) *GetChatGiftsCall

ExcludeLimitedNonUpgradable sets the exclude_limited_non_upgradable parameter.

func (*GetChatGiftsCall) ExcludeLimitedUpgradable added in v0.16.0

func (call *GetChatGiftsCall) ExcludeLimitedUpgradable(excludeLimitedUpgradable bool) *GetChatGiftsCall

ExcludeLimitedUpgradable sets the exclude_limited_upgradable parameter.

func (*GetChatGiftsCall) ExcludeSaved added in v0.16.0

func (call *GetChatGiftsCall) ExcludeSaved(excludeSaved bool) *GetChatGiftsCall

ExcludeSaved sets the exclude_saved parameter.

func (*GetChatGiftsCall) ExcludeUnique added in v0.16.0

func (call *GetChatGiftsCall) ExcludeUnique(excludeUnique bool) *GetChatGiftsCall

ExcludeUnique sets the exclude_unique parameter.

func (*GetChatGiftsCall) ExcludeUnlimited added in v0.16.0

func (call *GetChatGiftsCall) ExcludeUnlimited(excludeUnlimited bool) *GetChatGiftsCall

ExcludeUnlimited sets the exclude_unlimited parameter.

func (*GetChatGiftsCall) ExcludeUnsaved added in v0.16.0

func (call *GetChatGiftsCall) ExcludeUnsaved(excludeUnsaved bool) *GetChatGiftsCall

ExcludeUnsaved sets the exclude_unsaved parameter.

func (*GetChatGiftsCall) Limit added in v0.16.0

func (call *GetChatGiftsCall) Limit(limit int) *GetChatGiftsCall

Limit sets the limit parameter.

func (*GetChatGiftsCall) Offset added in v0.16.0

func (call *GetChatGiftsCall) Offset(offset string) *GetChatGiftsCall

Offset sets the offset parameter.

func (*GetChatGiftsCall) SortByPrice added in v0.16.0

func (call *GetChatGiftsCall) SortByPrice(sortByPrice bool) *GetChatGiftsCall

SortByPrice sets the sort_by_price parameter.

type GetChatMemberCall

type GetChatMemberCall struct {
	Call[ChatMember]
}

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

func NewGetChatMemberCall

func NewGetChatMemberCall(chatID PeerID, userID UserID) *GetChatMemberCall

NewGetChatMemberCall constructs a new GetChatMemberCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
  • userID: Unique identifier of the target user

func (*GetChatMemberCall) ChatID added in v0.0.5

func (call *GetChatMemberCall) ChatID(chatID PeerID) *GetChatMemberCall

ChatID sets the chat_id parameter.

func (*GetChatMemberCall) UserID added in v0.0.5

func (call *GetChatMemberCall) UserID(userID UserID) *GetChatMemberCall

UserID sets the user_id parameter.

type GetChatMemberCountCall

type GetChatMemberCountCall struct {
	Call[int]
}

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

func NewGetChatMemberCountCall

func NewGetChatMemberCountCall(chatID PeerID) *GetChatMemberCountCall

NewGetChatMemberCountCall constructs a new GetChatMemberCountCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)

func (*GetChatMemberCountCall) ChatID added in v0.0.5

ChatID sets the chat_id parameter.

type GetChatMenuButtonCall

type GetChatMenuButtonCall struct {
	Call[MenuButton]
}

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

func NewGetChatMenuButtonCall

func NewGetChatMenuButtonCall() *GetChatMenuButtonCall

NewGetChatMenuButtonCall constructs a new GetChatMenuButtonCall.

func (*GetChatMenuButtonCall) ChatID added in v0.0.5

func (call *GetChatMenuButtonCall) ChatID(chatID int) *GetChatMenuButtonCall

ChatID sets the chat_id parameter.

type GetCustomEmojiStickersCall added in v0.5.0

type GetCustomEmojiStickersCall struct {
	Call[[]Sticker]
}

GetCustomEmojiStickersCall represents a call to the getCustomEmojiStickers method. Use this method to get information about custom emoji stickers by their identifiers. Returns an Array of Sticker objects.

func NewGetCustomEmojiStickersCall added in v0.5.0

func NewGetCustomEmojiStickersCall(customEmojiIDs []string) *GetCustomEmojiStickersCall

NewGetCustomEmojiStickersCall constructs a new GetCustomEmojiStickersCall.

Required params:

  • customEmojiIDs: A JSON-serialized list of custom emoji identifiers. At most 200 custom emoji identifiers can be specified.

func (*GetCustomEmojiStickersCall) CustomEmojiIDs added in v0.16.0

func (call *GetCustomEmojiStickersCall) CustomEmojiIDs(customEmojiIDs []string) *GetCustomEmojiStickersCall

CustomEmojiIDs sets the custom_emoji_ids parameter.

type GetFileCall

type GetFileCall struct {
	Call[File]
}

GetFileCall represents a call to the getFile method. Use this method to get basic information about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>, where <file_path> is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling Client.GetFile again. Note: This function may not preserve the original file name and MIME type. You should save the file's MIME type and name (if available) when the File object is received.

func NewGetFileCall

func NewGetFileCall(fileID FileID) *GetFileCall

NewGetFileCall constructs a new GetFileCall.

Required params:

  • fileID: File identifier to get information about

func (*GetFileCall) FileID added in v0.0.5

func (call *GetFileCall) FileID(fileID FileID) *GetFileCall

FileID sets the file_id parameter.

type GetForumTopicIconStickersCall added in v0.6.0

type GetForumTopicIconStickersCall struct {
	Call[[]Sticker]
}

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

func NewGetForumTopicIconStickersCall added in v0.6.0

func NewGetForumTopicIconStickersCall() *GetForumTopicIconStickersCall

NewGetForumTopicIconStickersCall constructs a new GetForumTopicIconStickersCall.

type GetGameHighScoresCall

type GetGameHighScoresCall struct {
	Call[[]GameHighScore]
}

GetGameHighScoresCall represents a call to the getGameHighScores method. Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game. Returns an Array of GameHighScore objects. This method will currently return scores for the target user, plus two of their closest neighbors on each side. Will also return the top three users if the user and their neighbors are not among them. Please note that this behavior is subject to change.

func NewGetGameHighScoresCall

func NewGetGameHighScoresCall(userID UserID) *GetGameHighScoresCall

NewGetGameHighScoresCall constructs a new GetGameHighScoresCall.

Required params:

  • userID: Target user id

func (*GetGameHighScoresCall) ChatID added in v0.0.5

func (call *GetGameHighScoresCall) ChatID(chatID int) *GetGameHighScoresCall

ChatID sets the chat_id parameter.

func (*GetGameHighScoresCall) InlineMessageID added in v0.0.5

func (call *GetGameHighScoresCall) InlineMessageID(inlineMessageID string) *GetGameHighScoresCall

InlineMessageID sets the inline_message_id parameter.

func (*GetGameHighScoresCall) MessageID added in v0.0.5

func (call *GetGameHighScoresCall) MessageID(messageID int) *GetGameHighScoresCall

MessageID sets the message_id parameter.

func (*GetGameHighScoresCall) UserID added in v0.0.5

func (call *GetGameHighScoresCall) UserID(userID UserID) *GetGameHighScoresCall

UserID sets the user_id parameter.

type GetMeCall

type GetMeCall struct {
	Call[User]
}

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

func NewGetMeCall

func NewGetMeCall() *GetMeCall

NewGetMeCall constructs a new GetMeCall.

type GetMyCommandsCall

type GetMyCommandsCall struct {
	Call[[]BotCommand]
}

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

func NewGetMyCommandsCall

func NewGetMyCommandsCall() *GetMyCommandsCall

NewGetMyCommandsCall constructs a new GetMyCommandsCall.

func (*GetMyCommandsCall) LanguageCode

func (call *GetMyCommandsCall) LanguageCode(languageCode string) *GetMyCommandsCall

LanguageCode sets the language_code parameter.

func (*GetMyCommandsCall) Scope

Scope sets the scope parameter.

type GetMyDefaultAdministratorRightsCall

type GetMyDefaultAdministratorRightsCall struct {
	Call[ChatAdministratorRights]
}

GetMyDefaultAdministratorRightsCall represents a call to the getMyDefaultAdministratorRights method. Use this method to get the current default administrator rights of the bot. Returns ChatAdministratorRights on success.

func NewGetMyDefaultAdministratorRightsCall

func NewGetMyDefaultAdministratorRightsCall() *GetMyDefaultAdministratorRightsCall

NewGetMyDefaultAdministratorRightsCall constructs a new GetMyDefaultAdministratorRightsCall.

func (*GetMyDefaultAdministratorRightsCall) ForChannels

ForChannels sets the for_channels parameter.

type GetMyDescriptionCall added in v0.8.0

type GetMyDescriptionCall struct {
	Call[BotDescription]
}

GetMyDescriptionCall represents a call to the getMyDescription method. Use this method to get the current bot description for the given user language. Returns BotDescription on success.

func NewGetMyDescriptionCall added in v0.8.0

func NewGetMyDescriptionCall() *GetMyDescriptionCall

NewGetMyDescriptionCall constructs a new GetMyDescriptionCall.

func (*GetMyDescriptionCall) LanguageCode added in v0.8.0

func (call *GetMyDescriptionCall) LanguageCode(languageCode string) *GetMyDescriptionCall

LanguageCode sets the language_code parameter.

type GetMyNameCall added in v0.9.0

type GetMyNameCall struct {
	Call[BotName]
}

GetMyNameCall represents a call to the getMyName method. Use this method to get the current bot name for the given user language. Returns BotName on success.

func NewGetMyNameCall added in v0.9.0

func NewGetMyNameCall() *GetMyNameCall

NewGetMyNameCall constructs a new GetMyNameCall.

func (*GetMyNameCall) LanguageCode added in v0.9.0

func (call *GetMyNameCall) LanguageCode(languageCode string) *GetMyNameCall

LanguageCode sets the language_code parameter.

type GetMyShortDescriptionCall added in v0.8.0

type GetMyShortDescriptionCall struct {
	Call[BotShortDescription]
}

GetMyShortDescriptionCall represents a call to the getMyShortDescription method. Use this method to get the current bot short description for the given user language. Returns BotShortDescription on success.

func NewGetMyShortDescriptionCall added in v0.8.0

func NewGetMyShortDescriptionCall() *GetMyShortDescriptionCall

NewGetMyShortDescriptionCall constructs a new GetMyShortDescriptionCall.

func (*GetMyShortDescriptionCall) LanguageCode added in v0.8.0

func (call *GetMyShortDescriptionCall) LanguageCode(languageCode string) *GetMyShortDescriptionCall

LanguageCode sets the language_code parameter.

type GetMyStarBalanceCall added in v0.16.0

type GetMyStarBalanceCall struct {
	Call[StarAmount]
}

GetMyStarBalanceCall represents a call to the getMyStarBalance method. A method to get the current Telegram Stars balance of the bot. Requires no parameters. On success, returns a StarAmount object.

func NewGetMyStarBalanceCall added in v0.16.0

func NewGetMyStarBalanceCall() *GetMyStarBalanceCall

NewGetMyStarBalanceCall constructs a new GetMyStarBalanceCall.

type GetStarTransactionsCall added in v0.16.0

type GetStarTransactionsCall struct {
	Call[StarTransactions]
}

GetStarTransactionsCall represents a call to the getStarTransactions method. Returns the bot's Telegram Star transactions in chronological order. On success, returns a StarTransactions object.

func NewGetStarTransactionsCall added in v0.16.0

func NewGetStarTransactionsCall() *GetStarTransactionsCall

NewGetStarTransactionsCall constructs a new GetStarTransactionsCall.

func (*GetStarTransactionsCall) Limit added in v0.16.0

Limit sets the limit parameter.

func (*GetStarTransactionsCall) Offset added in v0.16.0

func (call *GetStarTransactionsCall) Offset(offset int) *GetStarTransactionsCall

Offset sets the offset parameter.

type GetStickerSetCall

type GetStickerSetCall struct {
	Call[StickerSet]
}

GetStickerSetCall represents a call to the getStickerSet method. Use this method to get a sticker set. On success, a StickerSet object is returned.

func NewGetStickerSetCall

func NewGetStickerSetCall(name string) *GetStickerSetCall

NewGetStickerSetCall constructs a new GetStickerSetCall.

Required params:

  • name: Name of the sticker set

func (*GetStickerSetCall) Name

func (call *GetStickerSetCall) Name(name string) *GetStickerSetCall

Name sets the name parameter.

type GetUpdatesCall

type GetUpdatesCall struct {
	Call[[]Update]
}

GetUpdatesCall represents a call to the getUpdates method. Use this method to receive incoming updates using long polling (wiki). Returns an Array of Update objects. Notes 1. This method will not work if an outgoing webhook is set up. 2. In order to avoid getting duplicate updates, recalculate offset after each server response.

func NewGetUpdatesCall

func NewGetUpdatesCall() *GetUpdatesCall

NewGetUpdatesCall constructs a new GetUpdatesCall.

func (*GetUpdatesCall) AllowedUpdates

func (call *GetUpdatesCall) AllowedUpdates(allowedUpdates []UpdateType) *GetUpdatesCall

AllowedUpdates sets the allowed_updates parameter.

func (*GetUpdatesCall) Limit

func (call *GetUpdatesCall) Limit(limit int) *GetUpdatesCall

Limit sets the limit parameter.

func (*GetUpdatesCall) Offset

func (call *GetUpdatesCall) Offset(offset int) *GetUpdatesCall

Offset sets the offset parameter.

func (*GetUpdatesCall) Timeout

func (call *GetUpdatesCall) Timeout(timeout int) *GetUpdatesCall

Timeout sets the timeout parameter.

type GetUserChatBoostsCall added in v0.12.0

type GetUserChatBoostsCall struct {
	Call[UserChatBoosts]
}

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

func NewGetUserChatBoostsCall added in v0.12.0

func NewGetUserChatBoostsCall(chatID PeerID, userID UserID) *GetUserChatBoostsCall

NewGetUserChatBoostsCall constructs a new GetUserChatBoostsCall.

Required params:

  • chatID: Unique identifier for the chat or username of the channel (in the format @channelusername)
  • userID: Unique identifier of the target user

func (*GetUserChatBoostsCall) ChatID added in v0.12.0

func (call *GetUserChatBoostsCall) ChatID(chatID PeerID) *GetUserChatBoostsCall

ChatID sets the chat_id parameter.

func (*GetUserChatBoostsCall) UserID added in v0.12.0

func (call *GetUserChatBoostsCall) UserID(userID UserID) *GetUserChatBoostsCall

UserID sets the user_id parameter.

type GetUserGiftsCall added in v0.16.0

type GetUserGiftsCall struct {
	Call[OwnedGifts]
}

GetUserGiftsCall represents a call to the getUserGifts method. Returns the gifts owned and hosted by a user. Returns OwnedGifts on success.

func NewGetUserGiftsCall added in v0.16.0

func NewGetUserGiftsCall(userID UserID) *GetUserGiftsCall

NewGetUserGiftsCall constructs a new GetUserGiftsCall.

Required params:

  • userID: Unique identifier of the user

func (*GetUserGiftsCall) ExcludeFromBlockchain added in v0.16.0

func (call *GetUserGiftsCall) ExcludeFromBlockchain(excludeFromBlockchain bool) *GetUserGiftsCall

ExcludeFromBlockchain sets the exclude_from_blockchain parameter.

func (*GetUserGiftsCall) ExcludeLimitedNonUpgradable added in v0.16.0

func (call *GetUserGiftsCall) ExcludeLimitedNonUpgradable(excludeLimitedNonUpgradable bool) *GetUserGiftsCall

ExcludeLimitedNonUpgradable sets the exclude_limited_non_upgradable parameter.

func (*GetUserGiftsCall) ExcludeLimitedUpgradable added in v0.16.0

func (call *GetUserGiftsCall) ExcludeLimitedUpgradable(excludeLimitedUpgradable bool) *GetUserGiftsCall

ExcludeLimitedUpgradable sets the exclude_limited_upgradable parameter.

func (*GetUserGiftsCall) ExcludeUnique added in v0.16.0

func (call *GetUserGiftsCall) ExcludeUnique(excludeUnique bool) *GetUserGiftsCall

ExcludeUnique sets the exclude_unique parameter.

func (*GetUserGiftsCall) ExcludeUnlimited added in v0.16.0

func (call *GetUserGiftsCall) ExcludeUnlimited(excludeUnlimited bool) *GetUserGiftsCall

ExcludeUnlimited sets the exclude_unlimited parameter.

func (*GetUserGiftsCall) Limit added in v0.16.0

func (call *GetUserGiftsCall) Limit(limit int) *GetUserGiftsCall

Limit sets the limit parameter.

func (*GetUserGiftsCall) Offset added in v0.16.0

func (call *GetUserGiftsCall) Offset(offset string) *GetUserGiftsCall

Offset sets the offset parameter.

func (*GetUserGiftsCall) SortByPrice added in v0.16.0

func (call *GetUserGiftsCall) SortByPrice(sortByPrice bool) *GetUserGiftsCall

SortByPrice sets the sort_by_price parameter.

func (*GetUserGiftsCall) UserID added in v0.16.0

func (call *GetUserGiftsCall) UserID(userID UserID) *GetUserGiftsCall

UserID sets the user_id parameter.

type GetUserProfileAudiosCall added in v0.18.0

type GetUserProfileAudiosCall struct {
	Call[UserProfileAudios]
}

GetUserProfileAudiosCall represents a call to the getUserProfileAudios method. Use this method to get a list of profile audios for a user. Returns a UserProfileAudios object.

func NewGetUserProfileAudiosCall added in v0.18.0

func NewGetUserProfileAudiosCall(userID UserID) *GetUserProfileAudiosCall

NewGetUserProfileAudiosCall constructs a new GetUserProfileAudiosCall.

Required params:

  • userID: Unique identifier of the target user

func (*GetUserProfileAudiosCall) Limit added in v0.18.0

Limit sets the limit parameter.

func (*GetUserProfileAudiosCall) Offset added in v0.18.0

Offset sets the offset parameter.

func (*GetUserProfileAudiosCall) UserID added in v0.18.0

UserID sets the user_id parameter.

type GetUserProfilePhotosCall

type GetUserProfilePhotosCall struct {
	Call[UserProfilePhotos]
}

GetUserProfilePhotosCall represents a call to the getUserProfilePhotos method. Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object.

func NewGetUserProfilePhotosCall

func NewGetUserProfilePhotosCall(userID UserID) *GetUserProfilePhotosCall

NewGetUserProfilePhotosCall constructs a new GetUserProfilePhotosCall.

Required params:

  • userID: Unique identifier of the target user

func (*GetUserProfilePhotosCall) Limit

Limit sets the limit parameter.

func (*GetUserProfilePhotosCall) Offset

Offset sets the offset parameter.

func (*GetUserProfilePhotosCall) UserID added in v0.0.5

UserID sets the user_id parameter.

type GetWebhookInfoCall

type GetWebhookInfoCall struct {
	Call[WebhookInfo]
}

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

func NewGetWebhookInfoCall

func NewGetWebhookInfoCall() *GetWebhookInfoCall

NewGetWebhookInfoCall constructs a new GetWebhookInfoCall.

type Gift added in v0.16.0

type Gift struct {
	// Unique identifier of the gift
	ID string `json:"id"`

	// The sticker that represents the gift
	Sticker Sticker `json:"sticker"`

	// The number of Telegram Stars that must be paid to send the sticker
	StarCount int `json:"star_count"`

	// Optional. The number of Telegram Stars that must be paid to upgrade the gift to a unique one
	UpgradeStarCount int `json:"upgrade_star_count,omitempty"`

	// Optional. True, if the gift can only be purchased by Telegram Premium subscribers
	IsPremium bool `json:"is_premium,omitempty"`

	// Optional. True, if the gift can be used (after being upgraded) to customize a user's appearance
	HasColors bool `json:"has_colors,omitempty"`

	// Optional. The total number of gifts of this type that can be sent by all users; for limited gifts only
	TotalCount int `json:"total_count,omitempty"`

	// Optional. The number of remaining gifts of this type that can be sent by all users; for limited gifts only
	RemainingCount int `json:"remaining_count,omitempty"`

	// Optional. The total number of gifts of this type that can be sent by the bot; for limited gifts only
	PersonalTotalCount int `json:"personal_total_count,omitempty"`

	// Optional. The number of remaining gifts of this type that can be sent by the bot; for limited gifts only
	PersonalRemainingCount int `json:"personal_remaining_count,omitempty"`

	// Optional. Background of the gift
	Background *GiftBackground `json:"background,omitempty"`

	// Optional. The total number of different unique gifts that can be obtained by upgrading the gift
	UniqueGiftVariantCount int `json:"unique_gift_variant_count,omitempty"`

	// Optional. Information about the chat that published the gift
	PublisherChat *Chat `json:"publisher_chat,omitempty"`
}

Gift this object represents a gift that can be sent by the bot.

type GiftBackground added in v0.16.0

type GiftBackground struct {
	// Center color of the background in RGB format
	CenterColor int `json:"center_color"`

	// Edge color of the background in RGB format
	EdgeColor int `json:"edge_color"`

	// Text color of the background in RGB format
	TextColor int `json:"text_color"`
}

GiftBackground this object describes the background of a gift.

type GiftInfo added in v0.16.0

type GiftInfo struct {
	// Information about the gift
	Gift Gift `json:"gift"`

	// Optional. Unique identifier of the received gift for the bot; only present for gifts received on behalf of business accounts
	OwnedGiftID string `json:"owned_gift_id,omitempty"`

	// Optional. Number of Telegram Stars that can be claimed by the receiver by converting the gift; omitted if conversion to Telegram Stars is impossible
	ConvertStarCount int `json:"convert_star_count,omitempty"`

	// Optional. Number of Telegram Stars that were prepaid for the ability to upgrade the gift
	PrepaidUpgradeStarCount int `json:"prepaid_upgrade_star_count,omitempty"`

	// Optional. True, if the gift's upgrade was purchased after the gift was sent
	IsUpgradeSeparate bool `json:"is_upgrade_separate,omitempty"`

	// Optional. True, if the gift can be upgraded to a unique gift
	CanBeUpgraded bool `json:"can_be_upgraded,omitempty"`

	// Optional. Text of the message that was added to the gift
	Text string `json:"text,omitempty"`

	// Optional. Special entities that appear in the text
	Entities []MessageEntity `json:"entities,omitempty"`

	// Optional. True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them
	IsPrivate bool `json:"is_private,omitempty"`

	// Optional. Unique number reserved for this gift when upgraded. See the number field in [UniqueGift]
	UniqueGiftNumber int `json:"unique_gift_number,omitempty"`
}

GiftInfo describes a service message about a regular gift that was sent or received.

type GiftPremiumSubscriptionCall added in v0.16.0

type GiftPremiumSubscriptionCall struct {
	CallNoResult
}

GiftPremiumSubscriptionCall represents a call to the giftPremiumSubscription method. Gifts a Telegram Premium subscription to the given user. Returns True on success.

func NewGiftPremiumSubscriptionCall added in v0.16.0

func NewGiftPremiumSubscriptionCall(userID UserID, monthCount int, starCount int) *GiftPremiumSubscriptionCall

NewGiftPremiumSubscriptionCall constructs a new GiftPremiumSubscriptionCall.

Required params:

  • userID: Unique identifier of the target user who will receive a Telegram Premium subscription
  • monthCount: Number of months the Telegram Premium subscription will be active for the user; must be one of 3, 6, or 12
  • starCount: Number of Telegram Stars to pay for the Telegram Premium subscription; must be 1000 for 3 months, 1500 for 6 months, and 2500 for 12 months

func (*GiftPremiumSubscriptionCall) MonthCount added in v0.16.0

func (call *GiftPremiumSubscriptionCall) MonthCount(monthCount int) *GiftPremiumSubscriptionCall

MonthCount sets the month_count parameter.

func (*GiftPremiumSubscriptionCall) StarCount added in v0.16.0

func (call *GiftPremiumSubscriptionCall) StarCount(starCount int) *GiftPremiumSubscriptionCall

StarCount sets the star_count parameter.

func (*GiftPremiumSubscriptionCall) Text added in v0.16.0

Text sets the text parameter.

func (*GiftPremiumSubscriptionCall) TextEntities added in v0.16.0

func (call *GiftPremiumSubscriptionCall) TextEntities(textEntities []MessageEntity) *GiftPremiumSubscriptionCall

TextEntities sets the text_entities parameter.

func (*GiftPremiumSubscriptionCall) TextParseMode added in v0.16.0

func (call *GiftPremiumSubscriptionCall) TextParseMode(textParseMode string) *GiftPremiumSubscriptionCall

TextParseMode sets the text_parse_mode parameter.

func (*GiftPremiumSubscriptionCall) UserID added in v0.16.0

UserID sets the user_id parameter.

type Gifts added in v0.16.0

type Gifts struct {
	// The list of gifts
	Gifts []Gift `json:"gifts"`
}

Gifts this object represent a list of gifts.

type Giveaway added in v0.12.0

type Giveaway struct {
	// The list of chats which the user must join to participate in the giveaway
	Chats []Chat `json:"chats"`

	// Point in time (Unix timestamp) when winners of the giveaway will be selected
	WinnersSelectionDate UnixTime `json:"winners_selection_date"`

	// The number of users which are supposed to be selected as winners of the giveaway
	WinnerCount int `json:"winner_count"`

	// Optional. True, if only users who join the chats after the giveaway started should be eligible to win
	OnlyNewMembers bool `json:"only_new_members,omitempty"`

	// Optional. True, if the list of giveaway winners will be visible to everyone
	HasPublicWinners bool `json:"has_public_winners,omitempty"`

	// Optional. Description of additional giveaway prize
	PrizeDescription string `json:"prize_description,omitempty"`

	// Optional. A list of two-letter [ISO 3166-1 alpha-2] country codes indicating the countries from which eligible users for the giveaway must come. If empty, then all users can participate in the giveaway. Users with a phone number that was bought on Fragment can always participate in giveaways.
	//
	// [ISO 3166-1 alpha-2]: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
	CountryCodes []string `json:"country_codes,omitempty"`

	// Optional. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only
	PrizeStarCount int `json:"prize_star_count,omitempty"`

	// Optional. The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only
	PremiumSubscriptionMonthCount int `json:"premium_subscription_month_count,omitempty"`
}

Giveaway this object represents a message about a scheduled giveaway.

type GiveawayCompleted added in v0.12.0

type GiveawayCompleted struct {
	// Number of winners in the giveaway
	WinnerCount int `json:"winner_count"`

	// Optional. Number of undistributed prizes
	UnclaimedPrizeCount int `json:"unclaimed_prize_count,omitempty"`

	// Optional. Message with the giveaway that was completed, if it wasn't deleted
	GiveawayMessage *Message `json:"giveaway_message,omitempty"`

	// Optional. True, if the giveaway is a Telegram Star giveaway. Otherwise, currently, the giveaway is a Telegram Premium giveaway.
	IsStarGiveaway bool `json:"is_star_giveaway,omitempty"`
}

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

type GiveawayCreated added in v0.12.0

type GiveawayCreated struct {
	// Optional. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only
	PrizeStarCount int `json:"prize_star_count,omitempty"`
}

GiveawayCreated this object represents a service message about the creation of a scheduled giveaway.

type GiveawayWinners added in v0.12.0

type GiveawayWinners struct {
	// The chat that created the giveaway
	Chat Chat `json:"chat"`

	// Identifier of the message with the giveaway in the chat
	GiveawayMessageID int `json:"giveaway_message_id"`

	// Point in time (Unix timestamp) when winners of the giveaway were selected
	WinnersSelectionDate UnixTime `json:"winners_selection_date"`

	// Total number of winners in the giveaway
	WinnerCount int `json:"winner_count"`

	// List of up to 100 winners of the giveaway
	Winners []User `json:"winners"`

	// Optional. The number of other chats the user had to join in order to be eligible for the giveaway
	AdditionalChatCount int `json:"additional_chat_count,omitempty"`

	// Optional. The number of Telegram Stars that were split between giveaway winners; for Telegram Star giveaways only
	PrizeStarCount int `json:"prize_star_count,omitempty"`

	// Optional. The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only
	PremiumSubscriptionMonthCount int `json:"premium_subscription_month_count,omitempty"`

	// Optional. Number of undistributed prizes
	UnclaimedPrizeCount int `json:"unclaimed_prize_count,omitempty"`

	// Optional. True, if only users who had joined the chats after the giveaway started were eligible to win
	OnlyNewMembers bool `json:"only_new_members,omitempty"`

	// Optional. True, if the giveaway was canceled because the payment for it was refunded
	WasRefunded bool `json:"was_refunded,omitempty"`

	// Optional. Description of additional giveaway prize
	PrizeDescription string `json:"prize_description,omitempty"`
}

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

type HideGeneralForumTopicCall added in v0.6.0

type HideGeneralForumTopicCall struct {
	CallNoResult
}

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

func NewHideGeneralForumTopicCall added in v0.6.0

func NewHideGeneralForumTopicCall(chatID PeerID) *HideGeneralForumTopicCall

NewHideGeneralForumTopicCall constructs a new HideGeneralForumTopicCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

func (*HideGeneralForumTopicCall) ChatID added in v0.6.0

ChatID sets the chat_id parameter.

type InaccessibleMessage added in v0.12.0

type InaccessibleMessage struct {
	// Chat the message belonged to
	Chat Chat `json:"chat"`

	// Unique message identifier inside the chat
	MessageID int `json:"message_id"`

	// Always 0. The field can be used to differentiate regular and inaccessible messages.
	Date UnixTime `json:"date"`
}

InaccessibleMessage this object describes a message that was deleted or is otherwise inaccessible to the bot.

type InlineKeyboard added in v0.17.0

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

InlineKeyboard is a builder for inline keyboards with a fluent API.

Both InlineKeyboard.Row and InlineKeyboard.Adjust commit uncommitted buttons added via InlineKeyboard.Button or shorthand methods like InlineKeyboard.Callback. Previously committed rows are never affected.

InlineKeyboard implements ReplyMarkup and can be passed directly to .ReplyMarkup(). Use InlineKeyboard.Markup when you need the underlying InlineKeyboardMarkup value.

func NewInlineKeyboard added in v0.17.0

func NewInlineKeyboard() *InlineKeyboard

NewInlineKeyboard creates a new InlineKeyboard builder.

func (*InlineKeyboard) Adjust added in v0.17.0

func (b *InlineKeyboard) Adjust(sizes ...int) *InlineKeyboard

Adjust redistributes uncommitted buttons into rows following a repeating size pattern. For example, Adjust(2,1) produces rows of 2, 1, 2, 1, … buttons. Empty sizes default to [1]. Previously committed rows are not affected.

func (*InlineKeyboard) Button added in v0.17.0

func (b *InlineKeyboard) Button(buttons ...InlineKeyboardButton) *InlineKeyboard

Button adds pre-built InlineKeyboardButton values to the current (uncommitted) row.

func (*InlineKeyboard) Callback added in v0.17.0

func (b *InlineKeyboard) Callback(text, callbackData string) *InlineKeyboard

Callback adds a callback button with the given text and data.

func (*InlineKeyboard) CallbackGame added in v0.17.0

func (b *InlineKeyboard) CallbackGame(text string) *InlineKeyboard

CallbackGame adds a callback game button.

func (*InlineKeyboard) CopyText added in v0.17.0

func (b *InlineKeyboard) CopyText(text string, copyText CopyTextButton) *InlineKeyboard

CopyText adds a copy-text button.

func (*InlineKeyboard) LoginURL added in v0.17.0

func (b *InlineKeyboard) LoginURL(text string, loginURL LoginURL) *InlineKeyboard

LoginURL adds a login URL button.

func (*InlineKeyboard) Markup added in v0.17.0

Markup flushes any remaining uncommitted buttons as the last row and returns the resulting InlineKeyboardMarkup.

func (*InlineKeyboard) MarshalJSON added in v0.17.0

func (b *InlineKeyboard) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler. It serializes the builder as an InlineKeyboardMarkup.

func (*InlineKeyboard) Pay added in v0.17.0

func (b *InlineKeyboard) Pay(text string) *InlineKeyboard

Pay adds a pay button.

func (*InlineKeyboard) Row added in v0.17.0

func (b *InlineKeyboard) Row() *InlineKeyboard

Row commits the current buttons as a completed row. Subsequent buttons go into a new row.

func (*InlineKeyboard) SwitchInlineQuery added in v0.17.0

func (b *InlineKeyboard) SwitchInlineQuery(text, query string) *InlineKeyboard

SwitchInlineQuery adds a switch inline query button.

func (*InlineKeyboard) SwitchInlineQueryChosenChat added in v0.17.0

func (b *InlineKeyboard) SwitchInlineQueryChosenChat(text string, chosen SwitchInlineQueryChosenChat) *InlineKeyboard

SwitchInlineQueryChosenChat adds a switch inline query button with chat selection.

func (*InlineKeyboard) SwitchInlineQueryCurrentChat added in v0.17.0

func (b *InlineKeyboard) SwitchInlineQueryCurrentChat(text, query string) *InlineKeyboard

SwitchInlineQueryCurrentChat adds a switch inline query button for the current chat.

func (*InlineKeyboard) URL added in v0.17.0

func (b *InlineKeyboard) URL(text, url string) *InlineKeyboard

URL adds a URL button.

func (*InlineKeyboard) WebApp added in v0.17.0

func (b *InlineKeyboard) WebApp(text, url string) *InlineKeyboard

WebApp adds a Web App button.

type InlineKeyboardButton

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

	// Optional. Unique identifier of the custom emoji shown before the text of the button. Can only be used by bots that purchased additional usernames on [Fragment] or in the messages directly sent by the bot to private, group and supergroup chats if the owner of the bot has a Telegram Premium subscription.
	//
	// [Fragment]: https://fragment.com
	IconCustomEmojiID string `json:"icon_custom_emoji_id,omitempty"`

	// Optional. Style of the button. Must be one of “danger” (red), “success” (green) or “primary” (blue). If omitted, then an app-specific style is used.
	Style ButtonStyle `json:"style,omitempty"`

	// Optional. HTTP or tg:// URL to be opened when the button is pressed. Links tg://user?id=<user_id> can be used to mention a user by their identifier without using a username, if this is allowed by their privacy settings.
	URL string `json:"url,omitempty"`

	// Optional. Data to be sent in a [CallbackQuery] to the bot when the button is pressed, 1-64 bytes
	CallbackData string `json:"callback_data,omitempty"`

	// Optional. Description of the [Web App] that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method [Client.AnswerWebAppQuery]. Available only in private chats between a user and the bot. Not supported for messages sent on behalf of a Telegram Business account.
	//
	// [Web App]: https://core.telegram.org/bots/webapps
	WebApp *WebAppInfo `json:"web_app,omitempty"`

	// Optional. An HTTPS URL used to automatically authorize the user. Can be used as a replacement for the [Telegram Login Widget].
	//
	// [Telegram Login Widget]: https://core.telegram.org/widgets/login
	LoginURL *LoginURL `json:"login_url,omitempty"`

	// Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted. Not supported for messages sent in channel direct messages chats and on behalf of a Telegram Business account.
	SwitchInlineQuery string `json:"switch_inline_query,omitempty"`

	// Optional. If set, pressing the button will insert the bot's username and the specified inline query in the current chat's input field. May be empty, in which case only the bot's username will be inserted.  This offers a quick way for the user to open your bot in inline mode in the same chat - good for selecting something from multiple options. Not supported in channels and for messages sent in channel direct messages chats and on behalf of a Telegram Business account.
	SwitchInlineQueryCurrentChat string `json:"switch_inline_query_current_chat,omitempty"`

	// Optional. If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot's username and the specified inline query in the input field. Not supported for messages sent in channel direct messages chats and on behalf of a Telegram Business account.
	SwitchInlineQueryChosenChat *SwitchInlineQueryChosenChat `json:"switch_inline_query_chosen_chat,omitempty"`

	// Optional. Description of the button that copies the specified text to the clipboard.
	CopyText *CopyTextButton `json:"copy_text,omitempty"`

	// Optional. Description of the game that will be launched when the user presses the button.  NOTE: This type of button must always be the first button in the first row.
	CallbackGame *CallbackGame `json:"callback_game,omitempty"`

	// Optional. Specify True, to send a [Pay button]. Substrings “⭐” and “XTR” in the buttons's text will be replaced with a Telegram Star icon.  NOTE: This type of button must always be the first button in the first row and can only be used in invoice messages.
	//
	// [Pay button]: https://core.telegram.org/bots/api#payments
	Pay bool `json:"pay,omitempty"`
}

InlineKeyboardButton this object represents one button of an inline keyboard. Exactly one of the fields other than text, icon_custom_emoji_id, and style must be used to specify the type of the button.

func NewInlineKeyboardButtonCallbackData added in v0.16.0

func NewInlineKeyboardButtonCallbackData(text string, callbackData string) InlineKeyboardButton

NewInlineKeyboardButtonCallbackData creates InlineKeyboardButton with CallbackData.

func NewInlineKeyboardButtonCallbackGame added in v0.0.2

func NewInlineKeyboardButtonCallbackGame(text string) InlineKeyboardButton

NewInlineKeyboardButtonCallbackGame creates InlineKeyboardButton with CallbackGame.

func NewInlineKeyboardButtonCopyText added in v0.16.0

func NewInlineKeyboardButtonCopyText(text string, copyText CopyTextButton) InlineKeyboardButton

NewInlineKeyboardButtonCopyText creates InlineKeyboardButton with CopyText.

func NewInlineKeyboardButtonLoginURL added in v0.0.2

func NewInlineKeyboardButtonLoginURL(text string, loginURL LoginURL) InlineKeyboardButton

NewInlineKeyboardButtonLoginURL creates InlineKeyboardButton with LoginURL.

func NewInlineKeyboardButtonPay added in v0.0.2

func NewInlineKeyboardButtonPay(text string) InlineKeyboardButton

NewInlineKeyboardButtonPay creates InlineKeyboardButton with Pay.

func NewInlineKeyboardButtonSwitchInlineQuery added in v0.0.2

func NewInlineKeyboardButtonSwitchInlineQuery(text string, switchInlineQuery string) InlineKeyboardButton

NewInlineKeyboardButtonSwitchInlineQuery creates InlineKeyboardButton with SwitchInlineQuery.

func NewInlineKeyboardButtonSwitchInlineQueryChosenChat added in v0.16.0

func NewInlineKeyboardButtonSwitchInlineQueryChosenChat(text string, switchInlineQueryChosenChat SwitchInlineQueryChosenChat) InlineKeyboardButton

NewInlineKeyboardButtonSwitchInlineQueryChosenChat creates InlineKeyboardButton with SwitchInlineQueryChosenChat.

func NewInlineKeyboardButtonSwitchInlineQueryCurrentChat added in v0.0.2

func NewInlineKeyboardButtonSwitchInlineQueryCurrentChat(text string, switchInlineQueryCurrentChat string) InlineKeyboardButton

NewInlineKeyboardButtonSwitchInlineQueryCurrentChat creates InlineKeyboardButton with SwitchInlineQueryCurrentChat.

func NewInlineKeyboardButtonURL added in v0.0.2

func NewInlineKeyboardButtonURL(text string, url string) InlineKeyboardButton

NewInlineKeyboardButtonURL creates InlineKeyboardButton with URL.

func NewInlineKeyboardButtonWebApp added in v0.0.2

func NewInlineKeyboardButtonWebApp(text string, webApp WebAppInfo) InlineKeyboardButton

NewInlineKeyboardButtonWebApp creates InlineKeyboardButton with WebApp.

func (InlineKeyboardButton) WithIconCustomEmojiID added in v0.18.0

func (v InlineKeyboardButton) WithIconCustomEmojiID(iconCustomEmojiID string) InlineKeyboardButton

WithIconCustomEmojiID sets the IconCustomEmojiID field.

func (InlineKeyboardButton) WithStyle added in v0.18.0

WithStyle sets the Style field.

type InlineKeyboardMarkup

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

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

func NewInlineKeyboardMarkup added in v0.0.2

func NewInlineKeyboardMarkup(inlineKeyboard ...[]InlineKeyboardButton) InlineKeyboardMarkup

NewInlineKeyboardMarkup creates a new InlineKeyboardMarkup.

func (InlineKeyboardMarkup) Ptr added in v0.0.3

type InlineQuery

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

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

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

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

	// Optional. Type of the chat from which the inline query was sent. Can be either “sender” for a private chat with the inline query sender, “private”, “group”, “supergroup”, or “channel”. The chat type should be always known for requests sent from official clients and most third-party clients, unless the request was sent from a secret chat
	ChatType ChatType `json:"chat_type,omitempty"`

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

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

type InlineQueryResult

InlineQueryResult this object represents one result of an inline query. Telegram clients currently support results of the following 20 types: Note: All URLs passed in inline query results will be available to end users and therefore must be assumed to be public.

func InlineQueryResultOf added in v0.17.0

func InlineQueryResultOf(values ...InlineQueryResultClass) []InlineQueryResult

InlineQueryResultOf converts InlineQueryResultClass arguments to a slice of InlineQueryResult.

func (InlineQueryResult) AsInlineQueryResult added in v0.17.0

func (u InlineQueryResult) AsInlineQueryResult() InlineQueryResult

AsInlineQueryResult returns the union as-is, implementing InlineQueryResultClass.

func (*InlineQueryResult) IsUnknown added in v0.16.0

func (u *InlineQueryResult) IsUnknown() bool

IsUnknown reports whether this union contains an unknown variant. This can happen when the API returns a new variant not yet supported by this library.

func (InlineQueryResult) MarshalJSON added in v0.16.0

func (u InlineQueryResult) MarshalJSON() ([]byte, error)

func (*InlineQueryResult) Type added in v0.16.0

Type returns the discriminator value for this union.

type InlineQueryResultArticle

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

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

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

	// Optional. [Inline keyboard] attached to the message
	//
	// [Inline keyboard]: https://core.telegram.org/bots/features#inline-keyboards
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

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

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

	// Optional. Url of the thumbnail for the result
	ThumbnailURL string `json:"thumbnail_url,omitempty"`

	// Optional. Thumbnail width
	ThumbnailWidth int `json:"thumbnail_width,omitempty"`

	// Optional. Thumbnail height
	ThumbnailHeight int `json:"thumbnail_height,omitempty"`
}

InlineQueryResultArticle represents a link to an article or web page.

func NewInlineQueryResultArticle added in v0.16.0

func NewInlineQueryResultArticle(id string, title string, inputMessageContent InputMessageContent) *InlineQueryResultArticle

NewInlineQueryResultArticle creates a new InlineQueryResultArticle.

func (*InlineQueryResultArticle) AsInlineQueryResult added in v0.17.0

func (v *InlineQueryResultArticle) AsInlineQueryResult() InlineQueryResult

AsInlineQueryResult wraps the variant into a InlineQueryResult union.

func (*InlineQueryResultArticle) WithDescription added in v0.17.0

func (v *InlineQueryResultArticle) WithDescription(description string) *InlineQueryResultArticle

WithDescription sets the Description field.

func (*InlineQueryResultArticle) WithReplyMarkup added in v0.17.0

WithReplyMarkup sets the ReplyMarkup field.

func (*InlineQueryResultArticle) WithThumbnailHeight added in v0.17.0

func (v *InlineQueryResultArticle) WithThumbnailHeight(thumbnailHeight int) *InlineQueryResultArticle

WithThumbnailHeight sets the ThumbnailHeight field.

func (*InlineQueryResultArticle) WithThumbnailURL added in v0.17.0

func (v *InlineQueryResultArticle) WithThumbnailURL(thumbnailURL string) *InlineQueryResultArticle

WithThumbnailURL sets the ThumbnailURL field.

func (*InlineQueryResultArticle) WithThumbnailWidth added in v0.17.0

func (v *InlineQueryResultArticle) WithThumbnailWidth(thumbnailWidth int) *InlineQueryResultArticle

WithThumbnailWidth sets the ThumbnailWidth field.

func (*InlineQueryResultArticle) WithURL added in v0.17.0

WithURL sets the URL field.

type InlineQueryResultAudio

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

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

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

	// Optional. Caption, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`

	// Optional. Mode for parsing entities in the audio caption. See [formatting options] for more details.
	//
	// [formatting options]: https://core.telegram.org/bots/api#formatting-options
	ParseMode ParseMode `json:"parse_mode,omitempty"`

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

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

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

	// Optional. [Inline keyboard] attached to the message
	//
	// [Inline keyboard]: https://core.telegram.org/bots/features#inline-keyboards
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

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

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

func NewInlineQueryResultAudio added in v0.16.0

func NewInlineQueryResultAudio(id string, audioURL string, title string) *InlineQueryResultAudio

NewInlineQueryResultAudio creates a new InlineQueryResultAudio.

func (*InlineQueryResultAudio) AsInlineQueryResult added in v0.17.0

func (v *InlineQueryResultAudio) AsInlineQueryResult() InlineQueryResult

AsInlineQueryResult wraps the variant into a InlineQueryResult union.

func (*InlineQueryResultAudio) WithAudioDuration added in v0.17.0

func (v *InlineQueryResultAudio) WithAudioDuration(audioDuration int) *InlineQueryResultAudio

WithAudioDuration sets the AudioDuration field.

func (*InlineQueryResultAudio) WithCaption added in v0.17.0

func (v *InlineQueryResultAudio) WithCaption(caption string) *InlineQueryResultAudio

WithCaption sets the Caption field.

func (*InlineQueryResultAudio) WithCaptionEntities added in v0.17.0

func (v *InlineQueryResultAudio) WithCaptionEntities(captionEntities []MessageEntity) *InlineQueryResultAudio

WithCaptionEntities sets the CaptionEntities field.

func (*InlineQueryResultAudio) WithInputMessageContent added in v0.17.0

func (v *InlineQueryResultAudio) WithInputMessageContent(inputMessageContent InputMessageContent) *InlineQueryResultAudio

WithInputMessageContent sets the InputMessageContent field.

func (*InlineQueryResultAudio) WithParseMode added in v0.17.0

func (v *InlineQueryResultAudio) WithParseMode(parseMode ParseMode) *InlineQueryResultAudio

WithParseMode sets the ParseMode field.

func (*InlineQueryResultAudio) WithPerformer added in v0.17.0

func (v *InlineQueryResultAudio) WithPerformer(performer string) *InlineQueryResultAudio

WithPerformer sets the Performer field.

func (*InlineQueryResultAudio) WithReplyMarkup added in v0.17.0

func (v *InlineQueryResultAudio) WithReplyMarkup(replyMarkup InlineKeyboardMarkup) *InlineQueryResultAudio

WithReplyMarkup sets the ReplyMarkup field.

type InlineQueryResultCachedAudio

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

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

	// Optional. Caption, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`

	// Optional. Mode for parsing entities in the audio caption. See [formatting options] for more details.
	//
	// [formatting options]: https://core.telegram.org/bots/api#formatting-options
	ParseMode ParseMode `json:"parse_mode,omitempty"`

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

	// Optional. [Inline keyboard] attached to the message
	//
	// [Inline keyboard]: https://core.telegram.org/bots/features#inline-keyboards
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

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

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

func NewInlineQueryResultCachedAudio added in v0.16.0

func NewInlineQueryResultCachedAudio(id string, audioFileID FileID) *InlineQueryResultCachedAudio

NewInlineQueryResultCachedAudio creates a new InlineQueryResultCachedAudio.

func (*InlineQueryResultCachedAudio) AsInlineQueryResult added in v0.17.0

func (v *InlineQueryResultCachedAudio) AsInlineQueryResult() InlineQueryResult

AsInlineQueryResult wraps the variant into a InlineQueryResult union.

func (*InlineQueryResultCachedAudio) WithCaption added in v0.17.0

WithCaption sets the Caption field.

func (*InlineQueryResultCachedAudio) WithCaptionEntities added in v0.17.0

func (v *InlineQueryResultCachedAudio) WithCaptionEntities(captionEntities []MessageEntity) *InlineQueryResultCachedAudio

WithCaptionEntities sets the CaptionEntities field.

func (*InlineQueryResultCachedAudio) WithInputMessageContent added in v0.17.0

func (v *InlineQueryResultCachedAudio) WithInputMessageContent(inputMessageContent InputMessageContent) *InlineQueryResultCachedAudio

WithInputMessageContent sets the InputMessageContent field.

func (*InlineQueryResultCachedAudio) WithParseMode added in v0.17.0

WithParseMode sets the ParseMode field.

func (*InlineQueryResultCachedAudio) WithReplyMarkup added in v0.17.0

WithReplyMarkup sets the ReplyMarkup field.

type InlineQueryResultCachedDocument

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

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

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

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

	// Optional. Caption of the document to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`

	// Optional. Mode for parsing entities in the document caption. See [formatting options] for more details.
	//
	// [formatting options]: https://core.telegram.org/bots/api#formatting-options
	ParseMode ParseMode `json:"parse_mode,omitempty"`

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

	// Optional. [Inline keyboard] attached to the message
	//
	// [Inline keyboard]: https://core.telegram.org/bots/features#inline-keyboards
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

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

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

func NewInlineQueryResultCachedDocument added in v0.16.0

func NewInlineQueryResultCachedDocument(id string, title string, documentFileID FileID) *InlineQueryResultCachedDocument

NewInlineQueryResultCachedDocument creates a new InlineQueryResultCachedDocument.

func (*InlineQueryResultCachedDocument) AsInlineQueryResult added in v0.17.0

func (v *InlineQueryResultCachedDocument) AsInlineQueryResult() InlineQueryResult

AsInlineQueryResult wraps the variant into a InlineQueryResult union.

func (*InlineQueryResultCachedDocument) WithCaption added in v0.17.0

WithCaption sets the Caption field.

func (*InlineQueryResultCachedDocument) WithCaptionEntities added in v0.17.0

func (v *InlineQueryResultCachedDocument) WithCaptionEntities(captionEntities []MessageEntity) *InlineQueryResultCachedDocument

WithCaptionEntities sets the CaptionEntities field.

func (*InlineQueryResultCachedDocument) WithDescription added in v0.17.0

WithDescription sets the Description field.

func (*InlineQueryResultCachedDocument) WithInputMessageContent added in v0.17.0

func (v *InlineQueryResultCachedDocument) WithInputMessageContent(inputMessageContent InputMessageContent) *InlineQueryResultCachedDocument

WithInputMessageContent sets the InputMessageContent field.

func (*InlineQueryResultCachedDocument) WithParseMode added in v0.17.0

WithParseMode sets the ParseMode field.

func (*InlineQueryResultCachedDocument) WithReplyMarkup added in v0.17.0

WithReplyMarkup sets the ReplyMarkup field.

type InlineQueryResultCachedGIF added in v0.0.5

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

	// A valid file identifier for the GIF file
	GIFFileID FileID `json:"gif_file_id"`

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

	// Optional. Caption of the GIF file to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`

	// Optional. Mode for parsing entities in the caption. See [formatting options] for more details.
	//
	// [formatting options]: https://core.telegram.org/bots/api#formatting-options
	ParseMode ParseMode `json:"parse_mode,omitempty"`

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

	// Optional. Pass True, if the caption must be shown above the message media
	ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`

	// Optional. [Inline keyboard] attached to the message
	//
	// [Inline keyboard]: https://core.telegram.org/bots/features#inline-keyboards
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

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

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

func NewInlineQueryResultCachedGIF added in v0.16.0

func NewInlineQueryResultCachedGIF(id string, gifFileID FileID) *InlineQueryResultCachedGIF

NewInlineQueryResultCachedGIF creates a new InlineQueryResultCachedGIF.

func (*InlineQueryResultCachedGIF) AsInlineQueryResult added in v0.17.0

func (v *InlineQueryResultCachedGIF) AsInlineQueryResult() InlineQueryResult

AsInlineQueryResult wraps the variant into a InlineQueryResult union.

func (*InlineQueryResultCachedGIF) WithCaption added in v0.17.0

WithCaption sets the Caption field.

func (*InlineQueryResultCachedGIF) WithCaptionEntities added in v0.17.0

func (v *InlineQueryResultCachedGIF) WithCaptionEntities(captionEntities []MessageEntity) *InlineQueryResultCachedGIF

WithCaptionEntities sets the CaptionEntities field.

func (*InlineQueryResultCachedGIF) WithInputMessageContent added in v0.17.0

func (v *InlineQueryResultCachedGIF) WithInputMessageContent(inputMessageContent InputMessageContent) *InlineQueryResultCachedGIF

WithInputMessageContent sets the InputMessageContent field.

func (*InlineQueryResultCachedGIF) WithParseMode added in v0.17.0

WithParseMode sets the ParseMode field.

func (*InlineQueryResultCachedGIF) WithReplyMarkup added in v0.17.0

WithReplyMarkup sets the ReplyMarkup field.

func (*InlineQueryResultCachedGIF) WithShowCaptionAboveMedia added in v0.17.0

func (v *InlineQueryResultCachedGIF) WithShowCaptionAboveMedia() *InlineQueryResultCachedGIF

WithShowCaptionAboveMedia sets the ShowCaptionAboveMedia field.

func (*InlineQueryResultCachedGIF) WithTitle added in v0.17.0

WithTitle sets the Title field.

type InlineQueryResultCachedMPEG4GIF added in v0.0.5

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

	// A valid file identifier for the MPEG4 file
	MPEG4FileID FileID `json:"mpeg4_file_id"`

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

	// Optional. Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`

	// Optional. Mode for parsing entities in the caption. See [formatting options] for more details.
	//
	// [formatting options]: https://core.telegram.org/bots/api#formatting-options
	ParseMode ParseMode `json:"parse_mode,omitempty"`

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

	// Optional. Pass True, if the caption must be shown above the message media
	ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`

	// Optional. [Inline keyboard] attached to the message
	//
	// [Inline keyboard]: https://core.telegram.org/bots/features#inline-keyboards
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

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

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

func NewInlineQueryResultCachedMPEG4GIF added in v0.16.0

func NewInlineQueryResultCachedMPEG4GIF(id string, mpeG4FileID FileID) *InlineQueryResultCachedMPEG4GIF

NewInlineQueryResultCachedMPEG4GIF creates a new InlineQueryResultCachedMPEG4GIF.

func (*InlineQueryResultCachedMPEG4GIF) AsInlineQueryResult added in v0.17.0

func (v *InlineQueryResultCachedMPEG4GIF) AsInlineQueryResult() InlineQueryResult

AsInlineQueryResult wraps the variant into a InlineQueryResult union.

func (*InlineQueryResultCachedMPEG4GIF) WithCaption added in v0.17.0

WithCaption sets the Caption field.

func (*InlineQueryResultCachedMPEG4GIF) WithCaptionEntities added in v0.17.0

func (v *InlineQueryResultCachedMPEG4GIF) WithCaptionEntities(captionEntities []MessageEntity) *InlineQueryResultCachedMPEG4GIF

WithCaptionEntities sets the CaptionEntities field.

func (*InlineQueryResultCachedMPEG4GIF) WithInputMessageContent added in v0.17.0

func (v *InlineQueryResultCachedMPEG4GIF) WithInputMessageContent(inputMessageContent InputMessageContent) *InlineQueryResultCachedMPEG4GIF

WithInputMessageContent sets the InputMessageContent field.

func (*InlineQueryResultCachedMPEG4GIF) WithParseMode added in v0.17.0

WithParseMode sets the ParseMode field.

func (*InlineQueryResultCachedMPEG4GIF) WithReplyMarkup added in v0.17.0

WithReplyMarkup sets the ReplyMarkup field.

func (*InlineQueryResultCachedMPEG4GIF) WithShowCaptionAboveMedia added in v0.17.0

func (v *InlineQueryResultCachedMPEG4GIF) WithShowCaptionAboveMedia() *InlineQueryResultCachedMPEG4GIF

WithShowCaptionAboveMedia sets the ShowCaptionAboveMedia field.

func (*InlineQueryResultCachedMPEG4GIF) WithTitle added in v0.17.0

WithTitle sets the Title field.

type InlineQueryResultCachedPhoto

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

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

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

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

	// Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`

	// Optional. Mode for parsing entities in the photo caption. See [formatting options] for more details.
	//
	// [formatting options]: https://core.telegram.org/bots/api#formatting-options
	ParseMode ParseMode `json:"parse_mode,omitempty"`

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

	// Optional. Pass True, if the caption must be shown above the message media
	ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`

	// Optional. [Inline keyboard] attached to the message
	//
	// [Inline keyboard]: https://core.telegram.org/bots/features#inline-keyboards
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

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

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

func NewInlineQueryResultCachedPhoto added in v0.16.0

func NewInlineQueryResultCachedPhoto(id string, photoFileID FileID) *InlineQueryResultCachedPhoto

NewInlineQueryResultCachedPhoto creates a new InlineQueryResultCachedPhoto.

func (*InlineQueryResultCachedPhoto) AsInlineQueryResult added in v0.17.0

func (v *InlineQueryResultCachedPhoto) AsInlineQueryResult() InlineQueryResult

AsInlineQueryResult wraps the variant into a InlineQueryResult union.

func (*InlineQueryResultCachedPhoto) WithCaption added in v0.17.0

WithCaption sets the Caption field.

func (*InlineQueryResultCachedPhoto) WithCaptionEntities added in v0.17.0

func (v *InlineQueryResultCachedPhoto) WithCaptionEntities(captionEntities []MessageEntity) *InlineQueryResultCachedPhoto

WithCaptionEntities sets the CaptionEntities field.

func (*InlineQueryResultCachedPhoto) WithDescription added in v0.17.0

func (v *InlineQueryResultCachedPhoto) WithDescription(description string) *InlineQueryResultCachedPhoto

WithDescription sets the Description field.

func (*InlineQueryResultCachedPhoto) WithInputMessageContent added in v0.17.0

func (v *InlineQueryResultCachedPhoto) WithInputMessageContent(inputMessageContent InputMessageContent) *InlineQueryResultCachedPhoto

WithInputMessageContent sets the InputMessageContent field.

func (*InlineQueryResultCachedPhoto) WithParseMode added in v0.17.0

WithParseMode sets the ParseMode field.

func (*InlineQueryResultCachedPhoto) WithReplyMarkup added in v0.17.0

WithReplyMarkup sets the ReplyMarkup field.

func (*InlineQueryResultCachedPhoto) WithShowCaptionAboveMedia added in v0.17.0

func (v *InlineQueryResultCachedPhoto) WithShowCaptionAboveMedia() *InlineQueryResultCachedPhoto

WithShowCaptionAboveMedia sets the ShowCaptionAboveMedia field.

func (*InlineQueryResultCachedPhoto) WithTitle added in v0.17.0

WithTitle sets the Title field.

type InlineQueryResultCachedSticker

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

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

	// Optional. [Inline keyboard] attached to the message
	//
	// [Inline keyboard]: https://core.telegram.org/bots/features#inline-keyboards
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

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

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

func NewInlineQueryResultCachedSticker added in v0.16.0

func NewInlineQueryResultCachedSticker(id string, stickerFileID FileID) *InlineQueryResultCachedSticker

NewInlineQueryResultCachedSticker creates a new InlineQueryResultCachedSticker.

func (*InlineQueryResultCachedSticker) AsInlineQueryResult added in v0.17.0

func (v *InlineQueryResultCachedSticker) AsInlineQueryResult() InlineQueryResult

AsInlineQueryResult wraps the variant into a InlineQueryResult union.

func (*InlineQueryResultCachedSticker) WithInputMessageContent added in v0.17.0

func (v *InlineQueryResultCachedSticker) WithInputMessageContent(inputMessageContent InputMessageContent) *InlineQueryResultCachedSticker

WithInputMessageContent sets the InputMessageContent field.

func (*InlineQueryResultCachedSticker) WithReplyMarkup added in v0.17.0

WithReplyMarkup sets the ReplyMarkup field.

type InlineQueryResultCachedVideo

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

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

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

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

	// Optional. Caption of the video to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`

	// Optional. Mode for parsing entities in the video caption. See [formatting options] for more details.
	//
	// [formatting options]: https://core.telegram.org/bots/api#formatting-options
	ParseMode ParseMode `json:"parse_mode,omitempty"`

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

	// Optional. Pass True, if the caption must be shown above the message media
	ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`

	// Optional. [Inline keyboard] attached to the message
	//
	// [Inline keyboard]: https://core.telegram.org/bots/features#inline-keyboards
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

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

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

func NewInlineQueryResultCachedVideo added in v0.16.0

func NewInlineQueryResultCachedVideo(id string, videoFileID FileID, title string) *InlineQueryResultCachedVideo

NewInlineQueryResultCachedVideo creates a new InlineQueryResultCachedVideo.

func (*InlineQueryResultCachedVideo) AsInlineQueryResult added in v0.17.0

func (v *InlineQueryResultCachedVideo) AsInlineQueryResult() InlineQueryResult

AsInlineQueryResult wraps the variant into a InlineQueryResult union.

func (*InlineQueryResultCachedVideo) WithCaption added in v0.17.0

WithCaption sets the Caption field.

func (*InlineQueryResultCachedVideo) WithCaptionEntities added in v0.17.0

func (v *InlineQueryResultCachedVideo) WithCaptionEntities(captionEntities []MessageEntity) *InlineQueryResultCachedVideo

WithCaptionEntities sets the CaptionEntities field.

func (*InlineQueryResultCachedVideo) WithDescription added in v0.17.0

func (v *InlineQueryResultCachedVideo) WithDescription(description string) *InlineQueryResultCachedVideo

WithDescription sets the Description field.

func (*InlineQueryResultCachedVideo) WithInputMessageContent added in v0.17.0

func (v *InlineQueryResultCachedVideo) WithInputMessageContent(inputMessageContent InputMessageContent) *InlineQueryResultCachedVideo

WithInputMessageContent sets the InputMessageContent field.

func (*InlineQueryResultCachedVideo) WithParseMode added in v0.17.0

WithParseMode sets the ParseMode field.

func (*InlineQueryResultCachedVideo) WithReplyMarkup added in v0.17.0

WithReplyMarkup sets the ReplyMarkup field.

func (*InlineQueryResultCachedVideo) WithShowCaptionAboveMedia added in v0.17.0

func (v *InlineQueryResultCachedVideo) WithShowCaptionAboveMedia() *InlineQueryResultCachedVideo

WithShowCaptionAboveMedia sets the ShowCaptionAboveMedia field.

type InlineQueryResultCachedVoice

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

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

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

	// Optional. Caption, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`

	// Optional. Mode for parsing entities in the voice message caption. See [formatting options] for more details.
	//
	// [formatting options]: https://core.telegram.org/bots/api#formatting-options
	ParseMode ParseMode `json:"parse_mode,omitempty"`

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

	// Optional. [Inline keyboard] attached to the message
	//
	// [Inline keyboard]: https://core.telegram.org/bots/features#inline-keyboards
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

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

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

func NewInlineQueryResultCachedVoice added in v0.16.0

func NewInlineQueryResultCachedVoice(id string, voiceFileID FileID, title string) *InlineQueryResultCachedVoice

NewInlineQueryResultCachedVoice creates a new InlineQueryResultCachedVoice.

func (*InlineQueryResultCachedVoice) AsInlineQueryResult added in v0.17.0

func (v *InlineQueryResultCachedVoice) AsInlineQueryResult() InlineQueryResult

AsInlineQueryResult wraps the variant into a InlineQueryResult union.

func (*InlineQueryResultCachedVoice) WithCaption added in v0.17.0

WithCaption sets the Caption field.

func (*InlineQueryResultCachedVoice) WithCaptionEntities added in v0.17.0

func (v *InlineQueryResultCachedVoice) WithCaptionEntities(captionEntities []MessageEntity) *InlineQueryResultCachedVoice

WithCaptionEntities sets the CaptionEntities field.

func (*InlineQueryResultCachedVoice) WithInputMessageContent added in v0.17.0

func (v *InlineQueryResultCachedVoice) WithInputMessageContent(inputMessageContent InputMessageContent) *InlineQueryResultCachedVoice

WithInputMessageContent sets the InputMessageContent field.

func (*InlineQueryResultCachedVoice) WithParseMode added in v0.17.0

WithParseMode sets the ParseMode field.

func (*InlineQueryResultCachedVoice) WithReplyMarkup added in v0.17.0

WithReplyMarkup sets the ReplyMarkup field.

type InlineQueryResultContact

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

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

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

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

	// Optional. Additional data about the contact in the form of a [vCard], 0-2048 bytes
	//
	// [vCard]: https://en.wikipedia.org/wiki/VCard
	VCard string `json:"vcard,omitempty"`

	// Optional. [Inline keyboard] attached to the message
	//
	// [Inline keyboard]: https://core.telegram.org/bots/features#inline-keyboards
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

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

	// Optional. Url of the thumbnail for the result
	ThumbnailURL string `json:"thumbnail_url,omitempty"`

	// Optional. Thumbnail width
	ThumbnailWidth int `json:"thumbnail_width,omitempty"`

	// Optional. Thumbnail height
	ThumbnailHeight int `json:"thumbnail_height,omitempty"`
}

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

func NewInlineQueryResultContact added in v0.16.0

func NewInlineQueryResultContact(id string, phoneNumber string, firstName string) *InlineQueryResultContact

NewInlineQueryResultContact creates a new InlineQueryResultContact.

func (*InlineQueryResultContact) AsInlineQueryResult added in v0.17.0

func (v *InlineQueryResultContact) AsInlineQueryResult() InlineQueryResult

AsInlineQueryResult wraps the variant into a InlineQueryResult union.

func (*InlineQueryResultContact) WithInputMessageContent added in v0.17.0

func (v *InlineQueryResultContact) WithInputMessageContent(inputMessageContent InputMessageContent) *InlineQueryResultContact

WithInputMessageContent sets the InputMessageContent field.

func (*InlineQueryResultContact) WithLastName added in v0.17.0

func (v *InlineQueryResultContact) WithLastName(lastName string) *InlineQueryResultContact

WithLastName sets the LastName field.

func (*InlineQueryResultContact) WithReplyMarkup added in v0.17.0

WithReplyMarkup sets the ReplyMarkup field.

func (*InlineQueryResultContact) WithThumbnailHeight added in v0.17.0

func (v *InlineQueryResultContact) WithThumbnailHeight(thumbnailHeight int) *InlineQueryResultContact

WithThumbnailHeight sets the ThumbnailHeight field.

func (*InlineQueryResultContact) WithThumbnailURL added in v0.17.0

func (v *InlineQueryResultContact) WithThumbnailURL(thumbnailURL string) *InlineQueryResultContact

WithThumbnailURL sets the ThumbnailURL field.

func (*InlineQueryResultContact) WithThumbnailWidth added in v0.17.0

func (v *InlineQueryResultContact) WithThumbnailWidth(thumbnailWidth int) *InlineQueryResultContact

WithThumbnailWidth sets the ThumbnailWidth field.

func (*InlineQueryResultContact) WithVCard added in v0.17.0

WithVCard sets the VCard field.

type InlineQueryResultDocument

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

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

	// Optional. Caption of the document to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`

	// Optional. Mode for parsing entities in the document caption. See [formatting options] for more details.
	//
	// [formatting options]: https://core.telegram.org/bots/api#formatting-options
	ParseMode ParseMode `json:"parse_mode,omitempty"`

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

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

	// MIME type of the content of the file, either “application/pdf” or “application/zip”
	MIMEType string `json:"mime_type"`

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

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

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

	// Optional. URL of the thumbnail (JPEG only) for the file
	ThumbnailURL string `json:"thumbnail_url,omitempty"`

	// Optional. Thumbnail width
	ThumbnailWidth int `json:"thumbnail_width,omitempty"`

	// Optional. Thumbnail height
	ThumbnailHeight int `json:"thumbnail_height,omitempty"`
}

InlineQueryResultDocument represents a link to a file. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file. Currently, only .PDF and .ZIP files can be sent using this method.

func NewInlineQueryResultDocument added in v0.16.0

func NewInlineQueryResultDocument(id string, title string, documentURL string, mimeType string) *InlineQueryResultDocument

NewInlineQueryResultDocument creates a new InlineQueryResultDocument.

func (*InlineQueryResultDocument) AsInlineQueryResult added in v0.17.0

func (v *InlineQueryResultDocument) AsInlineQueryResult() InlineQueryResult

AsInlineQueryResult wraps the variant into a InlineQueryResult union.

func (*InlineQueryResultDocument) WithCaption added in v0.17.0

WithCaption sets the Caption field.

func (*InlineQueryResultDocument) WithCaptionEntities added in v0.17.0

func (v *InlineQueryResultDocument) WithCaptionEntities(captionEntities []MessageEntity) *InlineQueryResultDocument

WithCaptionEntities sets the CaptionEntities field.

func (*InlineQueryResultDocument) WithDescription added in v0.17.0

func (v *InlineQueryResultDocument) WithDescription(description string) *InlineQueryResultDocument

WithDescription sets the Description field.

func (*InlineQueryResultDocument) WithInputMessageContent added in v0.17.0

func (v *InlineQueryResultDocument) WithInputMessageContent(inputMessageContent InputMessageContent) *InlineQueryResultDocument

WithInputMessageContent sets the InputMessageContent field.

func (*InlineQueryResultDocument) WithParseMode added in v0.17.0

func (v *InlineQueryResultDocument) WithParseMode(parseMode ParseMode) *InlineQueryResultDocument

WithParseMode sets the ParseMode field.

func (*InlineQueryResultDocument) WithReplyMarkup added in v0.17.0

WithReplyMarkup sets the ReplyMarkup field.

func (*InlineQueryResultDocument) WithThumbnailHeight added in v0.17.0

func (v *InlineQueryResultDocument) WithThumbnailHeight(thumbnailHeight int) *InlineQueryResultDocument

WithThumbnailHeight sets the ThumbnailHeight field.

func (*InlineQueryResultDocument) WithThumbnailURL added in v0.17.0

func (v *InlineQueryResultDocument) WithThumbnailURL(thumbnailURL string) *InlineQueryResultDocument

WithThumbnailURL sets the ThumbnailURL field.

func (*InlineQueryResultDocument) WithThumbnailWidth added in v0.17.0

func (v *InlineQueryResultDocument) WithThumbnailWidth(thumbnailWidth int) *InlineQueryResultDocument

WithThumbnailWidth sets the ThumbnailWidth field.

type InlineQueryResultGIF added in v0.0.5

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

	// A valid URL for the GIF file
	GIFURL string `json:"gif_url"`

	// Optional. Width of the GIF
	GIFWidth int `json:"gif_width,omitempty"`

	// Optional. Height of the GIF
	GIFHeight int `json:"gif_height,omitempty"`

	// Optional. Duration of the GIF in seconds
	GIFDuration int `json:"gif_duration,omitempty"`

	// URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result
	ThumbnailURL string `json:"thumbnail_url"`

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

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

	// Optional. Caption of the GIF file to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`

	// Optional. Mode for parsing entities in the caption. See [formatting options] for more details.
	//
	// [formatting options]: https://core.telegram.org/bots/api#formatting-options
	ParseMode ParseMode `json:"parse_mode,omitempty"`

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

	// Optional. Pass True, if the caption must be shown above the message media
	ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`

	// Optional. [Inline keyboard] attached to the message
	//
	// [Inline keyboard]: https://core.telegram.org/bots/features#inline-keyboards
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

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

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

func NewInlineQueryResultGIF added in v0.16.0

func NewInlineQueryResultGIF(id string, gifurl string, thumbnailURL string) *InlineQueryResultGIF

NewInlineQueryResultGIF creates a new InlineQueryResultGIF.

func (*InlineQueryResultGIF) AsInlineQueryResult added in v0.17.0

func (v *InlineQueryResultGIF) AsInlineQueryResult() InlineQueryResult

AsInlineQueryResult wraps the variant into a InlineQueryResult union.

func (*InlineQueryResultGIF) WithCaption added in v0.17.0

func (v *InlineQueryResultGIF) WithCaption(caption string) *InlineQueryResultGIF

WithCaption sets the Caption field.

func (*InlineQueryResultGIF) WithCaptionEntities added in v0.17.0

func (v *InlineQueryResultGIF) WithCaptionEntities(captionEntities []MessageEntity) *InlineQueryResultGIF

WithCaptionEntities sets the CaptionEntities field.

func (*InlineQueryResultGIF) WithGIFDuration added in v0.17.0

func (v *InlineQueryResultGIF) WithGIFDuration(gifDuration int) *InlineQueryResultGIF

WithGIFDuration sets the GIFDuration field.

func (*InlineQueryResultGIF) WithGIFHeight added in v0.17.0

func (v *InlineQueryResultGIF) WithGIFHeight(gifHeight int) *InlineQueryResultGIF

WithGIFHeight sets the GIFHeight field.

func (*InlineQueryResultGIF) WithGIFWidth added in v0.17.0

func (v *InlineQueryResultGIF) WithGIFWidth(gifWidth int) *InlineQueryResultGIF

WithGIFWidth sets the GIFWidth field.

func (*InlineQueryResultGIF) WithInputMessageContent added in v0.17.0

func (v *InlineQueryResultGIF) WithInputMessageContent(inputMessageContent InputMessageContent) *InlineQueryResultGIF

WithInputMessageContent sets the InputMessageContent field.

func (*InlineQueryResultGIF) WithParseMode added in v0.17.0

func (v *InlineQueryResultGIF) WithParseMode(parseMode ParseMode) *InlineQueryResultGIF

WithParseMode sets the ParseMode field.

func (*InlineQueryResultGIF) WithReplyMarkup added in v0.17.0

func (v *InlineQueryResultGIF) WithReplyMarkup(replyMarkup InlineKeyboardMarkup) *InlineQueryResultGIF

WithReplyMarkup sets the ReplyMarkup field.

func (*InlineQueryResultGIF) WithShowCaptionAboveMedia added in v0.17.0

func (v *InlineQueryResultGIF) WithShowCaptionAboveMedia() *InlineQueryResultGIF

WithShowCaptionAboveMedia sets the ShowCaptionAboveMedia field.

func (*InlineQueryResultGIF) WithThumbnailMIMEType added in v0.17.0

func (v *InlineQueryResultGIF) WithThumbnailMIMEType(thumbnailMIMEType string) *InlineQueryResultGIF

WithThumbnailMIMEType sets the ThumbnailMIMEType field.

func (*InlineQueryResultGIF) WithTitle added in v0.17.0

func (v *InlineQueryResultGIF) WithTitle(title string) *InlineQueryResultGIF

WithTitle sets the Title field.

type InlineQueryResultGame

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

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

	// Optional. [Inline keyboard] attached to the message
	//
	// [Inline keyboard]: https://core.telegram.org/bots/features#inline-keyboards
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}

InlineQueryResultGame represents a Game.

func NewInlineQueryResultGame added in v0.16.0

func NewInlineQueryResultGame(id string, gameShortName string) *InlineQueryResultGame

NewInlineQueryResultGame creates a new InlineQueryResultGame.

func (*InlineQueryResultGame) AsInlineQueryResult added in v0.17.0

func (v *InlineQueryResultGame) AsInlineQueryResult() InlineQueryResult

AsInlineQueryResult wraps the variant into a InlineQueryResult union.

func (*InlineQueryResultGame) WithReplyMarkup added in v0.17.0

func (v *InlineQueryResultGame) WithReplyMarkup(replyMarkup InlineKeyboardMarkup) *InlineQueryResultGame

WithReplyMarkup sets the ReplyMarkup field.

type InlineQueryResultLocation

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

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

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

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

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

	// Optional. Period in seconds during which the location can be updated, should be between 60 and 86400, or 0x7FFFFFFF for live locations that can be edited indefinitely.
	LivePeriod int `json:"live_period,omitempty"`

	// Optional. For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.
	Heading int `json:"heading,omitempty"`

	// Optional. For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.
	ProximityAlertRadius int `json:"proximity_alert_radius,omitempty"`

	// Optional. [Inline keyboard] attached to the message
	//
	// [Inline keyboard]: https://core.telegram.org/bots/features#inline-keyboards
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

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

	// Optional. Url of the thumbnail for the result
	ThumbnailURL string `json:"thumbnail_url,omitempty"`

	// Optional. Thumbnail width
	ThumbnailWidth int `json:"thumbnail_width,omitempty"`

	// Optional. Thumbnail height
	ThumbnailHeight int `json:"thumbnail_height,omitempty"`
}

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

func NewInlineQueryResultLocation added in v0.16.0

func NewInlineQueryResultLocation(id string, latitude float64, longitude float64, title string) *InlineQueryResultLocation

NewInlineQueryResultLocation creates a new InlineQueryResultLocation.

func (*InlineQueryResultLocation) AsInlineQueryResult added in v0.17.0

func (v *InlineQueryResultLocation) AsInlineQueryResult() InlineQueryResult

AsInlineQueryResult wraps the variant into a InlineQueryResult union.

func (*InlineQueryResultLocation) WithHeading added in v0.17.0

func (v *InlineQueryResultLocation) WithHeading(heading int) *InlineQueryResultLocation

WithHeading sets the Heading field.

func (*InlineQueryResultLocation) WithHorizontalAccuracy added in v0.17.0

func (v *InlineQueryResultLocation) WithHorizontalAccuracy(horizontalAccuracy float64) *InlineQueryResultLocation

WithHorizontalAccuracy sets the HorizontalAccuracy field.

func (*InlineQueryResultLocation) WithInputMessageContent added in v0.17.0

func (v *InlineQueryResultLocation) WithInputMessageContent(inputMessageContent InputMessageContent) *InlineQueryResultLocation

WithInputMessageContent sets the InputMessageContent field.

func (*InlineQueryResultLocation) WithLivePeriod added in v0.17.0

func (v *InlineQueryResultLocation) WithLivePeriod(livePeriod int) *InlineQueryResultLocation

WithLivePeriod sets the LivePeriod field.

func (*InlineQueryResultLocation) WithProximityAlertRadius added in v0.17.0

func (v *InlineQueryResultLocation) WithProximityAlertRadius(proximityAlertRadius int) *InlineQueryResultLocation

WithProximityAlertRadius sets the ProximityAlertRadius field.

func (*InlineQueryResultLocation) WithReplyMarkup added in v0.17.0

WithReplyMarkup sets the ReplyMarkup field.

func (*InlineQueryResultLocation) WithThumbnailHeight added in v0.17.0

func (v *InlineQueryResultLocation) WithThumbnailHeight(thumbnailHeight int) *InlineQueryResultLocation

WithThumbnailHeight sets the ThumbnailHeight field.

func (*InlineQueryResultLocation) WithThumbnailURL added in v0.17.0

func (v *InlineQueryResultLocation) WithThumbnailURL(thumbnailURL string) *InlineQueryResultLocation

WithThumbnailURL sets the ThumbnailURL field.

func (*InlineQueryResultLocation) WithThumbnailWidth added in v0.17.0

func (v *InlineQueryResultLocation) WithThumbnailWidth(thumbnailWidth int) *InlineQueryResultLocation

WithThumbnailWidth sets the ThumbnailWidth field.

type InlineQueryResultMPEG4GIF added in v0.0.5

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

	// A valid URL for the MPEG4 file
	MPEG4URL string `json:"mpeg4_url"`

	// Optional. Video width
	MPEG4Width int `json:"mpeg4_width,omitempty"`

	// Optional. Video height
	MPEG4Height int `json:"mpeg4_height,omitempty"`

	// Optional. Video duration in seconds
	MPEG4Duration int `json:"mpeg4_duration,omitempty"`

	// URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result
	ThumbnailURL string `json:"thumbnail_url"`

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

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

	// Optional. Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`

	// Optional. Mode for parsing entities in the caption. See [formatting options] for more details.
	//
	// [formatting options]: https://core.telegram.org/bots/api#formatting-options
	ParseMode ParseMode `json:"parse_mode,omitempty"`

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

	// Optional. Pass True, if the caption must be shown above the message media
	ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`

	// Optional. [Inline keyboard] attached to the message
	//
	// [Inline keyboard]: https://core.telegram.org/bots/features#inline-keyboards
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

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

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

func NewInlineQueryResultMPEG4GIF added in v0.16.0

func NewInlineQueryResultMPEG4GIF(id string, mpeG4URL string, thumbnailURL string) *InlineQueryResultMPEG4GIF

NewInlineQueryResultMPEG4GIF creates a new InlineQueryResultMPEG4GIF.

func (*InlineQueryResultMPEG4GIF) AsInlineQueryResult added in v0.17.0

func (v *InlineQueryResultMPEG4GIF) AsInlineQueryResult() InlineQueryResult

AsInlineQueryResult wraps the variant into a InlineQueryResult union.

func (*InlineQueryResultMPEG4GIF) WithCaption added in v0.17.0

WithCaption sets the Caption field.

func (*InlineQueryResultMPEG4GIF) WithCaptionEntities added in v0.17.0

func (v *InlineQueryResultMPEG4GIF) WithCaptionEntities(captionEntities []MessageEntity) *InlineQueryResultMPEG4GIF

WithCaptionEntities sets the CaptionEntities field.

func (*InlineQueryResultMPEG4GIF) WithInputMessageContent added in v0.17.0

func (v *InlineQueryResultMPEG4GIF) WithInputMessageContent(inputMessageContent InputMessageContent) *InlineQueryResultMPEG4GIF

WithInputMessageContent sets the InputMessageContent field.

func (*InlineQueryResultMPEG4GIF) WithMPEG4Duration added in v0.17.0

func (v *InlineQueryResultMPEG4GIF) WithMPEG4Duration(mpeG4Duration int) *InlineQueryResultMPEG4GIF

WithMPEG4Duration sets the MPEG4Duration field.

func (*InlineQueryResultMPEG4GIF) WithMPEG4Height added in v0.17.0

func (v *InlineQueryResultMPEG4GIF) WithMPEG4Height(mpeG4Height int) *InlineQueryResultMPEG4GIF

WithMPEG4Height sets the MPEG4Height field.

func (*InlineQueryResultMPEG4GIF) WithMPEG4Width added in v0.17.0

func (v *InlineQueryResultMPEG4GIF) WithMPEG4Width(mpeG4Width int) *InlineQueryResultMPEG4GIF

WithMPEG4Width sets the MPEG4Width field.

func (*InlineQueryResultMPEG4GIF) WithParseMode added in v0.17.0

func (v *InlineQueryResultMPEG4GIF) WithParseMode(parseMode ParseMode) *InlineQueryResultMPEG4GIF

WithParseMode sets the ParseMode field.

func (*InlineQueryResultMPEG4GIF) WithReplyMarkup added in v0.17.0

WithReplyMarkup sets the ReplyMarkup field.

func (*InlineQueryResultMPEG4GIF) WithShowCaptionAboveMedia added in v0.17.0

func (v *InlineQueryResultMPEG4GIF) WithShowCaptionAboveMedia() *InlineQueryResultMPEG4GIF

WithShowCaptionAboveMedia sets the ShowCaptionAboveMedia field.

func (*InlineQueryResultMPEG4GIF) WithThumbnailMIMEType added in v0.17.0

func (v *InlineQueryResultMPEG4GIF) WithThumbnailMIMEType(thumbnailMIMEType string) *InlineQueryResultMPEG4GIF

WithThumbnailMIMEType sets the ThumbnailMIMEType field.

func (*InlineQueryResultMPEG4GIF) WithTitle added in v0.17.0

WithTitle sets the Title field.

type InlineQueryResultPhoto

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

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

	// URL of the thumbnail for the photo
	ThumbnailURL string `json:"thumbnail_url"`

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

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

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

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

	// Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`

	// Optional. Mode for parsing entities in the photo caption. See [formatting options] for more details.
	//
	// [formatting options]: https://core.telegram.org/bots/api#formatting-options
	ParseMode ParseMode `json:"parse_mode,omitempty"`

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

	// Optional. Pass True, if the caption must be shown above the message media
	ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`

	// Optional. [Inline keyboard] attached to the message
	//
	// [Inline keyboard]: https://core.telegram.org/bots/features#inline-keyboards
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

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

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

func NewInlineQueryResultPhoto added in v0.16.0

func NewInlineQueryResultPhoto(id string, photoURL string, thumbnailURL string) *InlineQueryResultPhoto

NewInlineQueryResultPhoto creates a new InlineQueryResultPhoto.

func (*InlineQueryResultPhoto) AsInlineQueryResult added in v0.17.0

func (v *InlineQueryResultPhoto) AsInlineQueryResult() InlineQueryResult

AsInlineQueryResult wraps the variant into a InlineQueryResult union.

func (*InlineQueryResultPhoto) WithCaption added in v0.17.0

func (v *InlineQueryResultPhoto) WithCaption(caption string) *InlineQueryResultPhoto

WithCaption sets the Caption field.

func (*InlineQueryResultPhoto) WithCaptionEntities added in v0.17.0

func (v *InlineQueryResultPhoto) WithCaptionEntities(captionEntities []MessageEntity) *InlineQueryResultPhoto

WithCaptionEntities sets the CaptionEntities field.

func (*InlineQueryResultPhoto) WithDescription added in v0.17.0

func (v *InlineQueryResultPhoto) WithDescription(description string) *InlineQueryResultPhoto

WithDescription sets the Description field.

func (*InlineQueryResultPhoto) WithInputMessageContent added in v0.17.0

func (v *InlineQueryResultPhoto) WithInputMessageContent(inputMessageContent InputMessageContent) *InlineQueryResultPhoto

WithInputMessageContent sets the InputMessageContent field.

func (*InlineQueryResultPhoto) WithParseMode added in v0.17.0

func (v *InlineQueryResultPhoto) WithParseMode(parseMode ParseMode) *InlineQueryResultPhoto

WithParseMode sets the ParseMode field.

func (*InlineQueryResultPhoto) WithPhotoHeight added in v0.17.0

func (v *InlineQueryResultPhoto) WithPhotoHeight(photoHeight int) *InlineQueryResultPhoto

WithPhotoHeight sets the PhotoHeight field.

func (*InlineQueryResultPhoto) WithPhotoWidth added in v0.17.0

func (v *InlineQueryResultPhoto) WithPhotoWidth(photoWidth int) *InlineQueryResultPhoto

WithPhotoWidth sets the PhotoWidth field.

func (*InlineQueryResultPhoto) WithReplyMarkup added in v0.17.0

func (v *InlineQueryResultPhoto) WithReplyMarkup(replyMarkup InlineKeyboardMarkup) *InlineQueryResultPhoto

WithReplyMarkup sets the ReplyMarkup field.

func (*InlineQueryResultPhoto) WithShowCaptionAboveMedia added in v0.17.0

func (v *InlineQueryResultPhoto) WithShowCaptionAboveMedia() *InlineQueryResultPhoto

WithShowCaptionAboveMedia sets the ShowCaptionAboveMedia field.

func (*InlineQueryResultPhoto) WithTitle added in v0.17.0

WithTitle sets the Title field.

type InlineQueryResultType added in v0.16.0

type InlineQueryResultType int

InlineQueryResultType represents the type of InlineQueryResult.

const (
	InlineQueryResultTypeCachedAudio    InlineQueryResultType = iota + 1 // "audio"
	InlineQueryResultTypeCachedDocument                                  // "document"
	InlineQueryResultTypeCachedGIF                                       // "gif"
	InlineQueryResultTypeCachedMPEG4GIF                                  // "mpeg4_gif"
	InlineQueryResultTypeCachedPhoto                                     // "photo"
	InlineQueryResultTypeCachedSticker                                   // "sticker"
	InlineQueryResultTypeCachedVideo                                     // "video"
	InlineQueryResultTypeCachedVoice                                     // "voice"
	InlineQueryResultTypeArticle                                         // "article"
	InlineQueryResultTypeAudio                                           // "audio"
	InlineQueryResultTypeContact                                         // "contact"
	InlineQueryResultTypeGame                                            // "game"
	InlineQueryResultTypeDocument                                        // "document"
	InlineQueryResultTypeGIF                                             // "gif"
	InlineQueryResultTypeLocation                                        // "location"
	InlineQueryResultTypeMPEG4GIF                                        // "mpeg4_gif"
	InlineQueryResultTypePhoto                                           // "photo"
	InlineQueryResultTypeVenue                                           // "venue"
	InlineQueryResultTypeVideo                                           // "video"
	InlineQueryResultTypeVoice                                           // "voice"
)

func (InlineQueryResultType) MarshalText added in v0.16.0

func (v InlineQueryResultType) MarshalText() ([]byte, error)

func (InlineQueryResultType) String added in v0.16.0

func (v InlineQueryResultType) String() string

type InlineQueryResultVenue

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

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

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

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

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

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

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

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

	// Optional. Google Places type of the venue. (See [supported types].)
	//
	// [supported types]: https://developers.google.com/places/web-service/supported_types
	GooglePlaceType string `json:"google_place_type,omitempty"`

	// Optional. [Inline keyboard] attached to the message
	//
	// [Inline keyboard]: https://core.telegram.org/bots/features#inline-keyboards
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

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

	// Optional. Url of the thumbnail for the result
	ThumbnailURL string `json:"thumbnail_url,omitempty"`

	// Optional. Thumbnail width
	ThumbnailWidth int `json:"thumbnail_width,omitempty"`

	// Optional. Thumbnail height
	ThumbnailHeight int `json:"thumbnail_height,omitempty"`
}

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

func NewInlineQueryResultVenue added in v0.16.0

func NewInlineQueryResultVenue(id string, latitude float64, longitude float64, title string, address string) *InlineQueryResultVenue

NewInlineQueryResultVenue creates a new InlineQueryResultVenue.

func (*InlineQueryResultVenue) AsInlineQueryResult added in v0.17.0

func (v *InlineQueryResultVenue) AsInlineQueryResult() InlineQueryResult

AsInlineQueryResult wraps the variant into a InlineQueryResult union.

func (*InlineQueryResultVenue) WithFoursquareID added in v0.17.0

func (v *InlineQueryResultVenue) WithFoursquareID(foursquareID string) *InlineQueryResultVenue

WithFoursquareID sets the FoursquareID field.

func (*InlineQueryResultVenue) WithFoursquareType added in v0.17.0

func (v *InlineQueryResultVenue) WithFoursquareType(foursquareType string) *InlineQueryResultVenue

WithFoursquareType sets the FoursquareType field.

func (*InlineQueryResultVenue) WithGooglePlaceID added in v0.17.0

func (v *InlineQueryResultVenue) WithGooglePlaceID(googlePlaceID string) *InlineQueryResultVenue

WithGooglePlaceID sets the GooglePlaceID field.

func (*InlineQueryResultVenue) WithGooglePlaceType added in v0.17.0

func (v *InlineQueryResultVenue) WithGooglePlaceType(googlePlaceType string) *InlineQueryResultVenue

WithGooglePlaceType sets the GooglePlaceType field.

func (*InlineQueryResultVenue) WithInputMessageContent added in v0.17.0

func (v *InlineQueryResultVenue) WithInputMessageContent(inputMessageContent InputMessageContent) *InlineQueryResultVenue

WithInputMessageContent sets the InputMessageContent field.

func (*InlineQueryResultVenue) WithReplyMarkup added in v0.17.0

func (v *InlineQueryResultVenue) WithReplyMarkup(replyMarkup InlineKeyboardMarkup) *InlineQueryResultVenue

WithReplyMarkup sets the ReplyMarkup field.

func (*InlineQueryResultVenue) WithThumbnailHeight added in v0.17.0

func (v *InlineQueryResultVenue) WithThumbnailHeight(thumbnailHeight int) *InlineQueryResultVenue

WithThumbnailHeight sets the ThumbnailHeight field.

func (*InlineQueryResultVenue) WithThumbnailURL added in v0.17.0

func (v *InlineQueryResultVenue) WithThumbnailURL(thumbnailURL string) *InlineQueryResultVenue

WithThumbnailURL sets the ThumbnailURL field.

func (*InlineQueryResultVenue) WithThumbnailWidth added in v0.17.0

func (v *InlineQueryResultVenue) WithThumbnailWidth(thumbnailWidth int) *InlineQueryResultVenue

WithThumbnailWidth sets the ThumbnailWidth field.

type InlineQueryResultVideo

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

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

	// MIME type of the content of the video URL, “text/html” or “video/mp4”
	MIMEType string `json:"mime_type"`

	// URL of the thumbnail (JPEG only) for the video
	ThumbnailURL string `json:"thumbnail_url"`

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

	// Optional. Caption of the video to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`

	// Optional. Mode for parsing entities in the video caption. See [formatting options] for more details.
	//
	// [formatting options]: https://core.telegram.org/bots/api#formatting-options
	ParseMode ParseMode `json:"parse_mode,omitempty"`

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

	// Optional. Pass True, if the caption must be shown above the message media
	ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`

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

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

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

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

	// Optional. [Inline keyboard] attached to the message
	//
	// [Inline keyboard]: https://core.telegram.org/bots/features#inline-keyboards
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

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

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

func NewInlineQueryResultVideo added in v0.16.0

func NewInlineQueryResultVideo(id string, videoURL string, mimeType string, thumbnailURL string, title string) *InlineQueryResultVideo

NewInlineQueryResultVideo creates a new InlineQueryResultVideo.

func (*InlineQueryResultVideo) AsInlineQueryResult added in v0.17.0

func (v *InlineQueryResultVideo) AsInlineQueryResult() InlineQueryResult

AsInlineQueryResult wraps the variant into a InlineQueryResult union.

func (*InlineQueryResultVideo) WithCaption added in v0.17.0

func (v *InlineQueryResultVideo) WithCaption(caption string) *InlineQueryResultVideo

WithCaption sets the Caption field.

func (*InlineQueryResultVideo) WithCaptionEntities added in v0.17.0

func (v *InlineQueryResultVideo) WithCaptionEntities(captionEntities []MessageEntity) *InlineQueryResultVideo

WithCaptionEntities sets the CaptionEntities field.

func (*InlineQueryResultVideo) WithDescription added in v0.17.0

func (v *InlineQueryResultVideo) WithDescription(description string) *InlineQueryResultVideo

WithDescription sets the Description field.

func (*InlineQueryResultVideo) WithInputMessageContent added in v0.17.0

func (v *InlineQueryResultVideo) WithInputMessageContent(inputMessageContent InputMessageContent) *InlineQueryResultVideo

WithInputMessageContent sets the InputMessageContent field.

func (*InlineQueryResultVideo) WithParseMode added in v0.17.0

func (v *InlineQueryResultVideo) WithParseMode(parseMode ParseMode) *InlineQueryResultVideo

WithParseMode sets the ParseMode field.

func (*InlineQueryResultVideo) WithReplyMarkup added in v0.17.0

func (v *InlineQueryResultVideo) WithReplyMarkup(replyMarkup InlineKeyboardMarkup) *InlineQueryResultVideo

WithReplyMarkup sets the ReplyMarkup field.

func (*InlineQueryResultVideo) WithShowCaptionAboveMedia added in v0.17.0

func (v *InlineQueryResultVideo) WithShowCaptionAboveMedia() *InlineQueryResultVideo

WithShowCaptionAboveMedia sets the ShowCaptionAboveMedia field.

func (*InlineQueryResultVideo) WithVideoDuration added in v0.17.0

func (v *InlineQueryResultVideo) WithVideoDuration(videoDuration int) *InlineQueryResultVideo

WithVideoDuration sets the VideoDuration field.

func (*InlineQueryResultVideo) WithVideoHeight added in v0.17.0

func (v *InlineQueryResultVideo) WithVideoHeight(videoHeight int) *InlineQueryResultVideo

WithVideoHeight sets the VideoHeight field.

func (*InlineQueryResultVideo) WithVideoWidth added in v0.17.0

func (v *InlineQueryResultVideo) WithVideoWidth(videoWidth int) *InlineQueryResultVideo

WithVideoWidth sets the VideoWidth field.

type InlineQueryResultVoice

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

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

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

	// Optional. Caption, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`

	// Optional. Mode for parsing entities in the voice message caption. See [formatting options] for more details.
	//
	// [formatting options]: https://core.telegram.org/bots/api#formatting-options
	ParseMode ParseMode `json:"parse_mode,omitempty"`

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

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

	// Optional. [Inline keyboard] attached to the message
	//
	// [Inline keyboard]: https://core.telegram.org/bots/features#inline-keyboards
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

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

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

func NewInlineQueryResultVoice added in v0.16.0

func NewInlineQueryResultVoice(id string, voiceURL string, title string) *InlineQueryResultVoice

NewInlineQueryResultVoice creates a new InlineQueryResultVoice.

func (*InlineQueryResultVoice) AsInlineQueryResult added in v0.17.0

func (v *InlineQueryResultVoice) AsInlineQueryResult() InlineQueryResult

AsInlineQueryResult wraps the variant into a InlineQueryResult union.

func (*InlineQueryResultVoice) WithCaption added in v0.17.0

func (v *InlineQueryResultVoice) WithCaption(caption string) *InlineQueryResultVoice

WithCaption sets the Caption field.

func (*InlineQueryResultVoice) WithCaptionEntities added in v0.17.0

func (v *InlineQueryResultVoice) WithCaptionEntities(captionEntities []MessageEntity) *InlineQueryResultVoice

WithCaptionEntities sets the CaptionEntities field.

func (*InlineQueryResultVoice) WithInputMessageContent added in v0.17.0

func (v *InlineQueryResultVoice) WithInputMessageContent(inputMessageContent InputMessageContent) *InlineQueryResultVoice

WithInputMessageContent sets the InputMessageContent field.

func (*InlineQueryResultVoice) WithParseMode added in v0.17.0

func (v *InlineQueryResultVoice) WithParseMode(parseMode ParseMode) *InlineQueryResultVoice

WithParseMode sets the ParseMode field.

func (*InlineQueryResultVoice) WithReplyMarkup added in v0.17.0

func (v *InlineQueryResultVoice) WithReplyMarkup(replyMarkup InlineKeyboardMarkup) *InlineQueryResultVoice

WithReplyMarkup sets the ReplyMarkup field.

func (*InlineQueryResultVoice) WithVoiceDuration added in v0.17.0

func (v *InlineQueryResultVoice) WithVoiceDuration(voiceDuration int) *InlineQueryResultVoice

WithVoiceDuration sets the VoiceDuration field.

type InlineQueryResultsButton added in v0.9.0

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

	// Optional. Description of the [Web App] that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method [switchInlineQuery] inside the Web App.
	//
	// [Web App]: https://core.telegram.org/bots/webapps
	// [switchInlineQuery]: https://core.telegram.org/bots/webapps#initializing-mini-apps
	WebApp *WebAppInfo `json:"web_app,omitempty"`

	// Optional. [Deep-linking] parameter for the /start message sent to the bot when a user presses the button. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed.  Example: An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube account to adapt search results accordingly. To do this, it displays a 'Connect your YouTube account' button above the results, or even before showing any. The user presses the button, switches to a private chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an OAuth link. Once done, the bot can offer a [InlineKeyboardMarkup] button so that the user can easily return to the chat where they wanted to use the bot's inline capabilities.
	//
	// [Deep-linking]: https://core.telegram.org/bots/features#deep-linking
	StartParameter string `json:"start_parameter,omitempty"`
}

InlineQueryResultsButton this object represents a button to be shown above inline query results. You must use exactly one of the optional fields.

func NewInlineQueryResultsButtonStartParameter added in v0.16.0

func NewInlineQueryResultsButtonStartParameter(text string, startParameter string) InlineQueryResultsButton

NewInlineQueryResultsButtonStartParameter creates InlineQueryResultsButton with StartParameter.

func NewInlineQueryResultsButtonWebApp added in v0.16.0

func NewInlineQueryResultsButtonWebApp(text string, webApp WebAppInfo) InlineQueryResultsButton

NewInlineQueryResultsButtonWebApp creates InlineQueryResultsButton with WebApp.

type InputChecklist added in v0.16.0

type InputChecklist struct {
	// Title of the checklist; 1-255 characters after entities parsing
	Title string `json:"title"`

	// Optional. Mode for parsing entities in the title. See [formatting options] for more details.
	//
	// [formatting options]: https://core.telegram.org/bots/api#formatting-options
	ParseMode ParseMode `json:"parse_mode,omitempty"`

	// Optional. List of special entities that appear in the title, which can be specified instead of parse_mode. Currently, only bold, italic, underline, strikethrough, spoiler, and custom_emoji entities are allowed.
	TitleEntities []MessageEntity `json:"title_entities,omitempty"`

	// List of 1-30 tasks in the checklist
	Tasks []InputChecklistTask `json:"tasks"`

	// Optional. Pass True if other users can add tasks to the checklist
	OthersCanAddTasks bool `json:"others_can_add_tasks,omitempty"`

	// Optional. Pass True if other users can mark tasks as done or not done in the checklist
	OthersCanMarkTasksAsDone bool `json:"others_can_mark_tasks_as_done,omitempty"`
}

InputChecklist describes a checklist to create.

type InputChecklistTask added in v0.16.0

type InputChecklistTask struct {
	// Unique identifier of the task; must be positive and unique among all task identifiers currently present in the checklist
	ID int `json:"id"`

	// Text of the task; 1-100 characters after entities parsing
	Text string `json:"text"`

	// Optional. Mode for parsing entities in the text. See [formatting options] for more details.
	//
	// [formatting options]: https://core.telegram.org/bots/api#formatting-options
	ParseMode ParseMode `json:"parse_mode,omitempty"`

	// Optional. List of special entities that appear in the text, which can be specified instead of parse_mode. Currently, only bold, italic, underline, strikethrough, spoiler, and custom_emoji entities are allowed.
	TextEntities []MessageEntity `json:"text_entities,omitempty"`
}

InputChecklistTask describes a task to add to a checklist.

type InputContactMessageContent

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

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

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

	// Optional. Additional data about the contact in the form of a [vCard], 0-2048 bytes
	//
	// [vCard]: https://en.wikipedia.org/wiki/VCard
	VCard string `json:"vcard,omitempty"`
}

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

func NewInputContactMessageContent added in v0.17.0

func NewInputContactMessageContent(phoneNumber string, firstName string) *InputContactMessageContent

NewInputContactMessageContent creates a new InputContactMessageContent.

func (*InputContactMessageContent) WithLastName added in v0.17.0

WithLastName sets the LastName field.

func (*InputContactMessageContent) WithVCard added in v0.17.0

WithVCard sets the VCard field.

type InputFile

type InputFile struct {
	// Name of file
	Name string

	// Body of file
	Body io.Reader
	// contains filtered or unexported fields
}

InputFile represents the file that should be uploaded to the telegram.

func NewInputFile

func NewInputFile(name string, body io.Reader) InputFile

NewInputFile creates new InputFile with given name and body.

func NewInputFileBytes

func NewInputFileBytes(name string, body []byte) InputFile

NewInputFileFromBytes creates new InputFile with given name and bytes slice.

Example:

file := NewInputFileBytes("test.txt", []byte("test, test, test..."))

func NewInputFileFS added in v0.2.0

func NewInputFileFS(fsys fs.FS, path string) (InputFile, error)

NewInputFileFS creates the InputFile from provided FS and file path.

Usage:

//go:embed assets/*
var assets embed.FS
file, err := NewInputFileFS(assets, "images/test.png")
if err != nil {
  return err
}
defer file.Close()

func NewInputFileLocal

func NewInputFileLocal(path string) (InputFile, error)

NewInputFileLocal creates the InputFile from provided local file path. This method just open file by provided path. So, you should close it AFTER send.

Example:

file, err := NewInputFileLocal("test.png")
if err != nil {
    return err
}
defer  close()

func (InputFile) Close added in v0.1.1

func (file InputFile) Close() error

Close closes body, if body implements io.Closer.

func (*InputFile) MarshalJSON added in v0.0.5

func (file *InputFile) MarshalJSON() ([]byte, error)

func (InputFile) Ptr added in v0.0.5

func (file InputFile) Ptr() *InputFile

Ptr returns pointer to InputFile. Helper method.

func (InputFile) WithName

func (file InputFile) WithName(name string) InputFile

WithName creates new InputFile with overridden name.

type InputInvoiceMessageContent

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

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

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

	// Optional. Payment provider token, obtained via [@BotFather]. Pass an empty string for payments in [Telegram Stars].
	//
	// [@BotFather]: https://t.me/botfather
	// [Telegram Stars]: https://t.me/BotNews/90
	ProviderToken string `json:"provider_token,omitempty"`

	// Three-letter ISO 4217 currency code, see [more on currencies]. Pass “XTR” for payments in [Telegram Stars].
	//
	// [more on currencies]: https://core.telegram.org/bots/payments#supported-currencies
	// [Telegram Stars]: https://t.me/BotNews/90
	Currency string `json:"currency"`

	// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in [Telegram Stars].
	//
	// [Telegram Stars]: https://t.me/BotNews/90
	Prices []LabeledPrice `json:"prices"`

	// Optional. The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in [currencies.json], it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in [Telegram Stars].
	//
	// [currencies.json]: https://core.telegram.org/bots/payments/currencies.json
	// [Telegram Stars]: https://t.me/BotNews/90
	MaxTipAmount int `json:"max_tip_amount,omitempty"`

	// Optional. A JSON-serialized array of suggested amounts of tip in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount.
	SuggestedTipAmounts []int `json:"suggested_tip_amounts,omitempty"`

	// Optional. A JSON-serialized object for data about the invoice, which will be shared with the payment provider. A detailed description of the required fields should be provided by the payment provider.
	ProviderData string `json:"provider_data,omitempty"`

	// Optional. URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service.
	PhotoURL string `json:"photo_url,omitempty"`

	// Optional. Photo size in bytes
	PhotoSize int `json:"photo_size,omitempty"`

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

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

	// Optional. Pass True if you require the user's full name to complete the order. Ignored for payments in [Telegram Stars].
	//
	// [Telegram Stars]: https://t.me/BotNews/90
	NeedName bool `json:"need_name,omitempty"`

	// Optional. Pass True if you require the user's phone number to complete the order. Ignored for payments in [Telegram Stars].
	//
	// [Telegram Stars]: https://t.me/BotNews/90
	NeedPhoneNumber bool `json:"need_phone_number,omitempty"`

	// Optional. Pass True if you require the user's email address to complete the order. Ignored for payments in [Telegram Stars].
	//
	// [Telegram Stars]: https://t.me/BotNews/90
	NeedEmail bool `json:"need_email,omitempty"`

	// Optional. Pass True if you require the user's shipping address to complete the order. Ignored for payments in [Telegram Stars].
	//
	// [Telegram Stars]: https://t.me/BotNews/90
	NeedShippingAddress bool `json:"need_shipping_address,omitempty"`

	// Optional. Pass True if the user's phone number should be sent to the provider. Ignored for payments in [Telegram Stars].
	//
	// [Telegram Stars]: https://t.me/BotNews/90
	SendPhoneNumberToProvider bool `json:"send_phone_number_to_provider,omitempty"`

	// Optional. Pass True if the user's email address should be sent to the provider. Ignored for payments in [Telegram Stars].
	//
	// [Telegram Stars]: https://t.me/BotNews/90
	SendEmailToProvider bool `json:"send_email_to_provider,omitempty"`

	// Optional. Pass True if the final price depends on the shipping method. Ignored for payments in [Telegram Stars].
	//
	// [Telegram Stars]: https://t.me/BotNews/90
	IsFlexible bool `json:"is_flexible,omitempty"`
}

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

func NewInputInvoiceMessageContent added in v0.17.0

func NewInputInvoiceMessageContent(title string, description string, payload string, currency string, prices []LabeledPrice) *InputInvoiceMessageContent

NewInputInvoiceMessageContent creates a new InputInvoiceMessageContent.

func (*InputInvoiceMessageContent) WithIsFlexible added in v0.17.0

WithIsFlexible sets the IsFlexible field.

func (*InputInvoiceMessageContent) WithMaxTipAmount added in v0.17.0

func (v *InputInvoiceMessageContent) WithMaxTipAmount(maxTipAmount int) *InputInvoiceMessageContent

WithMaxTipAmount sets the MaxTipAmount field.

func (*InputInvoiceMessageContent) WithNeedEmail added in v0.17.0

WithNeedEmail sets the NeedEmail field.

func (*InputInvoiceMessageContent) WithNeedName added in v0.17.0

WithNeedName sets the NeedName field.

func (*InputInvoiceMessageContent) WithNeedPhoneNumber added in v0.17.0

func (v *InputInvoiceMessageContent) WithNeedPhoneNumber() *InputInvoiceMessageContent

WithNeedPhoneNumber sets the NeedPhoneNumber field.

func (*InputInvoiceMessageContent) WithNeedShippingAddress added in v0.17.0

func (v *InputInvoiceMessageContent) WithNeedShippingAddress() *InputInvoiceMessageContent

WithNeedShippingAddress sets the NeedShippingAddress field.

func (*InputInvoiceMessageContent) WithPhotoHeight added in v0.17.0

func (v *InputInvoiceMessageContent) WithPhotoHeight(photoHeight int) *InputInvoiceMessageContent

WithPhotoHeight sets the PhotoHeight field.

func (*InputInvoiceMessageContent) WithPhotoSize added in v0.17.0

func (v *InputInvoiceMessageContent) WithPhotoSize(photoSize int) *InputInvoiceMessageContent

WithPhotoSize sets the PhotoSize field.

func (*InputInvoiceMessageContent) WithPhotoURL added in v0.17.0

WithPhotoURL sets the PhotoURL field.

func (*InputInvoiceMessageContent) WithPhotoWidth added in v0.17.0

func (v *InputInvoiceMessageContent) WithPhotoWidth(photoWidth int) *InputInvoiceMessageContent

WithPhotoWidth sets the PhotoWidth field.

func (*InputInvoiceMessageContent) WithProviderData added in v0.17.0

func (v *InputInvoiceMessageContent) WithProviderData(providerData string) *InputInvoiceMessageContent

WithProviderData sets the ProviderData field.

func (*InputInvoiceMessageContent) WithProviderToken added in v0.17.0

func (v *InputInvoiceMessageContent) WithProviderToken(providerToken string) *InputInvoiceMessageContent

WithProviderToken sets the ProviderToken field.

func (*InputInvoiceMessageContent) WithSendEmailToProvider added in v0.17.0

func (v *InputInvoiceMessageContent) WithSendEmailToProvider() *InputInvoiceMessageContent

WithSendEmailToProvider sets the SendEmailToProvider field.

func (*InputInvoiceMessageContent) WithSendPhoneNumberToProvider added in v0.17.0

func (v *InputInvoiceMessageContent) WithSendPhoneNumberToProvider() *InputInvoiceMessageContent

WithSendPhoneNumberToProvider sets the SendPhoneNumberToProvider field.

func (*InputInvoiceMessageContent) WithSuggestedTipAmounts added in v0.17.0

func (v *InputInvoiceMessageContent) WithSuggestedTipAmounts(suggestedTipAmounts []int) *InputInvoiceMessageContent

WithSuggestedTipAmounts sets the SuggestedTipAmounts field.

type InputLocationMessageContent

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

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

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

	// Optional. Period in seconds during which the location can be updated, should be between 60 and 86400, or 0x7FFFFFFF for live locations that can be edited indefinitely.
	LivePeriod int `json:"live_period,omitempty"`

	// Optional. For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.
	Heading int `json:"heading,omitempty"`

	// Optional. For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.
	ProximityAlertRadius int `json:"proximity_alert_radius,omitempty"`
}

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

func NewInputLocationMessageContent added in v0.17.0

func NewInputLocationMessageContent(latitude float64, longitude float64) *InputLocationMessageContent

NewInputLocationMessageContent creates a new InputLocationMessageContent.

func (*InputLocationMessageContent) WithHeading added in v0.17.0

WithHeading sets the Heading field.

func (*InputLocationMessageContent) WithHorizontalAccuracy added in v0.17.0

func (v *InputLocationMessageContent) WithHorizontalAccuracy(horizontalAccuracy float64) *InputLocationMessageContent

WithHorizontalAccuracy sets the HorizontalAccuracy field.

func (*InputLocationMessageContent) WithLivePeriod added in v0.17.0

func (v *InputLocationMessageContent) WithLivePeriod(livePeriod int) *InputLocationMessageContent

WithLivePeriod sets the LivePeriod field.

func (*InputLocationMessageContent) WithProximityAlertRadius added in v0.17.0

func (v *InputLocationMessageContent) WithProximityAlertRadius(proximityAlertRadius int) *InputLocationMessageContent

WithProximityAlertRadius sets the ProximityAlertRadius field.

type InputMedia

type InputMedia struct {
	Animation *InputMediaAnimation
	Document  *InputMediaDocument
	Audio     *InputMediaAudio
	Photo     *InputMediaPhoto
	Video     *InputMediaVideo
	Unknown   *UnknownVariant
}

InputMedia this object represents the content of a media message to be sent. It should be one of

func InputMediaOf added in v0.17.0

func InputMediaOf(values ...InputMediaClass) []InputMedia

InputMediaOf converts InputMediaClass arguments to a slice of InputMedia.

func (InputMedia) AsInputMedia added in v0.17.0

func (u InputMedia) AsInputMedia() InputMedia

AsInputMedia returns the union as-is, implementing InputMediaClass.

func (*InputMedia) IsUnknown added in v0.16.0

func (u *InputMedia) IsUnknown() bool

IsUnknown reports whether this union contains an unknown variant. This can happen when the API returns a new variant not yet supported by this library.

func (InputMedia) MarshalJSON added in v0.16.0

func (u InputMedia) MarshalJSON() ([]byte, error)

func (*InputMedia) Type added in v0.16.0

func (u *InputMedia) Type() InputMediaType

Type returns the discriminator value for this union.

func (*InputMedia) UnmarshalJSON added in v0.16.0

func (u *InputMedia) UnmarshalJSON(data []byte) error

type InputMediaAnimation

type InputMediaAnimation struct {
	// File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. [More information on Sending Files »]
	//
	// [More information on Sending Files »]: https://core.telegram.org/bots/api#sending-files
	Media FileArg `json:"media"`

	// Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. [More information on Sending Files »]
	//
	// [More information on Sending Files »]: https://core.telegram.org/bots/api#sending-files
	Thumbnail *InputFile `json:"thumbnail,omitempty"`

	// Optional. Caption of the animation to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`

	// Optional. Mode for parsing entities in the animation caption. See [formatting options] for more details.
	//
	// [formatting options]: https://core.telegram.org/bots/api#formatting-options
	ParseMode ParseMode `json:"parse_mode,omitempty"`

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

	// Optional. Pass True, if the caption must be shown above the message media
	ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`

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

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

	// Optional. Animation duration in seconds
	Duration int `json:"duration,omitempty"`

	// Optional. Pass True if the animation needs to be covered with a spoiler animation
	HasSpoiler bool `json:"has_spoiler,omitempty"`
}

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

func NewInputMediaAnimation added in v0.16.0

func NewInputMediaAnimation(media FileArg) *InputMediaAnimation

NewInputMediaAnimation creates a new InputMediaAnimation.

func (*InputMediaAnimation) AsInputMedia added in v0.17.0

func (v *InputMediaAnimation) AsInputMedia() InputMedia

AsInputMedia wraps the variant into a InputMedia union.

func (*InputMediaAnimation) WithCaption added in v0.17.0

func (v *InputMediaAnimation) WithCaption(caption string) *InputMediaAnimation

WithCaption sets the Caption field.

func (*InputMediaAnimation) WithCaptionEntities added in v0.17.0

func (v *InputMediaAnimation) WithCaptionEntities(captionEntities []MessageEntity) *InputMediaAnimation

WithCaptionEntities sets the CaptionEntities field.

func (*InputMediaAnimation) WithDuration added in v0.17.0

func (v *InputMediaAnimation) WithDuration(duration int) *InputMediaAnimation

WithDuration sets the Duration field.

func (*InputMediaAnimation) WithHasSpoiler added in v0.17.0

func (v *InputMediaAnimation) WithHasSpoiler() *InputMediaAnimation

WithHasSpoiler sets the HasSpoiler field.

func (*InputMediaAnimation) WithHeight added in v0.17.0

func (v *InputMediaAnimation) WithHeight(height int) *InputMediaAnimation

WithHeight sets the Height field.

func (*InputMediaAnimation) WithParseMode added in v0.17.0

func (v *InputMediaAnimation) WithParseMode(parseMode ParseMode) *InputMediaAnimation

WithParseMode sets the ParseMode field.

func (*InputMediaAnimation) WithShowCaptionAboveMedia added in v0.17.0

func (v *InputMediaAnimation) WithShowCaptionAboveMedia() *InputMediaAnimation

WithShowCaptionAboveMedia sets the ShowCaptionAboveMedia field.

func (*InputMediaAnimation) WithThumbnail added in v0.17.0

func (v *InputMediaAnimation) WithThumbnail(thumbnail InputFile) *InputMediaAnimation

WithThumbnail sets the Thumbnail field.

func (*InputMediaAnimation) WithWidth added in v0.17.0

func (v *InputMediaAnimation) WithWidth(width int) *InputMediaAnimation

WithWidth sets the Width field.

type InputMediaAudio

type InputMediaAudio struct {
	// File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. [More information on Sending Files »]
	//
	// [More information on Sending Files »]: https://core.telegram.org/bots/api#sending-files
	Media FileArg `json:"media"`

	// Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. [More information on Sending Files »]
	//
	// [More information on Sending Files »]: https://core.telegram.org/bots/api#sending-files
	Thumbnail *InputFile `json:"thumbnail,omitempty"`

	// Optional. Caption of the audio to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`

	// Optional. Mode for parsing entities in the audio caption. See [formatting options] for more details.
	//
	// [formatting options]: https://core.telegram.org/bots/api#formatting-options
	ParseMode ParseMode `json:"parse_mode,omitempty"`

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

	// Optional. Duration of the audio in seconds
	Duration int `json:"duration,omitempty"`

	// Optional. Performer of the audio
	Performer string `json:"performer,omitempty"`

	// Optional. Title of the audio
	Title string `json:"title,omitempty"`
}

InputMediaAudio represents an audio file to be treated as music to be sent.

func NewInputMediaAudio added in v0.16.0

func NewInputMediaAudio(media FileArg) *InputMediaAudio

NewInputMediaAudio creates a new InputMediaAudio.

func (*InputMediaAudio) AsInputMedia added in v0.17.0

func (v *InputMediaAudio) AsInputMedia() InputMedia

AsInputMedia wraps the variant into a InputMedia union.

func (*InputMediaAudio) WithCaption added in v0.17.0

func (v *InputMediaAudio) WithCaption(caption string) *InputMediaAudio

WithCaption sets the Caption field.

func (*InputMediaAudio) WithCaptionEntities added in v0.17.0

func (v *InputMediaAudio) WithCaptionEntities(captionEntities []MessageEntity) *InputMediaAudio

WithCaptionEntities sets the CaptionEntities field.

func (*InputMediaAudio) WithDuration added in v0.17.0

func (v *InputMediaAudio) WithDuration(duration int) *InputMediaAudio

WithDuration sets the Duration field.

func (*InputMediaAudio) WithParseMode added in v0.17.0

func (v *InputMediaAudio) WithParseMode(parseMode ParseMode) *InputMediaAudio

WithParseMode sets the ParseMode field.

func (*InputMediaAudio) WithPerformer added in v0.17.0

func (v *InputMediaAudio) WithPerformer(performer string) *InputMediaAudio

WithPerformer sets the Performer field.

func (*InputMediaAudio) WithThumbnail added in v0.17.0

func (v *InputMediaAudio) WithThumbnail(thumbnail InputFile) *InputMediaAudio

WithThumbnail sets the Thumbnail field.

func (*InputMediaAudio) WithTitle added in v0.17.0

func (v *InputMediaAudio) WithTitle(title string) *InputMediaAudio

WithTitle sets the Title field.

type InputMediaClass added in v0.17.0

type InputMediaClass interface {
	AsInputMedia() InputMedia
}

InputMediaClass is an interface for types that can be used as InputMedia.

Known implementations:

type InputMediaDocument

type InputMediaDocument struct {
	// File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. [More information on Sending Files »]
	//
	// [More information on Sending Files »]: https://core.telegram.org/bots/api#sending-files
	Media FileArg `json:"media"`

	// Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. [More information on Sending Files »]
	//
	// [More information on Sending Files »]: https://core.telegram.org/bots/api#sending-files
	Thumbnail *InputFile `json:"thumbnail,omitempty"`

	// Optional. Caption of the document to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`

	// Optional. Mode for parsing entities in the document caption. See [formatting options] for more details.
	//
	// [formatting options]: https://core.telegram.org/bots/api#formatting-options
	ParseMode ParseMode `json:"parse_mode,omitempty"`

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

	// Optional. Disables automatic server-side content type detection for files uploaded using multipart/form-data. Always True, if the document is sent as part of an album.
	DisableContentTypeDetection bool `json:"disable_content_type_detection,omitempty"`
}

InputMediaDocument represents a general file to be sent.

func NewInputMediaDocument added in v0.16.0

func NewInputMediaDocument(media FileArg) *InputMediaDocument

NewInputMediaDocument creates a new InputMediaDocument.

func (*InputMediaDocument) AsInputMedia added in v0.17.0

func (v *InputMediaDocument) AsInputMedia() InputMedia

AsInputMedia wraps the variant into a InputMedia union.

func (*InputMediaDocument) WithCaption added in v0.17.0

func (v *InputMediaDocument) WithCaption(caption string) *InputMediaDocument

WithCaption sets the Caption field.

func (*InputMediaDocument) WithCaptionEntities added in v0.17.0

func (v *InputMediaDocument) WithCaptionEntities(captionEntities []MessageEntity) *InputMediaDocument

WithCaptionEntities sets the CaptionEntities field.

func (*InputMediaDocument) WithDisableContentTypeDetection added in v0.17.0

func (v *InputMediaDocument) WithDisableContentTypeDetection() *InputMediaDocument

WithDisableContentTypeDetection sets the DisableContentTypeDetection field.

func (*InputMediaDocument) WithParseMode added in v0.17.0

func (v *InputMediaDocument) WithParseMode(parseMode ParseMode) *InputMediaDocument

WithParseMode sets the ParseMode field.

func (*InputMediaDocument) WithThumbnail added in v0.17.0

func (v *InputMediaDocument) WithThumbnail(thumbnail InputFile) *InputMediaDocument

WithThumbnail sets the Thumbnail field.

type InputMediaPhoto

type InputMediaPhoto struct {
	// File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. [More information on Sending Files »]
	//
	// [More information on Sending Files »]: https://core.telegram.org/bots/api#sending-files
	Media FileArg `json:"media"`

	// Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`

	// Optional. Mode for parsing entities in the photo caption. See [formatting options] for more details.
	//
	// [formatting options]: https://core.telegram.org/bots/api#formatting-options
	ParseMode ParseMode `json:"parse_mode,omitempty"`

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

	// Optional. Pass True, if the caption must be shown above the message media
	ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`

	// Optional. Pass True if the photo needs to be covered with a spoiler animation
	HasSpoiler bool `json:"has_spoiler,omitempty"`
}

InputMediaPhoto represents a photo to be sent.

func NewInputMediaPhoto added in v0.16.0

func NewInputMediaPhoto(media FileArg) *InputMediaPhoto

NewInputMediaPhoto creates a new InputMediaPhoto.

func (*InputMediaPhoto) AsInputMedia added in v0.17.0

func (v *InputMediaPhoto) AsInputMedia() InputMedia

AsInputMedia wraps the variant into a InputMedia union.

func (*InputMediaPhoto) WithCaption added in v0.17.0

func (v *InputMediaPhoto) WithCaption(caption string) *InputMediaPhoto

WithCaption sets the Caption field.

func (*InputMediaPhoto) WithCaptionEntities added in v0.17.0

func (v *InputMediaPhoto) WithCaptionEntities(captionEntities []MessageEntity) *InputMediaPhoto

WithCaptionEntities sets the CaptionEntities field.

func (*InputMediaPhoto) WithHasSpoiler added in v0.17.0

func (v *InputMediaPhoto) WithHasSpoiler() *InputMediaPhoto

WithHasSpoiler sets the HasSpoiler field.

func (*InputMediaPhoto) WithParseMode added in v0.17.0

func (v *InputMediaPhoto) WithParseMode(parseMode ParseMode) *InputMediaPhoto

WithParseMode sets the ParseMode field.

func (*InputMediaPhoto) WithShowCaptionAboveMedia added in v0.17.0

func (v *InputMediaPhoto) WithShowCaptionAboveMedia() *InputMediaPhoto

WithShowCaptionAboveMedia sets the ShowCaptionAboveMedia field.

type InputMediaType added in v0.16.0

type InputMediaType int

InputMediaType represents the type of InputMedia.

const (
	InputMediaTypeAnimation InputMediaType = iota + 1 // "animation"
	InputMediaTypeDocument                            // "document"
	InputMediaTypeAudio                               // "audio"
	InputMediaTypePhoto                               // "photo"
	InputMediaTypeVideo                               // "video"
)

func (InputMediaType) MarshalText added in v0.16.0

func (v InputMediaType) MarshalText() ([]byte, error)

func (InputMediaType) String added in v0.16.0

func (v InputMediaType) String() string

func (*InputMediaType) UnmarshalText added in v0.16.0

func (v *InputMediaType) UnmarshalText(b []byte) error

type InputMediaVideo

type InputMediaVideo struct {
	// File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. [More information on Sending Files »]
	//
	// [More information on Sending Files »]: https://core.telegram.org/bots/api#sending-files
	Media FileArg `json:"media"`

	// Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. [More information on Sending Files »]
	//
	// [More information on Sending Files »]: https://core.telegram.org/bots/api#sending-files
	Thumbnail *InputFile `json:"thumbnail,omitempty"`

	// Optional. Cover for the video in the message. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. [More information on Sending Files »]
	//
	// [More information on Sending Files »]: https://core.telegram.org/bots/api#sending-files
	Cover *FileArg `json:"cover,omitempty"`

	// Optional. Start timestamp for the video in the message
	StartTimestamp int `json:"start_timestamp,omitempty"`

	// Optional. Caption of the video to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`

	// Optional. Mode for parsing entities in the video caption. See [formatting options] for more details.
	//
	// [formatting options]: https://core.telegram.org/bots/api#formatting-options
	ParseMode ParseMode `json:"parse_mode,omitempty"`

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

	// Optional. Pass True, if the caption must be shown above the message media
	ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`

	// Optional. Video width
	Width int `json:"width,omitempty"`

	// Optional. Video height
	Height int `json:"height,omitempty"`

	// Optional. Video duration in seconds
	Duration int `json:"duration,omitempty"`

	// Optional. Pass True if the uploaded video is suitable for streaming
	SupportsStreaming bool `json:"supports_streaming,omitempty"`

	// Optional. Pass True if the video needs to be covered with a spoiler animation
	HasSpoiler bool `json:"has_spoiler,omitempty"`
}

InputMediaVideo represents a video to be sent.

func NewInputMediaVideo added in v0.16.0

func NewInputMediaVideo(media FileArg) *InputMediaVideo

NewInputMediaVideo creates a new InputMediaVideo.

func (*InputMediaVideo) AsInputMedia added in v0.17.0

func (v *InputMediaVideo) AsInputMedia() InputMedia

AsInputMedia wraps the variant into a InputMedia union.

func (*InputMediaVideo) WithCaption added in v0.17.0

func (v *InputMediaVideo) WithCaption(caption string) *InputMediaVideo

WithCaption sets the Caption field.

func (*InputMediaVideo) WithCaptionEntities added in v0.17.0

func (v *InputMediaVideo) WithCaptionEntities(captionEntities []MessageEntity) *InputMediaVideo

WithCaptionEntities sets the CaptionEntities field.

func (*InputMediaVideo) WithCover added in v0.17.0

func (v *InputMediaVideo) WithCover(cover FileArg) *InputMediaVideo

WithCover sets the Cover field.

func (*InputMediaVideo) WithDuration added in v0.17.0

func (v *InputMediaVideo) WithDuration(duration int) *InputMediaVideo

WithDuration sets the Duration field.

func (*InputMediaVideo) WithHasSpoiler added in v0.17.0

func (v *InputMediaVideo) WithHasSpoiler() *InputMediaVideo

WithHasSpoiler sets the HasSpoiler field.

func (*InputMediaVideo) WithHeight added in v0.17.0

func (v *InputMediaVideo) WithHeight(height int) *InputMediaVideo

WithHeight sets the Height field.

func (*InputMediaVideo) WithParseMode added in v0.17.0

func (v *InputMediaVideo) WithParseMode(parseMode ParseMode) *InputMediaVideo

WithParseMode sets the ParseMode field.

func (*InputMediaVideo) WithShowCaptionAboveMedia added in v0.17.0

func (v *InputMediaVideo) WithShowCaptionAboveMedia() *InputMediaVideo

WithShowCaptionAboveMedia sets the ShowCaptionAboveMedia field.

func (*InputMediaVideo) WithStartTimestamp added in v0.17.0

func (v *InputMediaVideo) WithStartTimestamp(startTimestamp int) *InputMediaVideo

WithStartTimestamp sets the StartTimestamp field.

func (*InputMediaVideo) WithSupportsStreaming added in v0.17.0

func (v *InputMediaVideo) WithSupportsStreaming() *InputMediaVideo

WithSupportsStreaming sets the SupportsStreaming field.

func (*InputMediaVideo) WithThumbnail added in v0.17.0

func (v *InputMediaVideo) WithThumbnail(thumbnail InputFile) *InputMediaVideo

WithThumbnail sets the Thumbnail field.

func (*InputMediaVideo) WithWidth added in v0.17.0

func (v *InputMediaVideo) WithWidth(width int) *InputMediaVideo

WithWidth sets the Width field.

type InputMessageContent

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

InputMessageContent this object represents the content of a message to be sent as a result of an inline query. Telegram clients currently support the following 5 types:

Known implementations:

type InputPaidMedia added in v0.16.0

type InputPaidMedia struct {
	Photo   *InputPaidMediaPhoto
	Video   *InputPaidMediaVideo
	Unknown *UnknownVariant
}

InputPaidMedia this object describes the paid media to be sent. Currently, it can be one of

func InputPaidMediaOf added in v0.17.0

func InputPaidMediaOf(values ...InputPaidMediaClass) []InputPaidMedia

InputPaidMediaOf converts InputPaidMediaClass arguments to a slice of InputPaidMedia.

func (InputPaidMedia) AsInputPaidMedia added in v0.17.0

func (u InputPaidMedia) AsInputPaidMedia() InputPaidMedia

AsInputPaidMedia returns the union as-is, implementing InputPaidMediaClass.

func (*InputPaidMedia) IsUnknown added in v0.16.0

func (u *InputPaidMedia) IsUnknown() bool

IsUnknown reports whether this union contains an unknown variant. This can happen when the API returns a new variant not yet supported by this library.

func (InputPaidMedia) MarshalJSON added in v0.16.0

func (u InputPaidMedia) MarshalJSON() ([]byte, error)

func (*InputPaidMedia) Type added in v0.16.0

Type returns the discriminator value for this union.

func (*InputPaidMedia) UnmarshalJSON added in v0.16.0

func (u *InputPaidMedia) UnmarshalJSON(data []byte) error

type InputPaidMediaClass added in v0.17.0

type InputPaidMediaClass interface {
	AsInputPaidMedia() InputPaidMedia
}

InputPaidMediaClass is an interface for types that can be used as InputPaidMedia.

Known implementations:

type InputPaidMediaPhoto added in v0.16.0

type InputPaidMediaPhoto struct {
	// File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. [More information on Sending Files »]
	//
	// [More information on Sending Files »]: https://core.telegram.org/bots/api#sending-files
	Media FileArg `json:"media"`
}

InputPaidMediaPhoto the paid media to send is a photo.

func NewInputPaidMediaPhoto added in v0.16.0

func NewInputPaidMediaPhoto(media FileArg) *InputPaidMediaPhoto

NewInputPaidMediaPhoto creates a new InputPaidMediaPhoto.

func (*InputPaidMediaPhoto) AsInputPaidMedia added in v0.17.0

func (v *InputPaidMediaPhoto) AsInputPaidMedia() InputPaidMedia

AsInputPaidMedia wraps the variant into a InputPaidMedia union.

type InputPaidMediaType added in v0.16.0

type InputPaidMediaType int

InputPaidMediaType represents the type of InputPaidMedia.

const (
	InputPaidMediaTypePhoto InputPaidMediaType = iota + 1 // "photo"
	InputPaidMediaTypeVideo                               // "video"
)

func (InputPaidMediaType) MarshalText added in v0.16.0

func (v InputPaidMediaType) MarshalText() ([]byte, error)

func (InputPaidMediaType) String added in v0.16.0

func (v InputPaidMediaType) String() string

func (*InputPaidMediaType) UnmarshalText added in v0.16.0

func (v *InputPaidMediaType) UnmarshalText(b []byte) error

type InputPaidMediaVideo added in v0.16.0

type InputPaidMediaVideo struct {
	// File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. [More information on Sending Files »]
	//
	// [More information on Sending Files »]: https://core.telegram.org/bots/api#sending-files
	Media FileArg `json:"media"`

	// Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. [More information on Sending Files »]
	//
	// [More information on Sending Files »]: https://core.telegram.org/bots/api#sending-files
	Thumbnail *InputFile `json:"thumbnail,omitempty"`

	// Optional. Cover for the video in the message. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. [More information on Sending Files »]
	//
	// [More information on Sending Files »]: https://core.telegram.org/bots/api#sending-files
	Cover *FileArg `json:"cover,omitempty"`

	// Optional. Start timestamp for the video in the message
	StartTimestamp int `json:"start_timestamp,omitempty"`

	// Optional. Video width
	Width int `json:"width,omitempty"`

	// Optional. Video height
	Height int `json:"height,omitempty"`

	// Optional. Video duration in seconds
	Duration int `json:"duration,omitempty"`

	// Optional. Pass True if the uploaded video is suitable for streaming
	SupportsStreaming bool `json:"supports_streaming,omitempty"`
}

InputPaidMediaVideo the paid media to send is a video.

func NewInputPaidMediaVideo added in v0.16.0

func NewInputPaidMediaVideo(media FileArg) *InputPaidMediaVideo

NewInputPaidMediaVideo creates a new InputPaidMediaVideo.

func (*InputPaidMediaVideo) AsInputPaidMedia added in v0.17.0

func (v *InputPaidMediaVideo) AsInputPaidMedia() InputPaidMedia

AsInputPaidMedia wraps the variant into a InputPaidMedia union.

func (*InputPaidMediaVideo) WithCover added in v0.17.0

func (v *InputPaidMediaVideo) WithCover(cover FileArg) *InputPaidMediaVideo

WithCover sets the Cover field.

func (*InputPaidMediaVideo) WithDuration added in v0.17.0

func (v *InputPaidMediaVideo) WithDuration(duration int) *InputPaidMediaVideo

WithDuration sets the Duration field.

func (*InputPaidMediaVideo) WithHeight added in v0.17.0

func (v *InputPaidMediaVideo) WithHeight(height int) *InputPaidMediaVideo

WithHeight sets the Height field.

func (*InputPaidMediaVideo) WithStartTimestamp added in v0.17.0

func (v *InputPaidMediaVideo) WithStartTimestamp(startTimestamp int) *InputPaidMediaVideo

WithStartTimestamp sets the StartTimestamp field.

func (*InputPaidMediaVideo) WithSupportsStreaming added in v0.17.0

func (v *InputPaidMediaVideo) WithSupportsStreaming() *InputPaidMediaVideo

WithSupportsStreaming sets the SupportsStreaming field.

func (*InputPaidMediaVideo) WithThumbnail added in v0.17.0

func (v *InputPaidMediaVideo) WithThumbnail(thumbnail InputFile) *InputPaidMediaVideo

WithThumbnail sets the Thumbnail field.

func (*InputPaidMediaVideo) WithWidth added in v0.17.0

func (v *InputPaidMediaVideo) WithWidth(width int) *InputPaidMediaVideo

WithWidth sets the Width field.

type InputPollOption added in v0.16.0

type InputPollOption struct {
	// Option text, 1-100 characters
	Text string `json:"text"`

	// Optional. Mode for parsing entities in the text. See [formatting options] for more details. Currently, only custom emoji entities are allowed
	//
	// [formatting options]: https://core.telegram.org/bots/api#formatting-options
	TextParseMode ParseMode `json:"text_parse_mode,omitempty"`

	// Optional. A JSON-serialized list of special entities that appear in the poll option text. It can be specified instead of text_parse_mode
	TextEntities []MessageEntity `json:"text_entities,omitempty"`
}

InputPollOption this object contains information about one answer option in a poll to be sent.

type InputProfilePhoto added in v0.16.0

type InputProfilePhoto struct {
	Static   *InputProfilePhotoStatic
	Animated *InputProfilePhotoAnimated
	Unknown  *UnknownVariant
}

InputProfilePhoto this object describes a profile photo to set. Currently, it can be one of

func InputProfilePhotoOf added in v0.17.0

func InputProfilePhotoOf(values ...InputProfilePhotoClass) []InputProfilePhoto

InputProfilePhotoOf converts InputProfilePhotoClass arguments to a slice of InputProfilePhoto.

func (InputProfilePhoto) AsInputProfilePhoto added in v0.17.0

func (u InputProfilePhoto) AsInputProfilePhoto() InputProfilePhoto

AsInputProfilePhoto returns the union as-is, implementing InputProfilePhotoClass.

func (*InputProfilePhoto) IsUnknown added in v0.16.0

func (u *InputProfilePhoto) IsUnknown() bool

IsUnknown reports whether this union contains an unknown variant. This can happen when the API returns a new variant not yet supported by this library.

func (InputProfilePhoto) MarshalJSON added in v0.16.0

func (u InputProfilePhoto) MarshalJSON() ([]byte, error)

func (*InputProfilePhoto) Type added in v0.16.0

Type returns the discriminator value for this union.

func (*InputProfilePhoto) UnmarshalJSON added in v0.16.0

func (u *InputProfilePhoto) UnmarshalJSON(data []byte) error

type InputProfilePhotoAnimated added in v0.16.0

type InputProfilePhotoAnimated struct {
	// The animated profile photo. Profile photos can't be reused and can only be uploaded as a new file, so you can pass “attach://<file_attach_name>” if the photo was uploaded using multipart/form-data under <file_attach_name>. [More information on Sending Files »]
	//
	// [More information on Sending Files »]: https://core.telegram.org/bots/api#sending-files
	Animation InputFile `json:"animation"`

	// Optional. Timestamp in seconds of the frame that will be used as the static profile photo. Defaults to 0.0.
	MainFrameTimestamp float64 `json:"main_frame_timestamp,omitempty"`
}

InputProfilePhotoAnimated an animated profile photo in the MPEG4 format.

func NewInputProfilePhotoAnimated added in v0.16.0

func NewInputProfilePhotoAnimated(animation InputFile) *InputProfilePhotoAnimated

NewInputProfilePhotoAnimated creates a new InputProfilePhotoAnimated.

func (*InputProfilePhotoAnimated) AsInputProfilePhoto added in v0.17.0

func (v *InputProfilePhotoAnimated) AsInputProfilePhoto() InputProfilePhoto

AsInputProfilePhoto wraps the variant into a InputProfilePhoto union.

func (*InputProfilePhotoAnimated) WithMainFrameTimestamp added in v0.17.0

func (v *InputProfilePhotoAnimated) WithMainFrameTimestamp(mainFrameTimestamp float64) *InputProfilePhotoAnimated

WithMainFrameTimestamp sets the MainFrameTimestamp field.

type InputProfilePhotoClass added in v0.17.0

type InputProfilePhotoClass interface {
	AsInputProfilePhoto() InputProfilePhoto
}

InputProfilePhotoClass is an interface for types that can be used as InputProfilePhoto.

Known implementations:

type InputProfilePhotoStatic added in v0.16.0

type InputProfilePhotoStatic struct {
	// The static profile photo. Profile photos can't be reused and can only be uploaded as a new file, so you can pass “attach://<file_attach_name>” if the photo was uploaded using multipart/form-data under <file_attach_name>. [More information on Sending Files »]
	//
	// [More information on Sending Files »]: https://core.telegram.org/bots/api#sending-files
	Photo InputFile `json:"photo"`
}

InputProfilePhotoStatic a static profile photo in the .JPG format.

func NewInputProfilePhotoStatic added in v0.16.0

func NewInputProfilePhotoStatic(photo InputFile) *InputProfilePhotoStatic

NewInputProfilePhotoStatic creates a new InputProfilePhotoStatic.

func (*InputProfilePhotoStatic) AsInputProfilePhoto added in v0.17.0

func (v *InputProfilePhotoStatic) AsInputProfilePhoto() InputProfilePhoto

AsInputProfilePhoto wraps the variant into a InputProfilePhoto union.

type InputProfilePhotoType added in v0.16.0

type InputProfilePhotoType int

InputProfilePhotoType represents the type of InputProfilePhoto.

const (
	InputProfilePhotoTypeStatic   InputProfilePhotoType = iota + 1 // "static"
	InputProfilePhotoTypeAnimated                                  // "animated"
)

func (InputProfilePhotoType) MarshalText added in v0.16.0

func (v InputProfilePhotoType) MarshalText() ([]byte, error)

func (InputProfilePhotoType) String added in v0.16.0

func (v InputProfilePhotoType) String() string

func (*InputProfilePhotoType) UnmarshalText added in v0.16.0

func (v *InputProfilePhotoType) UnmarshalText(b []byte) error

type InputSticker added in v0.8.0

type InputSticker struct {
	// The added sticker. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new file using multipart/form-data under <file_attach_name> name. Animated and video stickers can't be uploaded via HTTP URL. [More information on Sending Files »]
	//
	// [More information on Sending Files »]: https://core.telegram.org/bots/api#sending-files
	Sticker FileArg `json:"sticker"`

	// Format of the added sticker, must be one of “static” for a .WEBP or .PNG image, “animated” for a .TGS animation, “video” for a .WEBM video
	Format StickerFormat `json:"format"`

	// List of 1-20 emoji associated with the sticker
	EmojiList []string `json:"emoji_list"`

	// Optional. Position where the mask should be placed on faces. For “mask” stickers only.
	MaskPosition *MaskPosition `json:"mask_position,omitempty"`

	// Optional. List of 0-20 search keywords for the sticker with total length of up to 64 characters. For “regular” and “custom_emoji” stickers only.
	Keywords []string `json:"keywords,omitempty"`
}

InputSticker this object describes a sticker to be added to a sticker set.

type InputStoryContent added in v0.16.0

type InputStoryContent struct {
	Photo   *InputStoryContentPhoto
	Video   *InputStoryContentVideo
	Unknown *UnknownVariant
}

InputStoryContent this object describes the content of a story to post. Currently, it can be one of

func InputStoryContentOf added in v0.17.0

func InputStoryContentOf(values ...InputStoryContentClass) []InputStoryContent

InputStoryContentOf converts InputStoryContentClass arguments to a slice of InputStoryContent.

func (InputStoryContent) AsInputStoryContent added in v0.17.0

func (u InputStoryContent) AsInputStoryContent() InputStoryContent

AsInputStoryContent returns the union as-is, implementing InputStoryContentClass.

func (*InputStoryContent) IsUnknown added in v0.16.0

func (u *InputStoryContent) IsUnknown() bool

IsUnknown reports whether this union contains an unknown variant. This can happen when the API returns a new variant not yet supported by this library.

func (InputStoryContent) MarshalJSON added in v0.16.0

func (u InputStoryContent) MarshalJSON() ([]byte, error)

func (*InputStoryContent) Type added in v0.16.0

Type returns the discriminator value for this union.

func (*InputStoryContent) UnmarshalJSON added in v0.16.0

func (u *InputStoryContent) UnmarshalJSON(data []byte) error

type InputStoryContentClass added in v0.17.0

type InputStoryContentClass interface {
	AsInputStoryContent() InputStoryContent
}

InputStoryContentClass is an interface for types that can be used as InputStoryContent.

Known implementations:

type InputStoryContentPhoto added in v0.16.0

type InputStoryContentPhoto struct {
	// The photo to post as a story. The photo must be of the size 1080x1920 and must not exceed 10 MB. The photo can't be reused and can only be uploaded as a new file, so you can pass “attach://<file_attach_name>” if the photo was uploaded using multipart/form-data under <file_attach_name>. [More information on Sending Files »]
	//
	// [More information on Sending Files »]: https://core.telegram.org/bots/api#sending-files
	Photo InputFile `json:"photo"`
}

InputStoryContentPhoto describes a photo to post as a story.

func NewInputStoryContentPhoto added in v0.16.0

func NewInputStoryContentPhoto(photo InputFile) *InputStoryContentPhoto

NewInputStoryContentPhoto creates a new InputStoryContentPhoto.

func (*InputStoryContentPhoto) AsInputStoryContent added in v0.17.0

func (v *InputStoryContentPhoto) AsInputStoryContent() InputStoryContent

AsInputStoryContent wraps the variant into a InputStoryContent union.

type InputStoryContentType added in v0.16.0

type InputStoryContentType int

InputStoryContentType represents the type of InputStoryContent.

const (
	InputStoryContentTypePhoto InputStoryContentType = iota + 1 // "photo"
	InputStoryContentTypeVideo                                  // "video"
)

func (InputStoryContentType) MarshalText added in v0.16.0

func (v InputStoryContentType) MarshalText() ([]byte, error)

func (InputStoryContentType) String added in v0.16.0

func (v InputStoryContentType) String() string

func (*InputStoryContentType) UnmarshalText added in v0.16.0

func (v *InputStoryContentType) UnmarshalText(b []byte) error

type InputStoryContentVideo added in v0.16.0

type InputStoryContentVideo struct {
	// The video to post as a story. The video must be of the size 720x1280, streamable, encoded with H.265 codec, with key frames added each second in the MPEG4 format, and must not exceed 30 MB. The video can't be reused and can only be uploaded as a new file, so you can pass “attach://<file_attach_name>” if the video was uploaded using multipart/form-data under <file_attach_name>. [More information on Sending Files »]
	//
	// [More information on Sending Files »]: https://core.telegram.org/bots/api#sending-files
	Video InputFile `json:"video"`

	// Optional. Precise duration of the video in seconds; 0-60
	Duration float64 `json:"duration,omitempty"`

	// Optional. Timestamp in seconds of the frame that will be used as the static cover for the story. Defaults to 0.0.
	CoverFrameTimestamp float64 `json:"cover_frame_timestamp,omitempty"`

	// Optional. Pass True if the video has no sound
	IsAnimation bool `json:"is_animation,omitempty"`
}

InputStoryContentVideo describes a video to post as a story.

func NewInputStoryContentVideo added in v0.16.0

func NewInputStoryContentVideo(video InputFile) *InputStoryContentVideo

NewInputStoryContentVideo creates a new InputStoryContentVideo.

func (*InputStoryContentVideo) AsInputStoryContent added in v0.17.0

func (v *InputStoryContentVideo) AsInputStoryContent() InputStoryContent

AsInputStoryContent wraps the variant into a InputStoryContent union.

func (*InputStoryContentVideo) WithCoverFrameTimestamp added in v0.17.0

func (v *InputStoryContentVideo) WithCoverFrameTimestamp(coverFrameTimestamp float64) *InputStoryContentVideo

WithCoverFrameTimestamp sets the CoverFrameTimestamp field.

func (*InputStoryContentVideo) WithDuration added in v0.17.0

func (v *InputStoryContentVideo) WithDuration(duration float64) *InputStoryContentVideo

WithDuration sets the Duration field.

func (*InputStoryContentVideo) WithIsAnimation added in v0.17.0

func (v *InputStoryContentVideo) WithIsAnimation() *InputStoryContentVideo

WithIsAnimation sets the IsAnimation field.

type InputTextMessageContent

type InputTextMessageContent struct {
	// Text of the message to be sent, 1-4096 characters
	MessageText string `json:"message_text"`

	// Optional. Mode for parsing entities in the message text. See [formatting options] for more details.
	//
	// [formatting options]: https://core.telegram.org/bots/api#formatting-options
	ParseMode ParseMode `json:"parse_mode,omitempty"`

	// Optional. List of special entities that appear in message text, which can be specified instead of parse_mode
	Entities []MessageEntity `json:"entities,omitempty"`

	// Optional. Link preview generation options for the message
	LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options,omitempty"`
}

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

func NewInputTextMessageContent added in v0.17.0

func NewInputTextMessageContent(messageText string) *InputTextMessageContent

NewInputTextMessageContent creates a new InputTextMessageContent.

func (*InputTextMessageContent) WithEntities added in v0.17.0

func (v *InputTextMessageContent) WithEntities(entities []MessageEntity) *InputTextMessageContent

WithEntities sets the Entities field.

func (*InputTextMessageContent) WithLinkPreviewOptions added in v0.17.0

func (v *InputTextMessageContent) WithLinkPreviewOptions(linkPreviewOptions LinkPreviewOptions) *InputTextMessageContent

WithLinkPreviewOptions sets the LinkPreviewOptions field.

func (*InputTextMessageContent) WithParseMode added in v0.17.0

func (v *InputTextMessageContent) WithParseMode(parseMode ParseMode) *InputTextMessageContent

WithParseMode sets the ParseMode field.

type InputVenueMessageContent

type InputVenueMessageContent struct {
	// Latitude of the venue in degrees
	Latitude float64 `json:"latitude"`

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

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

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

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

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

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

	// Optional. Google Places type of the venue. (See [supported types].)
	//
	// [supported types]: https://developers.google.com/places/web-service/supported_types
	GooglePlaceType string `json:"google_place_type,omitempty"`
}

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

func NewInputVenueMessageContent added in v0.17.0

func NewInputVenueMessageContent(latitude float64, longitude float64, title string, address string) *InputVenueMessageContent

NewInputVenueMessageContent creates a new InputVenueMessageContent.

func (*InputVenueMessageContent) WithFoursquareID added in v0.17.0

func (v *InputVenueMessageContent) WithFoursquareID(foursquareID string) *InputVenueMessageContent

WithFoursquareID sets the FoursquareID field.

func (*InputVenueMessageContent) WithFoursquareType added in v0.17.0

func (v *InputVenueMessageContent) WithFoursquareType(foursquareType string) *InputVenueMessageContent

WithFoursquareType sets the FoursquareType field.

func (*InputVenueMessageContent) WithGooglePlaceID added in v0.17.0

func (v *InputVenueMessageContent) WithGooglePlaceID(googlePlaceID string) *InputVenueMessageContent

WithGooglePlaceID sets the GooglePlaceID field.

func (*InputVenueMessageContent) WithGooglePlaceType added in v0.17.0

func (v *InputVenueMessageContent) WithGooglePlaceType(googlePlaceType string) *InputVenueMessageContent

WithGooglePlaceType sets the GooglePlaceType field.

type Interceptor added in v0.13.0

type Interceptor func(ctx context.Context, req *Request, dst any, invoker InterceptorInvoker) error

Interceptor is a function that intercepts request and response.

func NewInterceptorDefaultParseMethod added in v0.13.0

func NewInterceptorDefaultParseMethod(pm ParseMode) Interceptor

NewInterceptorDefaultParseMethod returns a new interceptor that sets the parse_method to the request if it is empty. Use in combination with NewInterceptorMethodFilter to filter and specify only needed methods. Like:

NewInterceptorMethodFilter(NewInterceptorDefaultParseMethod(tg.HTML), "sendMessage", "editMessageText")

func NewInterceptorMethodFilter added in v0.13.0

func NewInterceptorMethodFilter(interceptor Interceptor, methods ...string) Interceptor

ТewInterceptorMethodFilter returns a new filtering interceptor that calls the interceptor only for specified methods.

func NewInterceptorRetryFloodError added in v0.13.0

func NewInterceptorRetryFloodError(opts ...InterceptorRetryFloodErrorOption) Interceptor

NewInterceptorRetryFloodError returns a new interceptor that retries the request if the error is flood error. With that interceptor, calling of method that hit limit will be look like it will look like the request just takes unusually long. Under the hood, multiple HTTP requests are being performed, with the appropriate delays in between.

Default tries is 3, maxRetryAfter is 1 hour, timeAfter is time.After. The interceptor will retry the request if the error is flood error with RetryAfter less than maxRetryAfter. The interceptor will wait for RetryAfter duration before retrying the request. The interceptor will retry the request for tries times.

func NewInterceptorRetryInternalServerError added in v0.13.0

func NewInterceptorRetryInternalServerError(opts ...RetryInternalServerErrorOption) Interceptor

NewInterceptorRetryInternalServerError returns a new interceptor that retries the request if the error is internal server error.

With that interceptor, calling of method that hit limit will be look like it will look like the request just takes unusually long. Under the hood, multiple HTTP requests are being performed, with the appropriate delays in between.

Default tries is 10, delay is 100ms, timeAfter is time.After. The interceptor will retry the request if the error is internal server error. The interceptor will wait for delay * 2^i + random jitter before retrying the request, where i is the number of tries. The interceptor will retry the request for ten times.

type InterceptorInvoker added in v0.13.0

type InterceptorInvoker func(ctx context.Context, req *Request, dst any) error

type InterceptorRetryFloodErrorOption added in v0.13.0

type InterceptorRetryFloodErrorOption func(*interceptorRetryFloodErrorOpts)

InterceptorRetryFloodErrorOption is an option for NewRetryFloodErrorInterceptor.

func WithInterceptorRetryFloodErrorMaxRetryAfter added in v0.13.0

func WithInterceptorRetryFloodErrorMaxRetryAfter(maxRetryAfter time.Duration) InterceptorRetryFloodErrorOption

WithInterceptorRetryFloodErrorMaxRetryAfter sets the maximum retry after duration.

func WithInterceptorRetryFloodErrorTimeAfter added in v0.13.0

func WithInterceptorRetryFloodErrorTimeAfter(timeAfter func(time.Duration) <-chan time.Time) InterceptorRetryFloodErrorOption

WithInterceptorRetryFloodErrorTimeAfter sets the time.After function.

func WithInterceptorRetryFloodErrorTries added in v0.13.0

func WithInterceptorRetryFloodErrorTries(tries int) InterceptorRetryFloodErrorOption

WithInterceptorRetryFloodErrorTries sets the number of tries.

type Invoice

type Invoice struct {
	// Product name
	Title string `json:"title"`

	// Product description
	Description string `json:"description"`

	// Unique bot deep-linking parameter that can be used to generate this invoice
	StartParameter string `json:"start_parameter"`

	// Three-letter ISO 4217 [currency] code, or “XTR” for payments in [Telegram Stars]
	//
	// [currency]: https://core.telegram.org/bots/payments#supported-currencies
	// [Telegram Stars]: https://t.me/BotNews/90
	Currency string `json:"currency"`

	// Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in [currencies.json], it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
	//
	// [currencies.json]: https://core.telegram.org/bots/payments/currencies.json
	TotalAmount int `json:"total_amount"`
}

Invoice this object contains basic information about an invoice.

type KeyboardButton

type KeyboardButton struct {
	// Text of the button. If none of the fields other than text, icon_custom_emoji_id, and style are used, it will be sent as a message when the button is pressed
	Text string `json:"text"`

	// Optional. Unique identifier of the custom emoji shown before the text of the button. Can only be used by bots that purchased additional usernames on [Fragment] or in the messages directly sent by the bot to private, group and supergroup chats if the owner of the bot has a Telegram Premium subscription.
	//
	// [Fragment]: https://fragment.com
	IconCustomEmojiID string `json:"icon_custom_emoji_id,omitempty"`

	// Optional. Style of the button. Must be one of “danger” (red), “success” (green) or “primary” (blue). If omitted, then an app-specific style is used.
	Style ButtonStyle `json:"style,omitempty"`

	// Optional. If specified, pressing the button will open a list of suitable users. Identifiers of selected users will be sent to the bot in a “users_shared” service message. Available in private chats only.
	RequestUsers *KeyboardButtonRequestUsers `json:"request_users,omitempty"`

	// Optional. If specified, pressing the button will open a list of suitable chats. Tapping on a chat will send its identifier to the bot in a “chat_shared” service message. Available in private chats only.
	RequestChat *KeyboardButtonRequestChat `json:"request_chat,omitempty"`

	// Optional. If True, the user's phone number will be sent as a contact when the button is pressed. Available in private chats only.
	RequestContact bool `json:"request_contact,omitempty"`

	// Optional. If True, the user's current location will be sent when the button is pressed. Available in private chats only.
	RequestLocation bool `json:"request_location,omitempty"`

	// Optional. If specified, the user will be asked to create a poll and send it to the bot when the button is pressed. Available in private chats only.
	RequestPoll *KeyboardButtonPollType `json:"request_poll,omitempty"`

	// Optional. If specified, the described [Web App] will be launched when the button is pressed. The Web App will be able to send a “web_app_data” service message. Available in private chats only.
	//
	// [Web App]: https://core.telegram.org/bots/webapps
	WebApp *WebAppInfo `json:"web_app,omitempty"`
}

KeyboardButton this object represents one button of the reply keyboard. At most one of the fields other than text, icon_custom_emoji_id, and style must be used to specify the type of the button. For simple text buttons, String can be used instead of this object to specify the button text.

func NewKeyboardButton added in v0.0.2

func NewKeyboardButton(text string) KeyboardButton

NewKeyboardButton creates KeyboardButton.

func NewKeyboardButtonRequestChat added in v0.12.0

func NewKeyboardButtonRequestChat(text string, requestChat KeyboardButtonRequestChat) KeyboardButton

NewKeyboardButtonRequestChat creates KeyboardButton with RequestChat.

func NewKeyboardButtonRequestContact added in v0.0.2

func NewKeyboardButtonRequestContact(text string) KeyboardButton

NewKeyboardButtonRequestContact creates KeyboardButton with RequestContact.

func NewKeyboardButtonRequestLocation added in v0.0.2

func NewKeyboardButtonRequestLocation(text string) KeyboardButton

NewKeyboardButtonRequestLocation creates KeyboardButton with RequestLocation.

func NewKeyboardButtonRequestPoll added in v0.0.2

func NewKeyboardButtonRequestPoll(text string, requestPoll KeyboardButtonPollType) KeyboardButton

NewKeyboardButtonRequestPoll creates KeyboardButton with RequestPoll.

func NewKeyboardButtonRequestUsers added in v0.12.0

func NewKeyboardButtonRequestUsers(text string, requestUsers KeyboardButtonRequestUsers) KeyboardButton

NewKeyboardButtonRequestUsers creates KeyboardButton with RequestUsers.

func NewKeyboardButtonWebApp added in v0.0.2

func NewKeyboardButtonWebApp(text string, webApp WebAppInfo) KeyboardButton

NewKeyboardButtonWebApp creates KeyboardButton with WebApp.

func (KeyboardButton) WithIconCustomEmojiID added in v0.18.0

func (v KeyboardButton) WithIconCustomEmojiID(iconCustomEmojiID string) KeyboardButton

WithIconCustomEmojiID sets the IconCustomEmojiID field.

func (KeyboardButton) WithStyle added in v0.18.0

func (v KeyboardButton) WithStyle(style ButtonStyle) KeyboardButton

WithStyle sets the Style field.

type KeyboardButtonPollType

type KeyboardButtonPollType struct {
	// Optional. If quiz is passed, the user will be allowed to create only polls in the quiz mode. If regular is passed, only regular polls will be allowed. Otherwise, the user will be allowed to create a poll of any type.
	Type PollType `json:"type,omitempty"`
}

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

type KeyboardButtonRequestChat added in v0.6.0

type KeyboardButtonRequestChat struct {
	// Signed 32-bit identifier of the request, which will be received back in the [ChatShared] object. Must be unique within the message
	RequestID int `json:"request_id"`

	// Pass True to request a channel chat, pass False to request a group or a supergroup chat.
	ChatIsChannel bool `json:"chat_is_channel"`

	// Optional. Pass True to request a forum supergroup, pass False to request a non-forum chat. If not specified, no additional restrictions are applied.
	ChatIsForum bool `json:"chat_is_forum,omitempty"`

	// Optional. Pass True to request a supergroup or a channel with a username, pass False to request a chat without a username. If not specified, no additional restrictions are applied.
	ChatHasUsername bool `json:"chat_has_username,omitempty"`

	// Optional. Pass True to request a chat owned by the user. Otherwise, no additional restrictions are applied.
	ChatIsCreated bool `json:"chat_is_created,omitempty"`

	// Optional. A JSON-serialized object listing the required administrator rights of the user in the chat. The rights must be a superset of bot_administrator_rights. If not specified, no additional restrictions are applied.
	UserAdministratorRights *ChatAdministratorRights `json:"user_administrator_rights,omitempty"`

	// Optional. A JSON-serialized object listing the required administrator rights of the bot in the chat. The rights must be a subset of user_administrator_rights. If not specified, no additional restrictions are applied.
	BotAdministratorRights *ChatAdministratorRights `json:"bot_administrator_rights,omitempty"`

	// Optional. Pass True to request a chat with the bot as a member. Otherwise, no additional restrictions are applied.
	BotIsMember bool `json:"bot_is_member,omitempty"`

	// Optional. Pass True to request the chat's title
	RequestTitle bool `json:"request_title,omitempty"`

	// Optional. Pass True to request the chat's username
	RequestUsername bool `json:"request_username,omitempty"`

	// Optional. Pass True to request the chat's photo
	RequestPhoto bool `json:"request_photo,omitempty"`
}

KeyboardButtonRequestChat this object defines the criteria used to request a suitable chat. Information about the selected chat will be shared with the bot when the corresponding button is pressed. The bot will be granted requested rights in the chat if appropriate. More about requesting chats ».

type KeyboardButtonRequestUsers added in v0.12.0

type KeyboardButtonRequestUsers struct {
	// Signed 32-bit identifier of the request that will be received back in the [UsersShared] object. Must be unique within the message
	RequestID int `json:"request_id"`

	// Optional. Pass True to request bots, pass False to request regular users. If not specified, no additional restrictions are applied.
	UserIsBot bool `json:"user_is_bot,omitempty"`

	// Optional. Pass True to request premium users, pass False to request non-premium users. If not specified, no additional restrictions are applied.
	UserIsPremium bool `json:"user_is_premium,omitempty"`

	// Optional. The maximum number of users to be selected; 1-10. Defaults to 1.
	MaxQuantity int `json:"max_quantity,omitempty"`

	// Optional. Pass True to request the users' first and last names
	RequestName bool `json:"request_name,omitempty"`

	// Optional. Pass True to request the users' usernames
	RequestUsername bool `json:"request_username,omitempty"`

	// Optional. Pass True to request the users' photos
	RequestPhoto bool `json:"request_photo,omitempty"`
}

KeyboardButtonRequestUsers this object defines the criteria used to request suitable users. Information about the selected users will be shared with the bot when the corresponding button is pressed. More about requesting users »

type LabeledPrice

type LabeledPrice struct {
	// Portion label
	Label string `json:"label"`

	// Price of the product in the smallest units of the [currency] (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in [currencies.json], it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
	//
	// [currency]: https://core.telegram.org/bots/payments#supported-currencies
	// [currencies.json]: https://core.telegram.org/bots/payments/currencies.json
	Amount int `json:"amount"`
}

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

type LeaveChatCall

type LeaveChatCall struct {
	CallNoResult
}

LeaveChatCall represents a call to the leaveChat method. Use this method for your bot to leave a group, supergroup or channel. Returns True on success.

func NewLeaveChatCall

func NewLeaveChatCall(chatID PeerID) *LeaveChatCall

NewLeaveChatCall constructs a new LeaveChatCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername). Channel direct messages chats aren't supported; leave the corresponding channel instead.

func (*LeaveChatCall) ChatID added in v0.0.5

func (call *LeaveChatCall) ChatID(chatID PeerID) *LeaveChatCall

ChatID sets the chat_id parameter.

type LinkPreviewOptions added in v0.12.0

type LinkPreviewOptions struct {
	// Optional. True, if the link preview is disabled
	IsDisabled bool `json:"is_disabled,omitempty"`

	// Optional. URL to use for the link preview. If empty, then the first URL found in the message text will be used
	URL string `json:"url,omitempty"`

	// Optional. True, if the media in the link preview is supposed to be shrunk; ignored if the URL isn't explicitly specified or media size change isn't supported for the preview
	PreferSmallMedia bool `json:"prefer_small_media,omitempty"`

	// Optional. True, if the media in the link preview is supposed to be enlarged; ignored if the URL isn't explicitly specified or media size change isn't supported for the preview
	PreferLargeMedia bool `json:"prefer_large_media,omitempty"`

	// Optional. True, if the link preview must be shown above the message text; otherwise, the link preview will be shown below the message text
	ShowAboveText bool `json:"show_above_text,omitempty"`
}

LinkPreviewOptions describes the options used for link preview generation.

type Location

type Location struct {
	// Latitude as defined by the sender
	Latitude float64 `json:"latitude"`

	// Longitude as defined by the sender
	Longitude float64 `json:"longitude"`

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

	// Optional. Time relative to the message sending date, during which the location can be updated; in seconds. For active live locations only.
	LivePeriod int `json:"live_period,omitempty"`

	// Optional. The direction in which user is moving, in degrees; 1-360. For active live locations only.
	Heading int `json:"heading,omitempty"`

	// Optional. The maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only.
	ProximityAlertRadius int `json:"proximity_alert_radius,omitempty"`
}

Location this object represents a point on the map.

type LocationAddress added in v0.16.0

type LocationAddress struct {
	// The two-letter ISO 3166-1 alpha-2 country code of the country where the location is located
	CountryCode string `json:"country_code"`

	// Optional. State of the location
	State string `json:"state,omitempty"`

	// Optional. City of the location
	City string `json:"city,omitempty"`

	// Optional. Street address of the location
	Street string `json:"street,omitempty"`
}

LocationAddress describes the physical address of a location.

type LogOutCall

type LogOutCall struct {
	CallNoResult
}

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

func NewLogOutCall

func NewLogOutCall() *LogOutCall

NewLogOutCall constructs a new LogOutCall.

type LoginURL added in v0.0.5

type LoginURL struct {
	// An HTTPS URL to be opened with user authorization data added to the query string when the button is pressed. If the user refuses to provide authorization data, the original URL without information about the user will be opened. The data added is the same as described in [Receiving authorization data].  NOTE: You must always check the hash of the received data to verify the authentication and the integrity of the data as described in [Checking authorization].
	//
	// [Receiving authorization data]: https://core.telegram.org/widgets/login#receiving-authorization-data
	// [Checking authorization]: https://core.telegram.org/widgets/login#checking-authorization
	URL string `json:"url"`

	// Optional. New text of the button in forwarded messages.
	ForwardText string `json:"forward_text,omitempty"`

	// Optional. Username of a bot, which will be used for user authorization. See [Setting up a bot] for more details. If not specified, the current bot's username will be assumed. The url's domain must be the same as the domain linked with the bot. See [Linking your domain to the bot] for more details.
	//
	// [Setting up a bot]: https://core.telegram.org/widgets/login#setting-up-a-bot
	// [Linking your domain to the bot]: https://core.telegram.org/widgets/login#linking-your-domain-to-the-bot
	BotUsername Username `json:"bot_username,omitempty"`

	// Optional. Pass True to request the permission for your bot to send messages to the user.
	RequestWriteAccess bool `json:"request_write_access,omitempty"`
}

LoginURL this object represents a parameter of the inline keyboard button used to automatically authorize a user. Serves as a great replacement for the Telegram Login Widget when the user is coming from Telegram. All the user needs to do is tap/click a button and confirm that they want to log in: Telegram apps support these buttons as of version 5.7.

type MaskPosition

type MaskPosition struct {
	// The part of the face relative to which the mask should be placed. One of “forehead”, “eyes”, “mouth”, or “chin”.
	Point MaskPositionPoint `json:"point"`

	// Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. For example, choosing -1.0 will place mask just to the left of the default mask position.
	XShift float64 `json:"x_shift"`

	// Shift by Y-axis measured in heights of the mask scaled to the face size, from top to bottom. For example, 1.0 will place the mask just below the default mask position.
	YShift float64 `json:"y_shift"`

	// Mask scaling coefficient. For example, 2.0 means double size.
	Scale float64 `json:"scale"`
}

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

type MaskPositionPoint added in v0.17.0

type MaskPositionPoint int8

MaskPositionPoint represents an enum type.

const (
	MaskPositionPointUnknown  MaskPositionPoint = iota
	MaskPositionPointForehead                   // "forehead"
	MaskPositionPointEyes                       // "eyes"
	MaskPositionPointMouth                      // "mouth"
	MaskPositionPointChin                       // "chin"
)

func (MaskPositionPoint) IsUnknown added in v0.17.0

func (v MaskPositionPoint) IsUnknown() bool

IsUnknown reports whether this value is unknown.

func (MaskPositionPoint) MarshalText added in v0.17.0

func (v MaskPositionPoint) MarshalText() ([]byte, error)

func (MaskPositionPoint) String added in v0.17.0

func (v MaskPositionPoint) String() string

func (*MaskPositionPoint) UnmarshalText added in v0.17.0

func (v *MaskPositionPoint) UnmarshalText(b []byte) error

type MaybeInaccessibleMessage added in v0.12.0

type MaybeInaccessibleMessage struct {
	Message             *Message
	InaccessibleMessage *InaccessibleMessage
}

This object describes a message that can be inaccessible to the bot. It can be one of:

func (*MaybeInaccessibleMessage) Chat added in v0.12.0

func (mim *MaybeInaccessibleMessage) Chat() Chat

func (*MaybeInaccessibleMessage) IsAccessible added in v0.12.0

func (mim *MaybeInaccessibleMessage) IsAccessible() bool

IsAccessible returns true if message is accessible.

func (*MaybeInaccessibleMessage) IsInaccessible added in v0.12.0

func (mim *MaybeInaccessibleMessage) IsInaccessible() bool

IsInaccessible returns true if message is inaccessible.

func (*MaybeInaccessibleMessage) MessageID added in v0.12.0

func (mim *MaybeInaccessibleMessage) MessageID() int

func (*MaybeInaccessibleMessage) UnmarshalJSON added in v0.12.0

func (mim *MaybeInaccessibleMessage) UnmarshalJSON(v []byte) error
type MenuButton struct {
	Commands *MenuButtonCommands
	WebApp   *MenuButtonWebApp
	Default  *MenuButtonDefault
	Unknown  *UnknownVariant
}

MenuButton this object describes the bot's menu button in a private chat. It should be one of If a menu button other than MenuButtonDefault is set for a private chat, then it is applied in the chat. Otherwise the default menu button is applied. By default, the menu button opens the list of bot commands.

func MenuButtonOf(values ...MenuButtonClass) []MenuButton

MenuButtonOf converts MenuButtonClass arguments to a slice of MenuButton.

func (u MenuButton) AsMenuButton() MenuButton

AsMenuButton returns the union as-is, implementing MenuButtonClass.

func (u *MenuButton) IsUnknown() bool

IsUnknown reports whether this union contains an unknown variant. This can happen when the API returns a new variant not yet supported by this library.

func (u MenuButton) MarshalJSON() ([]byte, error)
func (u *MenuButton) Type() MenuButtonType

Type returns the discriminator value for this union.

func (u *MenuButton) UnmarshalJSON(data []byte) error
type MenuButtonClass interface {
	AsMenuButton() MenuButton
}

MenuButtonClass is an interface for types that can be used as MenuButton.

Known implementations:

type MenuButtonCommands struct{}

MenuButtonCommands represents a menu button, which opens the bot's list of commands.

func NewMenuButtonCommands added in v0.16.0

func NewMenuButtonCommands() *MenuButtonCommands

NewMenuButtonCommands creates a new MenuButtonCommands.

func (v *MenuButtonCommands) AsMenuButton() MenuButton

AsMenuButton wraps the variant into a MenuButton union.

type MenuButtonDefault struct{}

MenuButtonDefault describes that no specific value for the menu button was set.

func NewMenuButtonDefault added in v0.16.0

func NewMenuButtonDefault() *MenuButtonDefault

NewMenuButtonDefault creates a new MenuButtonDefault.

func (v *MenuButtonDefault) AsMenuButton() MenuButton

AsMenuButton wraps the variant into a MenuButton union.

type MenuButtonOneOf = MenuButton

MenuButtonOneOf is an alias for MenuButton for backward compatibility.

Deprecated: Use MenuButton directly.

type MenuButtonType int

MenuButtonType represents the type of MenuButton.

const (
	MenuButtonTypeCommands MenuButtonType = iota + 1 // "commands"
	MenuButtonTypeWebApp                             // "web_app"
	MenuButtonTypeDefault                            // "default"
)
func (v MenuButtonType) MarshalText() ([]byte, error)
func (v MenuButtonType) String() string
func (v *MenuButtonType) UnmarshalText(b []byte) error
type MenuButtonWebApp struct {
	// Text on the button
	Text string `json:"text"`

	// Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method [Client.AnswerWebAppQuery]. Alternatively, a t.me link to a Web App of the bot can be specified in the object instead of the Web App's URL, in which case the Web App will be opened as if the user pressed the link.
	WebApp WebAppInfo `json:"web_app"`
}

MenuButtonWebApp represents a menu button, which launches a Web App.

func NewMenuButtonWebApp added in v0.16.0

func NewMenuButtonWebApp(text string, webApp WebAppInfo) *MenuButtonWebApp

NewMenuButtonWebApp creates a new MenuButtonWebApp.

func (v *MenuButtonWebApp) AsMenuButton() MenuButton

AsMenuButton wraps the variant into a MenuButton union.

type Message

type Message struct {
	// Unique message identifier inside this chat. In specific instances (e.g., message containing a video sent to a big chat), the server might automatically schedule a message instead of sending it immediately. In such cases, this field will be 0 and the relevant message will be unusable until it is actually sent
	ID int `json:"message_id"`

	// Optional. Unique identifier of a message thread or forum topic to which the message belongs; for supergroups and private chats only
	MessageThreadID int `json:"message_thread_id,omitempty"`

	// Optional. Information about the direct messages chat topic that contains the message
	DirectMessagesTopic *DirectMessagesTopic `json:"direct_messages_topic,omitempty"`

	// Optional. Sender of the message; may be empty for messages sent to channels. For backward compatibility, if the message was sent on behalf of a chat, the field contains a fake sender user in non-channel chats
	From *User `json:"from,omitempty"`

	// Optional. Sender of the message when sent on behalf of a chat. For example, the supergroup itself for messages sent by its anonymous administrators or a linked channel for messages automatically forwarded to the channel's discussion group. For backward compatibility, if the message was sent on behalf of a chat, the field from contains a fake sender user in non-channel chats.
	SenderChat *Chat `json:"sender_chat,omitempty"`

	// Optional. If the sender of the message boosted the chat, the number of boosts added by the user
	SenderBoostCount int `json:"sender_boost_count,omitempty"`

	// Optional. The bot that actually sent the message on behalf of the business account. Available only for outgoing messages sent on behalf of the connected business account.
	SenderBusinessBot *User `json:"sender_business_bot,omitempty"`

	// Date the message was sent in Unix time. It is always a positive number, representing a valid date.
	Date UnixTime `json:"date"`

	// Optional. Unique identifier of the business connection from which the message was received. If non-empty, the message belongs to a chat of the corresponding business account that is independent from any potential bot chat which might share the same identifier.
	BusinessConnectionID string `json:"business_connection_id,omitempty"`

	// Chat the message belongs to
	Chat Chat `json:"chat"`

	// Optional. Information about the original message for forwarded messages
	ForwardOrigin *MessageOrigin `json:"forward_origin,omitempty"`

	// Optional. True, if the message is sent to a topic in a forum supergroup or a private chat with the bot
	IsTopicMessage bool `json:"is_topic_message,omitempty"`

	// Optional. True, if the message is a channel post that was automatically forwarded to the connected discussion group
	IsAutomaticForward bool `json:"is_automatic_forward,omitempty"`

	// Optional. For replies in the same chat and message thread, the original message. Note that the [Message] object in this field will not contain further reply_to_message fields even if it itself is a reply.
	ReplyToMessage *Message `json:"reply_to_message,omitempty"`

	// Optional. Information about the message that is being replied to, which may come from another chat or forum topic
	ExternalReply *ExternalReplyInfo `json:"external_reply,omitempty"`

	// Optional. For replies that quote part of the original message, the quoted part of the message
	Quote *TextQuote `json:"quote,omitempty"`

	// Optional. For replies to a story, the original story
	ReplyToStory *Story `json:"reply_to_story,omitempty"`

	// Optional. Identifier of the specific checklist task that is being replied to
	ReplyToChecklistTaskID int `json:"reply_to_checklist_task_id,omitempty"`

	// Optional. Bot through which the message was sent
	ViaBot *User `json:"via_bot,omitempty"`

	// Optional. Date the message was last edited in Unix time
	EditDate UnixTime `json:"edit_date,omitempty"`

	// Optional. True, if the message can't be forwarded
	HasProtectedContent bool `json:"has_protected_content,omitempty"`

	// Optional. True, if the message was sent by an implicit action, for example, as an away or a greeting business message, or as a scheduled message
	IsFromOffline bool `json:"is_from_offline,omitempty"`

	// Optional. True, if the message is a paid post. Note that such posts must not be deleted for 24 hours to receive the payment and can't be edited.
	IsPaidPost bool `json:"is_paid_post,omitempty"`

	// Optional. The unique identifier of a media message group this message belongs to
	MediaGroupID string `json:"media_group_id,omitempty"`

	// Optional. Signature of the post author for messages in channels, or the custom title of an anonymous group administrator
	AuthorSignature string `json:"author_signature,omitempty"`

	// Optional. The number of Telegram Stars that were paid by the sender of the message to send it
	PaidStarCount int `json:"paid_star_count,omitempty"`

	// Optional. For text messages, the actual UTF-8 text of the message
	Text string `json:"text,omitempty"`

	// Optional. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text
	Entities []MessageEntity `json:"entities,omitempty"`

	// Optional. Options used for link preview generation for the message, if it is a text message and link preview options were changed
	LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options,omitempty"`

	// Optional. Information about suggested post parameters if the message is a suggested post in a channel direct messages chat. If the message is an approved or declined suggested post, then it can't be edited.
	SuggestedPostInfo *SuggestedPostInfo `json:"suggested_post_info,omitempty"`

	// Optional. Unique identifier of the message effect added to the message
	EffectID string `json:"effect_id,omitempty"`

	// Optional. Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set
	Animation *Animation `json:"animation,omitempty"`

	// Optional. Message is an audio file, information about the file
	Audio *Audio `json:"audio,omitempty"`

	// Optional. Message is a general file, information about the file
	Document *Document `json:"document,omitempty"`

	// Optional. Message contains paid media; information about the paid media
	PaidMedia *PaidMediaInfo `json:"paid_media,omitempty"`

	// Optional. Message is a photo, available sizes of the photo
	Photo []PhotoSize `json:"photo,omitempty"`

	// Optional. Message is a sticker, information about the sticker
	Sticker *Sticker `json:"sticker,omitempty"`

	// Optional. Message is a forwarded story
	Story *Story `json:"story,omitempty"`

	// Optional. Message is a video, information about the video
	Video *Video `json:"video,omitempty"`

	// Optional. Message is a [video note], information about the video message
	//
	// [video note]: https://telegram.org/blog/video-messages-and-telescope
	VideoNote *VideoNote `json:"video_note,omitempty"`

	// Optional. Message is a voice message, information about the file
	Voice *Voice `json:"voice,omitempty"`

	// Optional. Caption for the animation, audio, document, paid media, photo, video or voice
	Caption string `json:"caption,omitempty"`

	// Optional. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption
	CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`

	// Optional. True, if the caption must be shown above the message media
	ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`

	// Optional. True, if the message media is covered by a spoiler animation
	HasMediaSpoiler bool `json:"has_media_spoiler,omitempty"`

	// Optional. Message is a checklist
	Checklist *Checklist `json:"checklist,omitempty"`

	// Optional. Message is a shared contact, information about the contact
	Contact *Contact `json:"contact,omitempty"`

	// Optional. Message is a dice with random value
	Dice *Dice `json:"dice,omitempty"`

	// Optional. Message is a game, information about the game. [More about games »]
	//
	// [More about games »]: https://core.telegram.org/bots/api#games
	Game *Game `json:"game,omitempty"`

	// Optional. Message is a native poll, information about the poll
	Poll *Poll `json:"poll,omitempty"`

	// Optional. Message is a venue, information about the venue. For backward compatibility, when this field is set, the location field will also be set
	Venue *Venue `json:"venue,omitempty"`

	// Optional. Message is a shared location, information about the location
	Location *Location `json:"location,omitempty"`

	// Optional. New members that were added to the group or supergroup and information about them (the bot itself may be one of these members)
	NewChatMembers []User `json:"new_chat_members,omitempty"`

	// Optional. A member was removed from the group, information about them (this member may be the bot itself)
	LeftChatMember *User `json:"left_chat_member,omitempty"`

	// Optional. Service message: chat owner has left
	ChatOwnerLeft *ChatOwnerLeft `json:"chat_owner_left,omitempty"`

	// Optional. Service message: chat owner has changed
	ChatOwnerChanged *ChatOwnerChanged `json:"chat_owner_changed,omitempty"`

	// Optional. A chat title was changed to this value
	NewChatTitle string `json:"new_chat_title,omitempty"`

	// Optional. A chat photo was change to this value
	NewChatPhoto []PhotoSize `json:"new_chat_photo,omitempty"`

	// Optional. Service message: the chat photo was deleted
	DeleteChatPhoto bool `json:"delete_chat_photo,omitempty"`

	// Optional. Service message: the group has been created
	GroupChatCreated bool `json:"group_chat_created,omitempty"`

	// Optional. Service message: the supergroup has been created. This field can't be received in a message coming through updates, because bot can't be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup.
	SupergroupChatCreated bool `json:"supergroup_chat_created,omitempty"`

	// Optional. Service message: the channel has been created. This field can't be received in a message coming through updates, because bot can't be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel.
	ChannelChatCreated bool `json:"channel_chat_created,omitempty"`

	// Optional. Service message: auto-delete timer settings changed in the chat
	MessageAutoDeleteTimerChanged *MessageAutoDeleteTimerChanged `json:"message_auto_delete_timer_changed,omitempty"`

	// Optional. The group has been migrated to a supergroup with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.
	MigrateToChatID ChatID `json:"migrate_to_chat_id,omitempty"`

	// Optional. The supergroup has been migrated from a group with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.
	MigrateFromChatID ChatID `json:"migrate_from_chat_id,omitempty"`

	// Optional. Specified message was pinned. Note that the [Message] object in this field will not contain further reply_to_message fields even if it itself is a reply.
	PinnedMessage *MaybeInaccessibleMessage `json:"pinned_message,omitempty"`

	// Optional. Message is an invoice for a [payment], information about the invoice. [More about payments »]
	//
	// [payment]: https://core.telegram.org/bots/api#payments
	// [More about payments »]: https://core.telegram.org/bots/api#payments
	Invoice *Invoice `json:"invoice,omitempty"`

	// Optional. Message is a service message about a successful payment, information about the payment. [More about payments »]
	//
	// [More about payments »]: https://core.telegram.org/bots/api#payments
	SuccessfulPayment *SuccessfulPayment `json:"successful_payment,omitempty"`

	// Optional. Message is a service message about a refunded payment, information about the payment. [More about payments »]
	//
	// [More about payments »]: https://core.telegram.org/bots/api#payments
	RefundedPayment *RefundedPayment `json:"refunded_payment,omitempty"`

	// Optional. Service message: users were shared with the bot
	UsersShared *UsersShared `json:"users_shared,omitempty"`

	// Optional. Service message: a chat was shared with the bot
	ChatShared *ChatShared `json:"chat_shared,omitempty"`

	// Optional. Service message: a regular gift was sent or received
	Gift *GiftInfo `json:"gift,omitempty"`

	// Optional. Service message: a unique gift was sent or received
	UniqueGift *UniqueGiftInfo `json:"unique_gift,omitempty"`

	// Optional. Service message: upgrade of a gift was purchased after the gift was sent
	GiftUpgradeSent *GiftInfo `json:"gift_upgrade_sent,omitempty"`

	// Optional. The domain name of the website on which the user has logged in. [More about Telegram Login »]
	//
	// [More about Telegram Login »]: https://core.telegram.org/widgets/login
	ConnectedWebsite string `json:"connected_website,omitempty"`

	// Optional. Service message: the user allowed the bot to write messages after adding it to the attachment or side menu, launching a Web App from a link, or accepting an explicit request from a Web App sent by the method [requestWriteAccess]
	//
	// [requestWriteAccess]: https://core.telegram.org/bots/webapps#initializing-mini-apps
	WriteAccessAllowed *WriteAccessAllowed `json:"write_access_allowed,omitempty"`

	// Optional. Telegram Passport data
	PassportData *PassportData `json:"passport_data,omitempty"`

	// Optional. Service message. A user in the chat triggered another user's proximity alert while sharing Live Location.
	ProximityAlertTriggered *ProximityAlertTriggered `json:"proximity_alert_triggered,omitempty"`

	// Optional. Service message: user boosted the chat
	BoostAdded *ChatBoostAdded `json:"boost_added,omitempty"`

	// Optional. Service message: chat background set
	ChatBackgroundSet *ChatBackground `json:"chat_background_set,omitempty"`

	// Optional. Service message: some tasks in a checklist were marked as done or not done
	ChecklistTasksDone *ChecklistTasksDone `json:"checklist_tasks_done,omitempty"`

	// Optional. Service message: tasks were added to a checklist
	ChecklistTasksAdded *ChecklistTasksAdded `json:"checklist_tasks_added,omitempty"`

	// Optional. Service message: the price for paid messages in the corresponding direct messages chat of a channel has changed
	DirectMessagePriceChanged *DirectMessagePriceChanged `json:"direct_message_price_changed,omitempty"`

	// Optional. Service message: forum topic created
	ForumTopicCreated *ForumTopicCreated `json:"forum_topic_created,omitempty"`

	// Optional. Service message: forum topic edited
	ForumTopicEdited *ForumTopicEdited `json:"forum_topic_edited,omitempty"`

	// Optional. Service message: forum topic closed
	ForumTopicClosed *ForumTopicClosed `json:"forum_topic_closed,omitempty"`

	// Optional. Service message: forum topic reopened
	ForumTopicReopened *ForumTopicReopened `json:"forum_topic_reopened,omitempty"`

	// Optional. Service message: the 'General' forum topic hidden
	GeneralForumTopicHidden *GeneralForumTopicHidden `json:"general_forum_topic_hidden,omitempty"`

	// Optional. Service message: the 'General' forum topic unhidden
	GeneralForumTopicUnhidden *GeneralForumTopicUnhidden `json:"general_forum_topic_unhidden,omitempty"`

	// Optional. Service message: a scheduled giveaway was created
	GiveawayCreated *GiveawayCreated `json:"giveaway_created,omitempty"`

	// Optional. The message is a scheduled giveaway message
	Giveaway *Giveaway `json:"giveaway,omitempty"`

	// Optional. A giveaway with public winners was completed
	GiveawayWinners *GiveawayWinners `json:"giveaway_winners,omitempty"`

	// Optional. Service message: a giveaway without public winners was completed
	GiveawayCompleted *GiveawayCompleted `json:"giveaway_completed,omitempty"`

	// Optional. Service message: the price for paid messages has changed in the chat
	PaidMessagePriceChanged *PaidMessagePriceChanged `json:"paid_message_price_changed,omitempty"`

	// Optional. Service message: a suggested post was approved
	SuggestedPostApproved *SuggestedPostApproved `json:"suggested_post_approved,omitempty"`

	// Optional. Service message: approval of a suggested post has failed
	SuggestedPostApprovalFailed *SuggestedPostApprovalFailed `json:"suggested_post_approval_failed,omitempty"`

	// Optional. Service message: a suggested post was declined
	SuggestedPostDeclined *SuggestedPostDeclined `json:"suggested_post_declined,omitempty"`

	// Optional. Service message: payment for a suggested post was received
	SuggestedPostPaid *SuggestedPostPaid `json:"suggested_post_paid,omitempty"`

	// Optional. Service message: payment for a suggested post was refunded
	SuggestedPostRefunded *SuggestedPostRefunded `json:"suggested_post_refunded,omitempty"`

	// Optional. Service message: video chat scheduled
	VideoChatScheduled *VideoChatScheduled `json:"video_chat_scheduled,omitempty"`

	// Optional. Service message: video chat started
	VideoChatStarted *VideoChatStarted `json:"video_chat_started,omitempty"`

	// Optional. Service message: video chat ended
	VideoChatEnded *VideoChatEnded `json:"video_chat_ended,omitempty"`

	// Optional. Service message: new participants invited to a video chat
	VideoChatParticipantsInvited *VideoChatParticipantsInvited `json:"video_chat_participants_invited,omitempty"`

	// Optional. Service message: data sent by a Web App
	WebAppData *WebAppData `json:"web_app_data,omitempty"`

	// Optional. Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons.
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}

Message this object represents a message.

func (*Message) FileID added in v0.17.0

func (msg *Message) FileID() FileID

FileID returns the file ID from whichever media field is set. For photos, it returns the file ID of the largest size. Returns empty FileID if the message contains no media.

func (*Message) IsInaccessible added in v0.12.0

func (msg *Message) IsInaccessible() bool

IsInaccessible returns true if message is inaccessible.

func (*Message) TextOrCaption added in v0.17.0

func (msg *Message) TextOrCaption() string

TextOrCaption returns the message text or caption, whichever is set. For text messages it returns Text, for media messages it returns Caption.

func (*Message) TextOrCaptionEntities added in v0.17.0

func (msg *Message) TextOrCaptionEntities() []MessageEntity

TextOrCaptionEntities returns text entities or caption entities, whichever applies. For text messages it returns Entities, for media messages it returns CaptionEntities.

func (*Message) Type added in v0.0.6

func (v *Message) Type() MessageType

Type returns the MessageType of this Message.

type MessageAutoDeleteTimerChanged

type MessageAutoDeleteTimerChanged struct {
	// New auto-delete time for messages in the chat; in seconds
	MessageAutoDeleteTime int `json:"message_auto_delete_time"`
}

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

type MessageEntity

type MessageEntity struct {
	// Type of the entity. Currently, can be “mention” (@username), “hashtag” (#hashtag or #hashtag@chatusername), “cashtag” ($USD or $USD@chatusername), “bot_command” (/start@jobs_bot), “url” (https://telegram.org), “email” ([email protected]), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “blockquote” (block quotation), “expandable_blockquote” (collapsed-by-default block quotation), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users [without usernames]), “custom_emoji” (for inline custom emoji stickers)
	//
	// [without usernames]: https://telegram.org/blog/edit#new-mentions
	Type MessageEntityType `json:"type"`

	// Offset in [UTF-16 code units] to the start of the entity
	//
	// [UTF-16 code units]: https://core.telegram.org/api/entities#entity-length
	Offset int `json:"offset"`

	// Length of the entity in [UTF-16 code units]
	//
	// [UTF-16 code units]: https://core.telegram.org/api/entities#entity-length
	Length int `json:"length"`

	// Optional. For “text_link” only, URL that will be opened after user taps on the text
	URL string `json:"url,omitempty"`

	// Optional. For “text_mention” only, the mentioned user
	User *User `json:"user,omitempty"`

	// Optional. For “pre” only, the programming language of the entity text
	Language string `json:"language,omitempty"`

	// Optional. For “custom_emoji” only, unique identifier of the custom emoji. Use [Client.GetCustomEmojiStickers] to get full information about the sticker
	CustomEmojiID string `json:"custom_emoji_id,omitempty"`
}

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

func (MessageEntity) Extract added in v0.1.1

func (me MessageEntity) Extract(text string) string

Extract entitie value from plain text.

type MessageEntityType added in v0.1.1

type MessageEntityType int8

MessageEntityType represents an enum type.

const (
	MessageEntityTypeUnknown              MessageEntityType = iota
	MessageEntityTypeMention                                // "mention"
	MessageEntityTypeHashtag                                // "hashtag"
	MessageEntityTypeCashtag                                // "cashtag"
	MessageEntityTypeBotCommand                             // "bot_command"
	MessageEntityTypeURL                                    // "url"
	MessageEntityTypeEmail                                  // "email"
	MessageEntityTypePhoneNumber                            // "phone_number"
	MessageEntityTypeBold                                   // "bold"
	MessageEntityTypeItalic                                 // "italic"
	MessageEntityTypeUnderline                              // "underline"
	MessageEntityTypeStrikethrough                          // "strikethrough"
	MessageEntityTypeSpoiler                                // "spoiler"
	MessageEntityTypeBlockquote                             // "blockquote"
	MessageEntityTypeExpandableBlockquote                   // "expandable_blockquote"
	MessageEntityTypeCode                                   // "code"
	MessageEntityTypePre                                    // "pre"
	MessageEntityTypeTextLink                               // "text_link"
	MessageEntityTypeTextMention                            // "text_mention"
	MessageEntityTypeCustomEmoji                            // "custom_emoji"
)

func (MessageEntityType) IsUnknown added in v0.16.0

func (v MessageEntityType) IsUnknown() bool

IsUnknown reports whether this value is unknown.

func (MessageEntityType) MarshalText added in v0.1.1

func (v MessageEntityType) MarshalText() ([]byte, error)

func (MessageEntityType) String added in v0.1.1

func (v MessageEntityType) String() string

func (*MessageEntityType) UnmarshalText added in v0.1.1

func (v *MessageEntityType) UnmarshalText(b []byte) error

type MessageID

type MessageID struct {
	// Unique message identifier. In specific instances (e.g., message containing a video sent to a big chat), the server might automatically schedule a message instead of sending it immediately. In such cases, this field will be 0 and the relevant message will be unusable until it is actually sent
	MessageID int `json:"message_id"`
}

MessageID this object represents a unique message identifier.

type MessageOrigin added in v0.12.0

type MessageOrigin struct {
	User       *MessageOriginUser
	HiddenUser *MessageOriginHiddenUser
	Chat       *MessageOriginChat
	Channel    *MessageOriginChannel
	Unknown    *UnknownVariant
}

MessageOrigin this object describes the origin of a message. It can be one of

func (*MessageOrigin) IsUnknown added in v0.16.0

func (u *MessageOrigin) IsUnknown() bool

IsUnknown reports whether this union contains an unknown variant. This can happen when the API returns a new variant not yet supported by this library.

func (MessageOrigin) MarshalJSON added in v0.16.0

func (u MessageOrigin) MarshalJSON() ([]byte, error)

func (*MessageOrigin) Type added in v0.12.0

func (u *MessageOrigin) Type() MessageOriginType

Type returns the discriminator value for this union.

func (*MessageOrigin) UnmarshalJSON added in v0.12.0

func (u *MessageOrigin) UnmarshalJSON(data []byte) error

type MessageOriginChannel added in v0.12.0

type MessageOriginChannel struct {
	// Date the message was sent originally in Unix time
	Date UnixTime `json:"date"`

	// Channel chat to which the message was originally sent
	Chat Chat `json:"chat"`

	// Unique message identifier inside the chat
	MessageID int `json:"message_id"`

	// Optional. Signature of the original post author
	AuthorSignature string `json:"author_signature,omitempty"`
}

MessageOriginChannel the message was originally sent to a channel chat.

type MessageOriginChat added in v0.12.0

type MessageOriginChat struct {
	// Date the message was sent originally in Unix time
	Date UnixTime `json:"date"`

	// Chat that sent the message originally
	SenderChat Chat `json:"sender_chat"`

	// Optional. For messages originally sent by an anonymous chat administrator, original message author signature
	AuthorSignature string `json:"author_signature,omitempty"`
}

MessageOriginChat the message was originally sent on behalf of a chat to a group chat.

type MessageOriginHiddenUser added in v0.12.0

type MessageOriginHiddenUser struct {
	// Date the message was sent originally in Unix time
	Date UnixTime `json:"date"`

	// Name of the user that sent the message originally
	SenderUserName string `json:"sender_user_name"`
}

MessageOriginHiddenUser the message was originally sent by an unknown user.

type MessageOriginType added in v0.16.0

type MessageOriginType int

MessageOriginType represents the type of MessageOrigin.

const (
	MessageOriginTypeUser       MessageOriginType = iota + 1 // "user"
	MessageOriginTypeHiddenUser                              // "hidden_user"
	MessageOriginTypeChat                                    // "chat"
	MessageOriginTypeChannel                                 // "channel"
)

func (MessageOriginType) MarshalText added in v0.16.0

func (v MessageOriginType) MarshalText() ([]byte, error)

func (MessageOriginType) String added in v0.16.0

func (v MessageOriginType) String() string

func (*MessageOriginType) UnmarshalText added in v0.16.0

func (v *MessageOriginType) UnmarshalText(b []byte) error

type MessageOriginUser added in v0.12.0

type MessageOriginUser struct {
	// Date the message was sent originally in Unix time
	Date UnixTime `json:"date"`

	// User that sent the message originally
	SenderUser User `json:"sender_user"`
}

MessageOriginUser the message was originally sent by a known user.

type MessageReactionCountUpdated added in v0.12.0

type MessageReactionCountUpdated struct {
	// The chat containing the message
	Chat Chat `json:"chat"`

	// Unique message identifier inside the chat
	MessageID int `json:"message_id"`

	// Date of the change in Unix time
	Date UnixTime `json:"date"`

	// List of reactions that are present on the message
	Reactions []ReactionCount `json:"reactions"`
}

MessageReactionCountUpdated this object represents reaction changes on a message with anonymous reactions.

type MessageReactionUpdated added in v0.12.0

type MessageReactionUpdated struct {
	// The chat containing the message the user reacted to
	Chat Chat `json:"chat"`

	// Unique identifier of the message inside the chat
	MessageID int `json:"message_id"`

	// Optional. The user that changed the reaction, if the user isn't anonymous
	User *User `json:"user,omitempty"`

	// Optional. The chat on behalf of which the reaction was changed, if the user is anonymous
	ActorChat *Chat `json:"actor_chat,omitempty"`

	// Date of the change in Unix time
	Date UnixTime `json:"date"`

	// Previous list of reaction types that were set by the user
	OldReaction []ReactionType `json:"old_reaction"`

	// New list of reaction types that have been set by the user
	NewReaction []ReactionType `json:"new_reaction"`
}

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

type MessageType added in v0.0.6

type MessageType int8

MessageType represents an enum type.

const (
	MessageTypeUnknown                       MessageType = iota
	MessageTypeText                                      // "text"
	MessageTypeAnimation                                 // "animation"
	MessageTypeAudio                                     // "audio"
	MessageTypeDocument                                  // "document"
	MessageTypePaidMedia                                 // "paid_media"
	MessageTypePhoto                                     // "photo"
	MessageTypeSticker                                   // "sticker"
	MessageTypeStory                                     // "story"
	MessageTypeVideo                                     // "video"
	MessageTypeVideoNote                                 // "video_note"
	MessageTypeVoice                                     // "voice"
	MessageTypeChecklist                                 // "checklist"
	MessageTypeContact                                   // "contact"
	MessageTypeDice                                      // "dice"
	MessageTypeGame                                      // "game"
	MessageTypePoll                                      // "poll"
	MessageTypeVenue                                     // "venue"
	MessageTypeLocation                                  // "location"
	MessageTypeNewChatMembers                            // "new_chat_members"
	MessageTypeLeftChatMember                            // "left_chat_member"
	MessageTypeChatOwnerLeft                             // "chat_owner_left"
	MessageTypeChatOwnerChanged                          // "chat_owner_changed"
	MessageTypeNewChatTitle                              // "new_chat_title"
	MessageTypeNewChatPhoto                              // "new_chat_photo"
	MessageTypeDeleteChatPhoto                           // "delete_chat_photo"
	MessageTypeGroupChatCreated                          // "group_chat_created"
	MessageTypeSupergroupChatCreated                     // "supergroup_chat_created"
	MessageTypeChannelChatCreated                        // "channel_chat_created"
	MessageTypeMessageAutoDeleteTimerChanged             // "message_auto_delete_timer_changed"
	MessageTypeMigrateToChatID                           // "migrate_to_chat_id"
	MessageTypeMigrateFromChatID                         // "migrate_from_chat_id"
	MessageTypePinnedMessage                             // "pinned_message"
	MessageTypeInvoice                                   // "invoice"
	MessageTypeSuccessfulPayment                         // "successful_payment"
	MessageTypeRefundedPayment                           // "refunded_payment"
	MessageTypeUsersShared                               // "users_shared"
	MessageTypeChatShared                                // "chat_shared"
	MessageTypeGift                                      // "gift"
	MessageTypeUniqueGift                                // "unique_gift"
	MessageTypeGiftUpgradeSent                           // "gift_upgrade_sent"
	MessageTypeConnectedWebsite                          // "connected_website"
	MessageTypeWriteAccessAllowed                        // "write_access_allowed"
	MessageTypePassportData                              // "passport_data"
	MessageTypeProximityAlertTriggered                   // "proximity_alert_triggered"
	MessageTypeBoostAdded                                // "boost_added"
	MessageTypeChatBackgroundSet                         // "chat_background_set"
	MessageTypeChecklistTasksDone                        // "checklist_tasks_done"
	MessageTypeChecklistTasksAdded                       // "checklist_tasks_added"
	MessageTypeDirectMessagePriceChanged                 // "direct_message_price_changed"
	MessageTypeForumTopicCreated                         // "forum_topic_created"
	MessageTypeForumTopicEdited                          // "forum_topic_edited"
	MessageTypeForumTopicClosed                          // "forum_topic_closed"
	MessageTypeForumTopicReopened                        // "forum_topic_reopened"
	MessageTypeGeneralForumTopicHidden                   // "general_forum_topic_hidden"
	MessageTypeGeneralForumTopicUnhidden                 // "general_forum_topic_unhidden"
	MessageTypeGiveawayCreated                           // "giveaway_created"
	MessageTypeGiveaway                                  // "giveaway"
	MessageTypeGiveawayWinners                           // "giveaway_winners"
	MessageTypeGiveawayCompleted                         // "giveaway_completed"
	MessageTypePaidMessagePriceChanged                   // "paid_message_price_changed"
	MessageTypeSuggestedPostApproved                     // "suggested_post_approved"
	MessageTypeSuggestedPostApprovalFailed               // "suggested_post_approval_failed"
	MessageTypeSuggestedPostDeclined                     // "suggested_post_declined"
	MessageTypeSuggestedPostPaid                         // "suggested_post_paid"
	MessageTypeSuggestedPostRefunded                     // "suggested_post_refunded"
	MessageTypeVideoChatScheduled                        // "video_chat_scheduled"
	MessageTypeVideoChatStarted                          // "video_chat_started"
	MessageTypeVideoChatEnded                            // "video_chat_ended"
	MessageTypeVideoChatParticipantsInvited              // "video_chat_participants_invited"
	MessageTypeWebAppData                                // "web_app_data"
)

func (MessageType) IsUnknown added in v0.16.0

func (v MessageType) IsUnknown() bool

IsUnknown reports whether this value is unknown.

func (MessageType) String added in v0.16.0

func (v MessageType) String() string

type OrderInfo

type OrderInfo struct {
	// Optional. User name
	Name string `json:"name,omitempty"`

	// Optional. User's phone number
	PhoneNumber string `json:"phone_number,omitempty"`

	// Optional. User email
	Email string `json:"email,omitempty"`

	// Optional. User shipping address
	ShippingAddress *ShippingAddress `json:"shipping_address,omitempty"`
}

OrderInfo this object represents information about an order.

type OwnedGift added in v0.16.0

type OwnedGift struct {
	Regular *OwnedGiftRegular
	Unique  *OwnedGiftUnique
	Unknown *UnknownVariant
}

OwnedGift this object describes a gift received and owned by a user or a chat. Currently, it can be one of

func (*OwnedGift) IsUnknown added in v0.16.0

func (u *OwnedGift) IsUnknown() bool

IsUnknown reports whether this union contains an unknown variant. This can happen when the API returns a new variant not yet supported by this library.

func (OwnedGift) MarshalJSON added in v0.16.0

func (u OwnedGift) MarshalJSON() ([]byte, error)

func (*OwnedGift) Type added in v0.16.0

func (u *OwnedGift) Type() OwnedGiftType

Type returns the discriminator value for this union.

func (*OwnedGift) UnmarshalJSON added in v0.16.0

func (u *OwnedGift) UnmarshalJSON(data []byte) error

type OwnedGiftRegular added in v0.16.0

type OwnedGiftRegular struct {
	// Information about the regular gift
	Gift Gift `json:"gift"`

	// Optional. Unique identifier of the gift for the bot; for gifts received on behalf of business accounts only
	OwnedGiftID string `json:"owned_gift_id,omitempty"`

	// Optional. Sender of the gift if it is a known user
	SenderUser *User `json:"sender_user,omitempty"`

	// Date the gift was sent in Unix time
	SendDate UnixTime `json:"send_date"`

	// Optional. Text of the message that was added to the gift
	Text string `json:"text,omitempty"`

	// Optional. Special entities that appear in the text
	Entities []MessageEntity `json:"entities,omitempty"`

	// Optional. True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them
	IsPrivate bool `json:"is_private,omitempty"`

	// Optional. True, if the gift is displayed on the account's profile page; for gifts received on behalf of business accounts only
	IsSaved bool `json:"is_saved,omitempty"`

	// Optional. True, if the gift can be upgraded to a unique gift; for gifts received on behalf of business accounts only
	CanBeUpgraded bool `json:"can_be_upgraded,omitempty"`

	// Optional. True, if the gift was refunded and isn't available anymore
	WasRefunded bool `json:"was_refunded,omitempty"`

	// Optional. Number of Telegram Stars that can be claimed by the receiver instead of the gift; omitted if the gift cannot be converted to Telegram Stars; for gifts received on behalf of business accounts only
	ConvertStarCount int `json:"convert_star_count,omitempty"`

	// Optional. Number of Telegram Stars that were paid for the ability to upgrade the gift
	PrepaidUpgradeStarCount int `json:"prepaid_upgrade_star_count,omitempty"`

	// Optional. True, if the gift's upgrade was purchased after the gift was sent; for gifts received on behalf of business accounts only
	IsUpgradeSeparate bool `json:"is_upgrade_separate,omitempty"`

	// Optional. Unique number reserved for this gift when upgraded. See the number field in [UniqueGift]
	UniqueGiftNumber int `json:"unique_gift_number,omitempty"`
}

OwnedGiftRegular describes a regular gift owned by a user or a chat.

type OwnedGiftType added in v0.16.0

type OwnedGiftType int

OwnedGiftType represents the type of OwnedGift.

const (
	OwnedGiftTypeRegular OwnedGiftType = iota + 1 // "regular"
	OwnedGiftTypeUnique                           // "unique"
)

func (OwnedGiftType) MarshalText added in v0.16.0

func (v OwnedGiftType) MarshalText() ([]byte, error)

func (OwnedGiftType) String added in v0.16.0

func (v OwnedGiftType) String() string

func (*OwnedGiftType) UnmarshalText added in v0.16.0

func (v *OwnedGiftType) UnmarshalText(b []byte) error

type OwnedGiftUnique added in v0.16.0

type OwnedGiftUnique struct {
	// Information about the unique gift
	Gift UniqueGift `json:"gift"`

	// Optional. Unique identifier of the received gift for the bot; for gifts received on behalf of business accounts only
	OwnedGiftID string `json:"owned_gift_id,omitempty"`

	// Optional. Sender of the gift if it is a known user
	SenderUser *User `json:"sender_user,omitempty"`

	// Date the gift was sent in Unix time
	SendDate UnixTime `json:"send_date"`

	// Optional. True, if the gift is displayed on the account's profile page; for gifts received on behalf of business accounts only
	IsSaved bool `json:"is_saved,omitempty"`

	// Optional. True, if the gift can be transferred to another owner; for gifts received on behalf of business accounts only
	CanBeTransferred bool `json:"can_be_transferred,omitempty"`

	// Optional. Number of Telegram Stars that must be paid to transfer the gift; omitted if the bot cannot transfer the gift
	TransferStarCount int `json:"transfer_star_count,omitempty"`

	// Optional. Point in time (Unix timestamp) when the gift can be transferred. If it is in the past, then the gift can be transferred now
	NextTransferDate UnixTime `json:"next_transfer_date,omitempty"`
}

OwnedGiftUnique describes a unique gift received and owned by a user or a chat.

type OwnedGifts added in v0.16.0

type OwnedGifts struct {
	// The total number of gifts owned by the user or the chat
	TotalCount int `json:"total_count"`

	// The list of gifts
	Gifts []OwnedGift `json:"gifts"`

	// Optional. Offset for the next request. If empty, then there are no more results
	NextOffset string `json:"next_offset,omitempty"`
}

OwnedGifts contains the list of gifts received and owned by a user or a chat.

type PaidMedia added in v0.16.0

type PaidMedia struct {
	Preview *PaidMediaPreview
	Photo   *PaidMediaPhoto
	Video   *PaidMediaVideo
	Unknown *UnknownVariant
}

PaidMedia this object describes paid media. Currently, it can be one of

func (*PaidMedia) IsUnknown added in v0.16.0

func (u *PaidMedia) IsUnknown() bool

IsUnknown reports whether this union contains an unknown variant. This can happen when the API returns a new variant not yet supported by this library.

func (PaidMedia) MarshalJSON added in v0.16.0

func (u PaidMedia) MarshalJSON() ([]byte, error)

func (*PaidMedia) Type added in v0.16.0

func (u *PaidMedia) Type() PaidMediaType

Type returns the discriminator value for this union.

func (*PaidMedia) UnmarshalJSON added in v0.16.0

func (u *PaidMedia) UnmarshalJSON(data []byte) error

type PaidMediaInfo added in v0.16.0

type PaidMediaInfo struct {
	// The number of Telegram Stars that must be paid to buy access to the media
	StarCount int `json:"star_count"`

	// Information about the paid media
	PaidMedia []PaidMedia `json:"paid_media"`
}

PaidMediaInfo describes the paid media added to a message.

type PaidMediaPhoto added in v0.16.0

type PaidMediaPhoto struct {
	// The photo
	Photo []PhotoSize `json:"photo"`
}

PaidMediaPhoto the paid media is a photo.

type PaidMediaPreview added in v0.16.0

type PaidMediaPreview struct {
	// Optional. Media width as defined by the sender
	Width int `json:"width,omitempty"`

	// Optional. Media height as defined by the sender
	Height int `json:"height,omitempty"`

	// Optional. Duration of the media in seconds as defined by the sender
	Duration int `json:"duration,omitempty"`
}

PaidMediaPreview the paid media isn't available before the payment.

type PaidMediaPurchased added in v0.16.0

type PaidMediaPurchased struct {
	// User who purchased the media
	From User `json:"from"`

	// Bot-specified paid media payload
	PaidMediaPayload string `json:"paid_media_payload"`
}

PaidMediaPurchased this object contains information about a paid media purchase.

type PaidMediaType added in v0.16.0

type PaidMediaType int

PaidMediaType represents the type of PaidMedia.

const (
	PaidMediaTypePreview PaidMediaType = iota + 1 // "preview"
	PaidMediaTypePhoto                            // "photo"
	PaidMediaTypeVideo                            // "video"
)

func (PaidMediaType) MarshalText added in v0.16.0

func (v PaidMediaType) MarshalText() ([]byte, error)

func (PaidMediaType) String added in v0.16.0

func (v PaidMediaType) String() string

func (*PaidMediaType) UnmarshalText added in v0.16.0

func (v *PaidMediaType) UnmarshalText(b []byte) error

type PaidMediaVideo added in v0.16.0

type PaidMediaVideo struct {
	// The video
	Video Video `json:"video"`
}

PaidMediaVideo the paid media is a video.

type PaidMessagePriceChanged added in v0.16.0

type PaidMessagePriceChanged struct {
	// The new number of Telegram Stars that must be paid by non-administrator users of the supergroup chat for each sent message
	PaidMessageStarCount int `json:"paid_message_star_count"`
}

PaidMessagePriceChanged describes a service message about a change in the price of paid messages within a chat.

type ParseMode

type ParseMode interface {
	encoding.TextMarshaler
	fmt.Stringer

	// Change separator for next calls
	Sep(v string) ParseMode

	// Text joins the given strings with new line seprator
	Text(v ...string) string

	// Line joins the given strings with space seprator
	Line(v ...string) string

	// Escapef escapes the format string and then applies fmt.Sprintf with the given args.
	// Useful for MarkdownV2 where literal characters like . | ! need escaping,
	// while %s args (e.g. from Bold, Italic) pass through unchanged.
	Escapef(format string, args ...any) string

	// Bold
	Bold(v ...string) string

	// Italic
	Italic(v ...string) string

	// Underline
	Underline(v ...string) string

	// Deleted (Striketrough)
	Strike(v ...string) string

	// Spoiler
	Spoiler(v ...string) string

	// Link
	Link(title, url string) string

	// Mention creates an inline mention of a user by ID
	Mention(name string, userID UserID) string

	// CustomEmoji inserts a custom emoji by ID with fallback emoji text
	CustomEmoji(emoji, emojiID string) string

	// Code
	Code(v ...string) string

	// Preformated text
	Pre(v ...string) string

	// PreLanguage creates a pre-formatted code block with language specification
	PreLanguage(language string, v ...string) string

	// Blockquote
	Blockquote(v ...string) string

	// ExpandableBlockquote creates a collapsible blockquote
	ExpandableBlockquote(v ...string) string

	// Escape
	Escape(v string) string
}
var (
	// HTML is ParseMode that uses HTML tags
	HTML ParseMode = parseMode{
			// contains filtered or unexported fields
	}

	// MD is ParseMode that uses Markdown tags.
	// Warning: this is legacy mode, use MarkdownV2 (MD2) instead.
	MD ParseMode = parseMode{
		// contains filtered or unexported fields
	}

	// MD2 is ParseMode that uses MarkdownV2 tags.
	MD2 ParseMode = parseMode{
		// contains filtered or unexported fields
	}
)

type PassportData

type PassportData struct {
	// Array with information about documents and other Telegram Passport elements that was shared with the bot
	Data []EncryptedPassportElement `json:"data"`

	// Encrypted credentials required to decrypt the data
	Credentials EncryptedCredentials `json:"credentials"`
}

PassportData describes Telegram Passport data shared with the bot by the user.

type PassportElementError

PassportElementError this object represents an error in the Telegram Passport element which was submitted that should be resolved by the user. It should be one of:

func PassportElementErrorOf added in v0.17.0

func PassportElementErrorOf(values ...PassportElementErrorClass) []PassportElementError

PassportElementErrorOf converts PassportElementErrorClass arguments to a slice of PassportElementError.

func (PassportElementError) AsPassportElementError added in v0.17.0

func (u PassportElementError) AsPassportElementError() PassportElementError

AsPassportElementError returns the union as-is, implementing PassportElementErrorClass.

func (*PassportElementError) IsUnknown added in v0.16.0

func (u *PassportElementError) IsUnknown() bool

IsUnknown reports whether this union contains an unknown variant. This can happen when the API returns a new variant not yet supported by this library.

func (PassportElementError) MarshalJSON added in v0.16.0

func (u PassportElementError) MarshalJSON() ([]byte, error)

func (*PassportElementError) Source

Source returns the discriminator value for this union.

func (*PassportElementError) UnmarshalJSON added in v0.16.0

func (u *PassportElementError) UnmarshalJSON(data []byte) error

type PassportElementErrorDataField

type PassportElementErrorDataField struct {
	// The section of the user's Telegram Passport which has the error, one of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address”
	Type string `json:"type"`

	// Name of the data field which has the error
	FieldName string `json:"field_name"`

	// Base64-encoded data hash
	DataHash string `json:"data_hash"`

	// Error message
	Message string `json:"message"`
}

PassportElementErrorDataField represents an issue in one of the data fields that was provided by the user. The error is considered resolved when the field's value changes.

func NewPassportElementErrorDataField added in v0.16.0

func NewPassportElementErrorDataField(type_ string, fieldName string, dataHash string, message string) *PassportElementErrorDataField

NewPassportElementErrorDataField creates a new PassportElementErrorDataField.

func (*PassportElementErrorDataField) AsPassportElementError added in v0.17.0

func (v *PassportElementErrorDataField) AsPassportElementError() PassportElementError

AsPassportElementError wraps the variant into a PassportElementError union.

type PassportElementErrorFile

type PassportElementErrorFile struct {
	// The section of the user's Telegram Passport which has the issue, one of “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”
	Type string `json:"type"`

	// Base64-encoded file hash
	FileHash string `json:"file_hash"`

	// Error message
	Message string `json:"message"`
}

PassportElementErrorFile represents an issue with a document scan. The error is considered resolved when the file with the document scan changes.

func NewPassportElementErrorFile added in v0.16.0

func NewPassportElementErrorFile(type_ string, fileHash string, message string) *PassportElementErrorFile

NewPassportElementErrorFile creates a new PassportElementErrorFile.

func (*PassportElementErrorFile) AsPassportElementError added in v0.17.0

func (v *PassportElementErrorFile) AsPassportElementError() PassportElementError

AsPassportElementError wraps the variant into a PassportElementError union.

type PassportElementErrorFiles

type PassportElementErrorFiles struct {
	// The section of the user's Telegram Passport which has the issue, one of “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”
	Type string `json:"type"`

	// List of base64-encoded file hashes
	FileHashes []string `json:"file_hashes"`

	// Error message
	Message string `json:"message"`
}

PassportElementErrorFiles represents an issue with a list of scans. The error is considered resolved when the list of files containing the scans changes.

func NewPassportElementErrorFiles added in v0.16.0

func NewPassportElementErrorFiles(type_ string, fileHashes []string, message string) *PassportElementErrorFiles

NewPassportElementErrorFiles creates a new PassportElementErrorFiles.

func (*PassportElementErrorFiles) AsPassportElementError added in v0.17.0

func (v *PassportElementErrorFiles) AsPassportElementError() PassportElementError

AsPassportElementError wraps the variant into a PassportElementError union.

type PassportElementErrorFrontSide

type PassportElementErrorFrontSide struct {
	// The section of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport”
	Type string `json:"type"`

	// Base64-encoded hash of the file with the front side of the document
	FileHash string `json:"file_hash"`

	// Error message
	Message string `json:"message"`
}

PassportElementErrorFrontSide represents an issue with the front side of a document. The error is considered resolved when the file with the front side of the document changes.

func NewPassportElementErrorFrontSide added in v0.16.0

func NewPassportElementErrorFrontSide(type_ string, fileHash string, message string) *PassportElementErrorFrontSide

NewPassportElementErrorFrontSide creates a new PassportElementErrorFrontSide.

func (*PassportElementErrorFrontSide) AsPassportElementError added in v0.17.0

func (v *PassportElementErrorFrontSide) AsPassportElementError() PassportElementError

AsPassportElementError wraps the variant into a PassportElementError union.

type PassportElementErrorReverseSide

type PassportElementErrorReverseSide struct {
	// The section of the user's Telegram Passport which has the issue, one of “driver_license”, “identity_card”
	Type string `json:"type"`

	// Base64-encoded hash of the file with the reverse side of the document
	FileHash string `json:"file_hash"`

	// Error message
	Message string `json:"message"`
}

PassportElementErrorReverseSide represents an issue with the reverse side of a document. The error is considered resolved when the file with reverse side of the document changes.

func NewPassportElementErrorReverseSide added in v0.16.0

func NewPassportElementErrorReverseSide(type_ string, fileHash string, message string) *PassportElementErrorReverseSide

NewPassportElementErrorReverseSide creates a new PassportElementErrorReverseSide.

func (*PassportElementErrorReverseSide) AsPassportElementError added in v0.17.0

func (v *PassportElementErrorReverseSide) AsPassportElementError() PassportElementError

AsPassportElementError wraps the variant into a PassportElementError union.

type PassportElementErrorSelfie

type PassportElementErrorSelfie struct {
	// The section of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport”
	Type string `json:"type"`

	// Base64-encoded hash of the file with the selfie
	FileHash string `json:"file_hash"`

	// Error message
	Message string `json:"message"`
}

PassportElementErrorSelfie represents an issue with the selfie with a document. The error is considered resolved when the file with the selfie changes.

func NewPassportElementErrorSelfie added in v0.16.0

func NewPassportElementErrorSelfie(type_ string, fileHash string, message string) *PassportElementErrorSelfie

NewPassportElementErrorSelfie creates a new PassportElementErrorSelfie.

func (*PassportElementErrorSelfie) AsPassportElementError added in v0.17.0

func (v *PassportElementErrorSelfie) AsPassportElementError() PassportElementError

AsPassportElementError wraps the variant into a PassportElementError union.

type PassportElementErrorSource added in v0.16.0

type PassportElementErrorSource int

PassportElementErrorSource represents the type of PassportElementError.

const (
	PassportElementErrorSourceDataField        PassportElementErrorSource = iota + 1 // "data"
	PassportElementErrorSourceFrontSide                                              // "front_side"
	PassportElementErrorSourceReverseSide                                            // "reverse_side"
	PassportElementErrorSourceSelfie                                                 // "selfie"
	PassportElementErrorSourceFile                                                   // "file"
	PassportElementErrorSourceFiles                                                  // "files"
	PassportElementErrorSourceTranslationFile                                        // "translation_file"
	PassportElementErrorSourceTranslationFiles                                       // "translation_files"
	PassportElementErrorSourceUnspecified                                            // "unspecified"
)

func (PassportElementErrorSource) MarshalText added in v0.16.0

func (v PassportElementErrorSource) MarshalText() ([]byte, error)

func (PassportElementErrorSource) String added in v0.16.0

func (*PassportElementErrorSource) UnmarshalText added in v0.16.0

func (v *PassportElementErrorSource) UnmarshalText(b []byte) error

type PassportElementErrorTranslationFile

type PassportElementErrorTranslationFile struct {
	// Type of element of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”
	Type string `json:"type"`

	// Base64-encoded file hash
	FileHash string `json:"file_hash"`

	// Error message
	Message string `json:"message"`
}

PassportElementErrorTranslationFile represents an issue with one of the files that constitute the translation of a document. The error is considered resolved when the file changes.

func NewPassportElementErrorTranslationFile added in v0.16.0

func NewPassportElementErrorTranslationFile(type_ string, fileHash string, message string) *PassportElementErrorTranslationFile

NewPassportElementErrorTranslationFile creates a new PassportElementErrorTranslationFile.

func (*PassportElementErrorTranslationFile) AsPassportElementError added in v0.17.0

func (v *PassportElementErrorTranslationFile) AsPassportElementError() PassportElementError

AsPassportElementError wraps the variant into a PassportElementError union.

type PassportElementErrorTranslationFiles

type PassportElementErrorTranslationFiles struct {
	// Type of element of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”
	Type string `json:"type"`

	// List of base64-encoded file hashes
	FileHashes []string `json:"file_hashes"`

	// Error message
	Message string `json:"message"`
}

PassportElementErrorTranslationFiles represents an issue with the translated version of a document. The error is considered resolved when a file with the document translation change.

func NewPassportElementErrorTranslationFiles added in v0.16.0

func NewPassportElementErrorTranslationFiles(type_ string, fileHashes []string, message string) *PassportElementErrorTranslationFiles

NewPassportElementErrorTranslationFiles creates a new PassportElementErrorTranslationFiles.

func (*PassportElementErrorTranslationFiles) AsPassportElementError added in v0.17.0

func (v *PassportElementErrorTranslationFiles) AsPassportElementError() PassportElementError

AsPassportElementError wraps the variant into a PassportElementError union.

type PassportElementErrorUnspecified

type PassportElementErrorUnspecified struct {
	// Type of element of the user's Telegram Passport which has the issue
	Type string `json:"type"`

	// Base64-encoded element hash
	ElementHash string `json:"element_hash"`

	// Error message
	Message string `json:"message"`
}

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

func NewPassportElementErrorUnspecified added in v0.16.0

func NewPassportElementErrorUnspecified(type_ string, elementHash string, message string) *PassportElementErrorUnspecified

NewPassportElementErrorUnspecified creates a new PassportElementErrorUnspecified.

func (*PassportElementErrorUnspecified) AsPassportElementError added in v0.17.0

func (v *PassportElementErrorUnspecified) AsPassportElementError() PassportElementError

AsPassportElementError wraps the variant into a PassportElementError union.

type PassportFile

type PassportFile struct {
	// Identifier for this file, which can be used to download or reuse the file
	FileID FileID `json:"file_id"`

	// Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
	FileUniqueID string `json:"file_unique_id"`

	// File size in bytes
	FileSize int `json:"file_size"`

	// Unix time when the file was uploaded
	FileDate UnixTime `json:"file_date"`
}

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

type PeerID

type PeerID interface {
	PeerID() string
}

PeerID represents generic Telegram peer.

Known implementations:

type PhotoSize

type PhotoSize struct {
	// Identifier for this file, which can be used to download or reuse the file
	FileID FileID `json:"file_id"`

	// Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
	FileUniqueID string `json:"file_unique_id"`

	// Photo width
	Width int `json:"width"`

	// Photo height
	Height int `json:"height"`

	// Optional. File size in bytes
	FileSize int `json:"file_size,omitempty"`
}

PhotoSize this object represents one size of a photo or a Document / Sticker thumbnail.

type PinChatMessageCall

type PinChatMessageCall struct {
	CallNoResult
}

PinChatMessageCall represents a call to the pinChatMessage method. Use this method to add a message to the list of pinned messages in a chat. In private chats and channel direct messages chats, all non-service messages can be pinned. Conversely, the bot must be an administrator with the 'can_pin_messages' right or the 'can_edit_messages' right to pin messages in groups and channels respectively. Returns True on success.

func NewPinChatMessageCall

func NewPinChatMessageCall(chatID PeerID, messageID int) *PinChatMessageCall

NewPinChatMessageCall constructs a new PinChatMessageCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • messageID: Identifier of a message to pin

func (*PinChatMessageCall) BusinessConnectionID added in v0.16.0

func (call *PinChatMessageCall) BusinessConnectionID(businessConnectionID string) *PinChatMessageCall

BusinessConnectionID sets the business_connection_id parameter.

func (*PinChatMessageCall) ChatID added in v0.0.5

func (call *PinChatMessageCall) ChatID(chatID PeerID) *PinChatMessageCall

ChatID sets the chat_id parameter.

func (*PinChatMessageCall) DisableNotification

func (call *PinChatMessageCall) DisableNotification(disableNotification bool) *PinChatMessageCall

DisableNotification sets the disable_notification parameter.

func (*PinChatMessageCall) MessageID added in v0.0.5

func (call *PinChatMessageCall) MessageID(messageID int) *PinChatMessageCall

MessageID sets the message_id parameter.

type Poll

type Poll struct {
	// Unique poll identifier
	ID string `json:"id"`

	// Poll question, 1-300 characters
	Question string `json:"question"`

	// Optional. Special entities that appear in the question. Currently, only custom emoji entities are allowed in poll questions
	QuestionEntities []MessageEntity `json:"question_entities,omitempty"`

	// List of poll options
	Options []PollOption `json:"options"`

	// Total number of users that voted in the poll
	TotalVoterCount int `json:"total_voter_count"`

	// True, if the poll is closed
	IsClosed bool `json:"is_closed"`

	// True, if the poll is anonymous
	IsAnonymous bool `json:"is_anonymous"`

	// Poll type, currently can be “regular” or “quiz”
	Type PollType `json:"type"`

	// True, if the poll allows multiple answers
	AllowsMultipleAnswers bool `json:"allows_multiple_answers"`

	// Optional. 0-based identifier of the correct answer option. Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to the private chat with the bot.
	CorrectOptionID int `json:"correct_option_id,omitempty"`

	// Optional. Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters
	Explanation string `json:"explanation,omitempty"`

	// Optional. Special entities like usernames, URLs, bot commands, etc. that appear in the explanation
	ExplanationEntities []MessageEntity `json:"explanation_entities,omitempty"`

	// Optional. Amount of time in seconds the poll will be active after creation
	OpenPeriod int `json:"open_period,omitempty"`

	// Optional. Point in time (Unix timestamp) when the poll will be automatically closed
	CloseDate UnixTime `json:"close_date,omitempty"`
}

Poll this object contains information about a poll.

type PollAnswer

type PollAnswer struct {
	// Unique poll identifier
	PollID string `json:"poll_id"`

	// Optional. The chat that changed the answer to the poll, if the voter is anonymous
	VoterChat *Chat `json:"voter_chat,omitempty"`

	// Optional. The user that changed the answer to the poll, if the voter isn't anonymous
	User *User `json:"user,omitempty"`

	// 0-based identifiers of chosen answer options. May be empty if the vote was retracted.
	OptionIDs []int `json:"option_ids"`
}

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

type PollOption

type PollOption struct {
	// Option text, 1-100 characters
	Text string `json:"text"`

	// Optional. Special entities that appear in the option text. Currently, only custom emoji entities are allowed in poll option texts
	TextEntities []MessageEntity `json:"text_entities,omitempty"`

	// Number of users that voted for this option
	VoterCount int `json:"voter_count"`
}

PollOption this object contains information about one answer option in a poll.

type PollType added in v0.17.0

type PollType int8

PollType represents an enum type.

const (
	PollTypeUnknown PollType = iota
	PollTypeRegular          // "regular"
	PollTypeQuiz             // "quiz"
)

func (PollType) IsUnknown added in v0.17.0

func (v PollType) IsUnknown() bool

IsUnknown reports whether this value is unknown.

func (PollType) MarshalText added in v0.17.0

func (v PollType) MarshalText() ([]byte, error)

func (PollType) String added in v0.17.0

func (v PollType) String() string

func (*PollType) UnmarshalText added in v0.17.0

func (v *PollType) UnmarshalText(b []byte) error

type PostStoryCall added in v0.16.0

type PostStoryCall struct {
	Call[Story]
}

PostStoryCall represents a call to the postStory method. Posts a story on behalf of a managed business account. Requires the can_manage_stories business bot right. Returns Story on success.

func NewPostStoryCall added in v0.16.0

func NewPostStoryCall(businessConnectionID string, content InputStoryContentClass, activePeriod int) *PostStoryCall

NewPostStoryCall constructs a new PostStoryCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection
  • content: Content of the story
  • activePeriod: Period after which the story is moved to the archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400

func (*PostStoryCall) ActivePeriod added in v0.16.0

func (call *PostStoryCall) ActivePeriod(activePeriod int) *PostStoryCall

ActivePeriod sets the active_period parameter.

func (*PostStoryCall) Areas added in v0.16.0

func (call *PostStoryCall) Areas(areas []StoryArea) *PostStoryCall

Areas sets the areas parameter.

func (*PostStoryCall) BusinessConnectionID added in v0.16.0

func (call *PostStoryCall) BusinessConnectionID(businessConnectionID string) *PostStoryCall

BusinessConnectionID sets the business_connection_id parameter.

func (*PostStoryCall) Caption added in v0.16.0

func (call *PostStoryCall) Caption(caption string) *PostStoryCall

Caption sets the caption parameter.

func (*PostStoryCall) CaptionEntities added in v0.16.0

func (call *PostStoryCall) CaptionEntities(captionEntities []MessageEntity) *PostStoryCall

CaptionEntities sets the caption_entities parameter.

func (*PostStoryCall) Content added in v0.16.0

func (call *PostStoryCall) Content(content InputStoryContentClass) *PostStoryCall

Content sets the content parameter.

func (*PostStoryCall) ParseMode added in v0.16.0

func (call *PostStoryCall) ParseMode(parseMode ParseMode) *PostStoryCall

ParseMode sets the parse_mode parameter.

func (*PostStoryCall) PostToChatPage added in v0.16.0

func (call *PostStoryCall) PostToChatPage(postToChatPage bool) *PostStoryCall

PostToChatPage sets the post_to_chat_page parameter.

func (*PostStoryCall) ProtectContent added in v0.16.0

func (call *PostStoryCall) ProtectContent(protectContent bool) *PostStoryCall

ProtectContent sets the protect_content parameter.

type PreCheckoutQuery

type PreCheckoutQuery struct {
	// Unique query identifier
	ID string `json:"id"`

	// User who sent the query
	From User `json:"from"`

	// Three-letter ISO 4217 [currency] code, or “XTR” for payments in [Telegram Stars]
	//
	// [currency]: https://core.telegram.org/bots/payments#supported-currencies
	// [Telegram Stars]: https://t.me/BotNews/90
	Currency string `json:"currency"`

	// Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in [currencies.json], it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
	//
	// [currencies.json]: https://core.telegram.org/bots/payments/currencies.json
	TotalAmount int `json:"total_amount"`

	// Bot-specified invoice payload
	InvoicePayload string `json:"invoice_payload"`

	// Optional. Identifier of the shipping option chosen by the user
	ShippingOptionID string `json:"shipping_option_id,omitempty"`

	// Optional. Order information provided by the user
	OrderInfo *OrderInfo `json:"order_info,omitempty"`
}

PreCheckoutQuery this object contains information about an incoming pre-checkout query.

type PreparedInlineMessage added in v0.16.0

type PreparedInlineMessage struct {
	// Unique identifier of the prepared message
	ID string `json:"id"`

	// Expiration date of the prepared message, in Unix time. Expired prepared messages can no longer be used
	ExpirationDate UnixTime `json:"expiration_date"`
}

PreparedInlineMessage describes an inline message to be sent by a user of a Mini App.

type PromoteChatMemberCall

type PromoteChatMemberCall struct {
	CallNoResult
}

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

func NewPromoteChatMemberCall

func NewPromoteChatMemberCall(chatID PeerID, userID UserID) *PromoteChatMemberCall

NewPromoteChatMemberCall constructs a new PromoteChatMemberCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • userID: Unique identifier of the target user

func (*PromoteChatMemberCall) CanChangeInfo

func (call *PromoteChatMemberCall) CanChangeInfo(canChangeInfo bool) *PromoteChatMemberCall

CanChangeInfo sets the can_change_info parameter.

func (*PromoteChatMemberCall) CanDeleteMessages

func (call *PromoteChatMemberCall) CanDeleteMessages(canDeleteMessages bool) *PromoteChatMemberCall

CanDeleteMessages sets the can_delete_messages parameter.

func (*PromoteChatMemberCall) CanDeleteStories added in v0.11.0

func (call *PromoteChatMemberCall) CanDeleteStories(canDeleteStories bool) *PromoteChatMemberCall

CanDeleteStories sets the can_delete_stories parameter.

func (*PromoteChatMemberCall) CanEditMessages

func (call *PromoteChatMemberCall) CanEditMessages(canEditMessages bool) *PromoteChatMemberCall

CanEditMessages sets the can_edit_messages parameter.

func (*PromoteChatMemberCall) CanEditStories added in v0.11.0

func (call *PromoteChatMemberCall) CanEditStories(canEditStories bool) *PromoteChatMemberCall

CanEditStories sets the can_edit_stories parameter.

func (*PromoteChatMemberCall) CanInviteUsers

func (call *PromoteChatMemberCall) CanInviteUsers(canInviteUsers bool) *PromoteChatMemberCall

CanInviteUsers sets the can_invite_users parameter.

func (*PromoteChatMemberCall) CanManageChat

func (call *PromoteChatMemberCall) CanManageChat(canManageChat bool) *PromoteChatMemberCall

CanManageChat sets the can_manage_chat parameter.

func (*PromoteChatMemberCall) CanManageDirectMessages added in v0.16.0

func (call *PromoteChatMemberCall) CanManageDirectMessages(canManageDirectMessages bool) *PromoteChatMemberCall

CanManageDirectMessages sets the can_manage_direct_messages parameter.

func (*PromoteChatMemberCall) CanManageTopics added in v0.6.0

func (call *PromoteChatMemberCall) CanManageTopics(canManageTopics bool) *PromoteChatMemberCall

CanManageTopics sets the can_manage_topics parameter.

func (*PromoteChatMemberCall) CanManageVideoChats

func (call *PromoteChatMemberCall) CanManageVideoChats(canManageVideoChats bool) *PromoteChatMemberCall

CanManageVideoChats sets the can_manage_video_chats parameter.

func (*PromoteChatMemberCall) CanPinMessages

func (call *PromoteChatMemberCall) CanPinMessages(canPinMessages bool) *PromoteChatMemberCall

CanPinMessages sets the can_pin_messages parameter.

func (*PromoteChatMemberCall) CanPostMessages

func (call *PromoteChatMemberCall) CanPostMessages(canPostMessages bool) *PromoteChatMemberCall

CanPostMessages sets the can_post_messages parameter.

func (*PromoteChatMemberCall) CanPostStories added in v0.11.0

func (call *PromoteChatMemberCall) CanPostStories(canPostStories bool) *PromoteChatMemberCall

CanPostStories sets the can_post_stories parameter.

func (*PromoteChatMemberCall) CanPromoteMembers

func (call *PromoteChatMemberCall) CanPromoteMembers(canPromoteMembers bool) *PromoteChatMemberCall

CanPromoteMembers sets the can_promote_members parameter.

func (*PromoteChatMemberCall) CanRestrictMembers

func (call *PromoteChatMemberCall) CanRestrictMembers(canRestrictMembers bool) *PromoteChatMemberCall

CanRestrictMembers sets the can_restrict_members parameter.

func (*PromoteChatMemberCall) ChatID added in v0.0.5

func (call *PromoteChatMemberCall) ChatID(chatID PeerID) *PromoteChatMemberCall

ChatID sets the chat_id parameter.

func (*PromoteChatMemberCall) IsAnonymous

func (call *PromoteChatMemberCall) IsAnonymous(isAnonymous bool) *PromoteChatMemberCall

IsAnonymous sets the is_anonymous parameter.

func (*PromoteChatMemberCall) UserID added in v0.0.5

func (call *PromoteChatMemberCall) UserID(userID UserID) *PromoteChatMemberCall

UserID sets the user_id parameter.

type ProximityAlertTriggered

type ProximityAlertTriggered struct {
	// User that triggered the alert
	Traveler User `json:"traveler"`

	// User that set the alert
	Watcher User `json:"watcher"`

	// The distance between the users
	Distance int `json:"distance"`
}

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

type ReactionCount added in v0.12.0

type ReactionCount struct {
	// Type of the reaction
	Type ReactionType `json:"type"`

	// Number of times the reaction was added
	TotalCount int `json:"total_count"`
}

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

type ReactionEmoji added in v0.17.0

type ReactionEmoji int8

ReactionEmoji represents an enum type.

const (
	ReactionEmojiUnknown                    ReactionEmoji = iota
	ReactionEmojiRedHeart                                 // "❤"
	ReactionEmojiThumbsUp                                 // "👍"
	ReactionEmojiThumbsDown                               // "👎"
	ReactionEmojiFire                                     // "🔥"
	ReactionEmojiSmilingFaceWithHearts                    // "🥰"
	ReactionEmojiClappingHands                            // "👏"
	ReactionEmojiBeamingFaceWithSmilingEyes               // "😁"
	ReactionEmojiThinkingFace                             // "🤔"
	ReactionEmojiExplodingHead                            // "🤯"
	ReactionEmojiFaceScreamingInFear                      // "😱"
	ReactionEmojiFaceWithSymbolsOnMouth                   // "🤬"
	ReactionEmojiCryingFace                               // "😢"
	ReactionEmojiPartyPopper                              // "🎉"
	ReactionEmojiStarStruck                               // "🤩"
	ReactionEmojiFaceVomiting                             // "🤮"
	ReactionEmojiPileOfPoo                                // "💩"
	ReactionEmojiFoldedHands                              // "🙏"
	ReactionEmojiOKHand                                   // "👌"
	ReactionEmojiDove                                     // "🕊"
	ReactionEmojiClownFace                                // "🤡"
	ReactionEmojiYawningFace                              // "🥱"
	ReactionEmojiWoozyFace                                // "🥴"
	ReactionEmojiSmilingFaceWithHeartEyes                 // "😍"
	ReactionEmojiSpoutingWhale                            // "🐳"
	ReactionEmojiHeartOnFire                              // "❤‍🔥"
	ReactionEmojiNewMoonFace                              // "🌚"
	ReactionEmojiHotDog                                   // "🌭"
	ReactionEmojiHundredPoints                            // "💯"
	ReactionEmojiRollingOnTheFloorLaughing                // "🤣"
	ReactionEmojiHighVoltage                              // "⚡"
	ReactionEmojiBanana                                   // "🍌"
	ReactionEmojiTrophy                                   // "🏆"
	ReactionEmojiBrokenHeart                              // "💔"
	ReactionEmojiFaceWithRaisedEyebrow                    // "🤨"
	ReactionEmojiNeutralFace                              // "😐"
	ReactionEmojiStrawberry                               // "🍓"
	ReactionEmojiBottleWithPoppingCork                    // "🍾"
	ReactionEmojiKissMark                                 // "💋"
	ReactionEmojiMiddleFinger                             // "🖕"
	ReactionEmojiSmilingFaceWithHorns                     // "😈"
	ReactionEmojiSleepingFace                             // "😴"
	ReactionEmojiLoudlyCryingFace                         // "😭"
	ReactionEmojiNerdFace                                 // "🤓"
	ReactionEmojiGhost                                    // "👻"
	ReactionEmojiManTechnologist                          // "👨‍💻"
	ReactionEmojiEyes                                     // "👀"
	ReactionEmojiJackOLantern                             // "🎃"
	ReactionEmojiSeeNoEvilMonkey                          // "🙈"
	ReactionEmojiSmilingFaceWithHalo                      // "😇"
	ReactionEmojiFearfulFace                              // "😨"
	ReactionEmojiHandshake                                // "🤝"
	ReactionEmojiWritingHand                              // "✍"
	ReactionEmojiSmilingFaceWithOpenHands                 // "🤗"
	ReactionEmojiSalutingFace                             // "🫡"
	ReactionEmojiSantaClaus                               // "🎅"
	ReactionEmojiChristmasTree                            // "🎄"
	ReactionEmojiSnowman                                  // "☃"
	ReactionEmojiNailPolish                               // "💅"
	ReactionEmojiZanyFace                                 // "🤪"
	ReactionEmojiMoai                                     // "🗿"
	ReactionEmojiCoolButton                               // "🆒"
	ReactionEmojiHeartWithArrow                           // "💘"
	ReactionEmojiHearNoEvilMonkey                         // "🙉"
	ReactionEmojiUnicorn                                  // "🦄"
	ReactionEmojiFaceBlowingAKiss                         // "😘"
	ReactionEmojiPill                                     // "💊"
	ReactionEmojiSpeakNoEvilMonkey                        // "🙊"
	ReactionEmojiSmilingFaceWithSunglasses                // "😎"
	ReactionEmojiAlienMonster                             // "👾"
	ReactionEmojiManShrugging                             // "🤷‍♂"
	ReactionEmojiPersonShrugging                          // "🤷"
	ReactionEmojiWomanShrugging                           // "🤷‍♀"
	ReactionEmojiEnragedFace                              // "😡"
)

func (ReactionEmoji) IsUnknown added in v0.17.0

func (v ReactionEmoji) IsUnknown() bool

IsUnknown reports whether this value is unknown.

func (ReactionEmoji) MarshalText added in v0.17.0

func (v ReactionEmoji) MarshalText() ([]byte, error)

func (ReactionEmoji) String added in v0.17.0

func (v ReactionEmoji) String() string

func (*ReactionEmoji) UnmarshalText added in v0.17.0

func (v *ReactionEmoji) UnmarshalText(b []byte) error

type ReactionType added in v0.12.0

type ReactionType struct {
	Emoji       *ReactionTypeEmoji
	CustomEmoji *ReactionTypeCustomEmoji
	Paid        *ReactionTypePaid
	Unknown     *UnknownVariant
}

ReactionType this object describes the type of a reaction. Currently, it can be one of

func ReactionTypeOf added in v0.17.0

func ReactionTypeOf(values ...ReactionTypeClass) []ReactionType

ReactionTypeOf converts ReactionTypeClass arguments to a slice of ReactionType.

func (ReactionType) AsReactionType added in v0.17.0

func (u ReactionType) AsReactionType() ReactionType

AsReactionType returns the union as-is, implementing ReactionTypeClass.

func (*ReactionType) IsUnknown added in v0.16.0

func (u *ReactionType) IsUnknown() bool

IsUnknown reports whether this union contains an unknown variant. This can happen when the API returns a new variant not yet supported by this library.

func (ReactionType) MarshalJSON added in v0.12.0

func (u ReactionType) MarshalJSON() ([]byte, error)

func (*ReactionType) Type added in v0.12.0

func (u *ReactionType) Type() ReactionTypeType

Type returns the discriminator value for this union.

func (*ReactionType) UnmarshalJSON added in v0.12.0

func (u *ReactionType) UnmarshalJSON(data []byte) error

type ReactionTypeClass added in v0.17.0

type ReactionTypeClass interface {
	AsReactionType() ReactionType
}

ReactionTypeClass is an interface for types that can be used as ReactionType.

Known implementations:

type ReactionTypeCustomEmoji added in v0.12.0

type ReactionTypeCustomEmoji struct {
	// Custom emoji identifier
	CustomEmojiID string `json:"custom_emoji_id"`
}

ReactionTypeCustomEmoji the reaction is based on a custom emoji.

func NewReactionTypeCustomEmoji added in v0.14.0

func NewReactionTypeCustomEmoji(customEmojiID string) *ReactionTypeCustomEmoji

NewReactionTypeCustomEmoji creates a new ReactionTypeCustomEmoji.

func (*ReactionTypeCustomEmoji) AsReactionType added in v0.17.0

func (v *ReactionTypeCustomEmoji) AsReactionType() ReactionType

AsReactionType wraps the variant into a ReactionType union.

type ReactionTypeEmoji added in v0.12.0

type ReactionTypeEmoji struct {
	// Reaction emoji. Currently, it can be one of "❤", "👍", "👎", "🔥", "🥰", "👏", "😁", "🤔", "🤯", "😱", "🤬", "😢", "🎉", "🤩", "🤮", "💩", "🙏", "👌", "🕊", "🤡", "🥱", "🥴", "😍", "🐳", "❤‍🔥", "🌚", "🌭", "💯", "🤣", "⚡", "🍌", "🏆", "💔", "🤨", "😐", "🍓", "🍾", "💋", "🖕", "😈", "😴", "😭", "🤓", "👻", "👨‍💻", "👀", "🎃", "🙈", "😇", "😨", "🤝", "✍", "🤗", "🫡", "🎅", "🎄", "☃", "💅", "🤪", "🗿", "🆒", "💘", "🙉", "🦄", "😘", "💊", "🙊", "😎", "👾", "🤷‍♂", "🤷", "🤷‍♀", "😡"
	Emoji ReactionEmoji `json:"emoji"`
}

ReactionTypeEmoji the reaction is based on an emoji.

func NewReactionTypeEmoji added in v0.14.0

func NewReactionTypeEmoji(emoji ReactionEmoji) *ReactionTypeEmoji

NewReactionTypeEmoji creates a new ReactionTypeEmoji.

func (*ReactionTypeEmoji) AsReactionType added in v0.17.0

func (v *ReactionTypeEmoji) AsReactionType() ReactionType

AsReactionType wraps the variant into a ReactionType union.

type ReactionTypePaid added in v0.16.0

type ReactionTypePaid struct{}

ReactionTypePaid the reaction is paid.

func NewReactionTypePaid added in v0.16.0

func NewReactionTypePaid() *ReactionTypePaid

NewReactionTypePaid creates a new ReactionTypePaid.

func (*ReactionTypePaid) AsReactionType added in v0.17.0

func (v *ReactionTypePaid) AsReactionType() ReactionType

AsReactionType wraps the variant into a ReactionType union.

type ReactionTypeType added in v0.16.0

type ReactionTypeType int

ReactionTypeType represents the type of ReactionType.

const (
	ReactionTypeTypeEmoji       ReactionTypeType = iota + 1 // "emoji"
	ReactionTypeTypeCustomEmoji                             // "custom_emoji"
	ReactionTypeTypePaid                                    // "paid"
)

func (ReactionTypeType) MarshalText added in v0.16.0

func (v ReactionTypeType) MarshalText() ([]byte, error)

func (ReactionTypeType) String added in v0.16.0

func (v ReactionTypeType) String() string

func (*ReactionTypeType) UnmarshalText added in v0.16.0

func (v *ReactionTypeType) UnmarshalText(b []byte) error

type ReadBusinessMessageCall added in v0.16.0

type ReadBusinessMessageCall struct {
	CallNoResult
}

ReadBusinessMessageCall represents a call to the readBusinessMessage method. Marks incoming message as read on behalf of a business account. Requires the can_read_messages business bot right. Returns True on success.

func NewReadBusinessMessageCall added in v0.16.0

func NewReadBusinessMessageCall(businessConnectionID string, chatID int, messageID int) *ReadBusinessMessageCall

NewReadBusinessMessageCall constructs a new ReadBusinessMessageCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection on behalf of which to read the message
  • chatID: Unique identifier of the chat in which the message was received. The chat must have been active in the last 24 hours.
  • messageID: Unique identifier of the message to mark as read

func (*ReadBusinessMessageCall) BusinessConnectionID added in v0.16.0

func (call *ReadBusinessMessageCall) BusinessConnectionID(businessConnectionID string) *ReadBusinessMessageCall

BusinessConnectionID sets the business_connection_id parameter.

func (*ReadBusinessMessageCall) ChatID added in v0.16.0

func (call *ReadBusinessMessageCall) ChatID(chatID int) *ReadBusinessMessageCall

ChatID sets the chat_id parameter.

func (*ReadBusinessMessageCall) MessageID added in v0.16.0

func (call *ReadBusinessMessageCall) MessageID(messageID int) *ReadBusinessMessageCall

MessageID sets the message_id parameter.

type RefundStarPaymentCall added in v0.16.0

type RefundStarPaymentCall struct {
	CallNoResult
}

RefundStarPaymentCall represents a call to the refundStarPayment method. Refunds a successful payment in Telegram Stars. Returns True on success.

func NewRefundStarPaymentCall added in v0.16.0

func NewRefundStarPaymentCall(userID UserID, telegramPaymentChargeID string) *RefundStarPaymentCall

NewRefundStarPaymentCall constructs a new RefundStarPaymentCall.

Required params:

  • userID: Identifier of the user whose payment will be refunded
  • telegramPaymentChargeID: Telegram payment identifier

func (*RefundStarPaymentCall) TelegramPaymentChargeID added in v0.16.0

func (call *RefundStarPaymentCall) TelegramPaymentChargeID(telegramPaymentChargeID string) *RefundStarPaymentCall

TelegramPaymentChargeID sets the telegram_payment_charge_id parameter.

func (*RefundStarPaymentCall) UserID added in v0.16.0

func (call *RefundStarPaymentCall) UserID(userID UserID) *RefundStarPaymentCall

UserID sets the user_id parameter.

type RefundedPayment added in v0.16.0

type RefundedPayment struct {
	// Total refunded price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45, total_amount = 145. See the exp parameter in [currencies.json], it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
	//
	// [currencies.json]: https://core.telegram.org/bots/payments/currencies.json
	TotalAmount int `json:"total_amount"`

	// Bot-specified invoice payload
	InvoicePayload string `json:"invoice_payload"`

	// Telegram payment identifier
	TelegramPaymentChargeID string `json:"telegram_payment_charge_id"`

	// Optional. Provider payment identifier
	ProviderPaymentChargeID string `json:"provider_payment_charge_id,omitempty"`
}

RefundedPayment this object contains basic information about a refunded payment.

type RemoveBusinessAccountProfilePhotoCall added in v0.16.0

type RemoveBusinessAccountProfilePhotoCall struct {
	CallNoResult
}

RemoveBusinessAccountProfilePhotoCall represents a call to the removeBusinessAccountProfilePhoto method. Removes the current profile photo of a managed business account. Requires the can_edit_profile_photo business bot right. Returns True on success.

func NewRemoveBusinessAccountProfilePhotoCall added in v0.16.0

func NewRemoveBusinessAccountProfilePhotoCall(businessConnectionID string) *RemoveBusinessAccountProfilePhotoCall

NewRemoveBusinessAccountProfilePhotoCall constructs a new RemoveBusinessAccountProfilePhotoCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection

func (*RemoveBusinessAccountProfilePhotoCall) BusinessConnectionID added in v0.16.0

func (call *RemoveBusinessAccountProfilePhotoCall) BusinessConnectionID(businessConnectionID string) *RemoveBusinessAccountProfilePhotoCall

BusinessConnectionID sets the business_connection_id parameter.

func (*RemoveBusinessAccountProfilePhotoCall) IsPublic added in v0.16.0

IsPublic sets the is_public parameter.

type RemoveChatVerificationCall added in v0.16.0

type RemoveChatVerificationCall struct {
	CallNoResult
}

RemoveChatVerificationCall represents a call to the removeChatVerification method. Removes verification from a chat that is currently verified on behalf of the organization represented by the bot. Returns True on success.

func NewRemoveChatVerificationCall added in v0.16.0

func NewRemoveChatVerificationCall(chatID PeerID) *RemoveChatVerificationCall

NewRemoveChatVerificationCall constructs a new RemoveChatVerificationCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*RemoveChatVerificationCall) ChatID added in v0.16.0

ChatID sets the chat_id parameter.

type RemoveMyProfilePhotoCall added in v0.18.0

type RemoveMyProfilePhotoCall struct {
	CallNoResult
}

RemoveMyProfilePhotoCall represents a call to the removeMyProfilePhoto method. Removes the profile photo of the bot. Requires no parameters. Returns True on success.

func NewRemoveMyProfilePhotoCall added in v0.18.0

func NewRemoveMyProfilePhotoCall() *RemoveMyProfilePhotoCall

NewRemoveMyProfilePhotoCall constructs a new RemoveMyProfilePhotoCall.

type RemoveUserVerificationCall added in v0.16.0

type RemoveUserVerificationCall struct {
	CallNoResult
}

RemoveUserVerificationCall represents a call to the removeUserVerification method. Removes verification from a user who is currently verified on behalf of the organization represented by the bot. Returns True on success.

func NewRemoveUserVerificationCall added in v0.16.0

func NewRemoveUserVerificationCall(userID UserID) *RemoveUserVerificationCall

NewRemoveUserVerificationCall constructs a new RemoveUserVerificationCall.

Required params:

  • userID: Unique identifier of the target user

func (*RemoveUserVerificationCall) UserID added in v0.16.0

UserID sets the user_id parameter.

type ReopenForumTopicCall added in v0.6.0

type ReopenForumTopicCall struct {
	CallNoResult
}

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

func NewReopenForumTopicCall added in v0.6.0

func NewReopenForumTopicCall(chatID PeerID, messageThreadID int) *ReopenForumTopicCall

NewReopenForumTopicCall constructs a new ReopenForumTopicCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
  • messageThreadID: Unique identifier for the target message thread of the forum topic

func (*ReopenForumTopicCall) ChatID added in v0.6.0

func (call *ReopenForumTopicCall) ChatID(chatID PeerID) *ReopenForumTopicCall

ChatID sets the chat_id parameter.

func (*ReopenForumTopicCall) MessageThreadID added in v0.6.0

func (call *ReopenForumTopicCall) MessageThreadID(messageThreadID int) *ReopenForumTopicCall

MessageThreadID sets the message_thread_id parameter.

type ReopenGeneralForumTopicCall added in v0.6.0

type ReopenGeneralForumTopicCall struct {
	CallNoResult
}

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

func NewReopenGeneralForumTopicCall added in v0.6.0

func NewReopenGeneralForumTopicCall(chatID PeerID) *ReopenGeneralForumTopicCall

NewReopenGeneralForumTopicCall constructs a new ReopenGeneralForumTopicCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

func (*ReopenGeneralForumTopicCall) ChatID added in v0.6.0

ChatID sets the chat_id parameter.

type ReplaceStickerInSetCall added in v0.15.0

type ReplaceStickerInSetCall struct {
	CallNoResult
}

ReplaceStickerInSetCall represents a call to the replaceStickerInSet method. Use this method to replace an existing sticker in a sticker set with a new one. The method is equivalent to calling Client.DeleteStickerFromSet, then Client.AddStickerToSet, then Client.SetStickerPositionInSet. Returns True on success.

func NewReplaceStickerInSetCall added in v0.15.0

func NewReplaceStickerInSetCall(userID UserID, name string, oldSticker string, sticker InputSticker) *ReplaceStickerInSetCall

NewReplaceStickerInSetCall constructs a new ReplaceStickerInSetCall.

Required params:

  • userID: User identifier of the sticker set owner
  • name: Sticker set name
  • oldSticker: File identifier of the replaced sticker
  • sticker: A JSON-serialized object with information about the added sticker. If exactly the same sticker had already been added to the set, then the set remains unchanged.

func (*ReplaceStickerInSetCall) Name added in v0.15.0

Name sets the name parameter.

func (*ReplaceStickerInSetCall) OldSticker added in v0.15.0

func (call *ReplaceStickerInSetCall) OldSticker(oldSticker string) *ReplaceStickerInSetCall

OldSticker sets the old_sticker parameter.

func (*ReplaceStickerInSetCall) Sticker added in v0.15.0

Sticker sets the sticker parameter.

func (*ReplaceStickerInSetCall) UserID added in v0.15.0

UserID sets the user_id parameter.

type ReplyKeyboard added in v0.17.0

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

ReplyKeyboard is a builder for reply keyboards with a fluent API.

Both ReplyKeyboard.Row and ReplyKeyboard.Adjust commit uncommitted buttons added via ReplyKeyboard.Button or shorthand methods like ReplyKeyboard.Text. Previously committed rows are never affected.

ReplyKeyboard implements ReplyMarkup and can be passed directly to .ReplyMarkup(). Use ReplyKeyboard.Markup when you need the underlying ReplyKeyboardMarkup value.

func NewReplyKeyboard added in v0.17.0

func NewReplyKeyboard() *ReplyKeyboard

NewReplyKeyboard creates a new ReplyKeyboard builder.

func (*ReplyKeyboard) Adjust added in v0.17.0

func (b *ReplyKeyboard) Adjust(sizes ...int) *ReplyKeyboard

Adjust redistributes uncommitted buttons into rows following a repeating size pattern. For example, Adjust(2,1) produces rows of 2, 1, 2, 1, … buttons. Empty sizes default to [1]. Previously committed rows are not affected.

func (*ReplyKeyboard) Button added in v0.17.0

func (b *ReplyKeyboard) Button(buttons ...KeyboardButton) *ReplyKeyboard

Button adds pre-built KeyboardButton values to the current (uncommitted) row.

func (*ReplyKeyboard) Markup added in v0.17.0

func (b *ReplyKeyboard) Markup() *ReplyKeyboardMarkup

Markup flushes any remaining uncommitted buttons as the last row and returns the resulting ReplyKeyboardMarkup.

func (*ReplyKeyboard) MarshalJSON added in v0.17.0

func (b *ReplyKeyboard) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler. It serializes the builder as a ReplyKeyboardMarkup.

func (*ReplyKeyboard) OneTime added in v0.17.0

func (b *ReplyKeyboard) OneTime() *ReplyKeyboard

OneTime requests clients to hide the keyboard as soon as it's been used.

func (*ReplyKeyboard) Persistent added in v0.17.0

func (b *ReplyKeyboard) Persistent() *ReplyKeyboard

Persistent requests clients to always show the keyboard.

func (*ReplyKeyboard) Placeholder added in v0.17.0

func (b *ReplyKeyboard) Placeholder(text string) *ReplyKeyboard

Placeholder sets the placeholder text shown in the input field; 1-64 characters.

func (*ReplyKeyboard) RequestChat added in v0.17.0

func (b *ReplyKeyboard) RequestChat(text string, request KeyboardButtonRequestChat) *ReplyKeyboard

RequestChat adds a button that lets the user select a chat.

func (*ReplyKeyboard) RequestContact added in v0.17.0

func (b *ReplyKeyboard) RequestContact(text string) *ReplyKeyboard

RequestContact adds a button that sends the user's phone number.

func (*ReplyKeyboard) RequestLocation added in v0.17.0

func (b *ReplyKeyboard) RequestLocation(text string) *ReplyKeyboard

RequestLocation adds a button that sends the user's current location.

func (*ReplyKeyboard) RequestPoll added in v0.17.0

func (b *ReplyKeyboard) RequestPoll(text string, pollType KeyboardButtonPollType) *ReplyKeyboard

RequestPoll adds a button that lets the user create and send a poll.

func (*ReplyKeyboard) RequestUsers added in v0.17.0

func (b *ReplyKeyboard) RequestUsers(text string, request KeyboardButtonRequestUsers) *ReplyKeyboard

RequestUsers adds a button that lets the user select users.

func (*ReplyKeyboard) Resize added in v0.17.0

func (b *ReplyKeyboard) Resize() *ReplyKeyboard

Resize requests clients to resize the keyboard vertically for optimal fit.

func (*ReplyKeyboard) Row added in v0.17.0

func (b *ReplyKeyboard) Row() *ReplyKeyboard

Row commits the current buttons as a completed row. Subsequent buttons go into a new row.

func (*ReplyKeyboard) Selective added in v0.17.0

func (b *ReplyKeyboard) Selective() *ReplyKeyboard

Selective shows the keyboard to specific users only.

func (*ReplyKeyboard) Text added in v0.17.0

func (b *ReplyKeyboard) Text(text string) *ReplyKeyboard

Text adds a simple text button.

func (*ReplyKeyboard) WebApp added in v0.17.0

func (b *ReplyKeyboard) WebApp(text, url string) *ReplyKeyboard

WebApp adds a Web App button.

type ReplyKeyboardMarkup

type ReplyKeyboardMarkup struct {
	// Array of button rows, each represented by an Array of [KeyboardButton] objects
	Keyboard [][]KeyboardButton `json:"keyboard"`

	// Optional. Requests clients to always show the keyboard when the regular keyboard is hidden. Defaults to false, in which case the custom keyboard can be hidden and opened with a keyboard icon.
	IsPersistent bool `json:"is_persistent,omitempty"`

	// Optional. Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). Defaults to false, in which case the custom keyboard is always of the same height as the app's standard keyboard.
	ResizeKeyboard bool `json:"resize_keyboard,omitempty"`

	// Optional. Requests clients to hide the keyboard as soon as it's been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat - the user can press a special button in the input field to see the custom keyboard again. Defaults to false.
	OneTimeKeyboard bool `json:"one_time_keyboard,omitempty"`

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

	// Optional. Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the [Message] object; 2) if the bot's message is a reply to a message in the same chat and forum topic, sender of the original message.  Example: A user requests to change the bot's language, bot replies to the request with a keyboard to select the new language. Other users in the group don't see the keyboard.
	Selective bool `json:"selective,omitempty"`
}

ReplyKeyboardMarkup this object represents a custom keyboard with reply options (see Introduction to bots for details and examples). Not supported in channels and for messages sent on behalf of a Telegram Business account.

func NewReplyKeyboardMarkup added in v0.0.2

func NewReplyKeyboardMarkup(keyboard ...[]KeyboardButton) *ReplyKeyboardMarkup

NewReplyKeyboardMarkup creates a new ReplyKeyboardMarkup.

func (*ReplyKeyboardMarkup) WithInputFieldPlaceholder added in v0.0.2

func (v *ReplyKeyboardMarkup) WithInputFieldPlaceholder(inputFieldPlaceholder string) *ReplyKeyboardMarkup

WithInputFieldPlaceholder sets the InputFieldPlaceholder field.

func (*ReplyKeyboardMarkup) WithIsPersistent added in v0.17.0

func (v *ReplyKeyboardMarkup) WithIsPersistent() *ReplyKeyboardMarkup

WithIsPersistent sets the IsPersistent field.

func (*ReplyKeyboardMarkup) WithOneTimeKeyboard added in v0.17.0

func (v *ReplyKeyboardMarkup) WithOneTimeKeyboard() *ReplyKeyboardMarkup

WithOneTimeKeyboard sets the OneTimeKeyboard field.

func (*ReplyKeyboardMarkup) WithResizeKeyboard added in v0.17.0

func (v *ReplyKeyboardMarkup) WithResizeKeyboard() *ReplyKeyboardMarkup

WithResizeKeyboard sets the ResizeKeyboard field.

func (*ReplyKeyboardMarkup) WithSelective added in v0.0.2

func (v *ReplyKeyboardMarkup) WithSelective() *ReplyKeyboardMarkup

WithSelective sets the Selective field.

type ReplyKeyboardRemove

type ReplyKeyboardRemove struct {
	// Requests clients to remove the custom keyboard (user will not be able to summon this keyboard; if you want to hide the keyboard from sight but keep it accessible, use one_time_keyboard in [ReplyKeyboardMarkup])
	RemoveKeyboard bool `json:"remove_keyboard"`

	// Optional. Use this parameter if you want to remove the keyboard for specific users only. Targets: 1) users that are @mentioned in the text of the [Message] object; 2) if the bot's message is a reply to a message in the same chat and forum topic, sender of the original message.  Example: A user votes in a poll, bot returns confirmation message in reply to the vote and removes the keyboard for that user, while still showing the keyboard with poll options to users who haven't voted yet.
	Selective bool `json:"selective,omitempty"`
}

ReplyKeyboardRemove upon receiving a message with this object, Telegram clients will remove the current custom keyboard and display the default letter-keyboard. By default, custom keyboards are displayed until a new keyboard is sent by a bot. An exception is made for one-time keyboards that are hidden immediately after the user presses a button (see ReplyKeyboardMarkup). Not supported in channels and for messages sent on behalf of a Telegram Business account.

func NewReplyKeyboardRemove added in v0.0.2

func NewReplyKeyboardRemove() *ReplyKeyboardRemove

NewReplyKeyboardRemove creates a new ReplyKeyboardRemove.

func (*ReplyKeyboardRemove) WithSelective added in v0.0.2

func (v *ReplyKeyboardRemove) WithSelective() *ReplyKeyboardRemove

WithSelective sets the Selective field.

type ReplyMarkup

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

ReplyMarkup is a marker interface for ReplyMarkup variants.

Known implementations:

type ReplyParameters added in v0.12.0

type ReplyParameters struct {
	// Identifier of the message that will be replied to in the current chat, or in the chat chat_id if it is specified
	MessageID int `json:"message_id"`

	// Optional. If the message to be replied to is from a different chat, unique identifier for the chat or username of the channel (in the format @channelusername). Not supported for messages sent on behalf of a business account and messages from channel direct messages chats.
	ChatID ChatID `json:"chat_id,omitempty"`

	// Optional. Pass True if the message should be sent even if the specified message to be replied to is not found. Always False for replies in another chat or forum topic. Always True for messages sent on behalf of a business account.
	AllowSendingWithoutReply bool `json:"allow_sending_without_reply,omitempty"`

	// Optional. Quoted part of the message to be replied to; 0-1024 characters after entities parsing. The quote must be an exact substring of the message to be replied to, including bold, italic, underline, strikethrough, spoiler, and custom_emoji entities. The message will fail to send if the quote isn't found in the original message.
	Quote string `json:"quote,omitempty"`

	// Optional. Mode for parsing entities in the quote. See [formatting options] for more details.
	//
	// [formatting options]: https://core.telegram.org/bots/api#formatting-options
	QuoteParseMode ParseMode `json:"quote_parse_mode,omitempty"`

	// Optional. A JSON-serialized list of special entities that appear in the quote. It can be specified instead of quote_parse_mode.
	QuoteEntities []MessageEntity `json:"quote_entities,omitempty"`

	// Optional. Position of the quote in the original message in UTF-16 code units
	QuotePosition int `json:"quote_position,omitempty"`

	// Optional. Identifier of the specific checklist task to be replied to
	ChecklistTaskID int `json:"checklist_task_id,omitempty"`
}

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

type RepostStoryCall added in v0.16.0

type RepostStoryCall struct {
	Call[Story]
}

RepostStoryCall represents a call to the repostStory method. Reposts a story on behalf of a business account from another business account. Both business accounts must be managed by the same bot, and the story on the source account must have been posted (or reposted) by the bot. Requires the can_manage_stories business bot right for both business accounts. Returns Story on success.

func NewRepostStoryCall added in v0.16.0

func NewRepostStoryCall(businessConnectionID string, fromChatID int, fromStoryID int, activePeriod int) *RepostStoryCall

NewRepostStoryCall constructs a new RepostStoryCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection
  • fromChatID: Unique identifier of the chat which posted the story that should be reposted
  • fromStoryID: Unique identifier of the story that should be reposted
  • activePeriod: Period after which the story is moved to the archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400

func (*RepostStoryCall) ActivePeriod added in v0.16.0

func (call *RepostStoryCall) ActivePeriod(activePeriod int) *RepostStoryCall

ActivePeriod sets the active_period parameter.

func (*RepostStoryCall) BusinessConnectionID added in v0.16.0

func (call *RepostStoryCall) BusinessConnectionID(businessConnectionID string) *RepostStoryCall

BusinessConnectionID sets the business_connection_id parameter.

func (*RepostStoryCall) FromChatID added in v0.16.0

func (call *RepostStoryCall) FromChatID(fromChatID int) *RepostStoryCall

FromChatID sets the from_chat_id parameter.

func (*RepostStoryCall) FromStoryID added in v0.16.0

func (call *RepostStoryCall) FromStoryID(fromStoryID int) *RepostStoryCall

FromStoryID sets the from_story_id parameter.

func (*RepostStoryCall) PostToChatPage added in v0.16.0

func (call *RepostStoryCall) PostToChatPage(postToChatPage bool) *RepostStoryCall

PostToChatPage sets the post_to_chat_page parameter.

func (*RepostStoryCall) ProtectContent added in v0.16.0

func (call *RepostStoryCall) ProtectContent(protectContent bool) *RepostStoryCall

ProtectContent sets the protect_content parameter.

type Request

type Request struct {
	Method string
	// contains filtered or unexported fields
}

Request is Telegram Bot API request structure.

func NewRequest

func NewRequest(method string) *Request

func (*Request) Bool

func (r *Request) Bool(name string, value bool) *Request

func (*Request) ChatID

func (r *Request) ChatID(name string, v ChatID) *Request

func (*Request) Encode

func (r *Request) Encode(encoder Encoder) error

Encode request using encoder.

func (*Request) File

func (r *Request) File(name string, arg FileArg) *Request

func (*Request) FileID added in v0.1.0

func (r *Request) FileID(name string, v FileID) *Request

func (*Request) Float64

func (r *Request) Float64(name string, value float64) *Request

func (*Request) GetArg added in v0.14.0

func (r *Request) GetArg(name string) (string, bool)

func (*Request) GetJSON added in v0.14.0

func (r *Request) GetJSON(name string) (any, bool)

func (*Request) Has added in v0.13.0

func (r *Request) Has(name string) bool

func (*Request) InputFile

func (r *Request) InputFile(name string, file InputFile) *Request

func (*Request) InputMedia added in v0.0.5

func (r *Request) InputMedia(name string, im InputMedia) *Request

func (*Request) InputMediaSlice added in v0.0.5

func (r *Request) InputMediaSlice(name string, im []InputMedia) *Request

func (*Request) InputPaidMediaSlice added in v0.16.0

func (r *Request) InputPaidMediaSlice(name string, im []InputPaidMedia) *Request

func (*Request) Int

func (r *Request) Int(name string, value int) *Request

func (*Request) Int64

func (r *Request) Int64(name string, value int64) *Request

func (*Request) JSON

func (r *Request) JSON(name string, v any) *Request

func (*Request) MarshalJSON added in v0.4.1

func (req *Request) MarshalJSON() ([]byte, error)

func (*Request) PeerID

func (r *Request) PeerID(name string, v PeerID) *Request

func (*Request) String

func (r *Request) String(name, value string) *Request

func (*Request) Stringer added in v0.0.4

func (r *Request) Stringer(name string, v fmt.Stringer) *Request

func (*Request) UserID added in v0.0.3

func (r *Request) UserID(name string, v UserID) *Request

type Response

type Response struct {
	// If equals true, the request was successful
	// and the result of the query can be found in the 'result' field
	Ok bool `json:"ok"`

	// A human-readable description of the result.
	// Empty if Ok is true.
	// Contains error message if Ok is false.
	Description string `json:"description"`

	// Optional. The result of the request
	Result json.RawMessage `json:"result"`

	// Optional. ErrorCode is the error code returned by Telegram Bot API.
	ErrorCode int `json:"error_code"`

	// Optional.
	Parameters *ResponseParameters `json:"parameters"`

	// HTTP response status code.
	StatusCode int `json:"-"`
}

Response is Telegram Bot API response structure.

type ResponseParameters

type ResponseParameters struct {
	// Optional. The group has been migrated to a supergroup with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.
	MigrateToChatID ChatID `json:"migrate_to_chat_id,omitempty"`

	// Optional. In case of exceeding flood control, the number of seconds left to wait before the request can be repeated
	RetryAfter int `json:"retry_after,omitempty"`
}

ResponseParameters describes why a request was unsuccessful.

func (*ResponseParameters) RetryAfterDuration added in v0.13.0

func (rp *ResponseParameters) RetryAfterDuration() time.Duration

RetryAfterDuration returns duration for retry after.

type RestrictChatMemberCall

type RestrictChatMemberCall struct {
	CallNoResult
}

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

func NewRestrictChatMemberCall

func NewRestrictChatMemberCall(chatID PeerID, userID UserID, permissions ChatPermissions) *RestrictChatMemberCall

NewRestrictChatMemberCall constructs a new RestrictChatMemberCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
  • userID: Unique identifier of the target user
  • permissions: A JSON-serialized object for new user permissions

func (*RestrictChatMemberCall) ChatID added in v0.0.5

ChatID sets the chat_id parameter.

func (*RestrictChatMemberCall) Permissions

func (call *RestrictChatMemberCall) Permissions(permissions ChatPermissions) *RestrictChatMemberCall

Permissions sets the permissions parameter.

func (*RestrictChatMemberCall) UntilDate

func (call *RestrictChatMemberCall) UntilDate(untilDate int) *RestrictChatMemberCall

UntilDate sets the until_date parameter.

func (*RestrictChatMemberCall) UseIndependentChatPermissions added in v0.6.0

func (call *RestrictChatMemberCall) UseIndependentChatPermissions(useIndependentChatPermissions bool) *RestrictChatMemberCall

UseIndependentChatPermissions sets the use_independent_chat_permissions parameter.

func (*RestrictChatMemberCall) UserID added in v0.0.5

UserID sets the user_id parameter.

type RetryInternalServerErrorOption added in v0.13.0

type RetryInternalServerErrorOption func(*interceptorRetryInternalServerErrorOpts)

RetryInternalServerErrorOption is an option for NewRetryInternalServerErrorInterceptor.

func WithInterceptorRetryInternalServerErrorDelay added in v0.13.0

func WithInterceptorRetryInternalServerErrorDelay(delay time.Duration) RetryInternalServerErrorOption

WithInterceptorRetryInternalServerErrorDelay sets the delay between tries. The delay calculated as delay * 2^i + random jitter, where i is the number of tries.

func WithInterceptorRetryInternalServerErrorTimeAfter added in v0.13.0

func WithInterceptorRetryInternalServerErrorTimeAfter(timeAfter func(time.Duration) <-chan time.Time) RetryInternalServerErrorOption

WithInterceptorRetryInternalServerErrorTimeAfter sets the time.After function.

func WithInterceptorRetryInternalServerErrorTries added in v0.13.0

func WithInterceptorRetryInternalServerErrorTries(tries int) RetryInternalServerErrorOption

WithInterceptorRetryInternalServerErrorTries sets the number of tries.

type RevenueWithdrawalState added in v0.16.0

type RevenueWithdrawalState struct {
	Pending   *RevenueWithdrawalStatePending
	Succeeded *RevenueWithdrawalStateSucceeded
	Failed    *RevenueWithdrawalStateFailed
	Unknown   *UnknownVariant
}

RevenueWithdrawalState this object describes the state of a revenue withdrawal operation. Currently, it can be one of

func (*RevenueWithdrawalState) IsUnknown added in v0.16.0

func (u *RevenueWithdrawalState) IsUnknown() bool

IsUnknown reports whether this union contains an unknown variant. This can happen when the API returns a new variant not yet supported by this library.

func (RevenueWithdrawalState) MarshalJSON added in v0.16.0

func (u RevenueWithdrawalState) MarshalJSON() ([]byte, error)

func (*RevenueWithdrawalState) Type added in v0.16.0

Type returns the discriminator value for this union.

func (*RevenueWithdrawalState) UnmarshalJSON added in v0.16.0

func (u *RevenueWithdrawalState) UnmarshalJSON(data []byte) error

type RevenueWithdrawalStateFailed added in v0.16.0

type RevenueWithdrawalStateFailed struct{}

RevenueWithdrawalStateFailed the withdrawal failed and the transaction was refunded.

type RevenueWithdrawalStatePending added in v0.16.0

type RevenueWithdrawalStatePending struct{}

RevenueWithdrawalStatePending the withdrawal is in progress.

type RevenueWithdrawalStateSucceeded added in v0.16.0

type RevenueWithdrawalStateSucceeded struct {
	// Date the withdrawal was completed in Unix time
	Date UnixTime `json:"date"`

	// An HTTPS URL that can be used to see transaction details
	URL string `json:"url"`
}

RevenueWithdrawalStateSucceeded the withdrawal succeeded.

type RevenueWithdrawalStateType added in v0.16.0

type RevenueWithdrawalStateType int

RevenueWithdrawalStateType represents the type of RevenueWithdrawalState.

const (
	RevenueWithdrawalStateTypePending   RevenueWithdrawalStateType = iota + 1 // "pending"
	RevenueWithdrawalStateTypeSucceeded                                       // "succeeded"
	RevenueWithdrawalStateTypeFailed                                          // "failed"
)

func (RevenueWithdrawalStateType) MarshalText added in v0.16.0

func (v RevenueWithdrawalStateType) MarshalText() ([]byte, error)

func (RevenueWithdrawalStateType) String added in v0.16.0

func (*RevenueWithdrawalStateType) UnmarshalText added in v0.16.0

func (v *RevenueWithdrawalStateType) UnmarshalText(b []byte) error

type RevokeChatInviteLinkCall

type RevokeChatInviteLinkCall struct {
	Call[ChatInviteLink]
}

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

func NewRevokeChatInviteLinkCall

func NewRevokeChatInviteLinkCall(chatID PeerID, inviteLink string) *RevokeChatInviteLinkCall

NewRevokeChatInviteLinkCall constructs a new RevokeChatInviteLinkCall.

Required params:

  • chatID: Unique identifier of the target chat or username of the target channel (in the format @channelusername)
  • inviteLink: The invite link to revoke

func (*RevokeChatInviteLinkCall) ChatID added in v0.0.5

ChatID sets the chat_id parameter.

func (call *RevokeChatInviteLinkCall) InviteLink(inviteLink string) *RevokeChatInviteLinkCall

InviteLink sets the invite_link parameter.

type SavePreparedInlineMessageCall added in v0.16.0

type SavePreparedInlineMessageCall struct {
	Call[PreparedInlineMessage]
}

SavePreparedInlineMessageCall represents a call to the savePreparedInlineMessage method. Stores a message that can be sent by a user of a Mini App. Returns a PreparedInlineMessage object.

func NewSavePreparedInlineMessageCall added in v0.16.0

func NewSavePreparedInlineMessageCall(userID UserID, result InlineQueryResultClass) *SavePreparedInlineMessageCall

NewSavePreparedInlineMessageCall constructs a new SavePreparedInlineMessageCall.

Required params:

  • userID: Unique identifier of the target user that can use the prepared message
  • result: A JSON-serialized object describing the message to be sent

func (*SavePreparedInlineMessageCall) AllowBotChats added in v0.16.0

func (call *SavePreparedInlineMessageCall) AllowBotChats(allowBotChats bool) *SavePreparedInlineMessageCall

AllowBotChats sets the allow_bot_chats parameter.

func (*SavePreparedInlineMessageCall) AllowChannelChats added in v0.16.0

func (call *SavePreparedInlineMessageCall) AllowChannelChats(allowChannelChats bool) *SavePreparedInlineMessageCall

AllowChannelChats sets the allow_channel_chats parameter.

func (*SavePreparedInlineMessageCall) AllowGroupChats added in v0.16.0

func (call *SavePreparedInlineMessageCall) AllowGroupChats(allowGroupChats bool) *SavePreparedInlineMessageCall

AllowGroupChats sets the allow_group_chats parameter.

func (*SavePreparedInlineMessageCall) AllowUserChats added in v0.16.0

func (call *SavePreparedInlineMessageCall) AllowUserChats(allowUserChats bool) *SavePreparedInlineMessageCall

AllowUserChats sets the allow_user_chats parameter.

func (*SavePreparedInlineMessageCall) Result added in v0.16.0

Result sets the result parameter.

func (*SavePreparedInlineMessageCall) UserID added in v0.16.0

UserID sets the user_id parameter.

type SendAnimationCall

type SendAnimationCall struct {
	Call[Message]
}

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

func NewSendAnimationCall

func NewSendAnimationCall(chatID PeerID, animation FileArg) *SendAnimationCall

NewSendAnimationCall constructs a new SendAnimationCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • animation: Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the Internet, or upload a new animation using multipart/form-data. More information on Sending Files »

func (*SendAnimationCall) AllowPaidBroadcast added in v0.16.0

func (call *SendAnimationCall) AllowPaidBroadcast(allowPaidBroadcast bool) *SendAnimationCall

AllowPaidBroadcast sets the allow_paid_broadcast parameter.

func (*SendAnimationCall) Animation

func (call *SendAnimationCall) Animation(animation FileArg) *SendAnimationCall

Animation sets the animation parameter.

func (*SendAnimationCall) BusinessConnectionID added in v0.15.0

func (call *SendAnimationCall) BusinessConnectionID(businessConnectionID string) *SendAnimationCall

BusinessConnectionID sets the business_connection_id parameter.

func (*SendAnimationCall) Caption

func (call *SendAnimationCall) Caption(caption string) *SendAnimationCall

Caption sets the caption parameter.

func (*SendAnimationCall) CaptionEntities

func (call *SendAnimationCall) CaptionEntities(captionEntities []MessageEntity) *SendAnimationCall

CaptionEntities sets the caption_entities parameter.

func (*SendAnimationCall) ChatID added in v0.0.5

func (call *SendAnimationCall) ChatID(chatID PeerID) *SendAnimationCall

ChatID sets the chat_id parameter.

func (*SendAnimationCall) DirectMessagesTopicID added in v0.16.0

func (call *SendAnimationCall) DirectMessagesTopicID(directMessagesTopicID int) *SendAnimationCall

DirectMessagesTopicID sets the direct_messages_topic_id parameter.

func (*SendAnimationCall) DisableNotification

func (call *SendAnimationCall) DisableNotification(disableNotification bool) *SendAnimationCall

DisableNotification sets the disable_notification parameter.

func (*SendAnimationCall) Duration

func (call *SendAnimationCall) Duration(duration int) *SendAnimationCall

Duration sets the duration parameter.

func (*SendAnimationCall) HasSpoiler added in v0.6.0

func (call *SendAnimationCall) HasSpoiler(hasSpoiler bool) *SendAnimationCall

HasSpoiler sets the has_spoiler parameter.

func (*SendAnimationCall) Height

func (call *SendAnimationCall) Height(height int) *SendAnimationCall

Height sets the height parameter.

func (*SendAnimationCall) MessageEffectID added in v0.16.0

func (call *SendAnimationCall) MessageEffectID(messageEffectID string) *SendAnimationCall

MessageEffectID sets the message_effect_id parameter.

func (*SendAnimationCall) MessageThreadID added in v0.6.0

func (call *SendAnimationCall) MessageThreadID(messageThreadID int) *SendAnimationCall

MessageThreadID sets the message_thread_id parameter.

func (*SendAnimationCall) ParseMode

func (call *SendAnimationCall) ParseMode(parseMode ParseMode) *SendAnimationCall

ParseMode sets the parse_mode parameter.

func (*SendAnimationCall) ProtectContent

func (call *SendAnimationCall) ProtectContent(protectContent bool) *SendAnimationCall

ProtectContent sets the protect_content parameter.

func (*SendAnimationCall) ReplyMarkup

func (call *SendAnimationCall) ReplyMarkup(replyMarkup ReplyMarkup) *SendAnimationCall

ReplyMarkup sets the reply_markup parameter.

func (*SendAnimationCall) ReplyParameters added in v0.12.0

func (call *SendAnimationCall) ReplyParameters(replyParameters ReplyParameters) *SendAnimationCall

ReplyParameters sets the reply_parameters parameter.

func (*SendAnimationCall) ShowCaptionAboveMedia added in v0.16.0

func (call *SendAnimationCall) ShowCaptionAboveMedia(showCaptionAboveMedia bool) *SendAnimationCall

ShowCaptionAboveMedia sets the show_caption_above_media parameter.

func (*SendAnimationCall) SuggestedPostParameters added in v0.16.0

func (call *SendAnimationCall) SuggestedPostParameters(suggestedPostParameters SuggestedPostParameters) *SendAnimationCall

SuggestedPostParameters sets the suggested_post_parameters parameter.

func (*SendAnimationCall) Thumbnail added in v0.8.0

func (call *SendAnimationCall) Thumbnail(thumbnail InputFile) *SendAnimationCall

Thumbnail sets the thumbnail parameter.

func (*SendAnimationCall) Width

func (call *SendAnimationCall) Width(width int) *SendAnimationCall

Width sets the width parameter.

type SendAudioCall

type SendAudioCall struct {
	Call[Message]
}

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

func NewSendAudioCall

func NewSendAudioCall(chatID PeerID, audio FileArg) *SendAudioCall

NewSendAudioCall constructs a new SendAudioCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • audio: Audio file to send. Pass a file_id as String to send an audio file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files »

func (*SendAudioCall) AllowPaidBroadcast added in v0.16.0

func (call *SendAudioCall) AllowPaidBroadcast(allowPaidBroadcast bool) *SendAudioCall

AllowPaidBroadcast sets the allow_paid_broadcast parameter.

func (*SendAudioCall) Audio

func (call *SendAudioCall) Audio(audio FileArg) *SendAudioCall

Audio sets the audio parameter.

func (*SendAudioCall) BusinessConnectionID added in v0.15.0

func (call *SendAudioCall) BusinessConnectionID(businessConnectionID string) *SendAudioCall

BusinessConnectionID sets the business_connection_id parameter.

func (*SendAudioCall) Caption

func (call *SendAudioCall) Caption(caption string) *SendAudioCall

Caption sets the caption parameter.

func (*SendAudioCall) CaptionEntities

func (call *SendAudioCall) CaptionEntities(captionEntities []MessageEntity) *SendAudioCall

CaptionEntities sets the caption_entities parameter.

func (*SendAudioCall) ChatID added in v0.0.5

func (call *SendAudioCall) ChatID(chatID PeerID) *SendAudioCall

ChatID sets the chat_id parameter.

func (*SendAudioCall) DirectMessagesTopicID added in v0.16.0

func (call *SendAudioCall) DirectMessagesTopicID(directMessagesTopicID int) *SendAudioCall

DirectMessagesTopicID sets the direct_messages_topic_id parameter.

func (*SendAudioCall) DisableNotification

func (call *SendAudioCall) DisableNotification(disableNotification bool) *SendAudioCall

DisableNotification sets the disable_notification parameter.

func (*SendAudioCall) Duration

func (call *SendAudioCall) Duration(duration int) *SendAudioCall

Duration sets the duration parameter.

func (*SendAudioCall) MessageEffectID added in v0.16.0

func (call *SendAudioCall) MessageEffectID(messageEffectID string) *SendAudioCall

MessageEffectID sets the message_effect_id parameter.

func (*SendAudioCall) MessageThreadID added in v0.6.0

func (call *SendAudioCall) MessageThreadID(messageThreadID int) *SendAudioCall

MessageThreadID sets the message_thread_id parameter.

func (*SendAudioCall) ParseMode

func (call *SendAudioCall) ParseMode(parseMode ParseMode) *SendAudioCall

ParseMode sets the parse_mode parameter.

func (*SendAudioCall) Performer

func (call *SendAudioCall) Performer(performer string) *SendAudioCall

Performer sets the performer parameter.

func (*SendAudioCall) ProtectContent

func (call *SendAudioCall) ProtectContent(protectContent bool) *SendAudioCall

ProtectContent sets the protect_content parameter.

func (*SendAudioCall) ReplyMarkup

func (call *SendAudioCall) ReplyMarkup(replyMarkup ReplyMarkup) *SendAudioCall

ReplyMarkup sets the reply_markup parameter.

func (*SendAudioCall) ReplyParameters added in v0.12.0

func (call *SendAudioCall) ReplyParameters(replyParameters ReplyParameters) *SendAudioCall

ReplyParameters sets the reply_parameters parameter.

func (*SendAudioCall) SuggestedPostParameters added in v0.16.0

func (call *SendAudioCall) SuggestedPostParameters(suggestedPostParameters SuggestedPostParameters) *SendAudioCall

SuggestedPostParameters sets the suggested_post_parameters parameter.

func (*SendAudioCall) Thumbnail added in v0.8.0

func (call *SendAudioCall) Thumbnail(thumbnail InputFile) *SendAudioCall

Thumbnail sets the thumbnail parameter.

func (*SendAudioCall) Title

func (call *SendAudioCall) Title(title string) *SendAudioCall

Title sets the title parameter.

type SendChatActionCall

type SendChatActionCall struct {
	CallNoResult
}

SendChatActionCall represents a call to the sendChatAction method. Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns True on success. Example: The ImageBot needs some time to process a request and upload the image. Instead of sending a text message along the lines of “Retrieving image, please wait…”, the bot may use Client.SendChatAction with action = upload_photo. The user will see a “sending photo” status for the bot. We only recommend using this method when a response from the bot will take a noticeable amount of time to arrive.

func NewSendChatActionCall

func NewSendChatActionCall(chatID PeerID, action ChatAction) *SendChatActionCall

NewSendChatActionCall constructs a new SendChatActionCall.

Required params:

func (*SendChatActionCall) Action

func (call *SendChatActionCall) Action(action ChatAction) *SendChatActionCall

Action sets the action parameter.

func (*SendChatActionCall) BusinessConnectionID added in v0.15.0

func (call *SendChatActionCall) BusinessConnectionID(businessConnectionID string) *SendChatActionCall

BusinessConnectionID sets the business_connection_id parameter.

func (*SendChatActionCall) ChatID added in v0.0.5

func (call *SendChatActionCall) ChatID(chatID PeerID) *SendChatActionCall

ChatID sets the chat_id parameter.

func (*SendChatActionCall) MessageThreadID added in v0.6.0

func (call *SendChatActionCall) MessageThreadID(messageThreadID int) *SendChatActionCall

MessageThreadID sets the message_thread_id parameter.

type SendChecklistCall added in v0.16.0

type SendChecklistCall struct {
	Call[Message]
}

SendChecklistCall represents a call to the sendChecklist method. Use this method to send a checklist on behalf of a connected business account. On success, the sent Message is returned.

func NewSendChecklistCall added in v0.16.0

func NewSendChecklistCall(businessConnectionID string, chatID int, checklist InputChecklist) *SendChecklistCall

NewSendChecklistCall constructs a new SendChecklistCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection on behalf of which the message will be sent
  • chatID: Unique identifier for the target chat
  • checklist: A JSON-serialized object for the checklist to send

func (*SendChecklistCall) BusinessConnectionID added in v0.16.0

func (call *SendChecklistCall) BusinessConnectionID(businessConnectionID string) *SendChecklistCall

BusinessConnectionID sets the business_connection_id parameter.

func (*SendChecklistCall) ChatID added in v0.16.0

func (call *SendChecklistCall) ChatID(chatID int) *SendChecklistCall

ChatID sets the chat_id parameter.

func (*SendChecklistCall) Checklist added in v0.16.0

func (call *SendChecklistCall) Checklist(checklist InputChecklist) *SendChecklistCall

Checklist sets the checklist parameter.

func (*SendChecklistCall) DisableNotification added in v0.16.0

func (call *SendChecklistCall) DisableNotification(disableNotification bool) *SendChecklistCall

DisableNotification sets the disable_notification parameter.

func (*SendChecklistCall) MessageEffectID added in v0.16.0

func (call *SendChecklistCall) MessageEffectID(messageEffectID string) *SendChecklistCall

MessageEffectID sets the message_effect_id parameter.

func (*SendChecklistCall) ProtectContent added in v0.16.0

func (call *SendChecklistCall) ProtectContent(protectContent bool) *SendChecklistCall

ProtectContent sets the protect_content parameter.

func (*SendChecklistCall) ReplyMarkup added in v0.16.0

func (call *SendChecklistCall) ReplyMarkup(replyMarkup InlineKeyboardMarkup) *SendChecklistCall

ReplyMarkup sets the reply_markup parameter.

func (*SendChecklistCall) ReplyParameters added in v0.16.0

func (call *SendChecklistCall) ReplyParameters(replyParameters ReplyParameters) *SendChecklistCall

ReplyParameters sets the reply_parameters parameter.

type SendContactCall

type SendContactCall struct {
	Call[Message]
}

SendContactCall represents a call to the sendContact method. Use this method to send phone contacts. On success, the sent Message is returned.

func NewSendContactCall

func NewSendContactCall(chatID PeerID, phoneNumber string, firstName string) *SendContactCall

NewSendContactCall constructs a new SendContactCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • phoneNumber: Contact's phone number
  • firstName: Contact's first name

func (*SendContactCall) AllowPaidBroadcast added in v0.16.0

func (call *SendContactCall) AllowPaidBroadcast(allowPaidBroadcast bool) *SendContactCall

AllowPaidBroadcast sets the allow_paid_broadcast parameter.

func (*SendContactCall) BusinessConnectionID added in v0.15.0

func (call *SendContactCall) BusinessConnectionID(businessConnectionID string) *SendContactCall

BusinessConnectionID sets the business_connection_id parameter.

func (*SendContactCall) ChatID added in v0.0.5

func (call *SendContactCall) ChatID(chatID PeerID) *SendContactCall

ChatID sets the chat_id parameter.

func (*SendContactCall) DirectMessagesTopicID added in v0.16.0

func (call *SendContactCall) DirectMessagesTopicID(directMessagesTopicID int) *SendContactCall

DirectMessagesTopicID sets the direct_messages_topic_id parameter.

func (*SendContactCall) DisableNotification

func (call *SendContactCall) DisableNotification(disableNotification bool) *SendContactCall

DisableNotification sets the disable_notification parameter.

func (*SendContactCall) FirstName

func (call *SendContactCall) FirstName(firstName string) *SendContactCall

FirstName sets the first_name parameter.

func (*SendContactCall) LastName

func (call *SendContactCall) LastName(lastName string) *SendContactCall

LastName sets the last_name parameter.

func (*SendContactCall) MessageEffectID added in v0.16.0

func (call *SendContactCall) MessageEffectID(messageEffectID string) *SendContactCall

MessageEffectID sets the message_effect_id parameter.

func (*SendContactCall) MessageThreadID added in v0.6.0

func (call *SendContactCall) MessageThreadID(messageThreadID int) *SendContactCall

MessageThreadID sets the message_thread_id parameter.

func (*SendContactCall) PhoneNumber

func (call *SendContactCall) PhoneNumber(phoneNumber string) *SendContactCall

PhoneNumber sets the phone_number parameter.

func (*SendContactCall) ProtectContent

func (call *SendContactCall) ProtectContent(protectContent bool) *SendContactCall

ProtectContent sets the protect_content parameter.

func (*SendContactCall) ReplyMarkup

func (call *SendContactCall) ReplyMarkup(replyMarkup ReplyMarkup) *SendContactCall

ReplyMarkup sets the reply_markup parameter.

func (*SendContactCall) ReplyParameters added in v0.12.0

func (call *SendContactCall) ReplyParameters(replyParameters ReplyParameters) *SendContactCall

ReplyParameters sets the reply_parameters parameter.

func (*SendContactCall) SuggestedPostParameters added in v0.16.0

func (call *SendContactCall) SuggestedPostParameters(suggestedPostParameters SuggestedPostParameters) *SendContactCall

SuggestedPostParameters sets the suggested_post_parameters parameter.

func (*SendContactCall) Vcard

func (call *SendContactCall) Vcard(vcard string) *SendContactCall

Vcard sets the vcard parameter.

type SendDiceCall

type SendDiceCall struct {
	Call[Message]
}

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

func NewSendDiceCall

func NewSendDiceCall(chatID PeerID) *SendDiceCall

NewSendDiceCall constructs a new SendDiceCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*SendDiceCall) AllowPaidBroadcast added in v0.16.0

func (call *SendDiceCall) AllowPaidBroadcast(allowPaidBroadcast bool) *SendDiceCall

AllowPaidBroadcast sets the allow_paid_broadcast parameter.

func (*SendDiceCall) BusinessConnectionID added in v0.15.0

func (call *SendDiceCall) BusinessConnectionID(businessConnectionID string) *SendDiceCall

BusinessConnectionID sets the business_connection_id parameter.

func (*SendDiceCall) ChatID added in v0.0.5

func (call *SendDiceCall) ChatID(chatID PeerID) *SendDiceCall

ChatID sets the chat_id parameter.

func (*SendDiceCall) DirectMessagesTopicID added in v0.16.0

func (call *SendDiceCall) DirectMessagesTopicID(directMessagesTopicID int) *SendDiceCall

DirectMessagesTopicID sets the direct_messages_topic_id parameter.

func (*SendDiceCall) DisableNotification

func (call *SendDiceCall) DisableNotification(disableNotification bool) *SendDiceCall

DisableNotification sets the disable_notification parameter.

func (*SendDiceCall) Emoji

func (call *SendDiceCall) Emoji(emoji DiceEmoji) *SendDiceCall

Emoji sets the emoji parameter.

func (*SendDiceCall) MessageEffectID added in v0.16.0

func (call *SendDiceCall) MessageEffectID(messageEffectID string) *SendDiceCall

MessageEffectID sets the message_effect_id parameter.

func (*SendDiceCall) MessageThreadID added in v0.6.0

func (call *SendDiceCall) MessageThreadID(messageThreadID int) *SendDiceCall

MessageThreadID sets the message_thread_id parameter.

func (*SendDiceCall) ProtectContent

func (call *SendDiceCall) ProtectContent(protectContent bool) *SendDiceCall

ProtectContent sets the protect_content parameter.

func (*SendDiceCall) ReplyMarkup

func (call *SendDiceCall) ReplyMarkup(replyMarkup ReplyMarkup) *SendDiceCall

ReplyMarkup sets the reply_markup parameter.

func (*SendDiceCall) ReplyParameters added in v0.12.0

func (call *SendDiceCall) ReplyParameters(replyParameters ReplyParameters) *SendDiceCall

ReplyParameters sets the reply_parameters parameter.

func (*SendDiceCall) SuggestedPostParameters added in v0.16.0

func (call *SendDiceCall) SuggestedPostParameters(suggestedPostParameters SuggestedPostParameters) *SendDiceCall

SuggestedPostParameters sets the suggested_post_parameters parameter.

type SendDocumentCall

type SendDocumentCall struct {
	Call[Message]
}

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

func NewSendDocumentCall

func NewSendDocumentCall(chatID PeerID, document FileArg) *SendDocumentCall

NewSendDocumentCall constructs a new SendDocumentCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • document: File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files »

func (*SendDocumentCall) AllowPaidBroadcast added in v0.16.0

func (call *SendDocumentCall) AllowPaidBroadcast(allowPaidBroadcast bool) *SendDocumentCall

AllowPaidBroadcast sets the allow_paid_broadcast parameter.

func (*SendDocumentCall) BusinessConnectionID added in v0.15.0

func (call *SendDocumentCall) BusinessConnectionID(businessConnectionID string) *SendDocumentCall

BusinessConnectionID sets the business_connection_id parameter.

func (*SendDocumentCall) Caption

func (call *SendDocumentCall) Caption(caption string) *SendDocumentCall

Caption sets the caption parameter.

func (*SendDocumentCall) CaptionEntities

func (call *SendDocumentCall) CaptionEntities(captionEntities []MessageEntity) *SendDocumentCall

CaptionEntities sets the caption_entities parameter.

func (*SendDocumentCall) ChatID added in v0.0.5

func (call *SendDocumentCall) ChatID(chatID PeerID) *SendDocumentCall

ChatID sets the chat_id parameter.

func (*SendDocumentCall) DirectMessagesTopicID added in v0.16.0

func (call *SendDocumentCall) DirectMessagesTopicID(directMessagesTopicID int) *SendDocumentCall

DirectMessagesTopicID sets the direct_messages_topic_id parameter.

func (*SendDocumentCall) DisableContentTypeDetection

func (call *SendDocumentCall) DisableContentTypeDetection(disableContentTypeDetection bool) *SendDocumentCall

DisableContentTypeDetection sets the disable_content_type_detection parameter.

func (*SendDocumentCall) DisableNotification

func (call *SendDocumentCall) DisableNotification(disableNotification bool) *SendDocumentCall

DisableNotification sets the disable_notification parameter.

func (*SendDocumentCall) Document

func (call *SendDocumentCall) Document(document FileArg) *SendDocumentCall

Document sets the document parameter.

func (*SendDocumentCall) MessageEffectID added in v0.16.0

func (call *SendDocumentCall) MessageEffectID(messageEffectID string) *SendDocumentCall

MessageEffectID sets the message_effect_id parameter.

func (*SendDocumentCall) MessageThreadID added in v0.6.0

func (call *SendDocumentCall) MessageThreadID(messageThreadID int) *SendDocumentCall

MessageThreadID sets the message_thread_id parameter.

func (*SendDocumentCall) ParseMode

func (call *SendDocumentCall) ParseMode(parseMode ParseMode) *SendDocumentCall

ParseMode sets the parse_mode parameter.

func (*SendDocumentCall) ProtectContent

func (call *SendDocumentCall) ProtectContent(protectContent bool) *SendDocumentCall

ProtectContent sets the protect_content parameter.

func (*SendDocumentCall) ReplyMarkup

func (call *SendDocumentCall) ReplyMarkup(replyMarkup ReplyMarkup) *SendDocumentCall

ReplyMarkup sets the reply_markup parameter.

func (*SendDocumentCall) ReplyParameters added in v0.12.0

func (call *SendDocumentCall) ReplyParameters(replyParameters ReplyParameters) *SendDocumentCall

ReplyParameters sets the reply_parameters parameter.

func (*SendDocumentCall) SuggestedPostParameters added in v0.16.0

func (call *SendDocumentCall) SuggestedPostParameters(suggestedPostParameters SuggestedPostParameters) *SendDocumentCall

SuggestedPostParameters sets the suggested_post_parameters parameter.

func (*SendDocumentCall) Thumbnail added in v0.8.0

func (call *SendDocumentCall) Thumbnail(thumbnail InputFile) *SendDocumentCall

Thumbnail sets the thumbnail parameter.

type SendGameCall

type SendGameCall struct {
	Call[Message]
}

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

func NewSendGameCall

func NewSendGameCall(chatID int, gameShortName string) *SendGameCall

NewSendGameCall constructs a new SendGameCall.

Required params:

  • chatID: Unique identifier for the target chat. Games can't be sent to channel direct messages chats and channel chats.
  • gameShortName: Short name of the game, serves as the unique identifier for the game. Set up your games via @BotFather.

func (*SendGameCall) AllowPaidBroadcast added in v0.16.0

func (call *SendGameCall) AllowPaidBroadcast(allowPaidBroadcast bool) *SendGameCall

AllowPaidBroadcast sets the allow_paid_broadcast parameter.

func (*SendGameCall) BusinessConnectionID added in v0.15.0

func (call *SendGameCall) BusinessConnectionID(businessConnectionID string) *SendGameCall

BusinessConnectionID sets the business_connection_id parameter.

func (*SendGameCall) ChatID added in v0.0.5

func (call *SendGameCall) ChatID(chatID int) *SendGameCall

ChatID sets the chat_id parameter.

func (*SendGameCall) DisableNotification

func (call *SendGameCall) DisableNotification(disableNotification bool) *SendGameCall

DisableNotification sets the disable_notification parameter.

func (*SendGameCall) GameShortName

func (call *SendGameCall) GameShortName(gameShortName string) *SendGameCall

GameShortName sets the game_short_name parameter.

func (*SendGameCall) MessageEffectID added in v0.16.0

func (call *SendGameCall) MessageEffectID(messageEffectID string) *SendGameCall

MessageEffectID sets the message_effect_id parameter.

func (*SendGameCall) MessageThreadID added in v0.6.0

func (call *SendGameCall) MessageThreadID(messageThreadID int) *SendGameCall

MessageThreadID sets the message_thread_id parameter.

func (*SendGameCall) ProtectContent

func (call *SendGameCall) ProtectContent(protectContent bool) *SendGameCall

ProtectContent sets the protect_content parameter.

func (*SendGameCall) ReplyMarkup

func (call *SendGameCall) ReplyMarkup(replyMarkup InlineKeyboardMarkup) *SendGameCall

ReplyMarkup sets the reply_markup parameter.

func (*SendGameCall) ReplyParameters added in v0.12.0

func (call *SendGameCall) ReplyParameters(replyParameters ReplyParameters) *SendGameCall

ReplyParameters sets the reply_parameters parameter.

type SendGiftCall added in v0.16.0

type SendGiftCall struct {
	CallNoResult
}

SendGiftCall represents a call to the sendGift method. Sends a gift to the given user or channel chat. The gift can't be converted to Telegram Stars by the receiver. Returns True on success.

func NewSendGiftCall added in v0.16.0

func NewSendGiftCall(giftID string) *SendGiftCall

NewSendGiftCall constructs a new SendGiftCall.

Required params:

  • giftID: Identifier of the gift; limited gifts can't be sent to channel chats

func (*SendGiftCall) ChatID added in v0.16.0

func (call *SendGiftCall) ChatID(chatID PeerID) *SendGiftCall

ChatID sets the chat_id parameter.

func (*SendGiftCall) GiftID added in v0.16.0

func (call *SendGiftCall) GiftID(giftID string) *SendGiftCall

GiftID sets the gift_id parameter.

func (*SendGiftCall) PayForUpgrade added in v0.16.0

func (call *SendGiftCall) PayForUpgrade(payForUpgrade bool) *SendGiftCall

PayForUpgrade sets the pay_for_upgrade parameter.

func (*SendGiftCall) Text added in v0.16.0

func (call *SendGiftCall) Text(text string) *SendGiftCall

Text sets the text parameter.

func (*SendGiftCall) TextEntities added in v0.16.0

func (call *SendGiftCall) TextEntities(textEntities []MessageEntity) *SendGiftCall

TextEntities sets the text_entities parameter.

func (*SendGiftCall) TextParseMode added in v0.16.0

func (call *SendGiftCall) TextParseMode(textParseMode string) *SendGiftCall

TextParseMode sets the text_parse_mode parameter.

func (*SendGiftCall) UserID added in v0.16.0

func (call *SendGiftCall) UserID(userID UserID) *SendGiftCall

UserID sets the user_id parameter.

type SendInvoiceCall

type SendInvoiceCall struct {
	Call[Message]
}

SendInvoiceCall represents a call to the sendInvoice method. Use this method to send invoices. On success, the sent Message is returned.

func NewSendInvoiceCall

func NewSendInvoiceCall(chatID PeerID, title string, description string, payload string, currency string, prices []LabeledPrice) *SendInvoiceCall

NewSendInvoiceCall constructs a new SendInvoiceCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • title: Product name, 1-32 characters
  • description: Product description, 1-255 characters
  • payload: Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes.
  • currency: Three-letter ISO 4217 currency code, see more on currencies. Pass “XTR” for payments in Telegram Stars.
  • prices: Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars.

func (*SendInvoiceCall) AllowPaidBroadcast added in v0.16.0

func (call *SendInvoiceCall) AllowPaidBroadcast(allowPaidBroadcast bool) *SendInvoiceCall

AllowPaidBroadcast sets the allow_paid_broadcast parameter.

func (*SendInvoiceCall) ChatID added in v0.0.5

func (call *SendInvoiceCall) ChatID(chatID PeerID) *SendInvoiceCall

ChatID sets the chat_id parameter.

func (*SendInvoiceCall) Currency

func (call *SendInvoiceCall) Currency(currency string) *SendInvoiceCall

Currency sets the currency parameter.

func (*SendInvoiceCall) Description

func (call *SendInvoiceCall) Description(description string) *SendInvoiceCall

Description sets the description parameter.

func (*SendInvoiceCall) DirectMessagesTopicID added in v0.16.0

func (call *SendInvoiceCall) DirectMessagesTopicID(directMessagesTopicID int) *SendInvoiceCall

DirectMessagesTopicID sets the direct_messages_topic_id parameter.

func (*SendInvoiceCall) DisableNotification

func (call *SendInvoiceCall) DisableNotification(disableNotification bool) *SendInvoiceCall

DisableNotification sets the disable_notification parameter.

func (*SendInvoiceCall) IsFlexible

func (call *SendInvoiceCall) IsFlexible(isFlexible bool) *SendInvoiceCall

IsFlexible sets the is_flexible parameter.

func (*SendInvoiceCall) MaxTipAmount

func (call *SendInvoiceCall) MaxTipAmount(maxTipAmount int) *SendInvoiceCall

MaxTipAmount sets the max_tip_amount parameter.

func (*SendInvoiceCall) MessageEffectID added in v0.16.0

func (call *SendInvoiceCall) MessageEffectID(messageEffectID string) *SendInvoiceCall

MessageEffectID sets the message_effect_id parameter.

func (*SendInvoiceCall) MessageThreadID added in v0.6.0

func (call *SendInvoiceCall) MessageThreadID(messageThreadID int) *SendInvoiceCall

MessageThreadID sets the message_thread_id parameter.

func (*SendInvoiceCall) NeedEmail

func (call *SendInvoiceCall) NeedEmail(needEmail bool) *SendInvoiceCall

NeedEmail sets the need_email parameter.

func (*SendInvoiceCall) NeedName

func (call *SendInvoiceCall) NeedName(needName bool) *SendInvoiceCall

NeedName sets the need_name parameter.

func (*SendInvoiceCall) NeedPhoneNumber

func (call *SendInvoiceCall) NeedPhoneNumber(needPhoneNumber bool) *SendInvoiceCall

NeedPhoneNumber sets the need_phone_number parameter.

func (*SendInvoiceCall) NeedShippingAddress

func (call *SendInvoiceCall) NeedShippingAddress(needShippingAddress bool) *SendInvoiceCall

NeedShippingAddress sets the need_shipping_address parameter.

func (*SendInvoiceCall) Payload

func (call *SendInvoiceCall) Payload(payload string) *SendInvoiceCall

Payload sets the payload parameter.

func (*SendInvoiceCall) PhotoHeight

func (call *SendInvoiceCall) PhotoHeight(photoHeight int) *SendInvoiceCall

PhotoHeight sets the photo_height parameter.

func (*SendInvoiceCall) PhotoSize

func (call *SendInvoiceCall) PhotoSize(photoSize int) *SendInvoiceCall

PhotoSize sets the photo_size parameter.

func (*SendInvoiceCall) PhotoURL added in v0.0.5

func (call *SendInvoiceCall) PhotoURL(photoURL string) *SendInvoiceCall

PhotoURL sets the photo_url parameter.

func (*SendInvoiceCall) PhotoWidth

func (call *SendInvoiceCall) PhotoWidth(photoWidth int) *SendInvoiceCall

PhotoWidth sets the photo_width parameter.

func (*SendInvoiceCall) Prices

func (call *SendInvoiceCall) Prices(prices []LabeledPrice) *SendInvoiceCall

Prices sets the prices parameter.

func (*SendInvoiceCall) ProtectContent

func (call *SendInvoiceCall) ProtectContent(protectContent bool) *SendInvoiceCall

ProtectContent sets the protect_content parameter.

func (*SendInvoiceCall) ProviderData

func (call *SendInvoiceCall) ProviderData(providerData string) *SendInvoiceCall

ProviderData sets the provider_data parameter.

func (*SendInvoiceCall) ProviderToken

func (call *SendInvoiceCall) ProviderToken(providerToken string) *SendInvoiceCall

ProviderToken sets the provider_token parameter.

func (*SendInvoiceCall) ReplyMarkup

func (call *SendInvoiceCall) ReplyMarkup(replyMarkup InlineKeyboardMarkup) *SendInvoiceCall

ReplyMarkup sets the reply_markup parameter.

func (*SendInvoiceCall) ReplyParameters added in v0.12.0

func (call *SendInvoiceCall) ReplyParameters(replyParameters ReplyParameters) *SendInvoiceCall

ReplyParameters sets the reply_parameters parameter.

func (*SendInvoiceCall) SendEmailToProvider

func (call *SendInvoiceCall) SendEmailToProvider(sendEmailToProvider bool) *SendInvoiceCall

SendEmailToProvider sets the send_email_to_provider parameter.

func (*SendInvoiceCall) SendPhoneNumberToProvider

func (call *SendInvoiceCall) SendPhoneNumberToProvider(sendPhoneNumberToProvider bool) *SendInvoiceCall

SendPhoneNumberToProvider sets the send_phone_number_to_provider parameter.

func (*SendInvoiceCall) StartParameter

func (call *SendInvoiceCall) StartParameter(startParameter string) *SendInvoiceCall

StartParameter sets the start_parameter parameter.

func (*SendInvoiceCall) SuggestedPostParameters added in v0.16.0

func (call *SendInvoiceCall) SuggestedPostParameters(suggestedPostParameters SuggestedPostParameters) *SendInvoiceCall

SuggestedPostParameters sets the suggested_post_parameters parameter.

func (*SendInvoiceCall) SuggestedTipAmounts

func (call *SendInvoiceCall) SuggestedTipAmounts(suggestedTipAmounts []int) *SendInvoiceCall

SuggestedTipAmounts sets the suggested_tip_amounts parameter.

func (*SendInvoiceCall) Title

func (call *SendInvoiceCall) Title(title string) *SendInvoiceCall

Title sets the title parameter.

type SendLocationCall

type SendLocationCall struct {
	Call[Message]
}

SendLocationCall represents a call to the sendLocation method. Use this method to send point on the map. On success, the sent Message is returned.

func NewSendLocationCall

func NewSendLocationCall(chatID PeerID, latitude float64, longitude float64) *SendLocationCall

NewSendLocationCall constructs a new SendLocationCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • latitude: Latitude of the location
  • longitude: Longitude of the location

func (*SendLocationCall) AllowPaidBroadcast added in v0.16.0

func (call *SendLocationCall) AllowPaidBroadcast(allowPaidBroadcast bool) *SendLocationCall

AllowPaidBroadcast sets the allow_paid_broadcast parameter.

func (*SendLocationCall) BusinessConnectionID added in v0.15.0

func (call *SendLocationCall) BusinessConnectionID(businessConnectionID string) *SendLocationCall

BusinessConnectionID sets the business_connection_id parameter.

func (*SendLocationCall) ChatID added in v0.0.5

func (call *SendLocationCall) ChatID(chatID PeerID) *SendLocationCall

ChatID sets the chat_id parameter.

func (*SendLocationCall) DirectMessagesTopicID added in v0.16.0

func (call *SendLocationCall) DirectMessagesTopicID(directMessagesTopicID int) *SendLocationCall

DirectMessagesTopicID sets the direct_messages_topic_id parameter.

func (*SendLocationCall) DisableNotification

func (call *SendLocationCall) DisableNotification(disableNotification bool) *SendLocationCall

DisableNotification sets the disable_notification parameter.

func (*SendLocationCall) Heading

func (call *SendLocationCall) Heading(heading int) *SendLocationCall

Heading sets the heading parameter.

func (*SendLocationCall) HorizontalAccuracy

func (call *SendLocationCall) HorizontalAccuracy(horizontalAccuracy float64) *SendLocationCall

HorizontalAccuracy sets the horizontal_accuracy parameter.

func (*SendLocationCall) Latitude

func (call *SendLocationCall) Latitude(latitude float64) *SendLocationCall

Latitude sets the latitude parameter.

func (*SendLocationCall) LivePeriod

func (call *SendLocationCall) LivePeriod(livePeriod int) *SendLocationCall

LivePeriod sets the live_period parameter.

func (*SendLocationCall) Longitude

func (call *SendLocationCall) Longitude(longitude float64) *SendLocationCall

Longitude sets the longitude parameter.

func (*SendLocationCall) MessageEffectID added in v0.16.0

func (call *SendLocationCall) MessageEffectID(messageEffectID string) *SendLocationCall

MessageEffectID sets the message_effect_id parameter.

func (*SendLocationCall) MessageThreadID added in v0.6.0

func (call *SendLocationCall) MessageThreadID(messageThreadID int) *SendLocationCall

MessageThreadID sets the message_thread_id parameter.

func (*SendLocationCall) ProtectContent

func (call *SendLocationCall) ProtectContent(protectContent bool) *SendLocationCall

ProtectContent sets the protect_content parameter.

func (*SendLocationCall) ProximityAlertRadius

func (call *SendLocationCall) ProximityAlertRadius(proximityAlertRadius int) *SendLocationCall

ProximityAlertRadius sets the proximity_alert_radius parameter.

func (*SendLocationCall) ReplyMarkup

func (call *SendLocationCall) ReplyMarkup(replyMarkup ReplyMarkup) *SendLocationCall

ReplyMarkup sets the reply_markup parameter.

func (*SendLocationCall) ReplyParameters added in v0.12.0

func (call *SendLocationCall) ReplyParameters(replyParameters ReplyParameters) *SendLocationCall

ReplyParameters sets the reply_parameters parameter.

func (*SendLocationCall) SuggestedPostParameters added in v0.16.0

func (call *SendLocationCall) SuggestedPostParameters(suggestedPostParameters SuggestedPostParameters) *SendLocationCall

SuggestedPostParameters sets the suggested_post_parameters parameter.

type SendMediaGroupCall added in v0.0.5

type SendMediaGroupCall struct {
	Call[[]Message]
}

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

func NewSendMediaGroupCall added in v0.0.5

func NewSendMediaGroupCall(chatID PeerID, media []InputMedia) *SendMediaGroupCall

NewSendMediaGroupCall constructs a new SendMediaGroupCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • media: A JSON-serialized array describing messages to be sent, must include 2-10 items

func (*SendMediaGroupCall) AllowPaidBroadcast added in v0.16.0

func (call *SendMediaGroupCall) AllowPaidBroadcast(allowPaidBroadcast bool) *SendMediaGroupCall

AllowPaidBroadcast sets the allow_paid_broadcast parameter.

func (*SendMediaGroupCall) BusinessConnectionID added in v0.15.0

func (call *SendMediaGroupCall) BusinessConnectionID(businessConnectionID string) *SendMediaGroupCall

BusinessConnectionID sets the business_connection_id parameter.

func (*SendMediaGroupCall) ChatID added in v0.0.5

func (call *SendMediaGroupCall) ChatID(chatID PeerID) *SendMediaGroupCall

ChatID sets the chat_id parameter.

func (*SendMediaGroupCall) DirectMessagesTopicID added in v0.16.0

func (call *SendMediaGroupCall) DirectMessagesTopicID(directMessagesTopicID int) *SendMediaGroupCall

DirectMessagesTopicID sets the direct_messages_topic_id parameter.

func (*SendMediaGroupCall) DisableNotification added in v0.0.5

func (call *SendMediaGroupCall) DisableNotification(disableNotification bool) *SendMediaGroupCall

DisableNotification sets the disable_notification parameter.

func (*SendMediaGroupCall) Media added in v0.0.5

func (call *SendMediaGroupCall) Media(media []InputMedia) *SendMediaGroupCall

Media sets the media parameter.

func (*SendMediaGroupCall) MessageEffectID added in v0.16.0

func (call *SendMediaGroupCall) MessageEffectID(messageEffectID string) *SendMediaGroupCall

MessageEffectID sets the message_effect_id parameter.

func (*SendMediaGroupCall) MessageThreadID added in v0.6.0

func (call *SendMediaGroupCall) MessageThreadID(messageThreadID int) *SendMediaGroupCall

MessageThreadID sets the message_thread_id parameter.

func (*SendMediaGroupCall) ProtectContent added in v0.0.5

func (call *SendMediaGroupCall) ProtectContent(protectContent bool) *SendMediaGroupCall

ProtectContent sets the protect_content parameter.

func (*SendMediaGroupCall) ReplyParameters added in v0.12.0

func (call *SendMediaGroupCall) ReplyParameters(replyParameters ReplyParameters) *SendMediaGroupCall

ReplyParameters sets the reply_parameters parameter.

type SendMessageCall

type SendMessageCall struct {
	Call[Message]
}

SendMessageCall represents a call to the sendMessage method. Use this method to send text messages. On success, the sent Message is returned.

func NewSendMessageCall

func NewSendMessageCall(chatID PeerID, text string) *SendMessageCall

NewSendMessageCall constructs a new SendMessageCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • text: Text of the message to be sent, 1-4096 characters after entities parsing

func (*SendMessageCall) AllowPaidBroadcast added in v0.16.0

func (call *SendMessageCall) AllowPaidBroadcast(allowPaidBroadcast bool) *SendMessageCall

AllowPaidBroadcast sets the allow_paid_broadcast parameter.

func (*SendMessageCall) BusinessConnectionID added in v0.15.0

func (call *SendMessageCall) BusinessConnectionID(businessConnectionID string) *SendMessageCall

BusinessConnectionID sets the business_connection_id parameter.

func (*SendMessageCall) ChatID added in v0.0.5

func (call *SendMessageCall) ChatID(chatID PeerID) *SendMessageCall

ChatID sets the chat_id parameter.

func (*SendMessageCall) DirectMessagesTopicID added in v0.16.0

func (call *SendMessageCall) DirectMessagesTopicID(directMessagesTopicID int) *SendMessageCall

DirectMessagesTopicID sets the direct_messages_topic_id parameter.

func (*SendMessageCall) DisableNotification

func (call *SendMessageCall) DisableNotification(disableNotification bool) *SendMessageCall

DisableNotification sets the disable_notification parameter.

func (*SendMessageCall) Entities

func (call *SendMessageCall) Entities(entities []MessageEntity) *SendMessageCall

Entities sets the entities parameter.

func (*SendMessageCall) LinkPreviewOptions added in v0.12.0

func (call *SendMessageCall) LinkPreviewOptions(linkPreviewOptions LinkPreviewOptions) *SendMessageCall

LinkPreviewOptions sets the link_preview_options parameter.

func (*SendMessageCall) MessageEffectID added in v0.16.0

func (call *SendMessageCall) MessageEffectID(messageEffectID string) *SendMessageCall

MessageEffectID sets the message_effect_id parameter.

func (*SendMessageCall) MessageThreadID added in v0.6.0

func (call *SendMessageCall) MessageThreadID(messageThreadID int) *SendMessageCall

MessageThreadID sets the message_thread_id parameter.

func (*SendMessageCall) ParseMode

func (call *SendMessageCall) ParseMode(parseMode ParseMode) *SendMessageCall

ParseMode sets the parse_mode parameter.

func (*SendMessageCall) ProtectContent

func (call *SendMessageCall) ProtectContent(protectContent bool) *SendMessageCall

ProtectContent sets the protect_content parameter.

func (*SendMessageCall) ReplyMarkup

func (call *SendMessageCall) ReplyMarkup(replyMarkup ReplyMarkup) *SendMessageCall

ReplyMarkup sets the reply_markup parameter.

func (*SendMessageCall) ReplyParameters added in v0.12.0

func (call *SendMessageCall) ReplyParameters(replyParameters ReplyParameters) *SendMessageCall

ReplyParameters sets the reply_parameters parameter.

func (*SendMessageCall) SuggestedPostParameters added in v0.16.0

func (call *SendMessageCall) SuggestedPostParameters(suggestedPostParameters SuggestedPostParameters) *SendMessageCall

SuggestedPostParameters sets the suggested_post_parameters parameter.

func (*SendMessageCall) Text

func (call *SendMessageCall) Text(text string) *SendMessageCall

Text sets the text parameter.

type SendMessageDraftCall added in v0.16.0

type SendMessageDraftCall struct {
	CallNoResult
}

SendMessageDraftCall represents a call to the sendMessageDraft method. Use this method to stream a partial message to a user while the message is being generated; supported only for bots with forum topic mode enabled. Returns True on success.

func NewSendMessageDraftCall added in v0.16.0

func NewSendMessageDraftCall(chatID int, draftID int, text string) *SendMessageDraftCall

NewSendMessageDraftCall constructs a new SendMessageDraftCall.

Required params:

  • chatID: Unique identifier for the target private chat
  • draftID: Unique identifier of the message draft; must be non-zero. Changes of drafts with the same identifier are animated
  • text: Text of the message to be sent, 1-4096 characters after entities parsing

func (*SendMessageDraftCall) ChatID added in v0.16.0

func (call *SendMessageDraftCall) ChatID(chatID int) *SendMessageDraftCall

ChatID sets the chat_id parameter.

func (*SendMessageDraftCall) DraftID added in v0.16.0

func (call *SendMessageDraftCall) DraftID(draftID int) *SendMessageDraftCall

DraftID sets the draft_id parameter.

func (*SendMessageDraftCall) Entities added in v0.16.0

func (call *SendMessageDraftCall) Entities(entities []MessageEntity) *SendMessageDraftCall

Entities sets the entities parameter.

func (*SendMessageDraftCall) MessageThreadID added in v0.16.0

func (call *SendMessageDraftCall) MessageThreadID(messageThreadID int) *SendMessageDraftCall

MessageThreadID sets the message_thread_id parameter.

func (*SendMessageDraftCall) ParseMode added in v0.16.0

func (call *SendMessageDraftCall) ParseMode(parseMode ParseMode) *SendMessageDraftCall

ParseMode sets the parse_mode parameter.

func (*SendMessageDraftCall) Text added in v0.16.0

Text sets the text parameter.

type SendPaidMediaCall added in v0.16.0

type SendPaidMediaCall struct {
	Call[Message]
}

SendPaidMediaCall represents a call to the sendPaidMedia method. Use this method to send paid media. On success, the sent Message is returned.

func NewSendPaidMediaCall added in v0.16.0

func NewSendPaidMediaCall(chatID PeerID, starCount int, media []InputPaidMedia) *SendPaidMediaCall

NewSendPaidMediaCall constructs a new SendPaidMediaCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername). If the chat is a channel, all Telegram Star proceeds from this media will be credited to the chat's balance. Otherwise, they will be credited to the bot's balance.
  • starCount: The number of Telegram Stars that must be paid to buy access to the media; 1-25000
  • media: A JSON-serialized array describing the media to be sent; up to 10 items

func (*SendPaidMediaCall) AllowPaidBroadcast added in v0.16.0

func (call *SendPaidMediaCall) AllowPaidBroadcast(allowPaidBroadcast bool) *SendPaidMediaCall

AllowPaidBroadcast sets the allow_paid_broadcast parameter.

func (*SendPaidMediaCall) BusinessConnectionID added in v0.16.0

func (call *SendPaidMediaCall) BusinessConnectionID(businessConnectionID string) *SendPaidMediaCall

BusinessConnectionID sets the business_connection_id parameter.

func (*SendPaidMediaCall) Caption added in v0.16.0

func (call *SendPaidMediaCall) Caption(caption string) *SendPaidMediaCall

Caption sets the caption parameter.

func (*SendPaidMediaCall) CaptionEntities added in v0.16.0

func (call *SendPaidMediaCall) CaptionEntities(captionEntities []MessageEntity) *SendPaidMediaCall

CaptionEntities sets the caption_entities parameter.

func (*SendPaidMediaCall) ChatID added in v0.16.0

func (call *SendPaidMediaCall) ChatID(chatID PeerID) *SendPaidMediaCall

ChatID sets the chat_id parameter.

func (*SendPaidMediaCall) DirectMessagesTopicID added in v0.16.0

func (call *SendPaidMediaCall) DirectMessagesTopicID(directMessagesTopicID int) *SendPaidMediaCall

DirectMessagesTopicID sets the direct_messages_topic_id parameter.

func (*SendPaidMediaCall) DisableNotification added in v0.16.0

func (call *SendPaidMediaCall) DisableNotification(disableNotification bool) *SendPaidMediaCall

DisableNotification sets the disable_notification parameter.

func (*SendPaidMediaCall) Media added in v0.16.0

func (call *SendPaidMediaCall) Media(media []InputPaidMedia) *SendPaidMediaCall

Media sets the media parameter.

func (*SendPaidMediaCall) MessageThreadID added in v0.16.0

func (call *SendPaidMediaCall) MessageThreadID(messageThreadID int) *SendPaidMediaCall

MessageThreadID sets the message_thread_id parameter.

func (*SendPaidMediaCall) ParseMode added in v0.16.0

func (call *SendPaidMediaCall) ParseMode(parseMode ParseMode) *SendPaidMediaCall

ParseMode sets the parse_mode parameter.

func (*SendPaidMediaCall) Payload added in v0.16.0

func (call *SendPaidMediaCall) Payload(payload string) *SendPaidMediaCall

Payload sets the payload parameter.

func (*SendPaidMediaCall) ProtectContent added in v0.16.0

func (call *SendPaidMediaCall) ProtectContent(protectContent bool) *SendPaidMediaCall

ProtectContent sets the protect_content parameter.

func (*SendPaidMediaCall) ReplyMarkup added in v0.16.0

func (call *SendPaidMediaCall) ReplyMarkup(replyMarkup ReplyMarkup) *SendPaidMediaCall

ReplyMarkup sets the reply_markup parameter.

func (*SendPaidMediaCall) ReplyParameters added in v0.16.0

func (call *SendPaidMediaCall) ReplyParameters(replyParameters ReplyParameters) *SendPaidMediaCall

ReplyParameters sets the reply_parameters parameter.

func (*SendPaidMediaCall) ShowCaptionAboveMedia added in v0.16.0

func (call *SendPaidMediaCall) ShowCaptionAboveMedia(showCaptionAboveMedia bool) *SendPaidMediaCall

ShowCaptionAboveMedia sets the show_caption_above_media parameter.

func (*SendPaidMediaCall) StarCount added in v0.16.0

func (call *SendPaidMediaCall) StarCount(starCount int) *SendPaidMediaCall

StarCount sets the star_count parameter.

func (*SendPaidMediaCall) SuggestedPostParameters added in v0.16.0

func (call *SendPaidMediaCall) SuggestedPostParameters(suggestedPostParameters SuggestedPostParameters) *SendPaidMediaCall

SuggestedPostParameters sets the suggested_post_parameters parameter.

type SendPhotoCall

type SendPhotoCall struct {
	Call[Message]
}

SendPhotoCall represents a call to the sendPhoto method. Use this method to send photos. On success, the sent Message is returned.

func NewSendPhotoCall

func NewSendPhotoCall(chatID PeerID, photo FileArg) *SendPhotoCall

NewSendPhotoCall constructs a new SendPhotoCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • photo: Photo to send. Pass a file_id as String to send a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, or upload a new photo using multipart/form-data. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20. More information on Sending Files »

func (*SendPhotoCall) AllowPaidBroadcast added in v0.16.0

func (call *SendPhotoCall) AllowPaidBroadcast(allowPaidBroadcast bool) *SendPhotoCall

AllowPaidBroadcast sets the allow_paid_broadcast parameter.

func (*SendPhotoCall) BusinessConnectionID added in v0.15.0

func (call *SendPhotoCall) BusinessConnectionID(businessConnectionID string) *SendPhotoCall

BusinessConnectionID sets the business_connection_id parameter.

func (*SendPhotoCall) Caption

func (call *SendPhotoCall) Caption(caption string) *SendPhotoCall

Caption sets the caption parameter.

func (*SendPhotoCall) CaptionEntities

func (call *SendPhotoCall) CaptionEntities(captionEntities []MessageEntity) *SendPhotoCall

CaptionEntities sets the caption_entities parameter.

func (*SendPhotoCall) ChatID added in v0.0.5

func (call *SendPhotoCall) ChatID(chatID PeerID) *SendPhotoCall

ChatID sets the chat_id parameter.

func (*SendPhotoCall) DirectMessagesTopicID added in v0.16.0

func (call *SendPhotoCall) DirectMessagesTopicID(directMessagesTopicID int) *SendPhotoCall

DirectMessagesTopicID sets the direct_messages_topic_id parameter.

func (*SendPhotoCall) DisableNotification

func (call *SendPhotoCall) DisableNotification(disableNotification bool) *SendPhotoCall

DisableNotification sets the disable_notification parameter.

func (*SendPhotoCall) HasSpoiler added in v0.6.0

func (call *SendPhotoCall) HasSpoiler(hasSpoiler bool) *SendPhotoCall

HasSpoiler sets the has_spoiler parameter.

func (*SendPhotoCall) MessageEffectID added in v0.16.0

func (call *SendPhotoCall) MessageEffectID(messageEffectID string) *SendPhotoCall

MessageEffectID sets the message_effect_id parameter.

func (*SendPhotoCall) MessageThreadID added in v0.6.0

func (call *SendPhotoCall) MessageThreadID(messageThreadID int) *SendPhotoCall

MessageThreadID sets the message_thread_id parameter.

func (*SendPhotoCall) ParseMode

func (call *SendPhotoCall) ParseMode(parseMode ParseMode) *SendPhotoCall

ParseMode sets the parse_mode parameter.

func (*SendPhotoCall) Photo

func (call *SendPhotoCall) Photo(photo FileArg) *SendPhotoCall

Photo sets the photo parameter.

func (*SendPhotoCall) ProtectContent

func (call *SendPhotoCall) ProtectContent(protectContent bool) *SendPhotoCall

ProtectContent sets the protect_content parameter.

func (*SendPhotoCall) ReplyMarkup

func (call *SendPhotoCall) ReplyMarkup(replyMarkup ReplyMarkup) *SendPhotoCall

ReplyMarkup sets the reply_markup parameter.

func (*SendPhotoCall) ReplyParameters added in v0.12.0

func (call *SendPhotoCall) ReplyParameters(replyParameters ReplyParameters) *SendPhotoCall

ReplyParameters sets the reply_parameters parameter.

func (*SendPhotoCall) ShowCaptionAboveMedia added in v0.16.0

func (call *SendPhotoCall) ShowCaptionAboveMedia(showCaptionAboveMedia bool) *SendPhotoCall

ShowCaptionAboveMedia sets the show_caption_above_media parameter.

func (*SendPhotoCall) SuggestedPostParameters added in v0.16.0

func (call *SendPhotoCall) SuggestedPostParameters(suggestedPostParameters SuggestedPostParameters) *SendPhotoCall

SuggestedPostParameters sets the suggested_post_parameters parameter.

type SendPollCall

type SendPollCall struct {
	Call[Message]
}

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

func NewSendPollCall

func NewSendPollCall(chatID PeerID, question string, options []InputPollOption) *SendPollCall

NewSendPollCall constructs a new SendPollCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername). Polls can't be sent to channel direct messages chats.
  • question: Poll question, 1-300 characters
  • options: A JSON-serialized list of 2-12 answer options

func (*SendPollCall) AllowPaidBroadcast added in v0.16.0

func (call *SendPollCall) AllowPaidBroadcast(allowPaidBroadcast bool) *SendPollCall

AllowPaidBroadcast sets the allow_paid_broadcast parameter.

func (*SendPollCall) AllowsMultipleAnswers

func (call *SendPollCall) AllowsMultipleAnswers(allowsMultipleAnswers bool) *SendPollCall

AllowsMultipleAnswers sets the allows_multiple_answers parameter.

func (*SendPollCall) BusinessConnectionID added in v0.15.0

func (call *SendPollCall) BusinessConnectionID(businessConnectionID string) *SendPollCall

BusinessConnectionID sets the business_connection_id parameter.

func (*SendPollCall) ChatID added in v0.0.5

func (call *SendPollCall) ChatID(chatID PeerID) *SendPollCall

ChatID sets the chat_id parameter.

func (*SendPollCall) CloseDate

func (call *SendPollCall) CloseDate(closeDate int) *SendPollCall

CloseDate sets the close_date parameter.

func (*SendPollCall) CorrectOptionID added in v0.0.5

func (call *SendPollCall) CorrectOptionID(correctOptionID int) *SendPollCall

CorrectOptionID sets the correct_option_id parameter.

func (*SendPollCall) DisableNotification

func (call *SendPollCall) DisableNotification(disableNotification bool) *SendPollCall

DisableNotification sets the disable_notification parameter.

func (*SendPollCall) Explanation

func (call *SendPollCall) Explanation(explanation string) *SendPollCall

Explanation sets the explanation parameter.

func (*SendPollCall) ExplanationEntities

func (call *SendPollCall) ExplanationEntities(explanationEntities []MessageEntity) *SendPollCall

ExplanationEntities sets the explanation_entities parameter.

func (*SendPollCall) ExplanationParseMode

func (call *SendPollCall) ExplanationParseMode(explanationParseMode string) *SendPollCall

ExplanationParseMode sets the explanation_parse_mode parameter.

func (*SendPollCall) IsAnonymous

func (call *SendPollCall) IsAnonymous(isAnonymous bool) *SendPollCall

IsAnonymous sets the is_anonymous parameter.

func (*SendPollCall) IsClosed

func (call *SendPollCall) IsClosed(isClosed bool) *SendPollCall

IsClosed sets the is_closed parameter.

func (*SendPollCall) MessageEffectID added in v0.16.0

func (call *SendPollCall) MessageEffectID(messageEffectID string) *SendPollCall

MessageEffectID sets the message_effect_id parameter.

func (*SendPollCall) MessageThreadID added in v0.6.0

func (call *SendPollCall) MessageThreadID(messageThreadID int) *SendPollCall

MessageThreadID sets the message_thread_id parameter.

func (*SendPollCall) OpenPeriod

func (call *SendPollCall) OpenPeriod(openPeriod int) *SendPollCall

OpenPeriod sets the open_period parameter.

func (*SendPollCall) Options

func (call *SendPollCall) Options(options []InputPollOption) *SendPollCall

Options sets the options parameter.

func (*SendPollCall) ProtectContent

func (call *SendPollCall) ProtectContent(protectContent bool) *SendPollCall

ProtectContent sets the protect_content parameter.

func (*SendPollCall) Question

func (call *SendPollCall) Question(question string) *SendPollCall

Question sets the question parameter.

func (*SendPollCall) QuestionEntities added in v0.16.0

func (call *SendPollCall) QuestionEntities(questionEntities []MessageEntity) *SendPollCall

QuestionEntities sets the question_entities parameter.

func (*SendPollCall) QuestionParseMode added in v0.16.0

func (call *SendPollCall) QuestionParseMode(questionParseMode string) *SendPollCall

QuestionParseMode sets the question_parse_mode parameter.

func (*SendPollCall) ReplyMarkup

func (call *SendPollCall) ReplyMarkup(replyMarkup ReplyMarkup) *SendPollCall

ReplyMarkup sets the reply_markup parameter.

func (*SendPollCall) ReplyParameters added in v0.12.0

func (call *SendPollCall) ReplyParameters(replyParameters ReplyParameters) *SendPollCall

ReplyParameters sets the reply_parameters parameter.

func (*SendPollCall) Type

func (call *SendPollCall) Type(type_ string) *SendPollCall

Type sets the type parameter.

type SendStickerCall

type SendStickerCall struct {
	Call[Message]
}

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

func NewSendStickerCall

func NewSendStickerCall(chatID PeerID, sticker FileArg) *SendStickerCall

NewSendStickerCall constructs a new SendStickerCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • sticker: Sticker to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a .WEBP sticker from the Internet, or upload a new .WEBP, .TGS, or .WEBM sticker using multipart/form-data. More information on Sending Files ». Video and animated stickers can't be sent via an HTTP URL.

func (*SendStickerCall) AllowPaidBroadcast added in v0.16.0

func (call *SendStickerCall) AllowPaidBroadcast(allowPaidBroadcast bool) *SendStickerCall

AllowPaidBroadcast sets the allow_paid_broadcast parameter.

func (*SendStickerCall) BusinessConnectionID added in v0.15.0

func (call *SendStickerCall) BusinessConnectionID(businessConnectionID string) *SendStickerCall

BusinessConnectionID sets the business_connection_id parameter.

func (*SendStickerCall) ChatID added in v0.0.5

func (call *SendStickerCall) ChatID(chatID PeerID) *SendStickerCall

ChatID sets the chat_id parameter.

func (*SendStickerCall) DirectMessagesTopicID added in v0.16.0

func (call *SendStickerCall) DirectMessagesTopicID(directMessagesTopicID int) *SendStickerCall

DirectMessagesTopicID sets the direct_messages_topic_id parameter.

func (*SendStickerCall) DisableNotification

func (call *SendStickerCall) DisableNotification(disableNotification bool) *SendStickerCall

DisableNotification sets the disable_notification parameter.

func (*SendStickerCall) Emoji added in v0.8.0

func (call *SendStickerCall) Emoji(emoji string) *SendStickerCall

Emoji sets the emoji parameter.

func (*SendStickerCall) MessageEffectID added in v0.16.0

func (call *SendStickerCall) MessageEffectID(messageEffectID string) *SendStickerCall

MessageEffectID sets the message_effect_id parameter.

func (*SendStickerCall) MessageThreadID added in v0.6.0

func (call *SendStickerCall) MessageThreadID(messageThreadID int) *SendStickerCall

MessageThreadID sets the message_thread_id parameter.

func (*SendStickerCall) ProtectContent

func (call *SendStickerCall) ProtectContent(protectContent bool) *SendStickerCall

ProtectContent sets the protect_content parameter.

func (*SendStickerCall) ReplyMarkup

func (call *SendStickerCall) ReplyMarkup(replyMarkup ReplyMarkup) *SendStickerCall

ReplyMarkup sets the reply_markup parameter.

func (*SendStickerCall) ReplyParameters added in v0.12.0

func (call *SendStickerCall) ReplyParameters(replyParameters ReplyParameters) *SendStickerCall

ReplyParameters sets the reply_parameters parameter.

func (*SendStickerCall) Sticker

func (call *SendStickerCall) Sticker(sticker FileArg) *SendStickerCall

Sticker sets the sticker parameter.

func (*SendStickerCall) SuggestedPostParameters added in v0.16.0

func (call *SendStickerCall) SuggestedPostParameters(suggestedPostParameters SuggestedPostParameters) *SendStickerCall

SuggestedPostParameters sets the suggested_post_parameters parameter.

type SendVenueCall

type SendVenueCall struct {
	Call[Message]
}

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

func NewSendVenueCall

func NewSendVenueCall(chatID PeerID, latitude float64, longitude float64, title string, address string) *SendVenueCall

NewSendVenueCall constructs a new SendVenueCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • latitude: Latitude of the venue
  • longitude: Longitude of the venue
  • title: Name of the venue
  • address: Address of the venue

func (*SendVenueCall) Address

func (call *SendVenueCall) Address(address string) *SendVenueCall

Address sets the address parameter.

func (*SendVenueCall) AllowPaidBroadcast added in v0.16.0

func (call *SendVenueCall) AllowPaidBroadcast(allowPaidBroadcast bool) *SendVenueCall

AllowPaidBroadcast sets the allow_paid_broadcast parameter.

func (*SendVenueCall) BusinessConnectionID added in v0.15.0

func (call *SendVenueCall) BusinessConnectionID(businessConnectionID string) *SendVenueCall

BusinessConnectionID sets the business_connection_id parameter.

func (*SendVenueCall) ChatID added in v0.0.5

func (call *SendVenueCall) ChatID(chatID PeerID) *SendVenueCall

ChatID sets the chat_id parameter.

func (*SendVenueCall) DirectMessagesTopicID added in v0.16.0

func (call *SendVenueCall) DirectMessagesTopicID(directMessagesTopicID int) *SendVenueCall

DirectMessagesTopicID sets the direct_messages_topic_id parameter.

func (*SendVenueCall) DisableNotification

func (call *SendVenueCall) DisableNotification(disableNotification bool) *SendVenueCall

DisableNotification sets the disable_notification parameter.

func (*SendVenueCall) FoursquareID added in v0.0.5

func (call *SendVenueCall) FoursquareID(foursquareID string) *SendVenueCall

FoursquareID sets the foursquare_id parameter.

func (*SendVenueCall) FoursquareType

func (call *SendVenueCall) FoursquareType(foursquareType string) *SendVenueCall

FoursquareType sets the foursquare_type parameter.

func (*SendVenueCall) GooglePlaceID added in v0.0.5

func (call *SendVenueCall) GooglePlaceID(googlePlaceID string) *SendVenueCall

GooglePlaceID sets the google_place_id parameter.

func (*SendVenueCall) GooglePlaceType

func (call *SendVenueCall) GooglePlaceType(googlePlaceType string) *SendVenueCall

GooglePlaceType sets the google_place_type parameter.

func (*SendVenueCall) Latitude

func (call *SendVenueCall) Latitude(latitude float64) *SendVenueCall

Latitude sets the latitude parameter.

func (*SendVenueCall) Longitude

func (call *SendVenueCall) Longitude(longitude float64) *SendVenueCall

Longitude sets the longitude parameter.

func (*SendVenueCall) MessageEffectID added in v0.16.0

func (call *SendVenueCall) MessageEffectID(messageEffectID string) *SendVenueCall

MessageEffectID sets the message_effect_id parameter.

func (*SendVenueCall) MessageThreadID added in v0.6.0

func (call *SendVenueCall) MessageThreadID(messageThreadID int) *SendVenueCall

MessageThreadID sets the message_thread_id parameter.

func (*SendVenueCall) ProtectContent

func (call *SendVenueCall) ProtectContent(protectContent bool) *SendVenueCall

ProtectContent sets the protect_content parameter.

func (*SendVenueCall) ReplyMarkup

func (call *SendVenueCall) ReplyMarkup(replyMarkup ReplyMarkup) *SendVenueCall

ReplyMarkup sets the reply_markup parameter.

func (*SendVenueCall) ReplyParameters added in v0.12.0

func (call *SendVenueCall) ReplyParameters(replyParameters ReplyParameters) *SendVenueCall

ReplyParameters sets the reply_parameters parameter.

func (*SendVenueCall) SuggestedPostParameters added in v0.16.0

func (call *SendVenueCall) SuggestedPostParameters(suggestedPostParameters SuggestedPostParameters) *SendVenueCall

SuggestedPostParameters sets the suggested_post_parameters parameter.

func (*SendVenueCall) Title

func (call *SendVenueCall) Title(title string) *SendVenueCall

Title sets the title parameter.

type SendVideoCall

type SendVideoCall struct {
	Call[Message]
}

SendVideoCall represents a call to the sendVideo method. Use this method to send video files, Telegram clients support MPEG4 videos (other formats may be sent as Document). On success, the sent Message is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.

func NewSendVideoCall

func NewSendVideoCall(chatID PeerID, video FileArg) *SendVideoCall

NewSendVideoCall constructs a new SendVideoCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • video: Video to send. Pass a file_id as String to send a video that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a video from the Internet, or upload a new video using multipart/form-data. More information on Sending Files »

func (*SendVideoCall) AllowPaidBroadcast added in v0.16.0

func (call *SendVideoCall) AllowPaidBroadcast(allowPaidBroadcast bool) *SendVideoCall

AllowPaidBroadcast sets the allow_paid_broadcast parameter.

func (*SendVideoCall) BusinessConnectionID added in v0.15.0

func (call *SendVideoCall) BusinessConnectionID(businessConnectionID string) *SendVideoCall

BusinessConnectionID sets the business_connection_id parameter.

func (*SendVideoCall) Caption

func (call *SendVideoCall) Caption(caption string) *SendVideoCall

Caption sets the caption parameter.

func (*SendVideoCall) CaptionEntities

func (call *SendVideoCall) CaptionEntities(captionEntities []MessageEntity) *SendVideoCall

CaptionEntities sets the caption_entities parameter.

func (*SendVideoCall) ChatID added in v0.0.5

func (call *SendVideoCall) ChatID(chatID PeerID) *SendVideoCall

ChatID sets the chat_id parameter.

func (*SendVideoCall) Cover added in v0.16.0

func (call *SendVideoCall) Cover(cover FileArg) *SendVideoCall

Cover sets the cover parameter.

func (*SendVideoCall) DirectMessagesTopicID added in v0.16.0

func (call *SendVideoCall) DirectMessagesTopicID(directMessagesTopicID int) *SendVideoCall

DirectMessagesTopicID sets the direct_messages_topic_id parameter.

func (*SendVideoCall) DisableNotification

func (call *SendVideoCall) DisableNotification(disableNotification bool) *SendVideoCall

DisableNotification sets the disable_notification parameter.

func (*SendVideoCall) Duration

func (call *SendVideoCall) Duration(duration int) *SendVideoCall

Duration sets the duration parameter.

func (*SendVideoCall) HasSpoiler added in v0.6.0

func (call *SendVideoCall) HasSpoiler(hasSpoiler bool) *SendVideoCall

HasSpoiler sets the has_spoiler parameter.

func (*SendVideoCall) Height

func (call *SendVideoCall) Height(height int) *SendVideoCall

Height sets the height parameter.

func (*SendVideoCall) MessageEffectID added in v0.16.0

func (call *SendVideoCall) MessageEffectID(messageEffectID string) *SendVideoCall

MessageEffectID sets the message_effect_id parameter.

func (*SendVideoCall) MessageThreadID added in v0.6.0

func (call *SendVideoCall) MessageThreadID(messageThreadID int) *SendVideoCall

MessageThreadID sets the message_thread_id parameter.

func (*SendVideoCall) ParseMode

func (call *SendVideoCall) ParseMode(parseMode ParseMode) *SendVideoCall

ParseMode sets the parse_mode parameter.

func (*SendVideoCall) ProtectContent

func (call *SendVideoCall) ProtectContent(protectContent bool) *SendVideoCall

ProtectContent sets the protect_content parameter.

func (*SendVideoCall) ReplyMarkup

func (call *SendVideoCall) ReplyMarkup(replyMarkup ReplyMarkup) *SendVideoCall

ReplyMarkup sets the reply_markup parameter.

func (*SendVideoCall) ReplyParameters added in v0.12.0

func (call *SendVideoCall) ReplyParameters(replyParameters ReplyParameters) *SendVideoCall

ReplyParameters sets the reply_parameters parameter.

func (*SendVideoCall) ShowCaptionAboveMedia added in v0.16.0

func (call *SendVideoCall) ShowCaptionAboveMedia(showCaptionAboveMedia bool) *SendVideoCall

ShowCaptionAboveMedia sets the show_caption_above_media parameter.

func (*SendVideoCall) StartTimestamp added in v0.16.0

func (call *SendVideoCall) StartTimestamp(startTimestamp int) *SendVideoCall

StartTimestamp sets the start_timestamp parameter.

func (*SendVideoCall) SuggestedPostParameters added in v0.16.0

func (call *SendVideoCall) SuggestedPostParameters(suggestedPostParameters SuggestedPostParameters) *SendVideoCall

SuggestedPostParameters sets the suggested_post_parameters parameter.

func (*SendVideoCall) SupportsStreaming

func (call *SendVideoCall) SupportsStreaming(supportsStreaming bool) *SendVideoCall

SupportsStreaming sets the supports_streaming parameter.

func (*SendVideoCall) Thumbnail added in v0.8.0

func (call *SendVideoCall) Thumbnail(thumbnail InputFile) *SendVideoCall

Thumbnail sets the thumbnail parameter.

func (*SendVideoCall) Video

func (call *SendVideoCall) Video(video FileArg) *SendVideoCall

Video sets the video parameter.

func (*SendVideoCall) Width

func (call *SendVideoCall) Width(width int) *SendVideoCall

Width sets the width parameter.

type SendVideoNoteCall

type SendVideoNoteCall struct {
	Call[Message]
}

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

func NewSendVideoNoteCall

func NewSendVideoNoteCall(chatID PeerID, videoNote FileArg) *SendVideoNoteCall

NewSendVideoNoteCall constructs a new SendVideoNoteCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • videoNote: Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data. More information on Sending Files ». Sending video notes by a URL is currently unsupported

func (*SendVideoNoteCall) AllowPaidBroadcast added in v0.16.0

func (call *SendVideoNoteCall) AllowPaidBroadcast(allowPaidBroadcast bool) *SendVideoNoteCall

AllowPaidBroadcast sets the allow_paid_broadcast parameter.

func (*SendVideoNoteCall) BusinessConnectionID added in v0.15.0

func (call *SendVideoNoteCall) BusinessConnectionID(businessConnectionID string) *SendVideoNoteCall

BusinessConnectionID sets the business_connection_id parameter.

func (*SendVideoNoteCall) ChatID added in v0.0.5

func (call *SendVideoNoteCall) ChatID(chatID PeerID) *SendVideoNoteCall

ChatID sets the chat_id parameter.

func (*SendVideoNoteCall) DirectMessagesTopicID added in v0.16.0

func (call *SendVideoNoteCall) DirectMessagesTopicID(directMessagesTopicID int) *SendVideoNoteCall

DirectMessagesTopicID sets the direct_messages_topic_id parameter.

func (*SendVideoNoteCall) DisableNotification

func (call *SendVideoNoteCall) DisableNotification(disableNotification bool) *SendVideoNoteCall

DisableNotification sets the disable_notification parameter.

func (*SendVideoNoteCall) Duration

func (call *SendVideoNoteCall) Duration(duration int) *SendVideoNoteCall

Duration sets the duration parameter.

func (*SendVideoNoteCall) Length

func (call *SendVideoNoteCall) Length(length int) *SendVideoNoteCall

Length sets the length parameter.

func (*SendVideoNoteCall) MessageEffectID added in v0.16.0

func (call *SendVideoNoteCall) MessageEffectID(messageEffectID string) *SendVideoNoteCall

MessageEffectID sets the message_effect_id parameter.

func (*SendVideoNoteCall) MessageThreadID added in v0.6.0

func (call *SendVideoNoteCall) MessageThreadID(messageThreadID int) *SendVideoNoteCall

MessageThreadID sets the message_thread_id parameter.

func (*SendVideoNoteCall) ProtectContent

func (call *SendVideoNoteCall) ProtectContent(protectContent bool) *SendVideoNoteCall

ProtectContent sets the protect_content parameter.

func (*SendVideoNoteCall) ReplyMarkup

func (call *SendVideoNoteCall) ReplyMarkup(replyMarkup ReplyMarkup) *SendVideoNoteCall

ReplyMarkup sets the reply_markup parameter.

func (*SendVideoNoteCall) ReplyParameters added in v0.12.0

func (call *SendVideoNoteCall) ReplyParameters(replyParameters ReplyParameters) *SendVideoNoteCall

ReplyParameters sets the reply_parameters parameter.

func (*SendVideoNoteCall) SuggestedPostParameters added in v0.16.0

func (call *SendVideoNoteCall) SuggestedPostParameters(suggestedPostParameters SuggestedPostParameters) *SendVideoNoteCall

SuggestedPostParameters sets the suggested_post_parameters parameter.

func (*SendVideoNoteCall) Thumbnail added in v0.8.0

func (call *SendVideoNoteCall) Thumbnail(thumbnail InputFile) *SendVideoNoteCall

Thumbnail sets the thumbnail parameter.

func (*SendVideoNoteCall) VideoNote

func (call *SendVideoNoteCall) VideoNote(videoNote FileArg) *SendVideoNoteCall

VideoNote sets the video_note parameter.

type SendVoiceCall

type SendVoiceCall struct {
	Call[Message]
}

SendVoiceCall represents a call to the sendVoice method. Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS, or in .MP3 format, or in .M4A format (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.

func NewSendVoiceCall

func NewSendVoiceCall(chatID PeerID, voice FileArg) *SendVoiceCall

NewSendVoiceCall constructs a new SendVoiceCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • voice: Audio file to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files »

func (*SendVoiceCall) AllowPaidBroadcast added in v0.16.0

func (call *SendVoiceCall) AllowPaidBroadcast(allowPaidBroadcast bool) *SendVoiceCall

AllowPaidBroadcast sets the allow_paid_broadcast parameter.

func (*SendVoiceCall) BusinessConnectionID added in v0.15.0

func (call *SendVoiceCall) BusinessConnectionID(businessConnectionID string) *SendVoiceCall

BusinessConnectionID sets the business_connection_id parameter.

func (*SendVoiceCall) Caption

func (call *SendVoiceCall) Caption(caption string) *SendVoiceCall

Caption sets the caption parameter.

func (*SendVoiceCall) CaptionEntities

func (call *SendVoiceCall) CaptionEntities(captionEntities []MessageEntity) *SendVoiceCall

CaptionEntities sets the caption_entities parameter.

func (*SendVoiceCall) ChatID added in v0.0.5

func (call *SendVoiceCall) ChatID(chatID PeerID) *SendVoiceCall

ChatID sets the chat_id parameter.

func (*SendVoiceCall) DirectMessagesTopicID added in v0.16.0

func (call *SendVoiceCall) DirectMessagesTopicID(directMessagesTopicID int) *SendVoiceCall

DirectMessagesTopicID sets the direct_messages_topic_id parameter.

func (*SendVoiceCall) DisableNotification

func (call *SendVoiceCall) DisableNotification(disableNotification bool) *SendVoiceCall

DisableNotification sets the disable_notification parameter.

func (*SendVoiceCall) Duration

func (call *SendVoiceCall) Duration(duration int) *SendVoiceCall

Duration sets the duration parameter.

func (*SendVoiceCall) MessageEffectID added in v0.16.0

func (call *SendVoiceCall) MessageEffectID(messageEffectID string) *SendVoiceCall

MessageEffectID sets the message_effect_id parameter.

func (*SendVoiceCall) MessageThreadID added in v0.6.0

func (call *SendVoiceCall) MessageThreadID(messageThreadID int) *SendVoiceCall

MessageThreadID sets the message_thread_id parameter.

func (*SendVoiceCall) ParseMode

func (call *SendVoiceCall) ParseMode(parseMode ParseMode) *SendVoiceCall

ParseMode sets the parse_mode parameter.

func (*SendVoiceCall) ProtectContent

func (call *SendVoiceCall) ProtectContent(protectContent bool) *SendVoiceCall

ProtectContent sets the protect_content parameter.

func (*SendVoiceCall) ReplyMarkup

func (call *SendVoiceCall) ReplyMarkup(replyMarkup ReplyMarkup) *SendVoiceCall

ReplyMarkup sets the reply_markup parameter.

func (*SendVoiceCall) ReplyParameters added in v0.12.0

func (call *SendVoiceCall) ReplyParameters(replyParameters ReplyParameters) *SendVoiceCall

ReplyParameters sets the reply_parameters parameter.

func (*SendVoiceCall) SuggestedPostParameters added in v0.16.0

func (call *SendVoiceCall) SuggestedPostParameters(suggestedPostParameters SuggestedPostParameters) *SendVoiceCall

SuggestedPostParameters sets the suggested_post_parameters parameter.

func (*SendVoiceCall) Voice

func (call *SendVoiceCall) Voice(voice FileArg) *SendVoiceCall

Voice sets the voice parameter.

type SentWebAppMessage

type SentWebAppMessage struct {
	// Optional. Identifier of the sent inline message. Available only if there is an [InlineKeyboardMarkup] attached to the message.
	InlineMessageID string `json:"inline_message_id,omitempty"`
}

SentWebAppMessage describes an inline message sent by a Web App on behalf of a user.

type SetBusinessAccountBioCall added in v0.16.0

type SetBusinessAccountBioCall struct {
	CallNoResult
}

SetBusinessAccountBioCall represents a call to the setBusinessAccountBio method. Changes the bio of a managed business account. Requires the can_change_bio business bot right. Returns True on success.

func NewSetBusinessAccountBioCall added in v0.16.0

func NewSetBusinessAccountBioCall(businessConnectionID string) *SetBusinessAccountBioCall

NewSetBusinessAccountBioCall constructs a new SetBusinessAccountBioCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection

func (*SetBusinessAccountBioCall) Bio added in v0.16.0

Bio sets the bio parameter.

func (*SetBusinessAccountBioCall) BusinessConnectionID added in v0.16.0

func (call *SetBusinessAccountBioCall) BusinessConnectionID(businessConnectionID string) *SetBusinessAccountBioCall

BusinessConnectionID sets the business_connection_id parameter.

type SetBusinessAccountGiftSettingsCall added in v0.16.0

type SetBusinessAccountGiftSettingsCall struct {
	CallNoResult
}

SetBusinessAccountGiftSettingsCall represents a call to the setBusinessAccountGiftSettings method. Changes the privacy settings pertaining to incoming gifts in a managed business account. Requires the can_change_gift_settings business bot right. Returns True on success.

func NewSetBusinessAccountGiftSettingsCall added in v0.16.0

func NewSetBusinessAccountGiftSettingsCall(businessConnectionID string, showGiftButton bool, acceptedGiftTypes AcceptedGiftTypes) *SetBusinessAccountGiftSettingsCall

NewSetBusinessAccountGiftSettingsCall constructs a new SetBusinessAccountGiftSettingsCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection
  • showGiftButton: Pass True, if a button for sending a gift to the user or by the business account must always be shown in the input field
  • acceptedGiftTypes: Types of gifts accepted by the business account

func (*SetBusinessAccountGiftSettingsCall) AcceptedGiftTypes added in v0.16.0

AcceptedGiftTypes sets the accepted_gift_types parameter.

func (*SetBusinessAccountGiftSettingsCall) BusinessConnectionID added in v0.16.0

func (call *SetBusinessAccountGiftSettingsCall) BusinessConnectionID(businessConnectionID string) *SetBusinessAccountGiftSettingsCall

BusinessConnectionID sets the business_connection_id parameter.

func (*SetBusinessAccountGiftSettingsCall) ShowGiftButton added in v0.16.0

func (call *SetBusinessAccountGiftSettingsCall) ShowGiftButton(showGiftButton bool) *SetBusinessAccountGiftSettingsCall

ShowGiftButton sets the show_gift_button parameter.

type SetBusinessAccountNameCall added in v0.16.0

type SetBusinessAccountNameCall struct {
	CallNoResult
}

SetBusinessAccountNameCall represents a call to the setBusinessAccountName method. Changes the first and last name of a managed business account. Requires the can_change_name business bot right. Returns True on success.

func NewSetBusinessAccountNameCall added in v0.16.0

func NewSetBusinessAccountNameCall(businessConnectionID string, firstName string) *SetBusinessAccountNameCall

NewSetBusinessAccountNameCall constructs a new SetBusinessAccountNameCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection
  • firstName: The new value of the first name for the business account; 1-64 characters

func (*SetBusinessAccountNameCall) BusinessConnectionID added in v0.16.0

func (call *SetBusinessAccountNameCall) BusinessConnectionID(businessConnectionID string) *SetBusinessAccountNameCall

BusinessConnectionID sets the business_connection_id parameter.

func (*SetBusinessAccountNameCall) FirstName added in v0.16.0

func (call *SetBusinessAccountNameCall) FirstName(firstName string) *SetBusinessAccountNameCall

FirstName sets the first_name parameter.

func (*SetBusinessAccountNameCall) LastName added in v0.16.0

LastName sets the last_name parameter.

type SetBusinessAccountProfilePhotoCall added in v0.16.0

type SetBusinessAccountProfilePhotoCall struct {
	CallNoResult
}

SetBusinessAccountProfilePhotoCall represents a call to the setBusinessAccountProfilePhoto method. Changes the profile photo of a managed business account. Requires the can_edit_profile_photo business bot right. Returns True on success.

func NewSetBusinessAccountProfilePhotoCall added in v0.16.0

func NewSetBusinessAccountProfilePhotoCall(businessConnectionID string, photo InputProfilePhotoClass) *SetBusinessAccountProfilePhotoCall

NewSetBusinessAccountProfilePhotoCall constructs a new SetBusinessAccountProfilePhotoCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection
  • photo: The new profile photo to set

func (*SetBusinessAccountProfilePhotoCall) BusinessConnectionID added in v0.16.0

func (call *SetBusinessAccountProfilePhotoCall) BusinessConnectionID(businessConnectionID string) *SetBusinessAccountProfilePhotoCall

BusinessConnectionID sets the business_connection_id parameter.

func (*SetBusinessAccountProfilePhotoCall) IsPublic added in v0.16.0

IsPublic sets the is_public parameter.

func (*SetBusinessAccountProfilePhotoCall) Photo added in v0.16.0

Photo sets the photo parameter.

type SetBusinessAccountUsernameCall added in v0.16.0

type SetBusinessAccountUsernameCall struct {
	CallNoResult
}

SetBusinessAccountUsernameCall represents a call to the setBusinessAccountUsername method. Changes the username of a managed business account. Requires the can_change_username business bot right. Returns True on success.

func NewSetBusinessAccountUsernameCall added in v0.16.0

func NewSetBusinessAccountUsernameCall(businessConnectionID string) *SetBusinessAccountUsernameCall

NewSetBusinessAccountUsernameCall constructs a new SetBusinessAccountUsernameCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection

func (*SetBusinessAccountUsernameCall) BusinessConnectionID added in v0.16.0

func (call *SetBusinessAccountUsernameCall) BusinessConnectionID(businessConnectionID string) *SetBusinessAccountUsernameCall

BusinessConnectionID sets the business_connection_id parameter.

func (*SetBusinessAccountUsernameCall) Username added in v0.16.0

Username sets the username parameter.

type SetChatAdministratorCustomTitleCall

type SetChatAdministratorCustomTitleCall struct {
	CallNoResult
}

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

func NewSetChatAdministratorCustomTitleCall

func NewSetChatAdministratorCustomTitleCall(chatID PeerID, userID UserID, customTitle string) *SetChatAdministratorCustomTitleCall

NewSetChatAdministratorCustomTitleCall constructs a new SetChatAdministratorCustomTitleCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
  • userID: Unique identifier of the target user
  • customTitle: New custom title for the administrator; 0-16 characters, emoji are not allowed

func (*SetChatAdministratorCustomTitleCall) ChatID added in v0.0.5

ChatID sets the chat_id parameter.

func (*SetChatAdministratorCustomTitleCall) CustomTitle

CustomTitle sets the custom_title parameter.

func (*SetChatAdministratorCustomTitleCall) UserID added in v0.0.5

UserID sets the user_id parameter.

type SetChatDescriptionCall

type SetChatDescriptionCall struct {
	CallNoResult
}

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

func NewSetChatDescriptionCall

func NewSetChatDescriptionCall(chatID PeerID) *SetChatDescriptionCall

NewSetChatDescriptionCall constructs a new SetChatDescriptionCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*SetChatDescriptionCall) ChatID added in v0.0.5

ChatID sets the chat_id parameter.

func (*SetChatDescriptionCall) Description

func (call *SetChatDescriptionCall) Description(description string) *SetChatDescriptionCall

Description sets the description parameter.

type SetChatMenuButtonCall

type SetChatMenuButtonCall struct {
	CallNoResult
}

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

func NewSetChatMenuButtonCall

func NewSetChatMenuButtonCall() *SetChatMenuButtonCall

NewSetChatMenuButtonCall constructs a new SetChatMenuButtonCall.

func (*SetChatMenuButtonCall) ChatID added in v0.0.5

func (call *SetChatMenuButtonCall) ChatID(chatID int) *SetChatMenuButtonCall

ChatID sets the chat_id parameter.

func (*SetChatMenuButtonCall) MenuButton

func (call *SetChatMenuButtonCall) MenuButton(menuButton MenuButtonClass) *SetChatMenuButtonCall

MenuButton sets the menu_button parameter.

type SetChatPermissionsCall

type SetChatPermissionsCall struct {
	CallNoResult
}

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

func NewSetChatPermissionsCall

func NewSetChatPermissionsCall(chatID PeerID, permissions ChatPermissions) *SetChatPermissionsCall

NewSetChatPermissionsCall constructs a new SetChatPermissionsCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
  • permissions: A JSON-serialized object for new default chat permissions

func (*SetChatPermissionsCall) ChatID added in v0.0.5

ChatID sets the chat_id parameter.

func (*SetChatPermissionsCall) Permissions

func (call *SetChatPermissionsCall) Permissions(permissions ChatPermissions) *SetChatPermissionsCall

Permissions sets the permissions parameter.

func (*SetChatPermissionsCall) UseIndependentChatPermissions added in v0.6.0

func (call *SetChatPermissionsCall) UseIndependentChatPermissions(useIndependentChatPermissions bool) *SetChatPermissionsCall

UseIndependentChatPermissions sets the use_independent_chat_permissions parameter.

type SetChatPhotoCall

type SetChatPhotoCall struct {
	CallNoResult
}

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

func NewSetChatPhotoCall

func NewSetChatPhotoCall(chatID PeerID, photo InputFile) *SetChatPhotoCall

NewSetChatPhotoCall constructs a new SetChatPhotoCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • photo: New chat photo, uploaded using multipart/form-data

func (*SetChatPhotoCall) ChatID added in v0.0.5

func (call *SetChatPhotoCall) ChatID(chatID PeerID) *SetChatPhotoCall

ChatID sets the chat_id parameter.

func (*SetChatPhotoCall) Photo

func (call *SetChatPhotoCall) Photo(photo InputFile) *SetChatPhotoCall

Photo sets the photo parameter.

type SetChatStickerSetCall

type SetChatStickerSetCall struct {
	CallNoResult
}

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

func NewSetChatStickerSetCall

func NewSetChatStickerSetCall(chatID PeerID, stickerSetName string) *SetChatStickerSetCall

NewSetChatStickerSetCall constructs a new SetChatStickerSetCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
  • stickerSetName: Name of the sticker set to be set as the group sticker set

func (*SetChatStickerSetCall) ChatID added in v0.0.5

func (call *SetChatStickerSetCall) ChatID(chatID PeerID) *SetChatStickerSetCall

ChatID sets the chat_id parameter.

func (*SetChatStickerSetCall) StickerSetName

func (call *SetChatStickerSetCall) StickerSetName(stickerSetName string) *SetChatStickerSetCall

StickerSetName sets the sticker_set_name parameter.

type SetChatTitleCall

type SetChatTitleCall struct {
	CallNoResult
}

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

func NewSetChatTitleCall

func NewSetChatTitleCall(chatID PeerID, title string) *SetChatTitleCall

NewSetChatTitleCall constructs a new SetChatTitleCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • title: New chat title, 1-128 characters

func (*SetChatTitleCall) ChatID added in v0.0.5

func (call *SetChatTitleCall) ChatID(chatID PeerID) *SetChatTitleCall

ChatID sets the chat_id parameter.

func (*SetChatTitleCall) Title

func (call *SetChatTitleCall) Title(title string) *SetChatTitleCall

Title sets the title parameter.

type SetCustomEmojiStickerSetThumbnailCall added in v0.8.0

type SetCustomEmojiStickerSetThumbnailCall struct {
	CallNoResult
}

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

func NewSetCustomEmojiStickerSetThumbnailCall added in v0.8.0

func NewSetCustomEmojiStickerSetThumbnailCall(name string) *SetCustomEmojiStickerSetThumbnailCall

NewSetCustomEmojiStickerSetThumbnailCall constructs a new SetCustomEmojiStickerSetThumbnailCall.

Required params:

  • name: Sticker set name

func (*SetCustomEmojiStickerSetThumbnailCall) CustomEmojiID added in v0.8.0

CustomEmojiID sets the custom_emoji_id parameter.

func (*SetCustomEmojiStickerSetThumbnailCall) Name added in v0.8.0

Name sets the name parameter.

type SetGameScoreCall

type SetGameScoreCall struct {
	CallNoResult
}

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

func NewSetGameScoreCall

func NewSetGameScoreCall(userID UserID, score int) *SetGameScoreCall

NewSetGameScoreCall constructs a new SetGameScoreCall.

Required params:

  • userID: User identifier
  • score: New score, must be non-negative

func (*SetGameScoreCall) ChatID added in v0.0.5

func (call *SetGameScoreCall) ChatID(chatID int) *SetGameScoreCall

ChatID sets the chat_id parameter.

func (*SetGameScoreCall) DisableEditMessage

func (call *SetGameScoreCall) DisableEditMessage(disableEditMessage bool) *SetGameScoreCall

DisableEditMessage sets the disable_edit_message parameter.

func (*SetGameScoreCall) Force

func (call *SetGameScoreCall) Force(force bool) *SetGameScoreCall

Force sets the force parameter.

func (*SetGameScoreCall) InlineMessageID added in v0.0.5

func (call *SetGameScoreCall) InlineMessageID(inlineMessageID string) *SetGameScoreCall

InlineMessageID sets the inline_message_id parameter.

func (*SetGameScoreCall) MessageID added in v0.0.5

func (call *SetGameScoreCall) MessageID(messageID int) *SetGameScoreCall

MessageID sets the message_id parameter.

func (*SetGameScoreCall) Score

func (call *SetGameScoreCall) Score(score int) *SetGameScoreCall

Score sets the score parameter.

func (*SetGameScoreCall) UserID added in v0.0.5

func (call *SetGameScoreCall) UserID(userID UserID) *SetGameScoreCall

UserID sets the user_id parameter.

type SetMessageReactionCall added in v0.12.0

type SetMessageReactionCall struct {
	CallNoResult
}

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

func NewSetMessageReactionCall added in v0.12.0

func NewSetMessageReactionCall(chatID PeerID, messageID int) *SetMessageReactionCall

NewSetMessageReactionCall constructs a new SetMessageReactionCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • messageID: Identifier of the target message. If the message belongs to a media group, the reaction is set to the first non-deleted message in the group instead.

func (*SetMessageReactionCall) ChatID added in v0.12.0

ChatID sets the chat_id parameter.

func (*SetMessageReactionCall) IsBig added in v0.12.0

IsBig sets the is_big parameter.

func (*SetMessageReactionCall) MessageID added in v0.12.0

func (call *SetMessageReactionCall) MessageID(messageID int) *SetMessageReactionCall

MessageID sets the message_id parameter.

func (*SetMessageReactionCall) Reaction added in v0.12.0

func (call *SetMessageReactionCall) Reaction(reaction []ReactionType) *SetMessageReactionCall

Reaction sets the reaction parameter.

type SetMyCommandsCall

type SetMyCommandsCall struct {
	CallNoResult
}

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

func NewSetMyCommandsCall

func NewSetMyCommandsCall(commands []BotCommand) *SetMyCommandsCall

NewSetMyCommandsCall constructs a new SetMyCommandsCall.

Required params:

  • commands: A JSON-serialized list of bot commands to be set as the list of the bot's commands. At most 100 commands can be specified.

func (*SetMyCommandsCall) Commands

func (call *SetMyCommandsCall) Commands(commands []BotCommand) *SetMyCommandsCall

Commands sets the commands parameter.

func (*SetMyCommandsCall) LanguageCode

func (call *SetMyCommandsCall) LanguageCode(languageCode string) *SetMyCommandsCall

LanguageCode sets the language_code parameter.

func (*SetMyCommandsCall) Scope

Scope sets the scope parameter.

type SetMyDefaultAdministratorRightsCall

type SetMyDefaultAdministratorRightsCall struct {
	CallNoResult
}

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

func NewSetMyDefaultAdministratorRightsCall

func NewSetMyDefaultAdministratorRightsCall() *SetMyDefaultAdministratorRightsCall

NewSetMyDefaultAdministratorRightsCall constructs a new SetMyDefaultAdministratorRightsCall.

func (*SetMyDefaultAdministratorRightsCall) ForChannels

ForChannels sets the for_channels parameter.

func (*SetMyDefaultAdministratorRightsCall) Rights

Rights sets the rights parameter.

type SetMyDescriptionCall added in v0.8.0

type SetMyDescriptionCall struct {
	CallNoResult
}

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

func NewSetMyDescriptionCall added in v0.8.0

func NewSetMyDescriptionCall() *SetMyDescriptionCall

NewSetMyDescriptionCall constructs a new SetMyDescriptionCall.

func (*SetMyDescriptionCall) Description added in v0.8.0

func (call *SetMyDescriptionCall) Description(description string) *SetMyDescriptionCall

Description sets the description parameter.

func (*SetMyDescriptionCall) LanguageCode added in v0.8.0

func (call *SetMyDescriptionCall) LanguageCode(languageCode string) *SetMyDescriptionCall

LanguageCode sets the language_code parameter.

type SetMyNameCall added in v0.9.0

type SetMyNameCall struct {
	CallNoResult
}

SetMyNameCall represents a call to the setMyName method. Use this method to change the bot's name. Returns True on success.

func NewSetMyNameCall added in v0.9.0

func NewSetMyNameCall() *SetMyNameCall

NewSetMyNameCall constructs a new SetMyNameCall.

func (*SetMyNameCall) LanguageCode added in v0.9.0

func (call *SetMyNameCall) LanguageCode(languageCode string) *SetMyNameCall

LanguageCode sets the language_code parameter.

func (*SetMyNameCall) Name added in v0.9.0

func (call *SetMyNameCall) Name(name string) *SetMyNameCall

Name sets the name parameter.

type SetMyProfilePhotoCall added in v0.18.0

type SetMyProfilePhotoCall struct {
	CallNoResult
}

SetMyProfilePhotoCall represents a call to the setMyProfilePhoto method. Changes the profile photo of the bot. Returns True on success.

func NewSetMyProfilePhotoCall added in v0.18.0

func NewSetMyProfilePhotoCall(photo InputProfilePhotoClass) *SetMyProfilePhotoCall

NewSetMyProfilePhotoCall constructs a new SetMyProfilePhotoCall.

Required params:

  • photo: The new profile photo to set

func (*SetMyProfilePhotoCall) Photo added in v0.18.0

Photo sets the photo parameter.

type SetMyShortDescriptionCall added in v0.8.0

type SetMyShortDescriptionCall struct {
	CallNoResult
}

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

func NewSetMyShortDescriptionCall added in v0.8.0

func NewSetMyShortDescriptionCall() *SetMyShortDescriptionCall

NewSetMyShortDescriptionCall constructs a new SetMyShortDescriptionCall.

func (*SetMyShortDescriptionCall) LanguageCode added in v0.8.0

func (call *SetMyShortDescriptionCall) LanguageCode(languageCode string) *SetMyShortDescriptionCall

LanguageCode sets the language_code parameter.

func (*SetMyShortDescriptionCall) ShortDescription added in v0.8.0

func (call *SetMyShortDescriptionCall) ShortDescription(shortDescription string) *SetMyShortDescriptionCall

ShortDescription sets the short_description parameter.

type SetPassportDataErrorsCall

type SetPassportDataErrorsCall struct {
	CallNoResult
}

SetPassportDataErrorsCall represents a call to the setPassportDataErrors method. Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change). Returns True on success. Use this if the data submitted by the user doesn't satisfy the standards your service requires for any reason. For example, if a birthday date seems invalid, a submitted document is blurry, a scan shows evidence of tampering, etc. Supply some details in the error message to make sure the user knows how to correct the issues.

func NewSetPassportDataErrorsCall

func NewSetPassportDataErrorsCall(userID UserID, errors []PassportElementError) *SetPassportDataErrorsCall

NewSetPassportDataErrorsCall constructs a new SetPassportDataErrorsCall.

Required params:

  • userID: User identifier
  • errors: A JSON-serialized array describing the errors

func (*SetPassportDataErrorsCall) Errors

Errors sets the errors parameter.

func (*SetPassportDataErrorsCall) UserID added in v0.0.5

UserID sets the user_id parameter.

type SetStickerEmojiListCall added in v0.8.0

type SetStickerEmojiListCall struct {
	CallNoResult
}

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

func NewSetStickerEmojiListCall added in v0.8.0

func NewSetStickerEmojiListCall(sticker string, emojiList []string) *SetStickerEmojiListCall

NewSetStickerEmojiListCall constructs a new SetStickerEmojiListCall.

Required params:

  • sticker: File identifier of the sticker
  • emojiList: A JSON-serialized list of 1-20 emoji associated with the sticker

func (*SetStickerEmojiListCall) EmojiList added in v0.8.0

func (call *SetStickerEmojiListCall) EmojiList(emojiList []string) *SetStickerEmojiListCall

EmojiList sets the emoji_list parameter.

func (*SetStickerEmojiListCall) Sticker added in v0.8.0

func (call *SetStickerEmojiListCall) Sticker(sticker string) *SetStickerEmojiListCall

Sticker sets the sticker parameter.

type SetStickerKeywordsCall added in v0.8.0

type SetStickerKeywordsCall struct {
	CallNoResult
}

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

func NewSetStickerKeywordsCall added in v0.8.0

func NewSetStickerKeywordsCall(sticker string) *SetStickerKeywordsCall

NewSetStickerKeywordsCall constructs a new SetStickerKeywordsCall.

Required params:

  • sticker: File identifier of the sticker

func (*SetStickerKeywordsCall) Keywords added in v0.8.0

func (call *SetStickerKeywordsCall) Keywords(keywords []string) *SetStickerKeywordsCall

Keywords sets the keywords parameter.

func (*SetStickerKeywordsCall) Sticker added in v0.8.0

func (call *SetStickerKeywordsCall) Sticker(sticker string) *SetStickerKeywordsCall

Sticker sets the sticker parameter.

type SetStickerMaskPositionCall added in v0.8.0

type SetStickerMaskPositionCall struct {
	CallNoResult
}

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

func NewSetStickerMaskPositionCall added in v0.8.0

func NewSetStickerMaskPositionCall(sticker string) *SetStickerMaskPositionCall

NewSetStickerMaskPositionCall constructs a new SetStickerMaskPositionCall.

Required params:

  • sticker: File identifier of the sticker

func (*SetStickerMaskPositionCall) MaskPosition added in v0.8.0

func (call *SetStickerMaskPositionCall) MaskPosition(maskPosition MaskPosition) *SetStickerMaskPositionCall

MaskPosition sets the mask_position parameter.

func (*SetStickerMaskPositionCall) Sticker added in v0.8.0

Sticker sets the sticker parameter.

type SetStickerPositionInSetCall

type SetStickerPositionInSetCall struct {
	CallNoResult
}

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

func NewSetStickerPositionInSetCall

func NewSetStickerPositionInSetCall(sticker string, position int) *SetStickerPositionInSetCall

NewSetStickerPositionInSetCall constructs a new SetStickerPositionInSetCall.

Required params:

  • sticker: File identifier of the sticker
  • position: New sticker position in the set, zero-based

func (*SetStickerPositionInSetCall) Position

Position sets the position parameter.

func (*SetStickerPositionInSetCall) Sticker

Sticker sets the sticker parameter.

type SetStickerSetThumbnailCall added in v0.8.0

type SetStickerSetThumbnailCall struct {
	CallNoResult
}

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

func NewSetStickerSetThumbnailCall added in v0.8.0

func NewSetStickerSetThumbnailCall(name string, userID UserID, format string) *SetStickerSetThumbnailCall

NewSetStickerSetThumbnailCall constructs a new SetStickerSetThumbnailCall.

Required params:

  • name: Sticker set name
  • userID: User identifier of the sticker set owner
  • format: Format of the thumbnail, must be one of “static” for a .WEBP or .PNG image, “animated” for a .TGS animation, or “video” for a .WEBM video

func (*SetStickerSetThumbnailCall) Format added in v0.15.0

Format sets the format parameter.

func (*SetStickerSetThumbnailCall) Name added in v0.8.0

Name sets the name parameter.

func (*SetStickerSetThumbnailCall) Thumbnail added in v0.8.0

Thumbnail sets the thumbnail parameter.

func (*SetStickerSetThumbnailCall) UserID added in v0.8.0

UserID sets the user_id parameter.

type SetStickerSetTitleCall added in v0.8.0

type SetStickerSetTitleCall struct {
	CallNoResult
}

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

func NewSetStickerSetTitleCall added in v0.8.0

func NewSetStickerSetTitleCall(name string, title string) *SetStickerSetTitleCall

NewSetStickerSetTitleCall constructs a new SetStickerSetTitleCall.

Required params:

  • name: Sticker set name
  • title: Sticker set title, 1-64 characters

func (*SetStickerSetTitleCall) Name added in v0.8.0

Name sets the name parameter.

func (*SetStickerSetTitleCall) Title added in v0.8.0

Title sets the title parameter.

type SetUserEmojiStatusCall added in v0.16.0

type SetUserEmojiStatusCall struct {
	CallNoResult
}

SetUserEmojiStatusCall represents a call to the setUserEmojiStatus method. Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method requestEmojiStatusAccess. Returns True on success.

func NewSetUserEmojiStatusCall added in v0.16.0

func NewSetUserEmojiStatusCall(userID UserID) *SetUserEmojiStatusCall

NewSetUserEmojiStatusCall constructs a new SetUserEmojiStatusCall.

Required params:

  • userID: Unique identifier of the target user

func (*SetUserEmojiStatusCall) EmojiStatusCustomEmojiID added in v0.16.0

func (call *SetUserEmojiStatusCall) EmojiStatusCustomEmojiID(emojiStatusCustomEmojiID string) *SetUserEmojiStatusCall

EmojiStatusCustomEmojiID sets the emoji_status_custom_emoji_id parameter.

func (*SetUserEmojiStatusCall) EmojiStatusExpirationDate added in v0.16.0

func (call *SetUserEmojiStatusCall) EmojiStatusExpirationDate(emojiStatusExpirationDate int) *SetUserEmojiStatusCall

EmojiStatusExpirationDate sets the emoji_status_expiration_date parameter.

func (*SetUserEmojiStatusCall) UserID added in v0.16.0

UserID sets the user_id parameter.

type SetWebhookCall

type SetWebhookCall struct {
	CallNoResult
}

SetWebhookCall represents a call to the setWebhook method. Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized Update. In case of an unsuccessful request (a request with response HTTP status code different from 2XY), we will repeat the request and give up after a reasonable amount of attempts. Returns True on success. If you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter secret_token. If specified, the request will contain a header “X-Telegram-Bot-Api-Secret-Token” with the secret token as content. Notes 1. You will not be able to receive updates using Client.GetUpdates for as long as an outgoing webhook is set up. 2. To use a self-signed certificate, you need to upload your public key certificate using certificate parameter. Please upload as InputFile, sending a String will not work. 3. Ports currently supported for webhooks: 443, 80, 88, 8443. If you're having any trouble setting up webhooks, please check out this amazing guide to webhooks.

func NewSetWebhookCall

func NewSetWebhookCall(url string) *SetWebhookCall

NewSetWebhookCall constructs a new SetWebhookCall.

Required params:

  • url: HTTPS URL to send updates to. Use an empty string to remove webhook integration

func (*SetWebhookCall) AllowedUpdates

func (call *SetWebhookCall) AllowedUpdates(allowedUpdates []UpdateType) *SetWebhookCall

AllowedUpdates sets the allowed_updates parameter.

func (*SetWebhookCall) Certificate

func (call *SetWebhookCall) Certificate(certificate InputFile) *SetWebhookCall

Certificate sets the certificate parameter.

func (*SetWebhookCall) DropPendingUpdates

func (call *SetWebhookCall) DropPendingUpdates(dropPendingUpdates bool) *SetWebhookCall

DropPendingUpdates sets the drop_pending_updates parameter.

func (*SetWebhookCall) IPAddress added in v0.0.5

func (call *SetWebhookCall) IPAddress(ipAddress string) *SetWebhookCall

IPAddress sets the ip_address parameter.

func (*SetWebhookCall) MaxConnections

func (call *SetWebhookCall) MaxConnections(maxConnections int) *SetWebhookCall

MaxConnections sets the max_connections parameter.

func (*SetWebhookCall) SecretToken

func (call *SetWebhookCall) SecretToken(secretToken string) *SetWebhookCall

SecretToken sets the secret_token parameter.

func (*SetWebhookCall) URL added in v0.0.5

func (call *SetWebhookCall) URL(url string) *SetWebhookCall

URL sets the url parameter.

type SharedUser added in v0.15.0

type SharedUser struct {
	// Identifier of the shared user. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so 64-bit integers or double-precision float types are safe for storing these identifiers. The bot may not have access to the user and could be unable to use this identifier, unless the user is already known to the bot by some other means.
	UserID UserID `json:"user_id"`

	// Optional. First name of the user, if the name was requested by the bot
	FirstName string `json:"first_name,omitempty"`

	// Optional. Last name of the user, if the name was requested by the bot
	LastName string `json:"last_name,omitempty"`

	// Optional. Username of the user, if the username was requested by the bot
	Username Username `json:"username,omitempty"`

	// Optional. Available sizes of the chat photo, if the photo was requested by the bot
	Photo []PhotoSize `json:"photo,omitempty"`
}

SharedUser this object contains information about a user that was shared with the bot using a KeyboardButtonRequestUsers button.

type ShippingAddress

type ShippingAddress struct {
	// Two-letter [ISO 3166-1 alpha-2] country code
	//
	// [ISO 3166-1 alpha-2]: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
	CountryCode string `json:"country_code"`

	// State, if applicable
	State string `json:"state"`

	// City
	City string `json:"city"`

	// First line for the address
	StreetLine1 string `json:"street_line1"`

	// Second line for the address
	StreetLine2 string `json:"street_line2"`

	// Address post code
	PostCode string `json:"post_code"`
}

ShippingAddress this object represents a shipping address.

type ShippingOption

type ShippingOption struct {
	// Shipping option identifier
	ID string `json:"id"`

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

	// List of price portions
	Prices []LabeledPrice `json:"prices"`
}

ShippingOption this object represents one shipping option.

type ShippingQuery

type ShippingQuery struct {
	// Unique query identifier
	ID string `json:"id"`

	// User who sent the query
	From User `json:"from"`

	// Bot-specified invoice payload
	InvoicePayload string `json:"invoice_payload"`

	// User specified shipping address
	ShippingAddress ShippingAddress `json:"shipping_address"`
}

ShippingQuery this object contains information about an incoming shipping query.

type StarAmount added in v0.16.0

type StarAmount struct {
	// Integer amount of Telegram Stars, rounded to 0; can be negative
	Amount int `json:"amount"`

	// Optional. The number of 1/1000000000 shares of Telegram Stars; from -999999999 to 999999999; can be negative if and only if amount is non-positive
	NanostarAmount int `json:"nanostar_amount,omitempty"`
}

StarAmount describes an amount of Telegram Stars.

type StarTransaction added in v0.16.0

type StarTransaction struct {
	// Unique identifier of the transaction. Coincides with the identifier of the original transaction for refund transactions. Coincides with SuccessfulPayment.telegram_payment_charge_id for successful incoming payments from users.
	ID string `json:"id"`

	// Integer amount of Telegram Stars transferred by the transaction
	Amount int `json:"amount"`

	// Optional. The number of 1/1000000000 shares of Telegram Stars transferred by the transaction; from 0 to 999999999
	NanostarAmount int `json:"nanostar_amount,omitempty"`

	// Date the transaction was created in Unix time
	Date UnixTime `json:"date"`

	// Optional. Source of an incoming transaction (e.g., a user purchasing goods or services, Fragment refunding a failed withdrawal). Only for incoming transactions
	Source *TransactionPartner `json:"source,omitempty"`

	// Optional. Receiver of an outgoing transaction (e.g., a user for a purchase refund, Fragment for a withdrawal). Only for outgoing transactions
	Receiver *TransactionPartner `json:"receiver,omitempty"`
}

StarTransaction describes a Telegram Star transaction. Note that if the buyer initiates a chargeback with the payment provider from whom they acquired Stars (e.g., Apple, Google) following this transaction, the refunded Stars will be deducted from the bot's balance. This is outside of Telegram's control.

type StarTransactions added in v0.16.0

type StarTransactions struct {
	// The list of transactions
	Transactions []StarTransaction `json:"transactions"`
}

StarTransactions contains a list of Telegram Star transactions.

type Sticker

type Sticker struct {
	// Identifier for this file, which can be used to download or reuse the file
	FileID FileID `json:"file_id"`

	// Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
	FileUniqueID string `json:"file_unique_id"`

	// Type of the sticker, currently one of “regular”, “mask”, “custom_emoji”. The type of the sticker is independent from its format, which is determined by the fields is_animated and is_video.
	Type StickerType `json:"type"`

	// Sticker width
	Width int `json:"width"`

	// Sticker height
	Height int `json:"height"`

	// True, if the sticker is [animated]
	//
	// [animated]: https://telegram.org/blog/animated-stickers
	IsAnimated bool `json:"is_animated"`

	// True, if the sticker is a [video sticker]
	//
	// [video sticker]: https://telegram.org/blog/video-stickers-better-reactions
	IsVideo bool `json:"is_video"`

	// Optional. Sticker thumbnail in the .WEBP or .JPG format
	Thumbnail *PhotoSize `json:"thumbnail,omitempty"`

	// Optional. Emoji associated with the sticker
	Emoji string `json:"emoji,omitempty"`

	// Optional. Name of the sticker set to which the sticker belongs
	SetName string `json:"set_name,omitempty"`

	// Optional. For premium regular stickers, premium animation for the sticker
	PremiumAnimation *File `json:"premium_animation,omitempty"`

	// Optional. For mask stickers, the position where the mask should be placed
	MaskPosition *MaskPosition `json:"mask_position,omitempty"`

	// Optional. For custom emoji stickers, unique identifier of the custom emoji
	CustomEmojiID string `json:"custom_emoji_id,omitempty"`

	// Optional. True, if the sticker must be repainted to a text color in messages, the color of the Telegram Premium badge in emoji status, white color on chat photos, or another appropriate color in other places
	NeedsRepainting bool `json:"needs_repainting,omitempty"`

	// Optional. File size in bytes
	FileSize int `json:"file_size,omitempty"`
}

Sticker this object represents a sticker.

type StickerFormat added in v0.17.0

type StickerFormat int8

StickerFormat represents an enum type.

const (
	StickerFormatUnknown  StickerFormat = iota
	StickerFormatStatic                 // "static"
	StickerFormatAnimated               // "animated"
	StickerFormatVideo                  // "video"
)

func (StickerFormat) IsUnknown added in v0.17.0

func (v StickerFormat) IsUnknown() bool

IsUnknown reports whether this value is unknown.

func (StickerFormat) MarshalText added in v0.17.0

func (v StickerFormat) MarshalText() ([]byte, error)

func (StickerFormat) String added in v0.17.0

func (v StickerFormat) String() string

func (*StickerFormat) UnmarshalText added in v0.17.0

func (v *StickerFormat) UnmarshalText(b []byte) error

type StickerSet

type StickerSet struct {
	// Sticker set name
	Name string `json:"name"`

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

	// Type of stickers in the set, currently one of “regular”, “mask”, “custom_emoji”
	StickerType StickerType `json:"sticker_type"`

	// List of all set stickers
	Stickers []Sticker `json:"stickers"`

	// Optional. Sticker set thumbnail in the .WEBP, .TGS, or .WEBM format
	Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
}

StickerSet this object represents a sticker set.

type StickerType added in v0.5.0

type StickerType int8

StickerType represents an enum type.

const (
	StickerTypeUnknown     StickerType = iota
	StickerTypeRegular                 // "regular"
	StickerTypeMask                    // "mask"
	StickerTypeCustomEmoji             // "custom_emoji"
)

func (StickerType) IsUnknown added in v0.16.0

func (v StickerType) IsUnknown() bool

IsUnknown reports whether this value is unknown.

func (StickerType) MarshalText added in v0.5.0

func (v StickerType) MarshalText() ([]byte, error)

func (StickerType) String added in v0.5.0

func (v StickerType) String() string

func (*StickerType) UnmarshalText added in v0.5.0

func (v *StickerType) UnmarshalText(b []byte) error

type StopMessageLiveLocationCall

type StopMessageLiveLocationCall struct {
	Call[Message]
}

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

func NewStopMessageLiveLocationCall

func NewStopMessageLiveLocationCall(chatID PeerID, messageID int) *StopMessageLiveLocationCall

NewStopMessageLiveLocationCall constructs a new StopMessageLiveLocationCall.

Required params:

  • chatID: Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • messageID: Required if inline_message_id is not specified. Identifier of the message with live location to stop

func NewStopMessageLiveLocationInlineCall

func NewStopMessageLiveLocationInlineCall(inlineMessageID string) *StopMessageLiveLocationCall

NewStopMessageLiveLocationInlineCall constructs a new StopMessageLiveLocationCall.

Required params:

  • inlineMessageID: Required if chat_id and message_id are not specified. Identifier of the inline message

func (*StopMessageLiveLocationCall) BusinessConnectionID added in v0.16.0

func (call *StopMessageLiveLocationCall) BusinessConnectionID(businessConnectionID string) *StopMessageLiveLocationCall

BusinessConnectionID sets the business_connection_id parameter.

func (*StopMessageLiveLocationCall) ChatID added in v0.0.5

ChatID sets the chat_id parameter.

func (*StopMessageLiveLocationCall) InlineMessageID added in v0.0.5

func (call *StopMessageLiveLocationCall) InlineMessageID(inlineMessageID string) *StopMessageLiveLocationCall

InlineMessageID sets the inline_message_id parameter.

func (*StopMessageLiveLocationCall) MessageID added in v0.0.5

func (call *StopMessageLiveLocationCall) MessageID(messageID int) *StopMessageLiveLocationCall

MessageID sets the message_id parameter.

func (*StopMessageLiveLocationCall) ReplyMarkup

ReplyMarkup sets the reply_markup parameter.

type StopPollCall

type StopPollCall struct {
	Call[Poll]
}

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

func NewStopPollCall

func NewStopPollCall(chatID PeerID, messageID int) *StopPollCall

NewStopPollCall constructs a new StopPollCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • messageID: Identifier of the original message with the poll

func (*StopPollCall) BusinessConnectionID added in v0.16.0

func (call *StopPollCall) BusinessConnectionID(businessConnectionID string) *StopPollCall

BusinessConnectionID sets the business_connection_id parameter.

func (*StopPollCall) ChatID added in v0.0.5

func (call *StopPollCall) ChatID(chatID PeerID) *StopPollCall

ChatID sets the chat_id parameter.

func (*StopPollCall) MessageID added in v0.0.5

func (call *StopPollCall) MessageID(messageID int) *StopPollCall

MessageID sets the message_id parameter.

func (*StopPollCall) ReplyMarkup

func (call *StopPollCall) ReplyMarkup(replyMarkup InlineKeyboardMarkup) *StopPollCall

ReplyMarkup sets the reply_markup parameter.

type Story added in v0.10.0

type Story struct {
	// Chat that posted the story
	Chat Chat `json:"chat"`

	// Unique identifier for the story in the chat
	ID int `json:"id"`
}

Story this object represents a story.

type StoryArea added in v0.16.0

type StoryArea struct {
	// Position of the area
	Position StoryAreaPosition `json:"position"`

	// Type of the area
	Type StoryAreaType `json:"type"`
}

StoryArea describes a clickable area on a story media.

type StoryAreaPosition added in v0.16.0

type StoryAreaPosition struct {
	// The abscissa of the area's center, as a percentage of the media width
	XPercentage float64 `json:"x_percentage"`

	// The ordinate of the area's center, as a percentage of the media height
	YPercentage float64 `json:"y_percentage"`

	// The width of the area's rectangle, as a percentage of the media width
	WidthPercentage float64 `json:"width_percentage"`

	// The height of the area's rectangle, as a percentage of the media height
	HeightPercentage float64 `json:"height_percentage"`

	// The clockwise rotation angle of the rectangle, in degrees; 0-360
	RotationAngle float64 `json:"rotation_angle"`

	// The radius of the rectangle corner rounding, as a percentage of the media width
	CornerRadiusPercentage float64 `json:"corner_radius_percentage"`
}

StoryAreaPosition describes the position of a clickable area within a story.

type StoryAreaType added in v0.16.0

type StoryAreaType struct {
	Location          *StoryAreaTypeLocation
	SuggestedReaction *StoryAreaTypeSuggestedReaction
	Link              *StoryAreaTypeLink
	Weather           *StoryAreaTypeWeather
	UniqueGift        *StoryAreaTypeUniqueGift
	Unknown           *UnknownVariant
}

StoryAreaType describes the type of a clickable area on a story. Currently, it can be one of

func StoryAreaTypeOf added in v0.17.0

func StoryAreaTypeOf(values ...StoryAreaTypeClass) []StoryAreaType

StoryAreaTypeOf converts StoryAreaTypeClass arguments to a slice of StoryAreaType.

func (StoryAreaType) AsStoryAreaType added in v0.17.0

func (u StoryAreaType) AsStoryAreaType() StoryAreaType

AsStoryAreaType returns the union as-is, implementing StoryAreaTypeClass.

func (*StoryAreaType) IsUnknown added in v0.16.0

func (u *StoryAreaType) IsUnknown() bool

IsUnknown reports whether this union contains an unknown variant. This can happen when the API returns a new variant not yet supported by this library.

func (StoryAreaType) MarshalJSON added in v0.16.0

func (u StoryAreaType) MarshalJSON() ([]byte, error)

func (*StoryAreaType) Type added in v0.16.0

func (u *StoryAreaType) Type() StoryAreaTypeType

Type returns the discriminator value for this union.

func (*StoryAreaType) UnmarshalJSON added in v0.16.0

func (u *StoryAreaType) UnmarshalJSON(data []byte) error

type StoryAreaTypeClass added in v0.17.0

type StoryAreaTypeClass interface {
	AsStoryAreaType() StoryAreaType
}

StoryAreaTypeClass is an interface for types that can be used as StoryAreaType.

Known implementations:

type StoryAreaTypeLink struct {
	// HTTP or tg:// URL to be opened when the area is clicked
	URL string `json:"url"`
}

StoryAreaTypeLink describes a story area pointing to an HTTP or tg:// link. Currently, a story can have up to 3 link areas.

func NewStoryAreaTypeLink(url string) *StoryAreaTypeLink

NewStoryAreaTypeLink creates a new StoryAreaTypeLink.

func (*StoryAreaTypeLink) AsStoryAreaType added in v0.17.0

func (v *StoryAreaTypeLink) AsStoryAreaType() StoryAreaType

AsStoryAreaType wraps the variant into a StoryAreaType union.

type StoryAreaTypeLocation added in v0.16.0

type StoryAreaTypeLocation struct {
	// Location latitude in degrees
	Latitude float64 `json:"latitude"`

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

	// Optional. Address of the location
	Address *LocationAddress `json:"address,omitempty"`
}

StoryAreaTypeLocation describes a story area pointing to a location. Currently, a story can have up to 10 location areas.

func NewStoryAreaTypeLocation added in v0.16.0

func NewStoryAreaTypeLocation(latitude float64, longitude float64) *StoryAreaTypeLocation

NewStoryAreaTypeLocation creates a new StoryAreaTypeLocation.

func (*StoryAreaTypeLocation) AsStoryAreaType added in v0.17.0

func (v *StoryAreaTypeLocation) AsStoryAreaType() StoryAreaType

AsStoryAreaType wraps the variant into a StoryAreaType union.

func (*StoryAreaTypeLocation) WithAddress added in v0.17.0

WithAddress sets the Address field.

type StoryAreaTypeSuggestedReaction added in v0.16.0

type StoryAreaTypeSuggestedReaction struct {
	// Type of the reaction
	ReactionType ReactionType `json:"reaction_type"`

	// Optional. Pass True if the reaction area has a dark background
	IsDark bool `json:"is_dark,omitempty"`

	// Optional. Pass True if reaction area corner is flipped
	IsFlipped bool `json:"is_flipped,omitempty"`
}

StoryAreaTypeSuggestedReaction describes a story area pointing to a suggested reaction. Currently, a story can have up to 5 suggested reaction areas.

func NewStoryAreaTypeSuggestedReaction added in v0.16.0

func NewStoryAreaTypeSuggestedReaction(reactionType ReactionType) *StoryAreaTypeSuggestedReaction

NewStoryAreaTypeSuggestedReaction creates a new StoryAreaTypeSuggestedReaction.

func (*StoryAreaTypeSuggestedReaction) AsStoryAreaType added in v0.17.0

func (v *StoryAreaTypeSuggestedReaction) AsStoryAreaType() StoryAreaType

AsStoryAreaType wraps the variant into a StoryAreaType union.

func (*StoryAreaTypeSuggestedReaction) WithIsDark added in v0.17.0

WithIsDark sets the IsDark field.

func (*StoryAreaTypeSuggestedReaction) WithIsFlipped added in v0.17.0

WithIsFlipped sets the IsFlipped field.

type StoryAreaTypeType added in v0.16.0

type StoryAreaTypeType int

StoryAreaTypeType represents the type of StoryAreaType.

const (
	StoryAreaTypeTypeLocation          StoryAreaTypeType = iota + 1 // "location"
	StoryAreaTypeTypeSuggestedReaction                              // "suggested_reaction"
	StoryAreaTypeTypeLink                                           // "link"
	StoryAreaTypeTypeWeather                                        // "weather"
	StoryAreaTypeTypeUniqueGift                                     // "unique_gift"
)

func (StoryAreaTypeType) MarshalText added in v0.16.0

func (v StoryAreaTypeType) MarshalText() ([]byte, error)

func (StoryAreaTypeType) String added in v0.16.0

func (v StoryAreaTypeType) String() string

func (*StoryAreaTypeType) UnmarshalText added in v0.16.0

func (v *StoryAreaTypeType) UnmarshalText(b []byte) error

type StoryAreaTypeUniqueGift added in v0.16.0

type StoryAreaTypeUniqueGift struct {
	// Unique name of the gift
	Name string `json:"name"`
}

StoryAreaTypeUniqueGift describes a story area pointing to a unique gift. Currently, a story can have at most 1 unique gift area.

func NewStoryAreaTypeUniqueGift added in v0.16.0

func NewStoryAreaTypeUniqueGift(name string) *StoryAreaTypeUniqueGift

NewStoryAreaTypeUniqueGift creates a new StoryAreaTypeUniqueGift.

func (*StoryAreaTypeUniqueGift) AsStoryAreaType added in v0.17.0

func (v *StoryAreaTypeUniqueGift) AsStoryAreaType() StoryAreaType

AsStoryAreaType wraps the variant into a StoryAreaType union.

type StoryAreaTypeWeather added in v0.16.0

type StoryAreaTypeWeather struct {
	// Temperature, in degree Celsius
	Temperature float64 `json:"temperature"`

	// Emoji representing the weather
	Emoji string `json:"emoji"`

	// A color of the area background in the ARGB format
	BackgroundColor int `json:"background_color"`
}

StoryAreaTypeWeather describes a story area containing weather information. Currently, a story can have up to 3 weather areas.

func NewStoryAreaTypeWeather added in v0.16.0

func NewStoryAreaTypeWeather(temperature float64, emoji string, backgroundColor int) *StoryAreaTypeWeather

NewStoryAreaTypeWeather creates a new StoryAreaTypeWeather.

func (*StoryAreaTypeWeather) AsStoryAreaType added in v0.17.0

func (v *StoryAreaTypeWeather) AsStoryAreaType() StoryAreaType

AsStoryAreaType wraps the variant into a StoryAreaType union.

type SuccessfulPayment

type SuccessfulPayment struct {
	// Three-letter ISO 4217 [currency] code, or “XTR” for payments in [Telegram Stars]
	//
	// [currency]: https://core.telegram.org/bots/payments#supported-currencies
	// [Telegram Stars]: https://t.me/BotNews/90
	Currency string `json:"currency"`

	// Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in [currencies.json], it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
	//
	// [currencies.json]: https://core.telegram.org/bots/payments/currencies.json
	TotalAmount int `json:"total_amount"`

	// Bot-specified invoice payload
	InvoicePayload string `json:"invoice_payload"`

	// Optional. Expiration date of the subscription, in Unix time; for recurring payments only
	SubscriptionExpirationDate UnixTime `json:"subscription_expiration_date,omitempty"`

	// Optional. True, if the payment is a recurring payment for a subscription
	IsRecurring bool `json:"is_recurring,omitempty"`

	// Optional. True, if the payment is the first payment for a subscription
	IsFirstRecurring bool `json:"is_first_recurring,omitempty"`

	// Optional. Identifier of the shipping option chosen by the user
	ShippingOptionID string `json:"shipping_option_id,omitempty"`

	// Optional. Order information provided by the user
	OrderInfo *OrderInfo `json:"order_info,omitempty"`

	// Telegram payment identifier
	TelegramPaymentChargeID string `json:"telegram_payment_charge_id"`

	// Provider payment identifier
	ProviderPaymentChargeID string `json:"provider_payment_charge_id"`
}

SuccessfulPayment this object contains basic information about a successful payment. Note that if the buyer initiates a chargeback with the relevant payment provider following this transaction, the funds may be debited from your balance. This is outside of Telegram's control.

type SuggestedPostApprovalFailed added in v0.16.0

type SuggestedPostApprovalFailed struct {
	// Optional. Message containing the suggested post whose approval has failed. Note that the [Message] object in this field will not contain the reply_to_message field even if it itself is a reply.
	SuggestedPostMessage *Message `json:"suggested_post_message,omitempty"`

	// Expected price of the post
	Price SuggestedPostPrice `json:"price"`
}

SuggestedPostApprovalFailed describes a service message about the failed approval of a suggested post. Currently, only caused by insufficient user funds at the time of approval.

type SuggestedPostApproved added in v0.16.0

type SuggestedPostApproved struct {
	// Optional. Message containing the suggested post. Note that the [Message] object in this field will not contain the reply_to_message field even if it itself is a reply.
	SuggestedPostMessage *Message `json:"suggested_post_message,omitempty"`

	// Optional. Amount paid for the post
	Price *SuggestedPostPrice `json:"price,omitempty"`

	// Date when the post will be published
	SendDate int `json:"send_date"`
}

SuggestedPostApproved describes a service message about the approval of a suggested post.

type SuggestedPostDeclined added in v0.16.0

type SuggestedPostDeclined struct {
	// Optional. Message containing the suggested post. Note that the [Message] object in this field will not contain the reply_to_message field even if it itself is a reply.
	SuggestedPostMessage *Message `json:"suggested_post_message,omitempty"`

	// Optional. Comment with which the post was declined
	Comment string `json:"comment,omitempty"`
}

SuggestedPostDeclined describes a service message about the rejection of a suggested post.

type SuggestedPostInfo added in v0.16.0

type SuggestedPostInfo struct {
	// State of the suggested post. Currently, it can be one of “pending”, “approved”, “declined”.
	State string `json:"state"`

	// Optional. Proposed price of the post. If the field is omitted, then the post is unpaid.
	Price *SuggestedPostPrice `json:"price,omitempty"`

	// Optional. Proposed send date of the post. If the field is omitted, then the post can be published at any time within 30 days at the sole discretion of the user or administrator who approves it.
	SendDate int `json:"send_date,omitempty"`
}

SuggestedPostInfo contains information about a suggested post.

type SuggestedPostPaid added in v0.16.0

type SuggestedPostPaid struct {
	// Optional. Message containing the suggested post. Note that the [Message] object in this field will not contain the reply_to_message field even if it itself is a reply.
	SuggestedPostMessage *Message `json:"suggested_post_message,omitempty"`

	// Currency in which the payment was made. Currently, one of “XTR” for Telegram Stars or “TON” for toncoins
	Currency Currency `json:"currency"`

	// Optional. The amount of the currency that was received by the channel in nanotoncoins; for payments in toncoins only
	Amount int `json:"amount,omitempty"`

	// Optional. The amount of Telegram Stars that was received by the channel; for payments in Telegram Stars only
	StarAmount *StarAmount `json:"star_amount,omitempty"`
}

SuggestedPostPaid describes a service message about a successful payment for a suggested post.

type SuggestedPostParameters added in v0.16.0

type SuggestedPostParameters struct {
	// Optional. Proposed price for the post. If the field is omitted, then the post is unpaid.
	Price *SuggestedPostPrice `json:"price,omitempty"`

	// Optional. Proposed send date of the post. If specified, then the date must be between 300 second and 2678400 seconds (30 days) in the future. If the field is omitted, then the post can be published at any time within 30 days at the sole discretion of the user who approves it.
	SendDate int `json:"send_date,omitempty"`
}

SuggestedPostParameters contains parameters of a post that is being suggested by the bot.

type SuggestedPostPrice added in v0.16.0

type SuggestedPostPrice struct {
	// Currency in which the post will be paid. Currently, must be one of “XTR” for Telegram Stars or “TON” for toncoins
	Currency Currency `json:"currency"`

	// The amount of the currency that will be paid for the post in the smallest units of the currency, i.e. Telegram Stars or nanotoncoins. Currently, price in Telegram Stars must be between 5 and 100000, and price in nanotoncoins must be between 10000000 and 10000000000000.
	Amount int `json:"amount"`
}

SuggestedPostPrice describes the price of a suggested post.

type SuggestedPostRefunded added in v0.16.0

type SuggestedPostRefunded struct {
	// Optional. Message containing the suggested post. Note that the [Message] object in this field will not contain the reply_to_message field even if it itself is a reply.
	SuggestedPostMessage *Message `json:"suggested_post_message,omitempty"`

	// Reason for the refund. Currently, one of “post_deleted” if the post was deleted within 24 hours of being posted or removed from scheduled messages without being posted, or “payment_refunded” if the payer refunded their payment.
	Reason string `json:"reason"`
}

SuggestedPostRefunded describes a service message about a payment refund for a suggested post.

type SwitchInlineQueryChosenChat added in v0.9.0

type SwitchInlineQueryChosenChat struct {
	// Optional. The default inline query to be inserted in the input field. If left empty, only the bot's username will be inserted
	Query string `json:"query,omitempty"`

	// Optional. True, if private chats with users can be chosen
	AllowUserChats bool `json:"allow_user_chats,omitempty"`

	// Optional. True, if private chats with bots can be chosen
	AllowBotChats bool `json:"allow_bot_chats,omitempty"`

	// Optional. True, if group and supergroup chats can be chosen
	AllowGroupChats bool `json:"allow_group_chats,omitempty"`

	// Optional. True, if channel chats can be chosen
	AllowChannelChats bool `json:"allow_channel_chats,omitempty"`
}

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

type TextQuote added in v0.12.0

type TextQuote struct {
	// Text of the quoted part of a message that is replied to by the given message
	Text string `json:"text"`

	// Optional. Special entities that appear in the quote. Currently, only bold, italic, underline, strikethrough, spoiler, and custom_emoji entities are kept in quotes.
	Entities []MessageEntity `json:"entities,omitempty"`

	// Approximate quote position in the original message in UTF-16 code units as specified by the sender
	Position int `json:"position"`

	// Optional. True, if the quote was chosen manually by the message sender. Otherwise, the quote was added automatically by the server.
	IsManual bool `json:"is_manual,omitempty"`
}

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

type TopicIconColor added in v0.17.0

type TopicIconColor int

TopicIconColor represents the color of a forum topic icon in RGB format.

const (
	TopicIconColorBlue   TopicIconColor = 0x6FB9F0
	TopicIconColorYellow TopicIconColor = 0xFFD67E
	TopicIconColorPurple TopicIconColor = 0xCB86DB
	TopicIconColorGreen  TopicIconColor = 0x8EEE98
	TopicIconColorPink   TopicIconColor = 0xFF93B2
	TopicIconColorRed    TopicIconColor = 0xFB6F5F
)

type TransactionPartner added in v0.16.0

TransactionPartner this object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of

func (*TransactionPartner) IsUnknown added in v0.16.0

func (u *TransactionPartner) IsUnknown() bool

IsUnknown reports whether this union contains an unknown variant. This can happen when the API returns a new variant not yet supported by this library.

func (TransactionPartner) MarshalJSON added in v0.16.0

func (u TransactionPartner) MarshalJSON() ([]byte, error)

func (*TransactionPartner) Type added in v0.16.0

Type returns the discriminator value for this union.

func (*TransactionPartner) UnmarshalJSON added in v0.16.0

func (u *TransactionPartner) UnmarshalJSON(data []byte) error

type TransactionPartnerAffiliateProgram added in v0.16.0

type TransactionPartnerAffiliateProgram struct {
	// Optional. Information about the bot that sponsored the affiliate program
	SponsorUser *User `json:"sponsor_user,omitempty"`

	// The number of Telegram Stars received by the bot for each 1000 Telegram Stars received by the affiliate program sponsor from referred users
	CommissionPerMille int `json:"commission_per_mille"`
}

TransactionPartnerAffiliateProgram describes the affiliate program that issued the affiliate commission received via this transaction.

type TransactionPartnerChat added in v0.16.0

type TransactionPartnerChat struct {
	// Information about the chat
	Chat Chat `json:"chat"`

	// Optional. The gift sent to the chat by the bot
	Gift *Gift `json:"gift,omitempty"`
}

TransactionPartnerChat describes a transaction with a chat.

type TransactionPartnerFragment added in v0.16.0

type TransactionPartnerFragment struct {
	// Optional. State of the transaction if the transaction is outgoing
	WithdrawalState *RevenueWithdrawalState `json:"withdrawal_state,omitempty"`
}

TransactionPartnerFragment describes a withdrawal transaction with Fragment.

type TransactionPartnerOther added in v0.16.0

type TransactionPartnerOther struct{}

TransactionPartnerOther describes a transaction with an unknown source or recipient.

type TransactionPartnerTelegramAPI added in v0.16.0

type TransactionPartnerTelegramAPI struct {
	// The number of successful requests that exceeded regular limits and were therefore billed
	RequestCount int `json:"request_count"`
}

TransactionPartnerTelegramAPI describes a transaction with payment for paid broadcasting.

type TransactionPartnerTelegramAds added in v0.16.0

type TransactionPartnerTelegramAds struct{}

TransactionPartnerTelegramAds describes a withdrawal transaction to the Telegram Ads platform.

type TransactionPartnerType added in v0.16.0

type TransactionPartnerType int

TransactionPartnerType represents the type of TransactionPartner.

const (
	TransactionPartnerTypeUser             TransactionPartnerType = iota + 1 // "user"
	TransactionPartnerTypeChat                                               // "chat"
	TransactionPartnerTypeAffiliateProgram                                   // "affiliate_program"
	TransactionPartnerTypeFragment                                           // "fragment"
	TransactionPartnerTypeTelegramAds                                        // "telegram_ads"
	TransactionPartnerTypeTelegramAPI                                        // "telegram_api"
	TransactionPartnerTypeOther                                              // "other"
)

func (TransactionPartnerType) MarshalText added in v0.16.0

func (v TransactionPartnerType) MarshalText() ([]byte, error)

func (TransactionPartnerType) String added in v0.16.0

func (v TransactionPartnerType) String() string

func (*TransactionPartnerType) UnmarshalText added in v0.16.0

func (v *TransactionPartnerType) UnmarshalText(b []byte) error

type TransactionPartnerUser added in v0.16.0

type TransactionPartnerUser struct {
	// Type of the transaction, currently one of “invoice_payment” for payments via invoices, “paid_media_payment” for payments for paid media, “gift_purchase” for gifts sent by the bot, “premium_purchase” for Telegram Premium subscriptions gifted by the bot, “business_account_transfer” for direct transfers from managed business accounts
	TransactionType TransactionPartnerUserTransactionTypeEnum `json:"transaction_type"`

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

	// Optional. Information about the affiliate that received a commission via this transaction. Can be available only for “invoice_payment” and “paid_media_payment” transactions.
	Affiliate *AffiliateInfo `json:"affiliate,omitempty"`

	// Optional. Bot-specified invoice payload. Can be available only for “invoice_payment” transactions.
	InvoicePayload string `json:"invoice_payload,omitempty"`

	// Optional. The duration of the paid subscription. Can be available only for “invoice_payment” transactions.
	SubscriptionPeriod int `json:"subscription_period,omitempty"`

	// Optional. Information about the paid media bought by the user; for “paid_media_payment” transactions only
	PaidMedia []PaidMedia `json:"paid_media,omitempty"`

	// Optional. Bot-specified paid media payload. Can be available only for “paid_media_payment” transactions.
	PaidMediaPayload string `json:"paid_media_payload,omitempty"`

	// Optional. The gift sent to the user by the bot; for “gift_purchase” transactions only
	Gift *Gift `json:"gift,omitempty"`

	// Optional. Number of months the gifted Telegram Premium subscription will be active for; for “premium_purchase” transactions only
	PremiumSubscriptionDuration int `json:"premium_subscription_duration,omitempty"`
}

TransactionPartnerUser describes a transaction with a user.

type TransactionPartnerUserTransactionTypeEnum added in v0.17.0

type TransactionPartnerUserTransactionTypeEnum int8

TransactionPartnerUserTransactionTypeEnum represents an enum type.

const (
	TransactionPartnerUserTransactionTypeEnumUnknown                 TransactionPartnerUserTransactionTypeEnum = iota
	TransactionPartnerUserTransactionTypeEnumInvoicePayment                                                    // "invoice_payment"
	TransactionPartnerUserTransactionTypeEnumPaidMediaPayment                                                  // "paid_media_payment"
	TransactionPartnerUserTransactionTypeEnumGiftPurchase                                                      // "gift_purchase"
	TransactionPartnerUserTransactionTypeEnumPremiumPurchase                                                   // "premium_purchase"
	TransactionPartnerUserTransactionTypeEnumBusinessAccountTransfer                                           // "business_account_transfer"
)

func (TransactionPartnerUserTransactionTypeEnum) IsUnknown added in v0.17.0

IsUnknown reports whether this value is unknown.

func (TransactionPartnerUserTransactionTypeEnum) MarshalText added in v0.17.0

func (TransactionPartnerUserTransactionTypeEnum) String added in v0.17.0

func (*TransactionPartnerUserTransactionTypeEnum) UnmarshalText added in v0.17.0

type TransferBusinessAccountStarsCall added in v0.16.0

type TransferBusinessAccountStarsCall struct {
	CallNoResult
}

TransferBusinessAccountStarsCall represents a call to the transferBusinessAccountStars method. Transfers Telegram Stars from the business account balance to the bot's balance. Requires the can_transfer_stars business bot right. Returns True on success.

func NewTransferBusinessAccountStarsCall added in v0.16.0

func NewTransferBusinessAccountStarsCall(businessConnectionID string, starCount int) *TransferBusinessAccountStarsCall

NewTransferBusinessAccountStarsCall constructs a new TransferBusinessAccountStarsCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection
  • starCount: Number of Telegram Stars to transfer; 1-10000

func (*TransferBusinessAccountStarsCall) BusinessConnectionID added in v0.16.0

func (call *TransferBusinessAccountStarsCall) BusinessConnectionID(businessConnectionID string) *TransferBusinessAccountStarsCall

BusinessConnectionID sets the business_connection_id parameter.

func (*TransferBusinessAccountStarsCall) StarCount added in v0.16.0

StarCount sets the star_count parameter.

type TransferGiftCall added in v0.16.0

type TransferGiftCall struct {
	CallNoResult
}

TransferGiftCall represents a call to the transferGift method. Transfers an owned unique gift to another user. Requires the can_transfer_and_upgrade_gifts business bot right. Requires can_transfer_stars business bot right if the transfer is paid. Returns True on success.

func NewTransferGiftCall added in v0.16.0

func NewTransferGiftCall(businessConnectionID string, ownedGiftID string, newOwnerChatID int) *TransferGiftCall

NewTransferGiftCall constructs a new TransferGiftCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection
  • ownedGiftID: Unique identifier of the regular gift that should be transferred
  • newOwnerChatID: Unique identifier of the chat which will own the gift. The chat must be active in the last 24 hours.

func (*TransferGiftCall) BusinessConnectionID added in v0.16.0

func (call *TransferGiftCall) BusinessConnectionID(businessConnectionID string) *TransferGiftCall

BusinessConnectionID sets the business_connection_id parameter.

func (*TransferGiftCall) NewOwnerChatID added in v0.16.0

func (call *TransferGiftCall) NewOwnerChatID(newOwnerChatID int) *TransferGiftCall

NewOwnerChatID sets the new_owner_chat_id parameter.

func (*TransferGiftCall) OwnedGiftID added in v0.16.0

func (call *TransferGiftCall) OwnedGiftID(ownedGiftID string) *TransferGiftCall

OwnedGiftID sets the owned_gift_id parameter.

func (*TransferGiftCall) StarCount added in v0.16.0

func (call *TransferGiftCall) StarCount(starCount int) *TransferGiftCall

StarCount sets the star_count parameter.

type UnbanChatMemberCall

type UnbanChatMemberCall struct {
	CallNoResult
}

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

func NewUnbanChatMemberCall

func NewUnbanChatMemberCall(chatID PeerID, userID UserID) *UnbanChatMemberCall

NewUnbanChatMemberCall constructs a new UnbanChatMemberCall.

Required params:

  • chatID: Unique identifier for the target group or username of the target supergroup or channel (in the format @channelusername)
  • userID: Unique identifier of the target user

func (*UnbanChatMemberCall) ChatID added in v0.0.5

func (call *UnbanChatMemberCall) ChatID(chatID PeerID) *UnbanChatMemberCall

ChatID sets the chat_id parameter.

func (*UnbanChatMemberCall) OnlyIfBanned

func (call *UnbanChatMemberCall) OnlyIfBanned(onlyIfBanned bool) *UnbanChatMemberCall

OnlyIfBanned sets the only_if_banned parameter.

func (*UnbanChatMemberCall) UserID added in v0.0.5

func (call *UnbanChatMemberCall) UserID(userID UserID) *UnbanChatMemberCall

UserID sets the user_id parameter.

type UnbanChatSenderChatCall

type UnbanChatSenderChatCall struct {
	CallNoResult
}

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

func NewUnbanChatSenderChatCall

func NewUnbanChatSenderChatCall(chatID PeerID, senderChatID int) *UnbanChatSenderChatCall

NewUnbanChatSenderChatCall constructs a new UnbanChatSenderChatCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
  • senderChatID: Unique identifier of the target sender chat

func (*UnbanChatSenderChatCall) ChatID added in v0.0.5

ChatID sets the chat_id parameter.

func (*UnbanChatSenderChatCall) SenderChatID added in v0.0.5

func (call *UnbanChatSenderChatCall) SenderChatID(senderChatID int) *UnbanChatSenderChatCall

SenderChatID sets the sender_chat_id parameter.

type UnhideGeneralForumTopicCall added in v0.6.0

type UnhideGeneralForumTopicCall struct {
	CallNoResult
}

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

func NewUnhideGeneralForumTopicCall added in v0.6.0

func NewUnhideGeneralForumTopicCall(chatID PeerID) *UnhideGeneralForumTopicCall

NewUnhideGeneralForumTopicCall constructs a new UnhideGeneralForumTopicCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

func (*UnhideGeneralForumTopicCall) ChatID added in v0.6.0

ChatID sets the chat_id parameter.

type UniqueGift added in v0.16.0

type UniqueGift struct {
	// Identifier of the regular gift from which the gift was upgraded
	GiftID string `json:"gift_id"`

	// Human-readable name of the regular gift from which this unique gift was upgraded
	BaseName string `json:"base_name"`

	// Unique name of the gift. This name can be used in https://t.me/nft/... links and story areas
	Name string `json:"name"`

	// Unique number of the upgraded gift among gifts upgraded from the same regular gift
	Number int `json:"number"`

	// Model of the gift
	Model UniqueGiftModel `json:"model"`

	// Symbol of the gift
	Symbol UniqueGiftSymbol `json:"symbol"`

	// Backdrop of the gift
	Backdrop UniqueGiftBackdrop `json:"backdrop"`

	// Optional. True, if the original regular gift was exclusively purchaseable by Telegram Premium subscribers
	IsPremium bool `json:"is_premium,omitempty"`

	// Optional. True, if the gift was used to craft another gift and isn't available anymore
	IsBurned bool `json:"is_burned,omitempty"`

	// Optional. True, if the gift is assigned from the TON blockchain and can't be resold or transferred in Telegram
	IsFromBlockchain bool `json:"is_from_blockchain,omitempty"`

	// Optional. The color scheme that can be used by the gift's owner for the chat's name, replies to messages and link previews; for business account gifts and gifts that are currently on sale only
	Colors *UniqueGiftColors `json:"colors,omitempty"`

	// Optional. Information about the chat that published the gift
	PublisherChat *Chat `json:"publisher_chat,omitempty"`
}

UniqueGift this object describes a unique gift that was upgraded from a regular gift.

type UniqueGiftBackdrop added in v0.16.0

type UniqueGiftBackdrop struct {
	// Name of the backdrop
	Name string `json:"name"`

	// Colors of the backdrop
	Colors UniqueGiftBackdropColors `json:"colors"`

	// The number of unique gifts that receive this backdrop for every 1000 gifts upgraded
	RarityPerMille int `json:"rarity_per_mille"`
}

UniqueGiftBackdrop this object describes the backdrop of a unique gift.

type UniqueGiftBackdropColors added in v0.16.0

type UniqueGiftBackdropColors struct {
	// The color in the center of the backdrop in RGB format
	CenterColor int `json:"center_color"`

	// The color on the edges of the backdrop in RGB format
	EdgeColor int `json:"edge_color"`

	// The color to be applied to the symbol in RGB format
	SymbolColor int `json:"symbol_color"`

	// The color for the text on the backdrop in RGB format
	TextColor int `json:"text_color"`
}

UniqueGiftBackdropColors this object describes the colors of the backdrop of a unique gift.

type UniqueGiftColors added in v0.16.0

type UniqueGiftColors struct {
	// Custom emoji identifier of the unique gift's model
	ModelCustomEmojiID string `json:"model_custom_emoji_id"`

	// Custom emoji identifier of the unique gift's symbol
	SymbolCustomEmojiID string `json:"symbol_custom_emoji_id"`

	// Main color used in light themes; RGB format
	LightThemeMainColor int `json:"light_theme_main_color"`

	// List of 1-3 additional colors used in light themes; RGB format
	LightThemeOtherColors []int `json:"light_theme_other_colors"`

	// Main color used in dark themes; RGB format
	DarkThemeMainColor int `json:"dark_theme_main_color"`

	// List of 1-3 additional colors used in dark themes; RGB format
	DarkThemeOtherColors []int `json:"dark_theme_other_colors"`
}

UniqueGiftColors this object contains information about the color scheme for a user's name, message replies and link previews based on a unique gift.

type UniqueGiftInfo added in v0.16.0

type UniqueGiftInfo struct {
	// Information about the gift
	Gift UniqueGift `json:"gift"`

	// Origin of the gift. Currently, either “upgrade” for gifts upgraded from regular gifts, “transfer” for gifts transferred from other users or channels, “resale” for gifts bought from other users, “gifted_upgrade” for upgrades purchased after the gift was sent, or “offer” for gifts bought or sold through gift purchase offers
	Origin string `json:"origin"`

	// Optional. For gifts bought from other users, the currency in which the payment for the gift was done. Currently, one of “XTR” for Telegram Stars or “TON” for toncoins.
	LastResaleCurrency string `json:"last_resale_currency,omitempty"`

	// Optional. For gifts bought from other users, the price paid for the gift in either Telegram Stars or nanotoncoins
	LastResaleAmount int `json:"last_resale_amount,omitempty"`

	// Optional. Unique identifier of the received gift for the bot; only present for gifts received on behalf of business accounts
	OwnedGiftID string `json:"owned_gift_id,omitempty"`

	// Optional. Number of Telegram Stars that must be paid to transfer the gift; omitted if the bot cannot transfer the gift
	TransferStarCount int `json:"transfer_star_count,omitempty"`

	// Optional. Point in time (Unix timestamp) when the gift can be transferred. If it is in the past, then the gift can be transferred now
	NextTransferDate UnixTime `json:"next_transfer_date,omitempty"`
}

UniqueGiftInfo describes a service message about a unique gift that was sent or received.

type UniqueGiftModel added in v0.16.0

type UniqueGiftModel struct {
	// Name of the model
	Name string `json:"name"`

	// The sticker that represents the unique gift
	Sticker Sticker `json:"sticker"`

	// The number of unique gifts that receive this model for every 1000 gift upgrades. Always 0 for crafted gifts.
	RarityPerMille int `json:"rarity_per_mille"`

	// Optional. Rarity of the model if it is a crafted model. Currently, can be “uncommon”, “rare”, “epic”, or “legendary”.
	Rarity UniqueGiftModelRarity `json:"rarity,omitempty"`
}

UniqueGiftModel this object describes the model of a unique gift.

type UniqueGiftModelRarity added in v0.18.0

type UniqueGiftModelRarity int8

UniqueGiftModelRarity represents an enum type.

const (
	UniqueGiftModelRarityUnknown   UniqueGiftModelRarity = iota
	UniqueGiftModelRarityUncommon                        // "uncommon"
	UniqueGiftModelRarityRare                            // "rare"
	UniqueGiftModelRarityEpic                            // "epic"
	UniqueGiftModelRarityLegendary                       // "legendary"
)

func (UniqueGiftModelRarity) IsUnknown added in v0.18.0

func (v UniqueGiftModelRarity) IsUnknown() bool

IsUnknown reports whether this value is unknown.

func (UniqueGiftModelRarity) MarshalText added in v0.18.0

func (v UniqueGiftModelRarity) MarshalText() ([]byte, error)

func (UniqueGiftModelRarity) String added in v0.18.0

func (v UniqueGiftModelRarity) String() string

func (*UniqueGiftModelRarity) UnmarshalText added in v0.18.0

func (v *UniqueGiftModelRarity) UnmarshalText(b []byte) error

type UniqueGiftSymbol added in v0.16.0

type UniqueGiftSymbol struct {
	// Name of the symbol
	Name string `json:"name"`

	// The sticker that represents the unique gift
	Sticker Sticker `json:"sticker"`

	// The number of unique gifts that receive this model for every 1000 gifts upgraded
	RarityPerMille int `json:"rarity_per_mille"`
}

UniqueGiftSymbol this object describes the symbol shown on the pattern of a unique gift.

type UnixTime added in v0.16.0

type UnixTime int64

UnixTime represents a Unix timestamp (seconds since epoch). It is stored as int64 and serializes to/from JSON as an integer.

func (UnixTime) IsZero added in v0.16.0

func (t UnixTime) IsZero() bool

IsZero reports whether the timestamp is zero (unset).

func (UnixTime) Time added in v0.16.0

func (t UnixTime) Time() time.Time

Time converts the Unix timestamp to time.Time. Returns the zero time.Time for UnixTime(0).

type UnknownVariant added in v0.16.0

type UnknownVariant struct {
	Type string
	Data json.RawMessage
}

UnknownVariant stores data for unknown union variants. This provides forward compatibility when new variants are added to the API.

type UnpinAllChatMessagesCall

type UnpinAllChatMessagesCall struct {
	CallNoResult
}

UnpinAllChatMessagesCall represents a call to the unpinAllChatMessages method. Use this method to clear the list of pinned messages in a chat. In private chats and channel direct messages chats, no additional rights are required to unpin all pinned messages. Conversely, the bot must be an administrator with the 'can_pin_messages' right or the 'can_edit_messages' right to unpin all pinned messages in groups and channels respectively. Returns True on success.

func NewUnpinAllChatMessagesCall

func NewUnpinAllChatMessagesCall(chatID PeerID) *UnpinAllChatMessagesCall

NewUnpinAllChatMessagesCall constructs a new UnpinAllChatMessagesCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*UnpinAllChatMessagesCall) ChatID added in v0.0.5

ChatID sets the chat_id parameter.

type UnpinAllForumTopicMessagesCall added in v0.6.0

type UnpinAllForumTopicMessagesCall struct {
	CallNoResult
}

UnpinAllForumTopicMessagesCall represents a call to the unpinAllForumTopicMessages method. Use this method to clear the list of pinned messages in a forum topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success.

func NewUnpinAllForumTopicMessagesCall added in v0.6.0

func NewUnpinAllForumTopicMessagesCall(chatID PeerID, messageThreadID int) *UnpinAllForumTopicMessagesCall

NewUnpinAllForumTopicMessagesCall constructs a new UnpinAllForumTopicMessagesCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
  • messageThreadID: Unique identifier for the target message thread of the forum topic

func (*UnpinAllForumTopicMessagesCall) ChatID added in v0.6.0

ChatID sets the chat_id parameter.

func (*UnpinAllForumTopicMessagesCall) MessageThreadID added in v0.6.0

func (call *UnpinAllForumTopicMessagesCall) MessageThreadID(messageThreadID int) *UnpinAllForumTopicMessagesCall

MessageThreadID sets the message_thread_id parameter.

type UnpinAllGeneralForumTopicMessagesCall added in v0.10.0

type UnpinAllGeneralForumTopicMessagesCall struct {
	CallNoResult
}

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

func NewUnpinAllGeneralForumTopicMessagesCall added in v0.10.0

func NewUnpinAllGeneralForumTopicMessagesCall(chatID PeerID) *UnpinAllGeneralForumTopicMessagesCall

NewUnpinAllGeneralForumTopicMessagesCall constructs a new UnpinAllGeneralForumTopicMessagesCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

func (*UnpinAllGeneralForumTopicMessagesCall) ChatID added in v0.10.0

ChatID sets the chat_id parameter.

type UnpinChatMessageCall

type UnpinChatMessageCall struct {
	CallNoResult
}

UnpinChatMessageCall represents a call to the unpinChatMessage method. Use this method to remove a message from the list of pinned messages in a chat. In private chats and channel direct messages chats, all messages can be unpinned. Conversely, the bot must be an administrator with the 'can_pin_messages' right or the 'can_edit_messages' right to unpin messages in groups and channels respectively. Returns True on success.

func NewUnpinChatMessageCall

func NewUnpinChatMessageCall(chatID PeerID) *UnpinChatMessageCall

NewUnpinChatMessageCall constructs a new UnpinChatMessageCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*UnpinChatMessageCall) BusinessConnectionID added in v0.16.0

func (call *UnpinChatMessageCall) BusinessConnectionID(businessConnectionID string) *UnpinChatMessageCall

BusinessConnectionID sets the business_connection_id parameter.

func (*UnpinChatMessageCall) ChatID added in v0.0.5

func (call *UnpinChatMessageCall) ChatID(chatID PeerID) *UnpinChatMessageCall

ChatID sets the chat_id parameter.

func (*UnpinChatMessageCall) MessageID added in v0.0.5

func (call *UnpinChatMessageCall) MessageID(messageID int) *UnpinChatMessageCall

MessageID sets the message_id parameter.

type Update

type Update struct {
	// The update's unique identifier. Update identifiers start from a certain positive number and increase sequentially. This identifier becomes especially handy if you're using [Client.SetWebhook], since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order. If there are no new updates for at least a week, then identifier of the next update will be chosen randomly instead of sequentially.
	ID int `json:"update_id"`

	// Optional. New incoming message of any kind - text, photo, sticker, etc.
	Message *Message `json:"message,omitempty"`

	// Optional. New version of a message that is known to the bot and was edited. This update may at times be triggered by changes to message fields that are either unavailable or not actively used by your bot.
	EditedMessage *Message `json:"edited_message,omitempty"`

	// Optional. New incoming channel post of any kind - text, photo, sticker, etc.
	ChannelPost *Message `json:"channel_post,omitempty"`

	// Optional. New version of a channel post that is known to the bot and was edited. This update may at times be triggered by changes to message fields that are either unavailable or not actively used by your bot.
	EditedChannelPost *Message `json:"edited_channel_post,omitempty"`

	// Optional. The bot was connected to or disconnected from a business account, or a user edited an existing connection with the bot
	BusinessConnection *BusinessConnection `json:"business_connection,omitempty"`

	// Optional. New message from a connected business account
	BusinessMessage *Message `json:"business_message,omitempty"`

	// Optional. New version of a message from a connected business account
	EditedBusinessMessage *Message `json:"edited_business_message,omitempty"`

	// Optional. Messages were deleted from a connected business account
	DeletedBusinessMessages *BusinessMessagesDeleted `json:"deleted_business_messages,omitempty"`

	// Optional. A reaction to a message was changed by a user. The bot must be an administrator in the chat and must explicitly specify "message_reaction" in the list of allowed_updates to receive these updates. The update isn't received for reactions set by bots.
	MessageReaction *MessageReactionUpdated `json:"message_reaction,omitempty"`

	// Optional. Reactions to a message with anonymous reactions were changed. The bot must be an administrator in the chat and must explicitly specify "message_reaction_count" in the list of allowed_updates to receive these updates. The updates are grouped and can be sent with delay up to a few minutes.
	MessageReactionCount *MessageReactionCountUpdated `json:"message_reaction_count,omitempty"`

	// Optional. New incoming [inline] query
	//
	// [inline]: https://core.telegram.org/bots/api#inline-mode
	InlineQuery *InlineQuery `json:"inline_query,omitempty"`

	// Optional. The result of an [inline] query that was chosen by a user and sent to their chat partner. Please see our documentation on the [feedback collecting] for details on how to enable these updates for your bot.
	//
	// [inline]: https://core.telegram.org/bots/api#inline-mode
	// [feedback collecting]: https://core.telegram.org/bots/inline#collecting-feedback
	ChosenInlineResult *ChosenInlineResult `json:"chosen_inline_result,omitempty"`

	// Optional. New incoming callback query
	CallbackQuery *CallbackQuery `json:"callback_query,omitempty"`

	// Optional. New incoming shipping query. Only for invoices with flexible price
	ShippingQuery *ShippingQuery `json:"shipping_query,omitempty"`

	// Optional. New incoming pre-checkout query. Contains full information about checkout
	PreCheckoutQuery *PreCheckoutQuery `json:"pre_checkout_query,omitempty"`

	// Optional. A user purchased paid media with a non-empty payload sent by the bot in a non-channel chat
	PurchasedPaidMedia *PaidMediaPurchased `json:"purchased_paid_media,omitempty"`

	// Optional. New poll state. Bots receive only updates about manually stopped polls and polls, which are sent by the bot
	Poll *Poll `json:"poll,omitempty"`

	// Optional. A user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself.
	PollAnswer *PollAnswer `json:"poll_answer,omitempty"`

	// Optional. The bot's chat member status was updated in a chat. For private chats, this update is received only when the bot is blocked or unblocked by the user.
	MyChatMember *ChatMemberUpdated `json:"my_chat_member,omitempty"`

	// Optional. A chat member's status was updated in a chat. The bot must be an administrator in the chat and must explicitly specify "chat_member" in the list of allowed_updates to receive these updates.
	ChatMember *ChatMemberUpdated `json:"chat_member,omitempty"`

	// Optional. A request to join the chat has been sent. The bot must have the can_invite_users administrator right in the chat to receive these updates.
	ChatJoinRequest *ChatJoinRequest `json:"chat_join_request,omitempty"`

	// Optional. A chat boost was added or changed. The bot must be an administrator in the chat to receive these updates.
	ChatBoost *ChatBoostUpdated `json:"chat_boost,omitempty"`

	// Optional. A boost was removed from a chat. The bot must be an administrator in the chat to receive these updates.
	RemovedChatBoost *ChatBoostRemoved `json:"removed_chat_boost,omitempty"`
}

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

func (*Update) BusinessConnectionID added in v0.17.0

func (update *Update) BusinessConnectionID() string

BusinessConnectionID returns the business connection ID from wherever possible. It returns an empty string if no business connection ID can be determined.

func (*Update) Chat added in v0.3.0

func (update *Update) Chat() *Chat

Chat returns chat from wherever possible. It returns nil if no chat can be determined from this update.

func (*Update) ChatID added in v0.17.0

func (update *Update) ChatID() ChatID

ChatID returns the chat ID from wherever possible. Unlike Chat().ID, this also covers BusinessConnection.UserChatID where no Chat object is available. It returns 0 if no chat ID can be determined from this update.

func (*Update) InlineMessageID added in v0.17.0

func (update *Update) InlineMessageID() string

InlineMessageID returns the inline message ID from wherever possible. It returns an empty string if no inline message ID can be determined.

func (*Update) Msg added in v0.3.0

func (update *Update) Msg() *Message

Msg returns message from whever possible. It returns nil if message is not found.

func (*Update) MsgID added in v0.17.0

func (update *Update) MsgID() int

MsgID returns the message ID from wherever possible. It returns 0 if no message ID can be determined from this update.

func (*Update) SenderChat added in v0.17.0

func (update *Update) SenderChat() *Chat

SenderChat returns the chat on whose behalf the action was performed.

For messages, this is set when a message is sent on behalf of a chat (e.g. anonymous group admin, channel post forwarded to discussion group). For reactions, this is the anonymous chat that reacted (ActorChat). For poll answers, this is the anonymous chat that voted (VoterChat).

Not applicable to callback queries, inline queries, or other user-initiated actions — returns nil for those update types.

Returns nil if no sender chat can be determined.

func (*Update) Type added in v0.1.1

func (v *Update) Type() UpdateType

Type returns the UpdateType of this Update.

func (*Update) User added in v0.17.0

func (update *Update) User(allowed ...UpdateType) *User

User returns the user who performed the action in this update.

For message-based updates, this is the message sender (From field). For callback queries, this is the user who clicked the button (CallbackQuery.From), not the author of the message containing the button. For reactions and poll answers, this may be nil if the action was performed anonymously.

If allowed types are specified, only returns the user when the update matches one of those types. With no arguments, all update types are considered.

Returns nil if no user can be determined from this update.

type UpdateType added in v0.1.1

type UpdateType int8

UpdateType represents an enum type.

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

func (UpdateType) IsUnknown added in v0.16.0

func (v UpdateType) IsUnknown() bool

IsUnknown reports whether this value is unknown.

func (UpdateType) MarshalText added in v0.1.1

func (v UpdateType) MarshalText() ([]byte, error)

func (UpdateType) String added in v0.1.1

func (v UpdateType) String() string

func (*UpdateType) UnmarshalText added in v0.1.1

func (v *UpdateType) UnmarshalText(b []byte) error

type UpgradeGiftCall added in v0.16.0

type UpgradeGiftCall struct {
	CallNoResult
}

UpgradeGiftCall represents a call to the upgradeGift method. Upgrades a given regular gift to a unique gift. Requires the can_transfer_and_upgrade_gifts business bot right. Additionally requires the can_transfer_stars business bot right if the upgrade is paid. Returns True on success.

func NewUpgradeGiftCall added in v0.16.0

func NewUpgradeGiftCall(businessConnectionID string, ownedGiftID string) *UpgradeGiftCall

NewUpgradeGiftCall constructs a new UpgradeGiftCall.

Required params:

  • businessConnectionID: Unique identifier of the business connection
  • ownedGiftID: Unique identifier of the regular gift that should be upgraded to a unique one

func (*UpgradeGiftCall) BusinessConnectionID added in v0.16.0

func (call *UpgradeGiftCall) BusinessConnectionID(businessConnectionID string) *UpgradeGiftCall

BusinessConnectionID sets the business_connection_id parameter.

func (*UpgradeGiftCall) KeepOriginalDetails added in v0.16.0

func (call *UpgradeGiftCall) KeepOriginalDetails(keepOriginalDetails bool) *UpgradeGiftCall

KeepOriginalDetails sets the keep_original_details parameter.

func (*UpgradeGiftCall) OwnedGiftID added in v0.16.0

func (call *UpgradeGiftCall) OwnedGiftID(ownedGiftID string) *UpgradeGiftCall

OwnedGiftID sets the owned_gift_id parameter.

func (*UpgradeGiftCall) StarCount added in v0.16.0

func (call *UpgradeGiftCall) StarCount(starCount int) *UpgradeGiftCall

StarCount sets the star_count parameter.

type UploadStickerFileCall

type UploadStickerFileCall struct {
	Call[File]
}

UploadStickerFileCall represents a call to the uploadStickerFile method. Use this method to upload a file with a sticker for later use in the Client.CreateNewStickerSet, Client.AddStickerToSet, or Client.ReplaceStickerInSet methods (the file can be used multiple times). Returns the uploaded File on success.

func NewUploadStickerFileCall

func NewUploadStickerFileCall(userID UserID, sticker InputFile, stickerFormat string) *UploadStickerFileCall

NewUploadStickerFileCall constructs a new UploadStickerFileCall.

Required params:

func (*UploadStickerFileCall) Sticker added in v0.8.0

func (call *UploadStickerFileCall) Sticker(sticker InputFile) *UploadStickerFileCall

Sticker sets the sticker parameter.

func (*UploadStickerFileCall) StickerFormat added in v0.8.0

func (call *UploadStickerFileCall) StickerFormat(stickerFormat string) *UploadStickerFileCall

StickerFormat sets the sticker_format parameter.

func (*UploadStickerFileCall) UserID added in v0.0.5

func (call *UploadStickerFileCall) UserID(userID UserID) *UploadStickerFileCall

UserID sets the user_id parameter.

type User

type User struct {
	// Unique identifier for this user or bot. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier.
	ID UserID `json:"id"`

	// True, if this user is a bot
	IsBot bool `json:"is_bot"`

	// User's or bot's first name
	FirstName string `json:"first_name"`

	// Optional. User's or bot's last name
	LastName string `json:"last_name,omitempty"`

	// Optional. User's or bot's username
	Username Username `json:"username,omitempty"`

	// Optional. [IETF language tag] of the user's language
	//
	// [IETF language tag]: https://en.wikipedia.org/wiki/IETF_language_tag
	LanguageCode string `json:"language_code,omitempty"`

	// Optional. True, if this user is a Telegram Premium user
	IsPremium bool `json:"is_premium,omitempty"`

	// Optional. True, if this user added the bot to the attachment menu
	AddedToAttachmentMenu bool `json:"added_to_attachment_menu,omitempty"`

	// Optional. True, if the bot can be invited to groups. Returned only in [Client.GetMe].
	CanJoinGroups bool `json:"can_join_groups,omitempty"`

	// Optional. True, if [privacy mode] is disabled for the bot. Returned only in [Client.GetMe].
	//
	// [privacy mode]: https://core.telegram.org/bots/features#privacy-mode
	CanReadAllGroupMessages bool `json:"can_read_all_group_messages,omitempty"`

	// Optional. True, if the bot supports inline queries. Returned only in [Client.GetMe].
	SupportsInlineQueries bool `json:"supports_inline_queries,omitempty"`

	// Optional. True, if the bot can be connected to a Telegram Business account to receive its messages. Returned only in [Client.GetMe].
	CanConnectToBusiness bool `json:"can_connect_to_business,omitempty"`

	// Optional. True, if the bot has a main Web App. Returned only in [Client.GetMe].
	HasMainWebApp bool `json:"has_main_web_app,omitempty"`

	// Optional. True, if the bot has forum topic mode enabled in private chats. Returned only in [Client.GetMe].
	HasTopicsEnabled bool `json:"has_topics_enabled,omitempty"`

	// Optional. True, if the bot allows users to create and delete topics in private chats. Returned only in [Client.GetMe].
	AllowsUsersToCreateTopics bool `json:"allows_users_to_create_topics,omitempty"`
}

User this object represents a Telegram user or bot.

func (User) FullName added in v0.17.0

func (user User) FullName() string

FullName returns the user's full name. It combines first name and last name, or returns just first name if last name is empty.

func (User) PeerID added in v0.2.0

func (user User) PeerID() string

type UserChatBoosts added in v0.12.0

type UserChatBoosts struct {
	// The list of boosts added to the chat by the user
	Boosts []ChatBoost `json:"boosts"`
}

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

type UserID

type UserID int64

UserID it's unique identifier for Telegram user or bot.

func (UserID) PeerID

func (id UserID) PeerID() string

type UserProfileAudios added in v0.18.0

type UserProfileAudios struct {
	// Total number of profile audios for the target user
	TotalCount int `json:"total_count"`

	// Requested profile audios
	Audios []Audio `json:"audios"`
}

UserProfileAudios this object represents the audios displayed on a user's profile.

type UserProfilePhotos

type UserProfilePhotos struct {
	// Total number of profile pictures the target user has
	TotalCount int `json:"total_count"`

	// Requested profile pictures (in up to 4 sizes each)
	Photos [][]PhotoSize `json:"photos"`
}

UserProfilePhotos this object represent a user's profile pictures.

type UserRating added in v0.16.0

type UserRating struct {
	// Current level of the user, indicating their reliability when purchasing digital goods and services. A higher level suggests a more trustworthy customer; a negative level is likely reason for concern.
	Level int `json:"level"`

	// Numerical value of the user's rating; the higher the rating, the better
	Rating int `json:"rating"`

	// The rating value required to get the current level
	CurrentLevelRating int `json:"current_level_rating"`

	// Optional. The rating value required to get to the next level; omitted if the maximum level was reached
	NextLevelRating int `json:"next_level_rating,omitempty"`
}

UserRating this object describes the rating of a user based on their Telegram Star spendings.

type Username

type Username string

Username represents a Telegram username.

func (un Username) DeepLink() string

DeepLink returns a deep link with username.

func (un Username) Link() string

Link returns a public link with username.

func (Username) PeerID

func (un Username) PeerID() string

PeerID implements [Peer] interface.

type UsersShared added in v0.12.0

type UsersShared struct {
	// Identifier of the request
	RequestID int `json:"request_id"`

	// Information about users shared with the bot.
	Users []SharedUser `json:"users"`
}

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

type Venue

type Venue struct {
	// Venue location. Can't be a live location
	Location Location `json:"location"`

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

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

	// Optional. Foursquare identifier of the venue
	FoursquareID string `json:"foursquare_id,omitempty"`

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

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

	// Optional. Google Places type of the venue. (See [supported types].)
	//
	// [supported types]: https://developers.google.com/places/web-service/supported_types
	GooglePlaceType string `json:"google_place_type,omitempty"`
}

Venue this object represents a venue.

type VerifyChatCall added in v0.16.0

type VerifyChatCall struct {
	CallNoResult
}

VerifyChatCall represents a call to the verifyChat method. Verifies a chat on behalf of the organization which is represented by the bot. Returns True on success.

func NewVerifyChatCall added in v0.16.0

func NewVerifyChatCall(chatID PeerID) *VerifyChatCall

NewVerifyChatCall constructs a new VerifyChatCall.

Required params:

  • chatID: Unique identifier for the target chat or username of the target channel (in the format @channelusername). Channel direct messages chats can't be verified.

func (*VerifyChatCall) ChatID added in v0.16.0

func (call *VerifyChatCall) ChatID(chatID PeerID) *VerifyChatCall

ChatID sets the chat_id parameter.

func (*VerifyChatCall) CustomDescription added in v0.16.0

func (call *VerifyChatCall) CustomDescription(customDescription string) *VerifyChatCall

CustomDescription sets the custom_description parameter.

type VerifyUserCall added in v0.16.0

type VerifyUserCall struct {
	CallNoResult
}

VerifyUserCall represents a call to the verifyUser method. Verifies a user on behalf of the organization which is represented by the bot. Returns True on success.

func NewVerifyUserCall added in v0.16.0

func NewVerifyUserCall(userID UserID) *VerifyUserCall

NewVerifyUserCall constructs a new VerifyUserCall.

Required params:

  • userID: Unique identifier of the target user

func (*VerifyUserCall) CustomDescription added in v0.16.0

func (call *VerifyUserCall) CustomDescription(customDescription string) *VerifyUserCall

CustomDescription sets the custom_description parameter.

func (*VerifyUserCall) UserID added in v0.16.0

func (call *VerifyUserCall) UserID(userID UserID) *VerifyUserCall

UserID sets the user_id parameter.

type Video

type Video struct {
	// Identifier for this file, which can be used to download or reuse the file
	FileID FileID `json:"file_id"`

	// Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
	FileUniqueID string `json:"file_unique_id"`

	// Video width as defined by the sender
	Width int `json:"width"`

	// Video height as defined by the sender
	Height int `json:"height"`

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

	// Optional. Video thumbnail
	Thumbnail *PhotoSize `json:"thumbnail,omitempty"`

	// Optional. Available sizes of the cover of the video in the message
	Cover []PhotoSize `json:"cover,omitempty"`

	// Optional. Timestamp in seconds from which the video will play in the message
	StartTimestamp int `json:"start_timestamp,omitempty"`

	// Optional. List of available qualities of the video
	Qualities []VideoQuality `json:"qualities,omitempty"`

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

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

	// Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.
	FileSize int64 `json:"file_size,omitempty"`
}

Video this object represents a video file.

type VideoChatEnded

type VideoChatEnded struct {
	// Video chat duration in seconds
	Duration int `json:"duration"`
}

VideoChatEnded this object represents a service message about a video chat ended in the chat.

type VideoChatParticipantsInvited

type VideoChatParticipantsInvited struct {
	// New members that were invited to the video chat
	Users []User `json:"users"`
}

VideoChatParticipantsInvited this object represents a service message about new members invited to a video chat.

type VideoChatScheduled

type VideoChatScheduled struct {
	// Point in time (Unix timestamp) when the video chat is supposed to be started by a chat administrator
	StartDate UnixTime `json:"start_date"`
}

VideoChatScheduled this object represents a service message about a video chat scheduled in the chat.

type VideoChatStarted

type VideoChatStarted struct{}

VideoChatStarted this object represents a service message about a video chat started in the chat. Currently holds no information.

type VideoNote

type VideoNote struct {
	// Identifier for this file, which can be used to download or reuse the file
	FileID FileID `json:"file_id"`

	// Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
	FileUniqueID string `json:"file_unique_id"`

	// Video width and height (diameter of the video message) as defined by the sender
	Length int `json:"length"`

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

	// Optional. Video thumbnail
	Thumbnail *PhotoSize `json:"thumbnail,omitempty"`

	// Optional. File size in bytes
	FileSize int `json:"file_size,omitempty"`
}

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

type VideoQuality added in v0.18.0

type VideoQuality struct {
	// Identifier for this file, which can be used to download or reuse the file
	FileID FileID `json:"file_id"`

	// Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
	FileUniqueID string `json:"file_unique_id"`

	// Video width
	Width int `json:"width"`

	// Video height
	Height int `json:"height"`

	// Codec that was used to encode the video, for example, “h264”, “h265”, or “av01”
	Codec string `json:"codec"`

	// Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.
	FileSize int64 `json:"file_size,omitempty"`
}

VideoQuality this object represents a video file of a specific quality.

type Voice

type Voice struct {
	// Identifier for this file, which can be used to download or reuse the file
	FileID FileID `json:"file_id"`

	// Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
	FileUniqueID string `json:"file_unique_id"`

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

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

	// Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.
	FileSize int64 `json:"file_size,omitempty"`
}

Voice this object represents a voice note.

type WebAppChat added in v0.0.5

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

	// Type of chat.
	Type ChatType `json:"type"`

	// Title of the chat.
	Title string `json:"title"`

	// Optional. Username of the chat.
	Username string `json:"username,omitempty"`

	// Optional. URL of the chat's photo.
	PhotoURL string `json:"photo_url,omitempty"`
}

WebAppChat represents a chat in the Mini App context. See https://core.telegram.org/bots/webapps#webappchat for more information.

type WebAppData

type WebAppData struct {
	// The data. Be aware that a bad client can send arbitrary data in this field.
	Data string `json:"data"`

	// Text of the web_app keyboard button from which the Web App was opened. Be aware that a bad client can send arbitrary data in this field.
	ButtonText string `json:"button_text"`
}

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

type WebAppInfo

type WebAppInfo struct {
	// An HTTPS URL of a Web App to be opened with additional data as specified in [Initializing Web Apps]
	//
	// [Initializing Web Apps]: https://core.telegram.org/bots/webapps#initializing-mini-apps
	URL string `json:"url"`
}

WebAppInfo describes a Web App.

type WebAppInitData added in v0.0.5

type WebAppInitData struct {
	// Optional. A unique identifier for the Mini App session, required for sending messages via the answerWebAppQuery method.
	QueryID string `json:"query_id,omitempty"`

	// Optional. An object containing data about the current user.
	User *WebAppUser `json:"user,omitempty"`

	// Optional. An object containing data about the chat partner of the current user in the chat where the bot was launched via the attachment menu.
	Receiver *WebAppUser `json:"receiver,omitempty"`

	// Optional. An object containing data about the chat where the bot was launched via the attachment menu.
	Chat *WebAppChat `json:"chat,omitempty"`

	// Optional. Type of the chat from which the Mini App was opened.
	ChatType string `json:"chat_type,omitempty"`

	// Optional. Global identifier, uniquely corresponding to the chat from which the Mini App was opened.
	ChatInstance string `json:"chat_instance,omitempty"`

	// Optional. The value of the startattach parameter, passed via link.
	StartParam string `json:"start_param,omitempty"`

	// Optional. Time in seconds, after which a message can be sent via the answerWebAppQuery method.
	CanSendAfter int `json:"can_send_after,omitempty"`

	// Unix time when the form was opened.
	AuthDate UnixTime `json:"auth_date"`

	// A hash of all passed parameters, which the bot server can use to check their validity.
	Hash string `json:"hash"`
	// contains filtered or unexported fields
}

WebAppInitData contains data transferred to the Mini App when it is opened. See https://core.telegram.org/bots/webapps#webappinitdata for more information.

func ParseWebAppInitData added in v0.0.5

func ParseWebAppInitData(vs url.Values) (*WebAppInitData, error)

ParseWebAppInitData parses a WebAppInitData from query string.

func (WebAppInitData) Query added in v0.0.5

func (w WebAppInitData) Query() url.Values

Query returns a query values for the WebAppInitData.

func (WebAppInitData) Signature added in v0.0.5

func (w WebAppInitData) Signature(token string) string

Signature returns the signature of the WebAppInitData.

func (WebAppInitData) Valid added in v0.0.5

func (w WebAppInitData) Valid(token string) bool

type WebAppUser added in v0.0.5

type WebAppUser struct {
	// Unique identifier for this user or bot.
	ID UserID `json:"id"`

	// Optional. True, if this user is a bot.
	IsBot bool `json:"is_bot,omitempty"`

	// First name of the user or bot.
	FirstName string `json:"first_name"`

	// Optional. Last name of the user or bot.
	LastName string `json:"last_name,omitempty"`

	// Optional. Username of the user or bot.
	Username string `json:"username,omitempty"`

	// Optional. IETF language tag of the user's language.
	LanguageCode string `json:"language_code,omitempty"`

	// Optional. True, if this user is a Telegram Premium user.
	IsPremium bool `json:"is_premium,omitempty"`

	// Optional. True, if this user added the bot to the attachment menu.
	AddedToAttachmentMenu bool `json:"added_to_attachment_menu,omitempty"`

	// Optional. True, if this user allowed the bot to message them.
	AllowsWriteToPm bool `json:"allows_write_to_pm,omitempty"`

	// Optional. URL of the user's profile photo.
	PhotoURL string `json:"photo_url,omitempty"`
}

WebAppUser contains the data of the Mini App user. See https://core.telegram.org/bots/webapps#webappuser for more information.

type WebhookInfo

type WebhookInfo struct {
	// Webhook URL, may be empty if webhook is not set up
	URL string `json:"url"`

	// True, if a custom certificate was provided for webhook certificate checks
	HasCustomCertificate bool `json:"has_custom_certificate"`

	// Number of updates awaiting delivery
	PendingUpdateCount int `json:"pending_update_count"`

	// Optional. Currently used webhook IP address
	IPAddress string `json:"ip_address,omitempty"`

	// Optional. Unix time for the most recent error that happened when trying to deliver an update via webhook
	LastErrorDate UnixTime `json:"last_error_date,omitempty"`

	// Optional. Error message in human-readable format for the most recent error that happened when trying to deliver an update via webhook
	LastErrorMessage string `json:"last_error_message,omitempty"`

	// Optional. Unix time of the most recent error that happened when trying to synchronize available updates with Telegram datacenters
	LastSynchronizationErrorDate UnixTime `json:"last_synchronization_error_date,omitempty"`

	// Optional. The maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery
	MaxConnections int `json:"max_connections,omitempty"`

	// Optional. A list of update types the bot is subscribed to. Defaults to all update types except chat_member
	AllowedUpdates []UpdateType `json:"allowed_updates,omitempty"`
}

WebhookInfo describes the current status of a webhook.

type WriteAccessAllowed added in v0.6.0

type WriteAccessAllowed struct {
	// Optional. True, if the access was granted after the user accepted an explicit request from a Web App sent by the method [requestWriteAccess]
	//
	// [requestWriteAccess]: https://core.telegram.org/bots/webapps#initializing-mini-apps
	FromRequest bool `json:"from_request,omitempty"`

	// Optional. Name of the Web App, if the access was granted when the Web App was launched from a link
	WebAppName string `json:"web_app_name,omitempty"`

	// Optional. True, if the access was granted when the bot was added to the attachment or side menu
	FromAttachmentMenu bool `json:"from_attachment_menu,omitempty"`
}

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

Directories

Path Synopsis
_examples
book-bot command
Package contains example of book search bot via Inline Mode using Open Library API.
Package contains example of book search bot via Inline Mode using Open Library API.
business-bot command
Package contains simple echo bot, that demonstrates how to use handlers, filters and file uploads.
Package contains simple echo bot, that demonstrates how to use handlers, filters and file uploads.
calculator command
Package contains example of using tgb.ChatType filter.
Package contains example of using tgb.ChatType filter.
chat-type-filter command
Package contains example of using tgb.ChatType filter.
Package contains example of using tgb.ChatType filter.
echo-bot command
Package contains simple echo bot, that demonstrates how to use handlers, filters and file uploads.
Package contains simple echo bot, that demonstrates how to use handlers, filters and file uploads.
grayscale-image command
media-gallery command
Package contains a photo gallery bot that demonstrates MediaMessageCallBuilder.
Package contains a photo gallery bot that demonstrates MediaMessageCallBuilder.
media-group command
Package contains example of sending media groups and paid media.
Package contains example of sending media groups and paid media.
menu command
Package contains simple echo bot, that demonstrates how to use handlers, filters and file uploads.
Package contains simple echo bot, that demonstrates how to use handlers, filters and file uploads.
parse-mode command
Package contains example that demonstrates all ParseMode formatting features with an inline keyboard to switch between HTML, MarkdownV2 and Markdown modes.
Package contains example that demonstrates all ParseMode formatting features with an inline keyboard to switch between HTML, MarkdownV2 and Markdown modes.
retry-flood command
session-filter command
Package contains simple echo bot, that demonstrates how to use handlers, filters and file uploads.
Package contains simple echo bot, that demonstrates how to use handlers, filters and file uploads.
text-filter command
webapps command
Package contains example of using tgb.ChatType filter.
Package contains example of using tgb.ChatType filter.
tgb
Package tgb is a Telegram bot framework.
Package tgb is a Telegram bot framework.
session
Package session provides a session management.
Package session provides a session management.

Jump to

Keyboard shortcuts

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