GithubHelp home page GithubHelp logo

syclin / keywordbotinterface Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 30 KB

a node module of an easy-to-use keyword chatbot interface.

License: BSD 3-Clause "New" or "Revised" License

JavaScript 100.00%

keywordbotinterface's Introduction

KeywordBotInterface

a node module of an easy-to-use keyword chatbot interface.

Build Status Coverage Status

Getting started

Require this module

var KeywordBotInterface = require('path/to/this/repo'); // please wait for me to publish this repo, haha.
var keywordBot = new KeywordBotInterface();

Simple Text Response Example

In this part of the tutorial you will find it really simple to define the bot's simple text response to specific messages received.

The following four code snippets demonstrate the CRUD of simple text response behavior.

  1. Create keyword response
keywordBot.addKeyword('mySampleMessage', 'mySampleResponse', function(err) {
  if(err && err.code == keywordBot.error.KEYWORD_DUPLICATE) {
    console.log('Error: the key already existed');
  } else {
    console.log('Keyword added successfully');
  }
});
  1. Read keyword response
keywordBot.getResponse('mySampleMessage', function(err, res) {
  if(err && err.code == keywordBot.error.KEYWORD_NOT_FOUND) {
    console.log('Error: keyword not found');
  } else {
    console.log('the response is:', res);
  }
});
  1. Update keyword response

(TODO)

  1. Delete keyword response
keywordBot.removeKeyword('mySampleMessage', null, function(err, res) {
  if(err && err.code == keywordBot.error.KEYWORD_NOT_FOUND) {
    console.log('Error: keyword not found');
  } else {
    console.log('Keyword deleted successfully');
  }
});

keywordbotinterface's People

Contributors

syclin avatar

Stargazers

Ryan C avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.