This commit is contained in:
Aevann1 2022-01-07 21:13:01 +02:00
parent 3614e4a1bc
commit b75f004383
9 changed files with 80 additions and 19 deletions

View file

@ -104,8 +104,18 @@ def NOTIFY_USERS(text, v):
soup = BeautifulSoup(text, features="html.parser")
for mention in soup.find_all("a", href=re.compile("^\/id\/([0-9]+)")):
id = int(mention["href"].split("/id/")[1])
if id != v.id:
user = g.db.query(User).filter_by(id=id).one_or_none()
if user and not v.any_block_exists(user): notify_users.add(user.id)
if id != v.id: notify_users.add(id)
return notify_users
def NOTIFY_USERS2(text, v):
notify_users = set()
for word, id in NOTIFIED_USERS.items():
if id == 0: continue
if word in text.lower() and id not in notify_users and v.id != id: notify_users.add(id)
for i in re.finditer("(^|\s|\n)@((\w|-){1,25})", text):
user = get_user(i.group(2), graceful=True)
if user and not v.any_block_exists(user): notify_users.add(user.id)
return notify_users