This commit is contained in:
dupie 2015-07-05 12:14:41 -04:00
parent 968448cc21
commit 21f8e10147

View File

@ -1,3 +1,5 @@
-- shout-out to @luksi_reiku for showing me this site
local PLUGIN = {} local PLUGIN = {}
PLUGIN.triggers = { PLUGIN.triggers = {
@ -9,7 +11,7 @@ function PLUGIN.action(msg)
local input = get_input(msg.text) local input = get_input(msg.text)
local url = 'http://www.simsimi.com/requestChat?lc=es&ft=1.0&req=' .. URL.escape(input) local url = 'http://www.simsimi.com/requestChat?lc=en&ft=1.0&req=' .. URL.escape(input)
local jstr, res = HTTP.request(url) local jstr, res = HTTP.request(url)
@ -23,6 +25,13 @@ function PLUGIN.action(msg)
jdat.res = "I don't know what to say to that." jdat.res = "I don't know what to say to that."
end end
-- Let's clean up the response a little. Capitalization & punctuation.
local message = jdat.res:gsub('simsimi', 'clive')
local message = message:gsub("^%l", string.upper)
if not string.match(message, '%p$') then
message = message .. '.'
end
send_message(msg.chat.id, jdat.res) send_message(msg.chat.id, jdat.res)
end end