From: Matthias -apoc- Hecker Date: Mon, 14 Feb 2011 20:49:32 +0000 (+0100) Subject: twitter plugin: change the api urls to receive RTs X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;ds=sidebyside;h=7842b4d2dbc2940fa19dc7da1f33980b236fb55a;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git twitter plugin: change the api urls to receive RTs --- diff --git a/data/rbot/plugins/twitter.rb b/data/rbot/plugins/twitter.rb index 2ce8142f..e4c228da 100644 --- a/data/rbot/plugins/twitter.rb +++ b/data/rbot/plugins/twitter.rb @@ -92,18 +92,15 @@ class TwitterPlugin < Plugin count = friends ? @bot.config['twitter.friends_status_count'] : @bot.config['twitter.status_count'] user = URI.escape(nick) + # receive the public timeline per default (this works even without an access_token) + uri = "https://api.twitter.com/1/statuses/user_timeline.xml?screen_name=#{user}&count=#{count}&include_rts=true" if @has_oauth and @registry.has_key?(m.sourcenick + "_access_token") if friends #no change to count variable - uri = "https://api.twitter.com/1/statuses/friends_timeline.xml?count=#{count}" - response = @access_token.get(uri).body - else - uri = "https://api.twitter.com/1/statuses/user_timeline.xml?screen_name=#{user}&count=#{count}" - response = @access_token.get(uri).body + uri = "https://api.twitter.com/1/statuses/friends_timeline.xml?count=#{count}&include_rts=true" end + response = @access_token.get(uri).body else - #unauthorized user, will try to get from public timeline the old way - uri = "http://twitter.com/statuses/user_timeline/#{user}.xml?count=#{count}" response = @bot.httputil.get(uri, :cache => false) end debug response