Sha256: 6d17fe456e6ff79c05e2434ea80049583e0edf6da64d0cb937014d46a3434f83

Contents?: true

Size: 605 Bytes

Versions: 8

Compression:

Stored size: 605 Bytes

Contents

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))

require 'rubygems'
require 'net/irc'
require 'string-irc'

class Client < Net::IRC::Client
  def on_rpl_welcome(m)
    post JOIN, opts.channel
  end

  def on_privmsg(m)
    channel, message = *m
    if message =~ /ping/
      post NOTICE, channel, reply
    end
  end

  def reply
    si = StringIrc.new('pong')
    si.red.bold.to_s
  end
end

options = {
  :nick     => "sibot",
  :user     => "sibot",
  :real     => "sibot",
  :channel  => "",
  :password => "",
}
client = Client.new("irc.freenode.net", 6667, options)
client.start

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
string-irc-0.3.1 example/client.rb
string-irc-0.3.0 example/client.rb
string-irc-0.2.3 examples/client.rb
string-irc-0.2.2 examples/client.rb
string-irc-0.2.1 examples/client.rb
string-irc-0.2.0 examples/client.rb
string-irc-0.1.3 examples/client.rb
string-irc-0.1.2 examples/client.rb