list

package
v0.0.0-...-516d34e Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidTextPath = errors.New("invalid paths")
	ErrInvalidLanguage = errors.New("locale does not exist")
)

Functions

This section is empty.

Types

type Callback

type Callback func(list *List, path string, c *tb.Message) bool

Callback that triggers when a user sends an item from the list if the function returns true - the user is being evicted from the active sessions

type List

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

List is a set of prepared replies in a selected language that is able to perform a callback when a user selects an answer from the list

func NewListFlow

func NewListFlow(id string, textEngine *tr.Engine, bot *tb.Bot, callback Callback, textPaths ...string) (*List, error)

Creates a new list

func (*List) Build

func (l *List) Build(lang string) *List

Builds markups for a specific locale

func (*List) GetBot

func (l *List) GetBot() *tb.Bot

Get attached Telegram bot

func (*List) GetId

func (l *List) GetId() string

Get list's unique identificator

func (*List) GetMarkup

func (l *List) GetMarkup(lang string) *tb.ReplyMarkup

Gets a built markup in a specified language

func (*List) GetSession

func (l *List) GetSession(of tb.Recipient) (string, bool)

Retrieves a session language by recipient

func (*List) Start

func (l *List) Start(to tb.Recipient, textPath, language string) error

Starts a list flow for the user

func (*List) StartWithText

func (l *List) StartWithText(to tb.Recipient, text, language string) error

Starts a list flow for the user with a custom text

Jump to

Keyboard shortcuts

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