The weeb for the next gen discord boat - Wamellow
wamellow.com
bot
discord
1export interface TopggBot {
2 reviews: {
3 averageScore: number;
4 count: number;
5 };
6}
7
8export async function getReviews() {
9 const res = await fetch(`https://top.gg/api/bots/${process.env.NEXT_PUBLIC_CLIENT_ID}`, {
10 headers: {
11 authorization: process.env.TOPGG_TOKEN!
12 },
13 next: { revalidate: 60 * 60 }
14 });
15
16 if (!res.ok) {
17 return {
18 averageScore: 5,
19 count: 1
20 };
21 }
22
23 const bot = await res.json() as TopggBot;
24 return bot.reviews;
25}