tangled
alpha
login
or
join now
dunkirk.sh
/
hackatime-bot
0
fork
atom
providing password reset services for a long while: circa 2025
0
fork
atom
overview
issues
pulls
pipelines
feat: add command
Kieran Klukas
1 year ago
c5b8a18f
e797eceb
+61
-14
4 changed files
expand all
collapse all
unified
split
features
command.ts
example.ts
index.ts
manifest.yaml
+50
features/command.ts
···
1
1
+
import { slackApp } from "../index";
2
2
+
3
3
+
const command = async () => {
4
4
+
slackApp.command("/hackatime", async ({ context, payload }) => {
5
5
+
context.respond({
6
6
+
response_type: "ephemeral",
7
7
+
text: "Hi there! I'm the Hackatime bot :hyper-dino-wave:",
8
8
+
blocks: [
9
9
+
{
10
10
+
type: "section",
11
11
+
text: {
12
12
+
type: "mrkdwn",
13
13
+
text: "Hi there! I'm the Hackatime bot :hyper-dino-wave:",
14
14
+
},
15
15
+
},
16
16
+
{
17
17
+
type: "section",
18
18
+
text: {
19
19
+
type: "mrkdwn",
20
20
+
text: "I can see that you don't have an account yet. Do you want me to make you one?",
21
21
+
},
22
22
+
},
23
23
+
{
24
24
+
type: "actions",
25
25
+
elements: [
26
26
+
{
27
27
+
type: "button",
28
28
+
text: {
29
29
+
type: "plain_text",
30
30
+
text: "Yes, please!",
31
31
+
},
32
32
+
value: "yes",
33
33
+
style: "primary",
34
34
+
},
35
35
+
{
36
36
+
type: "button",
37
37
+
text: {
38
38
+
type: "plain_text",
39
39
+
text: "No, thanks",
40
40
+
},
41
41
+
value: "no",
42
42
+
},
43
43
+
],
44
44
+
},
45
45
+
],
46
46
+
});
47
47
+
});
48
48
+
};
49
49
+
50
50
+
export default command;
-9
features/example.ts
···
1
1
-
import { slackApp } from "../index";
2
2
-
3
3
-
const example = async () => {
4
4
-
slackApp.action("example_action", async ({ context, payload }) => {
5
5
-
console.log("Example Action", payload);
6
6
-
});
7
7
-
};
8
8
-
9
9
-
export default example;
+1
-1
features/index.ts
···
1
1
-
export { default as example } from "./example";
1
1
+
export { default as command } from "./command";
+10
-4
manifest.yaml
···
6
6
bot_user:
7
7
display_name: hackatime
8
8
always_online: true
9
9
+
slash_commands:
10
10
+
- command: /hackatime
11
11
+
url: https://casual-renewing-reptile.ngrok-free.app/slack
12
12
+
description: manage your hackatime account!
13
13
+
should_escape: true
9
14
oauth_config:
10
15
scopes:
11
16
bot:
17
17
+
- channels:join
12
18
- channels:read
13
19
- chat:write
14
20
- chat:write.public
15
15
-
- channels:join
21
21
+
- commands
16
22
- users.profile:read
17
23
- users:read
24
24
+
- users:read.email
18
25
settings:
19
19
-
event_subscriptions:
26
26
+
interactivity:
27
27
+
is_enabled: true
20
28
request_url: https://casual-renewing-reptile.ngrok-free.app/slack
21
21
-
bot_events:
22
22
-
- channel_created
23
29
org_deploy_enabled: false
24
30
socket_mode_enabled: false
25
31
token_rotation_enabled: false