tg

package module
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 28 Imported by: 7

README

go-tg

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

beta

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

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

Features

  • 🚀 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.18+
go get -u github.com/mr-linch/go-tg

Quick Example

package main

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

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

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

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

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

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

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

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

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

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

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

More examples can be found in examples.

API Client

Creating

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

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

With custom http.Client:

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

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

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

With self hosted Bot API server:

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

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

e.g. getMe call:

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

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

sendMessage call with required and optional arguments:

peer := tg.Username("MrLinch")

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

if err != nil {
  return err
}

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

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

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

peer := tg.Username("MrLinch")

if err := client.SendChatAction(
  peer,
  tg.ChatActionTyping
).DoVoid(ctx); err != nil {
  return err
}
Low-level Bot API methods call

Client has method Do for low-level requests execution:

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

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

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

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

There are several ways to send files to Telegram:

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

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

Consider each method by example.

Uploading a file along with a method call:

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

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

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

peer := tg.Username("MrLinch")

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

Loading a file from a buffer in memory:


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

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

peer := tg.Username("MrLinch")

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

Sending a file using a URL from the Internet:

peer := tg.Username("MrLinch")

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

Sending a previously uploaded file by its identifier:

peer := tg.Username("MrLinch")

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

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

Downloading files

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


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

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

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

// ...
Interceptors

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

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

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

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

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

      return err
    }),
  ),
)

Arguments of the interceptor are:

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

Contrib package has some useful interceptors:

Interceptors are called in the order they are registered.

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

Updates

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

Handlers

You can create an update handler in three ways:

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

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

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

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

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

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

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

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

List of typed handlers:

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

Receive updates via Polling

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

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

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

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

Receive updates via Webhook

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

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

Webhook has several security checks that are enabled by default:

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

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

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

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


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

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

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

e.g. integration with chi router

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

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

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

r := chi.NewRouter()

r.Get("/webhook", webhook)

http.ListenAndServe(":8080", r)

Routing updates

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

tgb.Router

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

router := tgb.NewRouter()

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

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

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

client := tg.NewClient(...)

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

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

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

The tgb package contains many built-in filters.

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

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

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

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

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

Logical operator or also supported.

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

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

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

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

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

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

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

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

e.g. log all updates

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

    return next(ctx, update)
  })
})
Error Handler

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

e.g. log all errors

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

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

Extensions

Sessions
What is a Session?

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

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

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

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

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

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

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

View Source
var (
	ReactionTypeEmojiThumbsUp                   = NewReactionTypeEmoji("👍")
	ReactionTypeEmojiThumbsDown                 = NewReactionTypeEmoji("👎")
	ReactionTypeEmojiRedHeart                   = NewReactionTypeEmoji("❤")
	ReactionTypeEmojiFire                       = NewReactionTypeEmoji("🔥")
	ReactionTypeEmojiSmilingFaceWithHearts      = NewReactionTypeEmoji("🥰")
	ReactionTypeEmojiClappingHands              = NewReactionTypeEmoji("👏")
	ReactionTypeEmojiBeamingFaceWithSmilingEyes = NewReactionTypeEmoji("😁")
	ReactionTypeEmojiThinkingFace               = NewReactionTypeEmoji("🤔")
	ReactionTypeEmojiExplodingHead              = NewReactionTypeEmoji("🤯")
	ReactionTypeEmojiFaceScreamingInFear        = NewReactionTypeEmoji("😱")
	ReactionTypeEmojiFaceWithSymbolsOnMouth     = NewReactionTypeEmoji("🤬")
	ReactionTypeEmojiCryingFace                 = NewReactionTypeEmoji("😢")
	ReactionTypeEmojiPartyPopper                = NewReactionTypeEmoji("🎉")
	ReactionTypeEmojiStarStruck                 = NewReactionTypeEmoji("🤩")
	ReactionTypeEmojiFaceVomiting               = NewReactionTypeEmoji("🤮")
	ReactionTypeEmojiPileOfPoo                  = NewReactionTypeEmoji("💩")
	ReactionTypeEmojiFoldedHands                = NewReactionTypeEmoji("🙏")
	ReactionTypeEmojiOkHand                     = NewReactionTypeEmoji("👌")
	ReactionTypeEmojiDove                       = NewReactionTypeEmoji("🕊")
	ReactionTypeEmojiClownFace                  = NewReactionTypeEmoji("🤡")
	ReactionTypeEmojiYawningFace                = NewReactionTypeEmoji("🥱")
	ReactionTypeEmojiWoozyFace                  = NewReactionTypeEmoji("🥴")
	ReactionTypeEmojiSmilingFaceWithHeartEyes   = NewReactionTypeEmoji("😍")
	ReactionTypeEmojiSpoutingWhale              = NewReactionTypeEmoji("🐳")
	ReactionTypeEmojiHeartOnFire                = NewReactionTypeEmoji("❤‍🔥")
	ReactionTypeEmojiNewMoonFace                = NewReactionTypeEmoji("🌚")
	ReactionTypeEmojiHotDog                     = NewReactionTypeEmoji("🌭")
	ReactionTypeEmojiHundredPoints              = NewReactionTypeEmoji("💯")
	ReactionTypeEmojiRollingOnTheFloorLaughing  = NewReactionTypeEmoji("🤣")
	ReactionTypeEmojiHighVoltage                = NewReactionTypeEmoji("⚡")
	ReactionTypeEmojiBanana                     = NewReactionTypeEmoji("🍌")
	ReactionTypeEmojiTrophy                     = NewReactionTypeEmoji("🏆")
	ReactionTypeEmojiBrokenHeart                = NewReactionTypeEmoji("💔")
	ReactionTypeEmojiFaceWithRaisedEyebrow      = NewReactionTypeEmoji("🤨")
	ReactionTypeEmojiNeutralFace                = NewReactionTypeEmoji("😐")
	ReactionTypeEmojiStrawberry                 = NewReactionTypeEmoji("🍓")
	ReactionTypeEmojiBottleWithPoppingCork      = NewReactionTypeEmoji("🍾")
	ReactionTypeEmojiKissMark                   = NewReactionTypeEmoji("💋")
	ReactionTypeEmojiMiddleFinger               = NewReactionTypeEmoji("🖕")
	ReactionTypeEmojiSmilingFaceWithHorns       = NewReactionTypeEmoji("😈")
	ReactionTypeEmojiSleepingFace               = NewReactionTypeEmoji("😴")
	ReactionTypeEmojiLoudlyCryingFace           = NewReactionTypeEmoji("😭")
	ReactionTypeEmojiNerdFace                   = NewReactionTypeEmoji("🤓")
	ReactionTypeEmojiGhost                      = NewReactionTypeEmoji("👻")
	ReactionTypeEmojiManTechnologist            = NewReactionTypeEmoji("👨‍💻")
	ReactionTypeEmojiEyes                       = NewReactionTypeEmoji("👀")
	ReactionTypeEmojiJackOLantern               = NewReactionTypeEmoji("🎃")
	ReactionTypeEmojiSeeNoEvilMonkey            = NewReactionTypeEmoji("🙈")
	ReactionTypeEmojiSmilingFaceWithHalo        = NewReactionTypeEmoji("😇")
	ReactionTypeEmojiFearfulFace                = NewReactionTypeEmoji("😨")
	ReactionTypeEmojiHandshake                  = NewReactionTypeEmoji("🤝")
	ReactionTypeEmojiWritingHand                = NewReactionTypeEmoji("✍")
	ReactionTypeEmojiSmilingFaceWithOpenHands   = NewReactionTypeEmoji("🤗")
	ReactionTypeEmojiSalutingFace               = NewReactionTypeEmoji("🫡")
	ReactionTypeEmojiSantaClaus                 = NewReactionTypeEmoji("🎅")
	ReactionTypeEmojiChristmasTree              = NewReactionTypeEmoji("🎄")
	ReactionTypeEmojiSnowman                    = NewReactionTypeEmoji("☃")
	ReactionTypeEmojiNailPolish                 = NewReactionTypeEmoji("💅")
	ReactionTypeEmojiZanyFace                   = NewReactionTypeEmoji("🤪")
	ReactionTypeEmojiMoai                       = NewReactionTypeEmoji("🗿")
	ReactionTypeEmojiCoolButton                 = NewReactionTypeEmoji("🆒")
	ReactionTypeEmojiHeartWithArrow             = NewReactionTypeEmoji("💘")
	ReactionTypeEmojiHearNoEvilMonkey           = NewReactionTypeEmoji("🙉")
	ReactionTypeEmojiUnicorn                    = NewReactionTypeEmoji("🦄")
	ReactionTypeEmojiFaceBlowingAKiss           = NewReactionTypeEmoji("😘")
	ReactionTypeEmojiPill                       = NewReactionTypeEmoji("💊")
	ReactionTypeEmojiSpeakNoEvilMonkey          = NewReactionTypeEmoji("🙊")
	ReactionTypeEmojiSmilingFaceWithSunglasses  = NewReactionTypeEmoji("😎")
	ReactionTypeEmojiAlienMonster               = NewReactionTypeEmoji("👾")
	ReactionTypeEmojiManShrugging               = NewReactionTypeEmoji("🤷‍♂")
	ReactionTypeEmojiPersonShrugging            = NewReactionTypeEmoji("🤷")
	ReactionTypeEmojiWomanShrugging             = NewReactionTypeEmoji("🤷‍♀")
	ReactionTypeEmojiEnragedFace                = NewReactionTypeEmoji("😡")
)

Define all available reactions that can be used in the bot.

View Source
var (
	// ReactionTypeEmojiAll is a list of all available emoji reactions
	// that can be used in the bot as ReactionType.
	ReactionTypeEmojiAll = []ReactionType{
		ReactionTypeEmojiThumbsUp,
		ReactionTypeEmojiThumbsDown,
		ReactionTypeEmojiRedHeart,
		ReactionTypeEmojiFire,
		ReactionTypeEmojiSmilingFaceWithHearts,
		ReactionTypeEmojiClappingHands,
		ReactionTypeEmojiBeamingFaceWithSmilingEyes,
		ReactionTypeEmojiThinkingFace,
		ReactionTypeEmojiExplodingHead,
		ReactionTypeEmojiFaceScreamingInFear,
		ReactionTypeEmojiFaceWithSymbolsOnMouth,
		ReactionTypeEmojiCryingFace,
		ReactionTypeEmojiPartyPopper,
		ReactionTypeEmojiStarStruck,
		ReactionTypeEmojiFaceVomiting,
		ReactionTypeEmojiPileOfPoo,
		ReactionTypeEmojiFoldedHands,
		ReactionTypeEmojiOkHand,
		ReactionTypeEmojiDove,
		ReactionTypeEmojiClownFace,
		ReactionTypeEmojiYawningFace,
		ReactionTypeEmojiWoozyFace,
		ReactionTypeEmojiSmilingFaceWithHeartEyes,
		ReactionTypeEmojiSpoutingWhale,
		ReactionTypeEmojiHeartOnFire,
		ReactionTypeEmojiNewMoonFace,
		ReactionTypeEmojiHotDog,
		ReactionTypeEmojiHundredPoints,
		ReactionTypeEmojiRollingOnTheFloorLaughing,
		ReactionTypeEmojiHighVoltage,
		ReactionTypeEmojiBanana,
		ReactionTypeEmojiTrophy,
		ReactionTypeEmojiBrokenHeart,
		ReactionTypeEmojiFaceWithRaisedEyebrow,
		ReactionTypeEmojiNeutralFace,
		ReactionTypeEmojiStrawberry,
		ReactionTypeEmojiBottleWithPoppingCork,
		ReactionTypeEmojiKissMark,
		ReactionTypeEmojiMiddleFinger,
		ReactionTypeEmojiSmilingFaceWithHorns,
		ReactionTypeEmojiSleepingFace,
		ReactionTypeEmojiLoudlyCryingFace,
		ReactionTypeEmojiNerdFace,
		ReactionTypeEmojiGhost,
		ReactionTypeEmojiManTechnologist,
		ReactionTypeEmojiEyes,
		ReactionTypeEmojiJackOLantern,
		ReactionTypeEmojiSeeNoEvilMonkey,
		ReactionTypeEmojiSmilingFaceWithHalo,
		ReactionTypeEmojiFearfulFace,
		ReactionTypeEmojiHandshake,
		ReactionTypeEmojiWritingHand,
		ReactionTypeEmojiSmilingFaceWithOpenHands,
		ReactionTypeEmojiSalutingFace,
		ReactionTypeEmojiSantaClaus,
		ReactionTypeEmojiChristmasTree,
		ReactionTypeEmojiSnowman,
		ReactionTypeEmojiNailPolish,
		ReactionTypeEmojiZanyFace,
		ReactionTypeEmojiMoai,
		ReactionTypeEmojiCoolButton,
		ReactionTypeEmojiHeartWithArrow,
		ReactionTypeEmojiHearNoEvilMonkey,
		ReactionTypeEmojiUnicorn,
		ReactionTypeEmojiFaceBlowingAKiss,
		ReactionTypeEmojiPill,
		ReactionTypeEmojiSpeakNoEvilMonkey,
		ReactionTypeEmojiSmilingFaceWithSunglasses,
		ReactionTypeEmojiAlienMonster,
		ReactionTypeEmojiManShrugging,
		ReactionTypeEmojiPersonShrugging,
		ReactionTypeEmojiWomanShrugging,
		ReactionTypeEmojiEnragedFace,
	}
)

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 added in v0.0.2

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

NewButtonColumn returns keyboard from a single column of Button.

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 AddStickerToSetCall

type AddStickerToSetCall struct {
	CallNoResult
}

AddStickerToSetCall reprenesents 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

func NewAddStickerToSetCall

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

NewAddStickerToSetCall constructs a new AddStickerToSetCall with required parameters. 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 Sticker set name

func (*AddStickerToSetCall) Sticker added in v0.8.0

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

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) UserID added in v0.0.5

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

UserID User identifier of sticker set owner

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 sender
	Width int `json:"width"`

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

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

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

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

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

	// Optional. File size in bytes.
	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 reprenesents 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 with required parameters. callbackQueryID - Unique identifier for the query to be answered

func (*AnswerCallbackQueryCall) CacheTime

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

CacheTime The maximum amount of time in seconds that the result of the callback query may be cached client-side. Telegram apps will support caching starting in version 3.14. Defaults to 0.

func (*AnswerCallbackQueryCall) CallbackQueryID added in v0.0.5

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

CallbackQueryID Unique identifier for the query to be answered

func (*AnswerCallbackQueryCall) ShowAlert

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

ShowAlert If True, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to false.

func (*AnswerCallbackQueryCall) Text

Text Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters

func (*AnswerCallbackQueryCall) URL added in v0.0.5

URL URL that will be opened by the user's client. If you have created a Game and accepted the conditions via @BotFather, specify the URL that opens your game - note that this will only work if the query comes from a callback_game button.Otherwise, you may use links like t.me/your_bot?start=XXXX that open your bot with a parameter.

type AnswerInlineQueryCall

type AnswerInlineQueryCall struct {
	CallNoResult
}

AnswerInlineQueryCall reprenesents 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 with required parameters. 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 A JSON-serialized object describing a button to be shown above inline query results

func (*AnswerInlineQueryCall) CacheTime

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

CacheTime The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300.

func (*AnswerInlineQueryCall) InlineQueryID added in v0.0.5

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

InlineQueryID Unique identifier for the answered query

func (*AnswerInlineQueryCall) IsPersonal

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

IsPersonal Pass True if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query.

func (*AnswerInlineQueryCall) NextOffset

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

NextOffset Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes.

func (*AnswerInlineQueryCall) Results

Results A JSON-serialized array of results for the inline query

type AnswerPreCheckoutQueryCall

type AnswerPreCheckoutQueryCall struct {
	CallNoResult
}

AnswerPreCheckoutQueryCall reprenesents 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 with required parameters. 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 Required if ok is False. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user.

func (*AnswerPreCheckoutQueryCall) Ok

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) PreCheckoutQueryID added in v0.0.5

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

PreCheckoutQueryID Unique identifier for the query to be answered

type AnswerShippingQueryCall

type AnswerShippingQueryCall struct {
	CallNoResult
}

AnswerShippingQueryCall reprenesents 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 with required parameters. 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 Required if ok is False. Error message in human readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable'). Telegram will display this message to the user.

func (*AnswerShippingQueryCall) Ok

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) ShippingOptions

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

ShippingOptions Required if ok is True. A JSON-serialized array of available shipping options.

func (*AnswerShippingQueryCall) ShippingQueryID added in v0.0.5

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

ShippingQueryID Unique identifier for the query to be answered

type AnswerWebAppQueryCall

type AnswerWebAppQueryCall struct {
	Call[SentWebAppMessage]
}

AnswerWebAppQueryCall reprenesents 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 InlineQueryResult) *AnswerWebAppQueryCall

NewAnswerWebAppQueryCall constructs a new AnswerWebAppQueryCall with required parameters. webAppQueryID - Unique identifier for the query to be answered result - A JSON-serialized object describing the message to be sent

func (*AnswerWebAppQueryCall) Result

Result A JSON-serialized object describing the message to be sent

func (*AnswerWebAppQueryCall) WebAppQueryID added in v0.0.5

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

WebAppQueryID Unique identifier for the query to be answered

type ApproveChatJoinRequestCall

type ApproveChatJoinRequestCall struct {
	CallNoResult
}

ApproveChatJoinRequestCall reprenesents 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

func NewApproveChatJoinRequestCall

func NewApproveChatJoinRequestCall(chatID PeerID, userID UserID) *ApproveChatJoinRequestCall

NewApproveChatJoinRequestCall constructs a new ApproveChatJoinRequestCall with required parameters. 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 Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*ApproveChatJoinRequestCall) UserID added in v0.0.5

UserID Unique identifier of the target user

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 sender
	Duration int `json:"duration"`

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

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

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

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

	// Optional. File size in bytes.
	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  int64  `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) AuthDateTime added in v0.0.5

func (w AuthWidget) AuthDateTime() time.Time

AuthDateTime returns the AuthDate as a time.Time.

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 BanChatMemberCall

type BanChatMemberCall struct {
	CallNoResult
}

BanChatMemberCall reprenesents 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 unbanned first The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights

func NewBanChatMemberCall

func NewBanChatMemberCall(chatID PeerID, userID UserID) *BanChatMemberCall

NewBanChatMemberCall constructs a new BanChatMemberCall with required parameters. 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 Unique identifier for the target group or username of the target supergroup or channel (in the format @channelusername)

func (*BanChatMemberCall) RevokeMessages

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

RevokeMessages Pass True to delete all messages from the chat for the user that is being removed. If False, the user will be able to see messages in the group that were sent before the user was removed. Always True for supergroups and channels.

func (*BanChatMemberCall) UntilDate

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

UntilDate Date when the user will be unbanned; Unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever. Applied for supergroups and channels only.

func (*BanChatMemberCall) UserID added in v0.0.5

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

UserID Unique identifier of the target user

type BanChatSenderChatCall

type BanChatSenderChatCall struct {
	CallNoResult
}

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

func NewBanChatSenderChatCall

func NewBanChatSenderChatCall(chatID PeerID, senderChatID int) *BanChatSenderChatCall

NewBanChatSenderChatCall constructs a new BanChatSenderChatCall with required parameters. 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 Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*BanChatSenderChatCall) SenderChatID added in v0.0.5

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

SenderChatID Unique identifier of the target sender chat

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

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 interface {
	json.Marshaler
	// contains filtered or unexported methods
}

BotCommandScope it's generic interface for all types of bot command scope.

Known implementations:

type BotCommandScopeAllChatAdministrators

type BotCommandScopeAllChatAdministrators struct {
	// Scope type, must be all_chat_administrators
	Type string `json:"type"`
}

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

func (BotCommandScopeAllChatAdministrators) MarshalJSON added in v0.0.5

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

type BotCommandScopeAllGroupChats

type BotCommandScopeAllGroupChats struct {
	// Scope type, must be all_group_chats
	Type string `json:"type"`
}

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

func (BotCommandScopeAllGroupChats) MarshalJSON added in v0.0.5

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

type BotCommandScopeAllPrivateChats

type BotCommandScopeAllPrivateChats struct {
	// Scope type, must be all_private_chats
	Type string `json:"type"`
}

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

func (BotCommandScopeAllPrivateChats) MarshalJSON added in v0.0.5

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

type BotCommandScopeChat

type BotCommandScopeChat struct {
	// Scope type, must be chat
	Type string `json:"type"`

	// Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
	ChatID ChatID `json:"chat_id"`
}

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

func (BotCommandScopeChat) MarshalJSON added in v0.0.5

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

type BotCommandScopeChatAdministrators

type BotCommandScopeChatAdministrators struct {
	// Scope type, must be chat_administrators
	Type string `json:"type"`

	// Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
	ChatID ChatID `json:"chat_id"`
}

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

func (BotCommandScopeChatAdministrators) MarshalJSON added in v0.0.5

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

type BotCommandScopeChatMember

type BotCommandScopeChatMember struct {
	// Scope type, must be chat_member
	Type string `json:"type"`

	// Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
	ChatID ChatID `json:"chat_id"`

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

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

func (BotCommandScopeChatMember) MarshalJSON added in v0.0.5

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

type BotCommandScopeDefault

type BotCommandScopeDefault struct {
	// Scope type, must be default
	Type string `json:"type"`
}

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

func (BotCommandScopeDefault) MarshalJSON added in v0.0.5

func (scope BotCommandScopeDefault) MarshalJSON() ([]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 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.
	UserChatID int64 `json:"user_chat_id"`

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

	// True, if the bot can act on behalf of the business account in chats that were active in the last 24 hours
	CanReply bool `json:"can_reply"`

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

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

func (*BusinessConnection) DateTime added in v0.15.0

func (s *BusinessConnection) DateTime() time.Time

DateTime returns time.Time representation of Date field.

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

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

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"`

	// A JSON-serialized 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

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

type Button added in v0.0.2

type Button interface {
	InlineKeyboardButton | KeyboardButton
}

Button define generic button interface

type ButtonLayout added in v0.0.2

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

ButtonLayout it's build for fixed width keyboards.

func NewButtonLayout added in v0.0.2

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

NewButtonLayout creates layout with specified width. Buttons will be added via Insert method.

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 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{}

type CallbackQuery

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

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

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

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

	// Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent. Useful for high scores in games.
	ChatInstance string `json:"chat_instance"`

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

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

CallbackQuery 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.
	ID ChatID `json:"id"`

	// Type of 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)
	IsForum bool `json:"is_forum,omitempty"`

	// Optional. Chat photo. Returned only in getChat.
	Photo *ChatPhoto `json:"photo,omitempty"`

	// Optional. If non-empty, the list of all active chat usernames; for private chats, supergroups and channels. Returned only in getChat.
	ActiveUsernames []string `json:"active_usernames,omitempty"`

	// Optional. For private chats, the date of birth of the user. Returned only in getChat.
	Birthdate int64 `json:"birthdate,omitempty"`

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

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

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

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

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

	// Optional. 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. Returned only in getChat. Always returned in getChat.
	AccentColorID int `json:"accent_color_id,omitempty"`

	// Optional. Custom emoji identifier of emoji chosen by the chat for the reply header and link preview background. Returned only in getChat.
	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. Returned only in getChat.
	ProfileAccentColorID int `json:"profile_accent_color_id,omitempty"`

	// Optional. Custom emoji identifier of the emoji chosen by the chat for its profile background. Returned only in getChat.
	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. Returned only in getChat.
	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. Returned only in getChat.
	EmojiStatusExpirationDate int64 `json:"emoji_status_expiration_date,omitempty"`

	// Optional. Bio of the other party in a private chat. Returned only in getChat.
	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. Returned only in getChat.
	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. Returned only in getChat.
	HasRestrictedVoiceAndVideoMessages bool `json:"has_restricted_voice_and_video_messages,omitempty"`

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

	// Optional. True, if all users directly joining the supergroup need to be approved by supergroup administrators. Returned only in getChat.
	JoinByRequest bool `json:"join_by_request,omitempty"`

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

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

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

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

	// Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds. Returned only in getChat.
	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. Returned only in getChat.
	UnrestrictBoostCount int `json:"unrestrict_boost_count,omitempty"`

	// Optional. The time after which all messages sent to the chat will be automatically deleted; in seconds. Returned only in getChat.
	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. Returned only in getChat.
	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. Returned only in getChat.
	HasHiddenMembers bool `json:"has_hidden_members,omitempty"`

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

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

	// Optional. For supergroups, name of group sticker set. Returned only in getChat.
	StickerSetName string `json:"sticker_set_name,omitempty"`

	// Optional. True, if the bot can change the group sticker set. Returned only in getChat.
	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. Returned only in getChat.
	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.  Returned only in getChat.
	LinkedChatID ChatID `json:"linked_chat_id,omitempty"`

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

Chat this object represents a chat.

func (*Chat) BirthdateTime added in v0.15.0

func (s *Chat) BirthdateTime() time.Time

BirthdateTime returns time.Time representation of Birthdate field.

func (*Chat) EmojiStatusExpirationDateTime added in v0.15.0

func (s *Chat) EmojiStatusExpirationDateTime() time.Time

EmojiStatusExpirationDateTime returns time.Time representation of EmojiStatusExpirationDate field.

func (Chat) PeerID

func (chat Chat) PeerID() string

type ChatAction added in v0.0.4

type ChatAction int8

ChatAction type of action to broadcast via sendChatAction.

const (
	ChatActionTyping ChatAction = iota + 1
	ChatActionUploadPhoto
	ChatActionRecordVideo
	ChatActionUploadVideo
	ChatActionRecordVoice
	ChatActionUploadVoice
	ChatActionUploadDocument
	ChatActionChooseSticker
	ChatActionFindLocation
	ChatActionRecordVideoNote
	ChatActionUploadVideoNote
)

func (ChatAction) String added in v0.0.4

