Created
June 13, 2021 09:25
-
-
Save skippednote/a1d33a4b546aad0dd55f2b6f17f58d7d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { WebClient } from "@slack/web-api"; | |
const token = process.env.SLACK_TOKEN; | |
const client = new WebClient(token); | |
async function main() { | |
try { | |
const { users } = await client.usergroups.users.list({ | |
usergroup: "S0DG3F3FD", | |
}); | |
const usersInfo = await Promise.all( | |
users!.map((user) => client.users.profile.get({ user })) | |
); | |
const a = usersInfo | |
.map(({ profile }) => ({ | |
name: profile!.real_name, | |
image: profile!.image_192, | |
})) | |
.map(({ name, image }) => `<li>${name}</li>`) | |
.join(""); | |
console.log(a); | |
} catch (e) { | |
console.error(e); | |
} | |
} | |
main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment