https://github.com/voided/hubot-dotnet
A KISS async (TPL) .NET library and Hubot adapter.
https://github.com/voided/hubot-dotnet
Last synced: 10 months ago
JSON representation
A KISS async (TPL) .NET library and Hubot adapter.
- Host: GitHub
- URL: https://github.com/voided/hubot-dotnet
- Owner: voided
- License: mit
- Created: 2015-01-19T00:08:28.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-01-19T21:58:40.000Z (over 11 years ago)
- Last Synced: 2023-08-01T22:38:07.803Z (almost 3 years ago)
- Language: C#
- Size: 969 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Hubot.NET
A Keep-It-Simple-Stupid async (TPL) .NET library and Hubot adapter.
Hubot.NET is the .NET library portion, and is designed to help you quickly and easily interact with a Hubot instance from an application via IPC, namely via TCP sockets. The library is designed with the async/await pattern in mind and allows you to make your interactions completely asynchronous if the need arises.
##### Dependencies
* [Nito.AsyncEx](https://www.nuget.org/packages/Nito.AsyncEx), which should be automatically installed by NuGet when building.
##### Usage
```csharp
async Task Init()
{
var client = new HubotClient();
// hook up the events we care about
client.Chat += OnChat;
client.Disconnected += OnDisconnected;
// connect to the dotnet adapter
await client.Connect( "localhost", 8880 );
// pretend that User123 is really hungry right now
await client.SendChat( "User123", "hubot: animate me a pizza" );
}
async void OnDisconnected( object sender, DisconnectEventArgs e )
{
Console.WriteLine( "Disconnected from Hubot adapter!" );
// add your reconnection logic here
}
void OnChat( object sender, MessageEventArgs e )
{
Console.WriteLine( "Hubot says: {0}", e.Message );
// you'd want to pipe this message back to where the source message originally came from
}
```
## hubot-dotnet
hubot-dotnet is the Hubot adapter portion, and is designed as a simple TCP server that routes chat to and from the Hubot instance.
##### Dependencies
* [buffercursor](https://www.npmjs.com/package/buffercursor), which should be automatically retrieved by `npm install`.
##### Usage
1. Set `HUBOT_DOTNET_PORT` environment variable to the tcp port (default is 8880) the dotnet adapter will listen on.
2. In your Hubot's directory: `npm install ""`.
3. Launch your Hubot with `--adapter dotnet`.
## Considerations
* The Hubot adapter itself performs no access control for which clients may connect, this should be performed at the firewall/iptables level.
* Traffic is sent entirely in plaintext between the .NET library and the adapter. There is no TLS or other crypto support.