smirc

A simple Ruby IRC client.

Features:

  • Message Queueing to prevent flood disconnects

  • Simple event handling

  • No DSL required, easy access to Irc#join and Irc#message

Example

options = {
  :server => "my.irc.net",
  :nickname => "Hal",
  :realname => "Daisy, Daisy",
  :port => 6667,
}

@irc = Smirc::Client.new(options)
@irc.on(:connect) do |irc|
  irc.join("#mychannel")
end

@irc.on(:message) do |irc, channel, message, user|
  case message
  when /open the bomb-bay doors/
    irc.message(channel, "I'm sorry, I cannot do that, Dave")
  end
end

begin
  @irc.connect
ensure
  @irc.disconnect
end

Contributions and Credit

This gem is based heavily on ichverstehe’s Isaac gem. There’s no way this would be written without that gem as a reference.

Copyright © 2009 Adam Pearson. See LICENSE for details.