Version: v0.2.0 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Jul 1, 2016 License: MIT Imports: 18 Imported by: 0



Package plugin enables plugins to register with Abot and connect to the database.



This section is empty.


View Source
var ErrMissingPluginName = errors.New("missing plugin name")

ErrMissingPluginName is returned when a plugin name is expected, but but a blank name is provided.

View Source
var ErrMissingTrigger = errors.New("missing plugin trigger")

ErrMissingTrigger is returned when a trigger is expected but none were found.


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

func New(url string) (*dt.Plugin, error)

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.

func TestReq added in v0.2.0

func TestReq(r *httprouter.Router, in, exp string) error

TestReq tests the input against the expected output. It returns an error if the input does not match the expected output.


This section is empty.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL