#!/usr/bin/env ruby -Ke

=begin header
an example of IRC Bot

  $Author: knu $
  $Date: 2001/01/31 10:55:28 $

  Copyright (C) 1998-2000 Hiroshi IGARASHI
=end

# Thread.abort_on_exception = true  # for debug
$LOAD_PATH << File::dirname(__FILE__)
require 'parsearg'
require 'irc/client'

################################################################
$USAGE = "usage"
def usage
  leprint(<<"USAGE_END")
usage: #{$0} --server <server name> [<options>]
options:
    --operator <operator>
    --nick <nick>
    --username <username>
    --agentname <agentname>
    --logfile <logfile>
USAGE_END
end
parseArgs(0, "server", "",
	  "server:", "logfile:", "nick:", "operator:", "username:", "realname:", "agentname:")
Server = $OPT_server
Operator = $OPT_operator || "igapon!igarashi@mahon.ueda.info.waseda.ac.jp"
Nick = $OPT_nick || "rubychan"
UserName = $OPT_username || "rubychan"
RealName = $OPT_realname || "Ruby¤Á¤ã¤ó"
AgentName = $OPT_agentname || "init"
#LogFileName = $OPT_logfile || "syslog"
################################################################

STDOUT.sync = true
STDERR.sync = true
bot = IRC::Client::new(Server, Nick, UserName, RealName)
bot.start(AgentName)
