Cleverbot: send_typing() und zusätzliches Pattern: ^Brawlbot, (.+)$"

This commit is contained in:
Andreas Bielawski 2016-08-14 00:47:18 +02:00
parent 5449bd3263
commit 8c747a27d7

View File

@ -2,7 +2,8 @@ local cleverbot = {}
function cleverbot:init(config)
cleverbot.triggers = {
"^/cbot (.*)$"
"^/cbot (.+)$",
"^[Bb]rawlbot, (.+)$",
}
cleverbot.doc = [[*
@ -14,6 +15,7 @@ cleverbot.command = 'cbot <Text>'
function cleverbot:action(msg, config)
local text = msg.text
local url = "https://brawlbot.tk/apis/chatter-bot-api/cleverbot.php?text="..URL.escape(text)
utilities.send_typing(self, msg.chat.id, 'typing')
local query = https.request(url)
if query == nil then utilities.send_reply(self, msg, 'Ein Fehler ist aufgetreten :(') return end
local decode = json.decode(query)