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