Skip to content

Commit

Permalink
Merge pull request #9 from sopel-irc/fix-quoted-tweets
Browse files Browse the repository at this point in the history
twitter: fix some quoted tweets causing errors
  • Loading branch information
dgw authored Feb 16, 2020
2 parents 14acb89 + 6e463fb commit 3440dd8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sopel_modules/twitter/twitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,14 @@ def get_url(bot, trigger, match):
'| {content[favorite_count]} ♥s').format(content=content, text=text)
all_urls = content['entities']['urls']
if content['is_quote_status']:
try:
text = content['quoted_status']['full_text']
except KeyError:
text = content['quoted_status']['text']
text.replace("\n", " \u23CE ") # Unicode symbol to indicate line-break
message += ('| Quoting {content[quoted_status][user][name]} '
'(@{content[quoted_status][user][screen_name]}): '
'{content[quoted_status][text]}').format(content=content)
'{text}').format(content=content, text=text)
quote_id = content['quoted_status']['id_str']
for url in content['entities']['urls']:
expanded_url = url['expanded_url']
Expand Down

0 comments on commit 3440dd8

Please sign in to comment.