func (action 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 and ignore slow mode. Implied by any other administrator privilege.
	CanManageChat bool `json:"can_manage_chat"`

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

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

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

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

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

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

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

	// True, if the administrator can edit stories posted by other users
	CanEditStories bool `json:"can_edit_stories"`

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

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

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

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

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

ChatAdministratorRights represents the rights of an administrator in a chat.

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 int64 `json:"add_date"`

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

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

ChatBoost this object contains information about a chat boost.

func (*ChatBoost) AddDateTime added in v0.15.0

func (s *ChatBoost) AddDateTime() time.Time

AddDateTime returns time.Time representation of AddDate field.

func (*ChatBoost) ExpirationDateTime added in v0.15.0

func (s *ChatBoost) ExpirationDateTime() time.Time

ExpirationDateTime returns time.Time representation of ExpirationDate field.

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 int64 `json:"remove_date"`

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

ChatBoostRemoved this object represents a boost removed from a chat.

func (*ChatBoostRemoved) RemoveDateTime added in v0.15.0

func (s *ChatBoostRemoved) RemoveDateTime() time.Time

RemoveDateTime returns time.Time representation of RemoveDate field.

type ChatBoostSource added in v0.12.0

type ChatBoostSource struct {
	// Source of the boost, always “premium”
	Source string `json:"source"`

	// User that boosted the chat
	User User `json:"user"`
}

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

type ChatBoostSourceGiftCode added in v0.12.0

type ChatBoostSourceGiftCode struct {
	// Source of the boost, always “gift_code”
	Source string `json:"source"`

	// 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 {
	// Source of the boost, always “giveaway”
	Source string `json:"source"`

	// 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
	User *User `json:"user,omitempty"`

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

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

type ChatBoostSourcePremium added in v0.12.0

type ChatBoostSourcePremium struct {
	// Source of the boost, always “premium”
	Source string `json:"source"`

	// 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 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 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 int64 `json:"expire_date,omitempty"`

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

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

ChatInviteLink represents an invite link for a chat.

func (*ChatInviteLink) ExpireDateTime added in v0.15.0

func (s *ChatInviteLink) ExpireDateTime() time.Time

ExpireDateTime returns time.Time representation of ExpireDate field.

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.  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 int64 `json:"date"`

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

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

ChatJoinRequest represents a join request sent to a chat.

func (*ChatJoinRequest) DateTime added in v0.15.0

func (s *ChatJoinRequest) DateTime() time.Time

DateTime returns time.Time representation of Date field.

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 {
	// The member's status in the chat, always “creator”
	Status string `json:"status"`

	// 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"`
}

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

type ChatMemberAdministrator

type ChatMemberAdministrator struct {
	// The member's status in the chat, always “administrator”
	Status string `json:"status"`

	// Information about the user
	User User `json:"user"`

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

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

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

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

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

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

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

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

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

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

	// True, if the administrator can edit stories posted by other users
	CanEditStories bool `json:"can_edit_stories"`

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

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

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

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

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

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

ChatMemberAdministrator represents a chat member that has some additional privileges.

type ChatMemberBanned

type ChatMemberBanned struct {
	// The member's status in the chat, always “kicked”
	Status string `json:"status"`

	// Information about the user
	User User `json:"user"`

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

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

func (*ChatMemberBanned) UntilDateTime added in v0.15.0

func (s *ChatMemberBanned) UntilDateTime() time.Time

UntilDateTime returns time.Time representation of UntilDate field.

type ChatMemberLeft

type ChatMemberLeft struct {
	// The member's status in the chat, always “left”
	Status string `json:"status"`

	// Information about the user
	User User `json:"user"`
}

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

type ChatMemberMember

type ChatMemberMember struct {
	// The member's status in the chat, always “member”
	Status string `json:"status"`

	// Information about the user
	User User `json:"user"`
}

ChatMemberMember represents a chat member that has no additional privileges or restrictions.

type ChatMemberOwner

type ChatMemberOwner struct {
	// The member's status in the chat, always “creator”
	Status string `json:"status"`

	// 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 chat member that owns the chat and has all administrator privileges.

type ChatMemberRestricted

type ChatMemberRestricted struct {
	// The member's status in the chat, always “restricted”
	Status string `json:"status"`

	// Information about the user
	User User `json:"user"`

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

func (*ChatMemberRestricted) UntilDateTime added in v0.15.0

func (s *ChatMemberRestricted) UntilDateTime() time.Time

UntilDateTime returns time.Time representation of UntilDate field.

type ChatMemberUpdated

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

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

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

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

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

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

	// Optional. True, if the user joined the chat 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.

func (*ChatMemberUpdated) DateTime added in v0.15.0

func (s *ChatMemberUpdated) DateTime() time.Time

DateTime returns time.Time representation of Date field.

type ChatPermissions

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

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

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

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

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

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

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

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

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

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

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

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

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

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

ChatPermissions 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.  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 string `json:"username,omitempty"`

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

ChatShared 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 enum of possible chat types.

const (
	// ChatTypePrivate represents one-to-one chat.
	ChatTypePrivate ChatType = iota + 1
	// ChatTypeGroup represents group chats.
	ChatTypeGroup
	// ChatTypeSupergroup supergroup chats.
	ChatTypeSupergroup
	// ChatTypeChannel represents channels
	ChatTypeChannel
	// ChatTypeSender for a private chat with the inline query sender
	ChatTypeSender
)

func (ChatType) MarshalJSON added in v0.0.2

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

func (ChatType) String added in v0.0.2

func (chatType ChatType) String() string

func (*ChatType) UnmarshalJSON added in v0.0.2

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

type ChosenInlineResult

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

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

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

	// Optional. Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message. Will be also received in callback queries and can be used to edit the message.
	InlineMessageID string `json:"inline_message_id,omitempty"`

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

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

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

AddStickerToSetCall constructs a new AddStickerToSetCall with required parameters.

func (*Client) AnswerCallbackQuery

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

AnswerCallbackQueryCall constructs a new AnswerCallbackQueryCall with required parameters.

func (*Client) AnswerInlineQuery

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

AnswerInlineQueryCall constructs a new AnswerInlineQueryCall with required parameters.

func (*Client) AnswerPreCheckoutQuery

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

AnswerPreCheckoutQueryCall constructs a new AnswerPreCheckoutQueryCall with required parameters.

func (*Client) AnswerShippingQuery

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

AnswerShippingQueryCall constructs a new AnswerShippingQueryCall with required parameters.

func (*Client) AnswerWebAppQuery

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

AnswerWebAppQueryCall constructs a new AnswerWebAppQueryCall with required parameters.

func (*Client) ApproveChatJoinRequest

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

ApproveChatJoinRequestCall constructs a new ApproveChatJoinRequestCall with required parameters.

func (*Client) BanChatMember

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

BanChatMemberCall constructs a new BanChatMemberCall with required parameters.

func (*Client) BanChatSenderChat

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

BanChatSenderChatCall constructs a new BanChatSenderChatCall with required parameters.

func (*Client) Close

func (client *Client) Close() *CloseCall

CloseCall constructs a new CloseCall with required parameters.

func (*Client) CloseForumTopic added in v0.6.0

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

CloseForumTopicCall constructs a new CloseForumTopicCall with required parameters.

func (*Client) CloseGeneralForumTopic added in v0.6.0

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

CloseGeneralForumTopicCall constructs a new CloseGeneralForumTopicCall with required parameters.

func (*Client) CopyMessage

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

CopyMessageCall constructs a new CopyMessageCall with required parameters.

func (*Client) CopyMessages added in v0.12.0

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

CopyMessagesCall constructs a new CopyMessagesCall with required parameters.

func (client *Client) CreateChatInviteLink(chatID PeerID) *CreateChatInviteLinkCall

CreateChatInviteLinkCall constructs a new CreateChatInviteLinkCall with required parameters.

func (*Client) CreateForumTopic added in v0.6.0

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

CreateForumTopicCall constructs a new CreateForumTopicCall with required parameters.

func (client *Client) CreateInvoiceLink(title string, description string, payload string, providerToken string, currency string, prices []LabeledPrice) *CreateInvoiceLinkCall

CreateInvoiceLinkCall constructs a new CreateInvoiceLinkCall with required parameters.

func (*Client) CreateNewStickerSet

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

CreateNewStickerSetCall constructs a new CreateNewStickerSetCall with required parameters.

func (*Client) DeclineChatJoinRequest

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

DeclineChatJoinRequestCall constructs a new DeclineChatJoinRequestCall with required parameters.

func (*Client) DeleteChatPhoto

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

DeleteChatPhotoCall constructs a new DeleteChatPhotoCall with required parameters.

func (*Client) DeleteChatStickerSet

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

DeleteChatStickerSetCall constructs a new DeleteChatStickerSetCall with required parameters.

func (*Client) DeleteForumTopic added in v0.6.0

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

DeleteForumTopicCall constructs a new DeleteForumTopicCall with required parameters.

func (*Client) DeleteMessage

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

DeleteMessageCall constructs a new DeleteMessageCall with required parameters.

func (*Client) DeleteMessages added in v0.12.0

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

DeleteMessagesCall constructs a new DeleteMessagesCall with required parameters.

func (*Client) DeleteMyCommands

func (client *Client) DeleteMyCommands() *DeleteMyCommandsCall

DeleteMyCommandsCall constructs a new DeleteMyCommandsCall with required parameters.

func (*Client) DeleteStickerFromSet

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

DeleteStickerFromSetCall constructs a new DeleteStickerFromSetCall with required parameters.

func (*Client) DeleteStickerSet added in v0.8.0

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

DeleteStickerSetCall constructs a new DeleteStickerSetCall with required parameters.

func (*Client) DeleteWebhook

func (client *Client) DeleteWebhook() *DeleteWebhookCall

DeleteWebhookCall constructs a new DeleteWebhookCall with required parameters.

func (*Client) Do added in v0.0.6

func (client *Client) Do(ctx context.Context, req *Request, dst interface{}) 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

EditChatInviteLinkCall constructs a new EditChatInviteLinkCall with required parameters.

func (*Client) EditForumTopic added in v0.6.0

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

EditForumTopicCall constructs a new EditForumTopicCall with required parameters.

func (*Client) EditGeneralForumTopic added in v0.6.0

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

EditGeneralForumTopicCall constructs a new EditGeneralForumTopicCall with required parameters.

func (*Client) EditMessageCaption

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

EditMessageCaptionCall constructs a new EditMessageCaptionCall with required parameters.

func (*Client) EditMessageCaptionInline added in v0.0.3

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

EditMessageCaptionCall constructs a new EditMessageCaptionCall with required parameters.

func (*Client) EditMessageLiveLocation

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

EditMessageLiveLocationCall constructs a new EditMessageLiveLocationCall with required parameters.

func (*Client) EditMessageLiveLocationInline

func (client *Client) EditMessageLiveLocationInline(inlineMessageID string) *EditMessageLiveLocationCall

EditMessageLiveLocationCall constructs a new EditMessageLiveLocationCall with required parameters.

func (*Client) EditMessageMedia

func (client *Client) EditMessageMedia(media InputMedia) *EditMessageMediaCall

EditMessageMediaCall constructs a new EditMessageMediaCall with required parameters.

func (*Client) EditMessageReplyMarkup

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

EditMessageReplyMarkupCall constructs a new EditMessageReplyMarkupCall with required parameters.

func (*Client) EditMessageReplyMarkupInline added in v0.0.3

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

EditMessageReplyMarkupCall constructs a new EditMessageReplyMarkupCall with required parameters.

func (*Client) EditMessageText

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

EditMessageTextCall constructs a new EditMessageTextCall with required parameters.

func (*Client) EditMessageTextInline added in v0.0.3

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

EditMessageTextCall constructs a new EditMessageTextCall with required parameters.

func (client *Client) ExportChatInviteLink(chatID PeerID) *ExportChatInviteLinkCall

ExportChatInviteLinkCall constructs a new ExportChatInviteLinkCall with required parameters.

func (*Client) ForwardMessage

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

ForwardMessageCall constructs a new ForwardMessageCall with required parameters.

func (*Client) ForwardMessages added in v0.12.0

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

ForwardMessagesCall constructs a new ForwardMessagesCall with required parameters.

func (*Client) GetBusinessConnection added in v0.15.0

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

GetBusinessConnectionCall constructs a new GetBusinessConnectionCall with required parameters.

func (*Client) GetChat

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

GetChatCall constructs a new GetChatCall with required parameters.

func (*Client) GetChatAdministrators

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

GetChatAdministratorsCall constructs a new GetChatAdministratorsCall with required parameters.

func (*Client) GetChatMember

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

GetChatMemberCall constructs a new GetChatMemberCall with required parameters.

func (*Client) GetChatMemberCount

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

GetChatMemberCountCall constructs a new GetChatMemberCountCall with required parameters.

func (*Client) GetChatMenuButton

func (client *Client) GetChatMenuButton() *GetChatMenuButtonCall

GetChatMenuButtonCall constructs a new GetChatMenuButtonCall with required parameters.

func (*Client) GetCustomEmojiStickers added in v0.5.0

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

GetCustomEmojiStickersCall constructs a new GetCustomEmojiStickersCall with required parameters.

func (*Client) GetFile

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

GetFileCall constructs a new GetFileCall with required parameters.

func (*Client) GetForumTopicIconStickers added in v0.6.0

func (client *Client) GetForumTopicIconStickers() *GetForumTopicIconStickersCall

GetForumTopicIconStickersCall constructs a new GetForumTopicIconStickersCall with required parameters.

func (*Client) GetGameHighScores

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

GetGameHighScoresCall constructs a new GetGameHighScoresCall with required parameters.

func (*Client) GetMe

func (client *Client) GetMe() *GetMeCall

GetMeCall constructs a new GetMeCall with required parameters.

func (*Client) GetMyCommands

func (client *Client) GetMyCommands() *GetMyCommandsCall

GetMyCommandsCall constructs a new GetMyCommandsCall with required parameters.

func (*Client) GetMyDefaultAdministratorRights

func (client *Client) GetMyDefaultAdministratorRights() *GetMyDefaultAdministratorRightsCall

GetMyDefaultAdministratorRightsCall constructs a new GetMyDefaultAdministratorRightsCall with required parameters.

func (*Client) GetMyDescription added in v0.8.0

func (client *Client) GetMyDescription() *GetMyDescriptionCall

GetMyDescriptionCall constructs a new GetMyDescriptionCall with required parameters.

func (*Client) GetMyName added in v0.9.0

func (client *Client) GetMyName() *GetMyNameCall

GetMyNameCall constructs a new GetMyNameCall with required parameters.

func (*Client) GetMyShortDescription added in v0.8.0

func (client *Client) GetMyShortDescription() *GetMyShortDescriptionCall

GetMyShortDescriptionCall constructs a new GetMyShortDescriptionCall with required parameters.

func (*Client) GetStickerSet

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

GetStickerSetCall constructs a new GetStickerSetCall with required parameters.

func (*Client) GetUpdates

func (client *Client) GetUpdates() *GetUpdatesCall

GetUpdatesCall constructs a new GetUpdatesCall with required parameters.

func (*Client) GetUserChatBoosts added in v0.12.0

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

GetUserChatBoostsCall constructs a new GetUserChatBoostsCall with required parameters.

func (*Client) GetUserProfilePhotos

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

GetUserProfilePhotosCall constructs a new GetUserProfilePhotosCall with required parameters.

func (*Client) GetWebhookInfo

func (client *Client) GetWebhookInfo() *GetWebhookInfoCall

GetWebhookInfoCall constructs a new GetWebhookInfoCall with required parameters.

func (*Client) HideGeneralForumTopic added in v0.6.0

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

HideGeneralForumTopicCall constructs a new HideGeneralForumTopicCall with required parameters.

func (*Client) LeaveChat

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

LeaveChatCall constructs a new LeaveChatCall with required parameters.

func (*Client) LogOut

func (client *Client) LogOut() *LogOutCall

LogOutCall constructs a new LogOutCall with required parameters.

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

PinChatMessageCall constructs a new PinChatMessageCall with required parameters.

func (*Client) PromoteChatMember

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

PromoteChatMemberCall constructs a new PromoteChatMemberCall with required parameters.

func (*Client) ReopenForumTopic added in v0.6.0

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

ReopenForumTopicCall constructs a new ReopenForumTopicCall with required parameters.

func (*Client) ReopenGeneralForumTopic added in v0.6.0

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

ReopenGeneralForumTopicCall constructs a new ReopenGeneralForumTopicCall with required parameters.

func (*Client) ReplaceStickerInSet added in v0.15.0

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

ReplaceStickerInSetCall constructs a new ReplaceStickerInSetCall with required parameters.

func (*Client) RestrictChatMember

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

RestrictChatMemberCall constructs a new RestrictChatMemberCall with required parameters.

func (client *Client) RevokeChatInviteLink(chatID PeerID, inviteLink string) *RevokeChatInviteLinkCall

RevokeChatInviteLinkCall constructs a new RevokeChatInviteLinkCall with required parameters.

func (*Client) SendAnimation

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

SendAnimationCall constructs a new SendAnimationCall with required parameters.

func (*Client) SendAudio

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

SendAudioCall constructs a new SendAudioCall with required parameters.

func (*Client) SendChatAction

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

SendChatActionCall constructs a new SendChatActionCall with required parameters.

func (*Client) SendContact

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

SendContactCall constructs a new SendContactCall with required parameters.

func (*Client) SendDice

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

SendDiceCall constructs a new SendDiceCall with required parameters.

func (*Client) SendDocument

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

SendDocumentCall constructs a new SendDocumentCall with required parameters.

func (*Client) SendGame

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

SendGameCall constructs a new SendGameCall with required parameters.

func (*Client) SendInvoice

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

SendInvoiceCall constructs a new SendInvoiceCall with required parameters.

func (*Client) SendLocation

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

SendLocationCall constructs a new SendLocationCall with required parameters.

func (*Client) SendMediaGroup added in v0.0.5

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

SendMediaGroupCall constructs a new SendMediaGroupCall with required parameters.

func (*Client) SendMessage

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

SendMessageCall constructs a new SendMessageCall with required parameters.

func (*Client) SendPhoto

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

SendPhotoCall constructs a new SendPhotoCall with required parameters.

func (*Client) SendPoll

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

SendPollCall constructs a new SendPollCall with required parameters.

func (*Client) SendSticker

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

SendStickerCall constructs a new SendStickerCall with required parameters.

func (*Client) SendVenue

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

SendVenueCall constructs a new SendVenueCall with required parameters.

func (*Client) SendVideo

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

SendVideoCall constructs a new SendVideoCall with required parameters.

func (*Client) SendVideoNote

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

SendVideoNoteCall constructs a new SendVideoNoteCall with required parameters.

func (*Client) SendVoice

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

SendVoiceCall constructs a new SendVoiceCall with required parameters.

func (*Client) SetChatAdministratorCustomTitle

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

SetChatAdministratorCustomTitleCall constructs a new SetChatAdministratorCustomTitleCall with required parameters.

func (*Client) SetChatDescription

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

SetChatDescriptionCall constructs a new SetChatDescriptionCall with required parameters.

func (*Client) SetChatMenuButton

func (client *Client) SetChatMenuButton() *SetChatMenuButtonCall

SetChatMenuButtonCall constructs a new SetChatMenuButtonCall with required parameters.

func (*Client) SetChatPermissions

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

SetChatPermissionsCall constructs a new SetChatPermissionsCall with required parameters.

func (*Client) SetChatPhoto

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

SetChatPhotoCall constructs a new SetChatPhotoCall with required parameters.

func (*Client) SetChatStickerSet

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

SetChatStickerSetCall constructs a new SetChatStickerSetCall with required parameters.

func (*Client) SetChatTitle

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

SetChatTitleCall constructs a new SetChatTitleCall with required parameters.

func (*Client) SetCustomEmojiStickerSetThumbnail added in v0.8.0

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

SetCustomEmojiStickerSetThumbnailCall constructs a new SetCustomEmojiStickerSetThumbnailCall with required parameters.

func (*Client) SetGameScore

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

SetGameScoreCall constructs a new SetGameScoreCall with required parameters.

func (*Client) SetMessageReaction added in v0.12.0

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

SetMessageReactionCall constructs a new SetMessageReactionCall with required parameters.

func (*Client) SetMyCommands

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

SetMyCommandsCall constructs a new SetMyCommandsCall with required parameters.

func (*Client) SetMyDefaultAdministratorRights

func (client *Client) SetMyDefaultAdministratorRights() *SetMyDefaultAdministratorRightsCall

SetMyDefaultAdministratorRightsCall constructs a new SetMyDefaultAdministratorRightsCall with required parameters.

func (*Client) SetMyDescription added in v0.8.0

func (client *Client) SetMyDescription() *SetMyDescriptionCall

SetMyDescriptionCall constructs a new SetMyDescriptionCall with required parameters.

func (*Client) SetMyName added in v0.9.0

func (client *Client) SetMyName() *SetMyNameCall

SetMyNameCall constructs a new SetMyNameCall with required parameters.

func (*Client) SetMyShortDescription added in v0.8.0

func (client *Client) SetMyShortDescription() *SetMyShortDescriptionCall

SetMyShortDescriptionCall constructs a new SetMyShortDescriptionCall with required parameters.

func (*Client) SetPassportDataErrors

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

SetPassportDataErrorsCall constructs a new SetPassportDataErrorsCall with required parameters.

func (*Client) SetStickerEmojiList added in v0.8.0

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

SetStickerEmojiListCall constructs a new SetStickerEmojiListCall with required parameters.

func (*Client) SetStickerKeywords added in v0.8.0

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

SetStickerKeywordsCall constructs a new SetStickerKeywordsCall with required parameters.

func (*Client) SetStickerMaskPosition added in v0.8.0

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

SetStickerMaskPositionCall constructs a new SetStickerMaskPositionCall with required parameters.

func (*Client) SetStickerPositionInSet

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

SetStickerPositionInSetCall constructs a new SetStickerPositionInSetCall with required parameters.

func (*Client) SetStickerSetThumbnail added in v0.8.0

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

SetStickerSetThumbnailCall constructs a new SetStickerSetThumbnailCall with required parameters.

func (*Client) SetStickerSetTitle added in v0.8.0

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

SetStickerSetTitleCall constructs a new SetStickerSetTitleCall with required parameters.

func (*Client) SetWebhook

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

SetWebhookCall constructs a new SetWebhookCall with required parameters.

func (*Client) StopMessageLiveLocation

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

StopMessageLiveLocationCall constructs a new StopMessageLiveLocationCall with required parameters.

func (*Client) StopMessageLiveLocationInline

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

StopMessageLiveLocationCall constructs a new StopMessageLiveLocationCall with required parameters.

func (*Client) StopPoll

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

StopPollCall constructs a new StopPollCall with required parameters.

func (*Client) Token

func (client *Client) Token() string

func (*Client) UnbanChatMember

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

UnbanChatMemberCall constructs a new UnbanChatMemberCall with required parameters.

func (*Client) UnbanChatSenderChat

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

UnbanChatSenderChatCall constructs a new UnbanChatSenderChatCall with required parameters.

func (*Client) UnhideGeneralForumTopic added in v0.6.0

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

UnhideGeneralForumTopicCall constructs a new UnhideGeneralForumTopicCall with required parameters.

func (*Client) UnpinAllChatMessages

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

UnpinAllChatMessagesCall constructs a new UnpinAllChatMessagesCall with required parameters.

func (*Client) UnpinAllForumTopicMessages added in v0.6.0

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

UnpinAllForumTopicMessagesCall constructs a new UnpinAllForumTopicMessagesCall with required parameters.

func (*Client) UnpinAllGeneralForumTopicMessages added in v0.10.0

func (client *Client) UnpinAllGeneralForumTopicMessages(chatID PeerID) *UnpinAllGeneralForumTopicMessagesCall

UnpinAllGeneralForumTopicMessagesCall constructs a new UnpinAllGeneralForumTopicMessagesCall with required parameters.

func (*Client) UnpinChatMessage

func (client *Client) UnpinChatMessage(chatID PeerID) *UnpinChatMessageCall

UnpinChatMessageCall constructs a new UnpinChatMessageCall with required parameters.

func (*Client) UploadStickerFile

func (client *Client) UploadStickerFile(userID UserID, sticker InputFile, stickerFormat string) *UploadStickerFileCall

UploadStickerFileCall constructs a new UploadStickerFileCall with required parameters.

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 reprenesents 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 Requires no parameters.

func NewCloseCall

func NewCloseCall() *CloseCall

NewCloseCall constructs a new CloseCall with required parameters.

type CloseForumTopicCall added in v0.6.0

type CloseForumTopicCall struct {
	CallNoResult
}

CloseForumTopicCall reprenesents 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

func NewCloseForumTopicCall added in v0.6.0

func NewCloseForumTopicCall(chatID PeerID, messageThreadID int) *CloseForumTopicCall

NewCloseForumTopicCall constructs a new CloseForumTopicCall with required parameters. 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 Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

func (*CloseForumTopicCall) MessageThreadID added in v0.6.0

func (call *CloseForumTopicCall) MessageThreadID(messageThreadID int) *CloseForumTopicCall

MessageThreadID Unique identifier for the target message thread of the forum topic

type CloseGeneralForumTopicCall added in v0.6.0

type CloseGeneralForumTopicCall struct {
	CallNoResult
}

CloseGeneralForumTopicCall reprenesents 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

func NewCloseGeneralForumTopicCall added in v0.6.0

func NewCloseGeneralForumTopicCall(chatID PeerID) *CloseGeneralForumTopicCall

NewCloseGeneralForumTopicCall constructs a new CloseGeneralForumTopicCall with required parameters. 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 Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

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.
	UserID int64 `json:"user_id,omitempty"`

	// Optional. Additional data about the contact in the form of a vCard
	VCard string `json:"vcard,omitempty"`
}

Contact this object represents a phone contact.

type CopyMessageCall

type CopyMessageCall struct {
	Call[MessageID]
}

CopyMessageCall reprenesents a call to the copyMessage method. Use this method to copy messages of any kind Service messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied A quiz poll can be copied only if the value of the field correct_option_id is known to the bot The method is analogous to the method 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 with required parameters. 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) Caption

func (call *CopyMessageCall) Caption(caption string) *CopyMessageCall

Caption New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept

func (*CopyMessageCall) CaptionEntities

func (call *CopyMessageCall) CaptionEntities(captionEntities []MessageEntity) *CopyMessageCall

CaptionEntities A JSON-serialized list of special entities that appear in the new caption, which can be specified instead of parse_mode

func (*CopyMessageCall) ChatID added in v0.0.5

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

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

func (*CopyMessageCall) DisableNotification

func (call *CopyMessageCall) DisableNotification(disableNotification bool) *CopyMessageCall

DisableNotification Sends the message silently. Users will receive a notification with no sound.

func (*CopyMessageCall) FromChatID added in v0.0.5

func (call *CopyMessageCall) FromChatID(fromChatID PeerID) *CopyMessageCall

FromChatID Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)

func (*CopyMessageCall) MessageID added in v0.0.5

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

MessageID Message identifier in the chat specified in from_chat_id

func (*CopyMessageCall) MessageThreadID added in v0.6.0

func (call *CopyMessageCall) MessageThreadID(messageThreadID int) *CopyMessageCall

MessageThreadID Unique identifier for the target message thread (topic) of the forum; for forum supergroups only

func (*CopyMessageCall) ParseMode

func (call *CopyMessageCall) ParseMode(parseMode ParseMode) *CopyMessageCall

ParseMode Mode for parsing entities in the new caption. See formatting options for more details.

func (*CopyMessageCall) ProtectContent

func (call *CopyMessageCall) ProtectContent(protectContent bool) *CopyMessageCall

ProtectContent Protects the contents of the sent message from forwarding and saving

func (*CopyMessageCall) ReplyMarkup

func (call *CopyMessageCall) ReplyMarkup(replyMarkup ReplyMarkup) *CopyMessageCall

ReplyMarkup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.

func (*CopyMessageCall) ReplyParameters added in v0.12.0

func (call *CopyMessageCall) ReplyParameters(replyParameters ReplyParameters) *CopyMessageCall

ReplyParameters Description of the message to reply to

type CopyMessagesCall added in v0.12.0

type CopyMessagesCall struct {
	Call[MessageID]
}

CopyMessagesCall reprenesents 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, giveaway messages, giveaway winners messages, and invoice messages can't be copied A quiz poll can be copied only if the value of the field correct_option_id is known to the bot The method is analogous to the method forwardMessages, but the copied messages don't have a link to the original message Album grouping is kept for copied messages On success, an array of MessageId of the sent messages is returned.

func NewCopyMessagesCall added in v0.12.0

func NewCopyMessagesCall(chatID PeerID, fromChatID PeerID, messageIds []int) *CopyMessagesCall

NewCopyMessagesCall constructs a new CopyMessagesCall with required parameters. 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 Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*CopyMessagesCall) DisableNotification added in v0.12.0

func (call *CopyMessagesCall) DisableNotification(disableNotification bool) *CopyMessagesCall

DisableNotification Sends the messages silently. Users will receive a notification with no sound.

func (*CopyMessagesCall) FromChatID added in v0.12.0

func (call *CopyMessagesCall) FromChatID(fromChatID PeerID) *CopyMessagesCall

FromChatID Unique identifier for the chat where the original messages were sent (or channel username in the format @channelusername)

func (*CopyMessagesCall) MessageIds added in v0.12.0

func (call *CopyMessagesCall) MessageIds(messageIds []int) *CopyMessagesCall

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) MessageThreadID added in v0.12.0

func (call *CopyMessagesCall) MessageThreadID(messageThreadID int) *CopyMessagesCall

MessageThreadID Unique identifier for the target message thread (topic) of the forum; for forum supergroups only

func (*CopyMessagesCall) ProtectContent added in v0.12.0

func (call *CopyMessagesCall) ProtectContent(protectContent bool) *CopyMessagesCall

ProtectContent Protects the contents of the sent messages from forwarding and saving

func (*CopyMessagesCall) RemoveCaption added in v0.12.0

func (call *CopyMessagesCall) RemoveCaption(removeCaption bool) *CopyMessagesCall

RemoveCaption Pass True to copy the messages without their captions

type CreateChatInviteLinkCall

type CreateChatInviteLinkCall struct {
	Call[ChatInviteLink]
}

CreateChatInviteLinkCall reprenesents 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 revokeChatInviteLink Returns the new invite link as ChatInviteLink object.

func NewCreateChatInviteLinkCall

func NewCreateChatInviteLinkCall(chatID PeerID) *CreateChatInviteLinkCall

NewCreateChatInviteLinkCall constructs a new CreateChatInviteLinkCall with required parameters. 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 Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*CreateChatInviteLinkCall) CreatesJoinRequest

func (call *CreateChatInviteLinkCall) CreatesJoinRequest(createsJoinRequest bool) *CreateChatInviteLinkCall

CreatesJoinRequest True, if users joining the chat via the link need to be approved by chat administrators. If True, member_limit can't be specified

func (*CreateChatInviteLinkCall) ExpireDate

func (call *CreateChatInviteLinkCall) ExpireDate(expireDate int) *CreateChatInviteLinkCall

ExpireDate Point in time (Unix timestamp) when the link will expire

func (*CreateChatInviteLinkCall) MemberLimit

func (call *CreateChatInviteLinkCall) MemberLimit(memberLimit int) *CreateChatInviteLinkCall

MemberLimit The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999

func (*CreateChatInviteLinkCall) Name

Name Invite link name; 0-32 characters

type CreateForumTopicCall added in v0.6.0

type CreateForumTopicCall struct {
	Call[ForumTopic]
}

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

func NewCreateForumTopicCall added in v0.6.0

func NewCreateForumTopicCall(chatID PeerID, name string) *CreateForumTopicCall

NewCreateForumTopicCall constructs a new CreateForumTopicCall with required parameters. 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 Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

func (*CreateForumTopicCall) IconColor added in v0.6.0

func (call *CreateForumTopicCall) IconColor(iconColor int) *CreateForumTopicCall

IconColor Color of the topic icon in RGB format. Currently, must be one of 7322096 (0x6FB9F0), 16766590 (0xFFD67E), 13338331 (0xCB86DB), 9367192 (0x8EEE98), 16749490 (0xFF93B2), or 16478047 (0xFB6F5F)

func (*CreateForumTopicCall) IconCustomEmojiID added in v0.6.0

func (call *CreateForumTopicCall) IconCustomEmojiID(iconCustomEmojiID string) *CreateForumTopicCall

IconCustomEmojiID Unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all allowed custom emoji identifiers.

func (*CreateForumTopicCall) Name added in v0.6.0

Name Topic name, 1-128 characters

type CreateInvoiceLinkCall

type CreateInvoiceLinkCall struct {
	Call[string]
}

CreateInvoiceLinkCall reprenesents 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, providerToken string, currency string, prices []LabeledPrice) *CreateInvoiceLinkCall

NewCreateInvoiceLinkCall constructs a new CreateInvoiceLinkCall with required parameters. 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 for your internal processes. providerToken - Payment provider token, obtained via BotFather currency - Three-letter ISO 4217 currency code, see more on currencies prices - Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.)

func (*CreateInvoiceLinkCall) Currency

func (call *CreateInvoiceLinkCall) Currency(currency string) *CreateInvoiceLinkCall

Currency Three-letter ISO 4217 currency code, see more on currencies

func (*CreateInvoiceLinkCall) Description

func (call *CreateInvoiceLinkCall) Description(description string) *CreateInvoiceLinkCall

Description Product description, 1-255 characters

func (*CreateInvoiceLinkCall) IsFlexible

func (call *CreateInvoiceLinkCall) IsFlexible(isFlexible bool) *CreateInvoiceLinkCall

IsFlexible Pass True if the final price depends on the shipping method

func (*CreateInvoiceLinkCall) MaxTipAmount

func (call *CreateInvoiceLinkCall) MaxTipAmount(maxTipAmount int) *CreateInvoiceLinkCall

MaxTipAmount 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

func (*CreateInvoiceLinkCall) NeedEmail

func (call *CreateInvoiceLinkCall) NeedEmail(needEmail bool) *CreateInvoiceLinkCall

NeedEmail Pass True if you require the user's email address to complete the order

func (*CreateInvoiceLinkCall) NeedName

func (call *CreateInvoiceLinkCall) NeedName(needName bool) *CreateInvoiceLinkCall

NeedName Pass True if you require the user's full name to complete the order

func (*CreateInvoiceLinkCall) NeedPhoneNumber

func (call *CreateInvoiceLinkCall) NeedPhoneNumber(needPhoneNumber bool) *CreateInvoiceLinkCall

NeedPhoneNumber Pass True if you require the user's phone number to complete the order

func (*CreateInvoiceLinkCall) NeedShippingAddress

func (call *CreateInvoiceLinkCall) NeedShippingAddress(needShippingAddress bool) *CreateInvoiceLinkCall

NeedShippingAddress Pass True if you require the user's shipping address to complete the order

func (*CreateInvoiceLinkCall) Payload

func (call *CreateInvoiceLinkCall) Payload(payload string) *CreateInvoiceLinkCall

Payload Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.

func (*CreateInvoiceLinkCall) PhotoHeight

func (call *CreateInvoiceLinkCall) PhotoHeight(photoHeight int) *CreateInvoiceLinkCall

PhotoHeight Photo height

func (*CreateInvoiceLinkCall) PhotoSize

func (call *CreateInvoiceLinkCall) PhotoSize(photoSize int) *CreateInvoiceLinkCall

PhotoSize Photo size in bytes

func (*CreateInvoiceLinkCall) PhotoURL added in v0.0.5

func (call *CreateInvoiceLinkCall) PhotoURL(photoURL string) *CreateInvoiceLinkCall

PhotoURL URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service.

func (*CreateInvoiceLinkCall) PhotoWidth

func (call *CreateInvoiceLinkCall) PhotoWidth(photoWidth int) *CreateInvoiceLinkCall

PhotoWidth Photo width

func (*CreateInvoiceLinkCall) Prices

Prices Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.)

func (*CreateInvoiceLinkCall) ProviderData

func (call *CreateInvoiceLinkCall) ProviderData(providerData string) *CreateInvoiceLinkCall

ProviderData JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider.

func (*CreateInvoiceLinkCall) ProviderToken

func (call *CreateInvoiceLinkCall) ProviderToken(providerToken string) *CreateInvoiceLinkCall

ProviderToken Payment provider token, obtained via BotFather

func (*CreateInvoiceLinkCall) SendEmailToProvider

func (call *CreateInvoiceLinkCall) SendEmailToProvider(sendEmailToProvider bool) *CreateInvoiceLinkCall

SendEmailToProvider Pass True if the user's email address should be sent to the provider

func (*CreateInvoiceLinkCall) SendPhoneNumberToProvider

func (call *CreateInvoiceLinkCall) SendPhoneNumberToProvider(sendPhoneNumberToProvider bool) *CreateInvoiceLinkCall

SendPhoneNumberToProvider Pass True if the user's phone number should be sent to the provider

func (*CreateInvoiceLinkCall) SuggestedTipAmounts

func (call *CreateInvoiceLinkCall) SuggestedTipAmounts(suggestedTipAmounts []int) *CreateInvoiceLinkCall

SuggestedTipAmounts A JSON-serialized array of suggested amounts of tips in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount.

func (*CreateInvoiceLinkCall) Title

Title Product name, 1-32 characters

