Versions in this module Expand all Collapse all v4 v4.0.1 Dec 3, 2022 Changes in this version type InputOption + func IOptValueResolver(fn ValueResolver) InputOption + type ValueResolver func(*tb.Message) (string, error) v4.0.0 Nov 20, 2021 Changes in this version + const FallbackLang + const MsgChooseVal + const MsgOK + const MsgRetry + const MsgSubCheck + const MsgSubNoSub + const MsgUnexpected + const MsgVoteCounted + const None + var BackPressed = errors.New("back") + var ErrAlreadyVoted = errors.New("already voted") + var ErrNoChange = &Error + var ErrRetry = &Error + func ButtonMarkup(c tb.Context, values []string, maxRowButtons int, ...) *tb.ReplyMarkup + func ButtonPatternMarkup(c tb.Context, values []string, pattern []uint, cbFn tb.HandlerFunc) (*tb.ReplyMarkup, error) + func ChatInfo(ch *tb.Chat) string + func NewControllerChain(first Controller, cc ...Controller) tb.HandlerFunc + func NewInputError(msg string) error + func NoDebugLogger() + func NoLogging() + func Nvlstring(s string, ss ...string) string + func Printer(lang string, fallback ...string) *message.Printer + func PrinterContext(c tb.Context, fallback ...string) *message.Printer + func PrivateOnly(fn tb.HandlerFunc) tb.HandlerFunc + func PrivateOnlyMsg(msg string, fn tb.HandlerFunc) tb.HandlerFunc + func Sdump(m interface{}) string + func SenderInfo(c tb.Context) string + func SetDebugLogger(l Logger) + func SetLogger(l Logger) + func Userinfo(u *tb.User) string + func WithController(ctx context.Context, ctrl Controller) context.Context + type BtnLabel string + type Button struct + Name string + Value int + func (b *Button) String() string + type Callbacker interface + Callback func(ctx context.Context, c tb.Context) error + type Controller interface + Form func() *Form + Handler func(c tb.Context) error + Name func() string + OutgoingID func(recipient string) (int, bool) + SetForm func(*Form) + SetNext func(Controller) + SetPrev func(Controller) + Value func(recipient string) (string, bool) + func ControllerFromCtx(ctx context.Context) (Controller, bool) + type ErrType int + const TErrNoChange + const TErrRetry + const TInputError + type Error struct + Alert bool + Msg string + Type ErrType + func (e *Error) Error() string + type ErrorHandler interface + OnError func(ctx context.Context, c tb.Context, err error) + type Form struct + func NewForm(ctrls ...Controller) *Form + func (fm *Form) Controller(name string) (Controller, bool) + func (fm *Form) Data(r tb.Recipient) map[string]string + func (fm *Form) Handler(c tb.Context) error + func (fm *Form) OnTextMiddleware(onText tb.HandlerFunc) tb.HandlerFunc + func (fm *Form) SetOverwrite(b bool) *Form + func (fm *Form) SetRemoveButtons(b bool) *Form + func (fm *Form) Value(ctrlName, recipient string) (string, bool) + type HandleContextFunc func(ctx context.Context, c tb.Context) error + type Input struct + UniqName string + func NewInput(name string, tc TextCallbacker, opts ...InputOption) *Input + func NewInputText(name string, text string, onTextFn HandleContextFunc, opts ...InputOption) *Input + func (cc *Input) Form() *Form + func (cc *Input) Name() string + func (cc *Input) OutgoingID(recipient string) (int, bool) + func (cc *Input) SetForm(fm *Form) + func (cc *Input) SetNext(ctrl Controller) + func (cc *Input) SetPrev(ctrl Controller) + func (cc *Input) SetValue(recipient string, value string) + func (cc *Input) Value(recipient string) (string, bool) + func (ip *Input) Handler(c tb.Context) error + func (ip *Input) OnTextMw(fn tb.HandlerFunc) tb.HandlerFunc + type InputOption func(*Input) + func IOptNoReply(b bool) InputOption + func IOptPrivateOnly(b bool) InputOption + type KbdOption func(k *Keyboard) + func KbdOptButtonsInRow(n int) KbdOption + type Keyboard struct + func NewKeyboard(cmds KeyboardCommands, opts ...KbdOption) *Keyboard + func (cc *Keyboard) Form() *Form + func (cc *Keyboard) Name() string + func (cc *Keyboard) OutgoingID(recipient string) (int, bool) + func (cc *Keyboard) SetForm(fm *Form) + func (cc *Keyboard) SetNext(ctrl Controller) + func (cc *Keyboard) SetPrev(ctrl Controller) + func (cc *Keyboard) SetValue(recipient string, value string) + func (cc *Keyboard) Value(recipient string) (string, bool) + func (k *Keyboard) InitForLanguages(b *tb.Bot, lang ...string) + func (k *Keyboard) Markup(b *tb.Bot, lang string) *tb.ReplyMarkup + type KeyboardCmd struct + Handler tb.HandlerFunc + Label BtnLabel + type KeyboardCommands []KeyboardCmd + type Logger interface + Print func(v ...interface{}) + Printf func(format string, a ...interface{}) + Println func(v ...interface{}) + func GetLogger() Logger + type Message struct + func NewMessage(name string, tx Texter, sendOpts ...interface{}) *Message + func NewMessageText(name, text string, sendOpts ...interface{}) *Message + func (cc *Message) Form() *Form + func (cc *Message) Name() string + func (cc *Message) OutgoingID(recipient string) (int, bool) + func (cc *Message) SetForm(fm *Form) + func (cc *Message) SetNext(ctrl Controller) + func (cc *Message) SetPrev(ctrl Controller) + func (cc *Message) SetValue(recipient string, value string) + func (cc *Message) Value(recipient string) (string, bool) + func (m *Message) Handler(c tb.Context) error + type PBOption func(*PostButtons) + func PBOptMaxButtons(n int) PBOption + type Picklist struct + func NewPicklist(name string, tvc TextValueCallbacker, opts ...PicklistOption) *Picklist + func (b Picklist) SetMaxButtons(n int) + func (cc *Picklist) Form() *Form + func (cc *Picklist) Name() string + func (cc *Picklist) OutgoingID(recipient string) (int, bool) + func (cc *Picklist) SetForm(fm *Form) + func (cc *Picklist) SetNext(ctrl Controller) + func (cc *Picklist) SetPrev(ctrl Controller) + func (cc *Picklist) SetValue(recipient string, value string) + func (cc *Picklist) Value(recipient string) (string, bool) + func (p *Picklist) Handler(c tb.Context) error + type PicklistOption func(p *Picklist) + func PickOptBtnBack(texter Texter) PicklistOption + func PickOptBtnPattern(pattern []uint) PicklistOption + func PickOptDefaultSendOptions(opts *tb.SendOptions) PicklistOption + func PickOptErrHandler(h ErrorHandler) PicklistOption + func PickOptFallbackLang(lang string) PicklistOption + func PickOptMaxInlineButtons(n int) PicklistOption + func PickOptNoUpdate(b bool) PicklistOption + func PickOptOverwrite(b bool) PicklistOption + func PickOptPrivateOnly(b bool) PicklistOption + func PickOptRemoveButtons(b bool) PicklistOption + type PostButtons struct + func NewPostButtons(callbackFn func(c tb.Context) error, opts ...PBOption) *PostButtons + func (b PostButtons) SetMaxButtons(n int) + func (pb *PostButtons) Markup(c tb.Context, labels []string, pattern ...uint) (*tb.ReplyMarkup, error) + type RBOption func(*Rating) + func RBOptShowPostRating(b bool) RBOption + func RBOptShowVoteCounter(b bool) RBOption + type Rating struct + func NewRating(fn RatingFunc, opts ...RBOption) *Rating + func (cc *Rating) Form() *Form + func (cc *Rating) Name() string + func (cc *Rating) OutgoingID(recipient string) (int, bool) + func (cc *Rating) SetForm(fm *Form) + func (cc *Rating) SetNext(ctrl Controller) + func (cc *Rating) SetPrev(ctrl Controller) + func (cc *Rating) SetValue(recipient string, value string) + func (cc *Rating) Value(recipient string) (string, bool) + func (rb *Rating) Markup(b *tb.Bot, btns [2]Button) *tb.ReplyMarkup + type RatingFunc func(tb.Editable, *tb.User, int) ([2]Button, error) + type RatingType int + type SCOption func(sc *SubChecker) + func SCOptFallbackLang(lang string) SCOption + func SCOptShowList(b bool) SCOption + type StoredMessage struct + ChatID int64 + MessageID string + func (m StoredMessage) MessageSig() (string, int64) + type SubChecker struct + func NewSubChecker(name string, t Texter, chats []int64, opts ...SCOption) *SubChecker + func (cc *SubChecker) Form() *Form + func (cc *SubChecker) Name() string + func (cc *SubChecker) OutgoingID(recipient string) (int, bool) + func (cc *SubChecker) SetForm(fm *Form) + func (cc *SubChecker) SetNext(ctrl Controller) + func (cc *SubChecker) SetPrev(ctrl Controller) + func (cc *SubChecker) SetValue(recipient string, value string) + func (cc *SubChecker) Value(recipient string) (string, bool) + func (sc *SubChecker) Handler(c tb.Context) error + type TVC struct + CBfn HandleContextFunc + ErrorFn func(ctx context.Context, c tb.Context, err error) + TextFn func(context.Context, tb.Context) (string, error) + ValuesFn func(context.Context, tb.Context) ([]string, error) + func NewStaticTVC(text string, values []string, callbackFn HandleContextFunc) *TVC + func (t *TVC) Callback(ctx context.Context, c tb.Context) error + func (t *TVC) OnError(ctx context.Context, c tb.Context, err error) error + func (t *TVC) Text(ctx context.Context, c tb.Context) (string, error) + func (t *TVC) Values(ctx context.Context, c tb.Context) ([]string, error) + func (t *TVC) WithCallbackFn(fn HandleContextFunc) *TVC + func (t *TVC) WithErrorFn(fn func(ctx context.Context, c tb.Context, err error)) *TVC + func (t *TVC) WithTextFn(fn func(context.Context, tb.Context) (string, error)) *TVC + func (t *TVC) WithValuesFn(fn func(context.Context, tb.Context) ([]string, error)) *TVC + type TextCallbacker interface + type TextValueCallbacker interface + type TextValuer interface + type Texter interface + Text func(ctx context.Context, c tb.Context) (string, error) + func NewTexter(msg string) Texter + type Valuer interface + Values func(ctx context.Context, c tb.Context) ([]string, error) Other modules containing this package github.com/rusq/tbcomctl github.com/rusq/tbcomctl/v2 github.com/rusq/tbcomctl/v3