bug nebrija rae
This commit is contained in:
parent
a1f5c7c9fa
commit
5657663c63
@ -68,7 +68,7 @@
|
|||||||
-- print("Trying", text, "against", pattern)
|
-- print("Trying", text, "against", pattern)
|
||||||
matches = { string.match(text, pattern) }
|
matches = { string.match(text, pattern) }
|
||||||
if matches[1] then
|
if matches[1] then
|
||||||
print(" matches!!!!!")
|
print(" matches",pattern)
|
||||||
result = desc.run(msg, matches)
|
result = desc.run(msg, matches)
|
||||||
print(" sending", result)
|
print(" sending", result)
|
||||||
if (result) then
|
if (result) then
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
function getDulcinea( text )
|
function getDulcinea( text )
|
||||||
-- Powered by https://github.com/javierhonduco/dulcinea
|
-- Powered by https://github.com/javierhonduco/dulcinea
|
||||||
local api = "http://dulcinea.herokuapp.com/api/?query="
|
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)
|
dulcinea = json:decode(b)
|
||||||
if dulcinea.status == "error" then
|
if dulcinea.status == "error" then
|
||||||
return "Error: " .. dulcinea.message
|
return "Error: " .. dulcinea.message
|
||||||
@ -12,9 +13,11 @@ function getDulcinea( text )
|
|||||||
b = http.request(api..text)
|
b = http.request(api..text)
|
||||||
dulcinea = json:decode(b)
|
dulcinea = json:decode(b)
|
||||||
end
|
end
|
||||||
vardump(dulcinea)
|
|
||||||
local text = ""
|
local text = ""
|
||||||
local responses = #dulcinea.response
|
local responses = #dulcinea.response
|
||||||
|
if responses == 0 then
|
||||||
|
return "Error: 404 word not found"
|
||||||
|
end
|
||||||
if (responses > 5) then
|
if (responses > 5) then
|
||||||
responses = 5
|
responses = 5
|
||||||
end
|
end
|
||||||
@ -29,8 +32,8 @@ function getDulcinea( text )
|
|||||||
text = text .. meaning .. "\n\n"
|
text = text .. meaning .. "\n\n"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
print (text)
|
||||||
return text
|
return text
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function run(msg, matches)
|
function run(msg, matches)
|
||||||
|
Reference in New Issue
Block a user