Documentation ¶
Overview ¶
Package plugin enables plugins to register with Abot and connect to the database.
Index ¶
- Variables
- func AppendTrigger(p *dt.Plugin, t *dt.StructuredInput)
- func New(url string) (*dt.Plugin, error)
- func Register(p *dt.Plugin) error
- func SetKeywords(p *dt.Plugin, khs ...dt.KeywordHandler)
- func SetStates(p *dt.Plugin, states [][]dt.State)
- func TestCleanup()
- func TestPrepare() *httprouter.Router
- func TestReq(r *httprouter.Router, in, exp string) error
Constants ¶
This section is empty.
Variables ¶
var ErrMissingPluginName = errors.New("missing plugin name")
ErrMissingPluginName is returned when a plugin name is expected, but but a blank name is provided.
var ErrMissingTrigger = errors.New("missing plugin trigger")
ErrMissingTrigger is returned when a trigger is expected but none were found.
Functions ¶
func AppendTrigger ¶ added in v0.2.0
func AppendTrigger(p *dt.Plugin, t *dt.StructuredInput)
AppendTrigger appends the StructuredInput's modified contents to a plugin. All Commands and Objects stemmed using the Porter2 Snowball algorithm.
func New ¶
New builds a Plugin with its trigger, RPC, and configuration settings from its plugin.json.
func Register ¶ added in v0.2.0
func Register(p *dt.Plugin) error
Register enables Abot to notify plugins when specific StructuredInput is encountered matching triggers set in the plugins themselves. Note that plugins will only listen when (Command and Object) or (Intent) criteria are met. There's no support currently for duplicate routes, e.g. "find_restaurant" leading to either one of two plugins.
func SetKeywords ¶ added in v0.2.0
func SetKeywords(p *dt.Plugin, khs ...dt.KeywordHandler)
SetKeywords processes and registers keywords with Abot's core for routing.
func SetStates ¶ added in v0.2.0
func SetStates(p *dt.Plugin, states [][]dt.State)
SetStates is a convenience function provided to match the API of NewKeywords and AppendTrigger.
func TestCleanup ¶ added in v0.2.0
func TestCleanup()
TestCleanup cleans up the test DB. It can only be run when ABOT_ENV == "test".
func TestPrepare ¶ added in v0.2.0
func TestPrepare() *httprouter.Router
TestPrepare sets the ABOT_ENV, cleans out the test DB, and initializes the server for testing.
Types ¶
This section is empty.