require 'etc'
require 'fileutils'
+$debug = false unless $debug
+# print +message+ if debugging is enabled
+def debug(message=nil)
+ print "DEBUG: #{message}\n" if($debug && message)
+ #yield
+end
+
# these first
require 'rbot/rbotconfig'
require 'rbot/config'
@argv = params[:argv]
- unless FileTest.directory? Config::DATADIR
- puts "data directory '#{Config::DATADIR}' not found, did you install.rb?"
+ unless FileTest.directory? Config::datadir
+ puts "data directory '#{Config::datadir}' not found, did you install.rb?"
exit 2
end
puts "Error: file #{botclass} exists but isn't a directory"
exit 2
end
- FileUtils.cp_r Config::DATADIR+'/templates', botclass
+ FileUtils.cp_r Config::datadir+'/templates', botclass
end
Dir.mkdir("#{botclass}/logs") unless File.exist?("#{botclass}/logs")
end while(message.length > 0)
end
+ # queue an arbitraty message for the server
def sendq(message="")
# temporary
@socket.queue(message)
sendq "TOPIC #{where} :#{topic}"
end
+ # disconnect from the server and cleanup all plugins and modules
def shutdown(message = nil)
trap("SIGTERM", "DEFAULT")
trap("SIGHUP", "DEFAULT")
return helpstr
end
+ # returns a string describing the current status of the bot (uptime etc)
def status
secs_up = Time.new - @startup_time
uptime = Utils.secs_to_string secs_up