This commit is contained in:
Aevann1 2021-12-02 22:48:13 +02:00
parent 9ec62479c3
commit b8bf2c0ff9
5 changed files with 39 additions and 73 deletions

View file

@ -240,15 +240,12 @@ def settings_profile_post(v):
error="Your friends list is too long")
notify_users = set()
notify_users = NOTIFY_USERS(friends_html, v.id)
soup = BeautifulSoup(friends_html, features="html.parser")
for mention in soup.find_all("a", href=re.compile("^/@(\w+)")):
username = mention["href"].split("@")[1]
user = g.db.query(User).filter_by(username=username).first()
if user and not v.any_block_exists(user) and user.id != v.id: notify_users.add(user.id)
if request.host == 'rdrama.net' and ('aevan' in friends_html.lower() or 'avean' in friends_html.lower()) and 1 not in notify_users and v.id != 1: notify_users.add(1)
for x in notify_users:
message = f"@{v.username} has added you to their friends list!"
send_notification(x, message)
@ -284,15 +281,13 @@ def settings_profile_post(v):
error="Your enemies list is too long")
notify_users = set()
notify_users = NOTIFY_USERS(enemies_html, v.id)
soup = BeautifulSoup(enemies_html, features="html.parser")
for mention in soup.find_all("a", href=re.compile("^/@(\w+)")):
username = mention["href"].split("@")[1]
user = g.db.query(User).filter_by(username=username).first()
if user and not v.any_block_exists(user) and user.id != v.id: notify_users.add(user.id)
if request.host == 'rdrama.net' and ('aevan' in enemies_html.lower() or 'avean' in enemies_html.lower()) and 1 not in notify_users and v.id != 1: notify_users.add(1)
for x in notify_users:
message = f"@{v.username} has added you to their enemies list!"
send_notification(x, message)