Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrValidationFailed = errors.New("the callback token is invalid")
ErrValidationFailed happens when a channel cannot validate an incoming callback
Functions ¶
This section is empty.
Types ¶
type Auth ¶ added in v0.6.0
type Auth struct {
Token string `mapstructure:"token"`
}
Auth is authorization for the bot API
type Bot ¶
type Bot struct { Name string Store store.Store Domain *fsm.Domain Classifier *clf.Classifier Extensions extension.ServerMap Channels *channels.Channels Config *Config Router *mux.Router }
Bot models a bot with a Classifier and an FSM
func (*Bot) ChannelHandler ¶ added in v0.7.0
ChannelHandler takes an incoming http.Request and passes it to a channel for it to respond
type Config ¶
type Config struct { Name string `mapstructure:"bot_name"` Extensions extension.ConfigMap `mapstructure:"extensions"` Store storeconfig.StoreConfig `mapstructure:"store"` Port int `mapstructure:"port"` Path string Conversation Conversation `mapstructure:"conversation"` Auth Auth `mapstructure:"auth"` }
Config struct models the bot.yml configuration file
func LoadConfig ¶
LoadConfig loads bot configuration from bot.yml
func (*Config) ShouldReplyError ¶ added in v0.6.0
ShouldReplyError depending on the conversational settings lets the bot know if it should reply with Error to the channel
func (*Config) ShouldReplyUnknown ¶ added in v0.6.0
ShouldReplyUnknown depending on the conversational settings lets the bot know if it should reply with Unknown to the channel
func (*Config) ShouldReplyUnsure ¶ added in v0.6.0
ShouldReplyUnsure depending on the conversational settings lets the bot know if it should reply with Unsure to the channel
type Conversation ¶ added in v0.6.0
type Conversation struct { New ConversationConfig `mapstructure:"new"` Existing ConversationConfig `mapstructure:"existing"` }
Conversation settings for new and existing conversations
type ConversationConfig ¶ added in v0.6.0
type ConversationConfig struct { ReplyUnsure bool `mapstructure:"reply_unsure"` ReplyUnknown bool `mapstructure:"reply_unknown"` ReplyError bool `mapstructure:"reply_error"` }
ConversationConfig for the bot
type ErrUnknownExtension ¶ added in v0.6.0
type ErrUnknownExtension struct {
Extension string
}
ErrUnknownExtension is returned by the Bot when the provided extension name does not exist
func (*ErrUnknownExtension) Error ¶ added in v0.6.0
func (e *ErrUnknownExtension) Error() string
Error returns the ErrUnknownExtension error message
type Prediction ¶
type Prediction struct { Original string `json:"original"` Predicted string `json:"predicted"` Probability float32 `json:"probability"` }
Prediction models a classifier prediction and its original string