From 329f34a6e62a2d0ce5002c24f035d62b8f294f51 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 17 Mar 2022 18:12:59 +0200 Subject: [PATCH] pizza --- files/helpers/const.py | 5 +++++ files/routes/awards.py | 6 ++++++ files/routes/comments.py | 2 ++ files/routes/posts.py | 6 +++++- 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/files/helpers/const.py b/files/helpers/const.py index 5124931e9..981633646 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -130,6 +130,7 @@ if SITE in {'rdrama.net','devrama.xyz'}: KIPPY_ID = 7150 GIFT_NOTIF_ID = 995 PIZZASHILL_ID = 2424 + PIZZASHILLSHILL_ID = 9712 HIL_ID = 4245 CRAT_ID = 747 IDIO_ID = 30 @@ -160,6 +161,7 @@ elif SITE == "pcmemes.net": A_ID = 0 KIPPY_ID = 1592 PIZZASHILL_ID = 0 + PIZZASHILLSHILL_ID = 0 GIFT_NOTIF_ID = 1592 HIL_ID = 0 CRAT_ID = 0 @@ -192,6 +194,7 @@ else: KIPPY_ID = 0 GIFT_NOTIF_ID = 9 PIZZASHILL_ID = 0 + PIZZASHILLSHILL_ID = 0 HIL_ID = 0 CRAT_ID = 0 IDIO_ID = 0 @@ -693,6 +696,8 @@ snappy_url_regex = re.compile(')|^)({single_words})((?=[\s<,.$]|s[\s<,.$]))", flags=re.I|re.A) slur_regex_upper = re.compile(rf"((?<=\s|>)|^)({single_words.upper()})((?=[\s<,.$]|S[\s<,.$]))", flags=re.A) torture_regex = re.compile('(^|\s)(i|me) ', flags=re.I|re.A) diff --git a/files/routes/awards.py b/files/routes/awards.py index d9a5e088e..e5fb9fc5a 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -226,6 +226,9 @@ def award_post(pid, v): author = post.author + if author.id == PIZZASHILL_ID: + return {"error": "Pizzashill is immune to awards."}, 403 + if v.id != author.id: msg = f"@{v.username} has given your [post]({post.shortlink}) the {AWARDS[kind]['title']} Award!" if note: msg += f"\n\n> {note}" @@ -444,6 +447,9 @@ def award_comment(cid, v): author = c.author + if author.id == PIZZASHILL_ID: + return {"error": "Pizzashill is immune to awards."}, 403 + if v.id != author.id: msg = f"@{v.username} has given your [comment]({c.shortlink}) the {AWARDS[kind]['title']} Award!" if note: msg += f"\n\n> {note}" diff --git a/files/routes/comments.py b/files/routes/comments.py index b6405737a..01a5f2b8e 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -661,6 +661,8 @@ def api_comment(v): g.db.add(autovote) autovote = CommentVote(user_id=CRAT_ID, comment_id=c.id, vote_type=1) g.db.add(autovote) + autovote = CommentVote(user_id=PIZZASHILLSHILL_ID, comment_id=c.id, vote_type=1) + g.db.add(autovote) v.coins += 3 v.truecoins += 3 g.db.add(v) diff --git a/files/routes/posts.py b/files/routes/posts.py index 47793c53d..447ce9106 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -871,7 +871,9 @@ def submit_post(v, sub=None): url = urlunparse(new_url) - search_url = url.replace('\\', '').replace('_', '\_').replace('%', '').strip() + search_url = url.replace('%', '') + search_url = reddit_post_regex.sub(r'\1%', search_url) + search_url = search_url.replace('\\', '').replace('_', '\_').strip() repost = g.db.query(Submission).filter( Submission.url.ilike(search_url), @@ -1289,6 +1291,8 @@ def submit_post(v, sub=None): g.db.add(autovote) autovote = Vote(user_id=CRAT_ID, submission_id=post.id, vote_type=1) g.db.add(autovote) + autovote = Vote(user_id=PIZZASHILLSHILL_ID, submission_id=post.id, vote_type=1) + g.db.add(autovote) v.coins += 3 v.truecoins += 3 g.db.add(v)