sorashi / Cleverbot.Net

🤖 A .NET wrapper around the cleverbot.io API, easy to use, supports asynchronous requests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cleverbot.Net

NuGet GitHub issues GitHub stars GitHub forks Twitter

- CLEVERBOT.IO API IS CURRENTLY DOWN, see issues -

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.

Usage

  1. Create a Visual Studio .NET 4.5 solution and save it.
  2. In Visual Studio menu bar, go to Tools -> NuGet Package Manager -> Package Manager Console.
  3. Type Install-Package Cleverbot.Net and wait.
  4. 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");
    }
}

Asynchronous requests

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.");

About

🤖 A .NET wrapper around the cleverbot.io API, easy to use, supports asynchronous requests


Languages

Language:C# 100.0%