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

@ -55,25 +55,13 @@ def publish(pid, v):
post.private = False
g.db.add(post)
notify_users = set()
notify_users = NOTIFY_USERS(f'{post.body_html}{post.title}', v.id)
soup = BeautifulSoup(post.body_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 == 'pcmemes.net':
if 'kippy' in f'{post.body_html}{post.title}'.lower() and 1592 not in notify_users and v.id != 1592: notify_users.add(1592)
if ('aevan' in f'{post.body_html}{post.title}'.lower() or 'avean' in f'{post.body_html}{post.title}'.lower()) and 1 not in notify_users and v.id != 1: notify_users.add(1)
if request.host == 'rdrama.net':
if ('aevan' in f'{post.body_html}{post.title}'.lower() or 'avean' in f'{post.body_html}{post.title}'.lower()) and 1 not in notify_users and v.id != 1: notify_users.add(1)
if ('joan' in f'{post.body_html}{post.title}'.lower() or 'pewkie' in f'{post.body_html}{post.title}'.lower()) and 28 not in notify_users and v.id != 28: notify_users.add(28)
if 'carp' in f'{post.body_html}{post.title}'.lower() and 995 not in notify_users and v.id != 995:
notify_users.add(995)
notify_users.add(541)
if ('idio3' in f'{post.body_html}{post.title}'.lower() or 'idio ' in f'{post.body_html}{post.title}'.lower()) and 30 not in notify_users and v.id != 30: notify_users.add(30)
if any(x in f'{post.body_html}{post.title}'.lower() for x in ('landlord_messiah', 'landlordmessiah', ' llm ', 'landlet')) and 253 not in notify_users and v.id != 253: notify_users.add(253)
for x in notify_users: send_notification(x, f"@{v.username} has mentioned you: http://{site}{post.permalink}")
for follow in v.followers:
@ -372,7 +360,7 @@ def edit_post(pid, v):
g.db.add(n)
notify_users = set()
notify_users = NOTIFY_USERS(f'{body_html}{title}', v.id)
soup = BeautifulSoup(body_html, features="html.parser")
for mention in soup.find_all("a", href=re.compile("^/@(\w+)")):
@ -382,18 +370,6 @@ def edit_post(pid, v):
message = f"@{v.username} has mentioned you: http://{site}{p.permalink}"
if request.host == 'pcmemes.net':
if 'kippy' in f'{body_html}{title}'.lower() and 1592 not in notify_users and v.id != 1592: notify_users.add(1592)
if ('aevan' in f'{body_html}{title}'.lower() or 'avean' in f'{body_html}{title}'.lower()) and 1 not in notify_users and v.id != 1: notify_users.add(1)
if request.host == 'rdrama.net':
if ('aevan' in f'{body_html}{title}'.lower() or 'avean' in f'{body_html}{title}'.lower()) and 1 not in notify_users and v.id != 1: notify_users.add(1)
if ('joan' in f'{body_html}{title}'.lower() or 'pewkie' in f'{body_html}{title}'.lower()) and 28 not in notify_users and v.id != 28: notify_users.add(28)
if 'carp' in f'{body_html}{title}'.lower() and 995 not in notify_users and v.id != 995:
notify_users.add(995)
notify_users.add(541)
if ('idio3' in f'{body_html}{title}'.lower() or 'idio ' in f'{body_html}{title}'.lower()) and 30 not in notify_users and v.id != 30: notify_users.add(30)
if any(x in f'{body_html}{title}'.lower() for x in ('landlord_messiah', 'landlordmessiah', ' llm ', 'landlet')) and 253 not in notify_users and v.id != 253: notify_users.add(253)
for x in notify_users: send_notification(x, message)
@ -870,25 +846,13 @@ def submit_post(v):
if not new_post.private:
notify_users = set()
notify_users = NOTIFY_USERS(f'{body_html}{title}', v.id)
soup = BeautifulSoup(body_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 == 'pcmemes.net':
if 'kippy' in f'{body_html}{title}'.lower() and 1592 not in notify_users and v.id != 1592: notify_users.add(1592)
if ('aevan' in f'{body_html}{title}'.lower() or 'avean' in f'{body_html}{title}'.lower()) and 1 not in notify_users and v.id != 1: notify_users.add(1)
if request.host == 'rdrama.net':
if ('aevan' in f'{body_html}{title}'.lower() or 'avean' in f'{body_html}{title}'.lower()) and 1 not in notify_users and v.id != 1: notify_users.add(1)
if ('joan' in f'{body_html}{title}'.lower() or 'pewkie' in f'{body_html}{title}'.lower()) and 28 not in notify_users and v.id != 28: notify_users.add(28)
if 'carp' in f'{body_html}{title}'.lower() and 995 not in notify_users and v.id != 995:
notify_users.add(995)
notify_users.add(541)
if ('idio3' in f'{body_html}{title}'.lower() or 'idio ' in f'{body_html}{title}'.lower()) and 30 not in notify_users and v.id != 30: notify_users.add(30)
if any(x in f'{body_html}{title}'.lower() for x in ('landlord_messiah', 'landlordmessiah', ' llm ', 'landlet')) and 253 not in notify_users and v.id != 253: notify_users.add(253)
for x in notify_users: send_notification(x, f"@{v.username} has mentioned you: http://{site}{new_post.permalink}")
for follow in v.followers: