Skip to content
This repository

The IRC Bot Building Framework

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 README.rdoc
Octocat-spinner-32 Rakefile
Octocat-spinner-32 cinch.gemspec
README.rdoc

Cinch: The IRC Microframework

Cinch is an IRC Microframework for quickly creating IRC bots in Ruby with minimal effort.

The Cinch philosophy is very based on that of the Sinatra web framework. It provides a minimal DSL like interface based on plugins and rules. It's as simple as greating a plugin, defining a rule, and watching your profits flourish.

Cinch will do all of the hard work for you, so you can spend time creating cool plugins and extensions to wow your internet peers.

Your typical Hello, World application would go something like this:

require 'cinch'

setup do
  server "irc.freenode.org"
  nick "Cinch"
end

plugin 'hello' do
  reply "Hello, #{nick}!"
end

It doesn't take much to work out what's happening here, but I'll explain it anyway.

First we define the setup block which is required in every application. Cinch is boxed with a load of default values, so the only option required in this block is the server option. We then define a plugin using the plugin method and pass it a rule (a String in this case). Every plugin must be happeded to a rule. When the rule matches an IRC message its block is invoked, the contents of which contains your plugin interface.

This example would provide the following response on IRC:

* Cinch has joined #cinch
injekt> !hello
Cinch> Hello, injekt!

Plugins are invoked using the command prefix character (which by default is set to !). You can also tell Cinch to ignore any command prefix and instead use the bots username. This would provide a result similar to this:

injekt> Cinch: hello
Cinch> Hello, injekt!
Something went wrong with that request. Please try again.