Documentation
¶
Index ¶
- Variables
- type AuthInteract
- type AuthMode
- type Authorizer
- type Command
- type CommandResponder
- type CustomInteraction
- type Interact
- func (it *Interact) AddCustomInteraction(custom CustomInteraction)
- func (it *Interact) Command(command string, f interface{}) *Command
- func (it *Interact) PrivateCommand(command string, f interface{}) *Command
- func (it *Interact) SetMessenger(messenger Messenger)
- func (it *Interact) SetOriginState(s State)
- func (it *Interact) Start(ctx context.Context) error
- type Messenger
- type Reply
- type Responder
- type State
- type Telegram
- type TelegramAuthorizer
- type TelegramReply
- type TextMessageResponder
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrAuthenticationFailed = errors.New("authentication failed")
Functions ¶
This section is empty.
Types ¶
type AuthInteract ¶
type AuthInteract struct {
Strict bool `json:"strict,omitempty"`
Mode AuthMode `json:"authMode"`
Token string `json:"authToken,omitempty"`
OneTimePasswordKey *otp.Key `json:"otpKey,omitempty"`
}
func (*AuthInteract) Commands ¶
func (it *AuthInteract) Commands(interact *Interact)
type Authorizer ¶
type Authorizer interface {
StartAuthorizing()
Authorize() error
}
type Command ¶
type Command struct {
// Name is the command name
Name string
// StateF is the command handler function
F interface{}
// contains filtered or unexported fields
}
Command is a domain specific language syntax helper It's used for helping developer define the state and transition function
func NewCommand ¶
type CommandResponder ¶
type CustomInteraction ¶
type CustomInteraction interface {
Commands(interact *Interact)
}
type Interact ¶
type Interact struct {
// contains filtered or unexported fields
}
Interact implements the interaction between bot and message software.
func (*Interact) AddCustomInteraction ¶
func (it *Interact) AddCustomInteraction(custom CustomInteraction)
func (*Interact) PrivateCommand ¶
func (*Interact) SetMessenger ¶
func (*Interact) SetOriginState ¶
type Messenger ¶
type Messenger interface {
TextMessageResponder
CommandResponder
Start(ctx context.Context)
}
type Telegram ¶
type Telegram struct {
Bot *telebot.Bot `json:"-"`
// Private is used to protect the telegram bot, users not authenticated can not see messages or sending commands
Private bool `json:"private,omitempty"`
// Owner is the authorized bot owner
// This field is exported in order to be stored in file
Owner *telebot.User `json:"owner,omitempty"`
// OwnerChat is the chat of the authorized bot owner
// This field is exported in order to be stored in file
OwnerChat *telebot.Chat `json:"chat,omitempty"`
// contains filtered or unexported fields
}
func (*Telegram) AddCommand ¶
func (*Telegram) SetTextMessageResponder ¶
type TelegramAuthorizer ¶
func (*TelegramAuthorizer) Authorize ¶
func (a *TelegramAuthorizer) Authorize() error
func (*TelegramAuthorizer) StartAuthorizing ¶
func (a *TelegramAuthorizer) StartAuthorizing()
type TelegramReply ¶
type TelegramReply struct {
// contains filtered or unexported fields
}
func (*TelegramReply) AddButton ¶
func (r *TelegramReply) AddButton(text string)
func (*TelegramReply) Message ¶
func (r *TelegramReply) Message(message string)
func (*TelegramReply) RemoveKeyboard ¶
func (r *TelegramReply) RemoveKeyboard()
type TextMessageResponder ¶
type TextMessageResponder interface {
SetTextMessageResponder(responder Responder)
}
Click to show internal directories.
Click to hide internal directories.