routers

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: MIT Imports: 1 Imported by: 0

README

TGO Routers

ToDo:

write a nice documentation about what they are, how they works, and how to implement one ourselves!

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler func(bot *tgo.Bot, upd *tgo.Update)

Handler is a basic handler used in Route

type Middleware

type Middleware func(bot *tgo.Bot, upd *tgo.Update) (ok bool)

Middleware is a basic middleware used in Router and Route

type Route

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

Route is a basic route for the Router

type Router

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

Router is a basic router for all type of updates.

func NewRouter

func NewRouter() *Router

NewRouter returns a new Router; nothing special

func (*Router) Handle

func (r *Router) Handle(filter tgo.Filter, handler Handler, middlewares ...Middleware)

Handle, adds a new route to the Router

func (*Router) HandleUpdate

func (r *Router) HandleUpdate(bot *tgo.Bot, upd *tgo.Update) (used bool)

HandleUpdate implements tgo.Router interface

func (*Router) Setup

func (r *Router) Setup(bot *tgo.Bot) error

Setup implements tgo.Router interface

func (*Router) Use

func (r *Router) Use(middlewares ...Middleware)

Use, adds the passed middlewares to the Router

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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