Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #17 from rehandalal/commenting

Add the comment command
  • Loading branch information...
commit 649ec01eda40070e5bde2e232254755e9315d668 2 parents e84676a + 7880d04
Mike Cooper mythmon authored
Showing with 25 additions and 1 deletion.
  1. +5 −1 api.js
  2. +20 −0 standup-irc.js
6 api.js
View
@@ -6,13 +6,17 @@ exports.status = {
* - `user`: The user that submitted the status.
* - `project`: The project associated with the status.
* - `content`: The text of the status.
+ * - `reply_to`: (Optional) The ID of the status being replied to
*/
- create: function(user, project, content) {
+ create: function(user, project, content, reply_to) {
var data = {
user: user,
content: content,
api_key: config.standup.api_key
};
+ if (reply_to) {
+ data.reply_to = reply_to;
+ }
if (project !== null) {
if (project[0] === '#') {
project = project.slice(1);
20 standup-irc.js
View
@@ -376,6 +376,25 @@ var commands = {
}
},
+ /* Comment on a status */
+ 're': {
+ help: "Comment on a status",
+ usage: "<id> <comment>",
+ func: function(user, channel, message, args) {
+ utils.ifAuthorized(user, channel, function() {
+ var response = api.status.create(user, null, args.slice(1).join(' '), parseInt(args[0]));
+
+ response.once('ok', function(data) {
+ utils.talkback(channel, user, 'Ok, commented on #' + args[0] + ' with #' + data.id);
+ });
+
+ response.once('error', function(err, data) {
+ utils.talkback(channel, user, 'Uh oh, something went wrong.');
+ });
+ });
+ }
+ },
+
/* Create a status. */
'status': {
usage: "<project> status message",
@@ -515,6 +534,7 @@ var commands = {
/* The default action. Return an error. */
'default': {
func: function(user, channel, message) {
+ logger.info('Invalid command: ' + message);
irc_client.say(channel, user + ': Huh? Try !help.');
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.