wizard

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const CallbackSep = ":"

Variables

View Source
var (
	ErrDone                = errors.New("wizard already done")
	ErrInvalidCallbackData = errors.New("invalid callback data")
	ErrUnknownWizardStep   = errors.New("unknown wizard step")
)

Functions

func Start

func Start(w Interface, update tg.Update) tg.Chattable

TODO: send a notification with a timeout

Types

type Add

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

func (*Add) Active

func (a *Add) Active() bool

func (*Add) ID

func (a *Add) ID() string

func (*Add) Name

func (a *Add) Name() string

func (*Add) Next

func (a *Add) Next(s storage.Interface, update tg.Update) (tg.Chattable, Consume, error)

NOTE: this works on a happy path. If a parsing error occurs, then that's likely due to a malicious client using malformed callback. For steps that consume update.Message.Text we just retry the same step.

func (*Add) Reset

func (a *Add) Reset()

type Consume

type Consume func(s storage.Interface, update tg.Update) (tg.Chattable, Consume, error)

type Delete

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

func (*Delete) Active

func (d *Delete) Active() bool

func (*Delete) ID

func (d *Delete) ID() string

func (*Delete) Name

func (d *Delete) Name() string

func (*Delete) Next

func (d *Delete) Next(s storage.Interface, update tg.Update) (tg.Chattable, Consume, error)

func (*Delete) Reset

func (d *Delete) Reset()

type Interface

type Interface interface {
	ID() string
	Active() bool
	Name() string
	Next(s storage.Interface, update tg.Update) (tg.Chattable, Consume, error)
	Reset()
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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