diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-09-15 10:10:28 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-09-15 10:10:28 +0000 |
commit | e3931e43edf5b3c47fc94a1ae8405f1f213190cb (patch) | |
tree | 247ae519abf5e2ad201514faeea1009aea52de55 /data | |
parent | 4ca06a4bc4359b85484896ab36fdb55d49795983 (diff) |
twitter plugin: customize count of status updates displayed, defaulting to 1
Diffstat (limited to 'data')
-rw-r--r-- | data/rbot/plugins/twitter.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/data/rbot/plugins/twitter.rb b/data/rbot/plugins/twitter.rb index daa237c0..79d46619 100644 --- a/data/rbot/plugins/twitter.rb +++ b/data/rbot/plugins/twitter.rb @@ -15,6 +15,10 @@ require 'rexml/rexml' require 'cgi' class TwitterPlugin < Plugin + Config.register Config::IntegerValue.new('twitter.status_count', + :default => 1, :validate => Proc.new { |v| v > 0 && v <= 10}, + :desc => "Maximum number of status updates shown by 'twitter status'") + def initialize super @@ -49,8 +53,8 @@ class TwitterPlugin < Plugin user = URI.escape(nick) - # TODO configurable count - uri = "http://twitter.com/statuses/user_timeline/#{user}.xml?count=3" + count = @bot.config['twitter.status_count'] + uri = "http://twitter.com/statuses/user_timeline/#{user}.xml?count=#{count}" response = @bot.httputil.get(uri, :headers => @header, :cache => false) debug response |