add different emoji-reactions

This commit is contained in:
Christoffer Müller Madsen 2016-03-21 18:10:55 +01:00
parent 5c9fa8b8fc
commit 42884ff67b

View File

@ -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');