Cleverbot: Führe Konversationen weiter (by @Brawl345)
This commit is contained in:
parent
48e8c7e864
commit
cf2a7ca85b
@ -16,7 +16,16 @@ local apikey = cred_data.cleverbot_apikey -- get your key here: https://www.clev
|
|||||||
function cleverbot:action(msg, config, matches)
|
function cleverbot:action(msg, config, matches)
|
||||||
utilities.send_typing(msg.chat.id, 'typing')
|
utilities.send_typing(msg.chat.id, 'typing')
|
||||||
local text = matches[1]
|
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
|
if code ~= 200 then
|
||||||
utilities.send_reply(msg, config.errors.connection)
|
utilities.send_reply(msg, config.errors.connection)
|
||||||
return
|
return
|
||||||
@ -28,6 +37,7 @@ function cleverbot:action(msg, config, matches)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
redis:set(hash, data.cs)
|
||||||
utilities.send_reply(msg, data.output)
|
utilities.send_reply(msg, data.output)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
-- YOU NEED THE FOLLOWING FOLDERS: photo, document, video, voice
|
-- YOU NEED THE FOLLOWING FOLDERS IN YOUR SAVE PATH: photo, document, video, voice, audio, sticker
|
||||||
-- PLEASE ADJUST YOUR PATH BELOW
|
|
||||||
|
|
||||||
local media_download = {}
|
local media_download = {}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user