Neverending Package Mountain
Wondering what’s next for npm?Check out our public roadmap! »

easy-slack-botTypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

easy-slack-bot

Node.js based, modular Slack bot framework.

NPM Version Linux Build Windows Build Dependency Status devDependency Status Codecov coverage

INSTALLATION

$ npm install easy-slack-bot --save

EXAMPLE

See sample files in "example" directory.

USAGE

Simple index.js:

var SlackBot = require("easy-slack-bot"),
    BotItems = __dirname + "/items",
    BotOptions = {
        Slack: {
            SLACK_TOKEN: "slack-bot-token"
        }
    };
 
new SlackBot(BotItems, BotOptions);

Simple items/hello.js item:

module.exports = function( bot )
{
    // https://api.slack.com/methods/chat.postMessage
    var params = {
        icon_emoji: ':robot_face:'
    };
 
    return 
    {
        // Get message
        // https://rawgit.com/sipimokus/easy-slack-bot/master/docs/interfaces/islackbotsmessage.html
        // https://rawgit.com/sipimokus/easy-slack-bot/master/docs/interfaces/iitemsonmessagecallback.html
        message: function( message, callBack ) 
        {
            // Detecting word in message
            if ( message.natural.indexOf("hello") > -1 ) 
            {
                // Answer message
                callBack("Hello world!", params);
 
                return true;
            }
 
            return false;
        }
    };
};

DOCUMENTATION

Source code documentation find here.

Install

npm i easy-slack-bot

DownloadsWeekly Downloads

4

Version

0.2.0

License

GNU

Last publish

Collaborators

  • avatar