From 42884ff67b0512501fcb849012ea23c3277de603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoffer=20M=C3=BCller=20Madsen?= Date: Mon, 21 Mar 2016 18:10:55 +0100 Subject: [PATCH] add different emoji-reactions --- np-bot.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/np-bot.js b/np-bot.js index 92a3f1c..9cc340b 100644 --- a/np-bot.js +++ b/np-bot.js @@ -44,6 +44,8 @@ function incrementKey(id, key, amount, scope) { } controller.hears(["np"],["direct_message","direct_mention","mention","ambient"],function(bot,message) { + var react_emoji = ""; + console.log(message.user + " mentioned \"np\""); // Increment the logged amount of mentions @@ -74,6 +76,7 @@ controller.hears(["np"],["direct_message","direct_mention","mention","ambient"], // Reply with the chosen problem bot.reply(message,"Have you heard about the _" + title + "_? That is an NP-complete problem!\nSee " + base_url + wiki_title + " for more info!"); last_index = index; + react_emoji = "raised_hands"; } else { bot.say( { @@ -81,13 +84,14 @@ controller.hears(["np"],["direct_message","direct_mention","mention","ambient"], channel: message.channel } ); + react_emoji = "clap"; } // React with appropriate emoji bot.api.reactions.add({ timestamp: message.ts, channel: message.channel, - name: "raised_hands", + name: react_emoji, },function(err, res) { if (err) { bot.botkit.log('Failed to add reaction emoji');