From 9b3580937256f777468b1959188ff895a7d47cd1 Mon Sep 17 00:00:00 2001 From: Peter Rowlands Date: Wed, 13 Aug 2014 14:43:05 -0500 Subject: [PATCH] fix #11 - use full retweeted text for native retweets instead of truncating it --- plugins/twitter.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/twitter.py b/plugins/twitter.py index 056c788..1f55834 100644 --- a/plugins/twitter.py +++ b/plugins/twitter.py @@ -72,7 +72,12 @@ def twitter(inp, api_key=None): except IndexError: return 'error: not that many tweets found' - text = http.unescape(tweet["text"]).replace('\n', ' ') + if 'retweeted_status' in tweet: + rt = tweet["retweeted_status"] + rt_text = http.unescape(rt["text"]).replace('\n', ' ') + text = "RT @%s %s" % (rt["user"]["screen_name"], rt_text) + else: + text = http.unescape(tweet["text"]).replace('\n', ' ') screen_name = tweet["user"]["screen_name"] time = tweet["created_at"]