remotes/1693045480750635534/spooky-22
Aevann1 2022-03-17 18:12:59 +02:00
parent 2b09a060a2
commit 329f34a6e6
4 changed files with 18 additions and 1 deletions

View File

@ -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('<a href=\"(https?:\/\/[a-z]{1,20}\.[^\"]+)\" rel=
email_regex = re.compile('([A-Za-z0-9]+[.-_])*[A-Za-z0-9]+@[A-Za-z0-9-]+(\.[A-Z|a-z]{2,})+', flags=re.A)
reddit_post_regex = re.compile('(https:\/\/old.reddit.com\/r\/\w{1,30}\/comments\/[a-z0-9]+).*', flags=re.A)
slur_regex = re.compile(rf"((?<=\s|>)|^)({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)

View File

@ -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}"

View File

@ -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)

View File

@ -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)