0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-04 10:39:43 +08:00
discourse/plugins/discourse-narrative-bot/lib
Régis Hanol f00dfb922a
FIX: Use bundled quotes for discobot instead of dead external API (#40367)
The discobot `quote` and `help` commands fetched a random quote from the
external `api.forismatic.com` service for English locales. That host now
returns HTTP 521, so `QuoteGenerator.generate` (which calls Excon with
`expects: [200, 201]`) raised and crashed the `bot_input` job, leaving
users with no reply. `roll` and `fortune` kept working because they run
locally, and non-English locales were unaffected because they already
used bundled quotes.

This removes the external call entirely and samples from the locally
bundled quotes for the user's effective locale — the same data already
shipped for translations — so the commands work without any network
dependency and can no longer fail silently. Sampling over every
available quote also surfaces entries that the previous `rand(1..10)`
never reached.

Adds a `QuoteGenerator` unit spec and a `bot_input` job spec covering
the no-network reply path and error propagation.

Ref - t/184527
2026-05-28 17:37:29 +02:00
..
discourse_narrative_bot FIX: Use bundled quotes for discobot instead of dead external API (#40367) 2026-05-28 17:37:29 +02:00