Unescape tweets before sending them to the client, update help string

This commit is contained in:
Klaus-Uwe Mitterer 2017-03-20 15:44:12 +01:00
parent 6f5b4e4f6d
commit 77fa014b75
2 changed files with 6 additions and 2 deletions

View file

@ -27,6 +27,10 @@ After authentication, you will be able to tweet from your account. Just drop me
Additionally, you will be able to use the following commands:
* /like TWEET - Like a tweet. You will need to pass a tweet ID (TWEET) as returned by /timeline.
* /reply TWEET TEXT - Reply TEXT to a tweet. You will need to pass a tweet ID (TWEET) as returned by /timeline.
* /retweet TWEET - Retweet a tweet. You will need to pass a tweet ID (TWEET) as returned by /timeline.
* /timeline - Shows you the latest tweets in your timeline. Returns 10 tweets by default, but you may also use it like /timeline 20, which would return 20 tweets.
* /toggletweet - Turn automatic tweeting of messages on/off. Useful in groups.
* /tweet TEXT - Explicitly tweet TEXT even if automatic tweeting is off (/toggletweet).
* /unauth - Revoke your authenticaton and stop using %s.

View file

@ -1,6 +1,6 @@
#!/usr/bin/env python3
import ast, dbtools, io, logging, PIL.Image, setuptools, strings, telegram.ext, twitools, urllib.request, tweepy
import ast, dbtools, html, io, logging, PIL.Image, setuptools, strings, telegram.ext, twitools, urllib.request, tweepy
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)
logger = logging.getLogger(__name__)
@ -176,7 +176,7 @@ def timeline(bot, update, args = [10]):
for status in two.api.home_timeline(count=count):
db.executeQuery("INSERT INTO timelines VALUES(%i, %i, %i);" % (update.message.chat_id, i, status.id))
update.message.reply_text("Tweet %i:\n%s (@%s) at %s:\n%s" % (i, status.author.name, status.author.screen_name, status.created_at, status.text))
update.message.reply_text("Tweet %i:\n%s (@%s) at %s:\n%s" % (i, status.author.name, status.author.screen_name, status.created_at, html.unescape(status.text)))
i += 1
except tweepy.error.TweepError as e: