Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sergiopvilar/chatbot-commander

A chatbot commander module to handle strings and call the proper callbacks
https://github.com/sergiopvilar/chatbot-commander

Last synced: about 1 month ago
JSON representation

A chatbot commander module to handle strings and call the proper callbacks

Awesome Lists containing this project

README

        

# Chatbot Commander

[![Build Status](https://travis-ci.org/sergiopvilar/chatbot-commander.svg?branch=master)](https://travis-ci.org/sergiopvilar/chatbot-commander)

A chatbot-commander module to handle strings and call the proper callbacks, particularly usefull for command oriented chatbots.

## How to use

At first don't forget to install the dependencies:

yarn add chatbot-commander

Then import the module and start the fun:

```javascript
import ChatbotCommander from 'chatbot-commander'

const commander = new ChatbotCommander('!') // Set the command prefix to '!'

// Registers a command
commander.register({command: 'test'}, (input, attrs) => {
console.log(input) // outputs 'foo'
})

commander.handle('!test foo')
```