diff options
Diffstat (limited to 'lib/lsg_irc/link_plugin/twitter.ex')
-rw-r--r-- | lib/lsg_irc/link_plugin/twitter.ex | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/lsg_irc/link_plugin/twitter.ex b/lib/lsg_irc/link_plugin/twitter.ex index 04dea7c..a6b6e29 100644 --- a/lib/lsg_irc/link_plugin/twitter.ex +++ b/lib/lsg_irc/link_plugin/twitter.ex @@ -55,6 +55,17 @@ defmodule LSG.IRC.LinkPlugin.Twitter do {:ok, at} = Timex.parse(tweet.created_at, "%a %b %e %H:%M:%S %z %Y", :strftime) {:ok, format} = Timex.format(at, "{relative}", :relative) + replyto = if tweet.in_reply_to_status_id do + replyurl = "https://twitter.com/#{tweet.in_reply_to_screen_name}/status/#{tweet.in_reply_to_status_id}" + if tweet.in_reply_to_screen_name == tweet.user.screen_name do + "— continued from #{replyurl}" + else + "— replying to #{replyurl}" + end + else + "" + end + quoted = if tweet.quoted_status do quote_url = "https://twitter.com/#{tweet.quoted_status.user.screen_name}/status/#{tweet.quoted_status.id}" full_text = expand_twitter_text(tweet.quoted_status) @@ -66,7 +77,7 @@ defmodule LSG.IRC.LinkPlugin.Twitter do foot = "— #{format} - #{tweet.retweet_count} retweets - #{tweet.favorite_count} likes" - text = ["#{tweet.user.name} (@#{tweet.user.screen_name}):"] ++ text ++ quoted ++ [foot] + text = ["#{tweet.user.name} (@#{tweet.user.screen_name}):", replyto] ++ text ++ quoted ++ [foot] {:ok, text} end |