forked from taboola/easy-peasy-bot
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathindex.js
More file actions
36 lines (30 loc) · 1007 Bytes
/
index.js
File metadata and controls
36 lines (30 loc) · 1007 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
/**
* A Bot for Slack!
*/
// Setting up custom integration
var customIntegration = require('./lib/custom_integrations');
var token = process.env.TOKEN;
var controller = customIntegration.configure(token);
// Handle events related to the websocket connection to Slack
controller.on('rtm_open', function (bot) {
console.log('** The RTM api just connected!');
});
controller.on('rtm_close', function (bot) {
console.log('** The RTM api just closed');
// you may want to attempt to re-open
});
/**
* bot logic goes here!
*/
// BEGIN EDITING HERE!
controller.hears('hello', 'direct_message', function (bot, message) {
bot.reply(message, 'Hello!');
});
// When your bot joins a channel, it announces it's presence. Spooky? I know!
controller.on('bot_channel_join', function (bot, message) {
bot.reply(message, "I'm here!")
});
/*
* You will be adding code to reply to different greetings, to reply to direct messages and mentions
* and finally to help your bot add reactions.
*/