change the name

pull/154/head
Chuck Sneed 2023-06-18 17:35:45 -05:00
parent 573a92441e
commit 457f8b2b11
5 changed files with 97 additions and 6 deletions

View File

@ -115,6 +115,62 @@ GIRL_PHRASES = [
"$, karen",
"$ but its whatever"
]
GIRL_NAME_PREFIX = [
'the',
'a',
'another',
'justA',
'one',
'that',
'itsA',
'theOnly'
]
GIRL_NAME_ADJECTIVE = [
'starry',
'serene',
'sweet',
'pretty',
'cute',
'chonky',
'fuzzy',
'bitchy',
'slutty',
'lovely',
'comfy',
'hot',
'funky',
'polite',
'cute',
'sexy',
'silver',
'juicy',
'magical',
'nice',
'normal'
]
GIRL_NAME_NOUN = [
'crown',
'throne',
'lake',
'tree',
'candy',
'gal',
'idol',
'teddy',
'queen',
'girl',
'woman',
'lady',
'ghost',
'friend',
'doll',
'bear',
'witch',
'bitch',
'duck',
'cottage',
'fairy',
]
SLURS = {
"(?<!\\bs)nigger": "BIPOC",

View File

@ -209,7 +209,10 @@ def _award_timers_task():
_process_timer(User.earlylife, [169], "The earlylife award you received has expired!")
_process_timer(User.marsify, [170], "The marsify award you received has expired!")
_process_timer(User.rainbow, [171], "The rainbow award you received has expired!")
_process_timer(User.misogynist, [999], "The misogynist award you received has expired!")
_process_timer(User.misogynist, [999], "The misogynist award you received has expired!", {
User.username: User.prelock_username,
User.prelock_username: None,
})
_process_timer(User.spider, [179], "The spider award you received has expired!")
_process_timer(User.namechanged, [281], "The namelock award you received has expired. You're now back to your old username!", {
User.username: User.prelock_username,

View File

@ -315,6 +315,9 @@ def award_thing(v, thing_type, id):
elif kind == "misogynist":
if author.agendaposter:
abort(409, f"{safe_username} is under the effect of a conflicting award: Chud award!")
if author.namechanged:
abort(409, f"{safe_username} is under the effect of a conflicting award: Namelock award!")
if author.marseyawarded:
abort(409, f"{safe_username} is under the effect of a conflicting award: Marsey award!")
@ -325,6 +328,30 @@ 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 not author.misogynist:
adjective = GIRL_NAME_ADJECTIVE[author.id%20].capitalize()
noun = GIRL_NAME_NOUN[(int(author.id/20))%20].capitalize()
prefix = GIRL_NAME_PREFIX[(int((id/20)/20))%8]
prefix = prefix[0].upper() + prefix[1:]
number = int(((author.id/20)/20)/8)
new_name = f"{prefix}{adjective}{noun}"+ (str(number) if number > 0 else "")
if not valid_username_regex.fullmatch(new_name):
new_name = f"SomeWeirdGirl{random.randrange(100000)}"
existing = get_user(new_name, graceful=True)
if existing and existing.id != author.id:
if len(new_name) < 23:
new_name = f"{new_name}_{random.randrange(pow(10, 23-len(new_name)))}"
else:
new_name = f"SomeQuirkyGirl{random.randrange(100000)}"
if not author.prelock_username:
author.prelock_username = author.username
author.username = new_name
if author.misogynist and time.time() < author.misogynist: author.misogynist += 86400
else: author.misogynist = int(time.time()) + 86400
@ -375,6 +402,10 @@ def award_thing(v, thing_type, id):
author.flairchanged = int(time.time()) + 86400
badge_grant(user=author, badge_id=96)
elif kind == "namelock":
if author.misogynist:
abort(409, f"{safe_username} is under the effect of a conflicting award: Misogynist award!")
new_name = note.strip().lstrip('@')
if not new_name and author.namechanged:
author.namechanged += 86400
@ -519,3 +550,4 @@ def award_thing(v, thing_type, id):
g.db.add(author)
return {"message": f"{AWARDS[kind]['title']} award given to {thing_type} successfully!"}

View File

@ -721,7 +721,7 @@ def settings_advanced_get(v:User):
@limiter.limit(DEFAULT_RATELIMIT, key_func=get_ID)
@is_not_permabanned
def settings_name_change(v):
if v.namechanged: abort(403)
if v.namechanged or v.misogynist: abort(403)
if v.shadowbanned: abort(500)

View File

@ -163,10 +163,10 @@
<p>Your original username will always stay reserved for you: <code>{{v.original_username}}</code></p>
<form action="/settings/name_change" method="post">
<input hidden name="formkey" value="{{v|formkey}}">
<input id="name-body" autocomplete="off" type="text" name="name" class="form-control" value="{{v.username}}" {% if v.namechanged %}disabled{% endif %}>
<input id="name-body" autocomplete="off" type="text" name="name" class="form-control" value="{{v.username}}" {% if v.namechanged or v.misogynist %}disabled{% endif %}>
<small>3-25 characters, including letters, numbers, _ , and -</small>
<div class="d-flex mt-2">
<input autocomplete="off" class="btn btn-primary ml-auto" type="submit" value="Change Display Name" {% if v.namechanged %}disabled{% endif %}>
<input autocomplete="off" class="btn btn-primary ml-auto" type="submit" value="Change Display Name" {% if v.namechanged or v.misogynist%}disabled{% endif %}>
</div>
</form>
</div>
@ -271,8 +271,8 @@
<script defer src="{{'js/flairchanged.js' | asset}}"></script>
{% endif %}
{% if v.namechanged %}
<input hidden id="namechanged" value="{{v.namechanged}}">
{% if v.namechanged or v.misogynist%}
<input hidden id="namechanged" value="{{v.namechanged if v.namechanged else v.misogynist}}">
<script defer src="{{'js/namechanged.js' | asset}}"></script>
{% endif %}