This repository has been archived on 2021-04-24. You can view files and clone it, but cannot push or open issues or pull requests.
Mikubot/plugins/cleverbot.lua

27 lines
809 B
Lua
Raw Normal View History

2015-11-12 17:42:03 +01:00
do
function run(msg, matches)
local text = msg.text
2015-12-07 19:43:04 +01:00
local url = "https://andibi.tk/dl/chatter-bot-api/cleverbot.php?text="..URL.escape(text)
local query = https.request(url)
2015-11-12 17:42:03 +01:00
if query == nil then return 'Ein Fehler ist aufgetreten :(' end
local decode = json:decode(query)
local answer = string.gsub(decode.clever, "&Auml;", "<EFBFBD>")
local answer = string.gsub(answer, "&auml;", "<EFBFBD>")
local answer = string.gsub(answer, "&Ouml;", "<EFBFBD>")
local answer = string.gsub(answer, "&ouml;", "<EFBFBD>")
local answer = string.gsub(answer, "&Uuml;", "<EFBFBD>")
local answer = string.gsub(answer, "&uuml;", "<EFBFBD>")
local answer = string.gsub(answer, "&szlig;", "<EFBFBD>")
return answer
end
return {
description = "Chat mit CleverBot",
usage = "#cbot [Text]: Befragt den Cleverbot",
patterns = {"^#cbot (.*)$"},
2015-11-12 17:42:03 +01:00
run = run
}
end