diff options
author | Tom Gilbert <tom@linuxbrit.co.uk> | 2005-07-30 00:22:21 +0000 |
---|---|---|
committer | Tom Gilbert <tom@linuxbrit.co.uk> | 2005-07-30 00:22:21 +0000 |
commit | 992ef2edbf3eed7cb1d7c4c22f72cd203aff2aa5 (patch) | |
tree | c34cc1bad75c9c226ac544fd4337e0acb5ac4a9b /data | |
parent | 676dd61e6b0bea5f506d064039a685944aefd6fb (diff) |
Sat Jul 30 01:19:32 BST 2005 Tom Gilbert <tom@linuxbrit.co.uk>
* config module for configuring the running bot via IRC
* BotConfig.register method for various modules and any plugin to register
bot configuration which the new config module will expose for them.
* various other tweaks as I continue to refactor..
Diffstat (limited to 'data')
-rw-r--r-- | data/rbot/plugins/url.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/data/rbot/plugins/url.rb b/data/rbot/plugins/url.rb index ced92133..5629e30a 100644 --- a/data/rbot/plugins/url.rb +++ b/data/rbot/plugins/url.rb @@ -1,6 +1,9 @@ Url = Struct.new("Url", :channel, :nick, :time, :url) class UrlPlugin < Plugin + BotConfig.register('url.max_urls', :type => :integer, :default => 100, + :desc => "Maximum number of urls to store. New urls replace oldest ones.") + def initialize super @registry.set_default(Array.new) @@ -22,7 +25,7 @@ class UrlPlugin < Plugin } url = Url.new(m.target, m.sourcenick, Time.new, urlstr) debug "#{list.length} urls so far" - if list.length > 50 # TODO make this configurable + if list.length > @bot.config['url.max_urls'] list.pop end debug "storing url #{url.url}" |