Documentation
¶
Index ¶
- type Context
- func (c *Context) Allow(action string, limit int, window time.Duration, keyParts ...string) (bool, time.Duration)
- func (c *Context) AnswerCallback(text string) error
- func (c *Context) CallbackRoute() string
- func (c *Context) CanEdit() bool
- func (c *Context) ClearState() error
- func (c *Context) Command() string
- func (c *Context) Edit(text string, kb *keyboard.Keyboard) error
- func (c *Context) EditByRef(ref platform.MessageRef, text string, kb *keyboard.Keyboard) error
- func (c *Context) EditText(text string) error
- func (c *Context) Get(key string) (any, bool)
- func (c *Context) Input() string
- func (c *Context) IsCallback() bool
- func (c *Context) PlatformName() string
- func (c *Context) Send(text string, kb *keyboard.Keyboard) error
- func (c *Context) SendText(text string) error
- func (c *Context) SendTextWithRef(text string) (platform.MessageRef, error)
- func (c *Context) SendWithAttachments(text string, kb *keyboard.Keyboard, files ...attachments.Attachment) error
- func (c *Context) Set(key string, value any)
- func (c *Context) SetState(mode string, step int, data map[string]string) error
- func (c *Context) State() (mode string, step int, data map[string]string, ok bool, err error)
- func (c *Context) Text() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
Context stdctx.Context
Event event.Event
Platform platform.Platform
Payload *payload.Payload
Values map[string]any
}
func (*Context) Allow ¶
func (c *Context) Allow(action string, limit int, window time.Duration, keyParts ...string) (bool, time.Duration)
Allow uses injected rate limiter (if present) for arbitrary actions. If limiter is not injected, request is considered allowed.
func (*Context) AnswerCallback ¶
func (*Context) CallbackRoute ¶
func (*Context) ClearState ¶
ClearState deletes FSM state for this user/chat from injected FSM manager.
func (*Context) Edit ¶
Edit tries to edit the message related to the current event. If editing is unsupported or unavailable, it falls back to Send.
func (*Context) EditByRef ¶
EditByRef tries to edit a message by an explicit message reference. If unsupported or unavailable, it falls back to Send.
func (*Context) EditText ¶
EditText tries to edit the message related to the current event. If editing is unsupported or unavailable, it falls back to SendText.
func (*Context) Input ¶
Input returns user input unified for text and callback events. For callbacks it prefers payload action, then payload route, then raw payload string.
func (*Context) IsCallback ¶
func (*Context) PlatformName ¶
func (*Context) SendTextWithRef ¶
func (c *Context) SendTextWithRef(text string) (platform.MessageRef, error)
func (*Context) SendWithAttachments ¶
func (c *Context) SendWithAttachments(text string, kb *keyboard.Keyboard, files ...attachments.Attachment) error