context

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 9 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

Index

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 (c *Context) AnswerCallback(text string) error

func (*Context) CallbackRoute

func (c *Context) CallbackRoute() string

func (*Context) CanEdit

func (c *Context) CanEdit() bool

func (*Context) ClearState

func (c *Context) ClearState() error

ClearState deletes FSM state for this user/chat from injected FSM manager.

func (*Context) Command

func (c *Context) Command() string

func (*Context) Edit

func (c *Context) Edit(text string, kb *keyboard.Keyboard) error

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

func (c *Context) EditByRef(ref platform.MessageRef, text string, kb *keyboard.Keyboard) error

EditByRef tries to edit a message by an explicit message reference. If unsupported or unavailable, it falls back to Send.

func (*Context) EditText

func (c *Context) EditText(text string) error

EditText tries to edit the message related to the current event. If editing is unsupported or unavailable, it falls back to SendText.

func (*Context) Get

func (c *Context) Get(key string) (any, bool)

func (*Context) Input

func (c *Context) Input() string

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 (c *Context) IsCallback() bool

func (*Context) PlatformName

func (c *Context) PlatformName() string

func (*Context) Send

func (c *Context) Send(text string, kb *keyboard.Keyboard) error

func (*Context) SendText

func (c *Context) SendText(text string) error

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

func (*Context) Set

func (c *Context) Set(key string, value any)

func (*Context) SetState

func (c *Context) SetState(mode string, step int, data map[string]string) error

SetState writes FSM state for this user/chat to injected FSM manager.

func (*Context) State

func (c *Context) State() (mode string, step int, data map[string]string, ok bool, err error)

State returns current FSM state for this user/chat from injected FSM manager.

func (*Context) Text

func (c *Context) Text() string

Jump to

Keyboard shortcuts

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