X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=lib%2Frbot%2Fircbot.rb;h=f99dd940d5207794d00c486eeb7e9fb13dd38427;hb=e7558ab501d89ed4d04ff69b58344aec8de50844;hp=11b03f507d04357076d002afdf0ab3f8e505abba;hpb=dd0b318cfd3df017b1ec4e44afc2f4e412fd2033;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb index 11b03f50..f99dd940 100644 --- a/lib/rbot/ircbot.rb +++ b/lib/rbot/ircbot.rb @@ -2,6 +2,13 @@ require 'thread' 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' @@ -369,6 +376,7 @@ class IrcBot end while(message.length > 0) end + # queue an arbitraty message for the server def sendq(message="") # temporary @socket.queue(message) @@ -429,6 +437,7 @@ class IrcBot 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") @@ -539,6 +548,7 @@ class IrcBot 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