A combined Discord presence (Lanyard-style) and profile/badges (dstn.to-style) API on a single Cloudflare Worker + Durable Object, powered by one Discord bot. It exposes a REST endpoint and a Lanyard-compatible WebSocket, returning a single unified JSON shape.
Go to file
Clove bbf8422d85 feat: add theme_colors/display_name_styles and make profile fetching rate-limit resilient (cache-first + merge, 429 cooldown, token rotation, client fingerprint) 2026-06-19 19:54:26 +01:00
scripts feat: add theme_colors/display_name_styles and make profile fetching rate-limit resilient (cache-first + merge, 429 cooldown, token rotation, client fingerprint) 2026-06-19 19:54:26 +01:00
src feat: add theme_colors/display_name_styles and make profile fetching rate-limit resilient (cache-first + merge, 429 cooldown, token rotation, client fingerprint) 2026-06-19 19:54:26 +01:00
.dev.vars.example Add a second user token (thanks Claude) 2026-06-19 19:04:43 +01:00
.gitignore first commit 2026-06-18 21:39:44 +01:00
README.md feat: add theme_colors/display_name_styles and make profile fetching rate-limit resilient (cache-first + merge, 429 cooldown, token rotation, client fingerprint) 2026-06-19 19:54:26 +01:00
package.json feat: add theme_colors/display_name_styles and make profile fetching rate-limit resilient (cache-first + merge, 429 cooldown, token rotation, client fingerprint) 2026-06-19 19:54:26 +01:00
pnpm-lock.yaml updates 2026-06-19 16:04:20 +01:00
pnpm-workspace.yaml updates 2026-06-19 16:04:20 +01:00
tsconfig.json first commit 2026-06-18 21:39:44 +01:00
wrangler.jsonc feat: add theme_colors/display_name_styles and make profile fetching rate-limit resilient (cache-first + merge, 429 cooldown, token rotation, client fingerprint) 2026-06-19 19:54:26 +01:00

README.md

dough-restful

A combined Discord presence (Lanyard-style) and profile/badges (dstn.to-style) API on a single Cloudflare Worker + Durable Object, powered by one Discord bot. It exposes a REST endpoint and a Lanyard-compatible WebSocket, returning a single unified JSON shape.

Thanks

This code wasn't just me. It took a good chunk of my own brain plus a lot of help from Dustin (@dstn.to), who was really generous explaining how he handles the tricky parts: rate limits, caching, and getting Discord to actually trust your requests. Thanks Dustin! And credit to Phineas for Lanyard, which inspired the presence half of this.

Setup

1. Settings

  1. https://discord.com/developers/applicationsNew ApplicationBot.
  2. Reset Token, copy it (this is DISCORD_BOT_TOKEN).
  3. Under Privileged Gateway Intents, enable PRESENCE INTENT and SERVER MEMBERS INTENT.
  4. Invite the bot to a server that contains the people you want to track (OAuth2 URL generator → scope bot). Presence is only visible for users sharing a server with the bot — same model as Lanyard.
  5. Optionally set TRACKED_GUILD_IDS in wrangler.jsonc (comma-separated) to limit monitoring to specific servers; empty = every guild the bots can see.

2. Commands

# REQUIRED
pnpm install

# KV namespace for profile cache — paste the printed id into wrangler.jsonc
pnpx wrangler kv namespace create PROFILE_CACHE

# Secrets
pnpx wrangler secret put DISCORD_BOT_TOKEN
# Optional, ToS risk — only if you want the rich badges:
pnpx wrangler secret put DISCORD_USER_TOKEN
# Optional second userbot
pnpx wrangler secret put DISCORD_USER_TOKEN2

# If you need to update the X-Super-Properties to latest version
pnpm decode "X-Super-Properties: [BASE64 HERE]"pnpm

# Local test
pnpm dev

# Production
pnpm deploy