0.0.1 • Published 7 years ago

botstation v0.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

Botstation

Botstation is a tiny framework made to build your own chatbot fast.

Installation

npm install --save botstation

Usage

var Botstation = require('botstation');
var bot = new Botstation.Bot();

bot.config({
    key: 'xoxb-157105193143-eJdSjJRttSCU2DAd3IdAtBoi',
    name: 'Dat Bot'
});

bot.task({
    name: "Help",
    matcher: "isMessage",
    content: "!help",
    exec: (bot, data, params) => {
        bot.postMessage(data.channel, 'Do you need help?', params);
    }
});

bot.start(() => {
    console.log('Bot started!');
});

Matchers

You can configure tasks to match in several ways with incoming messages:

  • isMessage: Checks if the incoming message is strictly equal to the specified content
  • beginWith: Checks if an incoming message begins with the specified content string
  • isJoining: Looks for channel joining events in incoming messages, so the bot can advertise itself