type CreateNewStickerSetCall

type CreateNewStickerSetCall struct {
	CallNoResult
}

CreateNewStickerSetCall reprenesents 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

func NewCreateNewStickerSetCall

func NewCreateNewStickerSetCall(userID UserID, name string, title string, stickers []InputSticker) *CreateNewStickerSetCall

NewCreateNewStickerSetCall constructs a new CreateNewStickerSetCall with required parameters. 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 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.

func (*CreateNewStickerSetCall) NeedsRepainting added in v0.8.0

func (call *CreateNewStickerSetCall) NeedsRepainting(needsRepainting bool) *CreateNewStickerSetCall

NeedsRepainting Pass True if stickers in the sticker set must be repainted to the color of text when used in messages, the accent color if used as emoji status, white on chat photos, or another appropriate color based on context; for custom emoji sticker sets only

func (*CreateNewStickerSetCall) StickerType added in v0.5.0

func (call *CreateNewStickerSetCall) StickerType(stickerType StickerType) *CreateNewStickerSetCall

StickerType Type of stickers in the set, pass “regular”, “mask”, or “custom_emoji”. By default, a regular sticker set is created.

func (*CreateNewStickerSetCall) Stickers added in v0.8.0

func (call *CreateNewStickerSetCall) Stickers(stickers []InputSticker) *CreateNewStickerSetCall

Stickers A JSON-serialized list of 1-50 initial stickers to be added to the sticker set

func (*CreateNewStickerSetCall) Title

Title Sticker set title, 1-64 characters

func (*CreateNewStickerSetCall) UserID added in v0.0.5

UserID User identifier of created sticker set owner

type DeclineChatJoinRequestCall

type DeclineChatJoinRequestCall struct {
	CallNoResult
}

DeclineChatJoinRequestCall reprenesents 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

func NewDeclineChatJoinRequestCall

func NewDeclineChatJoinRequestCall(chatID PeerID, userID UserID) *DeclineChatJoinRequestCall

NewDeclineChatJoinRequestCall constructs a new DeclineChatJoinRequestCall with required parameters. 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 Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*DeclineChatJoinRequestCall) UserID added in v0.0.5

UserID Unique identifier of the target user

type DeleteChatPhotoCall

type DeleteChatPhotoCall struct {
	CallNoResult
}

DeleteChatPhotoCall reprenesents 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

func NewDeleteChatPhotoCall

func NewDeleteChatPhotoCall(chatID PeerID) *DeleteChatPhotoCall

NewDeleteChatPhotoCall constructs a new DeleteChatPhotoCall with required parameters. 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 Unique identifier for the target chat or username of the target channel (in the format @channelusername)

type DeleteChatStickerSetCall

type DeleteChatStickerSetCall struct {
	CallNoResult
}

DeleteChatStickerSetCall reprenesents 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 getChat requests to check if the bot can use this method

func NewDeleteChatStickerSetCall

func NewDeleteChatStickerSetCall(chatID PeerID) *DeleteChatStickerSetCall

NewDeleteChatStickerSetCall constructs a new DeleteChatStickerSetCall with required parameters. 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 Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

type DeleteForumTopicCall added in v0.6.0

type DeleteForumTopicCall struct {
	CallNoResult
}

DeleteForumTopicCall reprenesents a call to the deleteForumTopic method. Use this method to delete a forum topic along with all its messages in a forum supergroup chat The bot must be an administrator in the chat for this to work and must have the can_delete_messages administrator rights

func NewDeleteForumTopicCall added in v0.6.0

func NewDeleteForumTopicCall(chatID PeerID, messageThreadID int) *DeleteForumTopicCall

NewDeleteForumTopicCall constructs a new DeleteForumTopicCall with required parameters. 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 Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

func (*DeleteForumTopicCall) MessageThreadID added in v0.6.0

func (call *DeleteForumTopicCall) MessageThreadID(messageThreadID int) *DeleteForumTopicCall

MessageThreadID Unique identifier for the target message thread of the forum topic

type DeleteMessageCall

type DeleteMessageCall struct {
	CallNoResult
}

DeleteMessageCall reprenesents a call to the deleteMessage method.

func NewDeleteMessageCall

func NewDeleteMessageCall(chatID PeerID, messageID int) *DeleteMessageCall

NewDeleteMessageCall constructs a new DeleteMessageCall with required parameters. 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 Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*DeleteMessageCall) MessageID added in v0.0.5

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

MessageID Identifier of the message to delete

type DeleteMessagesCall added in v0.12.0

type DeleteMessagesCall struct {
	CallNoResult
}

DeleteMessagesCall reprenesents 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

func NewDeleteMessagesCall added in v0.12.0

func NewDeleteMessagesCall(chatID PeerID, messageIds []int) *DeleteMessagesCall

NewDeleteMessagesCall constructs a new DeleteMessagesCall with required parameters. 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 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 Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*DeleteMessagesCall) MessageIds added in v0.12.0

func (call *DeleteMessagesCall) MessageIds(messageIds []int) *DeleteMessagesCall

MessageIds A JSON-serialized list of 1-100 identifiers of messages to delete. See deleteMessage for limitations on which messages can be deleted

type DeleteMyCommandsCall

type DeleteMyCommandsCall struct {
	CallNoResult
}

DeleteMyCommandsCall reprenesents 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

func NewDeleteMyCommandsCall

func NewDeleteMyCommandsCall() *DeleteMyCommandsCall

NewDeleteMyCommandsCall constructs a new DeleteMyCommandsCall with required parameters.

func (*DeleteMyCommandsCall) LanguageCode

func (call *DeleteMyCommandsCall) LanguageCode(languageCode string) *DeleteMyCommandsCall

LanguageCode A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands

func (*DeleteMyCommandsCall) Scope

Scope A JSON-serialized object, describing scope of users for which the commands are relevant. Defaults to BotCommandScopeDefault.

type DeleteStickerFromSetCall

type DeleteStickerFromSetCall struct {
	CallNoResult
}

DeleteStickerFromSetCall reprenesents a call to the deleteStickerFromSet method. Use this method to delete a sticker from a set created by the bot

func NewDeleteStickerFromSetCall

func NewDeleteStickerFromSetCall(sticker string) *DeleteStickerFromSetCall

NewDeleteStickerFromSetCall constructs a new DeleteStickerFromSetCall with required parameters. sticker - File identifier of the sticker

func (*DeleteStickerFromSetCall) Sticker

Sticker File identifier of the sticker

type DeleteStickerSetCall added in v0.8.0

type DeleteStickerSetCall struct {
	CallNoResult
}

DeleteStickerSetCall reprenesents a call to the deleteStickerSet method. Use this method to delete a sticker set that was created by the bot

func NewDeleteStickerSetCall added in v0.8.0

func NewDeleteStickerSetCall(name string) *DeleteStickerSetCall

NewDeleteStickerSetCall constructs a new DeleteStickerSetCall with required parameters. name - Sticker set name

func (*DeleteStickerSetCall) Name added in v0.8.0

Name Sticker set name

type DeleteWebhookCall

type DeleteWebhookCall struct {
	CallNoResult
}

DeleteWebhookCall reprenesents a call to the deleteWebhook method. Use this method to remove webhook integration if you decide to switch back to getUpdates

func NewDeleteWebhookCall

func NewDeleteWebhookCall() *DeleteWebhookCall

NewDeleteWebhookCall constructs a new DeleteWebhookCall with required parameters.

func (*DeleteWebhookCall) DropPendingUpdates

func (call *DeleteWebhookCall) DropPendingUpdates(dropPendingUpdates bool) *DeleteWebhookCall

DropPendingUpdates Pass True to drop all pending updates

type Dice

type Dice struct {
	// Emoji on which the dice throw animation is based
	Emoji string `json:"emoji"`

	// Value of the dice, 1-6 for “”, “” and “” base emoji, 1-5 for “” and “” base emoji, 1-64 for “” base emoji
	Value int `json:"value"`
}

Dice this object represents an animated emoji that displays a random value.

type Document

type Document struct {
	// Identifier for this file, which can be used to download or reuse the file
	FileID 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 sender
	Thumbnail *PhotoSize `json:"thumbnail,omitempty"`

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

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

	// Optional. File size in bytes.
	FileSize int64 `json:"file_size,omitempty"`
}

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

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 reprenesents 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 with required parameters. 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 Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*EditChatInviteLinkCall) CreatesJoinRequest

func (call *EditChatInviteLinkCall) CreatesJoinRequest(createsJoinRequest bool) *EditChatInviteLinkCall

CreatesJoinRequest True, if users joining the chat via the link need to be approved by chat administrators. If True, member_limit can't be specified

func (*EditChatInviteLinkCall) ExpireDate

func (call *EditChatInviteLinkCall) ExpireDate(expireDate int) *EditChatInviteLinkCall

ExpireDate Point in time (Unix timestamp) when the link will expire

func (call *EditChatInviteLinkCall) InviteLink(inviteLink string) *EditChatInviteLinkCall

InviteLink The invite link to edit

func (*EditChatInviteLinkCall) MemberLimit

func (call *EditChatInviteLinkCall) MemberLimit(memberLimit int) *EditChatInviteLinkCall

MemberLimit The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999

func (*EditChatInviteLinkCall) Name

Name Invite link name; 0-32 characters

type EditForumTopicCall added in v0.6.0

type EditForumTopicCall struct {
	CallNoResult
}

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

func NewEditForumTopicCall added in v0.6.0

func NewEditForumTopicCall(chatID PeerID, messageThreadID int) *EditForumTopicCall

NewEditForumTopicCall constructs a new EditForumTopicCall with required parameters. 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 Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

func (*EditForumTopicCall) IconCustomEmojiID added in v0.6.0

func (call *EditForumTopicCall) IconCustomEmojiID(iconCustomEmojiID string) *EditForumTopicCall

IconCustomEmojiID New unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all allowed custom emoji identifiers. Pass an empty string to remove the icon. If not specified, the current icon will be kept

func (*EditForumTopicCall) MessageThreadID added in v0.6.0

func (call *EditForumTopicCall) MessageThreadID(messageThreadID int) *EditForumTopicCall

MessageThreadID Unique identifier for the target message thread of the forum topic

func (*EditForumTopicCall) Name added in v0.6.0

func (call *EditForumTopicCall) Name(name string) *EditForumTopicCall

Name New topic name, 0-128 characters. If not specified or empty, the current name of the topic will be kept

type EditGeneralForumTopicCall added in v0.6.0

type EditGeneralForumTopicCall struct {
	CallNoResult
}

EditGeneralForumTopicCall reprenesents 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 can_manage_topics administrator rights

func NewEditGeneralForumTopicCall added in v0.6.0

func NewEditGeneralForumTopicCall(chatID PeerID, name string) *EditGeneralForumTopicCall

NewEditGeneralForumTopicCall constructs a new EditGeneralForumTopicCall with required parameters. 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 Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

func (*EditGeneralForumTopicCall) Name added in v0.6.0

Name New topic name, 1-128 characters

type EditMessageCaptionCall

type EditMessageCaptionCall struct {
	Call[Message]
}

EditMessageCaptionCall reprenesents 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.

func NewEditMessageCaptionCall

func NewEditMessageCaptionCall(chatID PeerID, messageID int, caption string) *EditMessageCaptionCall

NewEditMessageCaptionCall constructs a new EditMessageCaptionCall with required parameters. 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

NewEditMessageCaptionCall constructs a new EditMessageCaptionCall with required parameters. 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) Caption

func (call *EditMessageCaptionCall) Caption(caption string) *EditMessageCaptionCall

Caption New caption of the message, 0-1024 characters after entities parsing

func (*EditMessageCaptionCall) CaptionEntities

func (call *EditMessageCaptionCall) CaptionEntities(captionEntities []MessageEntity) *EditMessageCaptionCall

CaptionEntities A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode

func (*EditMessageCaptionCall) ChatID added in v0.0.5

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)

func (*EditMessageCaptionCall) InlineMessageID added in v0.0.5

func (call *EditMessageCaptionCall) InlineMessageID(inlineMessageID string) *EditMessageCaptionCall

InlineMessageID Required if chat_id and message_id are not specified. Identifier of the inline message

func (*EditMessageCaptionCall) MessageID added in v0.0.5

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

MessageID Required if inline_message_id is not specified. Identifier of the message to edit

func (*EditMessageCaptionCall) ParseMode

func (call *EditMessageCaptionCall) ParseMode(parseMode ParseMode) *EditMessageCaptionCall

ParseMode Mode for parsing entities in the message caption. See formatting options for more details.

func (*EditMessageCaptionCall) ReplyMarkup

func (call *EditMessageCaptionCall) ReplyMarkup(replyMarkup InlineKeyboardMarkup) *EditMessageCaptionCall

ReplyMarkup A JSON-serialized object for an inline keyboard.

type EditMessageLiveLocationCall

type EditMessageLiveLocationCall struct {
	Call[Message]
}

EditMessageLiveLocationCall reprenesents 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 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) *EditMessageLiveLocationCall

NewEditMessageLiveLocationCall constructs a new EditMessageLiveLocationCall with required parameters. 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 NewEditMessageLiveLocationInlineCall

func NewEditMessageLiveLocationInlineCall(inlineMessageID string) *EditMessageLiveLocationCall

NewEditMessageLiveLocationCall constructs a new EditMessageLiveLocationCall with required parameters. inlineMessageID - Required if chat_id and message_id are not specified. Identifier of the inline message

func (*EditMessageLiveLocationCall) ChatID added in v0.0.5

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)

func (*EditMessageLiveLocationCall) Heading

Heading Direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.

func (*EditMessageLiveLocationCall) HorizontalAccuracy

func (call *EditMessageLiveLocationCall) HorizontalAccuracy(horizontalAccuracy float64) *EditMessageLiveLocationCall

HorizontalAccuracy The radius of uncertainty for the location, measured in meters; 0-1500

func (*EditMessageLiveLocationCall) InlineMessageID added in v0.0.5

func (call *EditMessageLiveLocationCall) InlineMessageID(inlineMessageID string) *EditMessageLiveLocationCall

InlineMessageID Required if chat_id and message_id are not specified. Identifier of the inline message

func (*EditMessageLiveLocationCall) Latitude

Latitude Latitude of new location

func (*EditMessageLiveLocationCall) Longitude

Longitude Longitude of new location

func (*EditMessageLiveLocationCall) MessageID added in v0.0.5

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

MessageID Required if inline_message_id is not specified. Identifier of the message to edit

func (*EditMessageLiveLocationCall) ProximityAlertRadius

func (call *EditMessageLiveLocationCall) ProximityAlertRadius(proximityAlertRadius int) *EditMessageLiveLocationCall

ProximityAlertRadius The maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.

func (*EditMessageLiveLocationCall) ReplyMarkup

ReplyMarkup A JSON-serialized object for a new inline keyboard.

type EditMessageMediaCall

type EditMessageMediaCall struct {
	Call[Message]
}

EditMessageMediaCall reprenesents a call to the editMessageMedia method. Use this method to edit animation, audio, document, photo, or video messages If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.

func NewEditMessageMediaCall

func NewEditMessageMediaCall(media InputMedia) *EditMessageMediaCall

NewEditMessageMediaCall constructs a new EditMessageMediaCall with required parameters. media - A JSON-serialized object for a new media content of the message

func (*EditMessageMediaCall) ChatID added in v0.0.5

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

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)

func (*EditMessageMediaCall) InlineMessageID added in v0.0.5

func (call *EditMessageMediaCall) InlineMessageID(inlineMessageID string) *EditMessageMediaCall

InlineMessageID Required if chat_id and message_id are not specified. Identifier of the inline message

func (*EditMessageMediaCall) Media

Media A JSON-serialized object for a new media content of the message

func (*EditMessageMediaCall) MessageID added in v0.0.5

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

MessageID Required if inline_message_id is not specified. Identifier of the message to edit

func (*EditMessageMediaCall) ReplyMarkup

func (call *EditMessageMediaCall) ReplyMarkup(replyMarkup InlineKeyboardMarkup) *EditMessageMediaCall

ReplyMarkup A JSON-serialized object for a new inline keyboard.

type EditMessageReplyMarkupCall

type EditMessageReplyMarkupCall struct {
	Call[Message]
}

EditMessageReplyMarkupCall reprenesents 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.

func NewEditMessageReplyMarkupCall

func NewEditMessageReplyMarkupCall(chatID PeerID, messageID int) *EditMessageReplyMarkupCall

NewEditMessageReplyMarkupCall constructs a new EditMessageReplyMarkupCall with required parameters. 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

NewEditMessageReplyMarkupCall constructs a new EditMessageReplyMarkupCall with required parameters. inlineMessageID - Required if chat_id and message_id are not specified. Identifier of the inline message

func (*EditMessageReplyMarkupCall) ChatID added in v0.0.5

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)

func (*EditMessageReplyMarkupCall) InlineMessageID added in v0.0.5

func (call *EditMessageReplyMarkupCall) InlineMessageID(inlineMessageID string) *EditMessageReplyMarkupCall

InlineMessageID Required if chat_id and message_id are not specified. Identifier of the inline message

func (*EditMessageReplyMarkupCall) MessageID added in v0.0.5

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

MessageID Required if inline_message_id is not specified. Identifier of the message to edit

func (*EditMessageReplyMarkupCall) ReplyMarkup

ReplyMarkup A JSON-serialized object for an inline keyboard.

type EditMessageTextCall

type EditMessageTextCall struct {
	Call[Message]
}

EditMessageTextCall reprenesents 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.

func NewEditMessageTextCall

func NewEditMessageTextCall(chatID PeerID, messageID int, text string) *EditMessageTextCall

NewEditMessageTextCall constructs a new EditMessageTextCall with required parameters. 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

NewEditMessageTextCall constructs a new EditMessageTextCall with required parameters. 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) ChatID added in v0.0.5

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

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)

func (*EditMessageTextCall) Entities

func (call *EditMessageTextCall) Entities(entities []MessageEntity) *EditMessageTextCall

Entities A JSON-serialized list of special entities that appear in message text, which can be specified instead of parse_mode

func (*EditMessageTextCall) InlineMessageID added in v0.0.5

func (call *EditMessageTextCall) InlineMessageID(inlineMessageID string) *EditMessageTextCall

InlineMessageID Required if chat_id and message_id are not specified. Identifier of the inline message

func (*EditMessageTextCall) LinkPreviewOptions added in v0.12.0

func (call *EditMessageTextCall) LinkPreviewOptions(linkPreviewOptions LinkPreviewOptions) *EditMessageTextCall

LinkPreviewOptions Link preview generation options for the message

func (*EditMessageTextCall) MessageID added in v0.0.5

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

MessageID Required if inline_message_id is not specified. Identifier of the message to edit

func (*EditMessageTextCall) ParseMode

func (call *EditMessageTextCall) ParseMode(parseMode ParseMode) *EditMessageTextCall

ParseMode Mode for parsing entities in the message text. See formatting options for more details.

func (*EditMessageTextCall) ReplyMarkup

func (call *EditMessageTextCall) ReplyMarkup(replyMarkup InlineKeyboardMarkup) *EditMessageTextCall

ReplyMarkup A JSON-serialized object for an inline keyboard.

func (*EditMessageTextCall) Text

Text New text of the message, 1-4096 characters after entities parsing

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 string `json:"type"`

	// Optional. Base64-encoded encrypted Telegram Passport element data provided by the user; available only for “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport” and “address” types. Can be decrypted and verified using the accompanying EncryptedCredentials.
	Data string `json:"data,omitempty"`

	// Optional. User's verified phone number; available only for “phone_number” type
	PhoneNumber string `json:"phone_number,omitempty"`

	// Optional. User's verified email address; available only for “email” type
	Email string `json:"email,omitempty"`

	// Optional. Array of encrypted files with documents provided by the user; available only for “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials.
	Files []PassportFile `json:"files,omitempty"`

	// Optional. Encrypted file with the front side of the document, provided by the user; available only for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials.
	FrontSide *PassportFile `json:"front_side,omitempty"`

	// Optional. Encrypted file with the reverse side of the document, provided by the user; available only for “driver_license” and “identity_card”. The file can be decrypted and verified using the accompanying EncryptedCredentials.
	ReverseSide *PassportFile `json:"reverse_side,omitempty"`

	// Optional. Encrypted file with the selfie of the user holding a document, provided by the user; available if requested for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials.
	Selfie *PassportFile `json:"selfie,omitempty"`

	// Optional. Array of encrypted files with translated versions of documents provided by the user; available if requested for “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials.
	Translation []PassportFile `json:"translation,omitempty"`

	// Base64-encoded element hash for using in PassportElementErrorUnspecified
	Hash string `json:"hash"`
}

EncryptedPassportElement describes documents or other Telegram Passport elements shared with the bot by the user.

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 reprenesents 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.

func NewExportChatInviteLinkCall

func NewExportChatInviteLinkCall(chatID PeerID) *ExportChatInviteLinkCall

NewExportChatInviteLinkCall constructs a new ExportChatInviteLinkCall with required parameters. 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 Unique identifier for the target chat or username of the target channel (in the format @channelusername)

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 is a photo, available sizes of the photo
	Photo []PhotoSize `json:"photo,omitempty"`

	// Optional. Message is a sticker, information about the sticker
	Sticker *Sticker `json:"sticker,omitempty"`

	// Optional. Message is a forwarded story
	Story *Story `json:"story,omitempty"`

	// Optional. Message is a video, information about the video
	Video *Video `json:"video,omitempty"`

	// Optional. Message is a video note, information about the video message
	VideoNote *VideoNote `json:"video_note,omitempty"`

	// Optional. Message is a voice message, information about the file
	Voice *Voice `json:"voice,omitempty"`

	// Optional. True, if the message media is covered by a spoiler animation
	HasMediaSpoiler bool `json:"has_media_spoiler,omitempty"`

	// Optional. Message is a shared contact, information about the contact
	Contact *Contact `json:"contact,omitempty"`

	// Optional. Message is a dice with random value
	Dice *Dice `json:"dice,omitempty"`

	// Optional. Message is a game, information about the game. More about games »
	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 »
	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.
	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 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.

func NewForceReply added in v0.0.2

func NewForceReply() *ForceReply

NewForceReply creates a new ForceReply.

func (*ForceReply) WithInputFieldPlaceholder added in v0.0.2

func (markup *ForceReply) WithInputFieldPlaceholder(placeholder string) *ForceReply

WithInputFieldPlaceholder sets the placeholder to be shown in the input field when the reply is active; 1-64 characters

func (*ForceReply) WithSelective added in v0.0.2

func (markup *ForceReply) WithSelective() *ForceReply

WithSelective set it if you want to force reply for specific users only.

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 int `json:"icon_color"`

	// Optional. Unique identifier of the custom emoji shown as the topic icon
	IconCustomEmojiID string `json:"icon_custom_emoji_id,omitempty"`
}

ForumTopic this object represents a forum topic.

type ForumTopicClosed added in v0.6.0

type ForumTopicClosed struct{}

ForumTopicClosed 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 int `json:"icon_color"`

	// Optional. Unique identifier of the custom emoji shown as the topic icon
	IconCustomEmojiID string `json:"icon_custom_emoji_id,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 represents a service message about a forum topic reopened in the chat. Currently holds no information.

type ForwardMessageCall

type ForwardMessageCall struct {
	Call[Message]
}

ForwardMessageCall reprenesents 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 with required parameters. 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 Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*ForwardMessageCall) DisableNotification

func (call *ForwardMessageCall) DisableNotification(disableNotification bool) *ForwardMessageCall

DisableNotification Sends the message silently. Users will receive a notification with no sound.

func (*ForwardMessageCall) FromChatID added in v0.0.5

func (call *ForwardMessageCall) FromChatID(fromChatID PeerID) *ForwardMessageCall

FromChatID Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)

func (*ForwardMessageCall) MessageID added in v0.0.5

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

MessageID Message identifier in the chat specified in from_chat_id

func (*ForwardMessageCall) MessageThreadID added in v0.6.0

func (call *ForwardMessageCall) MessageThreadID(messageThreadID int) *ForwardMessageCall

MessageThreadID Unique identifier for the target message thread (topic) of the forum; for forum supergroups only

func (*ForwardMessageCall) ProtectContent

func (call *ForwardMessageCall) ProtectContent(protectContent bool) *ForwardMessageCall

ProtectContent Protects the contents of the forwarded message from forwarding and saving

type ForwardMessagesCall added in v0.12.0

type ForwardMessagesCall struct {
	Call[MessageID]
}

ForwardMessagesCall reprenesents 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 with required parameters. 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 Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*ForwardMessagesCall) DisableNotification added in v0.12.0

func (call *ForwardMessagesCall) DisableNotification(disableNotification bool) *ForwardMessagesCall

DisableNotification Sends the messages silently. Users will receive a notification with no sound.

func (*ForwardMessagesCall) FromChatID added in v0.12.0

func (call *ForwardMessagesCall) FromChatID(fromChatID PeerID) *ForwardMessagesCall

FromChatID Unique identifier for the chat where the original messages were sent (or channel username in the format @channelusername)

func (*ForwardMessagesCall) MessageIds added in v0.12.0

func (call *ForwardMessagesCall) MessageIds(messageIds []int) *ForwardMessagesCall

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) MessageThreadID added in v0.12.0

func (call *ForwardMessagesCall) MessageThreadID(messageThreadID int) *ForwardMessagesCall

MessageThreadID Unique identifier for the target message thread (topic) of the forum; for forum supergroups only

func (*ForwardMessagesCall) ProtectContent added in v0.12.0

func (call *ForwardMessagesCall) ProtectContent(protectContent bool) *ForwardMessagesCall

ProtectContent Protects the contents of the forwarded messages from forwarding and saving

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 setGameScore, or manually edited using editMessageText. 0-4096 characters.
	Text string `json:"text,omitempty"`

	// Optional. Special entities that appear in text, such as usernames, URLs, bot commands, etc.
	TextEntities []MessageEntity `json:"text_entities,omitempty"`

	// Optional. Animation that will be displayed in the game message in chats. Upload via BotFather
	Animation *Animation `json:"animation,omitempty"`
}

Game 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.

type GeneralForumTopicHidden added in v0.6.0

type GeneralForumTopicHidden struct{}

GeneralForumTopicHidden 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 represents a service message about General forum topic unhidden in the chat. Currently holds no information.

type GetBusinessConnectionCall added in v0.15.0

type GetBusinessConnectionCall struct {
	Call[BusinessConnection]
}

GetBusinessConnectionCall reprenesents 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 with required parameters. businessConnectionID - Unique identifier of the business connection

func (*GetBusinessConnectionCall) BusinessConnectionID added in v0.15.0

func (call *GetBusinessConnectionCall) BusinessConnectionID(businessConnectionID string) *GetBusinessConnectionCall

BusinessConnectionID Unique identifier of the business connection

type GetChatAdministratorsCall

type GetChatAdministratorsCall struct {
	Call[[]ChatMember]
}

GetChatAdministratorsCall reprenesents 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 with required parameters. 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 Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)

type GetChatCall

type GetChatCall struct {
	Call[Chat]
}

GetChatCall reprenesents a call to the getChat method. Use this method to get up to date information about the chat Returns a Chat object on success.

func NewGetChatCall

func NewGetChatCall(chatID PeerID) *GetChatCall

NewGetChatCall constructs a new GetChatCall with required parameters. 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 Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)

type GetChatMemberCall

type GetChatMemberCall struct {
	Call[ChatMember]
}

GetChatMemberCall reprenesents 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 with required parameters. 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 Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)

func (*GetChatMemberCall) UserID added in v0.0.5

func (call *GetChatMemberCall) UserID(userID UserID) *GetChatMemberCall

UserID Unique identifier of the target user

type GetChatMemberCountCall

type GetChatMemberCountCall struct {
	Call[int]
}

GetChatMemberCountCall reprenesents 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 with required parameters. 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 Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)

type GetChatMenuButtonCall

type GetChatMenuButtonCall struct {
	Call[MenuButtonOneOf]
}

GetChatMenuButtonCall reprenesents 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 with required parameters.

func (*GetChatMenuButtonCall) ChatID added in v0.0.5

func (call *GetChatMenuButtonCall) ChatID(chatID ChatID) *GetChatMenuButtonCall

ChatID Unique identifier for the target private chat. If not specified, default bot's menu button will be returned

type GetCustomEmojiStickersCall added in v0.5.0

type GetCustomEmojiStickersCall struct {
	Call[[]Sticker]
}

GetCustomEmojiStickersCall reprenesents 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 with required parameters. customEmojiIds - A JSON-serialized list of custom emoji identifiers. At most 200 custom emoji identifiers can be specified.

func (*GetCustomEmojiStickersCall) CustomEmojiIds added in v0.5.0

func (call *GetCustomEmojiStickersCall) CustomEmojiIds(customEmojiIds []string) *GetCustomEmojiStickersCall

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

type GetFileCall

type GetFileCall struct {
	Call[File]
}

GetFileCall reprenesents 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 getFile again.

func NewGetFileCall

func NewGetFileCall(fileID FileID) *GetFileCall

NewGetFileCall constructs a new GetFileCall with required parameters. fileID - File identifier to get information about

func (*GetFileCall) FileID added in v0.0.5

func (call *GetFileCall) FileID(fileID FileID) *GetFileCall

FileID File identifier to get information about

type GetForumTopicIconStickersCall added in v0.6.0

type GetForumTopicIconStickersCall struct {
	Call[[]Sticker]
}

GetForumTopicIconStickersCall reprenesents 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 with required parameters.

type GetGameHighScoresCall

type GetGameHighScoresCall struct {
	Call[[]GameHighScore]
}

GetGameHighScoresCall reprenesents 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 with required parameters. userID - Target user id

func (*GetGameHighScoresCall) ChatID added in v0.0.5

func (call *GetGameHighScoresCall) ChatID(chatID ChatID) *GetGameHighScoresCall

ChatID Required if inline_message_id is not specified. Unique identifier for the target chat

func (*GetGameHighScoresCall) InlineMessageID added in v0.0.5

func (call *GetGameHighScoresCall) InlineMessageID(inlineMessageID string) *GetGameHighScoresCall

InlineMessageID Required if chat_id and message_id are not specified. Identifier of the inline message

func (*GetGameHighScoresCall) MessageID added in v0.0.5

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

MessageID Required if inline_message_id is not specified. Identifier of the sent message

func (*GetGameHighScoresCall) UserID added in v0.0.5

func (call *GetGameHighScoresCall) UserID(userID UserID) *GetGameHighScoresCall

UserID Target user id

type GetMeCall

type GetMeCall struct {
	Call[User]
}

GetMeCall reprenesents 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 with required parameters.

type GetMyCommandsCall

type GetMyCommandsCall struct {
	Call[[]BotCommand]
}

GetMyCommandsCall reprenesents 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 with required parameters.

func (*GetMyCommandsCall) LanguageCode

func (call *GetMyCommandsCall) LanguageCode(languageCode string) *GetMyCommandsCall

LanguageCode A two-letter ISO 639-1 language code or an empty string

func (*GetMyCommandsCall) Scope

Scope A JSON-serialized object, describing scope of users. Defaults to BotCommandScopeDefault.

type GetMyDefaultAdministratorRightsCall

type GetMyDefaultAdministratorRightsCall struct {
	Call[ChatAdministratorRights]
}

GetMyDefaultAdministratorRightsCall reprenesents 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 with required parameters.

func (*GetMyDefaultAdministratorRightsCall) ForChannels

ForChannels Pass True to get default administrator rights of the bot in channels. Otherwise, default administrator rights of the bot for groups and supergroups will be returned.

type GetMyDescriptionCall added in v0.8.0

type GetMyDescriptionCall struct {
	Call[BotDescription]
}

GetMyDescriptionCall reprenesents 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 with required parameters.

func (*GetMyDescriptionCall) LanguageCode added in v0.8.0

func (call *GetMyDescriptionCall) LanguageCode(languageCode string) *GetMyDescriptionCall

LanguageCode A two-letter ISO 639-1 language code or an empty string

type GetMyNameCall added in v0.9.0

type GetMyNameCall struct {
	Call[BotName]
}

GetMyNameCall reprenesents 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 with required parameters.

func (*GetMyNameCall) LanguageCode added in v0.9.0

func (call *GetMyNameCall) LanguageCode(languageCode string) *GetMyNameCall

LanguageCode A two-letter ISO 639-1 language code or an empty string

type GetMyShortDescriptionCall added in v0.8.0

type GetMyShortDescriptionCall struct {
	Call[BotShortDescription]
}

GetMyShortDescriptionCall reprenesents 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 with required parameters.

func (*GetMyShortDescriptionCall) LanguageCode added in v0.8.0

func (call *GetMyShortDescriptionCall) LanguageCode(languageCode string) *GetMyShortDescriptionCall

LanguageCode A two-letter ISO 639-1 language code or an empty string

type GetStickerSetCall

type GetStickerSetCall struct {
	Call[StickerSet]
}

GetStickerSetCall reprenesents 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 with required parameters. name - Name of the sticker set

func (*GetStickerSetCall) Name

func (call *GetStickerSetCall) Name(name string) *GetStickerSetCall

Name Name of the sticker set

type GetUpdatesCall

type GetUpdatesCall struct {
	Call[[]Update]
}

GetUpdatesCall reprenesents a call to the getUpdates method. Use this method to receive incoming updates using long polling (wiki) Returns an Array of Update objects.

func NewGetUpdatesCall

func NewGetUpdatesCall() *GetUpdatesCall

NewGetUpdatesCall constructs a new GetUpdatesCall with required parameters.

func (*GetUpdatesCall) AllowedUpdates

func (call *GetUpdatesCall) AllowedUpdates(allowedUpdates []UpdateType) *GetUpdatesCall

AllowedUpdates A JSON-serialized list of the update types you want your bot to receive. For example, specify ["message", "edited_channel_post", "callback_query"] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member, message_reaction, and message_reaction_count (default). If not specified, the previous setting will be used.Please note that this parameter doesn't affect updates created before the call to the getUpdates, so unwanted updates may be received for a short period of time.

func (*GetUpdatesCall) Limit

func (call *GetUpdatesCall) Limit(limit int) *GetUpdatesCall

Limit Limits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults to 100.

func (*GetUpdatesCall) Offset

func (call *GetUpdatesCall) Offset(offset int) *GetUpdatesCall

Offset Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as getUpdates is called with an offset higher than its update_id. The negative offset can be specified to retrieve updates starting from -offset update from the end of the updates queue. All previous updates will be forgotten.

func (*GetUpdatesCall) Timeout

func (call *GetUpdatesCall) Timeout(timeout int) *GetUpdatesCall

Timeout Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be positive, short polling should be used for testing purposes only.

type GetUserChatBoostsCall added in v0.12.0

type GetUserChatBoostsCall struct {
	Call[UserChatBoosts]
}

GetUserChatBoostsCall reprenesents 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 with required parameters. 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 Unique identifier for the chat or username of the channel (in the format @channelusername)

func (*GetUserChatBoostsCall) UserID added in v0.12.0

func (call *GetUserChatBoostsCall) UserID(userID UserID) *GetUserChatBoostsCall

UserID Unique identifier of the target user

type GetUserProfilePhotosCall

type GetUserProfilePhotosCall struct {
	Call[UserProfilePhotos]
}

GetUserProfilePhotosCall reprenesents 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 with required parameters. userID - Unique identifier of the target user

func (*GetUserProfilePhotosCall) Limit

Limit Limits the number of photos to be retrieved. Values between 1-100 are accepted. Defaults to 100.

func (*GetUserProfilePhotosCall) Offset

Offset Sequential number of the first photo to be returned. By default, all photos are returned.

func (*GetUserProfilePhotosCall) UserID added in v0.0.5

UserID Unique identifier of the target user

type GetWebhookInfoCall

type GetWebhookInfoCall struct {
	Call[WebhookInfo]
}

GetWebhookInfoCall reprenesents 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 getUpdates, will return an object with the url field empty.

func NewGetWebhookInfoCall

func NewGetWebhookInfoCall() *GetWebhookInfoCall

NewGetWebhookInfoCall constructs a new GetWebhookInfoCall with required parameters.

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 int64 `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.
	CountryCodes []string `json:"country_codes,omitempty"`

	// Optional. The number of months the Telegram Premium subscription won from the giveaway will be active for
	PremiumSubscriptionMonthCount int `json:"premium_subscription_month_count,omitempty"`
}

Giveaway this object represents a message about a scheduled giveaway.

func (*Giveaway) WinnersSelectionDateTime added in v0.15.0

func (s *Giveaway) WinnersSelectionDateTime() time.Time

WinnersSelectionDateTime returns time.Time representation of WinnersSelectionDate field.

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"`
}

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{}

GiveawayCreated represents a service message about a giveaway created in the chat. Currently holds no information.

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 int64 `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 months the Telegram Premium subscription won from the giveaway will be active for
	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.

func (*GiveawayWinners) WinnersSelectionDateTime added in v0.15.0

func (s *GiveawayWinners) WinnersSelectionDateTime() time.Time

WinnersSelectionDateTime returns time.Time representation of WinnersSelectionDate field.

type HideGeneralForumTopicCall added in v0.6.0

type HideGeneralForumTopicCall struct {
	CallNoResult
}

HideGeneralForumTopicCall reprenesents 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

func NewHideGeneralForumTopicCall added in v0.6.0

func NewHideGeneralForumTopicCall(chatID PeerID) *HideGeneralForumTopicCall

NewHideGeneralForumTopicCall constructs a new HideGeneralForumTopicCall with required parameters. 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 Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

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 int64 `json:"date"`
}

InaccessibleMessage this object describes a message that was deleted or is otherwise inaccessible to the bot.

func (*InaccessibleMessage) DateTime added in v0.15.0

func (s *InaccessibleMessage) DateTime() time.Time

DateTime returns time.Time representation of Date field.

type InlineKeyboardButton

type InlineKeyboardButton struct {
	// Label text on the button
	Text string `json:"text"`

	// Optional. HTTP or tg:// URL to be opened when the button is pressed. Links tg://user?id=<user_id> can be used to mention a user by their identifier without using a username, if this is allowed by their privacy settings.
	URL string `json:"url,omitempty"`

	// Optional. Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes
	CallbackData string `json:"callback_data,omitempty"`

	// Optional. Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. Available only in private chats between a user and the bot.
	WebApp *WebAppInfo `json:"web_app,omitempty"`

	// Optional. An HTTPS URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget.
	LoginURL *LoginURL `json:"login_url,omitempty"`

	// Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted.
	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.
	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
	SwitchInlineQueryChosenChat *SwitchInlineQueryChosenChat `json:"switch_inline_query_chosen_chat,omitempty"`

	// Optional. Description of the game that will be launched when the user presses the button.NOTE: This type of button must always be the first button in the first row.
	CallbackGame *CallbackGame `json:"callback_game,omitempty"`

	// Optional. Specify True, to send a Pay button.NOTE: This type of button must always be the first button in the first row and can only be used in invoice messages.
	Pay bool `json:"pay,omitempty"`
}

InlineKeyboardButton this object represents one button of an inline keyboard. You must use exactly one of the optional fields.

func NewInlineKeyboardButtonCallback added in v0.0.2

func NewInlineKeyboardButtonCallback(text string, query string) InlineKeyboardButton

NewInlineKeyboardButtonCallback creates a new InlineKeyboardButton with specified callback data. Query should have length 1-64 bytes.

func NewInlineKeyboardButtonCallbackGame added in v0.0.2

func NewInlineKeyboardButtonCallbackGame(text string) InlineKeyboardButton

NewInlineKeyboardButtonCallbackGame represents the button which open a game.

func NewInlineKeyboardButtonLoginURL added in v0.0.2

func NewInlineKeyboardButtonLoginURL(text string, loginURL LoginURL) InlineKeyboardButton

InlineKeyboardMarkup represents button that open web page with auth data.

func NewInlineKeyboardButtonPay added in v0.0.2

func NewInlineKeyboardButtonPay(text string) InlineKeyboardButton

NewInlineKeyboardButtonPay represents a Pay button. NOTE: This type of button must always be the first button in the first row and can only be used in invoice messages

func NewInlineKeyboardButtonSwitchInlineQuery added in v0.0.2

func NewInlineKeyboardButtonSwitchInlineQuery(text string, query string) InlineKeyboardButton

NewInlineKeyboardButtonSwitchInlineQuery represents button that

will prompt the user to select one of their chats,

open that chat and insert the bot's username and the specified inline query in the input field.

func NewInlineKeyboardButtonSwitchInlineQueryCurrentChat added in v0.0.2

func NewInlineKeyboardButtonSwitchInlineQueryCurrentChat(text string, query string) InlineKeyboardButton

NewInlineKeyboardButtonSwitchInlineQueryCurrentChat represents button that will insert the bot's username and the specified inline query in the current chat's input field

func NewInlineKeyboardButtonURL added in v0.0.2

func NewInlineKeyboardButtonURL(text string, url string) InlineKeyboardButton

NewInlineButtonURL create inline button with http(s):// or tg:// URL to be opened when the button is pressed.

func NewInlineKeyboardButtonWebApp added in v0.0.2

func NewInlineKeyboardButtonWebApp(text string, webApp WebAppInfo) InlineKeyboardButton

NewInlineKeyboardButtonWebApp creates a button that open a web app.

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(rows ...[]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 InlineQueryResultArticle

type InlineQueryResultArticle struct {
	// Type of the result, must be article
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 Bytes
	ID string `json:"id"`

	// Title of the result
	Title string `json:"title"`

	// Content of the message to be sent
	InputMessageContent InputMessageContent `json:"input_message_content"`

	// Optional. Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

	// Optional. URL of the result
	URL string `json:"url,omitempty"`

	// Optional. Pass True if you don't want the URL to be shown in the message
	HideURL bool `json:"hide_url,omitempty"`

	// Optional. Short description of the result
	Description string `json:"description,omitempty"`

	// Optional. Url of the thumbnail for the result
	ThumbnailURL string `json:"thumbnail_url,omitempty"`

	// Optional. Thumbnail width
	ThumbnailWidth 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 (InlineQueryResultArticle) MarshalJSON added in v0.0.3

func (result InlineQueryResultArticle) MarshalJSON() ([]byte, error)

type InlineQueryResultAudio

type InlineQueryResultAudio struct {
	// Type of the result, must be audio
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 bytes
	ID string `json:"id"`

	// A valid URL for the audio file
	AudioURL string `json:"audio_url"`

	// Title
	Title string `json:"title"`

	// Optional. Caption, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`

	// Optional. Mode for parsing entities in the audio caption. See formatting options for more details.
	ParseMode 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
	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 (InlineQueryResultAudio) MarshalJSON added in v0.0.3

func (result InlineQueryResultAudio) MarshalJSON() ([]byte, error)

type InlineQueryResultCachedAudio

