Skip to content

Instantly share code, notes, and snippets.

@oogali
Created October 10, 2011 01:08
Show Gist options
  • Save oogali/1274439 to your computer and use it in GitHub Desktop.
Save oogali/1274439 to your computer and use it in GitHub Desktop.
Redis pubsub-to-IRC bridge
#!/usr/bin/env ruby
require 'rubygems'
require 'isaac'
require 'em-hiredis'
configure do |c|
c.nick = 'redisbot'
c.server = 'irc'
c.verbose = true
end
on :connect do
join '#bridge'
redis = EM::Hiredis.connect
redis.errback do |code|
msg '#bridge', "could not connect to redis: #{code}"
end
redis.subscribe('some::random.key')
redis.on(:message) do |channel, msg|
msg '#bridge', "#{msg}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment