1.2.3 • Published 4 years ago

brain-api v1.2.3

Weekly downloads
3
License
ISC
Repository
github
Last release
4 years ago

Brain API

With this module you can easily use the Brain API

Info

The module and API are still in the alpha phase. So it could be that a lot of things do not yet work as intended.

Installation

npm install brain-api

Get Token

To get a token you have to register here.

It is free of charge

Usage

const brain = require("brain-api");
const brainBot = new brain();

brainBot.setToken("YOUR_TOKEN");
brainBot.ask("Wer ist Barack Obama?").then(data => {
  console.log(data);
});

Lang Options

You can also optionally specify a language code. The default language code is the one you selected when you registered.

So far you can use these: |Code| Function| |--|--| | de | Returns an German answer | | en | Returns an English answer | |auto|Returns an answer automatically adapted to the question|

const brain = require("brain-api");
const brainBot = new brain();

brainBot.setLang("LANG_CODE"); // (From the upper table)

Example Output

{
BrainSolution:
'Barack Hussein Obama II (/bəˈrɑːk huːˈseɪn oʊˈbɑːmə/ born August 4, 1961) is an American politician and attorney who served as the 44th president of the United States from 2009 to 2017. A member of the Democratic Party, he was the first African-American president of the United States. He previously served as a U.S. senator from Illinois from 2005 to 2008 and an Illinois state senator from 1997 to 2004.',

FullData: {
name: 'Barack Obama',
link: 'https://en.wikipedia.org/wiki/Barack_Obama',
description: 'Barack Hussein Obama II (/bəˈrɑːk huːˈseɪn oʊˈbɑːmə/ born August 4, 1961) is an American politician and attorney who served as the 44th president of the United States from 2009 to 2017. A member of the Democratic Party, he was the first African-American president of the United States. He previously served as a U.S. senator from Illinois from 2005 to 2008 and an Illinois state senator from 1997 to 2004.'
}

Input Examples

Cooming Soon ...

1.2.3

4 years ago

1.2.2

4 years ago

1.2.0

4 years ago

1.1.9

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.2.1

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago