From cf2a7ca85b69648492a6e1296fb99598ffc80315 Mon Sep 17 00:00:00 2001 From: Akamaru Date: Sat, 18 Feb 2017 22:41:23 +0100 Subject: [PATCH] =?UTF-8?q?Cleverbot:=20F=C3=BChre=20Konversationen=20weit?= =?UTF-8?q?er=20(by=20@Brawl345)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- miku/plugins/cleverbot.lua | 12 +++++++++++- miku/plugins/getfile.lua | 3 +-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/miku/plugins/cleverbot.lua b/miku/plugins/cleverbot.lua index 86c341f..209730a 100644 --- a/miku/plugins/cleverbot.lua +++ b/miku/plugins/cleverbot.lua @@ -16,7 +16,16 @@ local apikey = cred_data.cleverbot_apikey -- get your key here: https://www.clev function cleverbot:action(msg, config, matches) utilities.send_typing(msg.chat.id, 'typing') local text = matches[1] - local query, code = https.request(BASE_URL..'?key='..apikey..'&input='..URL.escape(text)) + local hash = get_redis_hash(msg, 'cleverbot') + + local state = redis:get(hash) + + if not state then + query, code = https.request(BASE_URL..'?key='..apikey..'&input='..URL.escape(text)) + else + query, code = https.request(BASE_URL..'?key='..apikey..'&input='..URL.escape(text)..'&cs='..state) + end + if code ~= 200 then utilities.send_reply(msg, config.errors.connection) return @@ -28,6 +37,7 @@ function cleverbot:action(msg, config, matches) return end + redis:set(hash, data.cs) utilities.send_reply(msg, data.output) end diff --git a/miku/plugins/getfile.lua b/miku/plugins/getfile.lua index 8b13165..4ddaf23 100644 --- a/miku/plugins/getfile.lua +++ b/miku/plugins/getfile.lua @@ -1,5 +1,4 @@ --- YOU NEED THE FOLLOWING FOLDERS: photo, document, video, voice --- PLEASE ADJUST YOUR PATH BELOW +-- YOU NEED THE FOLLOWING FOLDERS IN YOUR SAVE PATH: photo, document, video, voice, audio, sticker local media_download = {}