Add try methods to response, update readme
This commit is contained in:
parent
e6d0779ee7
commit
7d614ea4bd
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
||||||
node_modules
|
node_modules
|
||||||
|
.idea
|
|
@ -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)
|
19
index.js
19
index.js
|
@ -34,14 +34,31 @@ _.assign(SlashCommand.prototype, {
|
||||||
this._generalReply();
|
this._generalReply();
|
||||||
this.res.end(message);
|
this.res.end(message);
|
||||||
},
|
},
|
||||||
|
tryReplyUser: function(message) {
|
||||||
|
if (this.hasReplied)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
this.replyUser(message);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
/* TODO
|
||||||
replyChannel: function () {
|
replyChannel: function () {
|
||||||
this._generalReply();
|
this._generalReply();
|
||||||
this.res.end();
|
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;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -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": {
|
||||||
|
|
Loading…
Reference in a new issue