type InlineQueryResultCachedAudio struct {
	// Type of the result, must be audio
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 bytes
	ID string `json:"id"`

	// A valid file identifier for the audio file
	AudioFileID string `json:"audio_file_id"`

	// Optional. Caption, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`

	// Optional. Mode for parsing entities in the audio caption. See formatting options for more details.
	ParseMode 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
	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 (InlineQueryResultCachedAudio) MarshalJSON added in v0.0.3

func (result InlineQueryResultCachedAudio) MarshalJSON() ([]byte, error)

type InlineQueryResultCachedDocument

type InlineQueryResultCachedDocument struct {
	// Type of the result, must be document
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 bytes
	ID string `json:"id"`

	// Title for the result
	Title string `json:"title"`

	// A valid file identifier for the file
	DocumentFileID string `json:"document_file_id"`

	// Optional. Short description of the result
	Description string `json:"description,omitempty"`

	// Optional. Caption of the document to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`

	// Optional. Mode for parsing entities in the document caption. See formatting options for more details.
	ParseMode 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
	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 (InlineQueryResultCachedDocument) MarshalJSON added in v0.0.3

func (result InlineQueryResultCachedDocument) MarshalJSON() ([]byte, error)

type InlineQueryResultCachedGIF added in v0.0.5

type InlineQueryResultCachedGIF struct {
	// Type of the result, must be gif
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 bytes
	ID string `json:"id"`

	// A valid file identifier for the GIF file
	GIFFileID string `json:"gif_file_id"`

	// Optional. Title for the result
	Title string `json:"title,omitempty"`

	// Optional. Caption of the GIF file to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`

	// Optional. Mode for parsing entities in the caption. See formatting options for more details.
	ParseMode 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
	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 (InlineQueryResultCachedGIF) MarshalJSON added in v0.0.5

func (result InlineQueryResultCachedGIF) MarshalJSON() ([]byte, error)

type InlineQueryResultCachedMPEG4GIF added in v0.0.5

type InlineQueryResultCachedMPEG4GIF struct {
	// Type of the result, must be mpeg4_gif
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 bytes
	ID string `json:"id"`

	// A valid file identifier for the MPEG4 file
	MPEG4FileID string `json:"mpeg4_file_id"`

	// Optional. Title for the result
	Title string `json:"title,omitempty"`

	// Optional. Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`

	// Optional. Mode for parsing entities in the caption. See formatting options for more details.
	ParseMode 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
	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 (InlineQueryResultCachedMPEG4GIF) MarshalJSON added in v0.0.5

func (result InlineQueryResultCachedMPEG4GIF) MarshalJSON() ([]byte, error)

type InlineQueryResultCachedPhoto

type InlineQueryResultCachedPhoto struct {
	// Type of the result, must be photo
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 bytes
	ID string `json:"id"`

	// A valid file identifier of the photo
	PhotoFileID string `json:"photo_file_id"`

	// Optional. Title for the result
	Title string `json:"title,omitempty"`

	// Optional. Short description of the result
	Description string `json:"description,omitempty"`

	// Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`

	// Optional. Mode for parsing entities in the photo caption. See formatting options for more details.
	ParseMode 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
	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 (InlineQueryResultCachedPhoto) MarshalJSON added in v0.0.3

func (result InlineQueryResultCachedPhoto) MarshalJSON() ([]byte, error)

type InlineQueryResultCachedSticker

type InlineQueryResultCachedSticker struct {
	// Type of the result, must be sticker
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 bytes
	ID string `json:"id"`

	// A valid file identifier of the sticker
	StickerFileID string `json:"sticker_file_id"`

	// Optional. Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

	// Optional. Content of the message to be sent instead of the sticker
	InputMessageContent *InputMessageContent `json:"input_message_content,omitempty"`
}

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

func (InlineQueryResultCachedSticker) MarshalJSON added in v0.0.3

func (result InlineQueryResultCachedSticker) MarshalJSON() ([]byte, error)

type InlineQueryResultCachedVideo

type InlineQueryResultCachedVideo struct {
	// Type of the result, must be video
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 bytes
	ID string `json:"id"`

	// A valid file identifier for the video file
	VideoFileID string `json:"video_file_id"`

	// Title for the result
	Title string `json:"title"`

	// Optional. Short description of the result
	Description string `json:"description,omitempty"`

	// Optional. Caption of the video to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`

	// Optional. Mode for parsing entities in the video caption. See formatting options for more details.
	ParseMode 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
	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 (InlineQueryResultCachedVideo) MarshalJSON added in v0.0.3

func (result InlineQueryResultCachedVideo) MarshalJSON() ([]byte, error)

type InlineQueryResultCachedVoice

type InlineQueryResultCachedVoice struct {
	// Type of the result, must be voice
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 bytes
	ID string `json:"id"`

	// A valid file identifier for the voice message
	VoiceFileID string `json:"voice_file_id"`

	// Voice message title
	Title string `json:"title"`

	// Optional. Caption, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`

	// Optional. Mode for parsing entities in the voice message caption. See formatting options for more details.
	ParseMode 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
	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 (InlineQueryResultCachedVoice) MarshalJSON added in v0.0.3

func (result InlineQueryResultCachedVoice) MarshalJSON() ([]byte, error)

type InlineQueryResultContact

type InlineQueryResultContact struct {
	// Type of the result, must be contact
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 Bytes
	ID string `json:"id"`

	// Contact's phone number
	PhoneNumber string `json:"phone_number"`

	// Contact's first name
	FirstName string `json:"first_name"`

	// Optional. Contact's last name
	LastName string `json:"last_name,omitempty"`

	// Optional. Additional data about the contact in the form of a vCard, 0-2048 bytes
	Vcard string `json:"vcard,omitempty"`

	// Optional. Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

	// Optional. Content of the message to be sent instead of the contact
	InputMessageContent *InputMessageContent `json:"input_message_content,omitempty"`

	// Optional. Url of the thumbnail for the result
	ThumbnailURL string `json:"thumbnail_url,omitempty"`

	// Optional. Thumbnail width
	ThumbnailWidth 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 (InlineQueryResultContact) MarshalJSON added in v0.0.3

func (result InlineQueryResultContact) MarshalJSON() ([]byte, error)

type InlineQueryResultDocument

type InlineQueryResultDocument struct {
	// Type of the result, must be document
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 bytes
	ID string `json:"id"`

	// Title for the result
	Title string `json:"title"`

	// Optional. Caption of the document to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`

	// Optional. Mode for parsing entities in the document caption. See formatting options for more details.
	ParseMode 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 (InlineQueryResultDocument) MarshalJSON added in v0.0.3

func (result InlineQueryResultDocument) MarshalJSON() ([]byte, error)

type InlineQueryResultGIF added in v0.0.5

type InlineQueryResultGIF struct {
	// Type of the result, must be gif
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 bytes
	ID string `json:"id"`

	// A valid URL for the GIF file. File size must not exceed 1MB
	GIFURL string `json:"gif_url"`

	// Optional. Width of the GIF
	GIFWidth 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.
	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
	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 (InlineQueryResultGIF) MarshalJSON added in v0.0.5

func (result InlineQueryResultGIF) MarshalJSON() ([]byte, error)

type InlineQueryResultGame

type InlineQueryResultGame struct {
	// Type of the result, must be game
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 bytes
	ID string `json:"id"`

	// Short name of the game
	GameShortName string `json:"game_short_name"`

	// Optional. Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}

InlineQueryResultGame represents a Game.

func (InlineQueryResultGame) MarshalJSON added in v0.0.3

func (result InlineQueryResultGame) MarshalJSON() ([]byte, error)

type InlineQueryResultLocation

type InlineQueryResultLocation struct {
	// Type of the result, must be location
	Type string `json:"type"`

	// 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 for which the location can be updated, should be between 60 and 86400.
	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
	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 (InlineQueryResultLocation) MarshalJSON added in v0.0.3

func (result InlineQueryResultLocation) MarshalJSON() ([]byte, error)

type InlineQueryResultMPEG4GIF added in v0.0.5

type InlineQueryResultMPEG4GIF struct {
	// Type of the result, must be mpeg4_gif
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 bytes
	ID string `json:"id"`

	// A valid URL for the MPEG4 file. File size must not exceed 1MB
	MPEG4URL string `json:"mpeg4_url"`

	// Optional. Video width
	MPEG4Width 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.
	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
	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 (InlineQueryResultMPEG4GIF) MarshalJSON added in v0.0.5

func (result InlineQueryResultMPEG4GIF) MarshalJSON() ([]byte, error)

type InlineQueryResultPhoto

type InlineQueryResultPhoto struct {
	// Type of the result, must be photo
	Type string `json:"type"`

	// 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.
	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
	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 (InlineQueryResultPhoto) MarshalJSON added in v0.0.3

func (result InlineQueryResultPhoto) MarshalJSON() ([]byte, error)

type InlineQueryResultVenue

type InlineQueryResultVenue struct {
	// Type of the result, must be venue
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 Bytes
	ID string `json:"id"`

	// Latitude of the venue location in degrees
	Latitude float64 `json:"latitude"`

	// Longitude of the venue location in degrees
	Longitude float64 `json:"longitude"`

	// Title of the venue
	Title string `json:"title"`

	// Address of the venue
	Address string `json:"address"`

	// Optional. Foursquare identifier of the venue if known
	FoursquareID string `json:"foursquare_id,omitempty"`

	// Optional. Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)
	FoursquareType string `json:"foursquare_type,omitempty"`

	// Optional. Google Places identifier of the venue
	GooglePlaceID string `json:"google_place_id,omitempty"`

	// Optional. Google Places type of the venue. (See supported types.)
	GooglePlaceType string `json:"google_place_type,omitempty"`

	// Optional. Inline keyboard attached to the message
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`

	// Optional. Content of the message to be sent instead of the venue
	InputMessageContent *InputMessageContent `json:"input_message_content,omitempty"`

	// Optional. Url of the thumbnail for the result
	ThumbnailURL string `json:"thumbnail_url,omitempty"`

	// Optional. Thumbnail width
	ThumbnailWidth 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 (InlineQueryResultVenue) MarshalJSON added in v0.0.3

func (result InlineQueryResultVenue) MarshalJSON() ([]byte, error)

type InlineQueryResultVideo

type InlineQueryResultVideo struct {
	// Type of the result, must be video
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 bytes
	ID string `json:"id"`

	// A valid URL for the embedded video player or video file
	VideoURL string `json:"video_url"`

	// MIME type of the content of the video URL, “text/html” or “video/mp4”
	MIMEType string `json:"mime_type"`

	// URL of the thumbnail (JPEG only) for the video
	ThumbnailURL string `json:"thumbnail_url"`

	// Title for the result
	Title string `json:"title"`

	// Optional. Caption of the video to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`

	// Optional. Mode for parsing entities in the video caption. See formatting options for more details.
	ParseMode 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. 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
	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 (InlineQueryResultVideo) MarshalJSON added in v0.0.3

func (result InlineQueryResultVideo) MarshalJSON() ([]byte, error)

type InlineQueryResultVoice

type InlineQueryResultVoice struct {
	// Type of the result, must be voice
	Type string `json:"type"`

	// Unique identifier for this result, 1-64 bytes
	ID string `json:"id"`

	// A valid URL for the voice recording
	VoiceURL string `json:"voice_url"`

	// Recording title
	Title string `json:"title"`

	// Optional. Caption, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`

	// Optional. Mode for parsing entities in the voice message caption. See formatting options for more details.
	ParseMode 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
	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 (InlineQueryResultVoice) MarshalJSON added in v0.0.3

func (result InlineQueryResultVoice) MarshalJSON() ([]byte, error)

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.
	WebApp *WebAppInfo `json:"web_app,omitempty"`

	// Optional. Deep-linking parameter for the /start message sent to the bot when a user presses the button. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed.Example: An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube account to adapt search results accordingly. To do this, it displays a 'Connect your YouTube account' button above the results, or even before showing any. The user presses the button, switches to a private chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an OAuth link. Once done, the bot can offer a switch_inline button so that the user can easily return to the chat where they wanted to use the bot's inline capabilities.
	StartParameter string `json:"start_parameter,omitempty"`
}

InlineQueryResultsButton this object represents a button to be shown above inline query results. You must use exactly one of the optional fields.

type InputContactMessageContent

type InputContactMessageContent struct {
	// Contact's phone number
	PhoneNumber string `json:"phone_number"`

	// Contact's first name
	FirstName string `json:"first_name"`

	// Optional. Contact's last name
	LastName string `json:"last_name,omitempty"`

	// Optional. Additional data about the contact in the form of a vCard, 0-2048 bytes
	Vcard string `json:"vcard,omitempty"`
}

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

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(fs 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 impliments 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 for your internal processes.
	Payload string `json:"payload"`

	// Payment provider token, obtained via @BotFather
	ProviderToken string `json:"provider_token"`

	// Three-letter ISO 4217 currency code, see more on currencies
	Currency string `json:"currency"`

	// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.)
	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
	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
	NeedName bool `json:"need_name,omitempty"`

	// Optional. Pass True if you require the user's phone number to complete the order
	NeedPhoneNumber bool `json:"need_phone_number,omitempty"`

	// Optional. Pass True if you require the user's email address to complete the order
	NeedEmail bool `json:"need_email,omitempty"`

	// Optional. Pass True if you require the user's shipping address to complete the order
	NeedShippingAddress bool `json:"need_shipping_address,omitempty"`

	// Optional. Pass True if the user's phone number should be sent to provider
	SendPhoneNumberToProvider bool `json:"send_phone_number_to_provider,omitempty"`

	// Optional. Pass True if the user's email address should be sent to provider
	SendEmailToProvider bool `json:"send_email_to_provider,omitempty"`

	// Optional. Pass True if the final price depends on the shipping method
	IsFlexible bool `json:"is_flexible,omitempty"`
}

InputInvoiceMessageContent represents the content of an invoice message to be sent as the result of an inline query.

type InputLocationMessageContent

type InputLocationMessageContent struct {
	// Latitude of the location in degrees
	Latitude float64 `json:"latitude"`

	// Longitude of the location in degrees
	Longitude float64 `json:"longitude"`

	// Optional. The radius of uncertainty for the location, measured in meters; 0-1500
	HorizontalAccuracy float64 `json:"horizontal_accuracy,omitempty"`

	// Optional. Period in seconds for which the location can be updated, should be between 60 and 86400.
	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 content of a location message to be sent as the result of an inline query.

type InputMedia

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

InputMedia generic interface for InputMedia*.

Known implementations:

type InputMediaAnimation

type InputMediaAnimation struct {
	// Type of the result, must be animation
	Type string `json:"type"`

	// File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files »
	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 »
	Thumbnail *InputFile `json:"thumbnail,omitempty"`

	// Optional. Caption of the animation to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`

	// Optional. Mode for parsing entities in the animation caption. See formatting options for more details.
	ParseMode 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. 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 (*InputMediaAnimation) MarshalJSON added in v0.0.5

func (media *InputMediaAnimation) MarshalJSON() ([]byte, error)

type InputMediaAudio

type InputMediaAudio struct {
	// Type of the result, must be audio
	Type string `json:"type"`

	// File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files »
	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 »
	Thumbnail *InputFile `json:"thumbnail,omitempty"`

	// Optional. Caption of the audio to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`

	// Optional. Mode for parsing entities in the audio caption. See formatting options for more details.
	ParseMode 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 (*InputMediaAudio) MarshalJSON added in v0.0.5

func (media *InputMediaAudio) MarshalJSON() ([]byte, error)

type InputMediaDocument

type InputMediaDocument struct {
	// Type of the result, must be document
	Type string `json:"type"`

	// File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files »
	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 »
	Thumbnail *InputFile `json:"thumbnail,omitempty"`

	// Optional. Caption of the document to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`

	// Optional. Mode for parsing entities in the document caption. See formatting options for more details.
	ParseMode 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 (*InputMediaDocument) MarshalJSON added in v0.0.5

func (media *InputMediaDocument) MarshalJSON() ([]byte, error)

type InputMediaPhoto

type InputMediaPhoto struct {
	// Type of the result, must be photo
	Type string `json:"type"`

	// File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files »
	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.
	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 photo needs to be covered with a spoiler animation
	HasSpoiler bool `json:"has_spoiler,omitempty"`
}

InputMediaPhoto represents a photo to be sent.

func (*InputMediaPhoto) MarshalJSON added in v0.0.5

func (media *InputMediaPhoto) MarshalJSON() ([]byte, error)

type InputMediaVideo

type InputMediaVideo struct {
	// Type of the result, must be video
	Type string `json:"type"`

	// File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files »
	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 »
	Thumbnail *InputFile `json:"thumbnail,omitempty"`

	// Optional. Caption of the video to be sent, 0-1024 characters after entities parsing
	Caption string `json:"caption,omitempty"`

	// Optional. Mode for parsing entities in the video caption. See formatting options for more details.
	ParseMode 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. 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 (*InputMediaVideo) MarshalJSON added in v0.0.5

func (media *InputMediaVideo) MarshalJSON() ([]byte, error)

type InputMessageContent

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

InputMessageContent it's generic interface for all types of input message content.

Known implementations:

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, upload a new one using multipart/form-data, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. Animated and video stickers can't be uploaded via HTTP URL. More information on Sending Files »
	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 string `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 InputTextMessageContent

type InputTextMessageContent struct {
	// Text of the message to be sent, 1-4096 characters
	MessageText string `json:"message_text"`

	// Optional. Mode for parsing entities in the message text. See formatting options for more details.
	ParseMode 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 content of a text message to be sent as the result of an inline query.

type InputVenueMessageContent

type InputVenueMessageContent struct {
	// Latitude of the venue in degrees
	Latitude float64 `json:"latitude"`

	// Longitude of the venue in degrees
	Longitude float64 `json:"longitude"`

	// Name of the venue
	Title string `json:"title"`

	// Address of the venue
	Address string `json:"address"`

	// Optional. Foursquare identifier of the venue, if known
	FoursquareID string `json:"foursquare_id,omitempty"`

	// Optional. Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)
	FoursquareType string `json:"foursquare_type,omitempty"`

	// Optional. Google Places identifier of the venue
	GooglePlaceID string `json:"google_place_id,omitempty"`

	// Optional. Google Places type of the venue. (See supported types.)
	GooglePlaceType string `json:"google_place_type,omitempty"`
}

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

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
	Currency string `json:"currency"`

	// Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
	TotalAmount 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 optional fields are used, it will be sent as a message when the button is pressed
	Text string `json:"text"`

	// Optional. If specified, pressing the button will open a list of suitable users. Identifiers of selected users will be sent to the bot in a “users_shared” service message. Available in private chats only.
	RequestUsers *KeyboardButtonRequestUsers `json:"request_users,omitempty"`

	// Optional. If specified, pressing the button will open a list of suitable chats. Tapping on a chat will send its identifier to the bot in a “chat_shared” service message. Available in private chats only.
	RequestChat *KeyboardButtonRequestChat `json:"request_chat,omitempty"`

	// Optional. If True, the user's phone number will be sent as a contact when the button is pressed. Available in private chats only.
	RequestContact bool `json:"request_contact,omitempty"`

	// Optional. If True, the user's current location will be sent when the button is pressed. Available in private chats only.
	RequestLocation bool `json:"request_location,omitempty"`

	// Optional. If specified, the user will be asked to create a poll and send it to the bot when the button is pressed. Available in private chats only.
	RequestPoll *KeyboardButtonPollType `json:"request_poll,omitempty"`

	// Optional. If specified, the described Web App will be launched when the button is pressed. The Web App will be able to send a “web_app_data” service message. Available in private chats only.
	WebApp *WebAppInfo `json:"web_app,omitempty"`
}

KeyboardButton this object represents one button of the reply keyboard. For simple text buttons, String can be used instead of this object to specify the button text. The optional fields web_app, request_users, request_chat, request_contact, request_location, and request_poll are mutually exclusive.

func NewKeyboardButton added in v0.0.2

func NewKeyboardButton(text string) KeyboardButton

NewKeyboardButton creates a plain reply keyboard button.

func NewKeyboardButtonRequestChat added in v0.12.0

func NewKeyboardButtonRequestChat(text string, config KeyboardButtonRequestChat) KeyboardButton

NewKeyboardButtonRequestChats creates a reply keyboard button that request a chat from user. Available in private chats only.

func NewKeyboardButtonRequestContact added in v0.0.2

func NewKeyboardButtonRequestContact(text string) KeyboardButton

NewKeyboardButtonRequestContact creates a reply keyboard button that request a contact from user. Available in private chats only.

func NewKeyboardButtonRequestLocation added in v0.0.2

func NewKeyboardButtonRequestLocation(text string) KeyboardButton

NewKeyboardButtonRequestLocation creates a reply keyboard button that request a location from user. Available in private chats only.

func NewKeyboardButtonRequestPoll added in v0.0.2

func NewKeyboardButtonRequestPoll(text string, poll KeyboardButtonPollType) KeyboardButton

NewKeyboardButtonRequestPoll creates a reply keyboard button that request a poll from user. Available in private chats only.

func NewKeyboardButtonRequestUsers added in v0.12.0

func NewKeyboardButtonRequestUsers(text string, config KeyboardButtonRequestUsers) KeyboardButton

NewKeyboardButtonRequestUsers creates a reply keyboard button that request a user from user. Available in private chats only.

func NewKeyboardButtonWebApp added in v0.0.2

func NewKeyboardButtonWebApp(text string, webApp WebAppInfo) KeyboardButton

NewKeyboardButtonWebApp create a reply keyboard button that open a web app.

type KeyboardButtonPollType

type KeyboardButtonPollType struct {
	// Optional. If quiz is passed, the user will be allowed to create only polls in the quiz mode. If regular is passed, only regular polls will be allowed. Otherwise, the user will be allowed to create a poll of any type.
	Type string `json:"type,omitempty"`
}

KeyboardButtonPollType 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 сhat 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 name
	RequestName bool `json:"request_name,omitempty"`

	// Optional. Pass True to request the users' username
	RequestUsername bool `json:"request_username,omitempty"`

	// Optional. Pass True to request the users' photo
	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).
	Amount int `json:"amount"`
}

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

type LeaveChatCall

type LeaveChatCall struct {
	CallNoResult
}

LeaveChatCall reprenesents a call to the leaveChat method. Use this method for your bot to leave a group, supergroup or channel

func NewLeaveChatCall

func NewLeaveChatCall(chatID PeerID) *LeaveChatCall

NewLeaveChatCall constructs a new LeaveChatCall with required parameters. chatID - Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)

func (*LeaveChatCall) ChatID added in v0.0.5

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

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

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 sender
	Latitude float64 `json:"latitude"`

	// Longitude as defined by 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 LogOutCall

type LogOutCall struct {
	CallNoResult
}

LogOutCall reprenesents 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 Requires no parameters.

func NewLogOutCall

func NewLogOutCall() *LogOutCall

NewLogOutCall constructs a new LogOutCall with required parameters.

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.
	URL string `json:"url"`

	// Optional. New text of the button in forwarded messages.
	ForwardText string `json:"forward_text,omitempty"`

	// Optional. Username of a bot, which will be used for user authorization. See Setting up a bot for more details. If not specified, the current bot's username will be assumed. The url's domain must be the same as the domain linked with the bot. See Linking your domain to the bot for more details.
	BotUsername string `json:"bot_username,omitempty"`

	// Optional. Pass True to request the permission for your bot to send messages to the user.
	RequestWriteAccess bool `json:"request_write_access,omitempty"`
}

LoginURL 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:

type MaskPosition

type MaskPosition struct {
	// The part of the face relative to which the mask should be placed. One of “forehead”, “eyes”, “mouth”, or “chin”.
	Point string `json:"point"`

	// Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. For example, choosing -1.0 will place mask just to the left of the default mask position.
	XShift float64 `json:"x_shift"`

	// Shift by Y-axis measured in heights of the mask scaled to the face size, from top to bottom. For example, 1.0 will place the mask just below the default mask position.
	YShift float64 `json:"y_shift"`

	// Mask scaling coefficient. For example, 2.0 means double size.
	Scale float64 `json:"scale"`
}

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

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 interface {
	json.Marshaler
	// contains filtered or unexported methods
}

MenuButton it's generic interface for all types of menu button.

Known implementations:

type MenuButtonCommands struct {
	// Type of the button, must be commands
	Type string `json:"type"`
}

MenuButtonCommands represents a menu button, which opens the bot's list of commands.

func (button MenuButtonCommands) MarshalJSON() ([]byte, error)
type MenuButtonDefault struct {
	// Type of the button, must be default
	Type string `json:"type"`
}

MenuButtonDefault describes that no specific value for the menu button was set.

func (button MenuButtonDefault) MarshalJSON() ([]byte, error)
type MenuButtonOneOf struct {
	Default  *MenuButtonDefault
	Commands *MenuButtonCommands
	WebApp   *MenuButtonWebApp
}

MenuButtonOneOf contains one of MenuButton implementations. It's used for proper JSON marshaling.

func (button *MenuButtonOneOf) UnmarshalJSON(v []byte) error
type MenuButtonWebApp struct {
	// Type of the button, must be web_app
	Type string `json:"type"`

	// Text on the button
	Text string `json:"text"`

	// Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery.
	WebApp WebAppInfo `json:"web_app"`
}

MenuButtonWebApp represents a menu button, which launches a Web App.

func (button MenuButtonWebApp) MarshalJSON() ([]byte, error)

type Message

type Message struct {
	// Unique message identifier inside this chat
	ID int `json:"message_id"`

	// Optional. Unique identifier of a message thread to which the message belongs; for supergroups only
	MessageThreadID int `json:"message_thread_id,omitempty"`

	// Optional. Sender of the message; empty for messages sent to channels. For backward compatibility, the field contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.
	From *User `json:"from,omitempty"`

	// Optional. Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts, the supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically forwarded to the discussion group. For backward compatibility, the field from contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.
	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 int64 `json:"date"`

	// Optional. Unique identifier of the business connection from which the message was received. If non-empty, the message belongs to a chat of the corresponding business account that is independent from any potential bot chat which might share the same identifier.
	BusinessConnectionID string `json:"business_connection_id,omitempty"`

	// Chat the message belongs to
	Chat Chat `json:"chat"`

	// Optional. Information about the original message for forwarded messages
	ForwardOrigin *MessageOrigin `json:"forward_origin,omitempty"`

	// Optional. True, if the message is sent to a forum topic
	IsTopicMessage bool `json:"is_topic_message,omitempty"`

	// Optional. True, if the message is a channel post that was automatically forwarded to the connected discussion group
	IsAutomaticForward bool `json:"is_automatic_forward,omitempty"`

	// Optional. For replies in the same chat and message thread, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply.
	ReplyToMessage *Message `json:"reply_to_message,omitempty"`

	// Optional. Information about the message that is being replied to, which may come from another chat or forum topic
	ExternalReply *ExternalReplyInfo `json:"external_reply,omitempty"`

	// Optional. For replies that quote part of the original message, the quoted part of the message
	Quote *TextQuote `json:"quote,omitempty"`

	// Optional. For replies to a story, the original story
	ReplyToStory *Story `json:"reply_to_story,omitempty"`

	// Optional. Bot through which the message was sent
	ViaBot *User `json:"via_bot,omitempty"`

	// Optional. Date the message was last edited in Unix time
	EditDate int64 `json:"edit_date,omitempty"`

	// Optional. True, if the message can't be forwarded
	HasProtectedContent bool `json:"has_protected_content,omitempty"`

	// Optional. True, if the message was sent by an implicit action, for example, as an away or a greeting business message, or as a scheduled message
	IsFromOffline bool `json:"is_from_offline,omitempty"`

	// Optional. The unique identifier of a media message group this message belongs to
	MediaGroupID string `json:"media_group_id,omitempty"`

	// Optional. Signature of the post author for messages in channels, or the custom title of an anonymous group administrator
	AuthorSignature string `json:"author_signature,omitempty"`

	// Optional. For text messages, the actual UTF-8 text of the message
	Text string `json:"text,omitempty"`

	// Optional. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text
	Entities []MessageEntity `json:"entities,omitempty"`

	// Optional. Options used for link preview generation for the message, if it is a text message and link preview options were changed
	LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options,omitempty"`

	// Optional. 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 is a photo, available sizes of the photo
	Photo []PhotoSize `json:"photo,omitempty"`

	// Optional. Message is a sticker, information about the sticker
	Sticker *Sticker `json:"sticker,omitempty"`

	// Optional. Message is a forwarded story
	Story *Story `json:"story,omitempty"`

	// Optional. Message is a video, information about the video
	Video *Video `json:"video,omitempty"`

	// Optional. Message is a video note, information about the video message
	VideoNote *VideoNote `json:"video_note,omitempty"`

	// Optional. Message is a voice message, information about the file
	Voice *Voice `json:"voice,omitempty"`

	// Optional. Caption for the animation, audio, document, 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 message media is covered by a spoiler animation
	HasMediaSpoiler bool `json:"has_media_spoiler,omitempty"`

	// Optional. Message is a shared contact, information about the contact
	Contact *Contact `json:"contact,omitempty"`

	// Optional. Message is a dice with random value
	Dice *Dice `json:"dice,omitempty"`

	// Optional. Message is a game, information about the game. More about games »
	Game *Game `json:"game,omitempty"`

	// Optional. Message is a native poll, information about the poll
	Poll *Poll `json:"poll,omitempty"`

	// Optional. Message is a venue, information about the venue. For backward compatibility, when this field is set, the location field will also be set
	Venue *Venue `json:"venue,omitempty"`

	// Optional. Message is a shared location, information about the location
	Location *Location `json:"location,omitempty"`

	// Optional. New members that were added to the group or supergroup and information about them (the bot itself may be one of these members)
	NewChatMembers []User `json:"new_chat_members,omitempty"`

	// Optional. A member was removed from the group, information about them (this member may be the bot itself)
	LeftChatMember *User `json:"left_chat_member,omitempty"`

	// Optional. A chat title was changed to this value
	NewChatTitle string `json:"new_chat_title,omitempty"`

	// Optional. A chat photo was change to this value
	NewChatPhoto []PhotoSize `json:"new_chat_photo,omitempty"`

	// Optional. Service message: the chat photo was deleted
	DeleteChatPhoto bool `json:"delete_chat_photo,omitempty"`

	// Optional. Service message: the group has been created
	GroupChatCreated bool `json:"group_chat_created,omitempty"`

	// Optional. Service message: the supergroup has been created. This field can't be received in a message coming through updates, because bot can't be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup.
	SupergroupChatCreated bool `json:"supergroup_chat_created,omitempty"`

	// Optional. Service message: the channel has been created. This field can't be received in a message coming through updates, because bot can't be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel.
	ChannelChatCreated bool `json:"channel_chat_created,omitempty"`

	// Optional. Service message: auto-delete timer settings changed in the chat
	MessageAutoDeleteTimerChanged *MessageAutoDeleteTimerChanged `json:"message_auto_delete_timer_changed,omitempty"`

	// Optional. The group has been migrated to a supergroup with the specified identifier.
	MigrateToChatID ChatID `json:"migrate_to_chat_id,omitempty"`

	// Optional. The supergroup has been migrated from a group with the specified 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 »
	Invoice *Invoice `json:"invoice,omitempty"`

	// Optional. Message is a service message about a successful payment, information about the payment. More about payments »
	SuccessfulPayment *SuccessfulPayment `json:"successful_payment,omitempty"`

	// Optional. Service message: users were shared with the bot
	UsersShared *UsersShared `json:"users_shared,omitempty"`

	// Optional. Service message: a chat was shared with the bot
	ChatShared *ChatShared `json:"chat_shared,omitempty"`

	// Optional. The domain name of the website on which the user has logged in. More about Telegram Login »
	ConnectedWebsite string `json:"connected_website,omitempty"`

	// Optional. Service message: the user allowed the bot to write messages after adding it to the attachment or side menu, launching a Web App from a link, or accepting an explicit request from a Web App sent by the method requestWriteAccess
	WriteAccessAllowed *WriteAccessAllowed `json:"write_access_allowed,omitempty"`

	// Optional. Telegram Passport data
	PassportData *PassportData `json:"passport_data,omitempty"`

	// Optional. Service message. A user in the chat triggered another user's proximity alert while sharing Live Location.
	ProximityAlertTriggered *ProximityAlertTriggered `json:"proximity_alert_triggered,omitempty"`

	// Optional. Service message: user boosted the chat
	BoostAdded *ChatBoostAdded `json:"boost_added,omitempty"`

	// Optional. Service message: forum topic created
	ForumTopicCreated *ForumTopicCreated `json:"forum_topic_created,omitempty"`

	// Optional. Service message: forum topic edited
	ForumTopicEdited *ForumTopicEdited `json:"forum_topic_edited,omitempty"`

	// Optional. Service message: forum topic closed
	ForumTopicClosed *ForumTopicClosed `json:"forum_topic_closed,omitempty"`

	// Optional. Service message: forum topic reopened
	ForumTopicReopened *ForumTopicReopened `json:"forum_topic_reopened,omitempty"`

	// Optional. Service message: the 'General' forum topic hidden
	GeneralForumTopicHidden *GeneralForumTopicHidden `json:"general_forum_topic_hidden,omitempty"`

	// Optional. Service message: the 'General' forum topic unhidden
	GeneralForumTopicUnhidden *GeneralForumTopicUnhidden `json:"general_forum_topic_unhidden,omitempty"`

	// Optional. Service message: a scheduled giveaway was created
	GiveawayCreated *GiveawayCreated `json:"giveaway_created,omitempty"`

	// Optional. The message is a scheduled giveaway message
	Giveaway *Giveaway `json:"giveaway,omitempty"`

	// Optional. A giveaway with public winners was completed
	GiveawayWinners *GiveawayWinners `json:"giveaway_winners,omitempty"`

	// Optional. Service message: a giveaway without public winners was completed
	GiveawayCompleted *GiveawayCompleted `json:"giveaway_completed,omitempty"`

	// Optional. Service message: video chat scheduled
	VideoChatScheduled *VideoChatScheduled `json:"video_chat_scheduled,omitempty"`

	// Optional. Service message: video chat started
	VideoChatStarted *VideoChatStarted `json:"video_chat_started,omitempty"`

	// Optional. Service message: video chat ended
	VideoChatEnded *VideoChatEnded `json:"video_chat_ended,omitempty"`

	// Optional. Service message: new participants invited to a video chat
	VideoChatParticipantsInvited *VideoChatParticipantsInvited `json:"video_chat_participants_invited,omitempty"`

	// Optional. Service message: data sent by a Web App
	WebAppData *WebAppData `json:"web_app_data,omitempty"`

	// Optional. Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons.
	ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}

Message this object represents a message.

func (*Message) DateTime added in v0.15.0

func (s *Message) DateTime() time.Time

DateTime returns time.Time representation of Date field.

func (*Message) EditDateTime added in v0.15.0

func (s *Message) EditDateTime() time.Time

EditDateTime returns time.Time representation of EditDate field.

func (*Message) IsInaccessible added in v0.12.0

func (msg *Message) IsInaccessible() bool

IsInaccessible returns true if message is inaccessible.

func (*Message) Type added in v0.0.6

func (msg *Message) Type() MessageType

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), “cashtag” ($USD), “bot_command” (/start@jobs_bot), “url” (https://telegram.org), “email” (do-not-reply@telegram.org), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “blockquote” (block quotation), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames), “custom_emoji” (for inline custom emoji stickers)
	Type MessageEntityType `json:"type"`

	// Offset in UTF-16 code units to the start of the entity
	Offset int `json:"offset"`

	// Length of the entity in UTF-16 code units
	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 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 int

MessageEntityType it's type for describe content of MessageEntity.

const (
	MessageEntityTypeUnknown MessageEntityType = iota

	// @username
	MessageEntityTypeMention

	// #hashtag
	MessageEntityTypeHashtag

	// $USD
	MessageEntityTypeCashtag

	// /start@jobs_bot
	MessageEntityTypeBotCommand

	// https://telegram.org
	MessageEntityTypeURL

	// do-not-reply@telegram.org
	MessageEntityTypeEmail

	// +1-212-555-0123
	MessageEntityTypePhoneNumber

	// <strong>bold</strong>
	MessageEntityTypeBold

	// <i>italic</i>
	MessageEntityTypeItalic

	// <u>underline</u>
	MessageEntityTypeUnderline

	// <strike>strike</strike>
	MessageEntityTypeStrikethrough

	// <tg-spoiler>spoiler</tg-spoiler>
	MessageEntityTypeSpoiler

	// <blockquote>quote</blockquote>
	MessageEntityTypeBlockquote

	// <code>code</code>
	MessageEntityTypeCode

	// <pre>pre</pre>
	MessageEntityTypePre

	// <a href="https://telegram.org">link</a>
	MessageEntityTypeTextLink

	// for users without usernames
	MessageEntityTypeTextMention

	// for inline custom emoji sticker
	MessageEntityTypeCustomEmoji
)

func (MessageEntityType) MarshalText added in v0.1.1

func (met MessageEntityType) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (MessageEntityType) String added in v0.1.1

func (met MessageEntityType) String() string

String returns string representation of MessageEntityType.

func (*MessageEntityType) UnmarshalText added in v0.1.1

func (met *MessageEntityType) UnmarshalText(v []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type MessageID

type MessageID struct {
	// Unique message identifier
	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
}

MessageOrigin this object describes the origin of a message. It can be one of:

func (*MessageOrigin) Type added in v0.12.0

func (origin *MessageOrigin) Type() string

func (*MessageOrigin) UnmarshalJSON added in v0.12.0

func (origin *MessageOrigin) UnmarshalJSON(v []byte) error

type MessageOriginChannel added in v0.12.0

type MessageOriginChannel struct {
	// Type of the message origin, always “channel”
	Type string `json:"type"`

	// Date the message was sent originally in Unix time
	Date int64 `json:"date"`

	// Channel chat to which the message was originally sent
	Chat Chat `json:"chat"`

	// Unique message identifier inside the chat
	MessageID 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.

func (*MessageOriginChannel) DateTime added in v0.15.0

func (s *MessageOriginChannel) DateTime() time.Time

DateTime returns time.Time representation of Date field.

type MessageOriginChat added in v0.12.0

type MessageOriginChat struct {
	// Type of the message origin, always “chat”
	Type string `json:"type"`

	// Date the message was sent originally in Unix time
	Date int64 `json:"date"`

	// Chat that sent the message originally
	SenderChat Chat `json:"sender_chat"`

	// Optional. For messages originally sent by an anonymous chat administrator, original message author signature
	AuthorSignature string `json:"author_signature,omitempty"`
}

MessageOriginChat the message was originally sent on behalf of a chat to a group chat.

func (*MessageOriginChat) DateTime added in v0.15.0

func (s *MessageOriginChat) DateTime() time.Time

DateTime returns time.Time representation of Date field.

type MessageOriginHiddenUser added in v0.12.0

type MessageOriginHiddenUser struct {
	// Type of the message origin, always “hidden_user”
	Type string `json:"type"`

	// Date the message was sent originally in Unix time
	Date int64 `json:"date"`

	// Name of the user that sent the message originally
	SenderUserName string `json:"sender_user_name"`
}

MessageOriginHiddenUser the message was originally sent by an unknown user.

func (*MessageOriginHiddenUser) DateTime added in v0.15.0

func (s *MessageOriginHiddenUser) DateTime() time.Time

DateTime returns time.Time representation of Date field.

type MessageOriginUser added in v0.12.0

type MessageOriginUser struct {
	// Type of the message origin, always “user”
	Type string `json:"type"`

	// Date the message was sent originally in Unix time
	Date int64 `json:"date"`

	// User that sent the message originally
	SenderUser User `json:"sender_user"`
}

MessageOriginUser the message was originally sent by a known user.

func (*MessageOriginUser) DateTime added in v0.15.0

func (s *MessageOriginUser) DateTime() time.Time

DateTime returns time.Time representation of Date field.

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 int64 `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.

func (*MessageReactionCountUpdated) DateTime added in v0.15.0

func (s *MessageReactionCountUpdated) DateTime() time.Time

DateTime returns time.Time representation of Date field.

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 int64 `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.

func (*MessageReactionUpdated) DateTime added in v0.15.0

func (s *MessageReactionUpdated) DateTime() time.Time

DateTime returns time.Time representation of Date field.

type MessageType added in v0.0.6

type MessageType int

MessageType it's type for describe content of Message.

const (
	MessageTypeUnknown MessageType = iota
	MessageTypeText
	MessageTypeAnimation
	MessageTypeAudio
	MessageTypeDocument
	MessageTypePhoto
	MessageTypeSticker
	MessageTypeVideo
	MessageTypeVideoNote
	MessageTypeVoice
	MessageTypeContact
	MessageTypeDice
	MessageTypeGame
	MessageTypePoll
	MessageTypeVenue
	MessageTypeLocation
	MessageTypeNewChatMembers
	MessageTypeLeftChatMember
	MessageTypeNewChatTitle
	MessageTypeNewChatPhoto
	MessageTypeDeleteChatPhoto
	MessageTypeGroupChatCreated
	MessageTypeSupergroupChatCreated
	MessageTypeChannelChatCreated
	MessageTypeMessageAutoDeleteTimerChanged
	MessageTypeMigrateToChatID
	MessageTypeMigrateFromChatID
	MessageTypePinnedMessage
	MessageTypeInvoice
	MessageTypeSuccessfulPayment
	MessageTypeUsersShared
	MessageTypeChatShared
	MessageTypeConnectedWebsite
	MessageTypePassportData
	MessageTypeProximityAlertTriggered
	MessageTypeVideoChatScheduled
	MessageTypeVideoChatStarted
	MessageTypeVideoChatEnded
	MessageTypeVideoChatParticipantsInvited
	MessageTypeWebAppData
)

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 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

	// 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

	// Code
	Code(v ...string) string

	// Preformated text
	Pre(v ...string) string

	// Blockquote
	Blockquote(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

type PassportElementError struct {
	// Error source, must be data
	Source string `json:"source"`

	// The section of the user's Telegram Passport which has the error, one of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address”
	Type string `json:"type"`

	// 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"`
}

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:

type PassportElementErrorDataField

type PassportElementErrorDataField struct {
	// Error source, must be data
	Source string `json:"source"`

	// The section of the user's Telegram Passport which has the error, one of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address”
	Type string `json:"type"`

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

type PassportElementErrorFile

type PassportElementErrorFile struct {
	// Error source, must be file
	Source string `json:"source"`

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

type PassportElementErrorFiles

type PassportElementErrorFiles struct {
	// Error source, must be files
	Source string `json:"source"`

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

type PassportElementErrorFrontSide

type PassportElementErrorFrontSide struct {
	// Error source, must be front_side
	Source string `json:"source"`

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

type PassportElementErrorReverseSide

type PassportElementErrorReverseSide struct {
	// Error source, must be reverse_side
	Source string `json:"source"`

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

type PassportElementErrorSelfie

type PassportElementErrorSelfie struct {
	// Error source, must be selfie
	Source string `json:"source"`

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

type PassportElementErrorTranslationFile

type PassportElementErrorTranslationFile struct {
	// Error source, must be translation_file
	Source string `json:"source"`

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

type PassportElementErrorTranslationFiles

type PassportElementErrorTranslationFiles struct {
	// Error source, must be translation_files
	Source string `json:"source"`

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

type PassportElementErrorUnspecified

type PassportElementErrorUnspecified struct {
	// Error source, must be unspecified
	Source string `json:"source"`

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

type PassportFile

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

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

	// File size in bytes
	FileSize int `json:"file_size"`

	// Unix time when the file was uploaded
	FileDate int64 `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.

func (*PassportFile) FileDateTime added in v0.15.0

func (s *PassportFile) FileDateTime() time.Time

FileDateTime returns time.Time representation of FileDate field.

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 file / sticker thumbnail.

type PinChatMessageCall

type PinChatMessageCall struct {
	CallNoResult
}

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

func NewPinChatMessageCall

func NewPinChatMessageCall(chatID PeerID, messageID int) *PinChatMessageCall

NewPinChatMessageCall constructs a new PinChatMessageCall with required parameters. 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) ChatID added in v0.0.5

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

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

func (*PinChatMessageCall) DisableNotification

func (call *PinChatMessageCall) DisableNotification(disableNotification bool) *PinChatMessageCall

DisableNotification Pass True if it is not necessary to send a notification to all chat members about the new pinned message. Notifications are always disabled in channels and private chats.

func (*PinChatMessageCall) MessageID added in v0.0.5

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

MessageID Identifier of a message to pin

type Poll

type Poll struct {
	// Unique poll identifier
	ID string `json:"id"`

	// Poll question, 1-300 characters
	Question string `json:"question"`

	// 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 string `json:"type"`

	// True, if the poll allows multiple answers
	AllowsMultipleAnswers bool `json:"allows_multiple_answers"`

	// Optional. 0-based identifier of the correct answer option. Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to the private chat with the bot.
	CorrectOptionID 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 int64 `json:"close_date,omitempty"`
}

Poll this object contains information about a poll.

func (*Poll) CloseDateTime added in v0.15.0

func (s *Poll) CloseDateTime() time.Time

CloseDateTime returns time.Time representation of CloseDate field.

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.
	OptionaIDs []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"`

	// 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 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
	Currency string `json:"currency"`

	// Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
	TotalAmount 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 PromoteChatMemberCall

type PromoteChatMemberCall struct {
	CallNoResult
}

PromoteChatMemberCall reprenesents 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

func NewPromoteChatMemberCall

func NewPromoteChatMemberCall(chatID PeerID, userID UserID) *PromoteChatMemberCall

NewPromoteChatMemberCall constructs a new PromoteChatMemberCall with required parameters. 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 Pass True if the administrator can change chat title, photo and other settings

func (*PromoteChatMemberCall) CanDeleteMessages

func (call *PromoteChatMemberCall) CanDeleteMessages(canDeleteMessages bool) *PromoteChatMemberCall

CanDeleteMessages Pass True if the administrator can delete messages of other users

func (*PromoteChatMemberCall) CanDeleteStories added in v0.11.0

func (call *PromoteChatMemberCall) CanDeleteStories(canDeleteStories bool) *PromoteChatMemberCall

CanDeleteStories Pass True if the administrator can delete stories posted by other users

func (*PromoteChatMemberCall) CanEditMessages

func (call *PromoteChatMemberCall) CanEditMessages(canEditMessages bool) *PromoteChatMemberCall

CanEditMessages Pass True if the administrator can edit messages of other users and can pin messages; for channels only

func (*PromoteChatMemberCall) CanEditStories added in v0.11.0

func (call *PromoteChatMemberCall) CanEditStories(canEditStories bool) *PromoteChatMemberCall

CanEditStories Pass True if the administrator can edit stories posted by other users

func (*PromoteChatMemberCall) CanInviteUsers

func (call *PromoteChatMemberCall) CanInviteUsers(canInviteUsers bool) *PromoteChatMemberCall

CanInviteUsers Pass True if the administrator can invite new users to the chat

func (*PromoteChatMemberCall) CanManageChat

func (call *PromoteChatMemberCall) CanManageChat(canManageChat bool) *PromoteChatMemberCall

CanManageChat Pass True if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages and ignore slow mode. Implied by any other administrator privilege.

func (*PromoteChatMemberCall) CanManageTopics added in v0.6.0

func (call *PromoteChatMemberCall) CanManageTopics(canManageTopics bool) *PromoteChatMemberCall

CanManageTopics Pass True if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only

func (*PromoteChatMemberCall) CanManageVideoChats

func (call *PromoteChatMemberCall) CanManageVideoChats(canManageVideoChats bool) *PromoteChatMemberCall

CanManageVideoChats Pass True if the administrator can manage video chats

func (*PromoteChatMemberCall) CanPinMessages

func (call *PromoteChatMemberCall) CanPinMessages(canPinMessages bool) *PromoteChatMemberCall

CanPinMessages Pass True if the administrator can pin messages; for supergroups only

func (*PromoteChatMemberCall) CanPostMessages

func (call *PromoteChatMemberCall) CanPostMessages(canPostMessages bool) *PromoteChatMemberCall

CanPostMessages Pass True if the administrator can post messages in the channel, or access channel statistics; for channels only

func (*PromoteChatMemberCall) CanPostStories added in v0.11.0

func (call *PromoteChatMemberCall) CanPostStories(canPostStories bool) *PromoteChatMemberCall

CanPostStories Pass True if the administrator can post stories to the chat

func (*PromoteChatMemberCall) CanPromoteMembers

func (call *PromoteChatMemberCall) CanPromoteMembers(canPromoteMembers bool) *PromoteChatMemberCall

CanPromoteMembers Pass True if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by him)

func (*PromoteChatMemberCall) CanRestrictMembers

func (call *PromoteChatMemberCall) CanRestrictMembers(canRestrictMembers bool) *PromoteChatMemberCall

CanRestrictMembers Pass True if the administrator can restrict, ban or unban chat members, or access supergroup statistics

func (*PromoteChatMemberCall) ChatID added in v0.0.5

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

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

func (*PromoteChatMemberCall) IsAnonymous

func (call *PromoteChatMemberCall) IsAnonymous(isAnonymous bool) *PromoteChatMemberCall

IsAnonymous Pass True if the administrator's presence in the chat is hidden

func (*PromoteChatMemberCall) UserID added in v0.0.5

func (call *PromoteChatMemberCall) UserID(userID UserID) *PromoteChatMemberCall

UserID Unique identifier of the target user

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 ReactionType added in v0.12.0

type ReactionType struct {
	Emoji       *ReactionTypeEmoji
	CustomEmoji *ReactionTypeCustomEmoji
}

ReactionType it's type for describe content of Reaction. It can be one of:

func NewReactionTypeCustomEmoji added in v0.14.0

func NewReactionTypeCustomEmoji(id string) ReactionType

NewReactionTypeCustomEmoji returns ReactionType with custom emoji subtype.

func NewReactionTypeEmoji added in v0.14.0

func NewReactionTypeEmoji(emoji string) ReactionType

NewReactionTypeEmoji returns ReactionType with emoji subtype.

func (ReactionType) MarshalJSON added in v0.12.0

func (reaction ReactionType) MarshalJSON() ([]byte, error)

func (*ReactionType) Type added in v0.12.0

func (reaction *ReactionType) Type() string

func (*ReactionType) UnmarshalJSON added in v0.12.0

func (reaction *ReactionType) UnmarshalJSON(v []byte) error

type ReactionTypeCustomEmoji added in v0.12.0

type ReactionTypeCustomEmoji struct {
	// Type of the reaction, always “custom_emoji”
	Type string `json:"type"`

	// Custom emoji identifier
	CustomEmojiID string `json:"custom_emoji_id"`
}

ReactionTypeCustomEmoji the reaction is based on a custom emoji.

type ReactionTypeEmoji added in v0.12.0

type ReactionTypeEmoji struct {
	// Type of the reaction, always “emoji”
	Type string `json:"type"`

	// Reaction emoji. Currently, it can be one of "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""
	Emoji string `json:"emoji"`
}

ReactionTypeEmoji the reaction is based on an emoji.

type ReopenForumTopicCall added in v0.6.0

type ReopenForumTopicCall struct {
	CallNoResult
}

ReopenForumTopicCall reprenesents 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

func NewReopenForumTopicCall added in v0.6.0

func NewReopenForumTopicCall(chatID PeerID, messageThreadID int) *ReopenForumTopicCall

NewReopenForumTopicCall constructs a new ReopenForumTopicCall with required parameters. 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 Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

func (*ReopenForumTopicCall) MessageThreadID added in v0.6.0

func (call *ReopenForumTopicCall) MessageThreadID(messageThreadID int) *ReopenForumTopicCall

MessageThreadID Unique identifier for the target message thread of the forum topic

type ReopenGeneralForumTopicCall added in v0.6.0

type ReopenGeneralForumTopicCall struct {
	CallNoResult
}

ReopenGeneralForumTopicCall reprenesents 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

func NewReopenGeneralForumTopicCall added in v0.6.0

func NewReopenGeneralForumTopicCall(chatID PeerID) *ReopenGeneralForumTopicCall

NewReopenGeneralForumTopicCall constructs a new ReopenGeneralForumTopicCall with required parameters. 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 Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

type ReplaceStickerInSetCall added in v0.15.0

type ReplaceStickerInSetCall struct {
	CallNoResult
}

ReplaceStickerInSetCall reprenesents 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 deleteStickerFromSet, then addStickerToSet, then setStickerPositionInSet

func NewReplaceStickerInSetCall added in v0.15.0

func NewReplaceStickerInSetCall(userID UserID, name string, oldSticker string, sticker InputSticker) *ReplaceStickerInSetCall

NewReplaceStickerInSetCall constructs a new ReplaceStickerInSetCall with required parameters. 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 Sticker set name

func (*ReplaceStickerInSetCall) OldSticker added in v0.15.0

func (call *ReplaceStickerInSetCall) OldSticker(oldSticker string) *ReplaceStickerInSetCall

OldSticker File identifier of the replaced sticker

func (*ReplaceStickerInSetCall) Sticker added in v0.15.0

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) UserID added in v0.15.0

UserID User identifier of the sticker set owner

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).

func NewReplyKeyboardMarkup added in v0.0.2

func NewReplyKeyboardMarkup(rows ...[]KeyboardButton) *ReplyKeyboardMarkup

NewReplyKeyboardMarkup creates a new ReplyKeyboardMarkup.

func (*ReplyKeyboardMarkup) WithInputFieldPlaceholder added in v0.0.2

func (markup *ReplyKeyboardMarkup) WithInputFieldPlaceholder(placeholder string) *ReplyKeyboardMarkup

WithInputFieldPlaceholder sets the placeholder to be shown in the input field when the keyboard is active; 1-64 characters

func (*ReplyKeyboardMarkup) WithOneTimeKeyboardMarkup added in v0.0.2

func (markup *ReplyKeyboardMarkup) WithOneTimeKeyboardMarkup() *ReplyKeyboardMarkup

WithOneTimeKeyboard 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.

func (*ReplyKeyboardMarkup) WithResizeKeyboardMarkup added in v0.0.2

func (markup *ReplyKeyboardMarkup) WithResizeKeyboardMarkup() *ReplyKeyboardMarkup

WithResizeKeyboard 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.

func (*ReplyKeyboardMarkup) WithSelective added in v0.0.2

func (markup *ReplyKeyboardMarkup) WithSelective() *ReplyKeyboardMarkup

Use this parameter if you want to show the keyboard to specific users only.

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).

func NewReplyKeyboardRemove added in v0.0.2

func NewReplyKeyboardRemove() *ReplyKeyboardRemove

NewReplyKeyboardRemove creates a new ReplyKeyboardRemove.

func (*ReplyKeyboardRemove) WithSelective added in v0.0.2

func (markup *ReplyKeyboardRemove) WithSelective() *ReplyKeyboardRemove

WithSelective set it if you want to remove the keyboard for specific users only.

type ReplyMarkup

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

ReplyMarkup generic for keyboards.

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.
	ChatID PeerID `json:"chat_id,omitempty"`

	// Optional. Pass True if the message should be sent even if the specified message to be replied to is not found. Always False for replies in another chat or forum topic. Always True for messages sent on behalf of a business account.
	AllowSendingWithoutReply bool `json:"allow_sending_without_reply,omitempty"`

	// Optional. Quoted part of the message to be replied to; 0-1024 characters after entities parsing. The quote must be an exact substring of the message to be replied to, including bold, italic, underline, strikethrough, spoiler, and custom_emoji entities. The message will fail to send if the quote isn't found in the original message.
	Quote string `json:"quote,omitempty"`

	// Optional. Mode for parsing entities in the quote. See formatting options for more details.
	QuoteParseMode 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"`
}

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

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(im InputMedia) *Request

func (*Request) InputMediaSlice added in v0.0.5

func (r *Request) InputMediaSlice(name string, im []InputMedia) *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.
	MigrateToChatID int64 `json:"migrate_to_chat_id,omitempty"`

	// Optional. In case of exceeding flood control, the number of seconds left to wait before the request can be repeated
	RetryAfter 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 reprenesents 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

func NewRestrictChatMemberCall

func NewRestrictChatMemberCall(chatID PeerID, userID UserID, permissions ChatPermissions) *RestrictChatMemberCall

NewRestrictChatMemberCall constructs a new RestrictChatMemberCall with required parameters. 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 Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

func (*RestrictChatMemberCall) Permissions

func (call *RestrictChatMemberCall) Permissions(permissions ChatPermissions) *RestrictChatMemberCall

Permissions A JSON-serialized object for new user permissions

func (*RestrictChatMemberCall) UntilDate

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

UntilDate Date when restrictions will be lifted for the user; Unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever

func (*RestrictChatMemberCall) UseIndependentChatPermissions added in v0.6.0

func (call *RestrictChatMemberCall) UseIndependentChatPermissions(useIndependentChatPermissions bool) *RestrictChatMemberCall

UseIndependentChatPermissions Pass True if chat permissions are set independently. Otherwise, the can_send_other_messages and can_add_web_page_previews permissions will imply the can_send_messages, can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, and can_send_voice_notes permissions; the can_send_polls permission will imply the can_send_messages permission.

func (*RestrictChatMemberCall) UserID added in v0.0.5

UserID Unique identifier of the target user

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 RevokeChatInviteLinkCall

type RevokeChatInviteLinkCall struct {
	Call[ChatInviteLink]
}

RevokeChatInviteLinkCall reprenesents 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 with required parameters. 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 Unique identifier of the target chat or username of the target channel (in the format @channelusername)

func (call *RevokeChatInviteLinkCall) InviteLink(inviteLink string) *RevokeChatInviteLinkCall

InviteLink The invite link to revoke

type SendAnimationCall

type SendAnimationCall struct {
	Call[Message]
}

SendAnimationCall reprenesents 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 with required parameters. 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) Animation

func (call *SendAnimationCall) Animation(animation FileArg) *SendAnimationCall

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) BusinessConnectionID added in v0.15.0

func (call *SendAnimationCall) BusinessConnectionID(businessConnectionID string) *SendAnimationCall

BusinessConnectionID Unique identifier of the business connection on behalf of which the message will be sent

func (*SendAnimationCall) Caption

func (call *SendAnimationCall) Caption(caption string) *SendAnimationCall

Caption Animation caption (may also be used when resending animation by file_id), 0-1024 characters after entities parsing

func (*SendAnimationCall) CaptionEntities

func (call *SendAnimationCall) CaptionEntities(captionEntities []MessageEntity) *SendAnimationCall

CaptionEntities A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode

func (*SendAnimationCall) ChatID added in v0.0.5

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

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

func (*SendAnimationCall) DisableNotification

func (call *SendAnimationCall) DisableNotification(disableNotification bool) *SendAnimationCall

DisableNotification Sends the message silently. Users will receive a notification with no sound.

func (*SendAnimationCall) Duration

func (call *SendAnimationCall) Duration(duration int) *SendAnimationCall

Duration Duration of sent animation in seconds

func (*SendAnimationCall) HasSpoiler added in v0.6.0

func (call *SendAnimationCall) HasSpoiler(hasSpoiler bool) *SendAnimationCall

HasSpoiler Pass True if the animation needs to be covered with a spoiler animation

func (*SendAnimationCall) Height

func (call *SendAnimationCall) Height(height int) *SendAnimationCall

Height Animation height

func (*SendAnimationCall) MessageThreadID added in v0.6.0

func (call *SendAnimationCall) MessageThreadID(messageThreadID int) *SendAnimationCall

MessageThreadID Unique identifier for the target message thread (topic) of the forum; for forum supergroups only

func (*SendAnimationCall) ParseMode

func (call *SendAnimationCall) ParseMode(parseMode ParseMode) *SendAnimationCall

ParseMode Mode for parsing entities in the animation caption. See formatting options for more details.

func (*SendAnimationCall) ProtectContent

func (call *SendAnimationCall) ProtectContent(protectContent bool) *SendAnimationCall

ProtectContent Protects the contents of the sent message from forwarding and saving

func (*SendAnimationCall) ReplyMarkup

func (call *SendAnimationCall) ReplyMarkup(replyMarkup ReplyMarkup) *SendAnimationCall

ReplyMarkup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account

func (*SendAnimationCall) ReplyParameters added in v0.12.0

func (call *SendAnimationCall) ReplyParameters(replyParameters ReplyParameters) *SendAnimationCall

ReplyParameters Description of the message to reply to

func (*SendAnimationCall) Thumbnail added in v0.8.0

func (call *SendAnimationCall) Thumbnail(thumbnail FileArg) *SendAnimationCall

Thumbnail 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 »

func (*SendAnimationCall) Width

func (call *SendAnimationCall) Width(width int) *SendAnimationCall

Width Animation width

type SendAudioCall

type SendAudioCall struct {
	Call[Message]
}

SendAudioCall reprenesents 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 sendVoice method instead.

func NewSendAudioCall

func NewSendAudioCall(chatID PeerID, audio FileArg) *SendAudioCall

NewSendAudioCall constructs a new SendAudioCall with required parameters. 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) Audio

func (call *SendAudioCall) Audio(audio FileArg) *SendAudioCall

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) BusinessConnectionID added in v0.15.0

func (call *SendAudioCall) BusinessConnectionID(businessConnectionID string) *SendAudioCall

BusinessConnectionID Unique identifier of the business connection on behalf of which the message will be sent

func (*SendAudioCall) Caption

func (call *SendAudioCall) Caption(caption string) *SendAudioCall

Caption Audio caption, 0-1024 characters after entities parsing

func (*SendAudioCall) CaptionEntities

func (call *SendAudioCall) CaptionEntities(captionEntities []MessageEntity) *SendAudioCall

CaptionEntities A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode

func (*SendAudioCall) ChatID added in v0.0.5

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

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

func (*SendAudioCall) DisableNotification

func (call *SendAudioCall) DisableNotification(disableNotification bool) *SendAudioCall

DisableNotification Sends the message silently. Users will receive a notification with no sound.

func (*SendAudioCall) Duration

func (call *SendAudioCall) Duration(duration int) *SendAudioCall

Duration Duration of the audio in seconds

func (*SendAudioCall) MessageThreadID added in v0.6.0

func (call *SendAudioCall) MessageThreadID(messageThreadID int) *SendAudioCall

MessageThreadID Unique identifier for the target message thread (topic) of the forum; for forum supergroups only

func (*SendAudioCall) ParseMode

func (call *SendAudioCall) ParseMode(parseMode ParseMode) *SendAudioCall

ParseMode Mode for parsing entities in the audio caption. See formatting options for more details.

func (*SendAudioCall) Performer

func (call *SendAudioCall) Performer(performer string) *SendAudioCall

Performer Performer

func (*SendAudioCall) ProtectContent

func (call *SendAudioCall) ProtectContent(protectContent bool) *SendAudioCall

ProtectContent Protects the contents of the sent message from forwarding and saving

func (*SendAudioCall) ReplyMarkup

func (call *SendAudioCall) ReplyMarkup(replyMarkup ReplyMarkup) *SendAudioCall

ReplyMarkup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account

func (*SendAudioCall) ReplyParameters added in v0.12.0

func (call *SendAudioCall) ReplyParameters(replyParameters ReplyParameters) *SendAudioCall

ReplyParameters Description of the message to reply to

func (*SendAudioCall) Thumbnail added in v0.8.0

func (call *SendAudioCall) Thumbnail(thumbnail FileArg) *SendAudioCall

Thumbnail 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 »

func (*SendAudioCall) Title

func (call *SendAudioCall) Title(title string) *SendAudioCall

Title Track name

type SendChatActionCall

type SendChatActionCall struct {
	CallNoResult
}

SendChatActionCall reprenesents 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) 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 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 with required parameters. chatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername) action - Type of action to broadcast. Choose one, depending on what the user is about to receive: typing for text messages, upload_photo for photos, record_video or upload_video for videos, record_voice or upload_voice for voice notes, upload_document for general files, choose_sticker for stickers, find_location for location data, record_video_note or upload_video_note for video notes.

func (*SendChatActionCall) Action

func (call *SendChatActionCall) Action(action ChatAction) *SendChatActionCall

Action Type of action to broadcast. Choose one, depending on what the user is about to receive: typing for text messages, upload_photo for photos, record_video or upload_video for videos, record_voice or upload_voice for voice notes, upload_document for general files, choose_sticker for stickers, find_location for location data, record_video_note or upload_video_note for video notes.

func (*SendChatActionCall) BusinessConnectionID added in v0.15.0

func (call *SendChatActionCall) BusinessConnectionID(businessConnectionID string) *SendChatActionCall

BusinessConnectionID Unique identifier of the business connection on behalf of which the action will be sent

func (*SendChatActionCall) ChatID added in v0.0.5

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

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

func (*SendChatActionCall) MessageThreadID added in v0.6.0

func (call *SendChatActionCall) MessageThreadID(messageThreadID int) *SendChatActionCall

MessageThreadID Unique identifier for the target message thread; for supergroups only

type SendContactCall

type SendContactCall struct {
	Call[Message]
}

SendContactCall reprenesents 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 with required parameters. 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) BusinessConnectionID added in v0.15.0

func (call *SendContactCall) BusinessConnectionID(businessConnectionID string) *SendContactCall

BusinessConnectionID Unique identifier of the business connection on behalf of which the message will be sent

func (*SendContactCall) ChatID added in v0.0.5

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

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

func (*SendContactCall) DisableNotification

func (call *SendContactCall) DisableNotification(disableNotification bool) *SendContactCall

DisableNotification Sends the message silently. Users will receive a notification with no sound.

func (*SendContactCall) FirstName

func (call *SendContactCall) FirstName(firstName string) *SendContactCall

FirstName Contact's first name

func (*SendContactCall) LastName

func (call *SendContactCall) LastName(lastName string) *SendContactCall

LastName Contact's last name

func (*SendContactCall) MessageThreadID added in v0.6.0

func (call *SendContactCall) MessageThreadID(messageThreadID int) *SendContactCall

MessageThreadID Unique identifier for the target message thread (topic) of the forum; for forum supergroups only

func (*SendContactCall) PhoneNumber

func (call *SendContactCall) PhoneNumber(phoneNumber string) *SendContactCall

PhoneNumber Contact's phone number

func (*SendContactCall) ProtectContent

func (call *SendContactCall) ProtectContent(protectContent bool) *SendContactCall

ProtectContent Protects the contents of the sent message from forwarding and saving

func (*SendContactCall) ReplyMarkup

func (call *SendContactCall) ReplyMarkup(replyMarkup ReplyMarkup) *SendContactCall

ReplyMarkup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account

func (*SendContactCall) ReplyParameters added in v0.12.0

func (call *SendContactCall) ReplyParameters(replyParameters ReplyParameters) *SendContactCall

ReplyParameters Description of the message to reply to

func (*SendContactCall) Vcard

func (call *SendContactCall) Vcard(vcard string) *SendContactCall

Vcard Additional data about the contact in the form of a vCard, 0-2048 bytes

type SendDiceCall

type SendDiceCall struct {
	Call[Message]
}

SendDiceCall reprenesents 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 with required parameters. chatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*SendDiceCall) BusinessConnectionID added in v0.15.0

func (call *SendDiceCall) BusinessConnectionID(businessConnectionID string) *SendDiceCall

BusinessConnectionID Unique identifier of the business connection on behalf of which the message will be sent

func (*SendDiceCall) ChatID added in v0.0.5

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

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

func (*SendDiceCall) DisableNotification

func (call *SendDiceCall) DisableNotification(disableNotification bool) *SendDiceCall

DisableNotification Sends the message silently. Users will receive a notification with no sound.

func (*SendDiceCall) Emoji

func (call *SendDiceCall) Emoji(emoji string) *SendDiceCall

Emoji Emoji on which the dice throw animation is based. Currently, must be one of “”, “”, “”, “”, “”, or “”. Dice can have values 1-6 for “”, “” and “”, values 1-5 for “” and “”, and values 1-64 for “”. Defaults to “”

func (*SendDiceCall) MessageThreadID added in v0.6.0

func (call *SendDiceCall) MessageThreadID(messageThreadID int) *SendDiceCall

MessageThreadID Unique identifier for the target message thread (topic) of the forum; for forum supergroups only

func (*SendDiceCall) ProtectContent

func (call *SendDiceCall) ProtectContent(protectContent bool) *SendDiceCall

ProtectContent Protects the contents of the sent message from forwarding

func (*SendDiceCall) ReplyMarkup

func (call *SendDiceCall) ReplyMarkup(replyMarkup ReplyMarkup) *SendDiceCall

ReplyMarkup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account

func (*SendDiceCall) ReplyParameters added in v0.12.0

func (call *SendDiceCall) ReplyParameters(replyParameters ReplyParameters) *SendDiceCall

ReplyParameters Description of the message to reply to

type SendDocumentCall

type SendDocumentCall struct {
	Call[Message]
}

SendDocumentCall reprenesents 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 with required parameters. 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) BusinessConnectionID added in v0.15.0

func (call *SendDocumentCall) BusinessConnectionID(businessConnectionID string) *SendDocumentCall

BusinessConnectionID Unique identifier of the business connection on behalf of which the message will be sent

func (*SendDocumentCall) Caption

func (call *SendDocumentCall) Caption(caption string) *SendDocumentCall

Caption Document caption (may also be used when resending documents by file_id), 0-1024 characters after entities parsing

func (*SendDocumentCall) CaptionEntities

func (call *SendDocumentCall) CaptionEntities(captionEntities []MessageEntity) *SendDocumentCall

CaptionEntities A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode

func (*SendDocumentCall) ChatID added in v0.0.5

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

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

func (*SendDocumentCall) DisableContentTypeDetection

func (call *SendDocumentCall) DisableContentTypeDetection(disableContentTypeDetection bool) *SendDocumentCall

DisableContentTypeDetection Disables automatic server-side content type detection for files uploaded using multipart/form-data

func (*SendDocumentCall) DisableNotification

func (call *SendDocumentCall) DisableNotification(disableNotification bool) *SendDocumentCall

DisableNotification Sends the message silently. Users will receive a notification with no sound.

func (*SendDocumentCall) Document

func (call *SendDocumentCall) Document(document FileArg) *SendDocumentCall

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) MessageThreadID added in v0.6.0

func (call *SendDocumentCall) MessageThreadID(messageThreadID int) *SendDocumentCall

MessageThreadID Unique identifier for the target message thread (topic) of the forum; for forum supergroups only

func (*SendDocumentCall) ParseMode

func (call *SendDocumentCall) ParseMode(parseMode ParseMode) *SendDocumentCall

ParseMode Mode for parsing entities in the document caption. See formatting options for more details.

func (*SendDocumentCall) ProtectContent

func (call *SendDocumentCall) ProtectContent(protectContent bool) *SendDocumentCall

ProtectContent Protects the contents of the sent message from forwarding and saving

func (*SendDocumentCall) ReplyMarkup

func (call *SendDocumentCall) ReplyMarkup(replyMarkup ReplyMarkup) *SendDocumentCall

ReplyMarkup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account

func (*SendDocumentCall) ReplyParameters added in v0.12.0

func (call *SendDocumentCall) ReplyParameters(replyParameters ReplyParameters) *SendDocumentCall

ReplyParameters Description of the message to reply to

func (*SendDocumentCall) Thumbnail added in v0.8.0

func (call *SendDocumentCall) Thumbnail(thumbnail FileArg) *SendDocumentCall

Thumbnail 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 »

type SendGameCall

type SendGameCall struct {
	Call[Message]
}

SendGameCall reprenesents 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 ChatID, gameShortName string) *SendGameCall

NewSendGameCall constructs a new SendGameCall with required parameters. chatID - Unique identifier for the target chat gameShortName - Short name of the game, serves as the unique identifier for the game. Set up your games via @BotFather.

func (*SendGameCall) BusinessConnectionID added in v0.15.0

func (call *SendGameCall) BusinessConnectionID(businessConnectionID string) *SendGameCall

BusinessConnectionID Unique identifier of the business connection on behalf of which the message will be sent

func (*SendGameCall) ChatID added in v0.0.5

func (call *SendGameCall) ChatID(chatID ChatID) *SendGameCall

ChatID Unique identifier for the target chat

func (*SendGameCall) DisableNotification

func (call *SendGameCall) DisableNotification(disableNotification bool) *SendGameCall

DisableNotification Sends the message silently. Users will receive a notification with no sound.

func (*SendGameCall) GameShortName

func (call *SendGameCall) GameShortName(gameShortName string) *SendGameCall

GameShortName Short name of the game, serves as the unique identifier for the game. Set up your games via @BotFather.

func (*SendGameCall) MessageThreadID added in v0.6.0

func (call *SendGameCall) MessageThreadID(messageThreadID int) *SendGameCall

MessageThreadID Unique identifier for the target message thread (topic) of the forum; for forum supergroups only

func (*SendGameCall) ProtectContent

func (call *SendGameCall) ProtectContent(protectContent bool) *SendGameCall

ProtectContent Protects the contents of the sent message from forwarding and saving

func (*SendGameCall) ReplyMarkup

func (call *SendGameCall) ReplyMarkup(replyMarkup InlineKeyboardMarkup) *SendGameCall

ReplyMarkup A JSON-serialized object for an inline keyboard. If empty, one 'Play game_title' button will be shown. If not empty, the first button must launch the game. Not supported for messages sent on behalf of a business account.

func (*SendGameCall) ReplyParameters added in v0.12.0

func (call *SendGameCall) ReplyParameters(replyParameters ReplyParameters) *SendGameCall

ReplyParameters Description of the message to reply to

type SendInvoiceCall

type SendInvoiceCall struct {
	Call[Message]
}

SendInvoiceCall reprenesents 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, providerToken string, currency string, prices []LabeledPrice) *SendInvoiceCall

NewSendInvoiceCall constructs a new SendInvoiceCall with required parameters. 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 for your internal processes. providerToken - Payment provider token, obtained via @BotFather currency - Three-letter ISO 4217 currency code, see more on currencies prices - Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.)

func (*SendInvoiceCall) ChatID added in v0.0.5

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

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

func (*SendInvoiceCall) Currency

func (call *SendInvoiceCall) Currency(currency string) *SendInvoiceCall

Currency Three-letter ISO 4217 currency code, see more on currencies

func (*SendInvoiceCall) Description

func (call *SendInvoiceCall) Description(description string) *SendInvoiceCall

Description Product description, 1-255 characters

func (*SendInvoiceCall) DisableNotification

func (call *SendInvoiceCall) DisableNotification(disableNotification bool) *SendInvoiceCall

DisableNotification Sends the message silently. Users will receive a notification with no sound.

func (*SendInvoiceCall) IsFlexible

func (call *SendInvoiceCall) IsFlexible(isFlexible bool) *SendInvoiceCall

IsFlexible Pass True if the final price depends on the shipping method

func (*SendInvoiceCall) MaxTipAmount

func (call *SendInvoiceCall) MaxTipAmount(maxTipAmount int) *SendInvoiceCall

MaxTipAmount 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

func (*SendInvoiceCall) MessageThreadID added in v0.6.0

func (call *SendInvoiceCall) MessageThreadID(messageThreadID int) *SendInvoiceCall

MessageThreadID Unique identifier for the target message thread (topic) of the forum; for forum supergroups only

func (*SendInvoiceCall) NeedEmail

func (call *SendInvoiceCall) NeedEmail(needEmail bool) *SendInvoiceCall

NeedEmail Pass True if you require the user's email address to complete the order

func (*SendInvoiceCall) NeedName

func (call *SendInvoiceCall) NeedName(needName bool) *SendInvoiceCall

NeedName Pass True if you require the user's full name to complete the order

func (*SendInvoiceCall) NeedPhoneNumber

func (call *SendInvoiceCall) NeedPhoneNumber(needPhoneNumber bool) *SendInvoiceCall

NeedPhoneNumber Pass True if you require the user's phone number to complete the order

func (*SendInvoiceCall) NeedShippingAddress

func (call *SendInvoiceCall) NeedShippingAddress(needShippingAddress bool) *SendInvoiceCall

NeedShippingAddress Pass True if you require the user's shipping address to complete the order

func (*SendInvoiceCall) Payload

func (call *SendInvoiceCall) Payload(payload string) *SendInvoiceCall

Payload Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.

func (*SendInvoiceCall) PhotoHeight

func (call *SendInvoiceCall) PhotoHeight(photoHeight int) *SendInvoiceCall

PhotoHeight Photo height

func (*SendInvoiceCall) PhotoSize

func (call *SendInvoiceCall) PhotoSize(photoSize int) *SendInvoiceCall

PhotoSize Photo size in bytes

func (*SendInvoiceCall) PhotoURL added in v0.0.5

func (call *SendInvoiceCall) PhotoURL(photoURL string) *SendInvoiceCall

PhotoURL URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for.

func (*SendInvoiceCall) PhotoWidth

func (call *SendInvoiceCall) PhotoWidth(photoWidth int) *SendInvoiceCall

PhotoWidth Photo width

func (*SendInvoiceCall) Prices

func (call *SendInvoiceCall) Prices(prices []LabeledPrice) *SendInvoiceCall

Prices Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.)

func (*SendInvoiceCall) ProtectContent

func (call *SendInvoiceCall) ProtectContent(protectContent bool) *SendInvoiceCall

ProtectContent Protects the contents of the sent message from forwarding and saving

func (*SendInvoiceCall) ProviderData

func (call *SendInvoiceCall) ProviderData(providerData string) *SendInvoiceCall

ProviderData JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider.

func (*SendInvoiceCall) ProviderToken

func (call *SendInvoiceCall) ProviderToken(providerToken string) *SendInvoiceCall

ProviderToken Payment provider token, obtained via @BotFather

func (*SendInvoiceCall) ReplyMarkup

func (call *SendInvoiceCall) ReplyMarkup(replyMarkup InlineKeyboardMarkup) *SendInvoiceCall

ReplyMarkup A JSON-serialized object for an inline keyboard. If empty, one 'Pay total price' button will be shown. If not empty, the first button must be a Pay button.

func (*SendInvoiceCall) ReplyParameters added in v0.12.0

func (call *SendInvoiceCall) ReplyParameters(replyParameters ReplyParameters) *SendInvoiceCall

ReplyParameters Description of the message to reply to

func (*SendInvoiceCall) SendEmailToProvider

func (call *SendInvoiceCall) SendEmailToProvider(sendEmailToProvider bool) *SendInvoiceCall

SendEmailToProvider Pass True if the user's email address should be sent to provider

func (*SendInvoiceCall) SendPhoneNumberToProvider

func (call *SendInvoiceCall) SendPhoneNumberToProvider(sendPhoneNumberToProvider bool) *SendInvoiceCall

SendPhoneNumberToProvider Pass True if the user's phone number should be sent to provider

func (*SendInvoiceCall) StartParameter

func (call *SendInvoiceCall) StartParameter(startParameter string) *SendInvoiceCall

StartParameter Unique deep-linking parameter. If left empty, forwarded copies of the sent message will have a Pay button, allowing multiple users to pay directly from the forwarded message, using the same invoice. If non-empty, forwarded copies of the sent message will have a URL button with a deep link to the bot (instead of a Pay button), with the value used as the start parameter

func (*SendInvoiceCall) SuggestedTipAmounts

func (call *SendInvoiceCall) SuggestedTipAmounts(suggestedTipAmounts []int) *SendInvoiceCall

SuggestedTipAmounts A JSON-serialized array of suggested amounts of tips in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount.

func (*SendInvoiceCall) Title

func (call *SendInvoiceCall) Title(title string) *SendInvoiceCall

Title Product name, 1-32 characters

type SendLocationCall

type SendLocationCall struct {
	Call[Message]
}

SendLocationCall reprenesents 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 with required parameters. 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) BusinessConnectionID added in v0.15.0

func (call *SendLocationCall) BusinessConnectionID(businessConnectionID string) *SendLocationCall

BusinessConnectionID Unique identifier of the business connection on behalf of which the message will be sent

func (*SendLocationCall) ChatID added in v0.0.5

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

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

func (*SendLocationCall) DisableNotification

func (call *SendLocationCall) DisableNotification(disableNotification bool) *SendLocationCall

DisableNotification Sends the message silently. Users will receive a notification with no sound.

func (*SendLocationCall) Heading

func (call *SendLocationCall) Heading(heading int) *SendLocationCall

Heading For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.

func (*SendLocationCall) HorizontalAccuracy

func (call *SendLocationCall) HorizontalAccuracy(horizontalAccuracy float64) *SendLocationCall

HorizontalAccuracy The radius of uncertainty for the location, measured in meters; 0-1500

func (*SendLocationCall) Latitude

func (call *SendLocationCall) Latitude(latitude float64) *SendLocationCall

Latitude Latitude of the location

func (*SendLocationCall) LivePeriod

func (call *SendLocationCall) LivePeriod(livePeriod int) *SendLocationCall

LivePeriod Period in seconds for which the location will be updated (see Live Locations, should be between 60 and 86400.

func (*SendLocationCall) Longitude

func (call *SendLocationCall) Longitude(longitude float64) *SendLocationCall

Longitude Longitude of the location

func (*SendLocationCall) MessageThreadID added in v0.6.0

func (call *SendLocationCall) MessageThreadID(messageThreadID int) *SendLocationCall

MessageThreadID Unique identifier for the target message thread (topic) of the forum; for forum supergroups only

func (*SendLocationCall) ProtectContent

func (call *SendLocationCall) ProtectContent(protectContent bool) *SendLocationCall

ProtectContent Protects the contents of the sent message from forwarding and saving

func (*SendLocationCall) ProximityAlertRadius

func (call *SendLocationCall) ProximityAlertRadius(proximityAlertRadius int) *SendLocationCall

ProximityAlertRadius For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.

func (*SendLocationCall) ReplyMarkup

func (call *SendLocationCall) ReplyMarkup(replyMarkup ReplyMarkup) *SendLocationCall

ReplyMarkup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account

func (*SendLocationCall) ReplyParameters added in v0.12.0

func (call *SendLocationCall) ReplyParameters(replyParameters ReplyParameters) *SendLocationCall

ReplyParameters Description of the message to reply to

type SendMediaGroupCall added in v0.0.5

type SendMediaGroupCall struct {
	Call[[]Message]
}

SendMediaGroupCall reprenesents 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 Messages that were sent is returned.

func NewSendMediaGroupCall added in v0.0.5

func NewSendMediaGroupCall(chatID PeerID, media []InputMedia) *SendMediaGroupCall

NewSendMediaGroupCall constructs a new SendMediaGroupCall with required parameters. 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) BusinessConnectionID added in v0.15.0

func (call *SendMediaGroupCall) BusinessConnectionID(businessConnectionID string) *SendMediaGroupCall

BusinessConnectionID Unique identifier of the business connection on behalf of which the message will be sent

func (*SendMediaGroupCall) ChatID added in v0.0.5

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

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

func (*SendMediaGroupCall) DisableNotification added in v0.0.5

func (call *SendMediaGroupCall) DisableNotification(disableNotification bool) *SendMediaGroupCall

DisableNotification Sends messages silently. Users will receive a notification with no sound.

func (*SendMediaGroupCall) Media added in v0.0.5

func (call *SendMediaGroupCall) Media(media []InputMedia) *SendMediaGroupCall

Media A JSON-serialized array describing messages to be sent, must include 2-10 items

func (*SendMediaGroupCall) MessageThreadID added in v0.6.0

func (call *SendMediaGroupCall) MessageThreadID(messageThreadID int) *SendMediaGroupCall

MessageThreadID Unique identifier for the target message thread (topic) of the forum; for forum supergroups only

func (*SendMediaGroupCall) ProtectContent added in v0.0.5

func (call *SendMediaGroupCall) ProtectContent(protectContent bool) *SendMediaGroupCall

ProtectContent Protects the contents of the sent messages from forwarding and saving

func (*SendMediaGroupCall) ReplyParameters added in v0.12.0

func (call *SendMediaGroupCall) ReplyParameters(replyParameters ReplyParameters) *SendMediaGroupCall

ReplyParameters Description of the message to reply to

type SendMessageCall

type SendMessageCall struct {
	Call[Message]
}

SendMessageCall reprenesents 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 with required parameters. 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) BusinessConnectionID added in v0.15.0

func (call *SendMessageCall) BusinessConnectionID(businessConnectionID string) *SendMessageCall

BusinessConnectionID Unique identifier of the business connection on behalf of which the message will be sent

func (*SendMessageCall) ChatID added in v0.0.5

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

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

func (*SendMessageCall) DisableNotification

func (call *SendMessageCall) DisableNotification(disableNotification bool) *SendMessageCall

DisableNotification Sends the message silently. Users will receive a notification with no sound.

func (*SendMessageCall) Entities

func (call *SendMessageCall) Entities(entities []MessageEntity) *SendMessageCall

Entities A JSON-serialized list of special entities that appear in message text, which can be specified instead of parse_mode

func (*SendMessageCall) LinkPreviewOptions added in v0.12.0

func (call *SendMessageCall) LinkPreviewOptions(linkPreviewOptions LinkPreviewOptions) *SendMessageCall

LinkPreviewOptions Link preview generation options for the message

func (*SendMessageCall) MessageThreadID added in v0.6.0

func (call *SendMessageCall) MessageThreadID(messageThreadID int) *SendMessageCall

MessageThreadID Unique identifier for the target message thread (topic) of the forum; for forum supergroups only

func (*SendMessageCall) ParseMode

func (call *SendMessageCall) ParseMode(parseMode ParseMode) *SendMessageCall

ParseMode Mode for parsing entities in the message text. See formatting options for more details.

func (*SendMessageCall) ProtectContent

func (call *SendMessageCall) ProtectContent(protectContent bool) *SendMessageCall

ProtectContent Protects the contents of the sent message from forwarding and saving

func (*SendMessageCall) ReplyMarkup

func (call *SendMessageCall) ReplyMarkup(replyMarkup ReplyMarkup) *SendMessageCall

ReplyMarkup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account

func (*SendMessageCall) ReplyParameters added in v0.12.0

func (call *SendMessageCall) ReplyParameters(replyParameters ReplyParameters) *SendMessageCall

ReplyParameters Description of the message to reply to

func (*SendMessageCall) Text

func (call *SendMessageCall) Text(text string) *SendMessageCall

Text Text of the message to be sent, 1-4096 characters after entities parsing

type SendPhotoCall

type SendPhotoCall struct {
	Call[Message]
}

SendPhotoCall reprenesents 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 with required parameters. 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) BusinessConnectionID added in v0.15.0

func (call *SendPhotoCall) BusinessConnectionID(businessConnectionID string) *SendPhotoCall

BusinessConnectionID Unique identifier of the business connection on behalf of which the message will be sent

func (*SendPhotoCall) Caption

func (call *SendPhotoCall) Caption(caption string) *SendPhotoCall

Caption Photo caption (may also be used when resending photos by file_id), 0-1024 characters after entities parsing

func (*SendPhotoCall) CaptionEntities

func (call *SendPhotoCall) CaptionEntities(captionEntities []MessageEntity) *SendPhotoCall

CaptionEntities A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode

func (*SendPhotoCall) ChatID added in v0.0.5

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

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

func (*SendPhotoCall) DisableNotification

func (call *SendPhotoCall) DisableNotification(disableNotification bool) *SendPhotoCall

DisableNotification Sends the message silently. Users will receive a notification with no sound.

func (*SendPhotoCall) HasSpoiler added in v0.6.0

func (call *SendPhotoCall) HasSpoiler(hasSpoiler bool) *SendPhotoCall

HasSpoiler Pass True if the photo needs to be covered with a spoiler animation

func (*SendPhotoCall) MessageThreadID added in v0.6.0

func (call *SendPhotoCall) MessageThreadID(messageThreadID int) *SendPhotoCall

MessageThreadID Unique identifier for the target message thread (topic) of the forum; for forum supergroups only

func (*SendPhotoCall) ParseMode

func (call *SendPhotoCall) ParseMode(parseMode ParseMode) *SendPhotoCall

ParseMode Mode for parsing entities in the photo caption. See formatting options for more details.

func (*SendPhotoCall) Photo

func (call *SendPhotoCall) Photo(photo FileArg) *SendPhotoCall

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) ProtectContent

func (call *SendPhotoCall) ProtectContent(protectContent bool) *SendPhotoCall

ProtectContent Protects the contents of the sent message from forwarding and saving

func (*SendPhotoCall) ReplyMarkup

func (call *SendPhotoCall) ReplyMarkup(replyMarkup ReplyMarkup) *SendPhotoCall

ReplyMarkup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account

func (*SendPhotoCall) ReplyParameters added in v0.12.0

func (call *SendPhotoCall) ReplyParameters(replyParameters ReplyParameters) *SendPhotoCall

ReplyParameters Description of the message to reply to

type SendPollCall

type SendPollCall struct {
	Call[Message]
}

SendPollCall reprenesents 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 []string) *SendPollCall

NewSendPollCall constructs a new SendPollCall with required parameters. chatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername) question - Poll question, 1-300 characters options - A JSON-serialized list of answer options, 2-10 strings 1-100 characters each

func (*SendPollCall) AllowsMultipleAnswers

func (call *SendPollCall) AllowsMultipleAnswers(allowsMultipleAnswers bool) *SendPollCall

AllowsMultipleAnswers True, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to False

func (*SendPollCall) BusinessConnectionID added in v0.15.0

func (call *SendPollCall) BusinessConnectionID(businessConnectionID string) *SendPollCall

BusinessConnectionID Unique identifier of the business connection on behalf of which the message will be sent

func (*SendPollCall) ChatID added in v0.0.5

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

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

func (*SendPollCall) CloseDate

func (call *SendPollCall) CloseDate(closeDate int) *SendPollCall

CloseDate Point in time (Unix timestamp) when the poll will be automatically closed. Must be at least 5 and no more than 600 seconds in the future. Can't be used together with open_period.

func (*SendPollCall) CorrectOptionID added in v0.0.5

func (call *SendPollCall) CorrectOptionID(correctOptionID int) *SendPollCall

CorrectOptionID 0-based identifier of the correct answer option, required for polls in quiz mode

func (*SendPollCall) DisableNotification

func (call *SendPollCall) DisableNotification(disableNotification bool) *SendPollCall

DisableNotification Sends the message silently. Users will receive a notification with no sound.

func (*SendPollCall) Explanation

func (call *SendPollCall) Explanation(explanation string) *SendPollCall

Explanation Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters with at most 2 line feeds after entities parsing

func (*SendPollCall) ExplanationEntities

func (call *SendPollCall) ExplanationEntities(explanationEntities []MessageEntity) *SendPollCall

ExplanationEntities A JSON-serialized list of special entities that appear in the poll explanation, which can be specified instead of parse_mode

func (*SendPollCall) ExplanationParseMode

func (call *SendPollCall) ExplanationParseMode(explanationParseMode ParseMode) *SendPollCall

ExplanationParseMode Mode for parsing entities in the explanation. See formatting options for more details.

func (*SendPollCall) IsAnonymous

func (call *SendPollCall) IsAnonymous(isAnonymous bool) *SendPollCall

IsAnonymous True, if the poll needs to be anonymous, defaults to True

func (*SendPollCall) IsClosed

func (call *SendPollCall) IsClosed(isClosed bool) *SendPollCall

IsClosed Pass True if the poll needs to be immediately closed. This can be useful for poll preview.

func (*SendPollCall) MessageThreadID added in v0.6.0

func (call *SendPollCall) MessageThreadID(messageThreadID int) *SendPollCall

MessageThreadID Unique identifier for the target message thread (topic) of the forum; for forum supergroups only

func (*SendPollCall) OpenPeriod

func (call *SendPollCall) OpenPeriod(openPeriod int) *SendPollCall

OpenPeriod Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with close_date.

func (*SendPollCall) Options

func (call *SendPollCall) Options(options []string) *SendPollCall

Options A JSON-serialized list of answer options, 2-10 strings 1-100 characters each

func (*SendPollCall) ProtectContent

func (call *SendPollCall) ProtectContent(protectContent bool) *SendPollCall

ProtectContent Protects the contents of the sent message from forwarding and saving

func (*SendPollCall) Question

func (call *SendPollCall) Question(question string) *SendPollCall

Question Poll question, 1-300 characters

func (*SendPollCall) ReplyMarkup

func (call *SendPollCall) ReplyMarkup(replyMarkup ReplyMarkup) *SendPollCall

ReplyMarkup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account

func (*SendPollCall) ReplyParameters added in v0.12.0

func (call *SendPollCall) ReplyParameters(replyParameters ReplyParameters) *SendPollCall

ReplyParameters Description of the message to reply to

func (*SendPollCall) Type

func (call *SendPollCall) Type(typ string) *SendPollCall

Type Poll type, “quiz” or “regular”, defaults to “regular”

type SendStickerCall

type SendStickerCall struct {
	Call[Message]
}

SendStickerCall reprenesents 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 with required parameters. 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) BusinessConnectionID added in v0.15.0

func (call *SendStickerCall) BusinessConnectionID(businessConnectionID string) *SendStickerCall

BusinessConnectionID Unique identifier of the business connection on behalf of which the message will be sent

func (*SendStickerCall) ChatID added in v0.0.5

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

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

func (*SendStickerCall) DisableNotification

func (call *SendStickerCall) DisableNotification(disableNotification bool) *SendStickerCall

DisableNotification Sends the message silently. Users will receive a notification with no sound.

func (*SendStickerCall) Emoji added in v0.8.0

func (call *SendStickerCall) Emoji(emoji string) *SendStickerCall

Emoji Emoji associated with the sticker; only for just uploaded stickers

func (*SendStickerCall) MessageThreadID added in v0.6.0

func (call *SendStickerCall) MessageThreadID(messageThreadID int) *SendStickerCall

MessageThreadID Unique identifier for the target message thread (topic) of the forum; for forum supergroups only

func (*SendStickerCall) ProtectContent

func (call *SendStickerCall) ProtectContent(protectContent bool) *SendStickerCall

ProtectContent Protects the contents of the sent message from forwarding and saving

func (*SendStickerCall) ReplyMarkup

func (call *SendStickerCall) ReplyMarkup(replyMarkup ReplyMarkup) *SendStickerCall

ReplyMarkup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account.

func (*SendStickerCall) ReplyParameters added in v0.12.0

func (call *SendStickerCall) ReplyParameters(replyParameters ReplyParameters) *SendStickerCall

ReplyParameters Description of the message to reply to

func (*SendStickerCall) Sticker

func (call *SendStickerCall) Sticker(sticker FileArg) *SendStickerCall

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.

type SendVenueCall

type SendVenueCall struct {
	Call[Message]
}

SendVenueCall reprenesents 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 with required parameters. 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 Address of the venue

func (*SendVenueCall) BusinessConnectionID added in v0.15.0

func (call *SendVenueCall) BusinessConnectionID(businessConnectionID string) *SendVenueCall

BusinessConnectionID Unique identifier of the business connection on behalf of which the message will be sent

func (*SendVenueCall) ChatID added in v0.0.5

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

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

func (*SendVenueCall) DisableNotification

func (call *SendVenueCall) DisableNotification(disableNotification bool) *SendVenueCall

DisableNotification Sends the message silently. Users will receive a notification with no sound.

func (*SendVenueCall) FoursquareID added in v0.0.5

func (call *SendVenueCall) FoursquareID(foursquareID string) *SendVenueCall

FoursquareID Foursquare identifier of the venue

func (*SendVenueCall) FoursquareType

func (call *SendVenueCall) FoursquareType(foursquareType string) *SendVenueCall

FoursquareType Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)

func (*SendVenueCall) GooglePlaceID added in v0.0.5

func (call *SendVenueCall) GooglePlaceID(googlePlaceID string) *SendVenueCall

GooglePlaceID Google Places identifier of the venue

func (*SendVenueCall) GooglePlaceType

func (call *SendVenueCall) GooglePlaceType(googlePlaceType string) *SendVenueCall

GooglePlaceType Google Places type of the venue. (See supported types.)

func (*SendVenueCall) Latitude

func (call *SendVenueCall) Latitude(latitude float64) *SendVenueCall

Latitude Latitude of the venue

func (*SendVenueCall) Longitude

func (call *SendVenueCall) Longitude(longitude float64) *SendVenueCall

Longitude Longitude of the venue

func (*SendVenueCall) MessageThreadID added in v0.6.0

func (call *SendVenueCall) MessageThreadID(messageThreadID int) *SendVenueCall

MessageThreadID Unique identifier for the target message thread (topic) of the forum; for forum supergroups only

func (*SendVenueCall) ProtectContent

func (call *SendVenueCall) ProtectContent(protectContent bool) *SendVenueCall

ProtectContent Protects the contents of the sent message from forwarding and saving

func (*SendVenueCall) ReplyMarkup

func (call *SendVenueCall) ReplyMarkup(replyMarkup ReplyMarkup) *SendVenueCall

ReplyMarkup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account

func (*SendVenueCall) ReplyParameters added in v0.12.0

func (call *SendVenueCall) ReplyParameters(replyParameters ReplyParameters) *SendVenueCall

ReplyParameters Description of the message to reply to

func (*SendVenueCall) Title

func (call *SendVenueCall) Title(title string) *SendVenueCall

Title Name of the venue

type SendVideoCall

type SendVideoCall struct {
	Call[Message]
}

SendVideoCall reprenesents 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 with required parameters. 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) BusinessConnectionID added in v0.15.0

func (call *SendVideoCall) BusinessConnectionID(businessConnectionID string) *SendVideoCall

BusinessConnectionID Unique identifier of the business connection on behalf of which the message will be sent

func (*SendVideoCall) Caption

func (call *SendVideoCall) Caption(caption string) *SendVideoCall

Caption Video caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing

func (*SendVideoCall) CaptionEntities

func (call *SendVideoCall) CaptionEntities(captionEntities []MessageEntity) *SendVideoCall

CaptionEntities A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode

func (*SendVideoCall) ChatID added in v0.0.5

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

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

func (*SendVideoCall) DisableNotification

func (call *SendVideoCall) DisableNotification(disableNotification bool) *SendVideoCall

DisableNotification Sends the message silently. Users will receive a notification with no sound.

func (*SendVideoCall) Duration

func (call *SendVideoCall) Duration(duration int) *SendVideoCall

Duration Duration of sent video in seconds

func (*SendVideoCall) HasSpoiler added in v0.6.0

func (call *SendVideoCall) HasSpoiler(hasSpoiler bool) *SendVideoCall

HasSpoiler Pass True if the video needs to be covered with a spoiler animation

func (*SendVideoCall) Height

func (call *SendVideoCall) Height(height int) *SendVideoCall

Height Video height

func (*SendVideoCall) MessageThreadID added in v0.6.0

func (call *SendVideoCall) MessageThreadID(messageThreadID int) *SendVideoCall

MessageThreadID Unique identifier for the target message thread (topic) of the forum; for forum supergroups only

func (*SendVideoCall) ParseMode

func (call *SendVideoCall) ParseMode(parseMode ParseMode) *SendVideoCall

ParseMode Mode for parsing entities in the video caption. See formatting options for more details.

func (*SendVideoCall) ProtectContent

func (call *SendVideoCall) ProtectContent(protectContent bool) *SendVideoCall

ProtectContent Protects the contents of the sent message from forwarding and saving

func (*SendVideoCall) ReplyMarkup

func (call *SendVideoCall) ReplyMarkup(replyMarkup ReplyMarkup) *SendVideoCall

ReplyMarkup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account

func (*SendVideoCall) ReplyParameters added in v0.12.0

func (call *SendVideoCall) ReplyParameters(replyParameters ReplyParameters) *SendVideoCall

ReplyParameters Description of the message to reply to

func (*SendVideoCall) SupportsStreaming

func (call *SendVideoCall) SupportsStreaming(supportsStreaming bool) *SendVideoCall

SupportsStreaming Pass True if the uploaded video is suitable for streaming

func (*SendVideoCall) Thumbnail added in v0.8.0

func (call *SendVideoCall) Thumbnail(thumbnail FileArg) *SendVideoCall

Thumbnail 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 »

func (*SendVideoCall) Video

func (call *SendVideoCall) Video(video FileArg) *SendVideoCall

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) Width

func (call *SendVideoCall) Width(width int) *SendVideoCall

Width Video width

type SendVideoNoteCall

type SendVideoNoteCall struct {
	Call[Message]
}

SendVideoNoteCall reprenesents 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 with required parameters. 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) BusinessConnectionID added in v0.15.0

func (call *SendVideoNoteCall) BusinessConnectionID(businessConnectionID string) *SendVideoNoteCall

BusinessConnectionID Unique identifier of the business connection on behalf of which the message will be sent

func (*SendVideoNoteCall) ChatID added in v0.0.5

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

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

func (*SendVideoNoteCall) DisableNotification

func (call *SendVideoNoteCall) DisableNotification(disableNotification bool) *SendVideoNoteCall

DisableNotification Sends the message silently. Users will receive a notification with no sound.

func (*SendVideoNoteCall) Duration

func (call *SendVideoNoteCall) Duration(duration int) *SendVideoNoteCall

Duration Duration of sent video in seconds

func (*SendVideoNoteCall) Length

func (call *SendVideoNoteCall) Length(length int) *SendVideoNoteCall

Length Video width and height, i.e. diameter of the video message

func (*SendVideoNoteCall) MessageThreadID added in v0.6.0

func (call *SendVideoNoteCall) MessageThreadID(messageThreadID int) *SendVideoNoteCall

MessageThreadID Unique identifier for the target message thread (topic) of the forum; for forum supergroups only

func (*SendVideoNoteCall) ProtectContent

func (call *SendVideoNoteCall) ProtectContent(protectContent bool) *SendVideoNoteCall

ProtectContent Protects the contents of the sent message from forwarding and saving

func (*SendVideoNoteCall) ReplyMarkup

func (call *SendVideoNoteCall) ReplyMarkup(replyMarkup ReplyMarkup) *SendVideoNoteCall

ReplyMarkup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account

func (*SendVideoNoteCall) ReplyParameters added in v0.12.0

func (call *SendVideoNoteCall) ReplyParameters(replyParameters ReplyParameters) *SendVideoNoteCall

ReplyParameters Description of the message to reply to

func (*SendVideoNoteCall) Thumbnail added in v0.8.0

func (call *SendVideoNoteCall) Thumbnail(thumbnail FileArg) *SendVideoNoteCall

Thumbnail 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 »

func (*SendVideoNoteCall) VideoNote

func (call *SendVideoNoteCall) VideoNote(videoNote FileArg) *SendVideoNoteCall

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

type SendVoiceCall

type SendVoiceCall struct {
	Call[Message]
}

SendVoiceCall reprenesents 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 (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 with required parameters. 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) BusinessConnectionID added in v0.15.0

func (call *SendVoiceCall) BusinessConnectionID(businessConnectionID string) *SendVoiceCall

BusinessConnectionID Unique identifier of the business connection on behalf of which the message will be sent

func (*SendVoiceCall) Caption

func (call *SendVoiceCall) Caption(caption string) *SendVoiceCall

Caption Voice message caption, 0-1024 characters after entities parsing

func (*SendVoiceCall) CaptionEntities

func (call *SendVoiceCall) CaptionEntities(captionEntities []MessageEntity) *SendVoiceCall

CaptionEntities A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode

func (*SendVoiceCall) ChatID added in v0.0.5

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

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

func (*SendVoiceCall) DisableNotification

func (call *SendVoiceCall) DisableNotification(disableNotification bool) *SendVoiceCall

DisableNotification Sends the message silently. Users will receive a notification with no sound.

func (*SendVoiceCall) Duration

func (call *SendVoiceCall) Duration(duration int) *SendVoiceCall

Duration Duration of the voice message in seconds

func (*SendVoiceCall) MessageThreadID added in v0.6.0

func (call *SendVoiceCall) MessageThreadID(messageThreadID int) *SendVoiceCall

MessageThreadID Unique identifier for the target message thread (topic) of the forum; for forum supergroups only

func (*SendVoiceCall) ParseMode

func (call *SendVoiceCall) ParseMode(parseMode ParseMode) *SendVoiceCall

ParseMode Mode for parsing entities in the voice message caption. See formatting options for more details.

func (*SendVoiceCall) ProtectContent

func (call *SendVoiceCall) ProtectContent(protectContent bool) *SendVoiceCall

ProtectContent Protects the contents of the sent message from forwarding and saving

func (*SendVoiceCall) ReplyMarkup

func (call *SendVoiceCall) ReplyMarkup(replyMarkup ReplyMarkup) *SendVoiceCall

ReplyMarkup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account

func (*SendVoiceCall) ReplyParameters added in v0.12.0

func (call *SendVoiceCall) ReplyParameters(replyParameters ReplyParameters) *SendVoiceCall

ReplyParameters Description of the message to reply to

func (*SendVoiceCall) Voice

func (call *SendVoiceCall) Voice(voice FileArg) *SendVoiceCall

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 »

type SentWebAppMessage

type SentWebAppMessage struct {
	// Optional. Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message.
	InlineMessageID string `json:"inline_message_id,omitempty"`
}

SentWebAppMessage describes an inline message sent by a Web App on behalf of a user.

type SetChatAdministratorCustomTitleCall

type SetChatAdministratorCustomTitleCall struct {
	CallNoResult
}

SetChatAdministratorCustomTitleCall reprenesents a call to the setChatAdministratorCustomTitle method. Use this method to set a custom title for an administrator in a supergroup promoted by the bot

func NewSetChatAdministratorCustomTitleCall

func NewSetChatAdministratorCustomTitleCall(chatID PeerID, userID UserID, customTitle string) *SetChatAdministratorCustomTitleCall

NewSetChatAdministratorCustomTitleCall constructs a new SetChatAdministratorCustomTitleCall with required parameters. 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 Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

func (*SetChatAdministratorCustomTitleCall) CustomTitle

CustomTitle New custom title for the administrator; 0-16 characters, emoji are not allowed

func (*SetChatAdministratorCustomTitleCall) UserID added in v0.0.5

UserID Unique identifier of the target user

type SetChatDescriptionCall

type SetChatDescriptionCall struct {
	CallNoResult
}

SetChatDescriptionCall reprenesents 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

func NewSetChatDescriptionCall

func NewSetChatDescriptionCall(chatID PeerID) *SetChatDescriptionCall

NewSetChatDescriptionCall constructs a new SetChatDescriptionCall with required parameters. 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 Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*SetChatDescriptionCall) Description

