add custom snappy quotes for patron donating $50/mo or higher

master
Aevann 2024-04-11 07:46:09 +02:00
parent 21b0814d2b
commit dc61bd9d47
11 changed files with 66 additions and 7 deletions

View File

@ -129,6 +129,7 @@ class User(Base):
defaulttime = Column(String, default=DEFAULT_TIME_FILTER)
custom_filter_list = Column(String)
keyword_notifs = Column(String)
snappy_quotes = deferred(Column(String))
original_username = Column(String)
extra_username = Column(String)
prelock_username = Column(String)

View File

@ -60,7 +60,10 @@ def execute_snappy(post, v):
post_ping_group_count = len(list(group_mention_regex.finditer(post.body)))
if SITE_NAME == 'rDrama' and (v.post_count <= 3 or v.new_user):
if post.author.snappy_quotes:
quotes = post.author.snappy_quotes.split("[para]")
body = random.choice(quotes).strip()
elif SITE_NAME == 'rDrama' and (v.post_count <= 3 or v.new_user):
body = "Hey, I saw that you just joined rdrama and a group of people who hate me are trying to smear my name by calling me a date male feminist. I just wanted to let you know that it's not true. If you want all the receipts proving it they're right here.\nThe TL;DR is that I hooked up with one of the hot girls on rdrama, and since I was twice her age, a lot of the guys here who wanted to bang her got jealous and assumed that the only way I could have managed that was by raping her, even though she herself said both before and afterwards that it was all completely consensual. So now that you're the new hot girl on rdrama, I guess they think that I'm going to somehow seduce you into flying all the way across the country (or some crazy shit like that) to hook up with me and they're trying to talk shit about me to make sure that doesnt happen. I don't understand it either, but I just wanted to let you know that I'm a nice guy and I hope you'll look at the evidence and make up your own mind instead of listening to all the jealous haters.\nAnyway, with that little intro out of the way, welcome to rdrama! The culture's a little rough here and you're probably going to get tons of requests to •show boobsU but if you talk to some of the women here first before engaging with all the creepy dudes, they'll give you some good advice to avoid stalkers and predators. Or (If you haven't been scared off by the rumor mill) you're welcome to ask me and I'm happy to help.\nJust out of curiosity, how did you find this place?"
elif post.hole and post.hole_obj.snappy_quotes:
quotes = post.hole_obj.snappy_quotes.split("[para]")

View File

