discordjs/rest

how to fetch all guilds at once? (its returning only 200)
export async function getBotGuildsService() {
    const now = Date.now();

    // Check if we need to refresh the cache
    if (now - guildsCache.lastFetchTime > CACHE_TTL) {
        try {
            await rest.get(Routes.userGuilds()).then(response=> {
                guildsCache.data = response as PartialGuild[]
            });

            guildsCache.lastFetchTime = now;
        } catch (error) {
            console.error('Error fetching guilds:', error);
            throw error;
        }
    }

    return guildsCache.data;
}
Was this page helpful?