arizuko › components › reditd
reditd is the Reddit channel adapter. It polls a configured list of subreddits plus the bot account’s inbox for new posts, mentions, and replies, posts them to gated, and sends outbound via the Reddit comment/submit API. JID prefix is reddit:; per-thing JIDs use Reddit’s fullname format (reddit:t1_<id> for comments, reddit:t3_<id> for posts).
Reddit is the only adapter on a platform with a true downvote primitive — everywhere else dislike degrades to a thumbs-down reaction or a textual reply. reditd is also where script-app OAuth lives: username + password against REDDIT_CLIENT_ID/SECRET, with cursor persistence in cursors.json so a restart doesn’t replay the inbox.
Reddit (oauth.reddit.com)
| poll: /r/<sub>/new.json + /message/inbox.json
v
reditd (LISTEN_ADDR=:8080)
| POST /v1/messages (signed by CHANNEL_SECRET)
v
gated
| POST /v1/send (callback to reditd)
v
reditd (POST /api/comment | /api/submit | /api/vote | /api/del | /api/editusertext)
|
v
Reddit
Wired verbs (reditd/client.go): send / reply (/api/comment), post (/api/submit kind=self), like (/api/vote dir=1), dislike (/api/vote dir=-1) — the only native dislike across all adapters — delete (/api/del), edit (/api/editusertext; self-posts + comments only). send_file, forward, quote, repost are 501-with-hint.
Inbound votes are not surfaced as like events. Reddit’s API only exposes aggregate score/ups on polled things, not discrete vote events; inbox.json covers replies / mentions / PMs only. The agent sees verb=message, reply, or post for inbound.
reditd is a plain Go binary. It needs a reachable gated and a Reddit script app with the bot account’s username + password.
export ROUTER_URL=http://gated:8080
export CHANNEL_SECRET=$(grep ^CHANNEL_SECRET .env | cut -d= -f2)
export LISTEN_ADDR=:8080
export REDDIT_CLIENT_ID=...
export REDDIT_CLIENT_SECRET=...
export REDDIT_USERNAME=mybot
export REDDIT_PASSWORD=...
export REDDIT_SUBREDDITS=arizuko_dev,programming
export REDDIT_USER_AGENT=arizuko/1.0
export DATA_DIR=/srv/data/arizuko_demo
./reditd
Reddit-side setup: old.reddit.com/prefs/apps → Create another app → script (not web app or installed app — script-app is what supports password grant). Set the redirect URI to anything; it’s unused. Copy client ID + secret. GET /health returns 503 when token refresh fails or the rate limit is saturated.
reditd/README.md — verb table, vote-event limitation.