@ -445,7 +445,7 @@ POST_SORTS = COMMENT_SORTS | {
HOLE_NAME_COLUMN_LENGTH = 25
HOLE_SIDEBAR_COLUMN_LENGTH = 10000
HOLE_SIDEBAR_HTML_COLUMN_LENGTH = 20000
HOLE_SNAPPY_QUOTES_LENGTH = 20000
CUSTOM_SNAPPY_QUOTES_LENGTH = 20000
HOLE_SIDEBAR_URL_COLUMN_LENGTH = 60
HOLE_BANNER_URL_COLUMN_LENGTH = 60
HOLE_MARSEY_URL_LENGTH = 60

View File

@ -324,6 +324,7 @@ def _award_timers_task():
User.patron: 0,
User.extra_username: None,
User.keyword_notifs: None,
User.snappy_quotes: None,
})
_process_timer(User.chud, [58], "Your temporary chud status has expired!", {
User.chud_phrase: None,

View File

@ -953,8 +953,8 @@ def post_hole_snappy_quotes(v, hole):
if snappy_quotes.endswith('[para]'):
snappy_quotes = snappy_quotes[:-6].strip()
if len(snappy_quotes) > HOLE_SNAPPY_QUOTES_LENGTH:
abort(400, f"Quotes are too long (max {HOLE_SNAPPY_QUOTES_LENGTH} characters)")
if len(snappy_quotes) > CUSTOM_SNAPPY_QUOTES_LENGTH:
abort(400, f"Quotes are too long (max {CUSTOM_SNAPPY_QUOTES_LENGTH} characters)")
hole.snappy_quotes = snappy_quotes
g.db.add(hole)

View File

@ -205,6 +205,6 @@ def inject_constants():
"CURSORMARSEY_DEFAULT":CURSORMARSEY_DEFAULT, "SNAPPY_ID":SNAPPY_ID, "ZOZBOT_ID":ZOZBOT_ID, "get_running_orgy":get_running_orgy,
"bar_position":bar_position, "datetime":datetime, "CSS_LENGTH_LIMIT":CSS_LENGTH_LIMIT, "cache":cache,
"emoji_count":emoji_count, "group_count":group_count, "user_count":user_count,
"HOLE_SIDEBAR_COLUMN_LENGTH":HOLE_SIDEBAR_COLUMN_LENGTH, "HOLE_SNAPPY_QUOTES_LENGTH":HOLE_SNAPPY_QUOTES_LENGTH,
"HOLE_SIDEBAR_COLUMN_LENGTH":HOLE_SIDEBAR_COLUMN_LENGTH, "CUSTOM_SNAPPY_QUOTES_LENGTH":CUSTOM_SNAPPY_QUOTES_LENGTH,
"top_poster_of_the_day":top_poster_of_the_day,
}

View File

@ -437,6 +437,35 @@ def keyword_notifs(v):
g.db.add(v)
return {"message": "Your keyword notifications have been updated!"}
@app.post("/settings/snappy_quotes")
@limiter.limit('1/second', scope=rpath)
@limiter.limit('1/second', scope=rpath, key_func=get_ID)
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
@auth_required
def snappy_quotes(v):
if v.patron < 5:
abort(403, f"Custom Snappy quotes are only available to {patron}s donating $50/month or higher!")
snappy_quotes = request.values.get("snappy_quotes", "").replace('\r','').strip()
if snappy_quotes.endswith('[para]'):
snappy_quotes = snappy_quotes[:-6].strip()
if snappy_quotes == v.snappy_quotes:
abort(400, "You didn't change anything!")
if len(snappy_quotes) > CUSTOM_SNAPPY_QUOTES_LENGTH:
abort(400, f"Quotes are too long (max {CUSTOM_SNAPPY_QUOTES_LENGTH} characters)")
if not snappy_quotes:
snappy_quotes = None
v.snappy_quotes = snappy_quotes
g.db.add(v)
return {"message": "Your custom Snappy quotes have been updated!"}
def set_color(v, attr):
color = request.values.get(attr)

View File

@ -148,6 +148,7 @@
<ul>
<li>Everything from previous tiers</li>
<li>Keyword notifications</li>
<li>Custom Snappy quotes</li>
<li>25% discount when buying awards</li>
{% if v or SITE != 'rdrama.net' %}
<li><del>25,000</del> 32,500 marseybux monthly (can be used in the shop, casino, and other places)</li>

View File

@ -84,9 +84,9 @@
<div class="w-lg-100">
<form id="snappy_quotes" action="/h/{{hole}}/snappy_quotes" method="post" data-nonce="{{g.nonce}}" data-onsubmit="sendFormXHR(this)">
<input hidden name="formkey" value="{{v|formkey}}" class="notranslate" translate="no">
<textarea autocomplete="off" maxlength="{{HOLE_SNAPPY_QUOTES_LENGTH}}" class="form-control rounded dont-resize" id="hole-snappy" placeholder="Enter Snappy Quotes here..." rows="10" name="snappy_quotes" form="snappy_quotes">{% if snappy_quotes %}{{snappy_quotes}}{% endif %}</textarea>
<textarea autocomplete="off" maxlength="{{CUSTOM_SNAPPY_QUOTES_LENGTH}}" class="form-control rounded dont-resize" id="hole-snappy" placeholder="Enter Snappy Quotes here..." rows="10" name="snappy_quotes" form="snappy_quotes">{% if snappy_quotes %}{{snappy_quotes}}{% endif %}</textarea>
<small>Separate quotes with <code>[para]</code></small>
<p><small>Limit of {{HOLE_SNAPPY_QUOTES_LENGTH}} characters</small></p>
<p><small>Limit of {{CUSTOM_SNAPPY_QUOTES_LENGTH}} characters</small></p>
<div class="d-flex mt-2">
<input autocomplete="off" class="btn btn-primary ml-auto" type="submit" value="Save">
</div>

View File

@ -201,6 +201,29 @@
</div>
</section>
<section id="site-settings-snappy-quotes" class="settings-section-section">
<h5>Custom Snappy Quotes</h5>
<div class="settings-section rounded">
<div id="snappy-quotes-section" class="d-lg-flex border-bottom">
<div class="title w-lg-25">
<label for="snappy-quotes">Custom Snappy Quotes</label>
</div>
<div class="body w-lg-100">
<form id="snappy-quotes" action="/settings/snappy_quotes" method="post" data-nonce="{{g.nonce}}" data-onsubmit="sendFormXHR(this)">
<input hidden name="formkey" value="{{v|formkey}}" class="notranslate" translate="no">
<small>Enter things you would like <a href="/id/{{SNAPPY_ID}}" rel="nofollow"><img src="/pp/2">@Snappy</a> to reply to your posts with.</small>
<textarea autocomplete="off" class="form-control rounded my-2" placeholder="Add your own custom Snappy quotes."
rows="3" name="snappy_quotes" form="snappy-quotes" maxlength="1000">{% if v.snappy_quotes %}{{v.snappy_quotes}}{% endif %}</textarea>
<small>Separate quotes with <code>[para]</code>. Limit of {{CUSTOM_SNAPPY_QUOTES_LENGTH}} characters</small>
<div class="d-flex">
<input autocomplete="off" class="btn btn-primary ml-auto" type="submit" value="Save Changes">
</div>
</form>
</div>
</div>
</div>
</section>
<section id="site-settings-sort-time-filter-section" class="settings-section-section">
<h5>RSS Feed</h5>
<p class="text-small text-muted">Subscribe to the {{SITE_NAME}} RSS feed.</p>

View File

@ -0,0 +1 @@
alter table users add column snappy_quotes varchar(20000);