Removed module projects because it can't work like that atm. Commented out package commands.

This commit is contained in:
Master Kwoth
2017-10-15 09:39:46 +02:00
parent 90e71a3a30
commit 696a0eb2a7
180 changed files with 21625 additions and 1058 deletions

View File

@ -0,0 +1,33 @@
using Newtonsoft.Json;
using System.Net.Http;
using System.Threading.Tasks;
namespace NadekoBot.Modules.Games.Common.ChatterBot
{
public class OfficialCleverbotSession : IChatterBotSession
{
private readonly string _apiKey;
private string _cs = null;
private string queryString => $"https://www.cleverbot.com/getreply?key={_apiKey}" +
"&wrapper=nadekobot" +
"&input={0}" +
"&cs={1}";
public OfficialCleverbotSession(string apiKey)
{
this._apiKey = apiKey;
}
public async Task<string> Think(string input)
{
using (var http = new HttpClient())
{
var dataString = await http.GetStringAsync(string.Format(queryString, input, _cs ?? "")).ConfigureAwait(false);
var data = JsonConvert.DeserializeObject<CleverbotResponse>(dataString);
_cs = data?.Cs;
return data?.Output;
}
}
}
}