diff --git a/retootbot.py b/retootbot.py index 879a948..63e16da 100644 --- a/retootbot.py +++ b/retootbot.py @@ -59,7 +59,7 @@ class RetootBot(object): if (notification['type'] == 'mention' and notification['status']['id'] not in self.seen_toots): self.seen_toots.add(notification['status']['id']) - text_content = re.sub('<[^>]*>', '', + text_content = re.sub(r'<[^>]*>', '', notification['status']['content']) if not self.filter.is_ok(text_content): continue @@ -68,7 +68,9 @@ class RetootBot(object): notification['status']['account']['acct'], notification['status']['content'])) self.m.status_reblog(notification['status']['id']) - retoots.append(text_content) + retoots.append('%s: %s' % ( + notification['status']['account']['acct'], + re.sub(r'@\S*', '', text_content))) # save state with os.fdopen(os.open('seen_toots.pickle.part', os.O_WRONLY | os.O_EXCL | os.O_CREAT), 'w') as f: diff --git a/retweetbot.py b/retweetbot.py index 348c4d3..0586216 100644 --- a/retweetbot.py +++ b/retweetbot.py @@ -138,6 +138,8 @@ class RetweetBot(object): :param post: String with the text to tweet. """ + if len(post) > 140: + post = post[:140 - 4] + u' ...' while 1: try: self.api.PostUpdate(status=post)