Versions in this module Expand all Collapse all v0 v0.0.1 May 4, 2024 Changes in this version + var ErrAuthenticationFailed = errors.New("authentication failed") + func AddCustomInteraction(custom CustomInteraction) + func AddMessenger(messenger Messenger) + func Start(ctx context.Context) error + type AuthInteract struct + Mode AuthMode + OneTimePasswordKey *otp.Key + Strict bool + Token string + func (it *AuthInteract) Commands(interact *Interact) + type AuthMode string + const AuthModeOTP + const AuthModeToken + type Authorizer interface + Authorize func() error + StartAuthorizing func() + type BaseSession struct + Authorized bool + CurrentState State + OriginState State + StartedTime time.Time + func (s *BaseSession) GetOriginState() State + func (s *BaseSession) GetState() State + func (s *BaseSession) IsAuthorized() bool + func (s *BaseSession) SetAuthorized() + func (s *BaseSession) SetAuthorizing(b bool) + func (s *BaseSession) SetOriginState(state State) + func (s *BaseSession) SetState(state State) + type Button struct + Name string + Text string + Value string + type ButtonReply interface + AddButton func(text string) + type CallbackResponder interface + SetCallbackResponder func(responder Responder) + type Command struct + Desc string + F interface{} + Name string + func NewCommand(name, desc string, f interface{}) *Command + func (c *Command) Cycle(f interface{}) *Command + func (c *Command) NamedNext(n State, f interface{}) *Command + func (c *Command) Next(f interface{}) *Command + func (c *Command) Transit(state1, state2 State, f interface{}) *Command + type CommandResponder interface + AddCommand func(command *Command, responder Responder) + type CustomInteraction interface + Commands func(interact *Interact) + type DialogReply interface + Dialog func(title, text string, buttons []string) + type Initializer interface + Initialize func() error + type Interact struct + func Default() *Interact + func New() *Interact + func (it *Interact) AddCustomInteraction(custom CustomInteraction) + func (it *Interact) AddMessenger(messenger Messenger) + func (it *Interact) Command(command string, desc string, f interface{}) *Command + func (it *Interact) PrivateCommand(command, desc string, f interface{}) *Command + func (it *Interact) Start(ctx context.Context) error + type KeyboardController interface + RemoveKeyboard func() + type Messenger interface + Start func(ctx context.Context) + type Option struct + Label string + Name string + Value string + type Reply interface + AddButton func(text string, name, value string) + AddMultipleButtons func(buttonsForm [][3]string) + Message func(message string) + Send func(message string) + type Responder func(session Session, message string, reply Reply, ctxObjects ...interface{}) error + type Session interface + GetOriginState func() State + GetState func() State + ID func() string + IsAuthorized func() bool + SetAuthorized func() + SetAuthorizing func(b bool) + SetOriginState func(state State) + SetState func(state State) + type Slack struct + func NewSlack(client *slack.Client) *Slack + func (s *Slack) AddCommand(command *Command, responder Responder) + func (s *Slack) EmitAuthorized(userSession *SlackSession) + func (s *Slack) EmitEventsApi(evt slackevents.EventsAPIEvent) + func (s *Slack) OnAuthorized(cb func(userSession *SlackSession)) + func (s *Slack) OnEventsApi(cb func(evt slackevents.EventsAPIEvent)) + func (s *Slack) SetTextMessageResponder(responder Responder) + func (s *Slack) Start(ctx context.Context) + type SlackReply struct + func (reply *SlackReply) AddButton(text string, name string, value string) + func (reply *SlackReply) AddMultipleButtons(buttonsForm [][3]string) + func (reply *SlackReply) Choose(prompt string, options ...Option) + func (reply *SlackReply) InputText(prompt string, textFields ...TextField) + func (reply *SlackReply) Message(message string) + func (reply *SlackReply) RemoveKeyboard() + func (reply *SlackReply) Send(message string) + type SlackSession struct + ChannelID string + UserID string + func NewSlackSession(slack *Slack, userID, channelID string) *SlackSession + func (s *SlackSession) ID() string + func (s *SlackSession) SetAuthorized() + type SlackSessionMap map[string]*SlackSession + type State string + const StateAuthenticated + const StatePublic + func ParseFuncArgsAndCall(f interface{}, args []string, objects ...interface{}) (State, error) + type Telegram struct + Bot *telebot.Bot + Private bool + func NewTelegram(bot *telebot.Bot) *Telegram + func (tm *Telegram) AddCommand(cmd *Command, responder Responder) + func (tm *Telegram) EmitAuthorized(s *TelegramSession) + func (tm *Telegram) OnAuthorized(cb func(s *TelegramSession)) + func (tm *Telegram) RestoreSessions(sessions TelegramSessionMap) + func (tm *Telegram) Sessions() TelegramSessionMap + func (tm *Telegram) SetCallbackResponder(responder CallbackResponder) + func (tm *Telegram) SetTextMessageResponder(responder Responder) + func (tm *Telegram) Start(ctx context.Context) + type TelegramReply struct + func (r *TelegramReply) AddButton(text string, name string, value string) + func (r *TelegramReply) AddMultipleButtons(buttonsForm [][3]string) + func (r *TelegramReply) Message(message string) + func (r *TelegramReply) RemoveKeyboard() + func (r *TelegramReply) Send(message string) + type TelegramSession struct + Chat *telebot.Chat + User *telebot.User + func NewTelegramSession(telegram *Telegram, message *telebot.Message) *TelegramSession + func (s *TelegramSession) ID() string + func (s *TelegramSession) SetAuthorized() + type TelegramSessionMap map[int64]*TelegramSession + type TextField struct + Label string + Name string + PlaceHolder string + type TextMessageResponder interface + SetTextMessageResponder func(responder Responder)