add different emoji-reactions
This commit is contained in:
parent
5c9fa8b8fc
commit
42884ff67b
|
@ -44,6 +44,8 @@ function incrementKey(id, key, amount, scope) {
|
||||||
}
|
}
|
||||||
|
|
||||||
controller.hears(["np"],["direct_message","direct_mention","mention","ambient"],function(bot,message) {
|
controller.hears(["np"],["direct_message","direct_mention","mention","ambient"],function(bot,message) {
|
||||||
|
var react_emoji = "";
|
||||||
|
|
||||||
console.log(message.user + " mentioned \"np\"");
|
console.log(message.user + " mentioned \"np\"");
|
||||||
|
|
||||||
// Increment the logged amount of mentions
|
// Increment the logged amount of mentions
|
||||||
|
@ -74,6 +76,7 @@ controller.hears(["np"],["direct_message","direct_mention","mention","ambient"],
|
||||||
// Reply with the chosen problem
|
// 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!");
|
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;
|
last_index = index;
|
||||||
|
react_emoji = "raised_hands";
|
||||||
} else {
|
} else {
|
||||||
bot.say(
|
bot.say(
|
||||||
{
|
{
|
||||||
|
@ -81,13 +84,14 @@ controller.hears(["np"],["direct_message","direct_mention","mention","ambient"],
|
||||||
channel: message.channel
|
channel: message.channel
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
react_emoji = "clap";
|
||||||
}
|
}
|
||||||
|
|
||||||
// React with appropriate emoji
|
// React with appropriate emoji
|
||||||
bot.api.reactions.add({
|
bot.api.reactions.add({
|
||||||
timestamp: message.ts,
|
timestamp: message.ts,
|
||||||
channel: message.channel,
|
channel: message.channel,
|
||||||
name: "raised_hands",
|
name: react_emoji,
|
||||||
},function(err, res) {
|
},function(err, res) {
|
||||||
if (err) {
|
if (err) {
|
||||||
bot.botkit.log('Failed to add reaction emoji');
|
bot.botkit.log('Failed to add reaction emoji');
|
||||||
|
|
Loading…
Reference in New Issue
Block a user