bot

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTokenNotFound = errors.New("token not found")
)

Functions

func NotFound

func NotFound(w ResponseWriter, r *Request)

Types

type DecodeRequestFunc

type DecodeRequestFunc func(context.Context, *Request) (request interface{}, err error)

type EncodeRequestFunc

type EncodeRequestFunc func(context.Context, *Request, interface{}) error

type EncodeResponseFunc

type EncodeResponseFunc func(context.Context, ResponseWriter, interface{}) error

type Handler

type Handler interface {
	Serve(ResponseWriter, *Request)
}

func NotFoundHandler

func NotFoundHandler() Handler

type HandlerFunc

type HandlerFunc func(ResponseWriter, *Request)

func (HandlerFunc) Serve

func (f HandlerFunc) Serve(w ResponseWriter, r *Request)

type Listener

type Listener interface {
	Listen(handler Handler) error
	Close()
}

func Listen

func Listen(token string) (Listener, error)

type Request

type Request struct {
	tgbotapi.Update
	// contains filtered or unexported fields
}

func (*Request) Context

func (r *Request) Context() context.Context

type ResponseWriter

type ResponseWriter struct {
	*tgbotapi.MessageConfig
}

func (ResponseWriter) Write

func (w ResponseWriter) Write(b []byte)

type Server

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

func NewServer

func NewServer(
	e endpoint.Endpoint,
	dec DecodeRequestFunc,
	enc EncodeResponseFunc,
	logger log.Logger,
) *Server

func (Server) Serve

func (s Server) Serve(w ResponseWriter, r *Request)

type ServerMux

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

func NewServeMux

func NewServeMux() *ServerMux

func (*ServerMux) Handle

func (mux *ServerMux) Handle(command string, handler Handler)

func (*ServerMux) HandleFunc

func (mux *ServerMux) HandleFunc(command string, handler func(ResponseWriter, *Request))

func (*ServerMux) Handler

func (mux *ServerMux) Handler(r *Request) Handler

func (*ServerMux) Serve

func (mux *ServerMux) Serve(w ResponseWriter, r *Request)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL