-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
36 lines (30 loc) · 902 Bytes
/
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
33
34
35
36
const Botkit = require("botkit");
const setupBotActions = require("./bot");
require("dotenv").config();
const controller = Botkit.slackbot({
json_file_store: "./db_slackbutton_slash_command/",
debug: false,
clientSigningSecret: process.env.CLIENT_SIGNING_SECRET
});
controller.configureSlackApp({
clientId: process.env.CLIENT_ID,
clientSecret: process.env.CLIENT_SECRET,
clientSigningSecret: process.env.CLIENT_SIGNING_SECRET,
scopes: ["commands", "bot"]
});
controller
.spawn({
token: process.env.BOT_TOKEN
})
.startRTM();
controller.setupWebserver(process.env.PORT, (err, webserver) => {
controller.createWebhookEndpoints(controller.webserver);
controller.createOauthEndpoints(controller.webserver, (err, req, res) => {
if (err) {
res.status(500).send(`ERROR: ${err}`);
} else {
res.send("Success!");
}
});
});
setupBotActions(controller);