Skip to content

theaquarium/dialect-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Diax Dialect for Node

NPM module for using the Diax Dialect API.

Installation

npm install diax-dialect --save

Usage

The node module can be installed by typing npm install diax-dialect --save in your project directory. Then you can include the module with const Dialect = require('diax-dialect');.

Then to create your Dialect instance, declare a global variable without initializing it:

var myDialect;

and then call:

Dialect.create("my-token", function(thisDialect) { myDialect = thisDialect; });

This sets that variable you declared earlier to your dialect instance.

After you do that, you can simply use the dialect api by doing:

myDialect.ask("something to ask the dialect", function(response) { console.log(response); });

This calls your dialect instance's ask method and runs the callback.

You can also train the api with the node module by running:

myDialect.train("something to ask the dialect", "what the dialect should respond");

Example

const Dialect = require('diax-dialect');
var myDialect;
Dialect.create("token", function(dialect) {
	myDialect = dialect;
});
// ask
myDialect.ask("Hello", function(response) {
	console.log(response);
});
// train
myDialect.train("Hello", "Hi there!");

Release History

  • 1.0.2 Updated README.md

  • 1.0.1 Updated README.md

  • 1.0.0 Initial release

About

Node.JS API for requests to Diax Dialect

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published