customizable chud phrases

pull/142/head
Aevann 2023-03-19 19:13:45 +02:00
parent df1ebf7cad
commit b004617695
10 changed files with 59 additions and 20 deletions

View File

@ -119,6 +119,14 @@ function pick(kind, price, coins, marseybux) {
document.getElementsByClassName('picked')[0].classList.toggle('picked');
}
document.getElementById(kind).classList.toggle('picked')
if (kind == "agendaposter") {
document.getElementById('phrase_section').classList.remove("d-none")
}
else {
document.getElementById('phrase_section').classList.add("d-none")
}
if (kind == "flairlock") {
document.getElementById('notelabel').innerHTML = "New flair:";
document.getElementById('note').placeholder = "Insert new flair here, or leave empty to add 1 day to the duration of the current flair. 100 characters max.";
@ -162,11 +170,17 @@ function buy(mb) {
function giveaward(t) {
const kind = document.getElementById('kind').value;
const values = {
"kind": kind,
"note": document.getElementById('note').value
}
if (kind == "agendaposter")
values["agendaposter_phrase"] = document.getElementById('agendaposter_phrase').value
postToast(t, t.dataset.action,
{
"kind": kind,
"note": document.getElementById('note').value
},
values,
() => {
let owned = document.getElementById(`${kind}-owned`)
let ownednum = Number(owned.textContent) - 1;

View File

@ -95,6 +95,7 @@ class User(Base):
coins_spent_on_hats = Column(Integer, default=0)
lootboxes_bought = Column(Integer, default=0)
agendaposter = Column(Integer, default=0)
agendaposter_phrase = Column(String)
is_activated = Column(Boolean, default=False)
shadowbanned = Column(Integer, ForeignKey("users.id"))
chudded_by = Column(Integer, ForeignKey("users.id"))

View File

@ -24,6 +24,7 @@ def award_timers(v, bot=False):
notify_if_not_bot("You have been unbanned!")
if v.agendaposter and v.agendaposter != 1 and v.agendaposter < now:
v.agendaposter = 0
v.agendaposter_phrase = None
v.chudded_by = None
notify_if_not_bot("Your chud status has expired!")
badge = v.has_badge(28)

View File

@ -394,8 +394,6 @@ profanity_single_words = "|".join([profanity.lower() for profanity in PROFANITIE
LONGPOST_REPLIES = ('Wow, you must be a JP fan.', 'This is one of the worst posts I have EVER seen. Delete it.', "No, don't reply like this, please do another wall of unhinged rant please.", '# 😴😴😴', "Ma'am we've been over this before. You need to stop.", "I've known more coherent downies.", "Your pulitzer's in the mail", "That's great and all, but I asked for my burger without cheese.", 'That degree finally paying off', "That's nice sweaty. Why don't you have a seat in the time out corner with Pizzashill until you calm down, then you can have your Capri Sun.", "All them words won't bring your pa back.", "You had a chance to not be completely worthless, but it looks like you threw it away. At least you're consistent.", 'Some people are able to display their intelligence by going on at length on a subject and never actually saying anything. This ability is most common in trades such as politics, public relations, and law. You have impressed me by being able to best them all, while still coming off as an absolute idiot.', "You can type 10,000 characters and you decided that these were the one's that you wanted.", 'Have you owned the libs yet?', "I don't know what you said, because I've seen another human naked.", 'Impressive. Normally people with such severe developmental disabilities struggle to write much more than a sentence or two. He really has exceded our expectations for the writing portion. Sadly the coherency of his writing, along with his abilities in the social skills and reading portions, are far behind his peers with similar disabilities.', "This is a really long way of saying you don't fuck.", "Sorry ma'am, looks like his delusions have gotten worse. We'll have to admit him.", 'If only you could put that energy into your relationships', 'Posts like this is why I do Heroine.', 'still unemployed then?', 'K', 'look im gunna have 2 ask u 2 keep ur giant dumps in the toilet not in my replys 😷😷😷', "Mommy is soooo proud of you, sweaty. Let's put this sperg out up on the fridge with all your other failures.", "Good job bobby, here's a star", "That was a mistake. You're about to find out the hard way why.", 'You sat down and wrote all this shit. You could have done so many other things with your life. What happened to your life that made you decide writing novels of bullshit here was the best option?', "I don't have enough spoons to read this shit", "All those words won't bring daddy back.", 'OUT!', "Damn, you're really mad over this, but thanks for the effort you put into typing that all out! Sadly I won't read it all.", "Jesse what the fuck are you talking about??", "▼you're fucking bananas if you think I'm reading all that, take my downvote and shut up idiot", "Are you feeling okay bud?", ':#marseywoah:', 'At no point in your rambling, incoherent post were you even close to anything that could be considered a rational thought. Everyone on this site is now dumber for having read it. May God have mercy on your soul.', 'https://rdrama.net/videos/1671169024815045.mp4', 'https://i.rdrama.net/images/16766675896248007.webp')
AGENDAPOSTER_PHRASE = 'trans lives matter'
AGENDAPOSTER_MSG = """Hi @{username},\n
Your {type} has been automatically removed because you forgot to include `{AGENDAPOSTER_PHRASE}`.\n
Don't worry, we're here to help! We won't let you post or comment anything that doesn't express your love and acceptance towards the trans community. Feel free to resubmit your {type} with `{AGENDAPOSTER_PHRASE}` included. \n

View File

@ -781,6 +781,7 @@ def unagendaposter(id, v):
abort(403, "Jannies can't undo chud awards anymore!")
user.agendaposter = 0
user.agendaposter_phrase = None
user.chudded_by = None
g.db.add(user)
@ -1305,7 +1306,7 @@ def remove_post(post_id, v):
def approve_post(post_id, v):
post = get_post(post_id)
if post.author.id == v.id and post.author.agendaposter and AGENDAPOSTER_PHRASE not in post.body.lower() and post.sub != 'chudrama':
if post.author.id == v.id and post.author.agendaposter and post.author.agendaposter_phrase not in post.body.lower() and post.sub != 'chudrama':
abort(400, "You can't bypass the chud award!")
if post.is_banned:
@ -1539,7 +1540,7 @@ def remove_comment(c_id, v):
def approve_comment(c_id, v):
comment = get_comment(c_id)
if comment.author.id == v.id and comment.author.agendaposter and AGENDAPOSTER_PHRASE not in comment.body.lower() and not (comment.parent_submission and comment.post.sub == 'chudrama'):
if comment.author.id == v.id and comment.author.agendaposter and comment.author.agendaposter_phrase not in comment.body.lower() and not (comment.parent_submission and comment.post.sub == 'chudrama'):
abort(400, "You can't bypass the chud award!")
if comment.is_banned:

View File

@ -305,6 +305,13 @@ def award_thing(v, thing_type, id):
if author.agendaposter and time.time() < author.agendaposter: author.agendaposter += 86400
else: author.agendaposter = int(time.time()) + 86400
agendaposter_phrase = request.values.get("agendaposter_phrase")
if not agendaposter_phrase: abort(400)
agendaposter_phrase = agendaposter_phrase.strip()
if not agendaposter_phrase: abort(400)
author.agendaposter_phrase = agendaposter_phrase
badge_grant(user=author, badge_id=28)
elif kind == "flairlock":
new_name = note[:100].replace("𒐪","").replace("","").strip()

View File

@ -232,7 +232,7 @@ def comment(v:User):
torture = (v.agendaposter and not v.marseyawarded and not (posting_to_submission and post_target.sub == 'chudrama') and post_target.id not in ADMIGGER_THREADS)
body_html = sanitize(body_for_sanitize, limit_pings=5, count_emojis=not v.marsify, torture=torture)
if post_target.id not in ADMIGGER_THREADS and '!wordle' not in body.lower() and AGENDAPOSTER_PHRASE not in body.lower():
if post_target.id not in ADMIGGER_THREADS and '!wordle' not in body.lower() and v.agendaposter_phrase not in body.lower():
existing = g.db.query(Comment.id).filter(
Comment.author_id == v.id,
Comment.deleted_utc == 0,
@ -278,13 +278,13 @@ def comment(v:User):
if c.level == 1: c.top_comment_id = c.id
else: c.top_comment_id = parent.top_comment_id
if post_target.id not in ADMIGGER_THREADS and v.agendaposter and not v.marseyawarded and AGENDAPOSTER_PHRASE not in c.body.lower() and not (posting_to_submission and post_target.sub == 'chudrama'):
if post_target.id not in ADMIGGER_THREADS and v.agendaposter and not v.marseyawarded and v.agendaposter_phrase not in c.body.lower() and not (posting_to_submission and post_target.sub == 'chudrama'):
c.is_banned = True
c.ban_reason = "AutoJanny"
g.db.add(c)
body = AGENDAPOSTER_MSG.format(username=v.username, type='comment', AGENDAPOSTER_PHRASE=AGENDAPOSTER_PHRASE)
body_jannied_html = AGENDAPOSTER_MSG_HTML.format(id=v.id, username=v.username, type='comment', AGENDAPOSTER_PHRASE=AGENDAPOSTER_PHRASE)
body = AGENDAPOSTER_MSG.format(username=v.username, type='comment', AGENDAPOSTER_PHRASE=v.agendaposter_phrase)
body_jannied_html = AGENDAPOSTER_MSG_HTML.format(id=v.id, username=v.username, type='comment', AGENDAPOSTER_PHRASE=v.agendaposter_phrase)
c_jannied = Comment(author_id=AUTOJANNY_ID,
parent_submission=post_target.id if posting_to_submission else None,
@ -673,8 +673,8 @@ def edit_comment(cid, v):
execute_blackjack(v, c, c.body, "comment")
execute_under_siege(v, c, c.body, "comment")
if not (c.parent_submission and c.post.id in ADMIGGER_THREADS) and v.agendaposter and not v.marseyawarded and AGENDAPOSTER_PHRASE not in c.body.lower() and not (c.parent_submission and c.post.sub == 'chudrama'):
abort(403, f'You have to include "{AGENDAPOSTER_PHRASE}" in your comment!')
if not (c.parent_submission and c.post.id in ADMIGGER_THREADS) and v.agendaposter and not v.marseyawarded and v.agendaposter_phrase not in c.body.lower() and not (c.parent_submission and c.post.sub == 'chudrama'):
abort(403, f'You have to include "{v.agendaposter_phrase}" in your comment!')
if int(time.time()) - c.created_utc > 60 * 3: c.edited_utc = int(time.time())

View File

@ -658,13 +658,13 @@ def submit_post(v:User, sub=None):
for x in notify_users:
add_notif(cid, x, text, pushnotif_url=p.permalink)
if v.agendaposter and not v.marseyawarded and AGENDAPOSTER_PHRASE not in f'{p.body}{p.title}'.lower() and sub != 'chudrama':
if v.agendaposter and not v.marseyawarded and v.agendaposter_phrase not in f'{p.body}{p.title}'.lower() and sub != 'chudrama':
p.is_banned = True
p.ban_reason = "AutoJanny"
body = AGENDAPOSTER_MSG.format(username=v.username, type='post', AGENDAPOSTER_PHRASE=AGENDAPOSTER_PHRASE)
body = AGENDAPOSTER_MSG.format(username=v.username, type='post', AGENDAPOSTER_PHRASE=v.agendaposter_phrase)
body_jannied_html = AGENDAPOSTER_MSG_HTML.format(id=v.id, username=v.username, type='post', AGENDAPOSTER_PHRASE=AGENDAPOSTER_PHRASE)
body_jannied_html = AGENDAPOSTER_MSG_HTML.format(id=v.id, username=v.username, type='post', AGENDAPOSTER_PHRASE=v.agendaposter_phrase)
c_jannied = Comment(author_id=AUTOJANNY_ID,
@ -1043,8 +1043,8 @@ def edit_post(pid, v):
p.body_html = body_html
if v.id == p.author_id and v.agendaposter and not v.marseyawarded and AGENDAPOSTER_PHRASE not in f'{p.body}{p.title}'.lower() and p.sub != 'chudrama':
abort(403, f'You have to include "{AGENDAPOSTER_PHRASE}" in your post!')
if v.id == p.author_id and v.agendaposter and not v.marseyawarded and v.agendaposter_phrase not in f'{p.body}{p.title}'.lower() and p.sub != 'chudrama':
abort(403, f'You have to include "{v.agendaposter_phrase}" in your post!')
if v.id == p.author_id:

View File

@ -37,8 +37,24 @@
{{iterate_awards(v.awards_author_effect)}}
</div>
</div>
<label id="notelabel" for="note" class="pt-4">Note (optional):</label>
<input autocomplete="off" id="kind" hidden>
{% set CHUD_PHRASES = ["Trans lives matter", "Black lives matter", "Black trans lives matter"] %}
<div id="phrase_section" class="d-none">
<label for="note" class="pt-4">The phrase the recipient will have to say:</label>
<div class="input-group">
<select autocomplete="off" id='agendaposter_phrase' class="form-control">
{% for entry in CHUD_PHRASES %}
<option value="{{entry}}">
{{entry}}
</option>
{% endfor %}
</select>
</div>
</div>
<label id="notelabel" for="note" class="pt-4">Note (optional):</label>
<textarea autocomplete="off" id="note" maxlength="200" class="form-control" placeholder="Note to include in award notification..."></textarea>
<input autocomplete="off" id="giveaward" class="awardbtn btn btn-primary mt-3 fl-r" type="submit" data-nonce="{{g.nonce}}" data-onclick="giveaward(this)" value="Give Award" data-bs-dismiss="modal" disabled>

View File

@ -0,0 +1 @@
alter table users add column agendaposter_phrase varchar(100);