Created
October 10, 2011 01:08
-
-
Save oogali/1274439 to your computer and use it in GitHub Desktop.
Redis pubsub-to-IRC bridge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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