state

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: MIT Imports: 8 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

func AttachSession

func AttachSession(ctx *botctx.Context, session Session)

Types

type FSM

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

func NewFSM

func NewFSM(repo storage.SessionRepository, ttl time.Duration) *FSM

func (*FSM) Enter

func (f *FSM) Enter(ctx *botctx.Context, sceneName string) error

func (*FSM) Exit

func (f *FSM) Exit(ctx *botctx.Context) error

func (*FSM) Handle

func (f *FSM) Handle(ctx *botctx.Context) (bool, error)

func (*FSM) Middleware

func (f *FSM) Middleware() middleware.Middleware

func (*FSM) Scene

func (f *FSM) Scene(scene *Scene)

type Scene

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

func NewScene

func NewScene(name string, ttl time.Duration) *Scene

func (*Scene) CurrentStep

func (s *Scene) CurrentStep(session Session) string

func (*Scene) Handle

func (s *Scene) Handle(ctx *botctx.Context, session Session) error

func (*Scene) Next

func (s *Scene) Next(session Session)

func (*Scene) Step

func (s *Scene) Step(name string, h StepHandler) *Scene

type Session

type Session interface {
	Get(key string) any
	Set(key string, value any)
	Delete(key string)
	Values() map[string]any
	Save(ctx context.Context) error
}

func NewSession

func NewSession(repo storage.SessionRepository, key string, ttl time.Duration) Session

func SessionFromContext

func SessionFromContext(ctx *botctx.Context) Session

type StepHandler

type StepHandler func(*botctx.Context, Session) error

Jump to

Keyboard shortcuts

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