Removing menchies from reply body, this time for real

This commit is contained in:
Mint 2022-09-10 19:29:22 +03:00
parent 599bbce185
commit c3491de711

View file

@ -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