mirror of
https://git.kiwifarms.net/mint/ebooks.git
synced 2024-10-22 21:29:05 +00:00
Removing menchies from reply body, this time for real
This commit is contained in:
parent
599bbce185
commit
c3491de711
1 changed files with 4 additions and 2 deletions
6
reply.py
6
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
|
||||
|
||||
|
|
Loading…
Reference in a new issue