LoginSignup
1
1

More than 5 years have passed since last update.

IRCで一行メッセージ

Last updated at Posted at 2012-02-24
#!/usr/local/bin/ruby
require 'net/irc'

class SimpleClient < Net::IRC::Client
  def on_rpl_welcome(m)
    super
    post JOIN, '#onelirc'
    post NOTICE, '#onelirc', 'Hi'
    sleep 5
    finish
  end

  def on_error(m)
    finish
  end

  def on_err_nicknameinuse(m)
    super
    $stderr.puts 'NICKNAME ALREADY INS USE ERRORRRRRRRRRRRRRRRRRRRRRRRRR'
    post NICK, 'another'# some server rejects multi-client connection
    sleep 3
  end
end

SimpleClient.new('irc.trpg.net', '6667',
  nick: 'onelirc',
  user: 'onelirc',
  real: 'onelirc'
).start
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1