CBot is a SlackBot for C#, originally forked from Noobot.
As mentioned above, CBot is originally forked from Noobot but has a different take on dependency injection (DI), logging and configuration.
Mainly, the DI container is external from the core bots code, so consumers can more easily extend the framework as they can add their own DI implementation of choice. Logging now uses the ILogger
interface for easily of implemenation for consumers, and configuration can be consumed more easily.
I believe these changes allow for improved consumption in .NET Core projects. Currently targetting .NET Core 2.1+.
- Available as a Nuget package to integrate into your apps (see Installation / Usage below)
- DI support out of the box
- Automatically builds up
help
text with all supported commands - Middleware can send multiple messages for each message received
- Supports long running processes
- Typing Indicator - indicate to the end user that the bot has received the message and is processing the request
Below are the intructions to add CBot framework to your ASP.NET Core 2.1 project.
In your web project, add the NuGet package:
Install-Package CBot
The easiest way to run CBot as a Hosted Service in ASP.NET Core. Simply add the below to your service initialisation within Startup.cs
:
public void ConfigureServices(IServiceCollection services)
{
...
services.RegisterCBotAsHostedService(this.Configuration.GetSection("Bot"));
}
In your application settings file, you will need to create a bot section and populate your Slack API key.
{
"Bot": {
"SlackApiKey": "YOUR_KEY"
}
}
You can find an example project of how to use the Nuget package in ASP.NET Core 2.1 application as shown in this SreBot.Web project
Examples of writing your own modules (resources) can be found in the public modules repository.
- Unit tests
- Improved documentation
- More examples