From c3491de7117341f280b8c488c321f8295ae92b3f Mon Sep 17 00:00:00 2001 From: Mint <> Date: Sat, 10 Sep 2022 19:29:22 +0300 Subject: [PATCH] Removing menchies from reply body, this time for real --- reply.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/reply.py b/reply.py index 7ad94b6..b1feeba 100755 --- a/reply.py +++ b/reply.py @@ -70,14 +70,16 @@ class ReplyBot: async def reply(self, notification): toot = await utils.make_post(self.cfg) # generate a toot + if cfg['strip_paired_punctuation']: + toot = PAIRED_PUNCTUATION.sub("", toot) + toot = toot.replace("@", "@\u200b") # sanitize mentions + toot = utils.remove_mentions(cfg, toot) await self.pleroma.reply(notification['status'], toot, cw=self.cfg['cw']) @staticmethod def extract_toot(toot, cfg): text = utils.extract_post_content(toot) text = re.sub(r"^@\S+\s", r"", text) # remove the initial mention - toot = toot.replace("@", "@\u200b") # sanitize mentions - text = utils.remove_mentions(cfg, text) text = text.lower() # treat text as lowercase for easier keyword matching (if this bot uses it) return text