Initial scaffold: Discord subreddit-announcer bot

This commit is contained in:
megaproxy 2026-06-04 19:16:31 +01:00
commit 705c6ba9f7
8 changed files with 1715 additions and 0 deletions

29
config.example.env Normal file
View file

@ -0,0 +1,29 @@
# subreddit-announcer configuration.
# Copy this to `config.env` and fill in real values. `config.env` is gitignored —
# never commit it. Load it before running, e.g.:
# set -a; source config.env; set +a; uv run bot.py
# --- Discord ---------------------------------------------------------------
# Bot token from https://discord.com/developers/applications
# Application -> Bot -> Reset Token. Invite the bot with the
# "applications.commands" + "bot" scopes and "Send Messages" + "Embed Links".
DISCORD_TOKEN=
# --- Reddit (read-only app) ------------------------------------------------
# Create an app at https://www.reddit.com/prefs/apps -> "create another app"
# type: "script" (or "installed app")
# the client id is the string under the app name; the secret is "secret".
REDDIT_CLIENT_ID=
REDDIT_CLIENT_SECRET=
# Reddit asks user agents be descriptive and include a contact handle.
REDDIT_USER_AGENT=discord:subreddit-announcer:1.0 (by /u/megaproxy)
# --- Behaviour (optional; sensible defaults) -------------------------------
# Seconds between poll sweeps. Lower = faster announcements, more API calls.
ANNOUNCER_POLL_INTERVAL=60
# Posts pulled from each subreddit's /new per sweep.
ANNOUNCER_FETCH_LIMIT=25
# Path to the SQLite state DB (created on first run).
# ANNOUNCER_DB=announcer.db
# Logging level: DEBUG, INFO, WARNING, ERROR.
ANNOUNCER_LOGLEVEL=INFO