func (call *SetChatDescriptionCall) Description(description string) *SetChatDescriptionCall

Description New chat description, 0-255 characters

type SetChatMenuButtonCall

type SetChatMenuButtonCall struct {
	CallNoResult
}

SetChatMenuButtonCall reprenesents 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

func NewSetChatMenuButtonCall

func NewSetChatMenuButtonCall() *SetChatMenuButtonCall

NewSetChatMenuButtonCall constructs a new SetChatMenuButtonCall with required parameters.

func (*SetChatMenuButtonCall) ChatID added in v0.0.5

func (call *SetChatMenuButtonCall) ChatID(chatID ChatID) *SetChatMenuButtonCall

ChatID Unique identifier for the target private chat. If not specified, default bot's menu button will be changed

func (*SetChatMenuButtonCall) MenuButton

func (call *SetChatMenuButtonCall) MenuButton(menuButton MenuButton) *SetChatMenuButtonCall

MenuButton A JSON-serialized object for the bot's new menu button. Defaults to MenuButtonDefault

type SetChatPermissionsCall

type SetChatPermissionsCall struct {
	CallNoResult
}

SetChatPermissionsCall reprenesents 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

func NewSetChatPermissionsCall

func NewSetChatPermissionsCall(chatID PeerID, permissions ChatPermissions) *SetChatPermissionsCall

