mirror of
https://github.com/discourse/discourse.git
synced 2026-08-04 10:39:43 +08:00
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 |
||
|---|---|---|
| .. | ||
| bot_input_spec.rb | ||
| send_default_welcome_message_spec.rb | ||