summaryrefslogtreecommitdiff
path: root/data/rbot/plugins
diff options
context:
space:
mode:
authorMatthias Hecker <apoc@sixserv.org>2013-11-14 14:49:52 +0000
committerMatthias Hecker <apoc@sixserv.org>2013-11-14 14:51:55 +0000
commitc02cb195e052d4c98540c79407bb752d627e8412 (patch)
treee63e9f0398b6b804751b0685c356b3fd2634088b /data/rbot/plugins
parentcc7a4c3d8c79c6036a161a6973ca5c84f2f63954 (diff)
twitter: fixes the htmlfilter used by url plugin
Diffstat (limited to 'data/rbot/plugins')
-rw-r--r--data/rbot/plugins/twitter.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/data/rbot/plugins/twitter.rb b/data/rbot/plugins/twitter.rb
index e661e633..16813c60 100644
--- a/data/rbot/plugins/twitter.rb
+++ b/data/rbot/plugins/twitter.rb
@@ -39,25 +39,25 @@ class TwitterPlugin < Plugin
:desc => "Maximum number of status updates shown by 'twitter [home|mentions|retweets] status'")
def twitter_filter(s)
- loc = Utils.check_location(s, Regexp.new('twitter\.com/#!/.*/status/\d+'))
+ loc = Utils.check_location(s, Regexp.new('twitter\.com/(#!/)?.*/status/\d+'))
return nil unless loc
id = loc.first.match(/\/status\/(\d+)/)[1]
- response = @app_access_token.get('/1.1/statuses/show/'+id).body
+ response = @app_access_token.get('/1.1/statuses/show/'+id+'.json').body
begin
- tweet = JSON.parse(response).first
+ tweet = JSON.parse(response)
status = {
:date => (Time.parse(tweet["created_at"]) rescue "<unknown>"),
- :id => (tweet["id"].text rescue "<unknown>"),
+ :id => (tweet["id_str"] rescue "<unknown>"),
:text => (tweet["text"].ircify_html rescue "<error>"),
- :source => (tweet["source"].text rescue "<unknown>"),
+ :source => (tweet["source"].ircify_html rescue "<unknown>"),
:user => (tweet["user"]["name"] rescue "<unknown>"),
:user_nick => (tweet["user"]["screen_name"] rescue "<unknown>")
# TODO other entries
}
status[:nicedate] = String === status[:date] ? status[:date] : Utils.timeago(status[:date])
return {
- :title => "#{status[:user]}/#{status[:id]}",
+ :title => "@#{status[:user_nick]}: #{status[:text]}",
:content => "#{status[:text]} (#{status[:nicedate]} via #{status[:source]})"
}
rescue