-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdaisy-bot.js
More file actions
executable file
·37 lines (31 loc) · 977 Bytes
/
daisy-bot.js
File metadata and controls
executable file
·37 lines (31 loc) · 977 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
* Example bot, based on Botkit sample bot.
*
* Copy this file to create your own bot. Replace <YOUR_BOT_NAME> and <your_bot_name> below with your bot's name.
* Add the following to .env in this directory:
* SLACK_TOKEN_YOUR_BOT_NAME=<your_bot_slack_token>
*/
var botkit = require('botkit');
var dotenv = require('dotenv').load();
var os = require('os');
var util = require('./lib/util');
var BOTNAME = 'daisy';
var controller = botkit.slackbot({
json_file_store: './storage/' + BOTNAME,
debug: false,
});
var bot = controller.spawn({
token: process.env['SLACK_TOKEN_' + BOTNAME.toUpperCase()]
}).startRTM();
/* Start bot routes */
controller.hears(['.*'],'direct_message,direct_mention,mention',function(bot,message) {
bot.api.reactions.add({
timestamp: message.ts,
channel: message.channel,
name: 'dog2',
},function(err,res) {
if (err) {
bot.botkit.log("Failed to add emoji reaction :(",err);
}
});
});