Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Decode html entities from tweets

  • Loading branch information...
commit ad68acc12efcba9b4ab998c68f61e4015e3dccd6 1 parent a36eb1e
@LindseyB authored
Showing with 5 additions and 2 deletions.
  1. +1 −0  Gemfile
  2. +2 −0  Gemfile.lock
  3. +2 −2 lib/xombot/plugins/tweet.rb
View
1  Gemfile
@@ -2,3 +2,4 @@ source :rubygems
gem "cinch"
gem "mechanize"
gem "twitter"
+gem "htmlentities"
View
2  Gemfile.lock
@@ -12,6 +12,7 @@ GEM
faraday_middleware (0.7.0)
faraday (~> 0.7.3)
hashie (1.1.0)
+ htmlentities (4.3.1)
mechanize (2.1.1)
domain_name (~> 0.5, >= 0.5.1)
net-http-digest_auth (~> 1.1, >= 1.1.1)
@@ -45,5 +46,6 @@ PLATFORMS
DEPENDENCIES
cinch
+ htmlentities
mechanize
twitter
View
4 lib/xombot/plugins/tweet.rb
@@ -9,10 +9,10 @@ class Tweet < XOmBot::Plugin
def tweet_by_id(m, id)
status = Twitter.status(id)
- m.reply "@#{status.user.screen_name}: #{status.text}"
+ m.reply "@#{status.user.screen_name}: #{HTMLEntities.new.decode status.text}"
end
def tweet_by_username(m, username)
- m.reply "@#{username}: #{Twitter.user_timeline(username).first.text}"
+ m.reply "@#{username}: #{HTMLEntities.new.decode Twitter.user_timeline(username).first.text}"
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.