From a88687ceda55e81bb9b07a4258998ab317f4bd18 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 1 Feb 2022 06:37:10 +0200 Subject: [PATCH] fds --- files/helpers/const.py | 4 ++++ files/routes/comments.py | 43 +++++++++++++++++++++++---------- files/routes/posts.py | 52 +++++++++++++++++++++++++++++++++++++++- 3 files changed, 85 insertions(+), 14 deletions(-) diff --git a/files/helpers/const.py b/files/helpers/const.py index cb072913b..775578357 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -557,3 +557,7 @@ REDDIT_NOTIFS = { 'carpathian florist': CARP_ID, 'the_homocracy': HOMO_ID } + + +no_pass_phrase = """

Sorry whiteboy, we're gonna need to see some ID before you start throwin that word around like it's nothing.\n\nTake a 5 minute time-out and come back when you've learned your lesson and/or paid reparations (by purchasing a BIPOC Approved™ Rdrama NWord Pass© from the shop) \n\nThis is an automated message; if you need help,+ + you can message us here.

""" \ No newline at end of file diff --git a/files/routes/comments.py b/files/routes/comments.py index 80ae97ba0..b751c5ab5 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -416,12 +416,7 @@ def api_comment(v): n = Notification(comment_id=c_jannied.id, user_id=v.id) g.db.add(n) - if 'nigg' in body and not v.nwordpass: - - no_pass_phrase = """Sorry whiteboy, we're gonna need to see some ID before you start throwin that word around like it's nothing.\n\nTake a 30 minute time-out and come back when you've learned your lesson and/or paid reparations (by purchasing a BIPOC Approved™ Rdrama NWord Pass© from the shop) \n\n*This is an automated message; if you need help, - you can message us [here](/contact).*""" - - body_jannied_html = sanitize(no_pass_phrase) + elif 'nigg' in c.body.lower() and not v.nwordpass: c_jannied = Comment(author_id=NOTIFICATIONS_ID, parent_submission=parent_submission, @@ -429,7 +424,7 @@ def api_comment(v): parent_comment_id=c.id, level=level+1, is_bot=True, - body_html=body_jannied_html, + body_html=no_pass_phrase, top_comment_id=c.top_comment_id, ghost=parent_post.ghost ) @@ -437,10 +432,9 @@ def api_comment(v): g.db.add(c_jannied) g.db.flush() - v.ban(reason="White people nonsense.", - days=0.02) + v.ban(reason="White people nonsense.", days=0.00347223) - text = "Your account has been suspended for 30 minutes for the following reason:\n\n> Unsacntioned Racism" + text = "Your account has been suspended for 5 minutes for the following reason:\n\n> Unsanctioned NWord" send_repeatable_notification(v.id, text) n = Notification(comment_id=c_jannied.id, user_id=v.id) @@ -788,17 +782,40 @@ def edit_comment(cid, v): is_bot=True, body_html=body_jannied_html, top_comment_id=c.top_comment_id, - ghost=c.ghost + ghost=c.post.ghost ) g.db.add(c_jannied) g.db.flush() - - n = Notification(comment_id=c_jannied.id, user_id=v.id) g.db.add(n) + elif 'nigg' in c.body.lower() and not v.nwordpass: + + c_jannied = Comment(author_id=NOTIFICATIONS_ID, + parent_submission=c.parent_submission, + distinguish_level=6, + parent_comment_id=c.id, + level=c.level+1, + is_bot=True, + body_html=no_pass_phrase, + top_comment_id=c.top_comment_id, + ghost=c.post.ghost + ) + + g.db.add(c_jannied) + g.db.flush() + + v.ban(reason="White people nonsense.", days=0.00347223) + + text = "Your account has been suspended for 5 minutes for the following reason:\n\n> Unsanctioned NWord" + send_repeatable_notification(v.id, text) + + n = Notification(comment_id=c_jannied.id, user_id=v.id) + g.db.add(n) + + if int(time.time()) - c.created_utc > 60 * 3: c.edited_utc = int(time.time()) g.db.add(c) diff --git a/files/routes/posts.py b/files/routes/posts.py index 39c7b88c9..3b194ab59 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -511,6 +511,7 @@ def edit_post(pid, v): is_pinned='AutoJanny', distinguish_level=6, body_html=body_jannied_html, + ghost=p.ghost ) g.db.add(c_jannied) @@ -518,7 +519,32 @@ def edit_post(pid, v): n = Notification(comment_id=c_jannied.id, user_id=v.id) g.db.add(n) - + + elif 'nigg' in f'{p.body}{p.title}'.lower() and not v.nwordpass: + + c_jannied = Comment(author_id=NOTIFICATIONS_ID, + parent_submission=p.id, + level=1, + over_18=False, + is_bot=True, + app_id=None, + is_pinned='AutoJanny', + distinguish_level=6, + body_html=no_pass_phrase, + ghost=p.ghost + ) + + g.db.add(c_jannied) + g.db.flush() + + v.ban(reason="White people nonsense.", days=0.00347223) + + text = "Your account has been suspended for 5 minutes for the following reason:\n\n> Unsanctioned NWord" + send_repeatable_notification(v.id, text) + + n = Notification(comment_id=c_jannied.id, user_id=v.id) + g.db.add(n) + notify_users = NOTIFY_USERS(body_html, v) | NOTIFY_USERS2(title, v) @@ -1081,6 +1107,30 @@ def submit_post(v): n = Notification(comment_id=c_jannied.id, user_id=v.id) g.db.add(n) + elif 'nigg' in f'{new_post.body}{new_post.title}'.lower() and not v.nwordpass: + + c_jannied = Comment(author_id=NOTIFICATIONS_ID, + parent_submission=new_post.id, + level=1, + over_18=False, + is_bot=True, + app_id=None, + is_pinned='AutoJanny', + distinguish_level=6, + body_html=no_pass_phrase, + ) + + g.db.add(c_jannied) + g.db.flush() + + v.ban(reason="White people nonsense.", days=0.00347223) + + text = "Your account has been suspended for 5 minutes for the following reason:\n\n> Unsanctioned NWord" + send_repeatable_notification(v.id, text) + + n = Notification(comment_id=c_jannied.id, user_id=v.id) + g.db.add(n) + if v.id == CARP_ID: if random.random() < 0.02: body = "i love you carp" else: body = ":#marseyfuckoffcarp:"