Aevann 2024-07-21 21:19:28 +03:00
parent 868045365f
commit a370b7c5c1
8 changed files with 13 additions and 7 deletions

View File

@ -756,7 +756,7 @@ class User(Base):
text += f"{days}d {hours:02d}h {mins:02d}m"
return f'''{text} - chud phrase: "{self.chud_phrase[0].upper()}{self.chud_phrase[1:].replace('israel', 'Israel').replace('ukraine', 'Ukraine').replace('ccp', 'CCP')}"'''
return f'''{text} - chud phrase: "{capitalize_chud_phrase(self.chud_phrase)}"'''
@property
@lazy

View File

@ -161,7 +161,7 @@ def execute_snappy(post, v):
)
g.db.add(award_object)
msg = f"@Snappy has given {post.textlink} the Chud Award\n\n**You now have to say this phrase in all posts and comments you make for 24 hours:**\n\n> Trans lives matter"
msg = f"@Snappy has given {post.textlink} the Chud Award\n\n**You now have to say this phrase in all posts and comments you make for 24 hours:**\n\n`Trans lives matter`"
send_repeatable_notification(post.author.id, msg)
if v.chud != 1:

View File

@ -1132,6 +1132,9 @@ CHUD_PHRASES = ( #if you add a phrase, remove one in turn
"Communism will win",
)
def capitalize_chud_phrase(chud_phrase):
return capitalize_first(chud_phrase).replace('israel', 'Israel').replace('ukraine', 'Ukraine').replace('ccp', 'CCP')
HEADERS = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"}
GIRL_NAMES = { #Lists on purpose
@ -1184,4 +1187,7 @@ with open("includes/content-security-policy", "w") as f:
def commas(number):
return "{:,}".format(number)
def capitalize_first(str):
return str[0].upper() + str[1:]
AMERICAS_CODES = {'AI','AG','AR','AW','BS','BB','BZ','BM','BO','BQ','BV','BR','CA','KY','CL','CO','CR','CU','CW','DM','DO','EC','SV','FK','GF','GL','GD','GP','GT','GY','HT','HN','JM','MQ','MX','MS','NI','PA','PY','PE','PR','BL','KN','LC','MF','PM','VC','SX','GS','SR','TT','TC','US','UY','VE','VG','VI'}

View File

@ -121,7 +121,7 @@ def sub_matcher(match, X_FOR_REPLACING):
if match_str.isupper():
return repl.upper()
if match_str[0].isupper():
return repl[0].upper() + repl[1:]
return capitalize_first(repl)
return repl
def sub_matcher_slurs(match):

View File

@ -1146,7 +1146,7 @@ def chud(fullname, v):
text = f"@{v.username} (a site admin) has chudded you **{duration}**"
if reason: text += f" for the following reason:\n\n> {reason}"
text += f"\n\n**You now have to say this phrase in all posts and comments you make {duration}:**\n\n> {user.chud_phrase}"
text += f"\n\n**You now have to say this phrase in all posts and comments you make {duration}:**\n\n`{capitalize_chud_phrase(user.chud_phrase)}`"
user.chudded_by = v.id
g.db.add(user)

View File

@ -686,7 +686,7 @@ def award_thing(v, thing_type, id):
note = '\n\n> '.join(note.splitlines())
if kind == "chud":
msg += f"\n\n**You now have to say this phrase in all posts and comments you make for {24*quantity} hours:**"
msg += f"\n\n> {note}"
msg += f"\n\n`{note}`"
n = send_repeatable_notification(author.id, msg)
if n: n.created_utc -= 2

View File

@ -272,7 +272,7 @@ def comment(v):
c.ban_reason = "AutoJanny"
g.db.add(c)
body = random.choice(CHUD_MSGS).format(username=v.username, type='comment', CHUD_PHRASE=v.chud_phrase)
body = random.choice(CHUD_MSGS).format(username=v.username, type='comment', CHUD_PHRASE=capitalize_chud_phrase(v.chud_phrase))
body_jannied_html = sanitize(body)
c_jannied = Comment(author_id=AUTOJANNY_ID,

View File

@ -681,7 +681,7 @@ def submit_post(v, hole=None):
p.is_banned = True
p.ban_reason = "AutoJanny"
body = random.choice(CHUD_MSGS).format(username=v.username, type='post', CHUD_PHRASE=v.chud_phrase)
body = random.choice(CHUD_MSGS).format(username=v.username, type='post', CHUD_PHRASE=capitalize_chud_phrase(v.chud_phrase))
body_jannied_html = sanitize(body)