Bible : Show Random Verse #2826
Bible : Show Random Verse #2826
Conversation
@MAMAMIA9 Hey! Thanks for taking the time to contribute! We really appreciate it. We work closely with every contributor to make Instant Answers the best they can be, so we appreciate your patience as we look over your code. From here, the process usually goes like this:
If you have any questions along the way, feel free to ask them here. Our staff and community are also available on Slack to answer any questions you may have. If you'd like to join us there please head to https://quackslack.herokuapp.com/ to get an invite.
Thanks! |
BibleDescription: Provides the text of selected Bible verses from the NET Bible translation. Example Query: [genesis 15:7](https://beta.duckduckgo.com/?q=genesis 15:7), [bible genesis 26:4](https://beta.duckduckgo.com/?q=bible genesis 26:4) Tab Name: Answer Source: These are the important fields from the IA page. Please check these for errors or missing information and update the IA page This is an automated message which will be updated as changes are made to the IA page |
@@ -12,6 +12,9 @@ spice to => 'http://labs.bible.org/api/?type=json&callback={{callback}}&formatti | |||
handle query_lc => sub { | |||
if ($_ =~ /^bible\s+([a-z]+\s*?[0-9]+:[0-9]+)$/i || $_ =~ /^((?:genesis|exodus|leviticus|numbers|deuteronomy|joshua|judges|ruth|1 samuel|2 samuel|1 kings|2 kings|1 chronicles|2 chronicles|ezra|nehemiah|esther|job|psalm|proverbs|ecclesiastes|song of solomon|isaiah|jeremiah|lamentations|ezekiel|daniel|hosea|joel|amos|obadiah|jonah|micah|nahum|habakkuk|zephaniah|haggai|zechariah|malachi|matthew|mark|luke|john|acts|romans|1 corinthians|2 corinthians|galatians|ephesians|philippians|colossians|1 thessalonians|2 thessalonians|1 timothy|2 timothy|titus|philemon|hebrews|james|1 peter|2 peter|1 john|2 john|3 john|jude|revelation)\s+[0-9]+:[0-9]+)$/) { | |||
return $1 if $1; | |||
} | |||
if ($_ =~ /^bible\s+(?:random|random verse)$/i){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please could you put a space between )
and {
@tagawa : is it necessary that @hunterlang give some input on this? |
@pnpninja Yes, I'm going to deploy to beta soon (there's currently a separate install in progress) and then we can test it - both the maintainer and community. |
@tagawa : sweet! thanks bro |
It's here on the beta server now: https://beta.duckduckgo.com/?q=bible+random+verse&ia=answer One thing I've noticed is that it would be good if it also appeared for |
Actually, maybe even |
@tagawa : we'll see what we can do... |
Added additional triggers
More triggers
Added additional tests for additional triggers that are getting accepted
@tagawa : added additional triggers and the tests... |
@tagawa : looking all good in the Beta 🤘🏼 |
Yay! |
One thing I've just noticed - with the query
|
Set signal to high to prevent some Fathead from triggering on `random bible verse` query
@tagawa : oh yea - i saw it... I think i've fixed it ... |
@@ -17,7 +17,8 @@ | |||
meta: { | |||
sourceName: 'Bible', | |||
sourceUrl: source_url, | |||
sourceIconUrl: 'http://bible.org/sites/bible.org/files/borg6_favicon.ico' | |||
sourceIconUrl: 'http://bible.org/sites/bible.org/files/borg6_favicon.ico', | |||
signal: 'high' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, you were right first time. This should be above the meta
object, next to id
, name
, etc. Sorry!
Thanks @pnpninja - this works for me now. How about you? |
@tagawa - yup ! it works |
@MAMAMIA9 @pnpninja: @zekiel noticed that we're caching the API result (it's on by default for one hour). Did you have trouble with their API limits when you turned it off during testing? If so, could we try adding a line in
More info about caching: http://docs.duckduckhack.com/backend-reference/api-reference.html |
@tagawa - yes. sometimes, we get a 500 error.. I think its best we cache for 5 min.. I'll do it |
@gaulrobe We'd likely get a 500 error from the API if there's no caching, but then the user wouldn't see the error - just no IA would appear. So it's a choice between that or possible repeated IA content. What do we think is best? |
@tagawa could we refactor this IA to be two separate modules/tests? One for random verses, which isn't cached and the other for specific bible verses which can probably be cached for a long time. Is that something we can do here? |
@gaulrobe True. @moollaza What do you reckon? I think we have three options:
|
ping @moollaza |
@@ -14,6 +14,7 @@ | |||
id: 'bible', | |||
name: 'Answer', | |||
data: result, | |||
signal: 'high', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, OK. So for IAs that aren't appearing as the default tab but should be, we should set it internally instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup 👍
I don't understand why we're seeing any 500 responses? That seems like a bigger problem. Given the nature of the "Random Verse" IA -- I think it's best to make this into a separate IA. We shouldn't sacrifice the speed and caching of the existing IA to support the random Bible verses results. The alternative, a Random IA that is only random every 5 minutes will probably give the impression that it's broken. We will need to namespace them accordingly: e.g. |
@MAMAMIA9 @pnpninja Sorry but could we make this into a new Instant Answer after all? It can re-use the code you've written, and the regex would be a lot simpler. Also:
I think the test file and JS file are OK as they are. |
This PR is being closed due to inactivity. If you're still interested in finishing, please let me know and I'll gladly re-open it for you! |
Fixes #2820 - adds trigger to random and shows random verses
#2820
https://duck.co/ia/view/bible
@hunterlang