Documentation
¶
Overview ¶
Package webhook provides an implementation of UpdateSource using Telegram webhooks.
Index ¶
Constants ¶
View Source
const (
// HeaderTelegramBotAPISecretToken is the header used by Telegram to send the secret token.
HeaderTelegramBotAPISecretToken = "X-Telegram-Bot-Api-Secret-Token"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OptOptionsSetter ¶
type OptOptionsSetter func(o *Options)
func WithBufferSize ¶
func WithBufferSize(opt int) OptOptionsSetter
func WithClient ¶
func WithClient(opt client.ClientWithResponsesInterface) OptOptionsSetter
func WithToken ¶
func WithToken(opt string) OptOptionsSetter
func WithUrl ¶
func WithUrl(opt string) OptOptionsSetter
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options is the options for the Webhook handler.
func NewOptions ¶
func NewOptions( options ...OptOptionsSetter, ) Options
type Webhook ¶
type Webhook struct {
// contains filtered or unexported fields
}
Webhook implements http.Handler to receive incoming updates via an outgoing webhook.
func (*Webhook) ServeHTTP ¶
func (h *Webhook) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler interface. It validates the request, decodes the update, and sends it to the updates channel.
func (*Webhook) SetWebhook ¶
SetWebhook sets the outgoing webhook for the bot.
func (*Webhook) Start ¶
Start satisfies the lifecycle.Lifecycle interface. The context is used only for the startup timeout.
func (*Webhook) Stop ¶
Stop satisfies the lifecycle.Lifecycle interface. The context is used only for the shutdown timeout.
func (*Webhook) UpdateChan ¶
UpdateChan returns the updates channel.
Click to show internal directories.
Click to hide internal directories.