-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
32 lines (28 loc) · 1.03 KB
/
index.js
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
// create a bot
const bot = require('./bot');
const handler = require('./handler');
const params = {
icon_emoji: ':speaker:',
};
bot.on('start', function() {
// more information about additional params https://api.slack.com/methods/chat.postMessage
// var params = {
// icon_emoji: ':speaker:',
// };
// define channel, where bot exist. You can adjust it there https://my.slack.com/services
// bot.postMessageToChannel('general', 'meow!', params);
// // define existing username instead of 'user_name'
// bot.postMessageToUser('user_name', 'meow!', params);
//
// // If you add a 'slackbot' property,
// // you will post to another user's slackbot channel instead of a direct message
// bot.postMessageToUser('user_name', 'meow!', { slackbot: true, icon_emoji: ':cat:' });
//
// // define private group instead of 'private_group', where bot exist
// bot.postMessageToGroup('private_group', 'meow!', params);
});
bot.on('message', function(data) {
// all ingoing events https://api.slack.com/rtm
console.log(data);
handler(data);
});