From e3931e43edf5b3c47fc94a1ae8405f1f213190cb Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sat, 15 Sep 2007 10:10:28 +0000 Subject: twitter plugin: customize count of status updates displayed, defaulting to 1 --- data/rbot/plugins/twitter.rb | 8 ++++++-- 1 file 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 -- cgit v1.2.3