- TypeScript 99%
- CSS <1%
- HTML <1%
- Docker <1%
Superbot #
A hosted chat bot for Streamplace, the AT Protocol livestreaming site. It covers what Fossabot does for Twitch, rebuilt on the AT Protocol (atproto):
- Commands: custom commands, 44 built-ins, counters, and Fossabot-compatible
$(variables). - Keywords and timers: keywords with phrase groups and shared
var:variables; timers that rotate messages and skip their turn when chat is quiet. - Moderation:
- Blocked terms with regex, word boundaries, lookalikes, warnings, repeat-offender escalation and expiry.
- 14 spam filters: caps, links, one-man spam, unique chat, zalgo, emoji, other languages, thread length, message height, malware links, and more.
- Nukes, plus ban and timeout management.
- Chat alerts: go live, stream ended, title and activity changes, new Bluesky followers, and incoming and outgoing teleports.
- Community: giveaways, loyalty (watchtime) and media requests (YouTube and SoundCloud, with a player and a public queue).
- Modules: 8-ball, emoji combos, pyramids, quotes, vote kick, and Bluesky post alerts.
- Integrations: Discord go-live notifications, Last.fm, teal.fm, an outgoing webhook, and an API key for running commands from a Stream Deck button (
GET /api/hooks/command?key=…&command=…). - Team and tooling:
- Roles and permissions: Streamplace moderators get access automatically, and custom roles cover everyone else.
- A configuration tester, lookalikes, shareable presets, import/export, and an audit log.
How it works on the AT Protocol #
| Reading chat | One websocket per channel to the Streamplace node (/api/websocket/<did>), carrying chat, livestream changes, viewer counts and teleports. |
| Posting | The bot is a normal atproto account (labeled bot in its place.stream.chat.profile). It posts place.stream.chat.message records to its own repo. |
| Moderating | The streamer signs in with atproto OAuth and grants scopes for four moderation collections. Superbot then writes records into the streamer's repo: • app.bsky.graph.block (bans and timeouts)• place.stream.chat.gate (hidden messages)• place.stream.chat.pinnedRecord• place.stream.livestream (title and activity) |
| Chatting from the dashboard | The chat box posts place.stream.chat.message from the signed-in person's own account, through their OAuth session. Everyone who signs in, moderators included, grants repo:place.stream.chat.message for this. The bot account is never used for it. |
| Public config | Commands, timers, quotes, built-in command settings, chat alerts and module messages are gay.evil.superbot.* records in the streamer's repo. Public presets and lookalike sets are records in their author's repo. See Public records. |
| Timeouts | Streamplace has no timeout primitive, so a timeout is a block plus a scheduled unblock. While it lasts, it's a real Bluesky block. |
| Follows and posts | Two Jetstream subscriptions: app.bsky.graph.follow for follow alerts, and filtered app.bsky.feed.post for post alerts. |
| Roles | Streamplace badges (streamer, mod, vip), place.stream.moderation.permission records, and Bluesky follows. |
Research notes are in research/: Fossabot reference screenshots and docs notes, and Streamplace protocol notes.
Public records #
Anything viewers can see anyway is published to its owner's atproto repo, and the repo is the source of truth. Lexicons are in lexicons/.
| Collection | Key | In whose repo |
|---|---|---|
gay.evil.superbot.command |
TID | streamer |
gay.evil.superbot.timer |
TID | streamer |
gay.evil.superbot.quote |
TID | streamer |
gay.evil.superbot.builtinCommand |
built-in id (quote, uptime…) |
streamer |
gay.evil.superbot.chatAlerts |
self |
streamer |
gay.evil.superbot.module |
eightball, combo, pyramid, bskyposts, votekick |
streamer |
gay.evil.superbot.preset |
preset id | author (public presets only) |
gay.evil.superbot.lookalike |
set id | author (public sets only) |
Keywords, variables, blocked terms, spam filters, roles, integrations, and everything about viewers (watchtime, giveaways, the media queue, logs) stay on the Superbot server.
How syncing works:
- Saving: a change applies to the bot right away and goes into an outbox (
record_outbox). The outbox writes it to the owner's repo through their OAuth session. If the session is missing the scope, the change waits, and the dashboard asks the owner to reconnect. - Reading: a Jetstream subscription and a reconcile on startup (and every 6 hours) apply changes made anywhere else, such as in another app, deletions included. A local change still in the outbox wins, because it's newer.
- Deleting a preset or lookalike record: this unpublishes it. Superbot keeps a private copy.
- Removing a channel from Superbot: the records stay in the repo. Signing in again restores the channel from them.
- Roles: they're private, so records name built-in roles (
moderator,vip…) and leave custom role ids opaque. - Fractions: atproto has no floats, so fractions are whole percentages (
similarityPercent,multiplierPercent).
To make the lexicons resolvable, run node --env-file=.env scripts/publish-lexicons.ts. It writes them as com.atproto.lexicon.schema records in the bot account. Then add the DNS TXT record it prints, at _lexicon.superbot.evil.gay.
Running it locally #
Requires Node 24 or later and pnpm.
pnpm install
cp .env.example .env # fill in BOT_IDENTIFIER and BOT_APP_PASSWORD
pnpm dev # API on :8787, dashboard on http://127.0.0.1:5173
Open http://127.0.0.1:5173 and sign in with your Bluesky handle. In development the OAuth client is a loopback client, so no keys are needed. Use 127.0.0.1, not localhost.
To work on the dashboard without OAuth, set DEV_LOGIN=1 BOT_ENABLED=0 and visit /auth/dev-login?handle=demo.test. This only works on a non-production, loopback-only server.
pnpm test # engine + pipeline tests (vitest)
pnpm typecheck
Deploying #
Pushes to main build an image on tangled's hosted spindle and publish it to atcr.io/superbot.evil.gay/superbot. The TrueNAS app pulls new images by itself. See deploy/README.md for the pipeline and one-time setup.
To run the image anywhere else, set:
PUBLIC_URLBOT_IDENTIFIER,BOT_APP_PASSWORD- a volume on
/data
The server creates its session secret and OAuth signing key in /data on first boot. You can override them with SESSION_SECRET and OAUTH_PRIVATE_JWK.
If a user's PDS doesn't support granular scopes yet, set OAUTH_SCOPE="atproto transition:generic".
Optional:
YOUTUBE_API_KEYenables!srsearch and length limits.LASTFM_API_KEYenables$(lastfm).$(tealfm)needs no key.
Rate limits #
Every message the bot sends is a record write to its PDS. Hosted bsky.social accounts allow roughly 1,600 record creations an hour. To serve many channels, run the bot account on your own PDS and set BOT_PDS_URL. The per-channel send gap (Channel settings) also throttles output.
Layout #
lexicons/ gay.evil.superbot.* record lexicons
src/shared/ zod schemas for all config, permissions, built-in commands, variable docs
src/server/ Hono API, OAuth, SQLite store, Streamplace + Jetstream clients
records/ publishing public config to atproto repos and syncing it back
bot/ per-channel runtime: moderation, commands, keywords, timers, alerts, modules
bot/engine/ pure logic: phrase matching, lookalikes, templates/variables, filters, roles
src/web/ React dashboard, landing page, public command list and media queue
test/ engine and pipeline tests against a fake platform
Not affiliated with Streamplace, Bluesky or Fossabot.