mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
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:
@ -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
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user