Skip to content

feat: GatewayPresence — keep .curtBot Online (intents-0 gateway keep-alive) - #8

Merged
JordanNewell merged 1 commit into
mainfrom
gateway-presence
Dec 2, 2026
Merged

JordanNewell merged 1 commit into
mainfrom
gateway-presence

Conversation

@JordanNewell

Copy link
Copy Markdown
Contributor

Keeps .curtBot showing Online in the member list without a process anywhere.

A GatewayPresence Durable Object holds one outbound Discord gateway WebSocket with intents 0 — zero events, just the connection, handshake, and heartbeats. WebSocket Hibernation parks the socket at the Cloudflare edge and evicts the object between events; DO alarms wake it for heartbeats. A 5-minute cron trigger pings the DO /ensure endpoint as a self-healing backstop (reconnect with exponential backoff, 15-minute cooldown after fatal close codes like a bad token).

  • Commands path untouched — interactions still answer from the edge, zero external calls
  • Without DISCORD_TOKEN the DO never connects; commands keep working
  • New types are ambient in src/workers-types.d.ts — repo stays zero-dependency
  • wrangler.jsonc: DO binding + migration v1-presence + cron trigger
  • README: presence section, plus corrected secret notes (public key is a var since feat: ship DISCORD_PUBLIC_KEY as a plain var #7; DISCORD_TOKEN is now the only real Worker secret)

After merge: npx wrangler secret put DISCORD_TOKEN (once). Green dot within a minute of the deploy.

@JordanNewell
JordanNewell merged commit a377037 into main Dec 2, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant