import { numberFormatter } from './number-formatter' ; export async function getDiscordMembers ( ) { let count = 5100 ; 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 ) { console . log ( 'Failed to get discord members count: ' , error . toString ( ) ) ; } return { count , prettyCount : numberFormatter . format ( count ) , } ; }