subreddit-announcer/CLAUDE.md

1.8 KiB

Project: subreddit-announcer

A Discord bot that announces new Reddit posts. A long-running discord.py process polls each watched subreddit's /new on an interval and posts an embed to the mapped Discord channel for every previously-unseen submission. Reddit access is read-only via asyncpraw; state is a local SQLite DB. Subreddits are managed at runtime with slash commands.

Working agreement

  • This is a git repo with origin on Forgejo at https://git.rdx4.com/megaproxy/subreddit-announcer.git (private). HTTPS auth uses the token in ~/.git-credentials — pushes are non-interactive.
  • Commit after each logical change with a one-line imperative message; git push after each commit (or at minimum before ending the session).
  • Read memory.md at session start. Update it before ending the session.
  • Never commit secrets — see .gitignore and the rules in ~/claude/CLAUDE.md.

Project-specific notes

  • Runtime: Python ≥3.10, managed with uv (pyproject.toml + uv.lock). Deps: discord.py, asyncpraw. Run with uv run bot.py.
  • Config: environment variables (see config.example.env). Real secrets (DISCORD_TOKEN, REDDIT_CLIENT_*) live in config.env, which is gitignored. Load before running: set -a; source config.env; set +a; uv run bot.py.
  • Data: announcer.db (SQLite) is created on first run and gitignored. Tables: watches (subreddit→channel + bootstrapped flag) and seen_posts (dedup, pruned to 500/subreddit).
  • Bootstrap behaviour: a newly-watched subreddit is silently baselined — existing /new posts are marked seen, not announced. Only posts created after the watch starts are announced. Re-watching resets the flag.
  • No privileged intents — the bot only posts, never reads message content.
  • No tests yet. Syntax check: uv run python -m py_compile bot.py.