Documentation ¶
Overview ¶
EndpointsExtension - an extension over Telegram-Bot-Api v5 that adds endpoints and middleware, similar to https://gopkg.in/telebot.v3
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct { // Copy of data from the update channel U tgb.Update // Link to the bot to send messages B *tgb.BotAPI // Custom Field - A map of custom fields to pass to endpoints via Context. // Because it is an interface, you must always check the typeof a // variable when retrieving and storing data. CustomField map[string]interface{} }
Context - a structure containing a copy of the update, a link to the bot and custom fields passed inside the handlers
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group - wrapper for grouping endpoints and middleware
func (*Group) Group ¶
Group - like *router.Group, creates a new routing group by delegating top and parent level middleware to it.
func (*Group) Handler ¶
func (g *Group) Handler(c interface{}, h HandleFunc, m ...MiddlewareFunc)
Handler - checks the type and adds it to the endpoints array for further processing. In case of error, causes panic
func (*Group) Use ¶
func (g *Group) Use(middleware ...MiddlewareFunc)
Use - adds middleware to the group. Executed in order of addition, but before the main function
type HandleFunc ¶
HandleFunc - action function to be called if the condition is successfully checked
type MiddlewareFunc ¶
type MiddlewareFunc func(HandleFunc) HandleFunc
MiddlewareFunc - wrapper over HandleFunc, executed after the endpoint condition, but before the main function
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router - a structure that contains handlers and performs routing of received updates.
func (*Router) Handler ¶
func (r *Router) Handler(condition interface{}, h HandleFunc, m ...MiddlewareFunc)
Handler - checks the type and adds it to the endpoints array for further processing. In case of error, causes panic
func (Router) Route ¶
Route - starts the verification process for all endpoints, and if a match is found, it stops the enumeration of conditions, for performing the assigned function.
func (*Router) Use ¶
func (r *Router) Use(middleware ...MiddlewareFunc)
Use - adds middleware to the bot's global chain.