From 36b5232fd42fe3d26c2c67d676cdaa65ba8b832a Mon Sep 17 00:00:00 2001 From: Jordan Stubblefield Date: Wed, 26 Apr 2017 21:27:48 -0400 Subject: [PATCH] Give woo command justice :enter Rick Flair: --- commands/woo.js | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) 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:'); + }); }