From c1e2d9dd9a89a170a71c0020bb9dd666ba72b3e0 Mon Sep 17 00:00:00 2001 From: Ashley Lamont Date: Wed, 30 Oct 2024 12:02:49 +1100 Subject: [PATCH] Quotes API is being weird --- src/quotes-server.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/quotes-server.ts b/src/quotes-server.ts index a995255..c054526 100644 --- a/src/quotes-server.ts +++ b/src/quotes-server.ts @@ -78,6 +78,7 @@ export function convertMessageToQuote( } export async function refreshQuotes() { + console.log("Refreshing quotes"); const quotesChannel = await globalThis.cssaGuild.channels.fetch( "1169166790094491678", ); @@ -88,13 +89,21 @@ export async function refreshQuotes() { } // Start fetching recent top-level messages let hitCachedMessage = false; - let messages = await quotesChannel.messages.fetch({ limit: 100 }); + let messages = await quotesChannel.messages.fetch({ + limit: 100, + cache: false, + }); while (!hitCachedMessage && messages.size > 0) { for (const message of messages.values()) { const quote = convertMessageToQuote(message); if (quote !== undefined) { if (quotes.has(message.id)) { + if (!hitCachedMessage) { + console.log("Hit cached message"); + } hitCachedMessage = true; + } else { + console.log("Adding new quote"); } quotes.set(message.id, quote); }