-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.ts
More file actions
33 lines (28 loc) · 765 Bytes
/
index.ts
File metadata and controls
33 lines (28 loc) · 765 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
32
33
import { App } from "@slack/bolt";
const SLACK_APP_TOKEN = "<PASTE ME>";
const SLACK_BOT_TOKEN = "<PASTE ME>";
const app = new App({
appToken: SLACK_APP_TOKEN,
token: SLACK_BOT_TOKEN,
socketMode: true,
});
app.command("/admins", async ({ ack, client }) => {
const { members } = await client.users.list();
const admins = members!.filter((member) => member.is_admin);
await ack({
blocks: [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": `${admins.map((admin) => `@${admin.name}`).join(", ")}`
}
},
],
response_type: "ephemeral", // change to "in_channel" to make it visible to others
});
});
app.start().catch((error) => {
console.error(error);
process.exit(1);
});