+
+begin
+ require 'rbot/ircbot'
+rescue LoadError => e
+ puts "Error: couldn't find the rbot/ircbot module (or one of its dependencies)\n"
+ puts e
+ exit 2
+end
+
+if ($opts["version"])
+ puts "rbot #{$version}"
+ exit 0
+end
+
+if ($opts["help"])
+ puts "usage: rbot [options] [config directory]"
+ puts " -h, --help this message"
+ puts " -v, --version version information"
+ puts " -d, --debug enable debug messages"
+ puts " -b, --background background (daemonize) the bot"
+ puts "config directory defaults to ~/.rbot"
+ exit 0
+end
+
+if(bot = Irc::IrcBot.new(ARGV.shift, :argv => orig_opts))
+ # just run the bot
+ bot.mainloop
+end