Improvements and fix

This commit is contained in:
Tiago Danin
2016-04-26 23:37:55 +00:00
parent 86c290eb17
commit 63ce836326
23 changed files with 77 additions and 76 deletions

View File

@@ -27,22 +27,22 @@ local action = function(msg)
local url = 'http://api.biblia.com/v1/bible/content/ASV.txt?key=' .. config.biblia_api_key .. '&passage=' .. URL.escape(input)
local message, res = HTTP.request(url)
local output, res = HTTP.request(url)
if not message or res ~= 200 or message:len() == 0 then
if not output or res ~= 200 or output:len() == 0 then
url = 'http://api.biblia.com/v1/bible/content/KJVAPOC.txt?key=' .. config.biblia_api_key .. '&passage=' .. URL.escape(input)
message, res = HTTP.request(url)
output, res = HTTP.request(url)
end
if not message or res ~= 200 or message:len() == 0 then
message = config.errors.results
if not output or res ~= 200 or output:len() == 0 then
output = config.errors.results
end
if message:len() > 4000 then
message = 'The text is too long to post here. Try being more specific.'
if output:len() > 4000 then
output = 'The text is too long to post here. Try being more specific.'
end
sendReply(msg, message)
sendMessage(msg.chat.id, output, true, msg.message_id, true)
end