-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
106 lines (97 loc) · 2.3 KB
/
app.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
const { App } = require("@slack/bolt");
const { getMeme, getWaifu } = require("./calls.js");
//dotenv config
const dotenv = require("dotenv");
dotenv.config();
// Initializes your app with your bot token and signing secret
const app = new App({
token: process.env.SLACK_BOT_TOKEN,
signingSecret: process.env.SLACK_SIGNING_SECRET,
socketMode: true,
appToken: process.env.SLACK_APP_TOKEN,
});
// Listens to incoming messages
//will only catch msgs starting with "yukino"
app.message(/^yukino hello/, async ({ message, say }) => {
await say(
`Hellowo <@${message.user}> san,\n type:'yukino help' for help b-d`
);
});
app.message(/^yukino meme/, async ({ message, say }) => {
const url = await getMeme();
await say({
blocks: [
{
type: "section",
text: {
type: "plain_text",
text: `your funny material, <@${message.user}> senpai`,
},
},
{
type: "image",
image_url: `${url}`,
alt_text: "hehe",
},
],
});
});
app.message(/^yukino waifu/, async ({ message, say }) => {
const url = await getWaifu();
await say({
blocks: [
{
type: "section",
text: {
type: "mrkdwn",
text: `presenting you today's waifu <@${message.user}> '~'`,
},
},
{
type: "image",
image_url: `${url}`,
alt_text: "kawaii",
},
],
});
});
app.message(/^yukino help/, async ({ message, say }) => {
// say() sends a message to the channel where the event was triggered
await say({
blocks: [
{
type: "section",
text: {
type: "mrkdwn",
text: `Here are all my commands, <@${message.user}> sama`,
},
},
{
type: "section",
text: {
type: "mrkdwn",
text: "make sure to call me by *writing my name first*",
},
},
{
type: "section",
text: {
type: "plain_text",
text: ">>meme: get a random anime meme UwU",
},
},
{
type: "section",
text: {
type: "plain_text",
text: ">>waifu: will show you a random waifu >.<",
},
},
],
});
});
(async () => {
// Start app
await app.start();
console.log("yukino chan is up and runnin");
})();