We’re editing the quotes provided by the default narrative bot by searching down from the following:
/admin/customize/site_texts?q=discourse_narrative_bot.quote
We’ve edited the authors and quotes for the 10 quotes, but we are finding that the quotes are not changing when we use a ‘discobot quote’ command.
We’ve tried restarting the app, and then when that didn’t work rebuilding the container but we can’t get them to change. When we ask for a quote it provides the old quotes author/text, even though we have edited them all.
Is there another setting we need to change? Thanks for any help.
We are on v2.3.0.beta4 +20
Ah, looks like we’ve misunderstood what those fields are for. It uses an external API to get the quotes, not local settings. That’s a shame.
When you’re using the english locale, Discobot fetches the quotes from an external API http://api.forismatic.com/api/1.0/ which is only available in English. As a work around for other languages, we added 10 generic quotes so that they can be translated and used by the other locales.
4 Mi Piace
Just temporarily we altered the switch here, and it works great. Obviously not a great way to do it, but thought it might help others in the future.
require 'excon'
module DiscourseNarrativeBot
class QuoteGenerator
API_ENDPOINT = 'http://api.forismatic.com/api/1.0/'.freeze
def self.generate(user)
quote, author =
if user.effective_locale != 'en'
translation_key = "discourse_narrative_bot.quote.#{rand(1..10)}"
[
I18n.t("#{translation_key}.quote"),
I18n.t("#{translation_key}.author")
]
else
connection = Excon.new("#{API_ENDPOINT}?lang=en&format=json&method=getQuote")
response = connection.request(expects: [200, 201], method: :Get)
4 Mi Piace
system
(system)
Chiuso
12 Aprile 2019, 2:20am
4
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.