3 # Copyright (C) 2002 Tom Gilbert.
5 # Permission is hereby granted, free of charge, to any person obtaining a copy
6 # of this software and associated documentation files (the "Software"), to
7 # deal in the Software without restriction, including without limitation the
8 # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9 # sell copies of the Software, and to permit persons to whom the Software is
10 # furnished to do so, subject to the following conditions:
12 # The above copyright notice and this permission notice shall be included in
13 # all copies of the Software and its documentation and acknowledgment shall be
14 # given in the documentation and software packages that this Software was
17 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 # THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34 # print +message+ if debugging is enabled
35 def debug(message=nil)
36 print "DEBUG: #{message}\n" if($debug && message)
40 opts = GetoptLong.new(
41 [ "--debug", "-d", GetoptLong::NO_ARGUMENT ],
42 [ "--help", "-h", GetoptLong::OPTIONAL_ARGUMENT ]
46 $debug = true if(opt == "--debug")
47 $opts[opt.sub(/^-+/, "")] = arg
52 botclass = "/home/#{user}/.rbot" unless(botclass);
54 unless FileTest.directory? botclass
55 # TODO copy in samples/templates from install directory
56 puts "no #{botclass} directory found, creating from templates.."
57 # copy DATA/rbot/templates to botclass
61 if(bot = Irc::IrcBot.new(botclass))
63 puts bot.help($opts["help"])