Documentation ¶
Overview ¶
Package botx provides interfaces and types to handle bot updates, with a chi-like router.
Index ¶
- type API
- type Bot
- type Chat
- type Handler
- type Middleware
- type Option
- type Options
- type Request
- type Response
- type Router
- func (r *Router) Add(prefix string, h Handler)
- func (r *Router) Clone() *Router
- func (r *Router) Group(f func(rtr *Router))
- func (r *Router) Handle(ctx context.Context, req Request) ([]Response, error)
- func (r *Router) NotFound(h Handler)
- func (r *Router) Use(mvs ...Middleware) *Router
- func (r *Router) With(mvs ...Middleware) *Router
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API interface { Updates() <-chan Request SendMessage(ctx context.Context, resp Response) error }
API defines methods for an API interface to receive and send chat messages.
type Bot ¶
type Bot struct { Options // contains filtered or unexported fields }
Bot defines parameters for running a bot over some API.
type Middleware ¶
Middleware specifies a basic middleware for bot handler.
type Option ¶
type Option func(*Options)
Option defines a function that configures Bot.
func WithWorkers ¶
WithWorkers sets the number of workers to run.
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router returns a multiplexer for handlers.
func (*Router) Use ¶
func (r *Router) Use(mvs ...Middleware) *Router
Use applies middleware to all handlers.
func (*Router) With ¶
func (r *Router) With(mvs ...Middleware) *Router
With returns a new router with middleware applied.
Click to show internal directories.
Click to hide internal directories.