Dough Git

commit

m a o w

commit
f2cdfb8e08532fafcb4cc5cf1b666ede2364e4c4
author
Clove Twilight <[email protected]>
date
2026-08-01 16:04

diff --git a/src/apidata.ts b/src/apidata.ts
index 98ff332..67c063f 100644
--- a/src/apidata.ts
+++ b/src/apidata.ts
@@ -47,9 +47,6 @@ export const GROUPS: GroupDef[] = [
       { m: "GET", path: "/discord/users/:id", auth: "public",
         desc: "A user's full record in one call: profile (avatar, banner, badges, connected accounts, and — when available — bio, pronouns and reviews), the collectibles they have equipped (nameplate, profile frame, profile effect, avatar decoration — each resolved to its name and image assets), and their live presence (status, activities, Spotify, platforms). Fetched fresh on every request. Presence is null if the user shares no tracked server with the bot.",
         params: [["id", "Discord user ID."], ["?fresh / ?nocache / ?refresh", "Force fresh sub-resource lookups (collectibles/wishlist) instead of their short shared caches."]] },
-      { m: "GET", path: "/discord/users?ids=a,b,c", auth: "public",
-        desc: "The same full record for up to 100 users at once. Returns a map of user ID → record (or null if not found).",
-        params: [["ids", "Comma-separated Discord user IDs, max 100."]] },
       { m: "GET", path: "/discord/status", auth: "public",
         desc: "Live-presence connection health: whether it's connected, how many users are tracked, and recent reconnect activity." },
       { m: "GET", path: "/discord/guilds/:invite", auth: "public",
diff --git a/src/index.ts b/src/index.ts
index 0a7ac72..7ab4d9e 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -102,14 +102,6 @@ async function fetchPresence(env: Env, id: string): Promise<UnifiedPresence | nu
   return body.presence;
 }
 
-/** Every monitored presence in one Durable Object round-trip (used by the
- *  batch endpoint so N users cost one DO call instead of N). */
-async function fetchAllPresences(env: Env): Promise<Record<string, UnifiedPresence>> {
-  const res = await gatewayStub(env).fetch("https://do/presences");
-  if (!res.ok) return {};
-  return (await res.json()) as Record<string, UnifiedPresence>;
-}
-
 /** Merge REST profile + gateway presence into the unified record shape the
  *  website's presence cards consume (identical to the old /v1/users/:id). */
 function buildRecord(
@@ -391,28 +383,6 @@ export default {
       return json<UnifiedMinecraftHypixel>({ success: true, data });
     }
 
-    // ---- /v2/discord/users  (batch: merged profile + presence) -----------
-    // Full user record (profile + badges + live presence) in one round-trip:
-    // one DO call for all presences, profiles fetched in parallel (KV-cached).
-    if (path === "/v2/discord/users") {
-      const ids = parseIds(url);
-      const bad = validateIds(ids);
-      if (bad) return bad;
-
-      const force = wantsForce(url);
-      const [presences, profiles] = await Promise.all([
-        fetchAllPresences(env),
-        Promise.all(ids.map((id) => getProfile(env, id, ctx, force).catch(() => null))),
-      ]);
-
-      const data: Record<string, UnifiedRecord | null> = {};
-      ids.forEach((id, i) => {
-        const profile = profiles[i];
-        data[id] = profile ? buildRecord(profile, presences[id] ?? null) : null;
-      });
-      return json<Record<string, UnifiedRecord | null>>({ success: true, data });
-    }
-
     // ---- /v2/discord/users/:id  (merged profile + presence) --------------
     // Profile (REST) + presence (gateway) in parallel — the full user record
     // the website's presence cards render from.
@@ -461,31 +431,3 @@ function isInsecure(req: Request, url: URL): boolean {
   return false;
 }
 
-function parseIds(url: URL): string[] {
-  return Array.from(
-    new Set(
-      (url.searchParams.get("ids") || "")
-        .split(",")
-        .map((s) => s.trim())
-        .filter(Boolean),
-    ),
-  );
-}
-
-/** Returns an error Response if the id list is invalid, else null. */
-function validateIds(ids: string[]): Response | null {
-  if (!ids.length) {
-    return json(
-      { success: false, error: { code: "missing_ids", message: "Provide ?ids=comma,separated,snowflakes." } },
-      400,
-    );
-  }
-  if (ids.length > 100) {
-    return json({ success: false, error: { code: "too_many_ids", message: "Maximum 100 ids per request." } }, 400);
-  }
-  const bad = ids.find((id) => !ID_RE.test(id));
-  if (bad) {
-    return json({ success: false, error: { code: "invalid_id", message: `Not a Discord snowflake: ${bad}` } }, 400);
-  }
-  return null;
-}
diff --git a/src/openapi.ts b/src/openapi.ts
index 815914c..d62af20 100644
--- a/src/openapi.ts
+++ b/src/openapi.ts
@@ -61,7 +61,7 @@ function security(auth: EndpointDef["auth"]): JsonObj[] | undefined {
   }
 }
 
-/** "/discord/users?ids=a,b,c" → { path: "/discord/users", query: ["ids"] };
+/** "/guestbook?limit=50&offset=0" → { path: "/guestbook", query: ["limit","offset"] };
  *  ":param" segments become "{param}". */
 function normalizePath(raw: string): { path: string; query: string[]; pathParams: string[] } {
   const [pathPart, queryPart] = raw.split("?");