router

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package router dispatches commands, callbacks and text events to handlers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Router

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

Router stores ordered message matchers and keyed command/callback routes.

func New

func New() *Router

New creates an empty router.

func (*Router) Callback

func (r *Router) Callback(pattern string, h middleware.Handler)

func (*Router) Command

func (r *Router) Command(name string, h middleware.Handler)

Command registers a case-insensitive slash command handler.

func (*Router) Fallback

func (r *Router) Fallback(h middleware.Handler)

func (*Router) Handle

func (r *Router) Handle(ctx *botctx.Context) error

Handle resolves and invokes handlers for the current event.

func (*Router) Match

func (r *Router) Match(re *regexp.Regexp, h middleware.Handler)

func (*Router) Message

func (r *Router) Message(h middleware.Handler)

func (*Router) Text

func (r *Router) Text(text string, h middleware.Handler)

Jump to

Keyboard shortcuts

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