NewSetChatPermissionsCall constructs a new SetChatPermissionsCall with required parameters. 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 Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

func (*SetChatPermissionsCall) Permissions

func (call *SetChatPermissionsCall) Permissions(permissions ChatPermissions) *SetChatPermissionsCall

Permissions A JSON-serialized object for new default chat permissions

func (*SetChatPermissionsCall) UseIndependentChatPermissions added in v0.6.0

func (call *SetChatPermissionsCall) UseIndependentChatPermissions(useIndependentChatPermissions bool) *SetChatPermissionsCall

UseIndependentChatPermissions Pass True if chat permissions are set independently. Otherwise, the can_send_other_messages and can_add_web_page_previews permissions will imply the can_send_messages, can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, and can_send_voice_notes permissions; the can_send_polls permission will imply the can_send_messages permission.

type SetChatPhotoCall

type SetChatPhotoCall struct {
	CallNoResult
}

SetChatPhotoCall reprenesents 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

func NewSetChatPhotoCall

func NewSetChatPhotoCall(chatID PeerID, photo InputFile) *SetChatPhotoCall

NewSetChatPhotoCall constructs a new SetChatPhotoCall with required parameters. 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 Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*SetChatPhotoCall) Photo

func (call *SetChatPhotoCall) Photo(photo InputFile) *SetChatPhotoCall

Photo New chat photo, uploaded using multipart/form-data

type SetChatStickerSetCall

type SetChatStickerSetCall struct {
	CallNoResult
}

SetChatStickerSetCall reprenesents 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 getChat requests to check if the bot can use this method

func NewSetChatStickerSetCall

func NewSetChatStickerSetCall(chatID PeerID, stickerSetName string) *SetChatStickerSetCall

NewSetChatStickerSetCall constructs a new SetChatStickerSetCall with required parameters. 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 Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

func (*SetChatStickerSetCall) StickerSetName

func (call *SetChatStickerSetCall) StickerSetName(stickerSetName string) *SetChatStickerSetCall

StickerSetName Name of the sticker set to be set as the group sticker set

type SetChatTitleCall

type SetChatTitleCall struct {
	CallNoResult
}

SetChatTitleCall reprenesents 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

func NewSetChatTitleCall

func NewSetChatTitleCall(chatID PeerID, title string) *SetChatTitleCall

NewSetChatTitleCall constructs a new SetChatTitleCall with required parameters. 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 Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*SetChatTitleCall) Title

func (call *SetChatTitleCall) Title(title string) *SetChatTitleCall

Title New chat title, 1-128 characters

type SetCustomEmojiStickerSetThumbnailCall added in v0.8.0

type SetCustomEmojiStickerSetThumbnailCall struct {
	CallNoResult
}

SetCustomEmojiStickerSetThumbnailCall reprenesents a call to the setCustomEmojiStickerSetThumbnail method. Use this method to set the thumbnail of a custom emoji sticker set

func NewSetCustomEmojiStickerSetThumbnailCall added in v0.8.0

func NewSetCustomEmojiStickerSetThumbnailCall(name string) *SetCustomEmojiStickerSetThumbnailCall

NewSetCustomEmojiStickerSetThumbnailCall constructs a new SetCustomEmojiStickerSetThumbnailCall with required parameters. name - Sticker set name

func (*SetCustomEmojiStickerSetThumbnailCall) CustomEmojiID added in v0.8.0

CustomEmojiID Custom emoji identifier of a sticker from the sticker set; pass an empty string to drop the thumbnail and use the first sticker as the thumbnail.

func (*SetCustomEmojiStickerSetThumbnailCall) Name added in v0.8.0

Name Sticker set name

type SetGameScoreCall

type SetGameScoreCall struct {
	Call[Message]
}

SetGameScoreCall reprenesents 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 with required parameters. userID - User identifier score - New score, must be non-negative

func (*SetGameScoreCall) ChatID added in v0.0.5

func (call *SetGameScoreCall) ChatID(chatID ChatID) *SetGameScoreCall

ChatID Required if inline_message_id is not specified. Unique identifier for the target chat

func (*SetGameScoreCall) DisableEditMessage

func (call *SetGameScoreCall) DisableEditMessage(disableEditMessage bool) *SetGameScoreCall

DisableEditMessage Pass True if the game message should not be automatically edited to include the current scoreboard

func (*SetGameScoreCall) Force

func (call *SetGameScoreCall) Force(force bool) *SetGameScoreCall

Force Pass True if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters

func (*SetGameScoreCall) InlineMessageID added in v0.0.5

func (call *SetGameScoreCall) InlineMessageID(inlineMessageID string) *SetGameScoreCall

InlineMessageID Required if chat_id and message_id are not specified. Identifier of the inline message

func (*SetGameScoreCall) MessageID added in v0.0.5

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

MessageID Required if inline_message_id is not specified. Identifier of the sent message

func (*SetGameScoreCall) Score

func (call *SetGameScoreCall) Score(score int) *SetGameScoreCall

Score New score, must be non-negative

func (*SetGameScoreCall) UserID added in v0.0.5

func (call *SetGameScoreCall) UserID(userID UserID) *SetGameScoreCall

UserID User identifier

type SetMessageReactionCall added in v0.12.0

type SetMessageReactionCall struct {
	CallNoResult
}

SetMessageReactionCall reprenesents a call to the setMessageReaction method. Use this method to change the chosen reactions on a message Service messages can't be reacted to Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel

func NewSetMessageReactionCall added in v0.12.0

func NewSetMessageReactionCall(chatID PeerID, messageID int) *SetMessageReactionCall

NewSetMessageReactionCall constructs a new SetMessageReactionCall with required parameters. 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 Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*SetMessageReactionCall) IsBig added in v0.12.0

IsBig Pass True to set the reaction with a big animation

func (*SetMessageReactionCall) MessageID added in v0.12.0

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

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) Reaction added in v0.12.0

func (call *SetMessageReactionCall) Reaction(reaction []ReactionType) *SetMessageReactionCall

Reaction A JSON-serialized list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators.

type SetMyCommandsCall

type SetMyCommandsCall struct {
	CallNoResult
}

SetMyCommandsCall reprenesents 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

func NewSetMyCommandsCall

func NewSetMyCommandsCall(commands []BotCommand) *SetMyCommandsCall

NewSetMyCommandsCall constructs a new SetMyCommandsCall with required parameters. 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 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) LanguageCode

func (call *SetMyCommandsCall) LanguageCode(languageCode string) *SetMyCommandsCall

LanguageCode A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands

func (*SetMyCommandsCall) Scope

Scope A JSON-serialized object, describing scope of users for which the commands are relevant. Defaults to BotCommandScopeDefault.

type SetMyDefaultAdministratorRightsCall

type SetMyDefaultAdministratorRightsCall struct {
	CallNoResult
}

SetMyDefaultAdministratorRightsCall reprenesents 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

func NewSetMyDefaultAdministratorRightsCall

func NewSetMyDefaultAdministratorRightsCall() *SetMyDefaultAdministratorRightsCall

NewSetMyDefaultAdministratorRightsCall constructs a new SetMyDefaultAdministratorRightsCall with required parameters.

func (*SetMyDefaultAdministratorRightsCall) ForChannels

ForChannels Pass True to change the default administrator rights of the bot in channels. Otherwise, the default administrator rights of the bot for groups and supergroups will be changed.

