27 lines
812 B
Lua
27 lines
812 B
Lua
do
|
|
|
|
function run(msg, matches)
|
|
local text = msg.text
|
|
local url = "http://nocf.andibi.tk/dl/chatter-bot-api/cleverbot.php?text="..URL.escape(text)
|
|
local query = http.request(url)
|
|
if query == nil then return 'Ein Fehler ist aufgetreten :(' end
|
|
local decode = json:decode(query)
|
|
local answer = string.gsub(decode.clever, "Ä", "Ä")
|
|
local answer = string.gsub(answer, "ä", "ä")
|
|
local answer = string.gsub(answer, "Ö", "Ö")
|
|
local answer = string.gsub(answer, "ö", "ö")
|
|
local answer = string.gsub(answer, "Ü", "Ü")
|
|
local answer = string.gsub(answer, "ü", "ü")
|
|
local answer = string.gsub(answer, "ß", "ß")
|
|
return answer
|
|
end
|
|
|
|
|
|
return {
|
|
description = "Chat mit CleverBot",
|
|
usage = "/cbot [Text]: Befragt den Cleverbot",
|
|
patterns = {"^/cbot (.*)$"},
|
|
run = run
|
|
}
|
|
|
|
end |