Skip to content

simplify: use direct Discord API cron script - #8

Merged
MetzinAround merged 2 commits into
mainfrom
feat/sparkedhost-cron-digest
Jul 29, 2026
Merged

simplify: use direct Discord API cron script#8
MetzinAround merged 2 commits into
mainfrom
feat/sparkedhost-cron-digest

Conversation

@MetzinAround

@MetzinAround MetzinAround commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Use one short-lived Python script for the Sparked Host cron job
  • Fetch the existing blog and YouTube criteria, then post JSON embeds through Discord HTTP API
  • Remove discord.py/Gateway runtime, async runner, and unnecessary scheduling layers

Validation

  • 16 unit tests passing
  • Python compilation and diff checks passing

Run the blog and YouTube digests as a short-lived Python cron task instead of a persistent Discord bot. Remove Docker and unused background bot layers, and document the Sparked Host setup.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: d9ac8887-4080-4972-980e-45eabc93247b
Reduce the scheduled job to one Python entry point that fetches the configured blog and YouTube content and posts embeds through Discord's HTTP API.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: d9ac8887-4080-4972-980e-45eabc93247b
@MetzinAround MetzinAround changed the title refactor: simplify Discord digest cron job simplify: use direct Discord API cron script Jul 29, 2026
@MetzinAround
MetzinAround requested a review from Copilot July 29, 2026 21:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review details

Comments suppressed due to low confidence (4)

main.py:61

  • run_digest aborts on the first exception (e.g., blog fetch/post failure), so the YouTube digest will not be attempted. This contradicts the setup docs that say the process reports failure after attempting both sources, and it also reduces reliability (one source outage prevents the other digest from posting).
def run_digest(config: dict, token: str) -> None:
    now = datetime.now(tz=timezone.utc)
    since = now - timedelta(days=7)

    blog = config["blog"]

main.py:94

  • The YouTube branch should be isolated from failures in the blog branch, and vice-versa, so the job can attempt both digests and then fail if either one failed. Right now any YouTube exception (including YouTube API HttpError) aborts immediately and prevents the job from recording a combined failure outcome.
    youtube = config["youtube"]
    videos = YouTubeClient(os.environ["YOUTUBE_API_KEY"]).get_top_recent_videos(
        channel_id=youtube["channel_id"],
        published_after=since,
        top_n=int(youtube.get("digest_count", 3)),

README.md:12

  • The README still describes this as a continuously running “Discord bot” and says the “digest day” is configurable via config/config.yaml, but the refactor removes digest_day from config and runs as a short-lived cron script. This mismatch is confusing for new users and contradicts the updated cron-oriented bullets.
- ⏰ **Cron-ready** — runs once on Thursday, posts both digests, and exits; no continuously running process is required.
- 🔒 **Secure by default** — secrets live in `.env` (gitignored) or host environment variables; never in source control.
- ⚙️ **Configurable** — digest day, topics, channel IDs, and feed URL are all in `config/config.yaml`.

LOCAL_SETUP.md:60

  • This bullet says the process “logs in” and only posts when run on Thursday, but the new implementation doesn’t maintain a Gateway session/login and will post whenever main.py is invoked. This makes local expectations unclear.
- The process logs in, posts the configured digests when run on Thursday, and exits.
  • Files reviewed: 18/20 changed files
  • Comments generated: 0 new
  • Review effort level: Low

@MetzinAround
MetzinAround merged commit eaa2ec9 into main Jul 29, 2026
2 checks passed
@MetzinAround
MetzinAround deleted the feat/sparkedhost-cron-digest branch July 29, 2026 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants