forked from rDrama/rDrama
fsdfds
parent
7e45d6492c
commit
d90218eaae
|
@ -127,3 +127,11 @@ def send_admin(vid, text):
|
||||||
for admin in admins:
|
for admin in admins:
|
||||||
notif = Notification(comment_id=new_comment.id, user_id=admin.id)
|
notif = Notification(comment_id=new_comment.id, user_id=admin.id)
|
||||||
g.db.add(notif)
|
g.db.add(notif)
|
||||||
|
|
||||||
|
def NOTIFY_USERS(text, vid):
|
||||||
|
text = text.lower()
|
||||||
|
notify_users = set()
|
||||||
|
for word, id in NOTIFIED_USERS:
|
||||||
|
if id == 0: continue
|
||||||
|
if word in text and id not in notify_users and vid != id: notify_users.add(id)
|
||||||
|
return notify_users
|
|
@ -130,6 +130,7 @@ WELCOME_MSG = "Hi there! It's me, your soon-to-be favorite rDrama user @carpathi
|
||||||
|
|
||||||
if SITE == 'rdrama.net':
|
if SITE == 'rdrama.net':
|
||||||
BASEDBOT_ID = 0
|
BASEDBOT_ID = 0
|
||||||
|
KIPPY_ID = 7150
|
||||||
NOTIFICATIONS_ID = 1046
|
NOTIFICATIONS_ID = 1046
|
||||||
AUTOJANNY_ID = 2360
|
AUTOJANNY_ID = 2360
|
||||||
SNAPPY_ID = 261
|
SNAPPY_ID = 261
|
||||||
|
@ -140,6 +141,8 @@ if SITE == 'rdrama.net':
|
||||||
PIZZA_SHILL_ID = 2424
|
PIZZA_SHILL_ID = 2424
|
||||||
IDIO_ID = 30
|
IDIO_ID = 30
|
||||||
CARP_ID = 995
|
CARP_ID = 995
|
||||||
|
JOAN_ID = 28
|
||||||
|
AEVANN_ID = 1
|
||||||
LAWLZ_ID = 3833
|
LAWLZ_ID = 3833
|
||||||
LLM_ID = 253
|
LLM_ID = 253
|
||||||
DAD_ID = 2513
|
DAD_ID = 2513
|
||||||
|
@ -148,6 +151,7 @@ if SITE == 'rdrama.net':
|
||||||
EMOJI_THREAD = 22479
|
EMOJI_THREAD = 22479
|
||||||
elif SITE == "pcmemes.net":
|
elif SITE == "pcmemes.net":
|
||||||
BASEDBOT_ID = 800
|
BASEDBOT_ID = 800
|
||||||
|
KIPPY_ID = 1592
|
||||||
NOTIFICATIONS_ID = 1046
|
NOTIFICATIONS_ID = 1046
|
||||||
AUTOJANNY_ID = 1050
|
AUTOJANNY_ID = 1050
|
||||||
SNAPPY_ID = 261
|
SNAPPY_ID = 261
|
||||||
|
@ -158,6 +162,8 @@ elif SITE == "pcmemes.net":
|
||||||
PIZZA_SHILL_ID = 0
|
PIZZA_SHILL_ID = 0
|
||||||
IDIO_ID = 0
|
IDIO_ID = 0
|
||||||
CARP_ID = 0
|
CARP_ID = 0
|
||||||
|
JOAN_ID = 0
|
||||||
|
AEVANN_ID = 1
|
||||||
LAWLZ_ID = 0
|
LAWLZ_ID = 0
|
||||||
LLM_ID = 0
|
LLM_ID = 0
|
||||||
DAD_ID = 0
|
DAD_ID = 0
|
||||||
|
@ -166,6 +172,7 @@ elif SITE == "pcmemes.net":
|
||||||
EMOJI_THREAD = 0
|
EMOJI_THREAD = 0
|
||||||
else:
|
else:
|
||||||
BASEDBOT_ID = 0
|
BASEDBOT_ID = 0
|
||||||
|
KIPPY_ID = 0
|
||||||
NOTIFICATIONS_ID = 1
|
NOTIFICATIONS_ID = 1
|
||||||
AUTOJANNY_ID = 2
|
AUTOJANNY_ID = 2
|
||||||
SNAPPY_ID = 3
|
SNAPPY_ID = 3
|
||||||
|
@ -176,6 +183,8 @@ else:
|
||||||
PIZZA_SHILL_ID = 0
|
PIZZA_SHILL_ID = 0
|
||||||
IDIO_ID = 0
|
IDIO_ID = 0
|
||||||
CARP_ID = 0
|
CARP_ID = 0
|
||||||
|
JOAN_ID = 0
|
||||||
|
AEVANN_ID = 0
|
||||||
LAWLZ_ID = 0
|
LAWLZ_ID = 0
|
||||||
LLM_ID = 0
|
LLM_ID = 0
|
||||||
DAD_ID = 0
|
DAD_ID = 0
|
||||||
|
@ -763,4 +772,18 @@ TROLLTITLES = [
|
||||||
"[META] Getting really sick of @{username}’s shit",
|
"[META] Getting really sick of @{username}’s shit",
|
||||||
"Pretty sure this is @{username}'s Reddit account",
|
"Pretty sure this is @{username}'s Reddit account",
|
||||||
"Hey jannies can you please ban @{username}",
|
"Hey jannies can you please ban @{username}",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
NOTIFIED_USERS = {
|
||||||
|
'aevan': AEVANN_ID,
|
||||||
|
'avean': AEVANN_ID,
|
||||||
|
'joan': JOAN_ID,
|
||||||
|
'pewkie': JOAN_ID,
|
||||||
|
'carp': CARP_ID,
|
||||||
|
'idio3': IDIO_ID,
|
||||||
|
'idio ': IDIO_ID,
|
||||||
|
'landlord_messiah': LLM_ID,
|
||||||
|
'landlordmessiah': LLM_ID,
|
||||||
|
' llm ': LLM_ID,
|
||||||
|
'landlet': LLM_ID,
|
||||||
|
}
|
|
@ -529,7 +529,7 @@ def api_comment(v):
|
||||||
|
|
||||||
|
|
||||||
if not v.shadowbanned:
|
if not v.shadowbanned:
|
||||||
notify_users = set()
|
notify_users = NOTIFY_USERS(body_html, v.id)
|
||||||
|
|
||||||
for x in g.db.query(Subscription.user_id).filter_by(submission_id=c.parent_submission).all(): notify_users.add(x[0])
|
for x in g.db.query(Subscription.user_id).filter_by(submission_id=c.parent_submission).all(): notify_users.add(x[0])
|
||||||
|
|
||||||
|
@ -547,18 +547,6 @@ def api_comment(v):
|
||||||
if v.any_block_exists(user): continue
|
if v.any_block_exists(user): continue
|
||||||
if user.id != v.id: notify_users.add(user.id)
|
if user.id != v.id: notify_users.add(user.id)
|
||||||
|
|
||||||
if request.host == 'pcmemes.net':
|
|
||||||
if 'kippy' in body_html.lower() and 1592 not in notify_users and v.id != 1592: notify_users.add(1592)
|
|
||||||
if ('aevan' in body_html.lower() or 'avean' in body_html.lower()) and 1 not in notify_users and v.id != 1: notify_users.add(1)
|
|
||||||
if request.host == 'rdrama.net':
|
|
||||||
if ('aevan' in body_html.lower() or 'avean' in body_html.lower()) and 1 not in notify_users and v.id != 1: notify_users.add(1)
|
|
||||||
if ('joan' in body_html.lower() or 'pewkie' in body_html.lower()) and 28 not in notify_users and v.id != 28: notify_users.add(28)
|
|
||||||
if 'carp' in body_html.lower() and 995 not in notify_users and v.id != 995:
|
|
||||||
notify_users.add(995)
|
|
||||||
notify_users.add(541)
|
|
||||||
if ('idio3' in body_html.lower() or 'idio ' in body_html.lower()) and 30 not in notify_users and v.id != 30: notify_users.add(30)
|
|
||||||
if any(x in body_html.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:
|
for x in notify_users:
|
||||||
n = Notification(comment_id=c.id, user_id=x)
|
n = Notification(comment_id=c.id, user_id=x)
|
||||||
g.db.add(n)
|
g.db.add(n)
|
||||||
|
@ -806,7 +794,7 @@ def edit_comment(cid, v):
|
||||||
|
|
||||||
g.db.flush()
|
g.db.flush()
|
||||||
|
|
||||||
notify_users = set()
|
notify_users = NOTIFY_USERS(body_html, v.id)
|
||||||
soup = BeautifulSoup(body_html, features="html.parser")
|
soup = BeautifulSoup(body_html, features="html.parser")
|
||||||
mentions = soup.find_all("a", href=re.compile("^/@(\w+)"))
|
mentions = soup.find_all("a", href=re.compile("^/@(\w+)"))
|
||||||
|
|
||||||
|
@ -820,18 +808,6 @@ def edit_comment(cid, v):
|
||||||
if v.any_block_exists(user): continue
|
if v.any_block_exists(user): continue
|
||||||
if user.id != v.id: notify_users.add(user.id)
|
if user.id != v.id: notify_users.add(user.id)
|
||||||
|
|
||||||
if request.host == 'pcmemes.net':
|
|
||||||
if 'kippy' in body_html.lower() and 1592 not in notify_users and v.id != 1592: notify_users.add(1592)
|
|
||||||
if ('aevan' in body_html.lower() or 'avean' in body_html.lower()) and 1 not in notify_users and v.id != 1: notify_users.add(1)
|
|
||||||
if request.host == 'rdrama.net':
|
|
||||||
if ('aevan' in body_html.lower() or 'avean' in body_html.lower()) and 1 not in notify_users and v.id != 1: notify_users.add(1)
|
|
||||||
if ('joan' in body_html.lower() or 'pewkie' in body_html.lower()) and 28 not in notify_users and v.id != 28: notify_users.add(28)
|
|
||||||
if 'carp' in body_html.lower() and 995 not in notify_users and v.id != 995:
|
|
||||||
notify_users.add(995)
|
|
||||||
notify_users.add(541)
|
|
||||||
if ('idio3' in body_html.lower() or 'idio ' in body_html.lower()) and 30 not in notify_users and v.id != 30: notify_users.add(30)
|
|
||||||
if any(x in body_html.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:
|
for x in notify_users:
|
||||||
notif = g.db.query(Notification).filter_by(comment_id=c.id, user_id=x).first()
|
notif = g.db.query(Notification).filter_by(comment_id=c.id, user_id=x).first()
|
||||||
if not notif:
|
if not notif:
|
||||||
|
|
|
@ -55,25 +55,13 @@ def publish(pid, v):
|
||||||
post.private = False
|
post.private = False
|
||||||
g.db.add(post)
|
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")
|
soup = BeautifulSoup(post.body_html, features="html.parser")
|
||||||
for mention in soup.find_all("a", href=re.compile("^/@(\w+)")):
|
for mention in soup.find_all("a", href=re.compile("^/@(\w+)")):
|
||||||
username = mention["href"].split("@")[1]
|
username = mention["href"].split("@")[1]
|
||||||
user = g.db.query(User).filter_by(username=username).first()
|
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 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 x in notify_users: send_notification(x, f"@{v.username} has mentioned you: http://{site}{post.permalink}")
|
||||||
|
|
||||||
for follow in v.followers:
|
for follow in v.followers:
|
||||||
|
@ -372,7 +360,7 @@ def edit_post(pid, v):
|
||||||
g.db.add(n)
|
g.db.add(n)
|
||||||
|
|
||||||
|
|
||||||
notify_users = set()
|
notify_users = NOTIFY_USERS(f'{body_html}{title}', v.id)
|
||||||
|
|
||||||
soup = BeautifulSoup(body_html, features="html.parser")
|
soup = BeautifulSoup(body_html, features="html.parser")
|
||||||
for mention in soup.find_all("a", href=re.compile("^/@(\w+)")):
|
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}"
|
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)
|
for x in notify_users: send_notification(x, message)
|
||||||
|
|
||||||
|
|
||||||
|
@ -870,25 +846,13 @@ def submit_post(v):
|
||||||
|
|
||||||
if not new_post.private:
|
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")
|
soup = BeautifulSoup(body_html, features="html.parser")
|
||||||
for mention in soup.find_all("a", href=re.compile("^/@(\w+)")):
|
for mention in soup.find_all("a", href=re.compile("^/@(\w+)")):
|
||||||
username = mention["href"].split("@")[1]
|
username = mention["href"].split("@")[1]
|
||||||
user = g.db.query(User).filter_by(username=username).first()
|
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 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 x in notify_users: send_notification(x, f"@{v.username} has mentioned you: http://{site}{new_post.permalink}")
|
||||||
|
|
||||||
for follow in v.followers:
|
for follow in v.followers:
|
||||||
|
|
|
@ -240,15 +240,12 @@ def settings_profile_post(v):
|
||||||
error="Your friends list is too long")
|
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")
|
soup = BeautifulSoup(friends_html, features="html.parser")
|
||||||
for mention in soup.find_all("a", href=re.compile("^/@(\w+)")):
|
for mention in soup.find_all("a", href=re.compile("^/@(\w+)")):
|
||||||
username = mention["href"].split("@")[1]
|
username = mention["href"].split("@")[1]
|
||||||
user = g.db.query(User).filter_by(username=username).first()
|
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 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:
|
for x in notify_users:
|
||||||
message = f"@{v.username} has added you to their friends list!"
|
message = f"@{v.username} has added you to their friends list!"
|
||||||
send_notification(x, message)
|
send_notification(x, message)
|
||||||
|
@ -284,15 +281,13 @@ def settings_profile_post(v):
|
||||||
error="Your enemies list is too long")
|
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")
|
soup = BeautifulSoup(enemies_html, features="html.parser")
|
||||||
for mention in soup.find_all("a", href=re.compile("^/@(\w+)")):
|
for mention in soup.find_all("a", href=re.compile("^/@(\w+)")):
|
||||||
username = mention["href"].split("@")[1]
|
username = mention["href"].split("@")[1]
|
||||||
user = g.db.query(User).filter_by(username=username).first()
|
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 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:
|
for x in notify_users:
|
||||||
message = f"@{v.username} has added you to their enemies list!"
|
message = f"@{v.username} has added you to their enemies list!"
|
||||||
send_notification(x, message)
|
send_notification(x, message)
|
||||||
|
|
Loading…
Reference in New Issue