Skip to content
A C# port of Hubot
Branch: master
Clone or download
Latest commit b728f90 Oct 11, 2015
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.nuget add nuget exe Sep 19, 2013
Docs/Images Added 48x48 logo May 21, 2014
MMBot.AzureTableBrain More version/reference changes to resolve issues Aug 19, 2014
MMBot.Core Fix Robot.Hear Regex Oct 9, 2015
MMBot.HipChat added ability to configure specific list of rooms to enter for HipCha… Aug 27, 2015
MMBot.Jabbr Changed dictionary to more discoverable AdapterArguments class Jan 8, 2015
MMBot.Powershell Updated to ScriptCS 0.10.2 & Resultant Dependencies Aug 19, 2014
MMBot.RedisBrain Purge use of obsolete APIs Nov 5, 2014
MMBot.Router.Nancy Fix tests Sep 16, 2014
MMBot.ScriptIt
MMBot.Slack Changed regex to private static field. Jul 28, 2015
MMBot.Spotify Added key value adapter args Jan 8, 2015
MMBot.Tests Changed dictionary to more discoverable AdapterArguments class Jan 8, 2015
MMBot.XMPP Changed dictionary to more discoverable AdapterArguments class Jan 8, 2015
build Adding proj file for CI Mar 28, 2014
lib Adding jabbr client dll Sep 19, 2013
mmbot add basic robot name configuration. Jun 27, 2015
packages More ref fixes Nov 14, 2014
.gitattributes Initial commit Sep 16, 2013
.gitignore Merge pull request #169 from andreasohlund/better-assembly-load-diagn… Nov 9, 2014
CreatePackages.ps1 Added azure table brain nuget package to package creation script. Rel… Aug 9, 2014
LICENSE.md Added license Sep 28, 2013
MMBot.sln Added Redis Brain implementation Apr 12, 2014
README.md Update README.md Jun 14, 2014
mmbot.chocolatey.nuspec Cleaned up installation using chocolatey and nuget flow Nov 17, 2013

README.md

Stories in You Take It
Build Status
Gitter chat

mmbot

Overview

mmbot is a port of github's Hubot to C#.

mmbot

Goals

  1. Provide a chat bot written in C# with all the functionality of Hubot but with a script environment more familiar to .Net devs. (done)
  2. Hubot scripts should be easy to convert into mmbot scripts. (done)
    This may mean that some weird design choices are made in the API but it should still be very usable, customizable and familiar to .Net devs
  3. ScriptCS style scripts should be automatically picked up and run from a scripts folder (done)
  4. Eventually provide the ability to run from scriptcs. (blocked)
    There are some blockers here in the NuGet package resolution and dynamic loading of scripts

Getting started

The best plan is to use chocolatey...

# chocolatey can install mmbot globally
cinst mmbot

# Now create a folder to host the scripts and config, then from that dir...
mmbot --init

# You're ready to go...
mmbot

When you need an adapter to talk to your chat rooms

nuget install mmbot.jabbr -o packages

When you want a script that is in nuget use the nuget command line in your path (installed via cinst nuget.commandline)

nuget install mmbot.scriptit -o packages

...or simply drop the .csx file in the "scripts" folder ...or even better use the scriptthis and scriptthat scripts to input them inline or pull from a gist!!!

For more info read the getting started guide

Adapters

Currently adapters exist for jabbr, HipChat, Slack and XMPP but with plans to add a CampFire adapter soon. The implementation is extremely similar to Hubot so other adapters could easily be added. Learn how to get your preferred adapter up and running in configuring mmbot.

Scripts

Writing scripts is easy. You can either implement the IMMBotScript interface and register your script or you can write a simple scriptcs script and drop it into a scripts folder beside the MMBot runner executable.

Here is a simple script that responds to "mmbot yo" with "sup?"

var robot = Require<Robot>();

robot.Respond("yo", msg => msg.Send("sup?"));

This script is a port of the Hubot math script

var robot = Require<Robot>();

robot.Respond(@"(calc|calculate|calculator|convert|math|maths)( me)? (.*)", msg =>
	{
	    msg
	    .Http("https://www.google.com/ig/calculator")
        .Query(new
        {
            hl = "en",
            q = msg.Match[3]
        })
        .Headers(new Dictionary<string, string>
        {
            {"Accept-Language", "en-us,en;q=0.5"},
            {"Accept-Charset", "utf-8"},
            {"User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1"}
        })
        .GetJson((err, res, body) => 
        {
        	if(err != null)
        	{
        		msg.Send("Could not compute");
        	}
        	else 
        	{
        		msg.Send((string)body["rhs"] ?? "Could not compute");
        	}
        });
});

robot.AddHelp(
    "mmbot math me <expression> - Calculate the given expression.",
    "mmbot convert me <expression> to <units> - Convert expression to given units."
);

You can even tell mmbot to watch for changes to script files when you run him

mmbot --watch

Current Script Implementations

The script catalog is available at mmbot.github.io/mmbot.scripts

You can also search the script catalog from within mmbot and even install scripts from there.

# List the scripts in the catalog
mmbot scripts

# Install a script (Pug)
mmbot download script Pug
You can’t perform that action at this time.