diff --git a/commands/woo.js b/commands/woo.js index 71315f3..2674b5f 100755 --- a/commands/woo.js +++ b/commands/woo.js @@ -2,13 +2,13 @@ var mooTracker = {}; -module.exports = function moo(controller) { - controller.hears('woo', ['direct_mention'], function(bot, message) { +module.exports = function woo(controller) { + controller.hears('woo-channel', ['direct_mention'], function(bot, message) { bot.api.reactions.add({ timestamp: message.ts, channel: message.channel, - name: 'moo', + name: 'woo', }, function(err, res) { if (err) { bot.botkit.log('Failed to add emoji reaction :(', err); @@ -16,27 +16,37 @@ module.exports = function moo(controller) { }); var okayToSend = true; - var thirtyMinutes = 30 * 60000; // 60000 being the number of milliseconds in a minute - var now = new Date(); - var thirtyMinutesAgo = new Date(now - thirtyMinutes); var lastVisit = mooTracker[message.channel]; - if (lastVisit) { + var thirtyMinutes = 30 * 60000; // 60000 being the number of milliseconds in a minute + var now = new Date(); + var thirtyMinutesAgo = new Date(now - thirtyMinutes); if (lastVisit > thirtyMinutesAgo) { okayToSend = false; } } - if (okayToSend) { + if(okayToSend) { mooTracker[message.channel] = new Date(); - for (var i = 0; i < 5; i++) { + for(var i=0; i < 5; i++) { setTimeout(function () { - bot.reply(message, { - text: ' :moo: /woo ^^' - // icon_emoji: ':cow:' - }); + bot.reply(message, ':woo: woo!!!!!'); }, i * 2000); } } }); + + controller.hears('woo', ['direct_mention'], function(bot, message) { + + bot.api.reactions.add({ + timestamp: message.ts, + channel: message.channel, + name: 'woo', + }, function(err, res) { + if (err) { + bot.botkit.log('Failed to add emoji reaction :(', err); + } + }); + bot.reply(message, 'WOOOOOOOO!!!!!!!!!! :woo:'); + }); }