File size: 444 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { numberFormatter } from "./number-formatter"

export async function getDiscordMembers() {
  let count = 5_100 // Fallback if there's any error

  try {
    const data = await fetch(
      "https://discord.com/api/v9/invites/chakra-ui?with_counts=true",
    ).then((res) => res.json())

    count = data.approximate_member_count
  } catch (error) {
    //
  }

  return {
    count,
    prettyCount: numberFormatter.format(count),
  }
}