remotes/1693045480750635534/spooky-22
Aevann1 2022-02-07 13:54:19 +02:00
parent ec74892284
commit 78a419ac0e
2 changed files with 43 additions and 5 deletions

View File

@ -588,4 +588,13 @@ ROLES={
} }
if SITE_NAME == 'Drama': patron = 'Paypig' if SITE_NAME == 'Drama': patron = 'Paypig'
else: patron = 'Patron' else: patron = 'Patron'
REDDIT_NOTIFS = {
'idio3': IDIO_ID,
'aevann': AEVANN_ID,
'carpflo': CARP_ID,
'carpathianflorist': CARP_ID,
'carpathian florist': CARP_ID,
'the_homocracy': HOMO_ID
}

View File

@ -720,9 +720,11 @@ def thumbnail_thread(pid):
if SITE == 'rdrama.net': if SITE == 'rdrama.net':
for t in ("submission","comment"): for t in ("submission","comment"):
for i in requests.get(f'https://api.pushshift.io/reddit/{t}/search?html_decode=true&q=rdrama&size=1').json()["data"]: word = random.choice(('rdrama','marsey'))
body_html = sanitize(f'New rdrama mention: https://old.reddit.com{i["permalink"]}?context=89', noimages=True) for i in requests.get(f'https://api.pushshift.io/reddit/{t}/search?html_decode=true&q={word}&size=1').json()["data"]:
body_html = sanitize(f'New {word} mention: https://old.reddit.com{i["permalink"]}?context=89', noimages=True)
existing_comment = db.query(Comment.id).filter_by(author_id=NOTIFICATIONS_ID, parent_submission=None, distinguish_level=6, body_html=body_html, level=1, sentto=0).first() existing_comment = db.query(Comment.id).filter_by(author_id=NOTIFICATIONS_ID, parent_submission=None, distinguish_level=6, body_html=body_html, level=1, sentto=0).first()
@ -744,7 +746,8 @@ def thumbnail_thread(pid):
notif = Notification(comment_id=new_comment.id, user_id=admin.id) notif = Notification(comment_id=new_comment.id, user_id=admin.id)
db.add(notif) db.add(notif)
for i in requests.get(f'https://api.pushshift.io/reddit/{t}/search?html_decode=true&q=aevann&size=1').json()["data"]: k,val = random.choice(REDDIT_NOTIFS.items())
for i in requests.get(f'https://api.pushshift.io/reddit/{t}/search?html_decode=true&q={k}&size=1').json()["data"]:
try: body_html = sanitize(f'New mention of you: https://old.reddit.com{i["permalink"]}?context=89', noimages=True) try: body_html = sanitize(f'New mention of you: https://old.reddit.com{i["permalink"]}?context=89', noimages=True)
except: continue except: continue
existing_comment = db.query(Comment.id).filter_by(author_id=NOTIFICATIONS_ID, parent_submission=None, distinguish_level=6, body_html=body_html).first() existing_comment = db.query(Comment.id).filter_by(author_id=NOTIFICATIONS_ID, parent_submission=None, distinguish_level=6, body_html=body_html).first()
@ -760,10 +763,36 @@ def thumbnail_thread(pid):
db.add(new_comment) db.add(new_comment)
db.flush() db.flush()
notif = Notification(comment_id=new_comment.id, user_id=AEVANN_ID) notif = Notification(comment_id=new_comment.id, user_id=val)
db.add(notif) db.add(notif)
if SITE == 'pcmemes.net':
for t in ("submission","comment"):
for i in requests.get(f'https://api.pushshift.io/reddit/{t}/search?html_decode=true&q=pcmemes.net&size=1').json()["data"]:
body_html = sanitize(f'New pcmemes.net mention: https://old.reddit.com{i["permalink"]}?context=89', noimages=True)
existing_comment = db.query(Comment.id).filter_by(author_id=NOTIFICATIONS_ID, parent_submission=None, distinguish_level=6, body_html=body_html, level=1, sentto=0).first()
if existing_comment: break
print(body_html, flush=True)
new_comment = Comment(author_id=NOTIFICATIONS_ID,
parent_submission=None,
distinguish_level=6,
body_html=body_html,
level=1,
sentto=0,
)
db.add(new_comment)
db.flush()
admins = db.query(User).filter(User.admin_level > 2).all()
for admin in admins:
notif = Notification(comment_id=new_comment.id, user_id=admin.id)
db.add(notif)
db.commit() db.commit()
db.close() db.close()
stdout.flush() stdout.flush()