diff options
author | Tom Gilbert <tom@linuxbrit.co.uk> | 2005-07-30 21:35:57 +0000 |
---|---|---|
committer | Tom Gilbert <tom@linuxbrit.co.uk> | 2005-07-30 21:35:57 +0000 |
commit | d30940cb5ff75cf7eab81f6a588b3b5297a762ad (patch) | |
tree | b3f0a62c9255b2ecb8a4f2c927bd116e220b0594 /data | |
parent | 992ef2edbf3eed7cb1d7c4c22f72cd203aff2aa5 (diff) |
Sat Jul 30 22:33:36 BST 2005 Tom Gilbert <tom@linuxbrit.co.uk>
* Config items are now objects, various types are available.
* The config wizard will now use registered config items if :wizard is set
to true for those items. It will ask questions in the order they were
registered.
* The config module now works for doing runtime configuration.
* misc refactoring
Diffstat (limited to 'data')
-rw-r--r-- | data/rbot/plugins/nickserv.rb | 2 | ||||
-rw-r--r-- | data/rbot/plugins/seen.rb | 19 | ||||
-rw-r--r-- | data/rbot/plugins/url.rb | 3 |
3 files changed, 4 insertions, 20 deletions
diff --git a/data/rbot/plugins/nickserv.rb b/data/rbot/plugins/nickserv.rb index 246f253c..976bb8f8 100644 --- a/data/rbot/plugins/nickserv.rb +++ b/data/rbot/plugins/nickserv.rb @@ -73,7 +73,7 @@ class NickServPlugin < Plugin return unless(m.kind_of? NoticeMessage) if (m.sourcenick == "NickServ" && m.message =~ /This nickname is owned by someone else/) - puts "nickserv asked us to identify for nick #{@bot.nick}" + debug "nickserv asked us to identify for nick #{@bot.nick}" if @registry.has_key?(@bot.nick) @bot.sendmsg "PRIVMSG", "NickServ", "IDENTIFY " + @registry[@bot.nick] end diff --git a/data/rbot/plugins/seen.rb b/data/rbot/plugins/seen.rb index 80d52f65..a8dc1af7 100644 --- a/data/rbot/plugins/seen.rb +++ b/data/rbot/plugins/seen.rb @@ -1,23 +1,6 @@ Saw = Struct.new("Saw", :nick, :time, :type, :where, :message) class SeenPlugin < Plugin - # turn a number of seconds into a human readable string, e.g - # 2 days, 3 hours, 18 minutes, 10 seconds - def secs_to_string(secs) - ret = "" - days = (secs / (60 * 60 * 24)).to_i - secs = secs % (60 * 60 * 24) - hours = (secs / (60 * 60)).to_i - secs = (secs % (60 * 60)) - mins = (secs / 60).to_i - secs = (secs % 60).to_i - ret += "#{days} days, " if days > 0 - ret += "#{hours} hours, " if hours > 0 || days > 0 - ret += "#{mins} minutes and " if mins > 0 || hours > 0 || days > 0 - ret += "#{secs} seconds" - return ret - end - def help(plugin, topic="") "seen <nick> => have you seen, or when did you last see <nick>" end @@ -80,7 +63,7 @@ class SeenPlugin < Plugin if (ago.to_i == 0) ret += "just now, " else - ret += secs_to_string(ago) + " ago, " + ret += Utils.secs_to_string(ago) + " ago, " end case saw.type diff --git a/data/rbot/plugins/url.rb b/data/rbot/plugins/url.rb index 5629e30a..7972037a 100644 --- a/data/rbot/plugins/url.rb +++ b/data/rbot/plugins/url.rb @@ -1,7 +1,8 @@ Url = Struct.new("Url", :channel, :nick, :time, :url) class UrlPlugin < Plugin - BotConfig.register('url.max_urls', :type => :integer, :default => 100, + BotConfig.register BotConfigIntegerValue.new('url.max_urls', + :default => 100, :validate => Proc.new{|v| v > 0}, :desc => "Maximum number of urls to store. New urls replace oldest ones.") def initialize |