Looking for a fast way to use Cleverbot.io in your application? Do you hate dealing with HTTP requests? You found the right tool!
This project uses cleverbot.io.
- Create a Visual Studio .NET 4.5 solution and save it.
- In Visual Studio menu bar, go to
Tools -> NuGet Package Manager -> Package Manager Console
. - Type
Install-Package Cleverbot.Net
and wait. - Aquire your API credentials here.
Then create a CleverbotSession
and send anything:
var session = CleverbotSession.NewSession("apiUser", "apiKey");
var response = session.Send("Hello.");
A simple console client:
using System;
using Cleverbot.Net;
class Program
{
static void Main()
{
string message;
var session = CleverbotSession.NewSession("apiUser", "apiKey");
do {
Console.Write("Type your message: ");
message = Console.ReadLine();
Console.Write("Bot: ");
Console.WriteLine(session.Send(message));
} while (message.ToLower().Trim() != "exit");
}
}
This wrapper allows you to use the asynchronous functionality. Basically, you just await
the methods and add Async to the end of their names.
var session = await CleverbotSession.NewSessionAsync("apiUser", "apiKey");
var response = await session.SendAsync("Hello.");