Skip to content

Commit

Permalink
added html unescaping for tweet text
Browse files Browse the repository at this point in the history
  • Loading branch information
katycat5e committed Nov 6, 2017
1 parent 97d585d commit bd8569a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions plugins/twitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import tweepy
from cloudbot import hook

import html

from cloudbot.util import timeformat

TWITTER_RE = re.compile(r"(?:(?:www.twitter.com|twitter.com)/(?:[-_a-zA-Z0-9]+)/status/)([0-9]+)", re.I)
Expand Down Expand Up @@ -55,7 +57,7 @@ def twitter_url(match):

time = timeformat.time_since(tweet.created_at, datetime.utcnow())

return "{}@\x02{}\x02 ({}): {} ({} ago)".format(prefix, user.screen_name, user.name, text, time)
return "{}@\x02{}\x02 ({}): {} ({} ago)".format(prefix, user.screen_name, user.name, html.unescape(text), time)


@hook.command("twitter", "tw", "twatter")
Expand Down Expand Up @@ -138,7 +140,7 @@ def twitter(text):

time = timeformat.time_since(tweet.created_at, datetime.utcnow())

return "{}@\x02{}\x02 ({}): {} ({} ago)".format(prefix, user.screen_name, user.name, text, time)
return "{}@\x02{}\x02 ({}): {} ({} ago)".format(prefix, user.screen_name, user.name, html.unescape(text), time)


@hook.command("twuser", "twinfo")
Expand Down

0 comments on commit bd8569a

Please sign in to comment.