Documentation ¶
Index ¶
- type Context
- func (ctx *Context) Ask(msg tgo.Sendable, timeout time.Duration) (question, answer *Context, err error)
- func (ctx *Context) Delete() error
- func (ctx *Context) Reply(msg tgo.Replyable) (*tgo.Message, error)
- func (ctx *Context) Send(msg tgo.Sendable) (*tgo.Message, error)
- func (ctx *Context) Session() *sync.Map
- func (m *Context) String() string
- type Handler
- type Middleware
- type Route
- type Router
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct { // Message contains the raw received message *tgo.Message // Bot is the bot instance which got the update. Bot *tgo.Bot // Storage contains an in-context storage used for middlewares to pass some data // to the next middleware or even the handler. Storage sync.Map }
func (*Context) Ask ¶
func (ctx *Context) Ask(msg tgo.Sendable, timeout time.Duration) (question, answer *Context, err error)
Ask asks a question from the message's sender and waits for the passed timeout for their response.
func (*Context) Reply ¶
Reply replies to the current message with the preferred ParseMode. It will pass/override the ChatId and ReplyToMessageId field.
func (*Context) Send ¶
Send sends a message into the current chat with the preferred ParseMode. It will set the target ChatId if not set.
type Middleware ¶
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
func NewRouter ¶
func NewRouter(middlewares ...Middleware) *Router
NewRouter returns a new message router
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 ¶
HandleUpdate implements tgo.Router interface
Click to show internal directories.
Click to hide internal directories.