Keep /bunny working without Reddit API dependency #585

Open
opened 2026-09-19 21:48:57 +01:00 by Smithy-bot · 1 comment
Member

Epic:
Story Points:


The /bunny command depends on random-bunny, which fetches anonymous Reddit JSON (https://reddit.com/r/{subreddit}/{sort}.json). Reddit is restricting that access, so the command is becoming unreliable.

Goal: keep /bunny returning a random rabbit image without relying on Reddit’s public/unauthenticated API.

Current behaviour

  • src/commands/bunny.ts picks a subreddit (rabbits, bunnieswithhats, buncomfortable, bunnytongues, dutchbunnymafia), calls randomBunny(subreddit, 'hot'), downloads the image, and embeds title / permalink / upvotes.
  • random-bunny (RabbitLabs package) has no OAuth; it only hits Reddit’s .json endpoints.

Options considered

  1. Third-party bunny API (simplest) — e.g. Rabbit API (GET /api/random) or bnuy-api. Replace random-bunny in the bot. Loses subreddit metadata; depends on third-party uptime/catalog.
  2. Self-host an image source (most durable) — run bnuy-api or a small image service on our infra. Full control; needs ops + image seeding/licensing.
  3. Reddit OAuth in random-bunny (stopgap) — keep the same UX (subreddits, titles, scores) via authenticated Reddit API. Still Reddit-dependent (keys, rate limits, policy risk).
  4. Stock image APIs — Unsplash / Pexels / Wikimedia with a rabbit query. Stable APIs but less community-bunny feel; keys + attribution required.

Recommendation from discussion: prefer option 1 or 2 for vylbot; treat OAuth in random-bunny as a delay, not a permanent fix. The command mainly needs a downloadable image URL.

Acceptance Criteria

GIVEN the bot is running without Reddit credentials or anonymous Reddit JSON access
WHEN a user runs /bunny
THEN they receive an embed with a rabbit/bunny image
AND the command does not call Reddit’s unauthenticated .json endpoints

GIVEN the image source is temporarily unavailable
WHEN a user runs /bunny
THEN the command fails gracefully with a clear error reply (no unhandled exception)

GIVEN a chosen non-Reddit source is adopted
WHEN the change is merged
THEN random-bunny is removed from vylbot-app dependencies if no longer used
AND tests for the bunny command are updated for the new source

Subtasks

  • Decide on source: third-party API vs self-hosted vs Reddit OAuth stopgap
  • Update src/commands/bunny.ts to use the chosen source
  • Adjust embed fields (title/footer/URL) for whatever metadata the new source provides
  • Update/remove random-bunny dependency as appropriate
  • Update bunny command tests
  • If self-hosting: stand up service + seed images + document ops
  • If changing random-bunny instead: track work in that repo and bump the package here

Notes

  • Related package: random-bunny @ RabbitLabs (also mirrored on Codeberg/npm)
  • Discord embed currently shows Reddit permalink and upvote count; those will need a replacement or simplification if leaving Reddit
  • Prefer not to scrape Reddit HTML as an alternative
Epic: Story Points: --- The `/bunny` command depends on `random-bunny`, which fetches anonymous Reddit JSON (`https://reddit.com/r/{subreddit}/{sort}.json`). Reddit is restricting that access, so the command is becoming unreliable. Goal: keep `/bunny` returning a random rabbit image without relying on Reddit’s public/unauthenticated API. ## Current behaviour - `src/commands/bunny.ts` picks a subreddit (`rabbits`, `bunnieswithhats`, `buncomfortable`, `bunnytongues`, `dutchbunnymafia`), calls `randomBunny(subreddit, 'hot')`, downloads the image, and embeds title / permalink / upvotes. - `random-bunny` (RabbitLabs package) has no OAuth; it only hits Reddit’s `.json` endpoints. ## Options considered 1. **Third-party bunny API (simplest)** — e.g. [Rabbit API](https://rabbit-api-two.vercel.app/docs) (`GET /api/random`) or [bnuy-api](https://git.scrunkly.cat/Michelle/bnuy-api). Replace `random-bunny` in the bot. Loses subreddit metadata; depends on third-party uptime/catalog. 2. **Self-host an image source (most durable)** — run bnuy-api or a small image service on our infra. Full control; needs ops + image seeding/licensing. 3. **Reddit OAuth in `random-bunny` (stopgap)** — keep the same UX (subreddits, titles, scores) via authenticated Reddit API. Still Reddit-dependent (keys, rate limits, policy risk). 4. **Stock image APIs** — Unsplash / Pexels / Wikimedia with a rabbit query. Stable APIs but less community-bunny feel; keys + attribution required. **Recommendation from discussion:** prefer option 1 or 2 for vylbot; treat OAuth in `random-bunny` as a delay, not a permanent fix. The command mainly needs a downloadable image URL. ## Acceptance Criteria GIVEN the bot is running without Reddit credentials or anonymous Reddit JSON access WHEN a user runs `/bunny` THEN they receive an embed with a rabbit/bunny image AND the command does not call Reddit’s unauthenticated `.json` endpoints GIVEN the image source is temporarily unavailable WHEN a user runs `/bunny` THEN the command fails gracefully with a clear error reply (no unhandled exception) GIVEN a chosen non-Reddit source is adopted WHEN the change is merged THEN `random-bunny` is removed from vylbot-app dependencies if no longer used AND tests for the bunny command are updated for the new source ## Subtasks - [ ] Decide on source: third-party API vs self-hosted vs Reddit OAuth stopgap - [ ] Update `src/commands/bunny.ts` to use the chosen source - [ ] Adjust embed fields (title/footer/URL) for whatever metadata the new source provides - [ ] Update/remove `random-bunny` dependency as appropriate - [ ] Update bunny command tests - [ ] If self-hosting: stand up service + seed images + document ops - [ ] If changing `random-bunny` instead: track work in that repo and bump the package here ## Notes - Related package: `random-bunny` @ RabbitLabs (also mirrored on Codeberg/npm) - Discord embed currently shows Reddit permalink and upvote count; those will need a replacement or simplification if leaving Reddit - Prefer not to scrape Reddit HTML as an alternative
Vylpes added this to the 3.5.0 milestone 2026-09-19 21:50:29 +01:00
Vylpes modified the milestone from 3.5.0 to 3.4.0 2026-09-19 21:50:31 +01:00
Author
Member

Option 1 source recommendation

For a hosted third-party API (option 1), prefer Rabbit API over bnuy-api.

  • Endpoint: GET https://rabbit-api-two.vercel.app/api/random
  • Docs: https://rabbit-api-two.vercel.app/docs
  • Example response:
    {
      "_id": "...",
      "breed": "hotot",
      "url": "https://firebasestorage.googleapis.com/...",
      "urlId": "4980879d"
    }
    
  • Pros:
    • Works today; returns a direct image URL (Firebase Storage)
    • Not Reddit-sourced content — cleaner break from Reddit
    • Simple JSON (breed, url, urlId) fits Discord embeds well
    • Public docs / landing page
  • Cons:
    • Small hobby project (Vercel + Firebase); no SLA — fine for option 1, not forever

bnuy-api (not preferred as the hosted default)

  • Endpoint: GET https://bnuy-api.scrunkly.cat/random
  • Example responses include Reddit-backed content, e.g.:
    {
      "url": "https://bnuy-api.scrunkly.cat/images/....jpeg",
      "source": "bunnies",
      "original_url": "https://i.redd.it/....jpeg"
    }
    
  • Pros:
    • Self-hostable (compose.yml + MariaDB) — better fit if we move to option 2
    • Has source / original_url for attribution
    • Rate limiting exists
  • Cons for hosted option 1:
    • Many images are still Reddit-derived (cached Reddit CDN originals)
    • Only avoids Reddit’s API, not Reddit as the content pipeline
    • Minimal public docs/landing; same single-operator reliability risk without cleaner metadata

Decision summary

Goal Prefer
Hosted third-party now (option 1) Rabbit API
Path to owning the source (option 2) bnuy-api (self-host / fork)

Caveat: if Rabbit API disappears later, fall back to self-hosting (option 2).

## Option 1 source recommendation For a **hosted** third-party API (option 1), prefer **Rabbit API** over bnuy-api. ### Rabbit API (recommended for option 1) - Endpoint: `GET https://rabbit-api-two.vercel.app/api/random` - Docs: https://rabbit-api-two.vercel.app/docs - Example response: ```json { "_id": "...", "breed": "hotot", "url": "https://firebasestorage.googleapis.com/...", "urlId": "4980879d" } ``` - Pros: - Works today; returns a direct image URL (Firebase Storage) - Not Reddit-sourced content — cleaner break from Reddit - Simple JSON (`breed`, `url`, `urlId`) fits Discord embeds well - Public docs / landing page - Cons: - Small hobby project (Vercel + Firebase); no SLA — fine for option 1, not forever ### bnuy-api (not preferred as the hosted default) - Endpoint: `GET https://bnuy-api.scrunkly.cat/random` - Example responses include Reddit-backed content, e.g.: ```json { "url": "https://bnuy-api.scrunkly.cat/images/....jpeg", "source": "bunnies", "original_url": "https://i.redd.it/....jpeg" } ``` - Pros: - Self-hostable (`compose.yml` + MariaDB) — better fit if we move to **option 2** - Has `source` / `original_url` for attribution - Rate limiting exists - Cons for hosted option 1: - Many images are still Reddit-derived (cached Reddit CDN originals) - Only avoids Reddit’s *API*, not Reddit as the content pipeline - Minimal public docs/landing; same single-operator reliability risk without cleaner metadata ### Decision summary | Goal | Prefer | |------|--------| | Hosted third-party now (option 1) | **Rabbit API** | | Path to owning the source (option 2) | **bnuy-api** (self-host / fork) | Caveat: if Rabbit API disappears later, fall back to self-hosting (option 2).
Vylpes added this to the 3.3 Sprint 9 project 2026-09-23 18:39:13 +01:00
Vylpes self-assigned this 2026-09-24 13:23:12 +01:00
Vylpes removed their assignment 2026-09-25 12:31:03 +01:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
RabbitLabs/vylbot-app#585
No description provided.