router

package
v0.0.0-...-8349458 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRouteNotFound = errors.New("route not found")

Functions

This section is empty.

Types

type Context

type Context struct {
	Context context.Context
	Update  *illuminate.Update
	Bot     *illuminate.Bot
	// contains filtered or unexported fields
}

func (*Context) Answer

func (ctx *Context) Answer(text string, opts ...*illuminate.AnswerCallbackQueryOpts) (bool, error)

Answer sends answer to callback query from update

func (*Context) AnswerAlert

func (ctx *Context) AnswerAlert(text string, opts ...*illuminate.AnswerCallbackQueryOpts) (bool, error)

AnswerAlert sends answer to callback query from update with alert

func (*Context) AnswerAlertVoid

func (ctx *Context) AnswerAlertVoid(text string, opts ...*illuminate.AnswerCallbackQueryOpts) error

AnswerAlertVoid sends answer to callback query with alert without returning result

func (*Context) AnswerVoid

func (ctx *Context) AnswerVoid(text string, opts ...*illuminate.AnswerCallbackQueryOpts) error

AnswerVoid sends answer to callback query without returning result

func (*Context) Chat

func (ctx *Context) Chat() *illuminate.Chat

func (*Context) ChatID

func (ctx *Context) ChatID() int64

func (*Context) CommandArgs

func (ctx *Context) CommandArgs() []string

func (*Context) DeleteMessage

func (ctx *Context) DeleteMessage(opts ...*illuminate.DeleteMessageOpts) (bool, error)

DeleteMessage deletes message which is in update

func (*Context) DeleteMessageVoid

func (ctx *Context) DeleteMessageVoid(opts ...*illuminate.DeleteMessageOpts) error

DeleteMessageVoid deletes message which is in update without returning result

func (*Context) EditMessageText

func (ctx *Context) EditMessageText(text string, opts ...*illuminate.EditMessageTextOpts) (*illuminate.Message, bool, error)

func (*Context) EditMessageTextVoid

func (ctx *Context) EditMessageTextVoid(text string, opts ...*illuminate.EditMessageTextOpts) error

func (*Context) GetState

func (ctx *Context) GetState() *string

func (*Context) Message

func (ctx *Context) Message() *illuminate.Message

func (*Context) Next

func (ctx *Context) Next() error

func (*Context) Reply

func (ctx *Context) Reply(text string, opts ...*illuminate.SendMessageOpts) (*illuminate.Message, error)

Reply sends message to the chat from update

func (*Context) ReplyEmojiBigReaction

func (ctx *Context) ReplyEmojiBigReaction(emoji ...string) (bool, error)

func (*Context) ReplyEmojiBigReactionVoid

func (ctx *Context) ReplyEmojiBigReactionVoid(emoji ...string) error

func (*Context) ReplyEmojiReaction

func (ctx *Context) ReplyEmojiReaction(emoji ...string) (bool, error)

func (*Context) ReplyEmojiReactionVoid

func (ctx *Context) ReplyEmojiReactionVoid(emoji ...string) error

func (*Context) ReplyVoid

func (ctx *Context) ReplyVoid(text string, opts ...*illuminate.SendMessageOpts) error

ReplyVoid sends message without returning result

func (*Context) ReplyWithMenu

func (ctx *Context) ReplyWithMenu(
	text string, menu illuminate.IMenu, opts ...*illuminate.SendMessageOpts,
) (*illuminate.Message, error)

ReplyWithMenu sends message with menu

func (*Context) ReplyWithMenuVoid

func (ctx *Context) ReplyWithMenuVoid(
	text string, menu illuminate.IMenu, opts ...*illuminate.SendMessageOpts,
) error

ReplyWithMenuVoid sends message with menu without returning result

func (*Context) Sender

func (ctx *Context) Sender() *illuminate.User

func (*Context) SetParseMode

func (ctx *Context) SetParseMode(parseMode string)

func (*Context) SetState

func (ctx *Context) SetState(state string)

type Handler

type Handler func(*Context) error

type Route

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

func (*Route) GetFormattedState

func (route *Route) GetFormattedState() string

func (*Route) GetHandlersCount

func (route *Route) GetHandlersCount() int

func (*Route) GetName

func (route *Route) GetName() string

func (*Route) GetState

func (route *Route) GetState() *string

func (*Route) Name

func (route *Route) Name(name string) *Route

type RouteFilter

type RouteFilter func(*Context) bool

func AnyUpdate

func AnyUpdate() RouteFilter

func CallbackPrefix

func CallbackPrefix(text string) RouteFilter

func Command

func Command(command string) RouteFilter

func CommandWithAt

func CommandWithAt(command, username string) RouteFilter

func Message

func Message() RouteFilter

func TextContains

func TextContains(text string) RouteFilter

func TextPrefix

func TextPrefix(text string) RouteFilter

type Router

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

func New

func New(bot *illuminate.Bot) *Router

func (*Router) GetRoutes

func (r *Router) GetRoutes() []*Route

func (*Router) Group

func (r *Router) Group(handlers ...Handler) *Router

func (*Router) HandleUpdate

func (r *Router) HandleUpdate(ctx context.Context, update *illuminate.Update) error

func (*Router) On

func (r *Router) On(filter RouteFilter, handlers ...Handler) *Route

func (*Router) OnCallbackPrefix

func (r *Router) OnCallbackPrefix(prefix string, handlers ...Handler) *Route

func (*Router) OnCommand

func (r *Router) OnCommand(command string, handlers ...Handler) *Route

func (*Router) OnCommandWithAt

func (r *Router) OnCommandWithAt(command, username string, handlers ...Handler) *Route

func (*Router) OnMessage

func (r *Router) OnMessage(handlers ...Handler) *Route

func (*Router) OnStart

func (r *Router) OnStart(handlers ...Handler) *Route

func (*Router) OnTextContains

func (r *Router) OnTextContains(text string, handlers ...Handler) *Route

func (*Router) OnTextPrefix

func (r *Router) OnTextPrefix(prefix string, handlers ...Handler) *Route

func (*Router) OnUpdate

func (r *Router) OnUpdate(handlers ...Handler) *Route

func (*Router) Use

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

func (*Router) UseState

func (r *Router) UseState(state string, handlers ...Handler) *Router

Jump to

Keyboard shortcuts

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