func (*SetMyDefaultAdministratorRightsCall) Rights

Rights A JSON-serialized object describing new default administrator rights. If not specified, the default administrator rights will be cleared.

type SetMyDescriptionCall added in v0.8.0

type SetMyDescriptionCall struct {
	CallNoResult
}

SetMyDescriptionCall reprenesents 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

func NewSetMyDescriptionCall added in v0.8.0

func NewSetMyDescriptionCall() *SetMyDescriptionCall

NewSetMyDescriptionCall constructs a new SetMyDescriptionCall with required parameters.

func (*SetMyDescriptionCall) Description added in v0.8.0

func (call *SetMyDescriptionCall) Description(description string) *SetMyDescriptionCall

Description New bot description; 0-512 characters. Pass an empty string to remove the dedicated description for the given language.

func (*SetMyDescriptionCall) LanguageCode added in v0.8.0

func (call *SetMyDescriptionCall) LanguageCode(languageCode string) *SetMyDescriptionCall

LanguageCode A two-letter ISO 639-1 language code. If empty, the description will be applied to all users for whose language there is no dedicated description.

type SetMyNameCall added in v0.9.0

type SetMyNameCall struct {
	CallNoResult
}

SetMyNameCall reprenesents a call to the setMyName method. Use this method to change the bot's name

func NewSetMyNameCall added in v0.9.0

func NewSetMyNameCall() *SetMyNameCall

NewSetMyNameCall constructs a new SetMyNameCall with required parameters.

func (*SetMyNameCall) LanguageCode added in v0.9.0

func (call *SetMyNameCall) LanguageCode(languageCode string) *SetMyNameCall

LanguageCode A two-letter ISO 639-1 language code. If empty, the name will be shown to all users for whose language there is no dedicated name.

func (*SetMyNameCall) Name added in v0.9.0

func (call *SetMyNameCall) Name(name string) *SetMyNameCall

Name New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language.

type SetMyShortDescriptionCall added in v0.8.0

type SetMyShortDescriptionCall struct {
	CallNoResult
}

SetMyShortDescriptionCall reprenesents 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

func NewSetMyShortDescriptionCall added in v0.8.0

func NewSetMyShortDescriptionCall() *SetMyShortDescriptionCall

NewSetMyShortDescriptionCall constructs a new SetMyShortDescriptionCall with required parameters.

func (*SetMyShortDescriptionCall) LanguageCode added in v0.8.0

func (call *SetMyShortDescriptionCall) LanguageCode(languageCode string) *SetMyShortDescriptionCall

LanguageCode A two-letter ISO 639-1 language code. If empty, the short description will be applied to all users for whose language there is no dedicated short description.

func (*SetMyShortDescriptionCall) ShortDescription added in v0.8.0

func (call *SetMyShortDescriptionCall) ShortDescription(shortDescription string) *SetMyShortDescriptionCall

ShortDescription New short description for the bot; 0-120 characters. Pass an empty string to remove the dedicated short description for the given language.

type SetPassportDataErrorsCall

type SetPassportDataErrorsCall struct {
	CallNoResult
}

SetPassportDataErrorsCall reprenesents 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) 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 with required parameters. userID - User identifier errors - A JSON-serialized array describing the errors

func (*SetPassportDataErrorsCall) Errors

Errors A JSON-serialized array describing the errors

func (*SetPassportDataErrorsCall) UserID added in v0.0.5

UserID User identifier

type SetStickerEmojiListCall added in v0.8.0

type SetStickerEmojiListCall struct {
	CallNoResult
}

SetStickerEmojiListCall reprenesents 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

func NewSetStickerEmojiListCall added in v0.8.0

func NewSetStickerEmojiListCall(sticker string, emojiList []string) *SetStickerEmojiListCall

NewSetStickerEmojiListCall constructs a new SetStickerEmojiListCall with required parameters. 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 A JSON-serialized list of 1-20 emoji associated with the sticker

func (*SetStickerEmojiListCall) Sticker added in v0.8.0

func (call *SetStickerEmojiListCall) Sticker(sticker string) *SetStickerEmojiListCall

Sticker File identifier of the sticker

type SetStickerKeywordsCall added in v0.8.0

type SetStickerKeywordsCall struct {
	CallNoResult
}

SetStickerKeywordsCall reprenesents 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

func NewSetStickerKeywordsCall added in v0.8.0

func NewSetStickerKeywordsCall(sticker string) *SetStickerKeywordsCall

NewSetStickerKeywordsCall constructs a new SetStickerKeywordsCall with required parameters. sticker - File identifier of the sticker

func (*SetStickerKeywordsCall) Keywords added in v0.8.0

func (call *SetStickerKeywordsCall) Keywords(keywords []string) *SetStickerKeywordsCall

Keywords A JSON-serialized list of 0-20 search keywords for the sticker with total length of up to 64 characters

func (*SetStickerKeywordsCall) Sticker added in v0.8.0

func (call *SetStickerKeywordsCall) Sticker(sticker string) *SetStickerKeywordsCall

Sticker File identifier of the sticker

type SetStickerMaskPositionCall added in v0.8.0

type SetStickerMaskPositionCall struct {
	CallNoResult
}

SetStickerMaskPositionCall reprenesents a call to the setStickerMaskPosition method. Use this method to change the mask position of a mask sticker The sticker must belong to a sticker set that was created by the bot

func NewSetStickerMaskPositionCall added in v0.8.0

func NewSetStickerMaskPositionCall(sticker string) *SetStickerMaskPositionCall

NewSetStickerMaskPositionCall constructs a new SetStickerMaskPositionCall with required parameters. sticker - File identifier of the sticker

func (*SetStickerMaskPositionCall) MaskPosition added in v0.8.0

func (call *SetStickerMaskPositionCall) MaskPosition(maskPosition MaskPosition) *SetStickerMaskPositionCall

MaskPosition A JSON-serialized object with the position where the mask should be placed on faces. Omit the parameter to remove the mask position.

func (*SetStickerMaskPositionCall) Sticker added in v0.8.0

Sticker File identifier of the sticker

type SetStickerPositionInSetCall

type SetStickerPositionInSetCall struct {
	CallNoResult
}

SetStickerPositionInSetCall reprenesents a call to the setStickerPositionInSet method. Use this method to move a sticker in a set created by the bot to a specific position

func NewSetStickerPositionInSetCall

func NewSetStickerPositionInSetCall(sticker string, position int) *SetStickerPositionInSetCall

NewSetStickerPositionInSetCall constructs a new SetStickerPositionInSetCall with required parameters. sticker - File identifier of the sticker position - New sticker position in the set, zero-based

func (*SetStickerPositionInSetCall) Position

Position New sticker position in the set, zero-based

func (*SetStickerPositionInSetCall) Sticker

Sticker File identifier of the sticker

type SetStickerSetThumbnailCall added in v0.8.0

type SetStickerSetThumbnailCall struct {
	CallNoResult
}

SetStickerSetThumbnailCall reprenesents 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

func NewSetStickerSetThumbnailCall added in v0.8.0

func NewSetStickerSetThumbnailCall(name string, userID UserID, format string) *SetStickerSetThumbnailCall

NewSetStickerSetThumbnailCall constructs a new SetStickerSetThumbnailCall with required parameters. 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 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) Name added in v0.8.0

Name Sticker set name

func (*SetStickerSetThumbnailCall) Thumbnail added in v0.8.0

Thumbnail A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size (see https://core.telegram.org/stickers#animated-sticker-requirements for animated sticker technical requirements), or a WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-sticker-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files ». Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.

func (*SetStickerSetThumbnailCall) UserID added in v0.8.0

UserID User identifier of the sticker set owner

type SetStickerSetTitleCall added in v0.8.0

type SetStickerSetTitleCall struct {
	CallNoResult
}

SetStickerSetTitleCall reprenesents a call to the setStickerSetTitle method. Use this method to set the title of a created sticker set

func NewSetStickerSetTitleCall added in v0.8.0

func NewSetStickerSetTitleCall(name string, title string) *SetStickerSetTitleCall

NewSetStickerSetTitleCall constructs a new SetStickerSetTitleCall with required parameters. name - Sticker set name title - Sticker set title, 1-64 characters

func (*SetStickerSetTitleCall) Name added in v0.8.0

Name Sticker set name

func (*SetStickerSetTitleCall) Title added in v0.8.0

Title Sticker set title, 1-64 characters

type SetWebhookCall

type SetWebhookCall struct {
	CallNoResult
}

SetWebhookCall reprenesents 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, we will give up after a reasonable amount of attempts 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.

func NewSetWebhookCall

func NewSetWebhookCall(url string) *SetWebhookCall

NewSetWebhookCall constructs a new SetWebhookCall with required parameters. 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 A JSON-serialized list of the update types you want your bot to receive. For example, specify ["message", "edited_channel_post", "callback_query"] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member, message_reaction, and message_reaction_count (default). If not specified, the previous setting will be used.Please note that this parameter doesn't affect updates created before the call to the setWebhook, so unwanted updates may be received for a short period of time.

func (*SetWebhookCall) Certificate

func (call *SetWebhookCall) Certificate(certificate InputFile) *SetWebhookCall

Certificate Upload your public key certificate so that the root certificate in use can be checked. See our self-signed guide for details.

func (*SetWebhookCall) DropPendingUpdates

func (call *SetWebhookCall) DropPendingUpdates(dropPendingUpdates bool) *SetWebhookCall

DropPendingUpdates Pass True to drop all pending updates

func (*SetWebhookCall) IPAddress added in v0.0.5

func (call *SetWebhookCall) IPAddress(ipAddress string) *SetWebhookCall

IPAddress The fixed IP address which will be used to send webhook requests instead of the IP address resolved through DNS

func (*SetWebhookCall) MaxConnections

func (call *SetWebhookCall) MaxConnections(maxConnections int) *SetWebhookCall

MaxConnections The maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100. Defaults to 40. Use lower values to limit the load on your bot's server, and higher values to increase your bot's throughput.

func (*SetWebhookCall) SecretToken

func (call *SetWebhookCall) SecretToken(secretToken string) *SetWebhookCall

SecretToken A secret token to be sent in a header “X-Telegram-Bot-Api-Secret-Token” in every webhook request, 1-256 characters. Only characters A-Z, a-z, 0-9, _ and - are allowed. The header is useful to ensure that the request comes from a webhook set by you.

func (*SetWebhookCall) URL added in v0.0.5

func (call *SetWebhookCall) URL(url string) *SetWebhookCall

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

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 int `json:"user_id"`

	// Optional. First name of the user, if the name was requested by the bot
	FirstName string `json:"first_name,omitempty"`

	// Optional. Last name of the user, if the name was requested by the bot
	LastName string `json:"last_name,omitempty"`

	// Optional. Username of the user, if the username was requested by the bot
	Username string `json:"username,omitempty"`

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

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

type ShippingAddress

type ShippingAddress struct {
	// Two-letter ISO 3166-1 alpha-2 country code
	CountryCode string `json:"country_code"`

	// State, if applicable
	State string `json:"state"`

	// City
	City string `json:"city"`

	// First line for the address
	StreetLine1 string `json:"street_line1"`

	// Second line for the address
	StreetLine2 string `json:"street_line2"`

	// Address post code
	PostCode string `json:"post_code"`
}

ShippingAddress 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 Sticker

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

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

	// Type of the sticker, currently one of “regular”, “mask”, “custom_emoji”. The type of the sticker is independent from its format, which is determined by the fields is_animated and is_video.
	Type StickerType `json:"type"`

	// Sticker width
	Width int `json:"width"`

	// Sticker height
	Height int `json:"height"`

	// True, if the sticker is animated
	IsAnimated bool `json:"is_animated"`

	// True, if the sticker is a video sticker
	IsVideo bool `json:"is_video"`

	// Optional. Sticker thumbnail in the .WEBP or .JPG format
	Thumbnail *PhotoSize `json:"thumbnail,omitempty"`

	// Optional. Emoji associated with the sticker
	Emoji string `json:"emoji,omitempty"`

	// Optional. Name of the sticker set to which the sticker belongs
	SetName string `json:"set_name,omitempty"`

	// Optional. For premium regular stickers, premium animation for the sticker
	PremiumAnimation *File `json:"premium_animation,omitempty"`

	// Optional. For mask stickers, the position where the mask should be placed
	MaskPosition *MaskPosition `json:"mask_position,omitempty"`

	// Optional. For custom emoji stickers, unique identifier of the custom emoji
	CustomEmojiID string `json:"custom_emoji_id,omitempty"`

	// Optional. True, if the sticker must be repainted to a text color in messages, the color of the Telegram Premium badge in emoji status, white color on chat photos, or another appropriate color in other places
	NeedsRepainting bool `json:"needs_repainting,omitempty"`

	// Optional. File size in bytes
	FileSize int `json:"file_size,omitempty"`
}

Sticker this object represents a sticker.

type StickerSet

type StickerSet struct {
	// Sticker set name
	Name string `json:"name"`

	// Sticker set title
	Title string `json:"title"`

	// Type of stickers in the set, currently one of “regular”, “mask”, “custom_emoji”
	StickerType 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 int

StickerType it's type for describe content of Sticker.

const (
	StickerTypeUnknown StickerType = iota
	StickerTypeRegular
	StickerTypeMask
	StickerTypeCustomEmoji
)

func (StickerType) MarshalText added in v0.5.0

func (sticker StickerType) MarshalText() ([]byte, error)

func (StickerType) String added in v0.5.0

func (sticker StickerType) String() string

func (*StickerType) UnmarshalText added in v0.5.0

func (sticker *StickerType) UnmarshalText(v []byte) error

type StopMessageLiveLocationCall

type StopMessageLiveLocationCall struct {
	Call[Message]
}

StopMessageLiveLocationCall reprenesents 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 with required parameters. 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

NewStopMessageLiveLocationCall constructs a new StopMessageLiveLocationCall with required parameters. inlineMessageID - Required if chat_id and message_id are not specified. Identifier of the inline message

func (*StopMessageLiveLocationCall) ChatID added in v0.0.5

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)

func (*StopMessageLiveLocationCall) InlineMessageID added in v0.0.5

func (call *StopMessageLiveLocationCall) InlineMessageID(inlineMessageID string) *StopMessageLiveLocationCall

InlineMessageID Required if chat_id and message_id are not specified. Identifier of the inline message

func (*StopMessageLiveLocationCall) MessageID added in v0.0.5

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

MessageID Required if inline_message_id is not specified. Identifier of the message with live location to stop

func (*StopMessageLiveLocationCall) ReplyMarkup

ReplyMarkup A JSON-serialized object for a new inline keyboard.

type StopPollCall

type StopPollCall struct {
	Call[Poll]
}

StopPollCall reprenesents 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 with required parameters. 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) ChatID added in v0.0.5

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

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

func (*StopPollCall) MessageID added in v0.0.5

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

MessageID Identifier of the original message with the poll

func (*StopPollCall) ReplyMarkup

func (call *StopPollCall) ReplyMarkup(replyMarkup InlineKeyboardMarkup) *StopPollCall

ReplyMarkup A JSON-serialized object for a new message inline keyboard.

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 SuccessfulPayment

type SuccessfulPayment struct {
	// Three-letter ISO 4217 currency code
	Currency string `json:"currency"`

	// Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
	TotalAmount 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"`

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

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 UnbanChatMemberCall

type UnbanChatMemberCall struct {
	CallNoResult
}

UnbanChatMemberCall reprenesents 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

func NewUnbanChatMemberCall

func NewUnbanChatMemberCall(chatID PeerID, userID UserID) *UnbanChatMemberCall

NewUnbanChatMemberCall constructs a new UnbanChatMemberCall with required parameters. 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 Unique identifier for the target group or username of the target supergroup or channel (in the format @channelusername)

func (*UnbanChatMemberCall) OnlyIfBanned

func (call *UnbanChatMemberCall) OnlyIfBanned(onlyIfBanned bool) *UnbanChatMemberCall

OnlyIfBanned Do nothing if the user is not banned

func (*UnbanChatMemberCall) UserID added in v0.0.5

func (call *UnbanChatMemberCall) UserID(userID UserID) *UnbanChatMemberCall

UserID Unique identifier of the target user

type UnbanChatSenderChatCall

type UnbanChatSenderChatCall struct {
	CallNoResult
}

UnbanChatSenderChatCall reprenesents 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

func NewUnbanChatSenderChatCall

func NewUnbanChatSenderChatCall(chatID PeerID, senderChatID int) *UnbanChatSenderChatCall

NewUnbanChatSenderChatCall constructs a new UnbanChatSenderChatCall with required parameters. 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 Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*UnbanChatSenderChatCall) SenderChatID added in v0.0.5

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

SenderChatID Unique identifier of the target sender chat

type UnhideGeneralForumTopicCall added in v0.6.0

type UnhideGeneralForumTopicCall struct {
	CallNoResult
}

UnhideGeneralForumTopicCall reprenesents 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

func NewUnhideGeneralForumTopicCall added in v0.6.0

func NewUnhideGeneralForumTopicCall(chatID PeerID) *UnhideGeneralForumTopicCall

NewUnhideGeneralForumTopicCall constructs a new UnhideGeneralForumTopicCall with required parameters. 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 Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

type UnpinAllChatMessagesCall

type UnpinAllChatMessagesCall struct {
	CallNoResult
}

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

func NewUnpinAllChatMessagesCall

func NewUnpinAllChatMessagesCall(chatID PeerID) *UnpinAllChatMessagesCall

NewUnpinAllChatMessagesCall constructs a new UnpinAllChatMessagesCall with required parameters. 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 Unique identifier for the target chat or username of the target channel (in the format @channelusername)

type UnpinAllForumTopicMessagesCall added in v0.6.0

type UnpinAllForumTopicMessagesCall struct {
	CallNoResult
}

UnpinAllForumTopicMessagesCall reprenesents a call to the unpinAllForumTopicMessages method. Use this method to clear the list of pinned messages in a forum topic The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup

func NewUnpinAllForumTopicMessagesCall added in v0.6.0

func NewUnpinAllForumTopicMessagesCall(chatID PeerID, messageThreadID int) *UnpinAllForumTopicMessagesCall

NewUnpinAllForumTopicMessagesCall constructs a new UnpinAllForumTopicMessagesCall with required parameters. 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 Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

func (*UnpinAllForumTopicMessagesCall) MessageThreadID added in v0.6.0

func (call *UnpinAllForumTopicMessagesCall) MessageThreadID(messageThreadID int) *UnpinAllForumTopicMessagesCall

MessageThreadID Unique identifier for the target message thread of the forum topic

type UnpinAllGeneralForumTopicMessagesCall added in v0.10.0

type UnpinAllGeneralForumTopicMessagesCall struct {
	CallNoResult
}

UnpinAllGeneralForumTopicMessagesCall reprenesents 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

func NewUnpinAllGeneralForumTopicMessagesCall added in v0.10.0

func NewUnpinAllGeneralForumTopicMessagesCall(chatID PeerID) *UnpinAllGeneralForumTopicMessagesCall

NewUnpinAllGeneralForumTopicMessagesCall constructs a new UnpinAllGeneralForumTopicMessagesCall with required parameters. 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 Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)

type UnpinChatMessageCall

type UnpinChatMessageCall struct {
	CallNoResult
}

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

func NewUnpinChatMessageCall

func NewUnpinChatMessageCall(chatID PeerID) *UnpinChatMessageCall

NewUnpinChatMessageCall constructs a new UnpinChatMessageCall with required parameters. chatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)

func (*UnpinChatMessageCall) ChatID added in v0.0.5

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

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

func (*UnpinChatMessageCall) MessageID added in v0.0.5

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

MessageID Identifier of a message to unpin. If not specified, the most recent pinned message (by sending date) will be unpinned.

type Update

type Update struct {
	// The update's unique identifier. Update identifiers start from a certain positive number and increase sequentially. This identifier becomes especially handy if you're using webhooks, since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order. If there are no new updates for at least a week, then identifier of the next update will be chosen randomly instead of sequentially.
	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 non-service message from a connected business account
	BusinessMessage *Message `json:"business_message,omitempty"`

	// Optional. New version of a message from a connected business account
	EditedBusinessMessage *Message `json:"edited_business_message,omitempty"`

	// Optional. Messages were deleted from a connected business account
	DeletedBusinessMessages *BusinessMessagesDeleted `json:"deleted_business_messages,omitempty"`

	// Optional. A reaction to a message was changed by a user. The bot must be an administrator in the chat and must explicitly specify "message_reaction" in the list of allowed_updates to receive these updates. The update isn't received for reactions set by bots.
	MessageReaction *MessageReactionUpdated `json:"message_reaction,omitempty"`

	// Optional. Reactions to a message with anonymous reactions were changed. The bot must be an administrator in the chat and must explicitly specify "message_reaction_count" in the list of allowed_updates to receive these updates. The updates are grouped and can be sent with delay up to a few minutes.
	MessageReactionCount *MessageReactionCountUpdated `json:"message_reaction_count,omitempty"`

	// Optional. New incoming inline query
	InlineQuery *InlineQuery `json:"inline_query,omitempty"`

	// Optional. The result of an inline query that was chosen by a user and sent to their chat partner. Please see our documentation on the feedback collecting for details on how to enable these updates for your bot.
	ChosenInlineResult *ChosenInlineResult `json:"chosen_inline_result,omitempty"`

	// Optional. New incoming callback query
	CallbackQuery *CallbackQuery `json:"callback_query,omitempty"`

	// Optional. New incoming shipping query. Only for invoices with flexible price
	ShippingQuery *ShippingQuery `json:"shipping_query,omitempty"`

	// Optional. New incoming pre-checkout query. Contains full information about checkout
	PreCheckoutQuery *PreCheckoutQuery `json:"pre_checkout_query,omitempty"`

	// Optional. New poll state. Bots receive only updates about manually stopped polls and polls, which are sent by the bot
	Poll *Poll `json:"poll,omitempty"`

	// Optional. A user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself.
	PollAnswer *PollAnswer `json:"poll_answer,omitempty"`

	// Optional. The bot's chat member status was updated in a chat. For private chats, this update is received only when the bot is blocked or unblocked by the user.
	MyChatMember *ChatMemberUpdated `json:"my_chat_member,omitempty"`

	// Optional. A chat member's status was updated in a chat. The bot must be an administrator in the chat and must explicitly specify "chat_member" in the list of allowed_updates to receive these updates.
	ChatMember *ChatMemberUpdated `json:"chat_member,omitempty"`

	// Optional. A request to join the chat has been sent. The bot must have the can_invite_users administrator right in the chat to receive these updates.
	ChatJoinRequest *ChatJoinRequest `json:"chat_join_request,omitempty"`

	// Optional. A chat boost was added or changed. The bot must be an administrator in the chat to receive these updates.
	ChatBoost *ChatBoostUpdated `json:"chat_boost,omitempty"`

	// Optional. A boost was removed from a chat. The bot must be an administrator in the chat to receive these updates.
	RemovedChatBoost *ChatBoostRemoved `json:"removed_chat_boost,omitempty"`
}

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

func (*Update) Chat added in v0.3.0

func (update *Update) Chat() *Chat

Chat returns chat from whever possible.

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) Type added in v0.1.1

func (update *Update) Type() UpdateType

type UpdateType added in v0.1.1

type UpdateType int

UpdateType it's type for describe content of Update.

const (
	UpdateTypeUnknown UpdateType = iota
	UpdateTypeMessage
	UpdateTypeEditedMessage
	UpdateTypeChannelPost
	UpdateTypeEditedChannelPost
	UpdateTypeInlineQuery
	UpdateTypeChosenInlineResult
	UpdateTypeCallbackQuery
	UpdateTypeShippingQuery
	UpdateTypePreCheckoutQuery
	UpdateTypePoll
	UpdateTypePollAnswer
	UpdateTypeMyChatMember
	UpdateTypeChatMember
	UpdateTypeChatJoinRequest
	UpdateTypeMessageReaction
	UpdateTypeMessageReactionCount
	UpdateTypeChatBoost
	UpdateTypeRemovedChatBoost
	UpdateTypeBusinessConnection
	UpdateTypeBusinessMessage
	UpdateTypeEditedBusinessMessage
	UpdateTypeDeletedBusinessMessages
)

func (UpdateType) MarshalText added in v0.1.1

func (typ UpdateType) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (UpdateType) String added in v0.1.1

func (typ UpdateType) String() string

String returns string representation of UpdateType.

func (*UpdateType) UnmarshalText added in v0.1.1

func (typ *UpdateType) UnmarshalText(v []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type UploadStickerFileCall

type UploadStickerFileCall struct {
	Call[File]
}

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

func NewUploadStickerFileCall

func NewUploadStickerFileCall(userID UserID, sticker InputFile, stickerFormat string) *UploadStickerFileCall

NewUploadStickerFileCall constructs a new UploadStickerFileCall with required parameters. userID - User identifier of sticker file owner sticker - A file with the sticker in .WEBP, .PNG, .TGS, or .WEBM format. See https://core.telegram.org/stickers for technical requirements. More information on Sending Files » stickerFormat - Format of the sticker, must be one of “static”, “animated”, “video”

func (*UploadStickerFileCall) Sticker added in v0.8.0

func (call *UploadStickerFileCall) Sticker(sticker InputFile) *UploadStickerFileCall

Sticker A file with the sticker in .WEBP, .PNG, .TGS, or .WEBM format. See https://core.telegram.org/stickers for technical requirements. More information on Sending Files »

func (*UploadStickerFileCall) StickerFormat added in v0.8.0

func (call *UploadStickerFileCall) StickerFormat(stickerFormat string) *UploadStickerFileCall

StickerFormat Format of the sticker, must be one of “static”, “animated”, “video”

func (*UploadStickerFileCall) UserID added in v0.0.5

func (call *UploadStickerFileCall) UserID(userID UserID) *UploadStickerFileCall

UserID User identifier of sticker file owner

type User

type User struct {
	// Unique identifier for this user or bot.
	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
	LanguageCode string `json:"language_code,omitempty"`

	// Optional. True, if this user is a Telegram Premium user
	IsPremium bool `json:"is_premium,omitempty"`

	// Optional. True, if this user added the bot to the attachment menu
	AddedToAttachmentMenu bool `json:"added_to_attachment_menu,omitempty"`

	// Optional. True, if the bot can be invited to groups. Returned only in getMe.
	CanJoinGroups bool `json:"can_join_groups,omitempty"`

	// Optional. True, if privacy mode is disabled for the bot. Returned only in getMe.
	CanReadAllGroupMessages bool `json:"can_read_all_group_messages,omitempty"`

	// Optional. True, if the bot supports inline queries. Returned only in getMe.
	SupportsInlineQueries bool `json:"supports_inline_queries,omitempty"`

	// Optional. True, if the bot can be connected to a Telegram Business account to receive its messages. Returned only in getMe.
	CanConnectToBusiness bool `json:"can_connect_to_business,omitempty"`
}

User this object represents a Telegram user or bot.

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 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 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.)
	GooglePlaceType string `json:"google_place_type,omitempty"`
}

Venue this object represents a venue.

type Video

type Video struct {
	// Identifier for this file, which can be used to download or reuse the file
	FileID 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 sender
	Width int `json:"width"`

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

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

	// Optional. Video thumbnail
	Thumbnail *PhotoSize `json:"thumbnail,omitempty"`

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

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

	// Optional. File size in bytes.
	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 int64 `json:"start_date"`
}

VideoChatScheduled this object represents a service message about a video chat scheduled in the chat.

func (*VideoChatScheduled) StartDateTime added in v0.15.0

func (s *VideoChatScheduled) StartDateTime() time.Time

StartDateTime returns time.Time representation of StartDate field.

type VideoChatStarted

type VideoChatStarted struct{}

VideoChatStarted 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 sender
	Length int `json:"length"`

	// Duration of the video in seconds as defined by 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 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 sender
	Duration int `json:"duration"`

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

	// Optional. File size in bytes.
	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, can be either “group”, “supergroup” or “channel”
	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. The photo can be in .jpeg or .svg formats. Only returned for Mini Apps launched from the attachment menu.
	PhotoURL string `json:"photo_url,omitempty"`
}

WebAppChat this object represents a chat.

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
	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. Returned only for private chats and only for Mini Apps 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. Returned for supergroups, channels and group chats – only for Mini Apps launched via the attachment menu.
	Chat *WebAppChat `json:"chat,omitempty"`

	// Optional. Type of the chat from which the Mini App was opened. Can be either “sender” for a private chat with the user opening the link, “private”, “group”, “supergroup”, or “channel”. Returned only for Mini Apps launched from direct links.
	ChatType string `json:"chat_type,omitempty"`

	// Optional. Global identifier, uniquely corresponding to the chat from which the Mini App was opened. Returned only for Mini Apps launched from a direct link.
	ChatInstance string `json:"chat_instance,omitempty"`

	// Optional. The value of the startattach parameter, passed via link. Only returned for Mini Apps when launched from the attachment menu via link.The value of the start_param parameter will also be passed in the GET-parameter tgWebAppStartParam, so the Mini App can load the correct interface right away.
	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 int64 `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 this object contains data that is transferred to the Mini App when it is opened. It is empty if the Mini App was launched from a keyboard button or from inline mode.

func ParseWebAppInitData added in v0.0.5

func ParseWebAppInitData(vs url.Values) (*WebAppInitData, error)

ParseWebAppInitData parses a WebAppInitData from query string.

func (*WebAppInitData) AuthDateTime added in v0.15.0

func (s *WebAppInitData) AuthDateTime() time.Time

AuthDateTime returns time.Time representation of AuthDate field.

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 {
	// A unique identifier for the user or bot. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. It has at most 52 significant bits, so a 64-bit integer or a double-precision float type is safe for storing this identifier.
	ID UserID `json:"id"`

	// Optional. True, if this user is a bot. Returns in the receiver field only.
	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. Returns in user field only.
	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. The photo can be in .jpeg or .svg formats. Only returned for Mini Apps launched from the attachment menu.
	PhotoURL string `json:"photo_url,omitempty"`
}

WebAppUser this object contains the data of the Mini App user.

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 int64 `json:"last_error_date,omitempty"`

	// Optional. Error message in human-readable format for the most recent error that happened when trying to deliver an update via webhook
	LastErrorMessage string `json:"last_error_message,omitempty"`

	// Optional. Unix time of the most recent error that happened when trying to synchronize available updates with Telegram datacenters
	LastSynchronizationErrorDate int64 `json:"last_synchronization_error_date,omitempty"`

	// Optional. The maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery
	MaxConnections 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.

func (*WebhookInfo) LastErrorDateTime added in v0.15.0

func (s *WebhookInfo) LastErrorDateTime() time.Time

LastErrorDateTime returns time.Time representation of LastErrorDate field.

func (*WebhookInfo) LastSynchronizationErrorDateTime added in v0.15.0

func (s *WebhookInfo) LastSynchronizationErrorDateTime() time.Time

LastSynchronizationErrorDateTime returns time.Time representation of LastSynchronizationErrorDate field.

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
	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
Packages examples contains usage examples of go-tg.
Packages examples contains usage examples of go-tg.
business-bot
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
Package contains example of using tgb.ChatType filter.
Package contains example of using tgb.ChatType filter.
chat-type-filter
Package contains example of using tgb.ChatType filter.
Package contains example of using tgb.ChatType filter.
echo-bot
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.
media-group
Package contains example of using tgb.ChatType filter.
Package contains example of using tgb.ChatType filter.
menu
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.
quote-bot
Package contains example of using tgb.ChatType filter.
Package contains example of using tgb.ChatType filter.
session-filter
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.
webapps
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 managment.
Package session provides a session managment.

Jump to

Keyboard shortcuts

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