Skip to content

Commit 18d856a

Browse files
author
Foxlet
committed
Base Version.
1 parent a99b32a commit 18d856a

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

plugins/chatbot_new.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
"""
2+
chatbot.py
3+
4+
Ask Cleverbot something via CloudBot!
5+
6+
Created By:
7+
- Foxlet <http://furcode.tk/>
8+
9+
License:
10+
GNU General Public License (Version 3)
11+
"""
12+
13+
from cloudbot import hook
14+
import requests
15+
import urllib.parse
16+
import hashlib
17+
import collections
18+
19+
SESSION = collections.OrderedDict()
20+
API_URL = "http://www.cleverbot.com/webservicemin/"
21+
22+
@hook.onload()
23+
def init_vars():
24+
SESSION['stimulus'] = ""
25+
SESSION['start'] = 'y'
26+
SESSION['icognoid'] = 'wsf'
27+
SESSION['fno'] = '0'
28+
SESSION['sub'] = 'Say'
29+
SESSION['islearning'] = '1'
30+
SESSION['cleanslate'] = 'false'
31+
32+
@hook.command()
33+
def cb_think(text):
34+
SESSION['stimulus'] = text
35+
payload = urllib.parse.urlencode(SESSION)
36+
digest = hashlib.md5(payload[9:35].encode('utf-8')).hexdigest()
37+
target_url = "{}&icognocheck={}".format(payload, digest)
38+
print(target_url)
39+
parsed = requests.post(API_URL, data=target_url)
40+
data = parsed.text.split('\r')
41+
print(data)

0 commit comments

Comments
 (0)