diff --git a/test/test-http-POST.js b/test/test-http-POST.js new file mode 100644 index 0000000..1032606 --- /dev/null +++ b/test/test-http-POST.js @@ -0,0 +1,21 @@ +// ag-0.de: # /opt/node-v10.23.1-linux-x86/bin/node WWW/software/wclbot +CleverBot = { + ask : function (line,cb) { + http.POST(CleverBot.url,{ + say:line, + session:CleverBot.session, + context:CleverBot.context + }, function (response) { + // console.log(response); + CleverBot.session=response.session; + CleverBot.context.push(line); CleverBot.context.push(response.answer); + cb(response.answer) + }); + }, + context : [], + reset : function () { CleverBot.session=null;CleverBot.context=[] }, + session : null, + url : 'http://ag-0.de:12121', +} +print('Asking cleverbot: Who are you? Answer:'); +CleverBot.ask('Who are you?',print);