18 lines
486 B
TypeScript
18 lines
486 B
TypeScript
export async function getRobloxFollowerCount(): Promise<number | null> {
|
|
const userId = process.env.ROBLOX_USER_ID;
|
|
if (!userId) return null;
|
|
|
|
try {
|
|
const res = await fetch(
|
|
`https://friends.roblox.com/v1/users/${encodeURIComponent(userId)}/followers/count`,
|
|
{ next: { revalidate: 3600 }, signal: AbortSignal.timeout(5000) }
|
|
);
|
|
if (!res.ok) return null;
|
|
|
|
const data = await res.json();
|
|
return data.count ?? null;
|
|
} catch {
|
|
return null;
|
|
}
|
|
}
|