63 lines
2.1 KiB
Plaintext
63 lines
2.1 KiB
Plaintext
{
|
|
// dough-restful — Discord presence + profile API on one Worker.
|
|
// Docs: https://developers.cloudflare.com/workers/wrangler/configuration/
|
|
"$schema": "node_modules/wrangler/config-schema.json",
|
|
"name": "dough-restful",
|
|
"main": "src/index.ts",
|
|
"compatibility_date": "2024-09-23",
|
|
"account_id": "f87ee4b9600f437b8da1104d077418c3",
|
|
// nodejs_compat is not required; we only use Web/Workers APIs.
|
|
"observability": {
|
|
"enabled": true
|
|
},
|
|
// ---- Durable Object: single instance holds the Discord gateway socket ----
|
|
"durable_objects": {
|
|
"bindings": [
|
|
{
|
|
"name": "GATEWAY",
|
|
"class_name": "GatewayManager"
|
|
}
|
|
]
|
|
},
|
|
"migrations": [
|
|
{
|
|
"tag": "v1",
|
|
"new_sqlite_classes": [
|
|
"GatewayManager"
|
|
]
|
|
}
|
|
],
|
|
// ---- KV: cache for profile/badge data (not available over the gateway) ----
|
|
// Create with: wrangler kv namespace create PROFILE_CACHE
|
|
// then paste the returned id below.
|
|
"kv_namespaces": [
|
|
{
|
|
"binding": "PROFILE_CACHE",
|
|
"id": "0ad7fefa9239482a9028c820e4a0cec1"
|
|
}
|
|
],
|
|
// ---- Cron: nudge the Durable Object so the gateway stays connected ----
|
|
"triggers": {
|
|
"crons": [
|
|
"*/2 * * * *"
|
|
]
|
|
},
|
|
// Non-secret vars. Secrets (tokens) are set via `wrangler secret put`.
|
|
"vars": {
|
|
// v9 matches what the web client actually uses; v9/v10 are interchangeable
|
|
// for the user/profile endpoints. Matching the client = more "trustworthy".
|
|
"DISCORD_API_VERSION": "9",
|
|
// Comma-separated guild IDs the bot is in that you want monitored.
|
|
// Leave empty to monitor every guild the bot can see.
|
|
"TRACKED_GUILD_IDS": "",
|
|
// Profile freshness window (seconds). Profiles change rarely and the
|
|
// user-token /profile route is heavily rate-limited, so keep this long.
|
|
// Presence stays live via the gateway regardless of this value.
|
|
"PROFILE_CACHE_TTL_SECONDS": "1800",
|
|
// Current Discord client build number, sent in X-Super-Properties so the
|
|
// user-token /profile calls get the client's gentler rate limits. Keep it
|
|
// reasonably current — grab the latest from your client's devtools
|
|
// (look for "client_build_number") and bump this when it drifts.
|
|
"DISCORD_CLIENT_BUILD_NUMBER": "565311"
|
|
}
|
|
} |