- JavaScript 100%
dicesprite #
Standalone atproto bot account for House Dice -- dicesprite.bsky.social.
Genuinely separate from dicestreak-atproto-alpha. That project is
a frontend-only static site, bundled and served with no backend at all.
This is the opposite: a small, continuously-running Node.js process
that logs in with its own credentials and talks to atproto directly.
Different shape of project, different repo, on purpose.
The game: dice-chestahedron-guess #
A 1-7 guessing game, themed around a chestahedron (a real, documented seven-faced solid). Players guess a number 1-7; the bot determines the true roll and reveals it. The rotating chestahedron visual itself is entirely a FRONTEND concern, out of scope for this repo -- this project only ever needs to track entries, guesses, and the true roll as plain numbers.
Two separate record types, matching their different real lifecycles:
com.pyxorium.dicesprite.entry-- membership. "I'm participating in this game." Written once, rarely changes.com.pyxorium.dicesprite.numGuess-- a per-round pick. Written fresh (or updated) each round.
Formal atproto Lexicon schemas for both live in lexicons/.
Current scope: real discovery, combined with the round-loop #
This does not yet implement the real game fully (no reward payout,
no always-on hosting, and the listener currently only watches the
numGuess collection -- see "Known gaps" below). It proves the core
mechanism working end-to-end:
listener.jsconnects to the live Bluesky network via Jetstream, watches for anyone writing tocom.pyxorium.dicesprite.numGuess, and maintains a localentries.jsonfile of every account discovered (DID, first-seen timestamp, guess value). Excludes the bot's own DID (BOT_DIDin.env), so the bot never counts itself as a player.index.jsreads that sameentries.jsonevery round, generates a fresh 1-7 roll only after that read completes, then reveals and compares against every discovered entry. That "read first, generate only after" ordering is the whole integrity mechanism this project is built around -- the roll provably doesn't exist yet while entries are still being read.
Both need to be running at the same time, in separate terminals, for
this to do anything real. index.js alone has nothing to read until
listener.js has actually discovered something.
Known gaps, deliberately not fixed yet:
listener.jsonly watches thenumGuesscollection right now, notentry. The two-record-type design is real and the lexicons exist, but the listener hasn't been extended to track membership yet --write-test-entry.jswrites a realentryrecord, but nothing is currently watching for it.- Live runtime validation against the formal lexicon schemas isn't
wired in yet.
@atproto/lex's real workflow is CLI-driven (lex install <published-lexicon-id>, generating code from already-published lexicons) -- using it against our own brand-new, never-published NSIDs needs more exploration than fit in this pass. The lexicon JSON files are correct and real, just not yet enforced by code at write/read time. - Network Replay (backfilling writes from before the listener started)
is available in
@bsky/jetstreambut not needed yet -- no real game exists yet for anyone to have written entries for. - Always-on hosting, real reward payout: not built.
Setup #
npm install
cp .env.example .env
Edit .env and fill in:
- The bot's real app password (
BOT_PASSWORD, generated in Bluesky account settings -- never the account's real login password). - An alt/test account's own handle and app password
(
ALT_HANDLE/ALT_PASSWORD), used only by the twowrite-test-*scripts to simulate a real player.
BOT_DID and BOT_HANDLE are already filled in with real values --
no need to change those.
Run #
Terminal one -- the listener, watching the live network:
npm run listen
Terminal two -- the round-loop, reading whatever the listener has discovered so far:
npm start
Terminal three (as needed) -- simulate a real player, since the regular Bluesky app has no way to write a custom-lexicon record like this:
npm run write-test-guess
npm run write-test-guess -- 5 # optional guess value, 1-7, defaults to 3
npm run write-test-entry
npm run write-test-entry -- withdrawn # optional status, defaults to "active"
With listener.js running, write-test-guess should show up in
terminal one within a few seconds (a new discovered entry), and the
very next round in terminal two will include it in the roll comparison.
write-test-entry writes real data too, but nothing currently watches
for it (see "Known gaps" above).
Why @bsky/jetstream, not @skyware/jetstream #
Checked directly (not assumed): @skyware/jetstream is archived and
predates Jetstream v2/Network Replay entirely. @bsky/jetstream is the
current, first-party client. Uses the library's simple live() path
rather than its own LexIndexer, since LexIndexer requires a formal
lexicon schema object loaded through its own tooling, which is real,
separate follow-on work (see "Known gaps" above).