Compare commits
1 commit
b650333bbc
...
86b5f31b06
Author | SHA1 | Date | |
---|---|---|---|
86b5f31b06 |
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,2 @@
|
|||
.env
|
||||
node_modules
|
||||
whitelist.json
|
|
@ -33,11 +33,3 @@ $ npm i
|
|||
```
|
||||
$ npx tsx .
|
||||
```
|
||||
|
||||
6. (Optional) Rename `whitelist.example.json` to `whitelist.json` and fill it with Slack User IDs who apart from admins/owners/primary owners should be able to view other people's verification.
|
||||
```json
|
||||
[
|
||||
"UA1B2C3D4E5",
|
||||
"U0123456789"
|
||||
]
|
||||
```
|
||||
|
|
14
index.ts
14
index.ts
|
@ -1,6 +1,6 @@
|
|||
import type { UsersInfoResponse } from "@slack/web-api";
|
||||
|
||||
const { App } = (await import("@slack/bolt"));
|
||||
const { App, ExpressReceiver } = (await import("@slack/bolt"));
|
||||
import "dotenv/config";
|
||||
|
||||
const app = new App({
|
||||
|
@ -8,21 +8,17 @@ const app = new App({
|
|||
signingSecret: process.env.SLACK_SIGNING_SECRET,
|
||||
});
|
||||
|
||||
const whitelist: string[] = (() => {
|
||||
try {
|
||||
return require('./whitelist.json')
|
||||
} catch (e) {
|
||||
return []
|
||||
}
|
||||
})();
|
||||
const whitelist: string[] = []
|
||||
|
||||
function checkUserOk(user: UsersInfoResponse['user']) {
|
||||
if (whitelist.includes(user!.id!)) return true
|
||||
|
||||
console.log(user)
|
||||
|
||||
return user!.is_admin || user!.is_owner || user!.is_primary_owner
|
||||
}
|
||||
|
||||
const eligibilityCmd = async (ctx: any) => {
|
||||
const eligibilityCmd = async ctx => {
|
||||
await ctx.ack();
|
||||
|
||||
const text = ctx.command.text.slice();
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
[
|
||||
|
||||
]
|
Loading…
Reference in a new issue