diff --git a/retootbot.py b/retootbot.py index c39f8cb..8b4ffdc 100755 --- a/retootbot.py +++ b/retootbot.py @@ -77,9 +77,10 @@ class RetootBot(object): self.save_last() os.rename('seen_toots.pickle.part', 'seen_toots.pickle') # add mention to mentions + text = re.sub("(?<=^|(?<=[^a-zA-Z0-9-_\.]))@([A-Za-z]+[A-Za-z0-9-_]+)", "", status['status']['content']) mentions.append(report.Report(status['account']['acct'], "mastodon", - re.sub(r'<[^>]*>', '', status['status']['content']), + re.sub(r'<[^>]*>', '', text), status['status']['id'], status['status']['created_at'])) return mentions diff --git a/retweetbot.py b/retweetbot.py index a585633..b120a4f 100755 --- a/retweetbot.py +++ b/retweetbot.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 import tweepy +import re import requests import pytoml as toml import trigger @@ -111,9 +112,10 @@ class RetweetBot(object): else: mentions = self.api.mentions_timeline(since_id=self.last_mention) for status in mentions: + text = re.sub("(?<=^|(?<=[^a-zA-Z0-9-_\.]))@([A-Za-z]+[A-Za-z0-9-_]+)", "", status.text) reports.append(report.Report(status.author.screen_name, "twitter", - status.text, + text, status.id, status.created_at)) return reports