-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
31 lines (24 loc) · 742 Bytes
/
main.js
File metadata and controls
31 lines (24 loc) · 742 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
const Discord = require("discord.js");
const netlify = require("./src/netlify");
const strapi = require("./src/strapi");
const nlp = require("./src/nlp");
const hakie = new Discord.Client();
require("dotenv").config();
hakie.on("message", async (msg) => {
if (!/^Hakie,\s/i.test(msg.content)) {
return;
}
const req = await nlp.process(msg.content);
const classification = req.classifications[0].intent;
switch (classification) {
case "article.reads":
await strapi.getArticleReads(msg);
break;
case "release.build":
await netlify.triggerBuild(msg);
break;
default:
msg.reply(`I can't understand what you're saying!`);
}
});
hakie.login(process.env.BOT_TOKEN);