Add try methods to response, update readme

This commit is contained in:
Kegan Myers 2014-08-09 18:11:33 -05:00
parent e6d0779ee7
commit 7d614ea4bd
4 changed files with 24 additions and 6 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
node_modules node_modules
.idea

View file

@ -3,4 +3,4 @@ slack-command-router
This is a simple library that exposes both a way to add event handlers for slack commands, and connect middleware to This is a simple library that exposes both a way to add event handlers for slack commands, and connect middleware to
facilitate the simple addition of a slack command handler to any project. facilitate the simple addition of a slack command handler to any project.
This project is written as a standalone library, but primarily designed for use in `slack-command-server` This project is written as a standalone library, but primarily designed for use in [slack-command-server](https://github.com/terribly-lazy/slack-command-server)

View file

@ -34,14 +34,31 @@ _.assign(SlashCommand.prototype, {
this._generalReply(); this._generalReply();
this.res.end(message); this.res.end(message);
}, },
replyChannel: function () { tryReplyUser: function(message) {
this._generalReply(); if (this.hasReplied)
this.res.end(); return false;
this.replyUser(message);
return true;
}, },
/* TODO
replyChannel: function () {
this._generalReply();
this.res.end();
},*/
error: function (message) { error: function (message) {
this._generalReply(); this._generalReply();
this.res.writeHead(400); this.res.writeHead(400);
this.res.end(message); this.res.end(message);
},
tryError: function (message) {
if (this.hasReplied)
return false;
this.error(message);
return true;
} }
}); });

View file

@ -1,6 +1,6 @@
{ {
"name": "slack-command-router", "name": "slack-command-router",
"version": "0.0.0", "version": "0.0.1",
"description": "A slack slash command handler routing framework", "description": "A slack slash command handler routing framework",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {