bug nebrija rae

This commit is contained in:
yago 2014-11-22 21:23:48 +01:00
parent a1f5c7c9fa
commit 5657663c63
2 changed files with 7 additions and 4 deletions

View File

@ -68,7 +68,7 @@
-- print("Trying", text, "against", pattern)
matches = { string.match(text, pattern) }
if matches[1] then
print(" matches!!!!!")
print(" matches",pattern)
result = desc.run(msg, matches)
print(" sending", result)
if (result) then

View File

@ -2,7 +2,8 @@
function getDulcinea( text )
-- Powered by https://github.com/javierhonduco/dulcinea
local api = "http://dulcinea.herokuapp.com/api/?query="
b = http.request(api..text)
local query_url = api..text
b = http.request(query_url)
dulcinea = json:decode(b)
if dulcinea.status == "error" then
return "Error: " .. dulcinea.message
@ -12,9 +13,11 @@ function getDulcinea( text )
b = http.request(api..text)
dulcinea = json:decode(b)
end
vardump(dulcinea)
local text = ""
local responses = #dulcinea.response
if responses == 0 then
return "Error: 404 word not found"
end
if (responses > 5) then
responses = 5
end
@ -29,8 +32,8 @@ function getDulcinea( text )
text = text .. meaning .. "\n\n"
end
end
print (text)
return text
end
function run(msg, matches)