diff --git a/active_bots/mastodonbot.py b/active_bots/mastodonbot.py index 065555a..07a2311 100755 --- a/active_bots/mastodonbot.py +++ b/active_bots/mastodonbot.py @@ -56,7 +56,10 @@ class MastodonBot(Bot): except Exception: logger.error('Error boosting: ' + report.id, exc_info=True) else: + text = report.text + if len(text) > 500: + text = text[:500 - 4] + u' ...' try: - m.toot(report.text) + m.toot(text) except Exception: logger.error('Error tooting: ' + user.get_city() + ': ' + report.id, exc_info=True) diff --git a/active_bots/twitterDMs.py b/active_bots/twitterDMs.py new file mode 100644 index 0000000..e69de29 diff --git a/active_bots/twitterbot.py b/active_bots/twitterbot.py index 051502b..5d8846f 100755 --- a/active_bots/twitterbot.py +++ b/active_bots/twitterbot.py @@ -33,8 +33,7 @@ class TwitterBot(Bot): if last_mention == 0: mentions = api.mentions_timeline() else: - mentions = api.mentions_timeline( - since_id=last_mention) + mentions = api.mentions_timeline(since_id=last_mention) for status in mentions: text = re.sub( "(?<=^|(?<=[^a-zA-Z0-9-_\.]))@([A-Za-z]+[A-Za-z0-9-_]+)", @@ -62,9 +61,10 @@ class TwitterBot(Bot): if report.source == self: api.retweet(report.id) else: - # text = report.format() - if len(report.text) > 280: - text = report.text[:280 - 4] + u' ...' + text = report.text + if len(text) > 280: + text = text[:280 - 4] + u' ...' + api.update_status(status=text) except requests.exceptions.ConnectionError: logger.error("Twitter API Error: Bad Connection", exc_info=True)