Documentation ¶
Index ¶
- Variables
- func ChatID(upd *telegram.Update) types.ChatID
- func NewCallbackFilterFromSpec(s *spec.CallbackTrigger) (types.EventFilter, error)
- func NewContextFilter(base types.EventFilter, cp types.ContextProvider, val string) types.EventFilter
- func NewMessageFilterFromSpec(s *spec.MessageTrigger) (types.EventFilter, error)
- type CallbackFilter
- type CallbackReply
- type Check
- type ContextFilter
- type DeleteContextHandler
- type InlineButton
- type InlineKeyboard
- type InvoiceConfig
- type InvoicePrice
- type MessageDelete
- type MessageEdit
- type MessageFilter
- type MessageModifier
- type MessageReply
- type PreCheckout
- type ReplyDocument
- type ReplyImage
- type SendInvoice
- type SetContextHandler
- type StateHandler
- type Template
- type Templater
- type Validator
- type Webhook
- type WebhookPayload
Constants ¶
This section is empty.
Variables ¶
var ErrNoCallbackMessage = errors.New("callback data doesn't have message id")
var ErrPrecheckoutQueryEmpty = errors.New("precheckout query is empty")
var ErrUpdateNotSupported = errors.New("update is not valid for this handler")
var ErrValidationFailed = fmt.Errorf("validation failed")
Functions ¶
func NewCallbackFilterFromSpec ¶
func NewCallbackFilterFromSpec(s *spec.CallbackTrigger) (types.EventFilter, error)
func NewContextFilter ¶
func NewContextFilter(base types.EventFilter, cp types.ContextProvider, val string) types.EventFilter
func NewMessageFilterFromSpec ¶
func NewMessageFilterFromSpec(s *spec.MessageTrigger) (types.EventFilter, error)
Types ¶
type CallbackFilter ¶
type CallbackFilter struct {
// contains filtered or unexported fields
}
CallbackFilter check update callback data.
type CallbackReply ¶
type CallbackReply struct {
// contains filtered or unexported fields
}
CallbackReply send callback message reply.
func NewCallbackReply ¶
func NewCallbackReply(sp types.StateProvider, secrets types.Secrets, text string, alert bool) *CallbackReply
NewCallbackReply creates new callback reply handler.
type Check ¶ added in v1.10.0
type Check string
Check is a type for message validator checks.
func ParseCheckString ¶ added in v1.10.0
type ContextFilter ¶
type ContextFilter struct {
// contains filtered or unexported fields
}
type DeleteContextHandler ¶
type DeleteContextHandler struct {
// contains filtered or unexported fields
}
func NewContextDeleter ¶
func NewContextDeleter(cp types.ContextProvider, val string, log zerolog.Logger) *DeleteContextHandler
type InlineButton ¶
type InlineKeyboard ¶ added in v1.1.0
type InlineKeyboard [][]InlineButton
type InvoiceConfig ¶ added in v1.2.0
type InvoiceConfig struct { Title string Description string Payload string Currency string Prices []InvoicePrice }
type InvoicePrice ¶ added in v1.2.0
type MessageDelete ¶ added in v1.1.0
type MessageDelete struct {
// contains filtered or unexported fields
}
func NewMessageDelete ¶ added in v1.1.0
func NewMessageDelete(logger zerolog.Logger) *MessageDelete
type MessageEdit ¶ added in v1.1.0
type MessageEdit struct {
// contains filtered or unexported fields
}
func NewMessageEdit ¶ added in v1.1.0
func NewMessageEdit(caption string, template Template, keyboard InlineKeyboard, sp types.StateProvider, secrets types.Secrets, logger zerolog.Logger, ) *MessageEdit
type MessageFilter ¶
type MessageFilter struct {
// contains filtered or unexported fields
}
MessageFilter checks update by message criteria.
type MessageModifier ¶
type MessageModifier func(*telegram.MessageConfig)
MessageModifier apply custom modifications to telegram message reply.
func MessageWithInlineKeyboard ¶ added in v1.1.0
func MessageWithInlineKeyboard(keyboard InlineKeyboard) MessageModifier
MessageWithInlineKeyboard creates new message modifier to add custom inline keyboard to message.
func MessageWithKeyboard ¶
func MessageWithKeyboard(keyboard [][]string) MessageModifier
MessageWithKeyboard creates new message modifier to add custom keyboard to message.
func MessageWithParseMode ¶
func MessageWithParseMode(mode string) MessageModifier
MessageWithParseMode creates new message modifier to set custom parse mode for message.
type MessageReply ¶
type MessageReply struct {
// contains filtered or unexported fields
}
MessageReply handler processes telegram updates and reply message to them.
func NewMessageReply ¶
func NewMessageReply( bot *telegram.BotAPI, sp types.StateProvider, secrets types.Secrets, template Template, logger zerolog.Logger, modifiers ...MessageModifier, ) *MessageReply
NewMessageReply from repliers funcs.
type PreCheckout ¶ added in v1.2.0
type PreCheckout struct {
// contains filtered or unexported fields
}
func NewPreCheckout ¶ added in v1.2.0
func NewPreCheckout(ok bool, err string, logger zerolog.Logger) *PreCheckout
type ReplyDocument ¶ added in v1.3.0
type ReplyDocument struct {
// contains filtered or unexported fields
}
ReplyDocument sends document file to chat.
func NewReplyDocument ¶ added in v1.3.0
func NewReplyDocument(key, name string, assets types.Assets, logger zerolog.Logger, ) *ReplyDocument
NewReplyDocument creates new ReplyDocument handler using file by key.
type ReplyImage ¶ added in v1.1.0
type ReplyImage struct {
// contains filtered or unexported fields
}
ReplyImage sends image to chat.
func NewReplyImageFile ¶ added in v1.1.0
NewReplyImageFile creates new ReplyImage handler using image from key.
type SendInvoice ¶ added in v1.2.0
type SendInvoice struct {
// contains filtered or unexported fields
}
func NewSendInvoice ¶ added in v1.2.0
func NewSendInvoice(providers types.PaymentProviders, sp types.StateProvider, secrets types.Secrets, providerName string, config InvoiceConfig, logger zerolog.Logger, ) *SendInvoice
type SetContextHandler ¶
type SetContextHandler struct {
// contains filtered or unexported fields
}
func NewContextSetter ¶
func NewContextSetter(cp types.ContextProvider, value string, log zerolog.Logger) *SetContextHandler
type StateHandler ¶
type StateHandler struct {
// contains filtered or unexported fields
}
func NewStateHandlerFromSpec ¶
func NewStateHandlerFromSpec(provider types.StateProvider, s *spec.State, log zerolog.Logger) *StateHandler
type Template ¶ added in v1.6.0
func NewDefaultTemplate ¶ added in v1.6.0
func NewGoTemplate ¶ added in v1.6.0
func NewNoTemplate ¶ added in v1.6.0
type Validator ¶ added in v1.10.0
type Validator struct {
// contains filtered or unexported fields
}
Validator is a struct for message validation.
func NewValidator ¶ added in v1.10.0
NewValidator is a constructor for Validator. It accepts a list of checks to perform and an error message to send if validation fails.
type Webhook ¶
type Webhook struct {
// contains filtered or unexported fields
}
Webhook handler sends HTTP request to the specified URL.