diff --git a/plugins/chatter.lua b/plugins/chatter.lua index cf36d6a..fafdc3c 100644 --- a/plugins/chatter.lua +++ b/plugins/chatter.lua @@ -1,3 +1,5 @@ + -- shout-out to @luksi_reiku for showing me this site + local PLUGIN = {} PLUGIN.triggers = { @@ -9,7 +11,7 @@ function PLUGIN.action(msg) 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) @@ -23,6 +25,13 @@ function PLUGIN.action(msg) jdat.res = "I don't know what to say to that." 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) end