Add the edgy award (and some other goodies) (#157)

# The Edgy Award
* Makes text bold, italic, and red, symbolizing the fire that burns within.
* Adds "fucking" to various places, after articles and prepositional phrases (I think) (tbh I just eyeballed it). EX: He is the fucking best
* Adds "motherfucker" and "bitch" to exclamations and questions, respectively.

# Goodies
* For the queen award:
	* based => comfy
    * Xpilled => x vibes
    * Xmaxxing => normalizing X

Co-authored-by: Chuck Sneed <sneed@formerlychucks.net>
Reviewed-on: #157
Co-authored-by: HeyMoon <heymoon@noreply.fsdfsd.net>
Co-committed-by: HeyMoon <heymoon@noreply.fsdfsd.net>
pull/158/head
HeyMoon 2023-06-26 14:38:48 +00:00 committed by Aevann
parent 9baefd8107
commit 36779a7ad1
15 changed files with 101 additions and 7 deletions

View File

@ -6676,6 +6676,12 @@ g {
text-transform: lowercase !important;
}
.sharpen:not(a) {
color: red !important;
font-weight: bold !important;
font-style: italic !important;
}
.rainbow-text:not(a) > p {
color: transparent !important;
}

View File

@ -155,6 +155,7 @@ class User(Base):
bite = Column(Integer, default=0)
earlylife = Column(Integer, default=0)
owoify = Column(Integer, default=0)
sharpen = Column(Integer, default=0)
marsify = Column(Integer, default=0)
rainbow = Column(Integer, default=0)
spider = Column(Integer, default=0)

View File

@ -494,7 +494,6 @@ AWARDS = {
"ghost": False,
"enabled": SITE_NAME != 'rDrama',
},
"rehab": {
"kind": "rehab",
"title": "Rehab",
@ -507,6 +506,18 @@ AWARDS = {
"ghost": False,
"enabled": True,
},
"sharpen": {
"kind": "sharpen",
"title": "Sharpen",
"description": "Adds a badass edge to all user's comments",
"icon": "fas fa-fire",
"color": "text-danger",
"price": 500,
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": True,
},
"flairlock": {
"kind": "flairlock",
"title": "1-Day Flairlock",

View File

@ -1112,6 +1112,7 @@ forced_hats = {
"bite": ("Vampire Mask", "When other little girls wanted to be ballet dancers I kind of wanted to be a vampire."),
"rainbow": ("Globohomo", "Homosexuality is no longer optional!"),
"owoify": ("Cat Ears (wiggly)", "Nuzzles, pounces on you, UwU, you're so warm!.."),
"sharpen": ("Bane Mask", "No one understands..."),
"earlylife": ("The Merchant", "SHUT IT DOWN, the goys know!"),
"marsify": ("Marsified", "I can't pick my own Marseys, help!"),
"is_suspended": ("Behind Bars", "This user is banned and needs to do better!"),

View File

@ -202,6 +202,7 @@ def _award_timers_task():
_process_timer(User.marseyawarded, [98], "The marsey award you received has expired!")
_process_timer(User.rehab, [109], "The rehab award you received has expired!")
_process_timer(User.owoify, [167], "The OwOify award you received has expired!")
_process_timer(User.sharpen, [289], "The Sharpen award you received has expired!")
_process_timer(User.bite, [168], "The bite award you received has expired! You're now back in your original house!", {
User.house: User.old_house,
User.old_house: '',

View File

@ -82,8 +82,29 @@ like_before_regex = re.compile('(?<=^|(?<=\s))(?<!like )(just|only)(?=$|\n|\s|[.
like_after_regex = re.compile('(?<=^|(?<=\s))(i mean)(?! like)(?=$|\n|\s|[.?!,])', flags=re.I|re.A)
#match ! or ? but only if it isn't touching another ! or ?, or is in front of a letter
single_repeatable_punctuation = re.compile('(?<!!|\?)(!|\?)(?!!|\?)(?=\s|$)', flags=re.I|re.A)
#match "redpilled", to turn into "goodpilled" (extremely jankpilled but its whatever). Group 2 contained "ed" if exists
redpilled_regex = re.compile('(?<=^|(?<=\s))(redpill(ed)*)(?=$|\n|\s|[.?!,])', flags=re.I|re.A)
#match "based and Xpilled". To be turned into "comfy X vibes". Note that "X" is in group 2. No conditional "ed", "ed" will always be present
based_and_x_pilled_regex = re.compile('(?<=^|(?<=\s))(based and ([a-zA-Z]*)pilled)(?=$|\n|\s|[.?!,])', flags=re.I|re.A)
#match "based" to "comfy"
based_regex = re.compile('(?<=^|(?<=\s))(based)(?=$|\n|\s|[.?!,])', flags=re.I|re.A)
#match "Xpilled". To be turned into "X vibes". Note that "X" is in group 2, "ed" in group 3
x_pilled_regex = re.compile('(?<=^|(?<=\s))(([a-zA-Z]+)pill(ed)?)(?=$|\n|\s|[.?!,])', flags=re.I|re.A)
#match "Xmaxxx". To be turned into "normalize good Xs". Note that "X" is in group 2, "s" (after X) in group 3
xmax_regex = re.compile('(?<=^|(?<=\s))(([a-zA-Z]+?)(s)?max*)(?=$|\n|\s|[.?!,])', flags=re.I|re.A)
#same as above, except "Xmaxxed" this time (b/c I have crippling OCD and "normalized" isn't "normalize" + "ed") :marseyrage:
xmaxed_regex = re.compile('(?<=^|(?<=\s))(([a-zA-Z]+?)(s)?max*ed)(?=$|\n|\s|[.?!,])', flags=re.I|re.A)
#same as above, except "Xmaxxing" this time
xmaxing_regex = re.compile('(?<=^|(?<=\s))(([a-zA-Z]+?)(s)?max*ing)(?=$|\n|\s|[.?!,])', flags=re.I|re.A)
initial_part_regex = re.compile('(?<=^)(>+)', flags=re.I|re.A)
#matches "the" or is, but only if it is not followed by "fucking". https://regex101.com/r/yxuYsQ/2
the_fucking_regex = re.compile('(?<=^|(?<=\s))((?:the|a)( (?:only))?|((that )?(?:is|are|was|were|will be|would be)( (?:your|her|his|their|no|a|not|to|too|so|this|the|our|what))?( (a|the))?)|is)(?=\s)(?! fucking)', flags=re.I|re.A)
#matches a single question mark but only if it isn't preceded by ", bitch"
bitch_question_mark_regex = re.compile('(?<!\?|\!)(?<!, bitch)(\?)(?!!|\?)(?=\s|$)', flags=re.I|re.A)
#matches a single exclamation point but only if it isn't preceded by ", motherfucker"
exclamation_point_regex = re.compile('(?<!!|\?)(?<!, motherfucker)(!)(?!!|\?)(?=\s|$)', flags=re.I|re.A)
image_check_regex = re.compile(f'!\[\]\(((?!(https:\/\/({hosts})\/|\/)).*?)\)', flags=re.A)
video_regex_extensions = '|'.join(VIDEO_FORMATS)

View File

@ -701,6 +701,14 @@ def torture_queen(string, key):
string = greeting_regex.sub(r"hiiiiiiiiii", string)
string = like_after_regex.sub(r"\g<1> like", string)
string = like_before_regex.sub(r"like \g<1>", string)
string = redpilled_regex.sub(r"goodpill\g<2>", string)
string = based_and_x_pilled_regex.sub(r"comfy \g<2> vibes", string)
string = based_regex.sub(r"comfy", string)
string = x_pilled_regex.sub(r"\g<2> vibes", string)
string = xmax_regex.sub(r"normalize good \g<2>s", string)
string = xmaxing_regex.sub(r"normalizing good \g<2>s", string)
string = xmaxed_regex.sub(r"normalized good \g<2>s", string)
string = normal_punctuation_regex.sub("", string)
string = more_than_one_comma_regex.sub(",", string)
if string[-5:] == ', and':

View File

@ -0,0 +1,8 @@
import re
from files.helpers.regex import *
def sharpen(string):
string = the_fucking_regex.sub("\g<1> fucking", string)
string = bitch_question_mark_regex.sub(", bitch?", string)
string = exclamation_point_regex.sub(", motherfucker!", string)
return string

View File

@ -13,6 +13,7 @@ from files.helpers.config.awards import AWARDS_ENABLED, HOUSE_AWARDS, LOOTBOX_IT
from files.helpers.get import *
from files.helpers.marsify import marsify
from files.helpers.owoify import owoify
from files.helpers.sharpen import sharpen
from files.helpers.regex import *
from files.helpers.sanitize import filter_emojis_only
from files.helpers.useractions import *
@ -330,6 +331,9 @@ def award_thing(v, thing_type, id):
if author.owoify:
abort(409, f"{safe_username} is under the effect of a conflicting award: OwOify award!")
if author.sharpen:
abort(409, f"{safe_username} is under the effect of a conflicting award: Sharpen!")
if not author.queen:
characters = list(filter(str.isalpha, author.username))
if characters:
@ -376,6 +380,9 @@ def award_thing(v, thing_type, id):
if author.owoify:
abort(409, f"{safe_username} is under the effect of a conflicting award: OwOify award!")
if author.sharpen:
abort(409, f"{safe_username} is under the effect of a conflicting award: Sharpen!")
if author.chud == 1:
abort(409, f"{safe_username} is already chudded permanently!")
@ -495,7 +502,8 @@ def award_thing(v, thing_type, id):
abort(409, f"{safe_username} is under the effect of a conflicting award: Chud award!")
if author.queen:
abort(409, f"{safe_username} is under the effect of a conflicting award: Queen award!")
if author.sharpen:
abort(409, f"{safe_username} is under the effect of a conflicting award: Sharpen!")
if not author.marsify or author.marsify != 1:
if author.marsify: author.marsify += 86400
else: author.marsify = int(time.time()) + 86400
@ -527,6 +535,8 @@ def award_thing(v, thing_type, id):
abort(409, f"{safe_username} is under the effect of a conflicting award: Chud award!")
if author.queen:
abort(409, f"{safe_username} is under the effect of a conflicting award: Queen award!")
if author.sharpen:
abort(409, f"{safe_username} is under the effect of a conflicting award: Sharpen!")
if author.owoify: author.owoify += 21600
else: author.owoify = int(time.time()) + 21600
@ -538,6 +548,21 @@ def award_thing(v, thing_type, id):
if author.marsify: body = marsify(body)
thing.body_html = sanitize(body, limit_pings=5, showmore=True)
g.db.add(thing)
elif kind == 'sharpen':
if author.chud:
abort(409, f"{safe_username} is under the effect of a conflicting award: Chud award!")
if author.queen:
abort(409, f"{safe_username} is under the effect of a conflicting award: Queen award!")
if author.sharpen: author.sharpen += 21600
else: author.sharpen = int(time.time()) + 21600
badge_grant(user=author, badge_id=289)
if thing_type == 'comment' and not thing.author.deflector:
body = thing.body
body = sharpen(body)
thing.body_html = sanitize(body, limit_pings=5, showmore=True)
g.db.add(thing)
elif ("Femboy" in kind and kind == v.house) or kind == 'rainbow':
if author.rainbow: author.rainbow += 86400
else: author.rainbow = int(time.time()) + 86400

View File

@ -14,6 +14,7 @@ from files.helpers.get import *
from files.helpers.marsify import marsify
from files.helpers.media import *
from files.helpers.owoify import owoify
from files.helpers.sharpen import sharpen
from files.helpers.regex import *
from files.helpers.slots import *
from files.helpers.treasure import *
@ -239,6 +240,7 @@ def comment(v:User):
body_for_sanitize = body
if v.owoify: body_for_sanitize = owoify(body_for_sanitize)
if v.marsify: body_for_sanitize = marsify(body_for_sanitize)
if v.sharpen: body_for_sanitize = sharpen(body_for_sanitize)
body_html = sanitize(body_for_sanitize, limit_pings=5, showmore=True, count_emojis=not v.marsify)
@ -634,6 +636,8 @@ def edit_comment(cid, v):
body_for_sanitize = owoify(body_for_sanitize)
if v.marsify:
body_for_sanitize = marsify(body_for_sanitize)
if v.sharpen:
body_for_sanitize = sharpen(body_for_sanitize)
body_html = sanitize(body_for_sanitize, golden=False, limit_pings=5, showmore=True)

View File

@ -246,7 +246,7 @@
{% endif %}
{% set realbody = c.realbody(v) %}
<div id="comment-text-{{c.id}}" class="comment-text mb-0 {% if c.chudded %}text-uppercase chud-img chud-{{c.id_last_num}}{% endif %} {% if c.author.rainbow %}rainbow-text{% endif %} {%if c.author.queen%}queen{%endif%}">
<div id="comment-text-{{c.id}}" class="comment-text mb-0 {% if c.chudded %}text-uppercase chud-img chud-{{c.id_last_num}}{% endif %} {% if c.author.rainbow %}rainbow-text{% endif %} {%if c.author.queen%}queen{%endif%} {%if c.author.sharpen%}sharpen{%endif%}">
{{realbody | safe}}
</div>
{% if c.parent_post or c.wall_user_id %}

View File

@ -81,13 +81,13 @@
{% if p.realurl(v) and not v_forbid_deleted %}
<h1 id="post-title" class="card-title post-title text-left mb-md-3 {% if p.chudded %}text-uppercase{% endif %}">
<a {% if p.author.rainbow %}class="rainbow-text"{% endif %} {%if p.author.queen%}queen{%endif%} {% if not v or v.newtabexternal %}target="_blank"{% endif %} rel="nofollow noopener" href="{{p.realurl(v)}}">
<a {% if p.author.rainbow %}class="rainbow-text"{% endif %} {%if p.author.queen%}queen{%endif%} {%if p.author.sharpen%}sharpen{%endif%} {% if not v or v.newtabexternal %}target="_blank"{% endif %} rel="nofollow noopener" href="{{p.realurl(v)}}">
{% if p.flair %}<span class="patron font-weight-bolder mr-1" style="background-color:var(--primary); font-size:12px; line-height:2;">{{p.flair | safe}}</span>{% endif %}
{{p.realtitle(v) | safe}}
</a>
</h1>
{% else %}
<h1 id="post-title" class="card-title post-title text-left mb-md-3 {% if p.chudded %}text-uppercase{% endif %} {% if p.author.rainbow %}rainbow-text{% endif %} {%if p.author.queen%}queen{%endif%}">
<h1 id="post-title" class="card-title post-title text-left mb-md-3 {% if p.chudded %}text-uppercase{% endif %} {% if p.author.rainbow %}rainbow-text{% endif %} {%if p.author.queen%}queen{%endif%} {%if p.author.sharpen%}sharpen{%endif%}">
{% if p.flair %}<span class="patron font-weight-bolder mr-1" style="background-color:var(--primary); font-size:12px; line-height:2;">{{p.flair | safe}}</span>{% endif %}
{{p.realtitle(v) | safe}}
</h1>
@ -117,7 +117,7 @@
{% endif %}
<div id="post-text" class="{% if p.chudded %}text-uppercase chud-img chud-{{p.id_last_num}}{% endif %} {% if p.author.rainbow %}rainbow-text{% endif %} {%if p.author.queen%}queen{%endif%}">
<div id="post-text" class="{% if p.chudded %}text-uppercase chud-img chud-{{p.id_last_num}}{% endif %} {% if p.author.rainbow %}rainbow-text{% endif %} {%if p.author.queen%}queen{%endif%} {%if p.author.sharpen%}sharpen{%endif%}">
{% if p.is_image %}
<div class="row no-gutters mb-4">
<div class="col">

View File

@ -208,7 +208,7 @@
{% if not v_forbid_deleted %}
{% if p.realbody(v, listing=True) %}
<div class="d-none card rounded border {% if p.chudded %}text-uppercase chud-img chud-{{p.id_last_num}}{% endif %} {% if p.author.rainbow %}rainbow-text{% endif %} {%if p.author.queen%}queen{%endif%} post-preview" id="post-text-{{p.id}}">
<div class="d-none card rounded border {% if p.chudded %}text-uppercase chud-img chud-{{p.id_last_num}}{% endif %} {% if p.author.rainbow %}rainbow-text{% endif %} {%if p.author.queen%}queen{%endif%} {%if p.author.sharpen%}sharpen{%endif%} post-preview" id="post-text-{{p.id}}">
{{p.realbody(v, listing=True) | safe}}
</div>
{% endif %}

View File

@ -0,0 +1 @@
alter table users add column sharpen integer;

View File

@ -236,6 +236,7 @@ CREATE TABLE public.users (
bite integer,
old_house character varying(16),
owoify integer,
sharpen integer,
marsify integer,
is_muted boolean DEFAULT false NOT NULL,
coins_spent_on_hats integer DEFAULT 0 NOT NULL,
@ -2280,6 +2281,12 @@ CREATE INDEX users_original_username_trgm_idx ON public.users USING gin (origina
CREATE INDEX users_owoify_idx ON public.users USING btree (owoify);
--
-- Name: users_edgified_idx; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX users_edgified_idx ON public.users USING btree (sharpen);
--
-- Name: users_patron_utc_idx; Type: INDEX; Schema: public; Owner: -