NBot is a "port" of git hub's Hubot but targeted at the .NET platform. It acts as a messaging framework for you to add on to. Currently there is an implementation for Campfire and a base set of plugins for you to enjoy.
- You can add Message Handlers that respond to messages sent from an Adapter like Campfire.
- You can create new Adapters.
- You can create Message Filters.
- Add features to the core application.
- Create wiki pages
- Create Message Handlers
- Create Adapters
- Create Message Filters
- Set ConsoleAdapter Project as the Startup Project
- Use the Fluent interface to configure your NBot
- Chat Bot Bliss....
static void Main(string[] args)
{
// New up a brain to use
var brain = new FileBrain(".\\Brain");
Robot.Create("NBot")
.UseBrain(brain) // <- Use your brain
.RegisterMessageFilter(new HandleBarsMessageFilter(brain)) // <- Register zero or more Message Filters
.RegisterAdapter(new ConsoleAdapter(), "ConsoleChannel") // <- Register one ore more Adapters
.RegisterHandlersInAssembly(Assembly.Load("NBot.MessageHandlers")) // <- Register all the Handlers
.AllowedInAllRooms() // <- Allow them in all rooms
.Run(); // <- Get Crackin
}
See Configration for more details.
- Create a new Console Application
- Refreence NBot.Core, NBot.MessageHandlers, NBot.CampfireAdapter
- Use the Fluent interface to configure your NBot
- Chat Bot Nirvana..
static void Main(string[] args)
{
// New up a brain to use
var brain = new SimpleBrain();
IAdapter adapter = new CampfireAdapter.CampfireAdapter("TOKEN", "SUBDOMAIN", new List<int>() { ROOMS_TO_JOIN });
Robot.Create("NAME", "ALIAS", "ENVIRONMENT")
.UseBrain(brain) // <- Use your brain
.RegisterMessageFilter(new HandleBarsMessageFilter(brain)) // <- Register zero or more Message Filters
.RegisterAdapter(adapter, "Campfire") // <- Register one ore more Adapters
.RegisterHandlersInAssembly(Assembly.Load("NBot.MessageHandlers")) // <- Register all the Handlers
.AllowedInAllRooms() // <- Allow them in all rooms
.Run(); // <- Get Crackin
}
See Configration for more details.
Creating your first plugin.
- Create a class and inherit from MessageHandler.
- Add a method with an attribute "Hear".
- The parameters are added as needed and are injected when the types are known.
- Do some logic.
- Reply if you like.
- Done!
public class HelloNBot : MessageHandler {
[Hear("Hello NBot")]
public void HandleHello(Message message, IMessagingClient client){
IEntity user = client.GetUser(message.UserId);
client.ReplyTo(message, string.Format("Hi {0}, how are you?",user.Name));
}
}
see Message Handler for more information...
- Jonathan Starnes - Project Lead
- Billy Laney
- Tyler Falkenhgen
- Rafael Torres
The NBot Logo was provided by The Noun Project http://thenounproject.com/