Add the sharpen award

pull/157/head
Chuck Sneed 2023-06-25 17:59:36 -05:00
parent 3b271cf1be
commit 3813c0b4cf
10 changed files with 68 additions and 2 deletions

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, [], "The Sharpen award you received has expired!") #TODO: badge
_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

@ -98,6 +98,13 @@ xmaxed_regex = re.compile('(?<=^|(?<=\s))(([a-zA-Z]+?)(s)?max*ed)(?=$|\n|\s|[.?!
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"
the_fucking_regex = re.compile('(?<=^|(?<=\s))(the|is)(?! fucking)(?=$|\n|\s|[.?!,])', 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

@ -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=167) #TODO: badge
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

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