Skip to content

Latest commit

 

History

History
59 lines (42 loc) · 1.18 KB

README.md

File metadata and controls

59 lines (42 loc) · 1.18 KB

rb-clubot: Simple ruby bindings for clubot.

Description

rb-clubot is a simple Client interface for interacting with clubot. See Clubot for more information on running a clubot.

Installation

If you're using bundler just add the gem to your Gemfile:

gem 'clubot', :git => "git://github.com/sbryant/rb-clubot.git"

I should have this submitted to rubygems when clubot is more complete.

Usage:

Using clubot is incredibly easy and the easiest way to understand clubot is to see an example of using clubot.

require 'clubot'

client = Clubot::Client.new
client.connect

# Make a blocking request
client.request "type" => "nick" do |data|
  puts "Got data: #{data}"
end

# Poll for IRC broadcasts
loop do
  ins, out, err = ZMQ.select([client.sub_sock])
  ins.each do |i|
    # We use multipart messages to make subscriptions easier.
    header = i.recv
    json = i.recv

    puts "Got Header #{header}"
    puts "Got json   #{json}"
  end
end

Contribute

Just fork and send a pull requests.