FIX: Use the quote generator in the example text

This way if a plugin customizes the quotes the example will match.
This commit is contained in:
Robin Ward
2019-10-16 13:40:05 -04:00
parent 48c1238492
commit a37dafdd4d
4 changed files with 13 additions and 4 deletions

View File

@ -6,6 +6,10 @@ module DiscourseNarrativeBot
class QuoteGenerator
API_ENDPOINT = 'http://api.forismatic.com/api/1.0/'.freeze
def self.format_quote(quote, author)
I18n.t('discourse_narrative_bot.quote.results', quote: quote, author: author)
end
def self.generate(user)
quote, author =
if !user.effective_locale.start_with?('en')
@ -23,7 +27,7 @@ module DiscourseNarrativeBot
[response_body["quoteText"].strip, response_body["quoteAuthor"].strip]
end
I18n.t('discourse_narrative_bot.quote.results', quote: quote, author: author)
format_quote(quote, author)
end
end
end

View File

@ -178,6 +178,7 @@ module DiscourseNarrativeBot
discobot_username: discobot_username,
dice_trigger: self.class.dice_trigger,
quote_trigger: self.class.quote_trigger,
quote_sample: DiscourseNarrativeBot::QuoteGenerator.generate(@user),
magic_8_ball_trigger: self.class.magic_8_ball_trigger
)}"
end