mirror of
https://git.kiwifarms.net/mint/ebooks.git
synced 2024-10-23 01:39:06 +00:00
Sanitize mentions for autoreply
This commit is contained in:
parent
448729bac3
commit
599bbce185
1 changed files with 1 additions and 0 deletions
1
reply.py
1
reply.py
|
@ -76,6 +76,7 @@ class ReplyBot:
|
||||||
def extract_toot(toot, cfg):
|
def extract_toot(toot, cfg):
|
||||||
text = utils.extract_post_content(toot)
|
text = utils.extract_post_content(toot)
|
||||||
text = re.sub(r"^@\S+\s", r"", text) # remove the initial mention
|
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 = utils.remove_mentions(cfg, text)
|
||||||
text = text.lower() # treat text as lowercase for easier keyword matching (if this bot uses it)
|
text = text.lower() # treat text as lowercase for easier keyword matching (if this bot uses it)
|
||||||
return text
|
return text
|
||||||
|
|
Loading…
Reference in a new issue