Skip to content
Browse files

Add botsnack command.

  • Loading branch information...
1 parent 6b05451 commit eccb48b3fd2eb0d31cb6705714fef003615bb143 @mythmon mythmon committed
Showing with 17 additions and 0 deletions.
  1. +17 −0 standup-irc.js
View
17 standup-irc.js
@@ -115,6 +115,11 @@ client.on('message', function(user, channel, msg) {
var cmd = commands[cmd_name] || commands['default'];
cmd(user, channel, msg, args);
} else {
+ // Special case for botsnack
+ if (msg.toLowerCase().trim() === 'botsnack') {
+ commands.botsnack(user, channel, msg, []);
+ return;
+ }
// If they didn't ask for a specific command, post a status.
commands.status(user, channel, msg, [channel, msg]);
}
@@ -158,6 +163,18 @@ var commands = {
});
},
+ 'botsnack': function(user, channel, message, args) {
+ var responses = [
+ 'Yummy!',
+ 'Thanks, ' + user + '!',
+ 'My favorite!',
+ 'Can I have another?',
+ 'Tasty!'
+ ];
+ var r = Math.floor(Math.random() * responses.length);
+ client.say(channel, responses[r]);
+ },
+
/* The default action. Return an error. */
'default': function(user, channel, message) {
client.say(channel, user + ": Wait, what?");

0 comments on commit eccb48b

Please sign in to comment.
Something went wrong with that request. Please try again.