Skip to content

Commit

Permalink
Post a prelude message stating the author of a command before posting…
Browse files Browse the repository at this point in the history
… to IRC
  • Loading branch information
ekmartin committed Jun 22, 2015
1 parent 025bead commit 676d56f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ Bot.prototype.sendToIRC = function(message) {
var body = message.getBody();
var text;
if (this.isCommandMessage(body)) {
var prelude = 'Command sent from Slack by ' + user.name + ':';
this.ircClient.say(ircChannel, prelude);
text = body;
} else {
text = '<' + user.name + '> ' + body;
Expand Down
5 changes: 4 additions & 1 deletion test/bot.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ describe('Bot', function() {
};

this.bot.sendToIRC(message);
ClientStub.prototype.say.should.have.been.calledWith('#irc', text);
ClientStub.prototype.say.getCall(0).args.should.deep.equal([
'#irc', 'Command sent from Slack by testuser:'
]);
ClientStub.prototype.say.getCall(1).args.should.deep.equal(['#irc', text]);
});
});

0 comments on commit 676d56f

Please sign in to comment.